From bfe9bf38e7e86d0952389b1e587a1dc39d1529bd Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Fri, 14 Oct 2016 17:26:47 -0700 Subject: [PATCH] 0.9.3 --- dist/ngl.js | 56 ++++++++++++++++++++++++++-------------------------- package.json | 2 +- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/dist/ngl.js b/dist/ngl.js index 301a9285e..b5bf1e52a 100644 --- a/dist/ngl.js +++ b/dist/ngl.js @@ -1,28 +1,28 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.NGL=t.NGL||{})}(this,function(t){"use strict";function e(){}function i(t,e){return function(){t.apply(e,arguments)}}function n(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],u(t,this)}function r(t,e){for(;3===t._state;)t=t._value;return 0===t._state?void t._deferreds.push(e):(t._handled=!0,void Wu(function(){var i=1===t._state?e.onFulfilled:e.onRejected;if(null===i)return void(1===t._state?o:a)(e.promise,t._value);var n;try{n=i(t._value)}catch(t){return void a(e.promise,t)}o(e.promise,n)}))}function o(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var r=e.then;if(e instanceof n)return t._state=3,t._value=e,void s(t);if("function"==typeof r)return void u(i(r,e),t)}t._state=1,t._value=e,s(t)}catch(e){a(t,e)}}function a(t,e){t._state=2,t._value=e,s(t)}function s(t){2===t._state&&0===t._deferreds.length&&Wu(function(){t._handled||Xu(t._value)});for(var e=0,i=t._deferreds.length;e1?c.pop().toLowerCase():"",h=e.match(/^(.+):\/\/(.+)$/);h&&(n=h[1].toLowerCase(),e=h[2]);var l=e.substring(0,e.lastIndexOf("/")+1);if(r.includes(u)){i=u;var d=e.length-u.length-1;u=e.substr(0,d).split(".").pop().toLowerCase();var f=s.length-u.length-1;s=s.substr(0,f)}else i=!1;return{path:e,name:a,ext:u,base:s,dir:l,compressed:i,protocol:n,src:t}}function b(t,e,i){var n,r,o,a=null,s=0;i||(i={});var c=function(){s=i.leading===!1?0:Date.now(),a=null,o=t.apply(n,r),a||(n=r=null)};return function(){var u=Date.now();s||i.leading!==!1||(s=u);var h=e-(u-s);return n=this,r=arguments,h<=0||h>e?(a&&(clearTimeout(a),a=null),s=u,o=t.apply(n,r),a||(n=r=null)):a||i.trailing===!1||(a=setTimeout(c,h)),o}}function x(t){return t.sort().filter(function(t,e,i){return 0===e||t!==i[e-1]})}function _(t){var e=28672;if(t.length>e){for(var i=[],n=0;n0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function D(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._w=void 0!==n?n:1}function N(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0}function k(t,e){function i(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),e=new Uint16Array([0,1,2,0,2,3]);o=l.createBuffer(),a=l.createBuffer(),l.bindBuffer(l.ARRAY_BUFFER,o),l.bufferData(l.ARRAY_BUFFER,t,l.STATIC_DRAW),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,a),l.bufferData(l.ELEMENT_ARRAY_BUFFER,e,l.STATIC_DRAW),s=n(),c={position:l.getAttribLocation(s,"position"),uv:l.getAttribLocation(s,"uv")},u={uvOffset:l.getUniformLocation(s,"uvOffset"),uvScale:l.getUniformLocation(s,"uvScale"),rotation:l.getUniformLocation(s,"rotation"),scale:l.getUniformLocation(s,"scale"),color:l.getUniformLocation(s,"color"),map:l.getUniformLocation(s,"map"),opacity:l.getUniformLocation(s,"opacity"),modelViewMatrix:l.getUniformLocation(s,"modelViewMatrix"),projectionMatrix:l.getUniformLocation(s,"projectionMatrix"),fogType:l.getUniformLocation(s,"fogType"),fogDensity:l.getUniformLocation(s,"fogDensity"),fogNear:l.getUniformLocation(s,"fogNear"),fogFar:l.getUniformLocation(s,"fogFar"),fogColor:l.getUniformLocation(s,"fogColor"),alphaTest:l.getUniformLocation(s,"alphaTest")};var i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");i.width=8,i.height=8;var r=i.getContext("2d");r.fillStyle="white",r.fillRect(0,0,8,8),h=new L(i),h.needsUpdate=!0}function n(){var e=l.createProgram(),i=l.createShader(l.VERTEX_SHADER),n=l.createShader(l.FRAGMENT_SHADER);return l.shaderSource(i,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),l.shaderSource(n,["precision "+t.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),l.compileShader(i),l.compileShader(n),l.attachShader(e,i),l.attachShader(e,n),l.linkProgram(e),e}function r(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var o,a,s,c,u,h,l=t.context,d=t.state,f=new N,p=new D,m=new N;this.render=function(n,g){if(0!==e.length){void 0===s&&i(),l.useProgram(s),d.initAttributes(),d.enableAttribute(c.position),d.enableAttribute(c.uv),d.disableUnusedAttributes(),d.disable(l.CULL_FACE),d.enable(l.BLEND),l.bindBuffer(l.ARRAY_BUFFER,o),l.vertexAttribPointer(c.position,2,l.FLOAT,!1,16,0),l.vertexAttribPointer(c.uv,2,l.FLOAT,!1,16,8),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,a),l.uniformMatrix4fv(u.projectionMatrix,!1,g.projectionMatrix.elements),d.activeTexture(l.TEXTURE0),l.uniform1i(u.map,0);var v=0,y=0,b=n.fog;b?(l.uniform3f(u.fogColor,b.color.r,b.color.g,b.color.b),b&&b.isFog?(l.uniform1f(u.fogNear,b.near),l.uniform1f(u.fogFar,b.far),l.uniform1i(u.fogType,1),v=1,y=1):b&&b.isFogExp2&&(l.uniform1f(u.fogDensity,b.density),l.uniform1i(u.fogType,2),v=2,y=2)):(l.uniform1i(u.fogType,0),v=0,y=0);for(var x=0,_=e.length;x<_;x++){var w=e[x];w.modelViewMatrix.multiplyMatrices(g.matrixWorldInverse,w.matrixWorld),w.z=-w.modelViewMatrix.elements[14]}e.sort(r);for(var S=[],x=0,_=e.length;x<_;x++){var w=e[x],A=w.material;if(A.visible!==!1){l.uniform1f(u.alphaTest,A.alphaTest),l.uniformMatrix4fv(u.modelViewMatrix,!1,w.modelViewMatrix.elements),w.matrixWorld.decompose(f,p,m),S[0]=m.x,S[1]=m.y;var M=0;n.fog&&A.fog&&(M=y),v!==M&&(l.uniform1i(u.fogType,M),v=M),null!==A.map?(l.uniform2f(u.uvOffset,A.map.offset.x,A.map.offset.y),l.uniform2f(u.uvScale,A.map.repeat.x,A.map.repeat.y)):(l.uniform2f(u.uvOffset,0,0),l.uniform2f(u.uvScale,1,1)),l.uniform1f(u.opacity,A.opacity),l.uniform3f(u.color,A.color.r,A.color.g,A.color.b),l.uniform1f(u.rotation,A.rotation),l.uniform2fv(u.scale,S),d.setBlending(A.blending,A.blendEquation,A.blendSrc,A.blendDst),d.setDepthTest(A.depthTest),d.setDepthWrite(A.depthWrite),A.map?t.setTexture2D(A.map,0):t.setTexture2D(h,0),l.drawElements(l.TRIANGLES,6,l.UNSIGNED_SHORT,0)}}d.enable(l.CULL_FACE),t.resetGLState()}}}function F(t,e){this.min=void 0!==t?t:new I(+(1/0),+(1/0)),this.max=void 0!==e?e:new I(-(1/0),-(1/0))}function z(t,e){function i(){var t=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),e=new Uint16Array([0,1,2,0,2,3]);r=d.createBuffer(),o=d.createBuffer(),d.bindBuffer(d.ARRAY_BUFFER,r),d.bufferData(d.ARRAY_BUFFER,t,d.STATIC_DRAW),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,o),d.bufferData(d.ELEMENT_ARRAY_BUFFER,e,d.STATIC_DRAW),h=d.createTexture(),l=d.createTexture(),f.bindTexture(d.TEXTURE_2D,h),d.texImage2D(d.TEXTURE_2D,0,d.RGB,16,16,0,d.RGB,d.UNSIGNED_BYTE,null),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.NEAREST),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.NEAREST),f.bindTexture(d.TEXTURE_2D,l),d.texImage2D(d.TEXTURE_2D,0,d.RGBA,16,16,0,d.RGBA,d.UNSIGNED_BYTE,null),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.NEAREST),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.NEAREST),a={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},s=n(a),c={vertex:d.getAttribLocation(s,"position"),uv:d.getAttribLocation(s,"uv")},u={renderType:d.getUniformLocation(s,"renderType"),map:d.getUniformLocation(s,"map"),occlusionMap:d.getUniformLocation(s,"occlusionMap"),opacity:d.getUniformLocation(s,"opacity"),color:d.getUniformLocation(s,"color"),scale:d.getUniformLocation(s,"scale"),rotation:d.getUniformLocation(s,"rotation"),screenPosition:d.getUniformLocation(s,"screenPosition")}}function n(e){var i=d.createProgram(),n=d.createShader(d.FRAGMENT_SHADER),r=d.createShader(d.VERTEX_SHADER),o="precision "+t.getPrecision()+" float;\n";return d.shaderSource(n,o+e.fragmentShader),d.shaderSource(r,o+e.vertexShader),d.compileShader(n),d.compileShader(r),d.attachShader(i,n),d.attachShader(i,r),d.linkProgram(i),i}var r,o,a,s,c,u,h,l,d=t.context,f=t.state;this.render=function(n,a,p){if(0!==e.length){var m=new N,g=p.w/p.z,v=.5*p.z,y=.5*p.w,b=16/p.w,x=new I(b*g,b),_=new N(1,1,0),w=new I(1,1),S=new F;S.min.set(0,0),S.max.set(p.z-16,p.w-16),void 0===s&&i(),d.useProgram(s),f.initAttributes(),f.enableAttribute(c.vertex),f.enableAttribute(c.uv),f.disableUnusedAttributes(),d.uniform1i(u.occlusionMap,0),d.uniform1i(u.map,1),d.bindBuffer(d.ARRAY_BUFFER,r),d.vertexAttribPointer(c.vertex,2,d.FLOAT,!1,16,0),d.vertexAttribPointer(c.uv,2,d.FLOAT,!1,16,8),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,o),f.disable(d.CULL_FACE),f.setDepthWrite(!1);for(var A=0,M=e.length;A.001&&E.scale>.001&&(_.x=E.x,_.y=E.y,_.z=E.z,b=E.size*E.scale/p.w,x.x=b*g,x.y=b,d.uniform3f(u.screenPosition,_.x,_.y,_.z),d.uniform2f(u.scale,x.x,x.y),d.uniform1f(u.rotation,E.rotation),d.uniform1f(u.opacity,E.opacity),d.uniform3f(u.color,E.color.r,E.color.g,E.color.b),f.setBlending(E.blending,E.blendEquation,E.blendSrc,E.blendDst),t.setTexture2D(E.texture,1),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0))}}}f.enable(d.CULL_FACE),f.enable(d.DEPTH_TEST),f.setDepthWrite(!0),t.resetGLState()}}}function B(t,e,i,n,r,o,a,s,c,u){t=void 0!==t?t:[],e=void 0!==e?e:Yh,L.call(this,t,e,i,n,r,o,a,s,c,u),this.flipY=!1}function U(){this.seq=[],this.map={}}function j(t,e,i){var n=t[0];if(n<=0||n>0)return t;var r=e*i,o=hd[r];if(void 0===o&&(o=new Float32Array(r),hd[r]=o),0!==e){n.toArray(o,0);for(var a=1,s=0;a!==e;++a)s+=i,t[a].toArray(o,s)}return o}function $(t,e){var i=ld[e];void 0===i&&(i=new Int32Array(e),ld[e]=i);for(var n=0;n!==e;++n)i[n]=t.allocTextureUnit();return i}function V(t,e){t.uniform1f(this.addr,e)}function G(t,e){t.uniform1i(this.addr,e)}function H(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function W(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function X(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function q(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function Y(t,e){t.uniformMatrix3fv(this.addr,!1,e.elements||e)}function Z(t,e){t.uniformMatrix4fv(this.addr,!1,e.elements||e)}function K(t,e,i){var n=i.allocTextureUnit();t.uniform1i(this.addr,n),i.setTexture2D(e||cd,n)}function Q(t,e,i){var n=i.allocTextureUnit();t.uniform1i(this.addr,n),i.setTextureCube(e||ud,n)}function J(t,e){t.uniform2iv(this.addr,e)}function tt(t,e){t.uniform3iv(this.addr,e)}function et(t,e){t.uniform4iv(this.addr,e)}function it(t){switch(t){case 5126:return V;case 35664:return H;case 35665:return W;case 35666:return X;case 35674:return q;case 35675:return Y;case 35676:return Z;case 35678:return K;case 35680:return Q;case 5124:case 35670:return G;case 35667:case 35671:return J;case 35668:case 35672:return tt;case 35669:case 35673:return et}}function nt(t,e){t.uniform1fv(this.addr,e)}function rt(t,e){t.uniform1iv(this.addr,e)}function ot(t,e){t.uniform2fv(this.addr,j(e,this.size,2))}function at(t,e){t.uniform3fv(this.addr,j(e,this.size,3))}function st(t,e){t.uniform4fv(this.addr,j(e,this.size,4))}function ct(t,e){t.uniformMatrix2fv(this.addr,!1,j(e,this.size,4))}function ut(t,e){t.uniformMatrix3fv(this.addr,!1,j(e,this.size,9))}function ht(t,e){t.uniformMatrix4fv(this.addr,!1,j(e,this.size,16))}function lt(t,e,i){var n=e.length,r=$(i,n);t.uniform1iv(this.addr,r);for(var o=0;o!==n;++o)i.setTexture2D(e[o]||cd,r[o])}function dt(t,e,i){var n=e.length,r=$(i,n);t.uniform1iv(this.addr,r);for(var o=0;o!==n;++o)i.setTextureCube(e[o]||ud,r[o])}function ft(t){switch(t){case 5126:return nt;case 35664:return ot;case 35665:return at;case 35666:return st;case 35674:return ct;case 35675:return ut;case 35676:return ht;case 35678:return lt;case 35680:return dt;case 5124:case 35670:return rt;case 35667:case 35671:return J;case 35668:case 35672:return tt;case 35669:case 35673:return et}}function pt(t,e,i){this.id=t,this.addr=i,this.setValue=it(e.type)}function mt(t,e,i){this.id=t,this.addr=i,this.size=e.size,this.setValue=ft(e.type)}function gt(t){this.id=t,U.call(this)}function vt(t,e){t.seq.push(e),t.map[e.id]=e}function yt(t,e,i){var n=t.name,r=n.length;for(dd.lastIndex=0;;){var o=dd.exec(n),a=dd.lastIndex,s=o[1],c="]"===o[2],u=o[3];if(c&&(s=0|s),void 0===u||"["===u&&a+2===r){vt(i,void 0===u?new pt(s,t,e):new mt(s,t,e));break}var h=i.map,l=h[s];void 0===l&&(l=new gt(s),vt(i,l)),i=l}}function bt(t,e,i){U.call(this),this.renderer=i;for(var n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r=0;r!==n;++r){var o=t.getActiveUniform(e,r),a=o.name,s=t.getUniformLocation(e,a);yt(o,s,this)}}function xt(t,e,i,n,r,o,a){function s(t,e){if(t.width>e||t.height>e){var i=e/Math.max(t.width,t.height),n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");n.width=Math.floor(t.width*i),n.height=Math.floor(t.height*i);var r=n.getContext("2d");return r.drawImage(t,0,0,t.width,t.height,0,0,n.width,n.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+n.width+"x"+n.height,t),n}return t}function c(t){return ad.isPowerOfTwo(t.width)&&ad.isPowerOfTwo(t.height)}function u(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");e.width=ad.nearestPowerOfTwo(t.width),e.height=ad.nearestPowerOfTwo(t.height);var i=e.getContext("2d");return i.drawImage(t,0,0,e.width,e.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+e.width+"x"+e.height,t),e}return t}function h(t){return t.wrapS!==nl||t.wrapT!==nl||t.minFilter!==ol&&t.minFilter!==cl}function l(e){return e===ol||e===al||e===sl?t.NEAREST:t.LINEAR}function d(t){var e=t.target;e.removeEventListener("dispose",d),p(e),C.textures--}function f(t){var e=t.target;e.removeEventListener("dispose",f),m(e),C.textures--}function p(e){var i=n.get(e);if(e.image&&i.__image__webglTextureCube)t.deleteTexture(i.__image__webglTextureCube);else{if(void 0===i.__webglInit)return;t.deleteTexture(i.__webglTexture)}n.delete(e)}function m(e){var i=n.get(e),r=n.get(e.texture);if(e){if(void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e&&e.isWebGLRenderTargetCube)for(var o=0;o<6;o++)t.deleteFramebuffer(i.__webglFramebuffer[o]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[o]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer);n.delete(e.texture),n.delete(e)}}function g(e,r){var o=n.get(e);if(e.version>0&&o.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(a.complete!==!1)return void x(o,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}i.activeTexture(t.TEXTURE0+r),i.bindTexture(t.TEXTURE_2D,o.__webglTexture)}function v(e,a){var u=n.get(e);if(6===e.image.length)if(e.version>0&&u.__version!==e.version){u.__image__webglTextureCube||(e.addEventListener("dispose",d),u.__image__webglTextureCube=t.createTexture(),C.textures++),i.activeTexture(t.TEXTURE0+a),i.bindTexture(t.TEXTURE_CUBE_MAP,u.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var h=e&&e.isCompressedTexture,l=e.image[0]&&e.image[0].isDataTexture,f=[],p=0;p<6;p++)h||l?f[p]=l?e.image[p].image:e.image[p]:f[p]=s(e.image[p],r.maxCubemapSize);var m=f[0],g=c(m),v=o(e.format),y=o(e.type);b(t.TEXTURE_CUBE_MAP,e,g);for(var p=0;p<6;p++)if(h)for(var x,_=f[p].mipmaps,w=0,S=_.length;w-1?i.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,w,v,x.width,x.height,0,x.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,w,v,x.width,x.height,0,v,y,x.data);else l?i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,v,f[p].width,f[p].height,0,v,y,f[p].data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,v,v,y,f[p]);e.generateMipmaps&&g&&t.generateMipmap(t.TEXTURE_CUBE_MAP),u.__version=e.version,e.onUpdate&&e.onUpdate(e)}else i.activeTexture(t.TEXTURE0+a),i.bindTexture(t.TEXTURE_CUBE_MAP,u.__image__webglTextureCube)}function y(e,r){i.activeTexture(t.TEXTURE0+r),i.bindTexture(t.TEXTURE_CUBE_MAP,n.get(e).__webglTexture)}function b(i,a,s){var c;if(s?(t.texParameteri(i,t.TEXTURE_WRAP_S,o(a.wrapS)),t.texParameteri(i,t.TEXTURE_WRAP_T,o(a.wrapT)),t.texParameteri(i,t.TEXTURE_MAG_FILTER,o(a.magFilter)),t.texParameteri(i,t.TEXTURE_MIN_FILTER,o(a.minFilter))):(t.texParameteri(i,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(i,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),a.wrapS===nl&&a.wrapT===nl||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",a),t.texParameteri(i,t.TEXTURE_MAG_FILTER,l(a.magFilter)),t.texParameteri(i,t.TEXTURE_MIN_FILTER,l(a.minFilter)),a.minFilter!==ol&&a.minFilter!==cl&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",a)),c=e.get("EXT_texture_filter_anisotropic")){if(a.type===vl&&null===e.get("OES_texture_float_linear"))return;if(a.type===yl&&null===e.get("OES_texture_half_float_linear"))return;(a.anisotropy>1||n.get(a).__currentAnisotropy)&&(t.texParameterf(i,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),n.get(a).__currentAnisotropy=a.anisotropy)}}function x(e,n,a){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",d),e.__webglTexture=t.createTexture(),C.textures++),i.activeTexture(t.TEXTURE0+a),i.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,n.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,n.unpackAlignment);var l=s(n.image,r.maxTextureSize);h(n)&&c(l)===!1&&(l=u(l));var f=c(l),p=o(n.format),m=o(n.type);b(t.TEXTURE_2D,n,f);var g,v=n.mipmaps;if(n&&n.isDepthTexture){var y=t.DEPTH_COMPONENT;if(n.type===vl){if(!T)throw new Error("Float Depth Texture only supported in WebGL2.0");y=t.DEPTH_COMPONENT32F}else T&&(y=t.DEPTH_COMPONENT16);n.format===El&&(y=t.DEPTH_STENCIL),i.texImage2D(t.TEXTURE_2D,0,y,l.width,l.height,0,p,m,null)}else if(n&&n.isDataTexture)if(v.length>0&&f){for(var x=0,_=v.length;x<_;x++)g=v[x],i.texImage2D(t.TEXTURE_2D,x,p,g.width,g.height,0,p,m,g.data);n.generateMipmaps=!1}else i.texImage2D(t.TEXTURE_2D,0,p,l.width,l.height,0,p,m,l.data);else if(n&&n.isCompressedTexture)for(var x=0,_=v.length;x<_;x++)g=v[x],n.format!==Ml&&n.format!==Al?i.getCompressedTextureFormats().indexOf(p)>-1?i.compressedTexImage2D(t.TEXTURE_2D,x,p,g.width,g.height,0,g.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(t.TEXTURE_2D,x,p,g.width,g.height,0,p,m,g.data);else if(v.length>0&&f){for(var x=0,_=v.length;x<_;x++)g=v[x],i.texImage2D(t.TEXTURE_2D,x,p,p,m,g);n.generateMipmaps=!1}else i.texImage2D(t.TEXTURE_2D,0,p,p,m,l);n.generateMipmaps&&f&&t.generateMipmap(t.TEXTURE_2D),e.__version=n.version,n.onUpdate&&n.onUpdate(n)}function _(e,r,a,s){var c=o(r.texture.format),u=o(r.texture.type);i.texImage2D(s,0,c,r.width,r.height,0,c,u,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,a,s,n.get(r.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function w(e,i){t.bindRenderbuffer(t.RENDERBUFFER,e),i.depthBuffer&&!i.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,i.width,i.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)):i.depthBuffer&&i.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,i.width,i.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,i.width,i.height),t.bindRenderbuffer(t.RENDERBUFFER,null)}function S(e,i){var r=i&&i.isWebGLRenderTargetCube;if(r)throw new Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,e),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),g(i.depthTexture,0);var o=n.get(i.depthTexture).__webglTexture;if(i.depthTexture.format===Tl)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,o,0);else{if(i.depthTexture.format!==El)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,o,0)}}function A(e){var i=n.get(e),r=e&&e.isWebGLRenderTargetCube;if(e.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");S(i.__webglFramebuffer,e)}else if(r){i.__webglDepthbuffer=[];for(var o=0;o<6;o++)t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer[o]),i.__webglDepthbuffer[o]=t.createRenderbuffer(),w(i.__webglDepthbuffer[o],e)}else t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),w(i.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}function M(e){var r=n.get(e),o=n.get(e.texture);e.addEventListener("dispose",f),o.__webglTexture=t.createTexture(),C.textures++;var a=e&&e.isWebGLRenderTargetCube,s=c(e);if(a){r.__webglFramebuffer=[];for(var u=0;u<6;u++)r.__webglFramebuffer[u]=t.createFramebuffer()}else r.__webglFramebuffer=t.createFramebuffer();if(a){i.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),b(t.TEXTURE_CUBE_MAP,e.texture,s);for(var u=0;u<6;u++)_(r.__webglFramebuffer[u],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+u);e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_CUBE_MAP),i.bindTexture(t.TEXTURE_CUBE_MAP,null)}else i.bindTexture(t.TEXTURE_2D,o.__webglTexture),b(t.TEXTURE_2D,e.texture,s),_(r.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_2D),i.bindTexture(t.TEXTURE_2D,null);e.depthBuffer&&A(e)}function P(e){var r=e.texture;if(r.generateMipmaps&&c(e)&&r.minFilter!==ol&&r.minFilter!==cl){var o=e&&e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,a=n.get(r).__webglTexture;i.bindTexture(o,a),t.generateMipmap(o),i.bindTexture(o,null)}}var C=a.memory,T="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext;this.setTexture2D=g,this.setTextureCube=v,this.setTextureCubeDynamic=y,this.setupRenderTarget=M,this.updateRenderTargetMipmap=P}function _t(t,e,i,n){this.x=t||0,this.y=e||0,this.z=i||0,this.w=void 0!==n?n:1}function wt(t,e,i){function n(){var e=!1,i=new _t,n=null,r=new _t;return{setMask:function(i){ -n===i||e||(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,o,a){i.set(e,n,o,a),r.equals(i)===!1&&(t.clearColor(e,n,o,a),r.copy(i))},reset:function(){e=!1,n=null,r.set(0,0,0,1)}}}function r(){var e=!1,i=null,n=null,r=null;return{setTest:function(e){e?d(t.DEPTH_TEST):f(t.DEPTH_TEST)},setMask:function(n){i===n||e||(t.depthMask(n),i=n)},setFunc:function(e){if(n!==e){if(e)switch(e){case Rh:t.depthFunc(t.NEVER);break;case Oh:t.depthFunc(t.ALWAYS);break;case Dh:t.depthFunc(t.LESS);break;case Nh:t.depthFunc(t.LEQUAL);break;case kh:t.depthFunc(t.EQUAL);break;case Fh:t.depthFunc(t.GEQUAL);break;case zh:t.depthFunc(t.GREATER);break;case Bh:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);n=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,i=null,n=null,r=null}}}function o(){var e=!1,i=null,n=null,r=null,o=null,a=null,s=null,c=null,u=null;return{setTest:function(e){e?d(t.STENCIL_TEST):f(t.STENCIL_TEST)},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,a){n===e&&r===i&&o===a||(t.stencilFunc(e,i,a),n=e,r=i,o=a)},setOp:function(e,i,n){a===e&&s===i&&c===n||(t.stencilOp(e,i,n),a=e,s=i,c=n)},setLocked:function(t){e=t},setClear:function(e){u!==e&&(t.clearStencil(e),u=e)},reset:function(){e=!1,i=null,n=null,r=null,o=null,a=null,s=null,c=null,u=null}}}function a(e,i,n){var r=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var a=0;a0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function Rt(t,e){this.normal=void 0!==t?t:new N(1,0,0),this.constant=void 0!==e?e:0}function Ot(t,e,i,n,r,o){this.planes=[void 0!==t?t:new Rt,void 0!==e?e:new Rt,void 0!==i?i:new Rt,void 0!==n?n:new Rt,void 0!==r?r:new Rt,void 0!==o?o:new Rt]}function Dt(t,e,i,n){function r(e,i,n,r){var o=e.geometry,a=null,s=b,c=e.customDepthMaterial;if(n&&(s=x,c=e.customDistanceMaterial),c)a=c;else{var u=!1;i.morphTargets&&(o&&o.isBufferGeometry?u=o.morphAttributes&&o.morphAttributes.position&&o.morphAttributes.position.length>0:o&&o.isGeometry&&(u=o.morphTargets&&o.morphTargets.length>0));var h=e.isSkinnedMesh&&i.skinning,l=0;u&&(l|=g),h&&(l|=v),a=s[l]}if(t.localClippingEnabled&&i.clipShadows===!0&&0!==i.clippingPlanes.length){var d=a.uuid,f=i.uuid,p=_[d];void 0===p&&(p={},_[d]=p);var m=p[f];void 0===m&&(m=a.clone(),p[f]=m),a=m}a.visible=i.visible,a.wireframe=i.wireframe;var y=i.side;return k.renderSingleSided&&y==rh&&(y=ih),k.renderReverseSided&&(y===ih?y=nh:y===nh&&(y=ih)),a.side=y,a.clipShadows=i.clipShadows,a.clippingPlanes=i.clippingPlanes,a.wireframeLinewidth=i.wireframeLinewidth,a.linewidth=i.linewidth,n&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(r),a}function o(t,e,i){if(t.visible!==!1){var n=0!==(t.layers.mask&e.layers.mask);if(n&&(t.isMesh||t.isLine||t.isPoints)&&t.castShadow&&(t.frustumCulled===!1||c.intersectsObject(t)===!0)){var r=t.material;r.visible===!0&&(t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),m.push(t))}for(var a=t.children,s=0,u=a.length;s");return Xt(i)}var i=/#include +<([\w\d.]+)>/g;return t.replace(i,e)}function qt(t){function e(t,e,i,n){for(var r="",o=parseInt(e);o0?t.gammaFactor:1,g=$t(o,n,t.extensions),v=Vt(a),y=r.createProgram();i.isRawShaderMaterial?(f=[v,"\n"].filter(Ht).join("\n"),p=[g,v,"\n"].filter(Ht).join("\n")):(f=["precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+i.__webglShader.name,v,n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+m,"#define MAX_BONES "+n.maxBones,n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(Ht).join("\n"),p=[g,"precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+i.__webglShader.name,v,n.alphaTest?"#define ALPHATEST "+n.alphaTest:"","#define GAMMA_FACTOR "+m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.envMap?"#define "+l:"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",n.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",n.toneMapping!==Vh?"#define TONE_MAPPING":"",n.toneMapping!==Vh?fp.tonemapping_pars_fragment:"",n.toneMapping!==Vh?jt("toneMapping",n.toneMapping):"",n.outputEncoding||n.mapEncoding||n.envMapEncoding||n.emissiveMapEncoding?fp.encodings_pars_fragment:"",n.mapEncoding?Bt("mapTexelToLinear",n.mapEncoding):"",n.envMapEncoding?Bt("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?Bt("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.outputEncoding?Ut("linearToOutputTexel",n.outputEncoding):"",n.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Ht).join("\n")),s=Xt(s,n),s=Wt(s,n),c=Xt(c,n),c=Wt(c,n),i.isShaderMaterial||(s=qt(s),c=qt(c));var b=f+s,x=p+c,_=kt(r,r.VERTEX_SHADER,b),w=kt(r,r.FRAGMENT_SHADER,x);r.attachShader(y,_),r.attachShader(y,w),void 0!==i.index0AttributeName?r.bindAttribLocation(y,0,i.index0AttributeName):n.morphTargets===!0&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y);var S=r.getProgramInfoLog(y),A=r.getShaderInfoLog(_),M=r.getShaderInfoLog(w),P=!0,C=!0;r.getProgramParameter(y,r.LINK_STATUS)===!1?(P=!1,console.error("THREE.WebGLProgram: shader error: ",r.getError(),"gl.VALIDATE_STATUS",r.getProgramParameter(y,r.VALIDATE_STATUS),"gl.getProgramInfoLog",S,A,M)):""!==S?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",S):""!==A&&""!==M||(C=!1),C&&(this.diagnostics={runnable:P,material:i,programLog:S,vertexShader:{log:A,prefix:f},fragmentShader:{log:M,prefix:p}}),r.deleteShader(_),r.deleteShader(w);var T;this.getUniforms=function(){return void 0===T&&(T=new bt(r,y,t)),T};var E;return this.getAttributes=function(){return void 0===E&&(E=Gt(r,y)),E},this.destroy=function(){r.deleteProgram(y),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=vp++,this.code=e,this.usedTimes=1,this.program=y,this.vertexShader=_,this.fragmentShader=w,this}function Zt(t,e){function i(t){if(e.floatVertexTextures&&t&&t.skeleton&&t.skeleton.useVertexTexture)return 1024;var i=e.maxVertexUniforms,n=Math.floor((i-20)/4),r=n;return void 0!==t&&t&&t.isSkinnedMesh&&(r=Math.min(t.skeleton.bones.length,r),r0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===rh,flipSided:r.side===nh,depthPacking:void 0!==r.depthPacking&&r.depthPacking};return p},this.getProgramCode=function(t,e){var i=[];if(e.shaderID?i.push(e.shaderID):(i.push(t.fragmentShader),i.push(t.vertexShader)),void 0!==t.defines)for(var n in t.defines)i.push(n),i.push(t.defines[n]);for(var r=0;r65535?Uint32Array:Uint16Array,y=new Kt(new v(o),1);return r(y,t.ELEMENT_ARRAY_BUFFER),n.wireframe=y,y}function u(t,e,i){if(e>i){var n=e;e=i,i=n}var r=t[e];return void 0===r?(t[e]=[i],!0):r.indexOf(i)===-1&&(r.push(i),!0)}var h=new he(t,e,i);return{getAttributeBuffer:s,getWireframeAttribute:c,update:n}}function de(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var i;switch(e.type){case"DirectionalLight":i={direction:new N,color:new Ct,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new I};break;case"SpotLight":i={position:new N,direction:new N,color:new Ct,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new I};break;case"PointLight":i={position:new N,color:new Ct,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new I};break;case"HemisphereLight":i={direction:new N,skyColor:new Ct,groundColor:new Ct}}return t[e.id]=i,i}}}function fe(t,e,i){function n(){if(void 0!==o)return o;var i=e.get("EXT_texture_filter_anisotropic");return o=null!==i?t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o,a=void 0!==i.precision?i.precision:"highp",s=r(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);var c=i.logarithmicDepthBuffer===!0&&!!e.get("EXT_frag_depth"),u=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),l=t.getParameter(t.MAX_TEXTURE_SIZE),d=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),f=t.getParameter(t.MAX_VERTEX_ATTRIBS),p=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),g=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),v=h>0,y=!!e.get("OES_texture_float"),b=v&&y;return{getMaxAnisotropy:n,getMaxPrecision:r,precision:a,logarithmicDepthBuffer:c,maxTextures:u,maxVertexTextures:h,maxTextureSize:l,maxCubemapSize:d,maxAttributes:f,maxVertexUniforms:p,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:b}}function pe(t){var e={};return{get:function(i){if(void 0!==e[i])return e[i];var n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":n=t.getExtension("WEBGL_compressed_texture_etc1");break;default:n=t.getExtension(i)}return null===n&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),e[i]=n,n}}}function me(t,e,i){function n(t){s=t}function r(i){i.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(c=t.UNSIGNED_INT,u=4):(c=t.UNSIGNED_SHORT,u=2)}function o(e,n){t.drawElements(s,n,c,e*u),i.calls++,i.vertices+=n,s===t.TRIANGLES&&(i.faces+=n/3)}function a(n,r,o){var a=e.get("ANGLE_instanced_arrays");return null===a?void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(a.drawElementsInstancedANGLE(s,o,c,r*u,n.maxInstancedCount),i.calls++,i.vertices+=o*n.maxInstancedCount,void(s===t.TRIANGLES&&(i.faces+=n.maxInstancedCount*o/3)))}var s,c,u;return{setMode:n,setIndex:r,render:o,renderInstances:a}}function ge(){function t(){u.value!==n&&(u.value=n,u.needsUpdate=r>0),i.numPlanes=r}function e(t,e,n,r){var o=null!==t?t.length:0,a=null;if(0!==o){if(a=u.value,r!==!0||null===a){var h=n+4*o,l=e.matrixWorldInverse;c.getNormalMatrix(l),(null===a||a.length0?1:-1,p[g]=I.x,p[g+1]=I.y,p[g+2]=I.z,m[v]=O/c,m[v+1]=1-L/h,g+=3,v+=2,T+=1}for(L=0;L65535?Uint32Array:Uint16Array)(l),f=new Float32Array(3*h),p=new Float32Array(3*h),m=new Float32Array(2*h),g=0,v=0,y=0,b=0,x=0;c("z","y","x",-1,-1,i,e,t,o,r,0),c("z","y","x",1,-1,i,e,-t,o,r,1),c("x","z","y",1,1,t,i,e,n,o,2),c("x","z","y",1,-1,t,i,-e,n,o,3),c("x","y","z",1,-1,t,e,i,n,r,4),c("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(new Kt(d,1)),this.addAttribute("position",new Kt(f,3)),this.addAttribute("normal",new Kt(p,3)),this.addAttribute("uv",new Kt(m,2))}function be(t,e){this.origin=void 0!==t?t:new N,this.direction=void 0!==e?e:new N}function xe(t,e){this.start=void 0!==t?t:new N,this.end=void 0!==e?e:new N}function _e(t,e,i){this.a=void 0!==t?t:new N,this.b=void 0!==e?e:new N,this.c=void 0!==i?i:new N}function we(t){At.call(this),this.type="MeshBasicMaterial",this.color=new Ct(16777215),this.map=null,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Uh,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function Se(t,e){re.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new ue,this.material=void 0!==e?e:new we({color:16777215*Math.random()}),this.drawMode=ql,this.updateMorphTargets()}function Ae(t,e,i,n){ue.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};for(var r=t/2,o=e/2,a=Math.floor(i)||1,s=Math.floor(n)||1,c=a+1,u=s+1,h=t/a,l=e/s,d=new Float32Array(c*u*3),f=new Float32Array(c*u*3),p=new Float32Array(c*u*2),m=0,g=0,v=0;v65535?Uint32Array:Uint16Array)(a*s*6),v=0;v=0){var h=o[c];if(void 0!==h){var l=Ut.FLOAT,d=h.array,f=h.normalized;d instanceof Float32Array?l=Ut.FLOAT:d instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):d instanceof Uint16Array?l=Ut.UNSIGNED_SHORT:d instanceof Int16Array?l=Ut.SHORT:d instanceof Uint32Array?l=Ut.UNSIGNED_INT:d instanceof Int32Array?l=Ut.INT:d instanceof Int8Array?l=Ut.BYTE:d instanceof Uint8Array&&(l=Ut.UNSIGNED_BYTE);var p=h.itemSize,m=Xt.getAttributeBuffer(h);if(h&&h.isInterleavedBufferAttribute){var g=h.data,v=g.stride,y=h.offset;g&&g.isInstancedInterleavedBuffer?(Gt.enableAttributeAndDivisor(u,g.meshPerAttribute,r),void 0===i.maxInstancedCount&&(i.maxInstancedCount=g.meshPerAttribute*g.count)):Gt.enableAttribute(u),Ut.bindBuffer(Ut.ARRAY_BUFFER,m),Ut.vertexAttribPointer(u,p,l,f,v*g.array.BYTES_PER_ELEMENT,(n*v+y)*g.array.BYTES_PER_ELEMENT)}else h&&h.isInstancedBufferAttribute?(Gt.enableAttributeAndDivisor(u,h.meshPerAttribute,r),void 0===i.maxInstancedCount&&(i.maxInstancedCount=h.meshPerAttribute*h.count)):Gt.enableAttribute(u),Ut.bindBuffer(Ut.ARRAY_BUFFER,m),Ut.vertexAttribPointer(u,p,l,f,0,n*p*h.array.BYTES_PER_ELEMENT)}else if(void 0!==s){var b=s[c];if(void 0!==b)switch(b.length){case 2:Ut.vertexAttrib2fv(u,b);break;case 3:Ut.vertexAttrib3fv(u,b);break;case 4:Ut.vertexAttrib4fv(u,b);break;default:Ut.vertexAttrib1fv(u,b)}}}}Gt.disableUnusedAttributes()}function h(t,e){return Math.abs(e[0])-Math.abs(t[0])}function l(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.material.program&&e.material.program&&t.material.program!==e.material.program?t.material.program.id-e.material.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function d(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function f(t,e,i,n,r){var o,a;i.transparent?(o=K,a=++Q):(o=Y,a=++Z);var s=o[a];void 0!==s?(s.id=t.id,s.object=t,s.geometry=e,s.material=i,s.z=kt.z,s.group=r):(s={id:t.id,object:t,geometry:e,material:i,z:kt.z,group:r},o.push(s))}function p(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Rt.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),g(Rt)}function m(t){return Rt.center.set(0,0,0),Rt.radius=.7071067811865476,Rt.applyMatrix4(t.matrixWorld),g(Rt)}function g(t){if(!Mt.intersectsSphere(t))return!1;var e=Tt.numPlanes;if(0===e)return!0;var i=it.clippingPlanes,n=t.center,r=-t.radius,o=0;do if(i[o].distanceToPoint(n)=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(var d=0;d=0&&t.numSupportedMorphNormals++}var f=n.__webglShader.uniforms;!t.isShaderMaterial&&!t.isRawShaderMaterial|t.clipping===!0&&(n.numClippingPlanes=Tt.numPlanes,f.clippingPlanes=Tt.uniform),n.fog=e,n.lightsHash=zt.hash,t.lights&&(f.ambientLightColor.value=zt.ambient,f.directionalLights.value=zt.directional,f.spotLights.value=zt.spot,f.pointLights.value=zt.point,f.hemisphereLights.value=zt.hemi,f.directionalShadowMap.value=zt.directionalShadowMap,f.directionalShadowMatrix.value=zt.directionalShadowMatrix,f.spotShadowMap.value=zt.spotShadowMap,f.spotShadowMatrix.value=zt.spotShadowMatrix,f.pointShadowMap.value=zt.pointShadowMap,f.pointShadowMatrix.value=zt.pointShadowMatrix);var p=n.program.getUniforms(),m=bt.seqWithValue(p.seq,f);n.uniformsList=m,n.dynamicUniforms=bt.splitDynamic(m,f)}function x(t){t.side===rh?Gt.disable(Ut.CULL_FACE):Gt.enable(Ut.CULL_FACE),Gt.setFlipSided(t.side===nh),t.transparent===!0?Gt.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha):Gt.setBlending(hh),Gt.setDepthFunc(t.depthFunc),Gt.setDepthTest(t.depthTest),Gt.setDepthWrite(t.depthWrite),Gt.setColorWrite(t.colorWrite),Gt.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function _(t,e,i,n){dt=0;var r=Ht.get(i);if(Et&&(Lt||t!==ct)){var o=t===ct&&i.id===at;Tt.setState(i.clippingPlanes,i.clipShadows,t,r,o)}i.needsUpdate===!1&&(void 0===r.program?i.needsUpdate=!0:i.fog&&r.fog!==e?i.needsUpdate=!0:i.lights&&r.lightsHash!==zt.hash?i.needsUpdate=!0:void 0!==r.numClippingPlanes&&r.numClippingPlanes!==Tt.numPlanes&&(i.needsUpdate=!0)),i.needsUpdate&&(b(i,e,n),i.needsUpdate=!1);var a=!1,s=!1,c=!1,u=r.program,h=u.getUniforms(),l=r.__webglShader.uniforms;if(u.id!==nt&&(Ut.useProgram(u.program),nt=u.id,a=!0,s=!0,c=!0),i.id!==at&&(at=i.id,s=!0),a||t!==ct){if(h.set(Ut,t,"projectionMatrix"),Vt.logarithmicDepthBuffer&&h.setValue(Ut,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),t!==ct&&(ct=t,s=!0,c=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.envMap){var d=h.map.cameraPosition;void 0!==d&&d.setValue(Ut,kt.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&h.setValue(Ut,"viewMatrix",t.matrixWorldInverse),h.set(Ut,it,"toneMappingExposure"),h.set(Ut,it,"toneMappingWhitePoint")}if(i.skinning){h.setOptional(Ut,n,"bindMatrix"),h.setOptional(Ut,n,"bindMatrixInverse");var f=n.skeleton;f&&(Vt.floatVertexTextures&&f.useVertexTexture?(h.set(Ut,f,"boneTexture"),h.set(Ut,f,"boneTextureWidth"),h.set(Ut,f,"boneTextureHeight")):h.setOptional(Ut,f,"boneMatrices"))}s&&(i.lights&&L(l,c),e&&i.fog&&P(l,e),(i.isMeshBasicMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.isMeshDepthMaterial)&&w(l,i),i.isLineBasicMaterial?S(l,i):i.isLineDashedMaterial?(S(l,i),A(l,i)):i.isPointsMaterial?M(l,i):i.isMeshLambertMaterial?C(l,i):i.isMeshPhongMaterial?T(l,i):i.isMeshPhysicalMaterial?I(l,i):i.isMeshStandardMaterial?E(l,i):i.isMeshDepthMaterial?i.displacementMap&&(l.displacementMap.value=i.displacementMap,l.displacementScale.value=i.displacementScale,l.displacementBias.value=i.displacementBias):i.isMeshNormalMaterial&&(l.opacity.value=i.opacity),bt.upload(Ut,r.uniformsList,l,it)),h.set(Ut,n,"modelViewMatrix"),h.set(Ut,n,"normalMatrix"),h.setValue(Ut,"modelMatrix",n.matrixWorld);var p=r.dynamicUniforms;return null!==p&&(bt.evalDynamic(p,l,n,t),bt.upload(Ut,p,l,it)),u}function w(t,e){t.opacity.value=e.opacity,t.diffuse.value=e.color,e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),t.map.value=e.map,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var i;if(e.map?i=e.map:e.specularMap?i=e.specularMap:e.displacementMap?i=e.displacementMap:e.normalMap?i=e.normalMap:e.bumpMap?i=e.bumpMap:e.roughnessMap?i=e.roughnessMap:e.metalnessMap?i=e.metalnessMap:e.alphaMap?i=e.alphaMap:e.emissiveMap&&(i=e.emissiveMap),void 0!==i){i.isWebGLRenderTarget&&(i=i.texture);var n=i.offset,r=i.repeat;t.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}function S(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function A(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function M(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*vt,t.scale.value=.5*U.clientHeight,t.map.value=e.map,null!==e.map){var i=e.map.offset,n=e.map.repeat;t.offsetRepeat.value.set(i.x,i.y,n.x,n.y)}}function P(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}function C(t,e){e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function T(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function E(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function I(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,E(t,e)}function L(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLights.needsUpdate=e,t.pointLights.needsUpdate=e,t.spotLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function R(t){for(var e=0,i=0,n=t.length;i=Vt.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+Vt.maxTextures),dt+=1,t}function B(t){var e;if(t===il)return Ut.REPEAT;if(t===nl)return Ut.CLAMP_TO_EDGE;if(t===rl)return Ut.MIRRORED_REPEAT;if(t===ol)return Ut.NEAREST;if(t===al)return Ut.NEAREST_MIPMAP_NEAREST;if(t===sl)return Ut.NEAREST_MIPMAP_LINEAR;if(t===cl)return Ut.LINEAR;if(t===ul)return Ut.LINEAR_MIPMAP_NEAREST;if(t===hl)return Ut.LINEAR_MIPMAP_LINEAR;if(t===ll)return Ut.UNSIGNED_BYTE;if(t===bl)return Ut.UNSIGNED_SHORT_4_4_4_4;if(t===xl)return Ut.UNSIGNED_SHORT_5_5_5_1;if(t===_l)return Ut.UNSIGNED_SHORT_5_6_5;if(t===dl)return Ut.BYTE;if(t===fl)return Ut.SHORT;if(t===pl)return Ut.UNSIGNED_SHORT;if(t===ml)return Ut.INT;if(t===gl)return Ut.UNSIGNED_INT;if(t===vl)return Ut.FLOAT;if(e=$t.get("OES_texture_half_float"),null!==e&&t===yl)return e.HALF_FLOAT_OES;if(t===Sl)return Ut.ALPHA;if(t===Al)return Ut.RGB;if(t===Ml)return Ut.RGBA;if(t===Pl)return Ut.LUMINANCE;if(t===Cl)return Ut.LUMINANCE_ALPHA;if(t===Tl)return Ut.DEPTH_COMPONENT;if(t===El)return Ut.DEPTH_STENCIL;if(t===gh)return Ut.FUNC_ADD;if(t===vh)return Ut.FUNC_SUBTRACT;if(t===yh)return Ut.FUNC_REVERSE_SUBTRACT;if(t===_h)return Ut.ZERO;if(t===wh)return Ut.ONE;if(t===Sh)return Ut.SRC_COLOR;if(t===Ah)return Ut.ONE_MINUS_SRC_COLOR;if(t===Mh)return Ut.SRC_ALPHA;if(t===Ph)return Ut.ONE_MINUS_SRC_ALPHA;if(t===Ch)return Ut.DST_ALPHA;if(t===Th)return Ut.ONE_MINUS_DST_ALPHA;if(t===Eh)return Ut.DST_COLOR;if(t===Ih)return Ut.ONE_MINUS_DST_COLOR;if(t===Lh)return Ut.SRC_ALPHA_SATURATE;if(e=$t.get("WEBGL_compressed_texture_s3tc"),null!==e){if(t===Il)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Ll)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Rl)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===Ol)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(e=$t.get("WEBGL_compressed_texture_pvrtc"),null!==e){if(t===Dl)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===Nl)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===kl)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===Fl)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e=$t.get("WEBGL_compressed_texture_etc1"),null!==e&&t===zl)return e.COMPRESSED_RGB_ETC1_WEBGL;if(e=$t.get("EXT_blend_minmax"),null!==e){if(t===bh)return e.MIN_EXT;if(t===xh)return e.MAX_EXT}return e=$t.get("WEBGL_depth_texture"),null!==e&&t===wl?e.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer",Yu),t=t||{};var U=void 0!==t.canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),j=void 0!==t.context?t.context:null,$=void 0!==t.alpha&&t.alpha,V=void 0===t.depth||t.depth,G=void 0===t.stencil||t.stencil,H=void 0!==t.antialias&&t.antialias,W=void 0===t.premultipliedAlpha||t.premultipliedAlpha,X=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,q=[],Y=[],Z=-1,K=[],Q=-1,J=new Float32Array(8),tt=[],et=[];this.domElement=U,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=Gh,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var it=this,nt=null,rt=null,ot=null,at=-1,st="",ct=null,ut=new _t,ht=null,lt=new _t,dt=0,ft=new Ct(0),pt=0,mt=U.width,gt=U.height,vt=1,yt=new _t(0,0,mt,gt),St=!1,At=new _t(0,0,mt,gt),Mt=new Ot,Tt=new ge,Et=!1,Lt=!1,Rt=new It,Nt=new O,kt=new N,zt={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Bt={calls:0,vertices:0,faces:0,points:0};this.info={render:Bt,memory:{geometries:0,textures:0},programs:null};var Ut;try{var jt={alpha:$,depth:V,stencil:G,antialias:H,premultipliedAlpha:W,preserveDrawingBuffer:X};if(Ut=j||U.getContext("webgl",jt)||U.getContext("experimental-webgl",jt),null===Ut)throw null!==U.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===Ut.getShaderPrecisionFormat&&(Ut.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),U.addEventListener("webglcontextlost",o,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var $t=new pe(Ut);$t.get("WEBGL_depth_texture"),$t.get("OES_texture_float"),$t.get("OES_texture_float_linear"),$t.get("OES_texture_half_float"),$t.get("OES_texture_half_float_linear"),$t.get("OES_standard_derivatives"),$t.get("ANGLE_instanced_arrays"),$t.get("OES_element_index_uint")&&(ue.MaxIndex=4294967296);var Vt=new fe(Ut,$t,t),Gt=new wt(Ut,$t,B),Ht=new Ft,Wt=new xt(Ut,$t,Gt,Ht,Vt,B,this.info),Xt=new le(Ut,Ht,this.info),qt=new Zt(this,Vt),Yt=new de;this.info.programs=qt.programs;var Kt=new ve(Ut,$t,Bt),Qt=new me(Ut,$t,Bt),Jt=new Ce(-1,1,1,-1,0,1),te=new Pe,ee=new Se(new Ae(2,2),new we({depthTest:!1,depthWrite:!1,fog:!1})),ie=gp.cube,ne=new Se(new ye(5,5,5),new Pt({uniforms:ie.uniforms,vertexShader:ie.vertexShader,fragmentShader:ie.fragmentShader,side:nh,depthTest:!1,depthWrite:!1,fog:!1}));n(),this.context=Ut,this.capabilities=Vt,this.extensions=$t,this.properties=Ht,this.state=Gt;var re=new Dt(this,zt,Xt,Vt);this.shadowMap=re;var oe=new k(this,tt),ae=new z(this,et);this.getContext=function(){return Ut},this.getContextAttributes=function(){return Ut.getContextAttributes()},this.forceContextLoss=function(){$t.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return Vt.getMaxAnisotropy()},this.getPrecision=function(){return Vt.precision},this.getPixelRatio=function(){return vt},this.setPixelRatio=function(t){void 0!==t&&(vt=t,this.setSize(At.z,At.w,!1))},this.getSize=function(){return{width:mt,height:gt}},this.setSize=function(t,e,i){mt=t,gt=e,U.width=t*vt,U.height=e*vt,i!==!1&&(U.style.width=t+"px",U.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,i,n){Gt.viewport(At.set(t,e,i,n))},this.setScissor=function(t,e,i,n){Gt.scissor(yt.set(t,e,i,n))},this.setScissorTest=function(t){Gt.setScissorTest(St=t)},this.getClearColor=function(){return ft},this.setClearColor=function(t,e){ft.set(t),pt=void 0!==e?e:1,i(ft.r,ft.g,ft.b,pt)},this.getClearAlpha=function(){return pt},this.setClearAlpha=function(t){pt=t,i(ft.r,ft.g,ft.b,pt)},this.clear=function(t,e,i){var n=0;(void 0===t||t)&&(n|=Ut.COLOR_BUFFER_BIT),(void 0===e||e)&&(n|=Ut.DEPTH_BUFFER_BIT),(void 0===i||i)&&(n|=Ut.STENCIL_BUFFER_BIT),Ut.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,i,n){this.setRenderTarget(t),this.clear(e,i,n)},this.resetGLState=r,this.dispose=function(){K=[],Q=-1,Y=[],Z=-1,U.removeEventListener("webglcontextlost",o,!1)},this.renderBufferImmediate=function(t,e,i){Gt.initAttributes();var n=Ht.get(t);t.hasPositions&&!n.position&&(n.position=Ut.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=Ut.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=Ut.createBuffer()),t.hasColors&&!n.color&&(n.color=Ut.createBuffer());var r=e.getAttributes();if(t.hasPositions&&(Ut.bindBuffer(Ut.ARRAY_BUFFER,n.position),Ut.bufferData(Ut.ARRAY_BUFFER,t.positionArray,Ut.DYNAMIC_DRAW),Gt.enableAttribute(r.position),Ut.vertexAttribPointer(r.position,3,Ut.FLOAT,!1,0,0)),t.hasNormals){if(Ut.bindBuffer(Ut.ARRAY_BUFFER,n.normal),!i.isMeshPhongMaterial&&!i.isMeshStandardMaterial&&i.shading===oh)for(var o=0,a=3*t.count;o8&&(f.length=8);for(var v=n.morphAttributes,p=0,m=f.length;p0&&w.renderInstances(n,E,L):w.render(E,L)},this.render=function(t,e,n,r){if((e&&e.isCamera)===!1)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");var o=t.fog;st="",at=-1,ct=null,t.autoUpdate===!0&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),Nt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),Mt.setFromMatrix(Nt),q.length=0,Z=-1,Q=-1,tt.length=0,et.length=0,Lt=this.localClippingEnabled,Et=Tt.init(this.clippingPlanes,Lt,e),v(t,e),Y.length=Z+1,K.length=Q+1,it.sortObjects===!0&&(Y.sort(l),K.sort(d)),Et&&Tt.beginShadows(),R(q),re.render(t,e),D(q,e),Et&&Tt.endShadows(),Bt.calls=0,Bt.vertices=0,Bt.faces=0,Bt.points=0,void 0===n&&(n=null),this.setRenderTarget(n);var a=t.background;if(null===a?i(ft.r,ft.g,ft.b,pt):a&&a.isColor&&(i(a.r,a.g,a.b,1),r=!0),(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),a&&a.isCubeTexture?(te.projectionMatrix.copy(e.projectionMatrix),te.matrixWorld.extractRotation(e.matrixWorld),te.matrixWorldInverse.getInverse(te.matrixWorld),ne.material.uniforms.tCube.value=a,ne.modelViewMatrix.multiplyMatrices(te.matrixWorldInverse,ne.matrixWorld),Xt.update(ne),it.renderBufferDirect(te,null,ne.geometry,ne.material,ne,null)):a&&a.isTexture&&(ee.material.map=a,Xt.update(ee),it.renderBufferDirect(Jt,null,ee.geometry,ee.material,ee,null)),t.overrideMaterial){var s=t.overrideMaterial;y(Y,e,o,s),y(K,e,o,s)}else Gt.setBlending(hh),y(Y,e,o),y(K,e,o);oe.render(t,e),ae.render(t,e,lt),n&&Wt.updateRenderTargetMipmap(n),Gt.setDepthTest(!0),Gt.setDepthWrite(!0),Gt.setColorWrite(!0)},this.setFaceCulling=function(t,e){Gt.setCullFace(t),Gt.setFlipSided(e===Ju)},this.allocTextureUnit=F,this.setTexture2D=function(){var t=!1;return function(e,i){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),Wt.setTexture2D(e,i)}}(),this.setTexture=function(){var t=!1;return function(e,i){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),Wt.setTexture2D(e,i)}}(),this.setTextureCube=function(){var t=!1;return function(e,i){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?Wt.setTextureCube(e,i):Wt.setTextureCubeDynamic(e,i)}}(),this.getCurrentRenderTarget=function(){return rt},this.setRenderTarget=function(t){rt=t,t&&void 0===Ht.get(t).__webglFramebuffer&&Wt.setupRenderTarget(t);var e,i=t&&t.isWebGLRenderTargetCube;if(t){var n=Ht.get(t);e=i?n.__webglFramebuffer[t.activeCubeFace]:n.__webglFramebuffer,ut.copy(t.scissor),ht=t.scissorTest,lt.copy(t.viewport)}else e=null,ut.copy(yt).multiplyScalar(vt),ht=St,lt.copy(At).multiplyScalar(vt);if(ot!==e&&(Ut.bindFramebuffer(Ut.FRAMEBUFFER,e),ot=e),Gt.scissor(ut),Gt.setScissorTest(ht),Gt.viewport(lt),i){var r=Ht.get(t.texture);Ut.framebufferTexture2D(Ut.FRAMEBUFFER,Ut.COLOR_ATTACHMENT0,Ut.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,r.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,i,n,r,o){if((t&&t.isWebGLRenderTarget)===!1)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var a=Ht.get(t).__webglFramebuffer;if(a){var s=!1;a!==ot&&(Ut.bindFramebuffer(Ut.FRAMEBUFFER,a),s=!0);try{var c=t.texture,u=c.format,h=c.type;if(u!==Ml&&B(u)!==Ut.getParameter(Ut.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(h===ll||B(h)===Ut.getParameter(Ut.IMPLEMENTATION_COLOR_READ_TYPE)||h===vl&&($t.get("OES_texture_float")||$t.get("WEBGL_color_buffer_float"))||h===yl&&$t.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");Ut.checkFramebufferStatus(Ut.FRAMEBUFFER)===Ut.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&Ut.readPixels(e,i,n,r,B(u),B(h),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&Ut.bindFramebuffer(Ut.FRAMEBUFFER,ot)}}}}function Ee(t,e){this.name="",this.color=new Ct(t),this.density=void 0!==e?e:25e-5}function Ie(t,e,i){this.name="",this.color=new Ct(t),this.near=void 0!==e?e:1,this.far=void 0!==i?i:1e3}function Le(){re.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function Re(t,e,i,n,r){re.call(this),this.lensFlares=[],this.positionScreen=new N,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,i,n,r)}function Oe(t){At.call(this),this.type="SpriteMaterial",this.color=new Ct(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function De(t){re.call(this),this.type="Sprite",this.material=void 0!==t?t:new Oe}function Ne(){re.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function ke(t,e,i,n,r,o,a,s,c,u,h,l){L.call(this,null,o,a,s,c,u,n,r,h,l),this.image={data:t,width:e,height:i},this.magFilter=void 0!==c?c:ol,this.minFilter=void 0!==u?u:ol,this.flipY=!1,this.generateMipmaps=!1}function Fe(t,e,i){if(this.useVertexTexture=void 0===i||i,this.identityMatrix=new O,t=t||[],this.bones=t.slice(0),this.useVertexTexture){var n=Math.sqrt(4*this.bones.length);n=ad.nextPowerOfTwo(Math.ceil(n)),n=Math.max(n,4),this.boneTextureWidth=n,this.boneTextureHeight=n,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new ke(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,Ml,vl)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var r=0,o=this.bones.length;r0)&&S.push(A,M,C),(m!==i-1||s65535?Jt:Qt)(S,1)),this.addAttribute("position",u),this.addAttribute("normal",h),this.addAttribute("uv",l),this.boundingSphere=new It(new N,t)}function an(t,e,i,n,r,o,a){ae.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new on(t,e,i,n,r,o,a))}function sn(t,e){re.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new Ct,new Ct];var i=new an(e,4,2);i.rotateX(-Math.PI/2);for(var n=0,r=8;n0&&f++,e>0&&f++);var p=c(),m=u(),g=new Kt(new(m>65535?Uint32Array:Uint16Array)(m),1),v=new Kt(new Float32Array(3*p),3),y=new Kt(new Float32Array(3*p),3),b=new Kt(new Float32Array(2*p),2),x=0,_=0,w=[],S=i/2,A=0;h(),o===!1&&(t>0&&l(!0),e>0&&l(!1)),this.setIndex(g),this.addAttribute("position",v),this.addAttribute("normal",y),this.addAttribute("uv",b)}function fn(t,e,i,n,r,o){re.call(this),void 0===n&&(n=16776960),void 0===i&&(i=1),void 0===r&&(r=.2*i),void 0===o&&(o=.2*r),this.position.copy(e),this.line=new je(Tp,new Ue({color:n})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Se(Ep,new we({color:n})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(i,r,o)}function pn(t,e,i,n){function r(t){var e=t.normalize().clone();e.index=h.vertices.push(e)-1;var i=s(t)/2/Math.PI+.5,n=c(t)/Math.PI+.5;return e.uv=new I(i,1-n),e}function o(t,e,i){var n=new ee(t.index,e.index,i.index,[t.clone(),e.clone(),i.clone()]);h.faces.push(n),b.copy(t).add(e).add(i).divideScalar(3);var r=s(b);h.faceVertexUvs[0].push([u(t.uv,t,r),u(e.uv,e,r),u(i.uv,i,r)])}function a(t,e){for(var i=Math.pow(2,e),n=r(h.vertices[t.a]),a=r(h.vertices[t.b]),s=r(h.vertices[t.c]),c=[],u=0;u<=i;u++){c[u]=[];for(var l=r(n.clone().lerp(s,u/i)),d=r(a.clone().lerp(s,u/i)),f=i-u,p=0;p<=f;p++)0===p&&u===i?c[u][p]=l:c[u][p]=r(l.clone().lerp(d,p/f))}for(var u=0;u.9&&M<.1&&(_<.2&&(x[0].x+=1),w<.2&&(x[1].x+=1),S<.2&&(x[2].x+=1))}for(var l=0,d=this.vertices.length;l=0&&e<=7&&fv[t]?fv[t][e]:Array(e+1).join(t)}function cr(t,e){function i(){f=[],r(),o(),a()}function n(t,e){return void 0!==t?t:e}function r(){f.push(or("TITEL %-74s",t.name))}function o(){d.forEach(function(t){f.push(or("REMARK %-73s",t))}),t.trajectory&&(f.push(or("REMARK %-73s","Trajectory '"+t.trajectory.name+"'")),f.push(or("REMARK %-73s","Frame "+t.trajectory.frame)))}function a(){var e=1,i=1;t.eachModel(function(t){f.push(or("MODEL %-74d",i++)),t.eachAtom(function(t){var i=t.hetero?m:p,r=l?e:t.serial,o=t.atomname;1===o.length&&(o=" "+o),f.push(or(i,r,o,t.resname,n(t.chainname," "),t.resno,t.x,t.y,t.z,n(t.occurence,1),n(t.bfactor,0),n(t.segid,""),n(t.element,""))),e+=1}),f.push(or("%-80s","ENDMDL")),i+=1}),f.push(or("%-80s","END"))}function s(){return i(),f.join("\n")}function c(){return new Blob([s()],{type:"text/plain"})}function u(t,e){t=t||"structure",e=e||"pdb";var i=t+"."+e,n=c();v(n,i)}var h=Object.assign({},e),l=void 0===h.renumberSerial||h.renumberSerial,d=h.remarks||[];Array.isArray(d)||(d=[d]);var f,p="ATOM %5d %-4s %3s %1s%4d %8.3f%8.3f%8.3f%6.2f%6.2f %4s%2s",m="HETATM%5d %-4s %3s %1s%4d %8.3f%8.3f%8.3f%6.2f%6.2f %4s%2s";this.getString=s,this.getBlob=c,this.download=u}function ur(){this.count=0,this.signals={countChanged:new xn}}function hr(t){this.name=t||"",this.nextGid=1,this.objectList=[],this.rangeList=[]}function lr(){this.signals={updated:new xn},this.begin(),this.maxDuration=-(1/0),this.minDuration=1/0,this.avgDuration=14,this.lastDuration=1/0,this.prevFpsTime=0,this.lastFps=1/0,this.lastFrames=1,this.frames=0,this.count=0}function dr(t,e){function i(t){d.enabled!==!1&&(v=g,g===f.NONE&&(t.keyCode!==d.keys[f.ROTATE]||d.noRotate?t.keyCode!==d.keys[f.ZOOM]||d.noZoom?t.keyCode!==d.keys[f.PAN]||d.noPan||(g=f.PAN):g=f.ZOOM:g=f.ROTATE))}function n(){d.enabled!==!1&&(g=v)}function r(t){d.enabled!==!1&&(g===f.NONE&&(g=t.button),g!==f.ROTATE||d.noRotate?g!==f.ZOOM||d.noZoom?g!==f.PAN||d.noPan||(C.copy(O(t.pageX,t.pageY)),T.copy(C)):(S.copy(O(t.pageX,t.pageY)),A.copy(S)):(x.copy(k(t.pageX,t.pageY)),b.copy(x)),document.addEventListener("mousemove",o,!1),document.addEventListener("mouseup",a,!1),d.dispatchEvent(L))}function o(t){d.enabled!==!1&&(g!==f.ROTATE||d.noRotate?g!==f.ZOOM||d.noZoom?g!==f.PAN||d.noPan||T.copy(O(t.pageX,t.pageY)):A.copy(O(t.pageX,t.pageY)):(b.copy(x),x.copy(k(t.pageX,t.pageY))))}function a(){d.enabled!==!1&&(g=f.NONE,document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",a),d.dispatchEvent(R))}function s(t){if(d.enabled!==!1){var e=0;e=t.wheelDelta?t.wheelDelta/40:t.detail?-t.detail/3:3*-t.deltaY,S.y+=.01*e,d.dispatchEvent(L),d.dispatchEvent(R)}}function c(t){if(d.enabled!==!1){switch(t.touches.length){case 1:g=f.TOUCH_ROTATE,x.copy(k(t.touches[0].pageX,t.touches[0].pageY)),b.copy(x);break;default:g=f.TOUCH_ZOOM_PAN;var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY;P=M=Math.sqrt(e*e+i*i);var n=(t.touches[0].pageX+t.touches[1].pageX)/2,r=(t.touches[0].pageY+t.touches[1].pageY)/2;C.copy(O(n,r)),T.copy(C)}d.dispatchEvent(L)}}function u(t){if(d.enabled!==!1)switch(t.touches.length){case 1:b.copy(x),x.copy(k(t.touches[0].pageX,t.touches[0].pageY));break;default:var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY;P=Math.sqrt(e*e+i*i);var n=(t.touches[0].pageX+t.touches[1].pageX)/2,r=(t.touches[0].pageY+t.touches[1].pageY)/2;T.copy(O(n,r))}}function h(t){if(d.enabled!==!1){switch(t.touches.length){case 0:g=f.NONE;break;case 1:g=f.TOUCH_ROTATE,x.copy(k(t.touches[0].pageX,t.touches[0].pageY)),b.copy(x)}d.dispatchEvent(R)}}function l(t){t.preventDefault()}var d=this,f={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4};this.object=t,this.domElement=void 0!==e?e:document,this.enabled=!0,this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.keys=[65,83,68],this.target=new N;var p=1e-6,m=new N,g=f.NONE,v=f.NONE,y=new N,b=new I,x=new I,_=new N,w=0,S=new I,A=new I,M=0,P=0,C=new I,T=new I;this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.up0=this.object.up.clone();var E={type:"change"},L={type:"start"},R={type:"end"};this.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 t=this.domElement.getBoundingClientRect(),e=this.domElement.ownerDocument.documentElement;this.screen.left=t.left+window.pageXOffset-e.clientLeft,this.screen.top=t.top+window.pageYOffset-e.clientTop,this.screen.width=t.width,this.screen.height=t.height}},this.handleEvent=function(t){"function"==typeof this[t.type]&&this[t.type](t)};var O=function(){var t=new I;return function(e,i){return t.set((e-d.screen.left)/d.screen.width,(i-d.screen.top)/d.screen.height),t}}(),k=function(){var t=new I;return function(e,i){return t.set((e-.5*d.screen.width-d.screen.left)/(.5*d.screen.width),(d.screen.height+2*(d.screen.top-i))/d.screen.width),t}}();this.rotateCamera=function(){var t,e=new N,i=new D,n=new N,r=new N,o=new N,a=new N;return function(){a.set(x.x-b.x,x.y-b.y,0),t=a.length(),t?(y.copy(d.object.position).sub(d.target),n.copy(y).normalize(),r.copy(d.object.up).normalize(),o.crossVectors(r,n).normalize(),r.setLength(x.y-b.y),o.setLength(x.x-b.x),a.copy(r.add(o)),e.crossVectors(a,y).normalize(),t*=d.rotateSpeed,i.setFromAxisAngle(e,t),y.applyQuaternion(i),d.object.up.applyQuaternion(i),_.copy(e),w=t):!d.staticMoving&&w&&(w*=Math.sqrt(1-d.dynamicDampingFactor),y.copy(d.object.position).sub(d.target),i.setFromAxisAngle(_,w),y.applyQuaternion(i),d.object.up.applyQuaternion(i)),b.copy(x)}}(),this.zoomCamera=function(){var t;g===f.TOUCH_ZOOM_PAN?(t=M/P,M=P,y.multiplyScalar(t),void 0===d.object.fov&&(d.object.zoom*=t)):(t=1+(A.y-S.y)*d.zoomSpeed,1!==t&&t>0&&(y.multiplyScalar(t),void 0===d.object.fov&&(d.object.zoom/=t),d.staticMoving?S.copy(A):S.y+=(A.y-S.y)*this.dynamicDampingFactor))},this.panCamera=function(){var t=new I,e=new N,i=new N;return function(){if(t.copy(T).sub(C),t.lengthSq()){if(void 0===d.object.fov){var n=(d.object.right-d.object.left)/d.object.zoom,r=(d.object.top-d.object.bottom)/d.object.zoom;t.x*=n,t.y*=r}else t.multiplyScalar(y.length()*d.panSpeed);i.copy(y).cross(d.object.up).setLength(t.x),i.add(e.copy(d.object.up).setLength(t.y)),d.object.position.add(i),d.target.add(i),d.staticMoving?C.copy(T):C.add(t.subVectors(T,C).multiplyScalar(d.dynamicDampingFactor))}}}(),this.checkDistances=function(){d.noZoom&&d.noPan||(y.lengthSq()>d.maxDistance*d.maxDistance&&(d.object.position.addVectors(d.target,y.setLength(d.maxDistance)),S.copy(A)),y.lengthSq()p&&(d.dispatchEvent(E),m.copy(d.object.position))},this.reset=function(){g=f.NONE,v=f.NONE,d.target.copy(d.target0),d.object.position.copy(d.position0),d.object.up.copy(d.up0),y.subVectors(d.object.position,d.target),d.object.lookAt(d.target),d.dispatchEvent(E),m.copy(d.object.position)},this.dispose=function(){this.domElement.removeEventListener("contextmenu",l,!1),this.domElement.removeEventListener("mousedown",r,!1),this.domElement.removeEventListener("mousewheel",s,!1),this.domElement.removeEventListener("wheel",s,!1),this.domElement.removeEventListener("MozMousePixelScroll",s,!1),this.domElement.removeEventListener("touchstart",c,!1),this.domElement.removeEventListener("touchend",h,!1),this.domElement.removeEventListener("touchmove",u,!1),document.removeEventListener("mousemove",o,!1),document.removeEventListener("mouseup",a,!1),window.removeEventListener("keydown",i,!1),window.removeEventListener("keyup",n,!1)},this.domElement.addEventListener("contextmenu",l,!1),this.domElement.addEventListener("mousedown",r,!1),this.domElement.addEventListener("mousewheel",s,!1),this.domElement.addEventListener("wheel",s,!1),this.domElement.addEventListener("MozMousePixelScroll",s,!1),this.domElement.addEventListener("touchstart",c,!1),this.domElement.addEventListener("touchend",h,!1),this.domElement.addEventListener("touchmove",u,!1),window.addEventListener("keydown",i,!1),window.addEventListener("keyup",n,!1),this.handleResize(),this.update()}function fr(t){if(void 0===t)return"";var e=[];for(var i in t){var n=t[i];n!==!1&&e.push("#define "+i+" "+n)}return e.join("\n")+"\n"}function pr(t,e){e=e||{};var i=t+"|";for(var n in e)i+=n+":"+e[n];if(!mv[i]){var r=fr(e),o=hv.get("shader/"+t);if(!o)throw"empty shader, '"+t+"'";o=o.replace(pv,function(t,e){var i="shader/chunk/"+e+".glsl",n=hv.get(i)||fp[e];return n?n:""}),mv[i]=r+o}return mv[i]}function mr(t,e,i,n){function r(e){var n=e%u,r=Math.floor(e/u),o=n*m,a=r*g;i.camera.setViewOffset(m*u,g*u,o,a,m,g),i.render(),h?v.drawImage(t.domElement,Math.floor(o/2),Math.floor(a/2),Math.ceil(m/2),Math.ceil(g/2)):v.drawImage(t.domElement,Math.floor(o),Math.floor(a),Math.ceil(m),Math.ceil(g)),"function"==typeof l&&l(e+1,f,!1)}function o(){i.setSampling(y),i.camera.view=null,"function"==typeof d&&d(f+1,f,!1)}function a(){for(var t=0;t<=f;++t)t===f?o():r(t)}function s(){function t(){e===f?o():r(e),e+=1}for(var e=0,i=0;i<=f;++i)setTimeout(t,0,i)}var c=n||{},u=void 0!==c.factor?c.factor:2,h=void 0!==c.antialias&&c.antialias,l=c.onProgress,d=c.onFinish;h&&(u*=2);var f=u*u,p=document.createElement("canvas"),m=i.width,g=i.height;h?(p.width=m*u/2,p.height=g*u/2):(p.width=m*u,p.height=g*u);var v=p.getContext("2d"),y=i.sampleLevel;i.setSampling(-1),this.render=a,this.renderAsync=s,this.canvas=p}function gr(t,e,i,n,r){i=i||1,n=n||0;var o,a,s,c=r?r.length:t.length/i,u=0,h=0;if(r)for(a=0;ae?1:t=u&&e(t[o],l)>0;)t[o+1]=t[o],--o;t[o+1]=l}if(c===-1)break;h=s[c--],u=s[c--]}else{var f=u+h>>1;for(o=u+1,a=h,r(f,o),e(t[u],t[h])>0&&r(u,h),e(t[o],t[h])>0&&r(o,h),e(t[u],t[o])>0&&r(u,o),l=t[o];;){do o++;while(e(t[o],l)<0);do a--;while(e(t[a],l)>0);if(a=a-u?(s[++c]=o,s[++c]=h,h=a-1):(s[++c]=u,s[++c]=a-1,u=o)}return t}function Ar(t,e,i,n,r){var o,a,s,c,u=t.height,h=t.width,l=t.getContext("2d"),d=l.getImageData(0,0,h,u).data;for(s=!1,a=0;a=0;a--){for(o=h-1;o>=0;o--)if(c=4*(a*h+o),d[c]!==e||d[c+1]!==i||d[c+2]!==n||d[c+3]!==r){s=!0;break}if(s)break}var m=a;for(s=!1,o=h-1;o>=0;o--){for(a=u-1;a>=0;a--)if(c=4*(a*h+o),d[c]!==e||d[c+1]!==i||d[c+2]!==n||d[c+3]!==r){s=!0;break}if(s)break}var g=o,v=document.createElement("canvas");v.width=g-p,v.height=m-f;var y=v.getContext("2d");return y.drawImage(t,p,f,v.width,v.height,0,0,v.width,v.height),v}function Mr(t,e){function i(e){var i=s;c&&(i*=2),e&&(i=1/i),t.scene.traverse(function(t){var e=t.material;e&&e.linewidth&&(e.linewidth*=i),e&&e.uniforms&&e.uniforms.size&&void 0===e.uniforms.size.__seen&&(e.uniforms.size.value*=i,e.uniforms.size.__seen=!0)}),t.scene.traverse(function(t){var e=t.material;e&&e.uniforms&&e.uniforms.size&&delete e.uniforms.size.__seen})}function n(t){if(a){var e=f,i=0|(u?0:255*e.r),n=0|(u?0:255*e.g),r=0|(u?0:255*e.b),o=0|(u?0:255);return Ar(t,i,n,r,o)}return t}function r(t,e,i){"function"==typeof o.onProgress&&o.onProgress(t,e,i)}var o=e||{},a=void 0!==o.trim&&o.trim,s=void 0!==o.factor?o.factor:1,c=void 0!==o.antialias&&o.antialias,u=void 0!==o.transparent&&o.transparent,h=t.renderer,l=t.camera,d=h.getClearAlpha(),f=h.getClearColor();return new Promise(function(e){function o(o,s){var c=n(a.canvas);c.toBlob(function(n){h.setClearAlpha(d),i(!0),t.requestRender(),r(s,s,!0),e(n)},"image/png")}var a=new mr(h,l,t,{factor:s,antialias:c,onProgress:r,onFinish:o});h.setClearAlpha(u?0:1),i(),a.renderAsync()})}function Pr(t,e){var i;t.traverseVisible(function(t){if(t instanceof Ge&&t.sortParticles){var n=t.geometry.attributes,r=n.position.count;if(0!==r){yv.multiplyMatrices(e.matrixWorldInverse,t.matrixWorld),bv.multiplyMatrices(e.projectionMatrix,yv);var o,a,s,c;for(t.userData.sortData?(o=t.userData.sortData,s=o.__zArray,a=o.__sortArray,c=o.__cmpFn):(s=new Float32Array(r),a=new Uint32Array(r),c=function(t,e){var i=s[t],n=s[e];return i>n?1:i500&&!Q&&K<3&&K!==-1){var i=K;K=3,Z=!0,B(),Q=!0,K=i,t.Debug&&nv.log("rendered still frame")}var n=et;n.spinAxis&&n.spinAngle&&(Dt(n.spinAxis,n.spinAngle*it.lastDuration/16),T()),requestAnimationFrame(C)}function T(){Z||(performance.now()-it.startTime>22&&(it.begin(),Q=!1),Z=!0,requestAnimationFrame(function(){B(),it.update()}))}function E(){var t=et;J=Rt.copy(ot.position).sub(At.target).length(),J||(ot.position.set(0,0,t.cameraZ),J=Math.abs(t.cameraZ)),tt=Math.max(10,.5*Lt),tt+=Tt.center(Rt).length(),(tt===1/0||tt===-(1/0)||isNaN(tt))&&(tt=50);var e=(50-t.clipNear)/50,i=-(50-t.clipFar)/50;ot.near=Math.max(.1,t.clipDist,J-tt*e),ot.far=Math.max(1,J+tt*i);var n=(50-t.fogNear)/50,r=-(50-t.fogFar)/50,o=at.fog;o.color.set(t.fogColor),o.near=Math.max(.1,J-tt*n),o.far=Math.max(1,J+tt*r)}function I(){E();var t=wn(nt.fov),e=(ot.near+ot.far)/2,i=2*Math.tan(t/2)*e;rt.zoom=X/i}function L(){ot.updateMatrix(),ot.updateMatrixWorld(!0),ot.matrixWorldInverse.getInverse(ot.matrixWorld),ot.updateProjectionMatrix(),Cr(at,ot,pt,J,tt),Pr(at,ot)}function R(t,e,i,n){ht.visible=t,lt.visible=e,dt.visible=i,ft.visible=n}function O(){Rt.copy(ot.position).sub(At.target).setLength(10*Lt),st.position.copy(ot.position).add(Rt),st.color.set(et.lightColor),st.intensity=et.lightIntensity,ct.color.set(et.ambientColor),ct.intensity=et.ambientIntensity}function k(){pt.clearTarget(gt),R(!1,!0,!1,!1),pt.render(at,ot,gt),M(),pt.setRenderTarget(null)}function F(e){e?pt.clearTarget(e):pt.clear(),R(!1,!1,!0,!1),pt.render(at,ot,e),e?pt.clearTarget(e,!1,!0,!1):pt.clearDepth(),M(),R(!0,!1,!1,t.Debug),pt.render(at,ot,e),M()}function z(){var t=wv[Math.max(0,Math.min(K,5))],e=1/t.length,i=1/32;bt.tForeground.value=vt.texture;for(var n=vt.width,r=vt.height,o=0;o0?z():F(),Y=!1,void(Z=!1))}function U(){nv.log("scene cleared"),at.remove(ut),o(),pt.clear()}function j(t,e){if(void 0===e?Tt.isEmpty()||kt(Tt.center()):kt(e),t){var i;if(t===!0){var n=It,r=Math.max(n.x,n.y,n.z),o=Math.min(n.x,n.y,n.z);i=r+Math.sqrt(o)}else i=t;var a=wn(nt.fov),s=W/X,c=Xr&&(r=u),h>o&&(o=h),l>a&&(a=l)}return[Fr([e,i,n]),Fr([r,o,a])]}function Dr(t,e){for(var i=0,n=e.length;ie?(e/=t,t*Math.sqrt(1+e*e)):e>0?(t/=e,e*Math.sqrt(1+t*t)):0}function so(t,e,i,n,r,o,a,s){for(var c=2*Cv,u=Tv,h=0,l=0,d=0,f=0,p=Math.max(o,30),m=0,g=0,v=0,y=0,b=0,x=0,_=0,w=0,S=0,A=0,M=0,P=0,C=0,T=0,E=0,I=0,L=0,R=4660,O=0,D=0,N=0,k=new Float64Array(a<<3);h>16&32767&256)?D:-D,t[h*e+d]=O;for(f=0;f<2;f++)for(l=0;l>o),f=Math.max(0,e-n-c>>o),p=Math.max(0,i-n-u>>o),y=Math.min(h,t+n-s>>o),x=Math.min(l,e+n-c>>o),_=Math.min(d,i+n-u>>o),w=[],S=a;S<=y;++S)for(var A=f;A<=x;++A)for(var P=p;P<=_;++P){var T=(S*l+A)*d+P,I=b[T];if(I>0)for(var L=I-1,R=C[L],O=M[L],D=R+O,N=R;N>o)+1,l=(a.max.y-c>>o)+1,d=(a.max.z-u>>o)+1,f=h*l*d,p=t.count,m=t.x,g=t.y,v=t.z,y=0,b=new Uint32Array(f),x=new Int32Array(p);for(n=0;n>o,w=g[n]-c>>o,S=v[n]-u>>o,A=(_*l+w)*d+S;1===(b[A]+=1)&&(y+=1),x[n]=A}var M=new Uint16Array(y);for(n=0,r=0;n0&&(b[n]=r+1,M[r]=P,r+=1)}var C=new Uint32Array(y);for(n=1;n0){var L=I-1;E[C[L]+T[L]]=n,T[L]+=1}}this.within=i}function xo(e,i){t.Debug&&nv.time("BondHash init");var n,r=e.count,o=e.atomIndex1,a=e.atomIndex2,s=new Uint8Array(i),c=new Int32Array(i);for(n=0;ns&&(s=e);var a=o-r;if(0===a)return-1;var u=4*l;if(l+=1,1===a)return h[u]=r,h[u+1]=-1,h[u+2]=-1,h[u+3]=n,u;var f=r+Math.floor(a/2);d=e%3;for(var p,m,g,v,y,b=r,x=o-1;x>b;){for(g=b+x>>1,v=t[3*c[g]+d],m=c[g],c[g]=c[x],c[x]=m,y=b,p=b;pr&&s.pop()}var d,f,p=n(u)%3,m=3*c[h[u]],g=[t[m+0],t[m+1],t[m+2]],v=e(i,g),y=h[u+1],b=h[u+2];if(b===-1&&y===-1)return void((s.size()t[3*c[h[e]]+r])throw"left child is > parent!";n+=o(a,i+1)}if(s!==-1){if(t[3*c[h[s]]+r]0&&(e=":"+x(t).join(" OR :")),new _n(e)}function Do(t){this.name=t||"",this.partList=[]}function No(t,e){this.matrixList=t||[],this.chainList=e||[]}function ko(e,i){if(i){t.Debug&&nv.time("assignSecondaryStructure");var n=[];e.eachModel(function(t){t.eachChain(function(t){n.push(t.chainname)})});var r=n.slice().sort(),o=[];r.forEach(function(t){o.push(n.indexOf(t))});var a=i.helices;a=a.filter(function(t){return qu(r,t[0])>=0}),a.sort(function(t,e){var i=t[0],n=e[0],a=t[1],s=e[1];if(i===n)return a===s?0:a=0}),c.sort(function(t,e){var i=t[0],n=e[0];if(i===n)return 0;var a=qu(r,i),s=qu(r,n);return o[a]=r;)e=Math.floor(e/r),o+=n[e%r],i+=1;return i>=5&&nv.warn("chainname overflow"),o},h=e.getAtomProxy(),l=e.getAtomProxy(),d=0,f=0,p=0,m=0,g=[];1===s.count?g.push({mIndex:0,chainname:"A",rStart:0,rCount:1}):e.eachResidueN(2,function(t,e){var i=!1,n=t.backboneType,r=e.backboneType,o=Gp;m=t.index,t.modelIndex!==e.modelIndex?i=!0:t.moleculeType!==e.moleculeType?i=!0:n!==o&&n===r&&(h.index=t.backboneEndAtomIndex,l.index=e.backboneStartAtomIndex,h.connectedTo(l)||(i=!0)),i||e.index!==s.count-1||(i=!0,m=e.index),i&&(g.push({mIndex:f,chainname:u(d),rStart:p,rCount:m-p+1}),d+=1,t.modelIndex!==e.modelIndex&&(d=0,f+=1),e.index===s.count-1&&m!==e.index&&g.push({mIndex:f,chainname:u(d),rStart:s.count-1,rCount:1}),p=e.index,m=e.index)}),a.count=0,g.forEach(function(t){c(t.mIndex,t.chainname,t.rStart,t.rCount)});var v=0;e.eachModel(function(t){o.chainOffset[t.index]=v,o.chainCount[t.index]-=1,v+=o.chainCount[t.index]})}t.Debug&&nv.timeEnd("calculateChainnames")}function zo(e){t.Debug&&nv.time("calculateBonds"),jo(e),$o(e),t.Debug&&nv.timeEnd("calculateBonds")}function Bo(e){var i=e.structure,n=i.getAtomProxy(),r=i.getAtomProxy(),o=e.atomCount,a=e.atomOffset,s=a+o,c=s-1;if(o>500)return void(t.Debug&&nv.warn("more than 500 atoms, skip residue for auto-bonding",e.qualifiedName()));var u,h,l=[],d=[],f=[];if(o>50){var p=new Lo(e,!0),m=e.isCg()?1.2:2.3;for(u=a;u500)return void nv.warn("more than 500 atoms, skip residue for auto-bonding",t.qualifiedName());for(var l=t.getBonds(),d=l.atomIndices1,f=l.atomIndices2,p=l.bondOrders,m=d.length,g=0;g1&&(c.x-=1),s.x<0&&(c.x+=1),s.y>1&&(c.y-=1),s.y<0&&(c.y+=1),s.z>1&&(c.z-=1),s.z<0&&(c.z+=1),t&&c.add(t),u.setPosition(c),u.multiplyMatrices(n.fracToCart,u),u.multiply(n.cartToFrac),e.push(u)}),e}if(e.unitcell){t.Debug&&nv.time("buildUnitcellAssembly");var n=e.unitcell,r=e.center.clone().applyMatrix4(n.cartToFrac),o=Ro(n.spacegroup),a=new N,s=new N,c=new N;r.x>1&&(a.x-=1),r.x<0&&(a.x+=1),r.y>1&&(a.y-=1),r.y<0&&(a.y+=1),r.z>1&&(a.z-=1),r.z<0&&(a.z+=1);var u,h=new Do("UNITCELL"),l=i();if(e.biomolDict.NCS){u=[new O].concat(e.biomolDict.NCS.partList[0].matrixList);var d=[];l.forEach(function(t){u.forEach(function(e){d.push(t.clone().multiply(e))})}),h.addPart(d)}else h.addPart(l);var f=new N,p=new Do("SUPERCELL"),m=Array.prototype.concat.call(i(),i(f.set(1,1,1)),i(f.set(-1,-1,-1)),i(f.set(1,0,0)),i(f.set(1,1,0)),i(f.set(1,0,1)),i(f.set(0,1,0)),i(f.set(0,1,1)),i(f.set(0,0,1)),i(f.set(-1,0,0)),i(f.set(-1,-1,0)),i(f.set(-1,0,-1)),i(f.set(0,-1,0)),i(f.set(0,-1,-1)),i(f.set(0,0,-1)),i(f.set(1,-1,-1)),i(f.set(1,1,-1)),i(f.set(1,-1,1)),i(f.set(-1,1,1)),i(f.set(-1,-1,1)),i(f.set(-1,1,-1)),i(f.set(0,1,-1)),i(f.set(0,-1,1)),i(f.set(1,0,-1)),i(f.set(-1,0,1)),i(f.set(1,-1,0)),i(f.set(-1,1,0)));if(e.biomolDict.NCS){var g=[];m.forEach(function(t){u.forEach(function(e){g.push(t.clone().multiply(e))})}),p.addPart(g)}else p.addPart(m);e.biomolDict.UNITCELL=h,e.biomolDict.SUPERCELL=p,t.Debug&&nv.timeEnd("buildUnitcellAssembly")}}function Go(t){var e=t.bondHash,i=e.countArray,n=e.offsetArray,r=e.indexArray,o=t.getBondProxy();t.eachResidue(function(t){var e=t.residueType;if(void 0===e.bonds){var a=t.atomOffset,s=[],c=[],u=[],h={};t.eachAtom(function(t){for(var e=t.index,l=n[e],d=i[e],f=0,p=d;fg){var v=g;g=m,m=v}var y=m+"|"+g;void 0===h[y]&&(h[y]=!0,s.push(m-a),c.push(g-a),u.push(o.bondOrder))}}),e.bonds={atomIndices1:s,atomIndices2:c,bondOrders:u}}})}function Ho(t,e,i){this.structure=t,i=i||Rv(e),this.atomname=e,this.element=i,this.vdw=rm[i],this.covalent=am[i]}function Wo(t){function e(t,e){return t+"|"+e}function i(i,n){n=n||Rv(i);var a=e(i,n),s=r[a];if(void 0===s){var c=new Ho(t,i,n);s=o.length,r[a]=s,o.push(c)}return s}function n(t){return o[t]}var r={},o=[];this.add=i,this.get=n,this.list=o,this.dict=r,this.toJSON=function(){var t={metadata:{version:.1,type:"AtomMap",generator:"AtomMapExporter"},idDict:r,typeList:o.map(function(t){return t.toJSON()})};return t},this.fromJSON=function(e){r=e.idDict,o=e.typeList.map(function(e){return new Ho(t,e.atomname,e.element)}),this.list=o,this.dict=r}}function Xo(t,e,i,n,r,o){this.structure=t,this.resname=e,this.atomTypeIdList=i,this.hetero=n?1:0,this.chemCompType=r,this.bonds=o,this.rings=void 0,this.atomCount=i.length,this.moleculeType=this.getMoleculeType(),this.backboneType=this.getBackboneType(0),this.backboneEndType=this.getBackboneType(-1),this.backboneStartType=this.getBackboneType(1),this.backboneIndexList=this.getBackboneIndexList();var a=xm[this.backboneType],s=xm[this.backboneStartType],c=xm[this.backboneEndType],u=this.getAtomIndexByName(a.trace);this.traceAtomIndex=void 0!==u?u:-1;var h=this.getAtomIndexByName(a.direction1);this.direction1AtomIndex=void 0!==h?h:-1;var l=this.getAtomIndexByName(a.direction2);this.direction2AtomIndex=void 0!==l?l:-1;var d=this.getAtomIndexByName(s.backboneStart);this.backboneStartAtomIndex=void 0!==d?d:-1;var f=this.getAtomIndexByName(c.backboneEnd);this.backboneEndAtomIndex=void 0!==f?f:-1;var p;p=pm.includes(e)?this.getAtomIndexByName("N1"):this.getAtomIndexByName("N3"),this.rungEndAtomIndex=void 0!==p?p:-1,this.bondReferenceAtomIndices=[]}function qo(t){function e(t,e,i,n){return t+"|"+e.join(",")+"|"+(i?1:0)+"|"+(n?n:"")}function i(i,n,a,s,c){i=i.toUpperCase();var u=e(i,n,a,s),h=r[u];if(void 0===h){var l=new Xo(t,i,n,a,s,c);h=o.length,r[u]=h,o.push(l)}return h}function n(t){return o[t]}var r={},o=[];this.add=i,this.get=n,this.list=o,this.dict=r}function Yo(t,e){this.structure=t,this.bondStore=t.bondStore,this.index=e,this._v12=new N,this._v13=new N,this._ap1=this.structure.getAtomProxy(),this._ap2=this.structure.getAtomProxy(),this._ap3=this.structure.getAtomProxy()}function Zo(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.atomStore=t.atomStore,this.residueMap=t.residueMap,this.atomMap=t.atomMap,this.bondHash=t.bondHash,this.index=e}function Ko(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.atomStore=t.atomStore,this.residueMap=t.residueMap,this.atomMap=t.atomMap,this.index=e}function Qo(t,e,i){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.atomStore=t.atomStore,this.residueIndexStart=e,this.residueIndexEnd=i,this.residueCount=i-e+1;var n=this.structure.getResidueProxy(this.residueIndexStart),r=this.structure.getResidueProxy(this.residueIndexEnd);this.isPrevConnected=void 0!==n.getPreviousConnectedResidue();var o=r.getNextConnectedResidue();this.isNextConnected=void 0!==o,this.isNextNextConnected=this.isNextConnected&&void 0!==o.getNextConnectedResidue(),this.isCyclic=r.connectedTo(n),this.__residueProxy=this.structure.getResidueProxy()}function Jo(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.index=e}function ta(t,e){this.structure=t,this.modelStore=t.modelStore,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.index=e}function ea(t,e){this.signals={refreshed:new xn},this.name=t,this.path=e,this.title="",this.id="",this.header={},this.atomSetCache=void 0,this.atomSetDict={},this.biomolDict={},this.entityList=[],this.unitcell=void 0,this.frames=[],this.boxes=[],this.bondStore=new wo(0),this.backboneBondStore=new wo(0),this.rungBondStore=new wo(0),this.atomStore=new So(0),this.residueStore=new Ao(0),this.chainStore=new Mo(0),this.modelStore=new Po(0),this.atomMap=new Wo(this),this.residueMap=new qo(this),this.bondHash=void 0,this.spatialHash=void 0,this.atomSet=void 0,this.bondSet=void 0,this.center=void 0,this.boundingBox=void 0,this._bp=this.getBondProxy(),this._ap=this.getAtomProxy(),this._rp=this.getResidueProxy(),this._cp=this.getChainProxy()}function ia(t,e,i){this.name=t,this.path=e,this.info={},this.center=new N,this.boundingBox=new Et,i instanceof ae||i instanceof ue||i instanceof He?this.fromGeometry(i):i&&this.set(i.position,i.index,i.normal,i.color,i.atomindex)}function na(e){var i=0,n=0,r={},o={},a=URL.createObjectURL(ov.get(e)),s=new window.Worker(a);ov.activeWorkerCount+=1,s.onmessage=function(n){i-=1;var a=n.data.__postId;t.Debug&&nv.timeEnd("Worker.postMessage "+e+" #"+a),r[a]&&r[a].call(s,n),delete r[a],delete o[a]},s.onerror=function(t){if(i-=1,t.data){var n=t.data.__postId;o[n]?o[n].call(s,t):nv.error("Worker.onerror",n,e,t),delete r[n],delete o[n]}else nv.error("Worker.onerror",e,t)},this.name=e,this.post=function(a,c,u,h){r[n]=u,o[n]=h,a=a||{},a.__name=e,a.__postId=n,a.__debug=t.Debug,t.Debug&&nv.time("Worker.postMessage "+e+" #"+n);try{s.postMessage(a,c)}catch(t){nv.error("worker.post:",t),s.postMessage(a)}return i+=1,n+=1,this},this.terminate=function(){s?(s.terminate(),URL.revokeObjectURL(a),ov.activeWorkerCount-=1):nv.log("no worker to terminate")},Object.defineProperties(this,{postCount:{get:function(){return n}},pending:{get:function(){return i}}})}function ra(t,e){e=Math.min(8,e||2);var i=[],n=0;this.name=t,this.maxCount=e,this.post=function(t,e,i,n){var r=this.getNextWorker();return r.post(t,e,i,n),this},this.terminate=function(){i.forEach(function(t){t.terminate()})},this.getNextWorker=function(){for(var r,o=1/0,a=0;a=n){r=new na(t),i.push(r),n+=1;break}var s=i[a];if(0===s.pending){o=s.pending,r=s;break}s.pending=g){L=m,T=!0;break}if(T)break}if(T)break}for(T=!1,p=o;p=g){I=p,T=!0;break}if(T)break}if(T)break}for(T=!1,d=r;d=g){E=d,T=!0;break}if(T)break}if(T)break}for(T=!1,m=u;m>=a;--m){for(p=c;p>=o;--p){for(d=s;d>=r;--d)if(l=e*i*m+e*p+d,t[l]>=g){D=m,T=!0;break}if(T)break}if(T)break}for(T=!1,p=c;p>=o;--p){for(m=D;m>=a;--m){for(d=s;d>=r;--d)if(l=e*i*m+e*p+d,t[l]>=g){O=p,T=!0;break}if(T)break}if(T)break}for(T=!1,d=s;d>=r;--d){for(p=O;p>=o;--p){for(m=D;m>=a;--m)if(l=e*i*m+e*p+d,t[l]>=g){R=d,T=!0;break}if(T)break}if(T)break}for(v?(r=Math.max(0,E-1),o=Math.max(0,I-1),a=Math.max(0,L-1),s=Math.min(e-1,R+1),c=Math.min(i-1,O+1),u=Math.min(n-1,D+1)):(r=Math.max(1,E-1),o=Math.max(1,I-1),a=Math.max(1,L-1),s=Math.min(e-2,R+1),c=Math.min(i-2,O+1),u=Math.min(n-2,D+1)),m=a;m65535?Uint32Array:Uint16Array;return{position:new Float32Array(w),normal:v?void 0:new Float32Array(S),index:new a(A),atomindex:r?new Int32Array(M):void 0}}}function ca(t,e,i,n){i=i||1,n=n||!0;var r,o=t.length/3,a=e.length/3;n&&(r=new Float32Array(3*o));var s,c=new Float32Array(3*o),u=20,h=new Array(u);for(s=0;s65535?Uint32Array:Uint16Array,a=new o(3*r),s=0;s65535?Uint32Array:Uint16Array;this.meshIndex=new u(c*o*3),this.makeIndex(),ba.call(this,this.meshPosition,this.meshColor,this.meshIndex,this.meshNormal,this.meshPickingColor,a),this.initNormals=!0,this.setAttributes({position:t,color:e,pickingColor:i}),this.initNormals=!1}function Aa(t,e,i,n,r){var o=r||{},a=d(o.sphereDetail,1);this.geo=new mn(1,a),this._radius=i,Sa.call(this,t,e,n,o)}function Ma(t){this.size=this.count,this.attributeSize=this.count*this.mappingSize;var e=this.count*this.mappingIndicesSize,i=this.attributeSize>65535?Uint32Array:Uint16Array;this.index=new i(e),this.makeIndex(),ya.call(this,null,null,this.index,null,t),this.addAttributes({mapping:{type:this.mappingType,value:null}})}function Pa(t){this.mapping=new Float32Array([-1,1,-1,-1,1,1,1,-1]),this.mappingIndices=new Uint16Array([0,1,2,1,3,2]),this.mappingIndicesSize=6,this.mappingType="v2",this.mappingSize=4,this.mappingItemSize=2,Ma.call(this,t)}function Ca(t,e,i,n,r){this.impostor=!0,this.count=t.length/3,this.vertexShader="SphereImpostor.vert",this.fragmentShader="SphereImpostor.frag",Pa.call(this,r),this.addUniforms({projectionMatrixInverse:{value:new O},ortho:{value:0}}),this.addAttributes({radius:{type:"f",value:null}}),this.setAttributes({position:t,color:e,radius:i}),n&&(this.addAttributes({pickingColor:{type:"c",value:null}}),this.setAttributes({pickingColor:n}),this.pickable=!0),this.makeMapping()}function Ta(t,e,i,n,r){var o=r||{};return!iv||o.disableImpostor?new Aa(t,e,i,n,r):new Ca(t,e,i,n,r)}function Ea(t,e,i,n,r,o,a){var s=a||{},c=d(s.sphereDetail,2);this.updateNormals=!0,this.geo=new mn(1,c),this._radius=i,this._majorAxis=n,this._minorAxis=r,Sa.call(this,t,e,o,s)}function Ia(t,e,i,n,r,o,a){return new Ea(t,e,i,n,r,o,a)}function La(t,e,i,n,r,o,a,s){var c=s||{},u=d(c.radialSegments,10),h=d(c.openEnded,!0);this.updateNormals=!0;var l=(new O).makeRotationX(Math.PI/2);this.geo=new dn(1,1,1,u,1,h),this.geo.applyMatrix(l);var f=t.length,p=r.length;this._position=new Float32Array(2*f),this._color=new Float32Array(2*f),this._pickingColor=new Float32Array(2*f),this._from=new Float32Array(2*f),this._to=new Float32Array(2*f),this._radius=new Float32Array(2*p),this.__center=new Float32Array(f),Sa.call(this,this._position,this._color,this._pickingColor,c),this.setAttributes({position1:t,position2:e,color:i,color2:n,radius:r,pickingColor:o,pickingColor2:a})}function Ra(t){this.mapping=new Float32Array([-1,1,-1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,1]),this.mappingIndices=new Uint16Array([0,1,2,1,4,2,2,4,3,4,5,3]),this.mappingIndicesSize=12,this.mappingType="v3",this.mappingSize=6,this.mappingItemSize=3,Ma.call(this,t)}function Oa(t,e,i,n,r,o,a,s){var c=s||{};this.openEnded=d(c.openEnded,!1),this.impostor=!0,this.count=t.length/3,this.vertexShader="CylinderImpostor.vert",this.fragmentShader="CylinderImpostor.frag",Ra.call(this,c);var u=new en(new O).onUpdate(function(t){this.value.getInverse(t.modelViewMatrix)});this.addUniforms({modelViewMatrixInverse:u,ortho:{value:0}}),this.addAttributes({position1:{type:"v3",value:null},position2:{type:"v3",value:null},color2:{type:"c",value:null},radius:{type:"f",value:null}}),this.setAttributes({position1:t,position2:e,color:i,color2:n,radius:r}),o&&(this.addAttributes({pickingColor:{type:"c",value:null},pickingColor2:{type:"c",value:null}}),this.setAttributes({pickingColor:o,pickingColor2:a}),this.pickable=!0),this.makeMapping()}function Da(t,e,i,n,r,o,a,s){var c=s||{};return!iv||c.disableImpostor?new La(t,e,i,n,r,o,a,s):new Oa(t,e,i,n,r,o,a,s)}function Na(t,e,i,n,r,o){var a=o||{},s=d(a.radialSegments,60),c=d(a.openEnded,!1);this.updateNormals=!0;var u=(new O).makeRotationX(-Math.PI/2);this.geo=new vn(1,1,s,1,c),this.geo.applyMatrix(u);var h=t.length,l=n.length;this._position=new Float32Array(h),this._from=new Float32Array(h),this._to=new Float32Array(h),this._radius=new Float32Array(l),Sa.call(this,this._position,i,r,a),this.setAttributes({position1:t,position2:e,color:i,radius:n,pickingColor:r})}function ka(t,e,i,n,r,o){return new Na(t,e,i,n,r,o)}function Fa(t,e,i,n,r,o){function a(t){var e,i,n={};if(t.radius){for(e=0,i=p.length;e65535?Uint32Array:Uint16Array;i=new r(i)}Array.isArray(n)&&(n=new Float32Array(n));var o=new ba(t,e,i,n);S.push(o),w.setFromArray(t),x.union(w)}function o(t,e,n){i(t,A),i(e,M),P.push(n),x.expandByPoint(_.fromArray(t))}function a(t,e,n,r,o){i(t,C),i(e,T),E.push(n),i(r,I),i(o,L),x.expandByPoint(_.fromArray(t))}function s(t,e,n,r){i(t,R),i(e,O),i(n,D),k.push(r),x.expandByPoint(_.fromArray(t)),x.expandByPoint(_.fromArray(e))}function c(t,e,n,r){i(t,F),i(e,z),i(n,B),U.push(r),x.expandByPoint(_.fromArray(t)),x.expandByPoint(_.fromArray(e))}function u(t,e,n,r){i(t,j),i(e,$),i(n,V),G.push(r),x.expandByPoint(_.fromArray(t)),x.expandByPoint(_.fromArray(e))}function h(){var t=[];if(A.length){var e=new Ta(new Float32Array(A),new Float32Array(M),new Float32Array(P),void 0,{sphereDetail:m,disableImpostor:v});t.push(e)}if(C.length){var i=new Ia(new Float32Array(C),new Float32Array(T),new Float32Array(E),new Float32Array(I),new Float32Array(L),void 0,{sphereDetail:m,disableImpostor:v});t.push(i)}if(R.length){var n=new Da(new Float32Array(R),new Float32Array(O),new Float32Array(D),new Float32Array(D),new Float32Array(k),void 0,void 0,{radialSegments:g,disableImpostor:v,openEnded:y});t.push(n)}if(F.length){var r=new ka(new Float32Array(F),new Float32Array(z),new Float32Array(B),new Float32Array(U),void 0,{radialSegments:g,disableImpostor:v,openEnded:y});t.push(r)}if(j.length){var o=new Fa(new Float32Array(j),new Float32Array($),new Float32Array(V),new Float32Array(G),void 0,{aspectRatio:p,radialSegments:g,disableImpostor:v,openEnded:y});t.push(o)}return S.concat(t)}function l(){S.forEach(function(t){t.dispose()}),S.length=0,A.length=0,M.length=0,P.length=0,C.length=0,T.length=0,E.length=0,I.length=0,L.length=0,R.length=0,O.length=0,D.length=0,k.length=0,F.length=0,z.length=0,B.length=0,U.length=0,j.length=0,$.length=0,V.length=0,G.length=0}this.name=d(t,"shape");var f=e||{},p=d(f.aspectRatio,1.5),m=d(f.sphereDetail,2),g=d(f.radialSegments,50),v=d(f.disableImpostor,!1),y=d(f.openEnded,!1),b=new N,x=new Et,_=new N,w=new Et,S=[],A=[],M=[],P=[],C=[],T=[],E=[],I=[],L=[],R=[],O=[],D=[],k=[],F=[],z=[],B=[],U=[],j=[],$=[],V=[],G=[];Object.defineProperties(this,{center:{get:function(){return x.center(b)}}}),this.boundingBox=x,this.addBuffer=n,this.addMesh=r,this.addSphere=o,this.addEllipsoid=a,this.addCylinder=s,this.addCone=c,this.addArrow=u,this.getBufferList=h,this.dispose=l}function Ba(t,e,i){this.viewer=e,this.gidPool=i?i.gidPool:void 0,this.tasks=new ur,this.queue=new pa(function(t,e){this.make(t,e)}.bind(this)),this.bufferList=[],this.init(i)}function Ua(t,e,i){Array.isArray(t)||(t=[t]),Ba.call(this,t,e,i),this.buffer=t,this.build()}function ja(){ba.apply(this,arguments)}function $a(t){this.size=t.size,this.side=t.side,this.wireframe=t.wireframe,this.visible=t.visible,this.geometry=t.geometry,this.pickable=t.pickable,this.background=t.background,this.group=new He,this.wireframeGroup=new He,this.pickingGroup=new He;var e=[],i=[],n=t,r=new t.constructor;n.makeMaterial(),r.makeMaterial(),r.geometry=t.geometry,r.wireframeGeometry=t.wireframeGeometry,r.size=t.size,r.attributeSize=t.attributeSize,r.pickable=t.pickable,r.setParameters(t.getParameters()),r.updateShader(),n.setParameters({side:"front"}),r.setParameters({side:"back",opacity:r.opacity}),this.getMesh=function(t){var o,a;return t?(a=r.getPickingMesh(),o=n.getPickingMesh()):(a=r.getMesh(),o=n.getMesh()),e.push(o),i.push(a),this.setParameters({side:this.side}),(new He).add(a,o)},this.getWireframeMesh=function(){return t.getWireframeMesh()},this.getPickingMesh=function(){return this.getMesh(!0)},this.setAttributes=function(e){t.setAttributes(e)},this.setParameters=function(t){t=Object.assign({},t),"front"===t.side?(e.forEach(function(t){t.visible=!0}),i.forEach(function(t){t.visible=!1})):"back"===t.side?(e.forEach(function(t){t.visible=!1}),i.forEach(function(t){t.visible=!0})):"double"===t.side&&(e.forEach(function(t){t.visible=!0}),i.forEach(function(t){t.visible=!0})),void 0!==t.side&&(this.side=t.side),delete t.side,n.setParameters(t),void 0!==t.wireframe&&(this.wireframe=t.wireframe,this.setVisibility(this.visible)),delete t.wireframe,r.setParameters(t)},this.setVisibility=ya.prototype.setVisibility,this.dispose=function(){n.dispose(),r.dispose()}}function Va(t,e,i){Ba.call(this,t,e,i),t instanceof fa?(this.surface=void 0,this.volume=t):(this.surface=t,this.volume=void 0),this.boxCenter=new N,this.__boxCenter=new N,this.box=new Et,this.__box=new Et,this.setBox=function(){var t=new N;return function(){var i=e.controls.target,n=e.rotationGroup.position;t.copy(n).negate().add(i),t.equals(this.boxCenter)||this.setParameters({boxCenter:t})}.bind(this)}.bind(this)(),this.viewer.signals.orientationChanged.add(this.setBox),this.build()}function Ga(t){function e(t,e,i){return Math.min(Math.max(t,e),i)}function i(t,e,i,n){var r=i-t,o=n-e;return Math.sqrt(r*r+o*o)}function n(t,i,n){return n=e((n-t)/(i-t),0,1),n*n*(3-2*n)}for(var r=Object.assign({},t),o=d(r.width,256),a=d(r.height,256),s=[o/2,a/2],c=Math.min(o/2,a/2),u=d(r.delta,1/(c+1))*c,h=0,l=0,f=new Uint8Array(o*a*4),p=0,m=f.length;p1&&(l=1),r(e,i,n,o,h,p),r(e,i,n,o,l,m),m.sub(p).normalize(),m.toArray(a,g)}}function s(e,i,n,r,o){for(var a,s=i.next(),c=i.next(),u=i.next(),h=i.size,l=h-1,d=r||0,f=0;f65535?Uint32Array:Uint16Array;this.meshIndex=new p(f),this.makeIndex(),ba.call(this,this.meshPosition,this.meshColor,this.meshIndex,this.meshNormal,this.meshPickingColor,c),this.setAttributes({position:t,normal:e,binormal:i,tangent:n,color:r,size:o,pickingColor:a})}function As(t,e,i){Xa.call(this,t,e,i)}function Ms(t,e){this.sview1=t,this.sview2=e,this.kdtree2=new Lo(e)}function Ps(t,e,i){e=e||3.5,i=i||40;for(var n=new _n("( ARG and ( .NE or .NH1 or .NH2 ) ) or ( ASP and .ND2 ) or ( GLN and .NE2 ) or ( HIS and ( .ND1 or .NE2 ) ) or ( LYS and .NZ ) or ( SER and .OG ) or ( THR and .OG1 ) or ( TRP and .NE1 ) or ( TYR and .OH ) or ( PROTEIN and .N )"),r=new _n("( ASN and .OD1 ) or ( ASP and ( OD1 or .OD2 ) ) or ( GLN and .OE1 ) or ( GLU and ( .OE1 or .OE2 ) ) or ( HIS and ( .ND1 or .NE2 ) ) or ( SER and .OG ) or ( THR and .OG1 ) or ( TYR and .OH ) or ( PROTEIN and .O )"),o=t.getView(n),a=t.getView(r),s=new Ms(o,a),c=s.within(e),u=c.bondStore,h=t.getAtomProxy(),l=t.getAtomProxy(),d=t.getAtomProxy(),f=t.getAtomProxy(),p=t.getResidueProxy(),m=t.getResidueProxy(),g=new N,v=new N,y=function(t,e,n,r){var o,a;t.atomname===n?(o=t,a=e):(o=e,a=t),p.index=o.residueIndex;var s=p.getAtomIndexByName(r);return g.subVectors(s,o),v.subVectors(s,a),Sn(g.angleTo(v))i&&c.bondSet.flip_unsafe(b)}else("OH"===h.atomname&&"TYR"===h.resname||"OH"===l.atomname&&"TYR"===l.resname)&&(y(h,l,"OH","CZ")||c.bondSet.flip_unsafe(b));return{atomSet:c.atomSet,bondSet:c.bondSet,bondStore:c.bondStore}}function Cs(t,e,i){e=e||3.5,i=i||40;for(var n=new _n("( PROTEIN and .N )"),r=new _n("( PROTEIN and .O )"),o=t.getView(n),a=t.getView(r),s=new Ms(o,a),c=s.within(e),u=c.bondStore,h=t.getAtomProxy(),l=t.getAtomProxy(),d=t.getAtomProxy(),f=t.getAtomProxy(),p=t.getResidueProxy(),m=t.getResidueProxy(),g=new N,v=new N,y=0,b=u.count;yi&&c.bondSet.flip_unsafe(y)))}}return{atomSet:c.atomSet,bondSet:c.bondSet,bondStore:c.bondStore}}function Ts(t,e,i){Xa.call(this,t,e,i)}function Es(t){var e=Object.assign({},t);if(this.font=d(e.font,["sans-serif"]),this.size=d(e.size,36),this.style=d(e.style,"normal"),this.variant=d(e.variant,"normal"),this.weight=d(e.weight,"normal"),this.outline=d(e.outline,0),this.width=d(e.width,1024),this.height=d(e.height,1024),this.gamma=1,"undefined"!=typeof navigator){var i=navigator.userAgent;i.match(/Chrome/)&&i.match(/OS X/)&&(this.gamma=.5)}this.mapped={},this.scratchW=0,this.scratchH=0,this.currentX=0,this.currentY=0,this.build(),this.populate(),this.texture=new Xe(this.canvas2),this.texture.flipY=!1,this.texture.needsUpdate=!0}function Is(t,e,i,n,r){var o=r||{};o.forceTransparent=!0,this.fontFamily=d(o.fontFamily,"sans-serif"),this.fontStyle=d(o.fontStyle,"normal"),this.fontWeight=d(o.fontWeight,"bold"),this.fontSize=d(o.fontSize,48),this.sdf=d(o.sdf,"Chrome"===Jg),this.xOffset=d(o.xOffset,0),this.yOffset=d(o.yOffset,0),this.zOffset=d(o.zOffset,.5),this.attachment=d(o.attachment,"bottom-left"),this.showBorder=d(o.showBorder,!1),this.borderColor=d(o.borderColor,"lightgrey"),this.borderWidth=d(o.borderWidth,.15),this.showBackground=d(o.showBackground,!1),this.backgroundColor=d(o.backgroundColor,"lightgrey"),this.backgroundMargin=d(o.backgroundMargin,.5),this.backgroundOpacity=d(o.backgroundOpacity,1);for(var a=t.length/3,s=0,c=0;ca?u[h]=-1:(o=Math.sqrt(a-r),u[h]=Math.floor(o)),++h;w[l]=c,_[l]=u}}function o(i){var n,r,o,a,s,c,u,h,l,d,f,m,b,S,P,T,E,I,L=3*i,O=i;n=Math.floor(.5+p*(t[L]+x[0])),r=Math.floor(.5+p*(t[L+1]+x[1])),o=Math.floor(.5+p*(t[L+2]+x[2]));var D,N=e[O],k=_[N],F=0,z=v*y,B=w[N];for(d=0;d=g||S>=v||P>=y)){var U=b*z+S*y+P;if(A)if(M[U]&R){if(M[U]&R){var j=C[U];j!==L&&(a=n+u-Math.floor(.5+p*(t[j]+x[0])),s=r+h-Math.floor(.5+p*(t[j+1]+x[1])),c=o+l-Math.floor(.5+p*(t[j+2]+x[2])),u*u+h*h+l*l=g||f>=v||m>=y)){var z=d*F+f*y+m;if(M[z]&O){if(A){var B=C[z];a=Math.floor(.5+p*(t[B]+x[0])),s=Math.floor(.5+p*(t[B+1]+x[1])),c=Math.floor(.5+p*(t[B+2]+x[2])),u*u+h*h+l*l-1&&a-1&&c-1&&s0);var p,b=m*m,x=new Uint16Array(3);for(t=0;t=b)||(M[r]|=D,A&&M[r]&O&&(o.toArray(t,e,i,x),p=x[0]*a+x[1]*y+x[2],C[r]=C[p])));console.timeEnd("EDTSurface fastdistancemap")}function l(t,e,i,n){var r,o,a,s,c,u,h,l,d,f,p,m,b=new Uint16Array(3),x=0;if(0===i)return x;var _=-1,w=-1,S=-1,A=v*y;for(h=0,d=i;h-1&&w-1&&S-1&&(p=_*A+y*w+S,M[p]&R&&!(M[p]&O)?(e.fromArray(_,w,S,b),s=_-b[0],c=w-b[1],u=S-b[2],f=s*s+c*c+u*u,P[p]=f,M[p]|=O,M[p]|=D,n[x]=_,n[x+1]=w,n[x+2]=S,x+=3):M[p]&R&&M[p]&O&&(s=_-b[0],c=w-b[1],u=S-b[2],f=s*s+c*c+u*u,f-1&&w-1&&S-1&&(p=_*A+y*w+S,M[p]&R&&!(M[p]&O)?(e.fromArray(_,w,S,b),s=_-b[0],c=w-b[1],u=S-b[2],f=s*s+c*c+u*u,P[p]=f,M[p]|=O,M[p]|=D,n[x]=_,n[x+1]=w,n[x+2]=S,x+=3):M[p]&R&&M[p]&O&&(s=_-b[0],c=w-b[1],u=S-b[2],f=s*s+c*c+u*u,f-1&&w-1&&S-1&&(p=_*A+y*w+S,M[p]&R&&!(M[p]&O)?(e.fromArray(_,w,S,b),s=_-b[0],c=w-b[1],u=S-b[2],f=s*s+c*c+u*u,P[p]=f,M[p]|=O,M[p]|=D,n[x]=_,n[x+1]=w,n[x+2]=S,x+=3):M[p]&R&&M[p]&O&&(s=_-b[0],c=w-b[1],u=S-b[2],f=s*s+c*c+u*u,fT&&(T=R)}this.neighbourListLength=27*T+1,this.withinRadii=function(r,o,a,c,d){for(var f=0,p=s(r,u),y=s(o,h),x=s(a,l),_=Math.max(0,p-1),w=Math.max(0,y-1),S=Math.max(0,x-1),C=Math.min(m,p+1),T=Math.min(g,y+1),E=Math.min(v,x+1),I=_;I<=C;++I)for(var L=I*b,R=w;R<=T;++R)for(var O=R*g,D=S;D<=E;++D)for(var N=L+O+D,k=A[N],F=k+M[N],z=k;zP&&(P=A[h]);o(),a(),s(),W=-1}function r(t,e,i){for(var n=0;n=0;){if(o!==n&&o!==r&&u(o,t,e,i))return W=o,o;o=j[++a]}return W=-1,-1}function u(e,i,n,r){var o=3*e,a=M[e],s=t[o]-i,c=t[o+1]-n,u=t[o+2]-r,h=s*s+c*c+u*u;return h=0;)t0&&s65535?Uint32Array:Uint16Array;this.meshIndex=new l(h),this.makeIndex(),ba.call(this,this.meshPosition,this.meshColor,this.meshIndex,this.meshNormal,this.meshPickingColor,s),this.vertexShader="Ribbon.vert",this.fragmentShader="Mesh.frag",this.geometry.addAttribute("dir",new Kt(new Float32Array(h),3)),this.geometry.addAttribute("size",new Kt(new Float32Array(u),1)),this.setAttributes({position:t,normal:e,dir:i,color:n,size:r,pickingColor:o})}function Ks(t,e,i){Xa.call(this,t,e,i),this.defaultScale.sstruc*=3}function Qs(t,e,i){this.helixbundleList=[],Xa.call(this,t,e,i)}function Js(t,e,i){As.call(this,t,e,i)}function tc(t,e,i){Xa.call(this,t,e,i)}function ec(t,e,i){var n=i||{};this.size=t.length/3,this.vertexShader="Line.vert",this.fragmentShader="Line.frag",this.line=!0;var r=this.size,o=r-1;this.attributeSize=2*o,this.linePosition=new Float32Array(3*o*2),this.lineColor=new Float32Array(3*o*2),ya.call(this,this.linePosition,this.lineColor,void 0,void 0,n),this.setAttributes({position:t,color:e})}function ic(t,e,i){Xa.call(this,t,e,i)}function nc(t,e,i){As.call(this,t,e,i)}function rc(t,e,i){Xa.call(this,t,e,i)}function oc(t,e){var i=e||{};this.streamer=t,this.name=d(i.name,""),this.path=d(i.path,"")}function ac(t){function e(t){for(var e=l.atomCount[t],r=l.atomOffset[t],o=new Array(e),a=0;a0&&e(g-1),l.growIfFull(),l.resno[g]=_,void 0!==S&&(l.sstruc[g]=S.charCodeAt(0)),void 0!==A&&(l.inscode[g]=A.charCodeAt(0)),l.atomOffset[g]=m,l.atomCount[g]=0,l.count+=1,l.chainIndex[g]=v,d.residueCount[v]+=1),h.count+=1,h.residueIndex[m]=g,l.atomCount[g]+=1,r=t,o=b,a=x,s=_,c=A,u=w},this.finalize=function(){i=a,n=u,g>-1&&e(g)}}function sc(t,e){var i=e||{};this.firstModelOnly=d(i.firstModelOnly,!1),this.asTrajectory=d(i.asTrajectory,!1),this.cAlphaOnly=d(i.cAlphaOnly,!1),oc.call(this,t,i),this.structure=new ea(this.name,this.path),this.structureBuilder=new ac(this.structure)}function cc(t,e,i,n,r,o,a,s){this.a=t||1,this.b=e||1,this.c=i||1,this.alpha=n||90,this.beta=r||90,this.gamma=o||90,this.spacegroup=a||"P 1";var c=wn(this.alpha),u=wn(this.beta),h=wn(this.gamma),l=Math.cos(c),d=Math.cos(u),f=Math.cos(h),p=Math.sin(u),m=Math.sin(h);if(this.volume=this.a*this.b*this.c*Math.sqrt(1-l*l-d*d-f*f+2*l*d*f),void 0===s){var g=this.a*this.b*m/this.volume,v=(d*f-l)/(p*m);this.fracToCart=(new O).set(this.a,0,0,0,this.b*f,this.b*m,0,0,this.c*d,-this.c*p*v,1/g,0,0,0,0,1).transpose(),this.cartToFrac=(new O).getInverse(this.fracToCart)}else this.cartToFrac=s,this.fracToCart=(new O).getInverse(this.cartToFrac)}function uc(t,e){sc.call(this,t,e)}function hc(t,e){sc.call(this,t,e)}function lc(t,e){sc.call(this,t,e)}function dc(t){switch(t=t.toLowerCase()){case"polymer":return Op;case"non-polymer":return Dp;case"macrolide":return Np;case"water":return kp;default:return Rp}}function fc(t,e,i,n,r){this.structure=t,this.index=e,this.description=i||"",this.entityType=dc(n||""),this.chainIndexList=r||[],r.forEach(function(i){t.chainStore.entityIndex[i]=e})}function pc(t,e){Array.isArray(t[e])||Object.keys(t).forEach(function(e){t[e]=[t[e]]})}function mc(t){return"?"!==t}function gc(t,e,i){var n,r,o=e.atomStore,a=e.atomMap,s=t.chem_comp,c=t.chem_comp_atom,u=t.chem_comp_bond;s&&(s.name&&(e.title=s.name.trim().replace(jv,"")),s.id&&(e.id=s.id.trim().replace(jv,"")));var h={};if(c){var l,d,f,p;for(r=c.comp_id.length,n=0;n0){o=o.split("(");var c=s(o[0]),u=s(o[1]);Object.keys(c).forEach(function(t){Object.keys(u).forEach(function(e){var i=new O;i.multiplyMatrices(c[t],u[e]),n[t+"x"+e]=i})})}else n=s(o);var h=[];for(var l in n)h.push(n[l]);var d=t;/^(0|[1-9][0-9]*)$/.test(d)&&(d="BU"+d);for(var f=a.asym_id_list[e].split(","),p=0,m=f.length;pw){var S=_;_=w,w=S;var A=p;p=b,b=A}if(0!==_&&0!==w)for(var M=0;Mo&&++s;e=new Int32Array(s)}for(i=0,n=0;in){for(var r=[],o=0;o>>16&65535|0,a=0;0!==i;){a=i>2e3?2e3:i,i-=a;do r=r+e[n++]|0,o=o+r|0;while(--a);r%=65521,o%=65521}return r|o<<16|0}function mu(){for(var t,e=[],i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}function gu(t,e,i,n){var r=qv,o=n+i;t^=-1;for(var a=n;a>>8^r[255&(t^e[a])];return t^-1}function vu(t,e){var i,n,r,o,a,s,c,u,h,l,d,f,p,m,g,v,y,b,x,_,w,S,A,M,P;i=t.state,n=t.next_in,M=t.input,r=n+(t.avail_in-5),o=t.next_out,P=t.output,a=o-(e-t.avail_out),s=o+(t.avail_out-257),c=i.dmax,u=i.wsize,h=i.whave,l=i.wnext,d=i.window,f=i.hold,p=i.bits,m=i.lencode,g=i.distcode,v=(1<>>24,f>>>=x,p-=x,x=b>>>16&255,0===x)P[o++]=65535&b;else{if(!(16&x)){if(0===(64&x)){b=m[(65535&b)+(f&(1<>>=x,p-=x),p<15&&(f+=M[n++]<>>24,f>>>=x,p-=x,x=b>>>16&255,!(16&x)){if(0===(64&x)){b=g[(65535&b)+(f&(1<c){t.msg="invalid distance too far back",i.mode=Yv;break t}if(f>>>=x,p-=x,x=o-a,w>x){if(x=w-x,x>h&&i.sane){t.msg="invalid distance too far back",i.mode=Yv;break t}if(S=0,A=d,0===l){if(S+=u-x,x<_){_-=x;do P[o++]=d[S++];while(--x);S=o-w,A=P}}else if(l2;)P[o++]=A[S++],P[o++]=A[S++],P[o++]=A[S++],_-=3;_&&(P[o++]=A[S++],_>1&&(P[o++]=A[S++]))}else{S=o-w;do P[o++]=P[S++],P[o++]=P[S++],P[o++]=P[S++],_-=3;while(_>2);_&&(P[o++]=P[S++],_>1&&(P[o++]=P[S++]))}break}}break}}while(n>3,n-=_,p-=_<<3,f&=(1<=1&&0===I[_];_--);if(w>_&&(w=_),0===_)return r[o++]=20971520,r[o++]=20971520,s.bits=1,0;for(x=1;x<_&&0===I[x];x++);for(w0&&(t===ty||1!==_))return-1;for(L[1]=0,y=1;yQv||t===iy&&P>Jv)return 1;for(var D=0;;){D++,p=y-A,a[b]f?(m=R[O+a[b]],g=T[E+a[b]]):(m=96,g=0),c=1<>A)+u]=p<<24|m<<16|g|0;while(0!==u);for(c=1<>=1;if(0!==c?(C&=c-1,C+=c):C=0,b++,0===--I[y]){if(y===_)break;y=e[i+a[b]]}if(y>w&&(C&l)!==h){for(0===A&&(A=w),d+=x,S=y-A,M=1<Qv||t===iy&&P>Jv)return 1;h=C&l,r[h]=w<<24|S<<16|d-o|0}}return 0!==C&&(r[d+C]=y-A<<24|64<<16|0),s.bits=w,0}function bu(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function xu(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _u(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=_y,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(Jy),e.distcode=e.distdyn=new Int32Array(tb),e.sane=1,e.back=-1,fy):gy}function wu(t){var e;return t&&t.state?(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,_u(t)):gy}function Su(t,e){var i,n;return t&&t.state?(n=t.state,e<0?(i=0,e=-e):(i=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15)?gy:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,wu(t))):gy}function Au(t,e){var i,n;return t?(n=new xu,t.state=n,n.window=null,i=Su(t,e),i!==fy&&(t.state=null),i):gy}function Mu(t){if(eb){var e;for(Wv=new Int32Array(512),Xv=new Int32Array(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(yu(cy,t.lens,0,288,Wv,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;yu(uy,t.lens,0,32,Xv,0,t.work,{bits:5}),eb=!1}t.lencode=Wv,t.lenbits=9,t.distcode=Xv,t.distbits=5}function Pu(t,e,i,n){var r,o=t.state;return null===o.window&&(o.wsize=1<=o.wsize?(du(o.window,e,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(r=o.wsize-o.wnext,r>n&&(r=n),du(o.window,e,i-n,r,o.wnext),n-=r,n?(du(o.window,e,i-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,i.check=gu(i.check,C,2,0),u=0,h=0,i.mode=wy;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&u)<<8)+(u>>8))%31){t.msg="incorrect header check",i.mode=Zy;break}if((15&u)!==xy){t.msg="unknown compression method",i.mode=Zy;break}if(u>>>=4,h-=4,w=(15&u)+8,0===i.wbits)i.wbits=w;else if(w>i.wbits){t.msg="invalid window size",i.mode=Zy;break}i.dmax=1<>8&1),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=gu(i.check,C,2,0)),u=0,h=0,i.mode=Sy;case Sy:for(;h<32;){if(0===s)break t;s--,u+=n[o++]<>>8&255,C[2]=u>>>16&255,C[3]=u>>>24&255,i.check=gu(i.check,C,4,0)),u=0,h=0,i.mode=Ay;case Ay:for(;h<16;){if(0===s)break t;s--,u+=n[o++]<>8),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=gu(i.check,C,2,0)),u=0,h=0,i.mode=My;case My:if(1024&i.flags){for(;h<16;){if(0===s)break t;s--,u+=n[o++]<>>8&255,i.check=gu(i.check,C,2,0)),u=0,h=0}else i.head&&(i.head.extra=null);i.mode=Py;case Py:if(1024&i.flags&&(f=i.length,f>s&&(f=s),f&&(i.head&&(w=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),du(i.head.extra,n,o,f,w)),512&i.flags&&(i.check=gu(i.check,n,f,o)),s-=f,o+=f,i.length-=f),i.length))break t;i.length=0,i.mode=Cy;case Cy:if(2048&i.flags){if(0===s)break t;f=0;do w=n[o+f++],i.head&&w&&i.length<65536&&(i.head.name+=String.fromCharCode(w));while(w&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=Ry;break;case Iy:for(;h<32;){if(0===s)break t;s--,u+=n[o++]<>>=7&h,h-=7&h,i.mode=Xy;break}for(;h<3;){if(0===s)break t;s--,u+=n[o++]<>>=1,h-=1,3&u){case 0:i.mode=Dy;break;case 1:if(Mu(i),i.mode=Uy,e===dy){u>>>=2,h-=2;break t}break;case 2:i.mode=Fy;break;case 3:t.msg="invalid block type",i.mode=Zy}u>>>=2,h-=2;break;case Dy:for(u>>>=7&h,h-=7&h;h<32;){if(0===s)break t;s--,u+=n[o++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=Zy;break}if(i.length=65535&u,u=0,h=0,i.mode=Ny,e===dy)break t;case Ny:i.mode=ky;case ky:if(f=i.length){if(f>s&&(f=s),f>c&&(f=c),0===f)break t;du(r,n,o,f,a),s-=f,o+=f,c-=f,a+=f,i.length-=f;break}i.mode=Ry;break;case Fy:for(;h<14;){if(0===s)break t;s--,u+=n[o++]<>>=5,h-=5,i.ndist=(31&u)+1,u>>>=5,h-=5,i.ncode=(15&u)+4,u>>>=4,h-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=Zy;break}i.have=0,i.mode=zy;case zy:for(;i.have>>=3,h-=3}for(;i.have<19;)i.lens[T[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,A={bits:i.lenbits},S=yu(sy,i.lens,0,19,i.lencode,0,i.work,A),i.lenbits=A.bits,S){t.msg="invalid code lengths set",i.mode=Zy;break}i.have=0,i.mode=By;case By:for(;i.have>>24,v=P>>>16&255,y=65535&P,!(g<=h);){if(0===s)break t;s--,u+=n[o++]<>>=g,h-=g,i.lens[i.have++]=y;else{if(16===y){for(M=g+2;h>>=g,h-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=Zy;break}w=i.lens[i.have-1],f=3+(3&u),u>>>=2,h-=2}else if(17===y){for(M=g+3;h>>=g,h-=g,w=0,f=3+(7&u),u>>>=3,h-=3}else{for(M=g+7;h>>=g,h-=g,w=0,f=11+(127&u),u>>>=7,h-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=Zy;break}for(;f--;)i.lens[i.have++]=w}}if(i.mode===Zy)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=Zy;break}if(i.lenbits=9,A={bits:i.lenbits},S=yu(cy,i.lens,0,i.nlen,i.lencode,0,i.work,A),i.lenbits=A.bits,S){t.msg="invalid literal/lengths set",i.mode=Zy;break}if(i.distbits=6,i.distcode=i.distdyn,A={bits:i.distbits},S=yu(uy,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,A),i.distbits=A.bits,S){t.msg="invalid distances set",i.mode=Zy;break}if(i.mode=Uy,e===dy)break t;case Uy:i.mode=jy;case jy:if(s>=6&&c>=258){t.next_out=a,t.avail_out=c,t.next_in=o,t.avail_in=s,i.hold=u,i.bits=h,vu(t,d),a=t.next_out,r=t.output,c=t.avail_out,o=t.next_in,n=t.input,s=t.avail_in,u=i.hold,h=i.bits,i.mode===Ry&&(i.back=-1);break}for(i.back=0;P=i.lencode[u&(1<>>24,v=P>>>16&255,y=65535&P,!(g<=h);){if(0===s)break t;s--,u+=n[o++]<>b)],g=P>>>24,v=P>>>16&255,y=65535&P,!(b+g<=h);){if(0===s)break t;s--,u+=n[o++]<>>=b,h-=b,i.back+=b}if(u>>>=g,h-=g,i.back+=g,i.length=y,0===v){i.mode=Wy;break}if(32&v){i.back=-1,i.mode=Ry;break}if(64&v){t.msg="invalid literal/length code",i.mode=Zy;break}i.extra=15&v,i.mode=$y;case $y:if(i.extra){for(M=i.extra;h>>=i.extra,h-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=Vy;case Vy:for(;P=i.distcode[u&(1<>>24,v=P>>>16&255,y=65535&P,!(g<=h);){if(0===s)break t;s--,u+=n[o++]<>b)],g=P>>>24,v=P>>>16&255,y=65535&P,!(b+g<=h);){if(0===s)break t;s--,u+=n[o++]<>>=b,h-=b,i.back+=b}if(u>>>=g,h-=g,i.back+=g,64&v){t.msg="invalid distance code",i.mode=Zy;break}i.offset=y,i.extra=15&v,i.mode=Gy;case Gy:if(i.extra){for(M=i.extra;h>>=i.extra,h-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=Zy;break}i.mode=Hy;case Hy:if(0===c)break t;if(f=d-c,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=Zy;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),m=i.window}else m=r,p=a-i.offset,f=i.length;f>c&&(f=c),c-=f,i.length-=f;do r[a++]=m[p++];while(--f);0===i.length&&(i.mode=jy);break;case Wy:if(0===c)break t;r[a++]=i.length,c--,i.mode=jy;break;case Xy:if(i.wrap){for(;h<32;){if(0===s)break t;s--,u|=n[o++]<>>6,e[o++]=128|63&i):i<65536?(e[o++]=224|i>>>12,e[o++]=128|i>>>6&63,e[o++]=128|63&i):(e[o++]=240|i>>>18,e[o++]=128|i>>>12&63,e[o++]=128|i>>>6&63,e[o++]=128|63&i);return e}function Ru(t,e){if(e<65537&&(t.subarray&&nb||!t.subarray&&ib))return String.fromCharCode.apply(null,lu(t,e));for(var i="",n=0;n4)s[n++]=65533,i+=o-1;else{for(r&=2===o?31:3===o?15:7;o>1&&i1?s[n++]=65533:r<65536?s[n++]=r:(r-=65536,s[n++]=55296|r>>10&1023,s[n++]=56320|1023&r)}return Ru(s,n)}function Nu(t,e){var i;for(e=e||t.length,e>t.length&&(e=t.length),i=e-1;i>=0&&128===(192&t[i]);)i--;return i<0?e:0===i?e:i+rb[t[i]]>e?i:e}function ku(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}function Fu(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}function zu(t){if(!(this instanceof zu))return new zu(t);this.options=hu({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0===(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ku,this.strm.avail_out=0;var i=Au(this.strm,e.windowBits);if(i!==ub)throw new Error(fb[i]);this.header=new Fu,Eu(this.strm,this.header)}function Bu(t,e){var i=new zu(e);if(i.push(t,!0),i.err)throw i.msg;return i.result}function Uu(t){var e;t instanceof ArrayBuffer&&(t=new Uint8Array(t));try{e=Bu(t)}catch(i){e=t}return e}function ju(){this.getUrl=function(t){var e,i=y(t),n=i.name.substr(0,4);return!["pdb","cif"].includes(i.ext)||i.compressed!==!1&&"gz"!==i.compressed?"mmtf"===i.ext?e=i.base.endsWith(".bb")?yb+n:vb+n:i.ext?(nv.warn("unsupported ext",i.ext),e=vb+n):e=vb+n:e=mb+i.path,f()+e},this.getExt=function(t){var e=y(t);if("mmtf"===e.ext||!e.ext)return"mmtf"}}function $u(){this.getUrl=function(t){var e,i=y(t),n=i.name;return i.ext&&"sdf"!==i.ext?(nv.warn("unsupported ext",i.ext),e=bb+n+xb):e=bb+n+xb,f()+e},this.getExt=function(t){var e=y(t);if(!e.ext||"sdf"===e.ext)return"sdf"}}function Vu(){this.getUrl=function(t){return t}}function Gu(t){t=t||"",this.getUrl=function(e){var i=y(e);return m(t+i.path)}}!function(t){t.console=t.console||{};for(var e,i,n=t.console,r={},o=function(){},a="memory".split(","),s="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(",");e=a.pop();)n[e]||(n[e]=r);for(;i=s.pop();)n[i]||(n[i]=o)}("undefined"==typeof window?self:window),HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(t,e,i){for(var n=window.atob(this.toDataURL(e,i).split(",")[1]),r=n.length,o=r>>2,a=new Uint8Array(r),s=new Uint32Array(a.buffer,0,o),c=0,u=0;c-9007199254740992&&t<9007199254740992&&Math.floor(t)===t}),Number.isNaN||(Number.isNaN=function(t){return t!==t}),Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert first argument to object");for(var e,i=Object(t),n=!1,r=1;r1?arguments[1]:void 0,s=a?Number(a):0;s!=s&&(s=0);var c=Math.min(Math.max(s,0),n);if(o+c>n)return!1;for(var u=-1;++ui.length)&&(e=i.length),e-=t.length;var n=i.indexOf(t,e);return n!==-1&&n===e}),String.prototype.includes||(String.prototype.includes=function(t,e){return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&this.indexOf(t,e)!==-1}),Array.prototype.includes||(Array.prototype.includes=function(t){if(null==this)throw new TypeError("Array.prototype.includes called on null or undefined");var e=Object(this),i=parseInt(e.length,10)||0;if(0===i)return!1;var n,r=parseInt(arguments[1],10)||0;r>=0?n=r:(n=i+r,n<0&&(n=0));for(var o;n0?1:-1)*Math.floor(Math.abs(e)):e},n=Math.pow(2,53)-1,r=function(t){var e=i(t);return Math.min(Math.max(e,0),n)};return function(t){var i=this,n=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var o,a=arguments.length>1?arguments[1]:void 0;if("undefined"!=typeof a){if(!e(a))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(o=arguments[2])}for(var s,c=r(n.length),u=e(i)?Object(new i(c)):new Array(c),h=0;he?1:0}return function(e,i,n){var r=0,o=e.length-1;for(n||(n=t);r<=o;){var a=r+o>>1,s=n(i,e[a]);if(s>0)r=a+1;else{if(!(s<0))return a;o=a-1}}return-r-1}}();void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t; -}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&!function(){Object.assign=function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i>=4,i[r]=e[19===r?3&t|8:t]);return i.join("")}}(),clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e),t*t*(3-2*t))},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e),t*t*t*(t*(6*t-15)+10))},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*ad.DEG2RAD},radToDeg:function(t){return t*ad.RAD2DEG},isPowerOfTwo:function(t){return 0===(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t++,t}};I.prototype={constructor:I,isVector2:!0,get width(){return this.x},set width(t){this.x=t},get height(){return this.y},set height(t){this.y=t},set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t):(this.x=0,this.y=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t,e;return function(i,n){return void 0===t&&(t=new I,e=new I),t.set(i,i),e.set(n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,i))/i)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromAttribute:function(t,e,i){return void 0===i&&(i=0),e=e*t.itemSize+i,this.x=t.array[e],this.y=t.array[e+1],this},rotateAround:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*i-o*n+t.x,this.y=r*n+o*i+t.y,this}},L.DEFAULT_IMAGE=void 0,L.DEFAULT_MAPPING=qh,L.prototype={constructor:L,isTexture:!0,set needsUpdate(t){t===!0&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){function e(t){var e;return void 0!==t.toDataURL?e=t:(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0,t.width,t.height)),e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var i={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var n=this.image;void 0===n.uuid&&(n.uuid=ad.generateUUID()),void 0===t.images[n.uuid]&&(t.images[n.uuid]={uuid:n.uuid,url:e(n)}),i.image=n.uuid}return t.textures[this.uuid]=i,i},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===qh){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case il:t.x=t.x-Math.floor(t.x);break;case nl:t.x=t.x<0?0:1;break;case rl:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case il:t.y=t.y-Math.floor(t.y);break;case nl:t.y=t.y<0?0:1;break;case rl:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}},Object.assign(L.prototype,E.prototype);var sd=0;O.prototype={constructor:O,isMatrix4:!0,set:function(t,e,i,n,r,o,a,s,c,u,h,l,d,f,p,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=r,g[5]=o,g[9]=a,g[13]=s,g[2]=c,g[6]=u,g[10]=h,g[14]=l,g[3]=d,g[7]=f,g[11]=p,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new O).fromArray(this.elements)},copy:function(t){return this.elements.set(t.elements),this},copyPosition:function(t){var e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this},extractBasis:function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this},extractRotation:function(){var t;return function(e){void 0===t&&(t=new N);var i=this.elements,n=e.elements,r=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length(),a=1/t.setFromMatrixColumn(e,2).length();return i[0]=n[0]*r,i[1]=n[1]*r,i[2]=n[2]*r,i[4]=n[4]*o,i[5]=n[5]*o,i[6]=n[6]*o,i[8]=n[8]*a,i[9]=n[9]*a,i[10]=n[10]*a,this}}(),makeRotationFromEuler:function(t){(t&&t.isEuler)===!1&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,i=t.x,n=t.y,r=t.z,o=Math.cos(i),a=Math.sin(i),s=Math.cos(n),c=Math.sin(n),u=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){var l=o*u,d=o*h,f=a*u,p=a*h;e[0]=s*u,e[4]=-s*h,e[8]=c,e[1]=d+f*c,e[5]=l-p*c,e[9]=-a*s,e[2]=p-l*c,e[6]=f+d*c,e[10]=o*s}else if("YXZ"===t.order){var m=s*u,g=s*h,v=c*u,y=c*h;e[0]=m+y*a,e[4]=v*a-g,e[8]=o*c,e[1]=o*h,e[5]=o*u,e[9]=-a,e[2]=g*a-v,e[6]=y+m*a,e[10]=o*s}else if("ZXY"===t.order){var m=s*u,g=s*h,v=c*u,y=c*h;e[0]=m-y*a,e[4]=-o*h,e[8]=v+g*a,e[1]=g+v*a,e[5]=o*u,e[9]=y-m*a,e[2]=-o*c,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){var l=o*u,d=o*h,f=a*u,p=a*h;e[0]=s*u,e[4]=f*c-d,e[8]=l*c+p,e[1]=s*h,e[5]=p*c+l,e[9]=d*c-f,e[2]=-c,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){var b=o*s,x=o*c,_=a*s,w=a*c;e[0]=s*u,e[4]=w-b*h,e[8]=_*h+x,e[1]=h,e[5]=o*u,e[9]=-a*u,e[2]=-c*u,e[6]=x*h+_,e[10]=b-w*h}else if("XZY"===t.order){var b=o*s,x=o*c,_=a*s,w=a*c;e[0]=s*u,e[4]=-h,e[8]=c*u,e[1]=b*h+w,e[5]=o*u,e[9]=x*h-_,e[2]=_*h-x,e[6]=a*u,e[10]=w*h+b}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,i=t.x,n=t.y,r=t.z,o=t.w,a=i+i,s=n+n,c=r+r,u=i*a,h=i*s,l=i*c,d=n*s,f=n*c,p=r*c,m=o*a,g=o*s,v=o*c;return e[0]=1-(d+p),e[4]=h-v,e[8]=l+g,e[1]=h+v,e[5]=1-(u+p),e[9]=f-m,e[2]=l-g,e[6]=f+m,e[10]=1-(u+d),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t,e,i;return function(n,r,o){void 0===t&&(t=new N,e=new N,i=new N);var a=this.elements;return i.subVectors(n,r).normalize(),0===i.lengthSq()&&(i.z=1),t.crossVectors(o,i).normalize(),0===t.lengthSq()&&(i.z+=1e-4,t.crossVectors(o,i).normalize()),e.crossVectors(i,t),a[0]=t.x,a[4]=e.x,a[8]=i.x,a[1]=t.y,a[5]=e.y,a[9]=i.y,a[2]=t.z,a[6]=e.z,a[10]=i.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,n=e.elements,r=this.elements,o=i[0],a=i[4],s=i[8],c=i[12],u=i[1],h=i[5],l=i[9],d=i[13],f=i[2],p=i[6],m=i[10],g=i[14],v=i[3],y=i[7],b=i[11],x=i[15],_=n[0],w=n[4],S=n[8],A=n[12],M=n[1],P=n[5],C=n[9],T=n[13],E=n[2],I=n[6],L=n[10],R=n[14],O=n[3],D=n[7],N=n[11],k=n[15];return r[0]=o*_+a*M+s*E+c*O,r[4]=o*w+a*P+s*I+c*D,r[8]=o*S+a*C+s*L+c*N,r[12]=o*A+a*T+s*R+c*k,r[1]=u*_+h*M+l*E+d*O,r[5]=u*w+h*P+l*I+d*D,r[9]=u*S+h*C+l*L+d*N,r[13]=u*A+h*T+l*R+d*k,r[2]=f*_+p*M+m*E+g*O,r[6]=f*w+p*P+m*I+g*D,r[10]=f*S+p*C+m*L+g*N,r[14]=f*A+p*T+m*R+g*k,r[3]=v*_+y*M+b*E+x*O,r[7]=v*w+y*P+b*I+x*D,r[11]=v*S+y*C+b*L+x*N,r[15]=v*A+y*T+b*R+x*k,this},multiplyToArray:function(t,e,i){var n=this.elements;return this.multiplyMatrices(t,e),i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i[4]=n[4],i[5]=n[5],i[6]=n[6],i[7]=n[7],i[8]=n[8],i[9]=n[9],i[10]=n[10],i[11]=n[11],i[12]=n[12],i[13]=n[13],i[14]=n[14],i[15]=n[15],this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToVector3Array:function(){var t;return function(e,i,n){void 0===t&&(t=new N),void 0===i&&(i=0),void 0===n&&(n=e.length);for(var r=0,o=i;r0?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(h-c)*e,this._y=(o-u)*e,this._z=(a-r)*e):n>s&&n>l?(e=2*Math.sqrt(1+n-s-l),this._w=(h-c)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(o+u)/e):s>l?(e=2*Math.sqrt(1+s-n-l),this._w=(o-u)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(c+h)/e):(e=2*Math.sqrt(1+l-n-s),this._w=(a-r)/e,this._x=(o+u)/e,this._y=(c+h)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e,i=1e-6;return function(n,r){return void 0===t&&(t=new N),e=n.dot(r)+1,eMath.abs(n.z)?t.set(-n.y,n.x,0):t.set(0,-n.z,n.y)):t.crossVectors(n,r),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var i=t._x,n=t._y,r=t._z,o=t._w,a=e._x,s=e._y,c=e._z,u=e._w;return this._x=i*u+o*a+n*c-r*s,this._y=n*u+o*s+r*a-i*c,this._z=r*u+o*c+i*s-n*a,this._w=o*u-i*a-n*s-r*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var i=this._x,n=this._y,r=this._z,o=this._w,a=o*t._w+i*t._x+n*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=i,this._y=n,this._z=r,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(i+this._x),this._y=.5*(n+this._y),this._z=.5*(r+this._z),this;var c=Math.atan2(s,a),u=Math.sin((1-e)*c)/s,h=Math.sin(e*c)/s;return this._w=o*u+this._w*h,this._x=i*u+this._x*h,this._y=n*u+this._y*h,this._z=r*u+this._z*h,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},Object.assign(D,{slerp:function(t,e,i,n){return i.copy(t).slerp(e,n)},slerpFlat:function(t,e,i,n,r,o,a){var s=i[n+0],c=i[n+1],u=i[n+2],h=i[n+3],l=r[o+0],d=r[o+1],f=r[o+2],p=r[o+3];if(h!==p||s!==l||c!==d||u!==f){var m=1-a,g=s*l+c*d+u*f+h*p,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var b=Math.sqrt(y),x=Math.atan2(b,g*v);m=Math.sin(m*x)/b,a=Math.sin(a*x)/b}var _=a*v;if(s=s*m+l*_,c=c*m+d*_,u=u*m+f*_,h=h*m+p*_,m===1-a){var w=1/Math.sqrt(s*s+c*c+u*u+h*h);s*=w,c*=w,u*=w,h*=w}}t[e]=s,t[e+1]=c,t[e+2]=u,t[e+3]=h}}),N.prototype={constructor:N,isVector3:!0,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t;return function(e){return(e&&e.isEuler)===!1&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===t&&(t=new D),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t;return function(e,i){return void 0===t&&(t=new D),this.applyQuaternion(t.setFromAxisAngle(e,i))}}(),applyMatrix3:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n+r[12],this.y=r[1]*e+r[5]*i+r[9]*n+r[13],this.z=r[2]*e+r[6]*i+r[10]*n+r[14],this},applyProjection:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements,o=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*o,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*o,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*o,this},applyQuaternion:function(t){var e=this.x,i=this.y,n=this.z,r=t.x,o=t.y,a=t.z,s=t.w,c=s*e+o*n-a*i,u=s*i+a*e-r*n,h=s*n+r*i-o*e,l=-r*e-o*i-a*n;return this.x=c*s+l*-r+u*-a-h*-o,this.y=u*s+l*-o+h*-r-c*-a,this.z=h*s+l*-a+c*-o-u*-r,this},project:function(){var t;return function(e){return void 0===t&&(t=new O),t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyProjection(t)}}(),unproject:function(){var t;return function(e){return void 0===t&&(t=new O),t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyProjection(t)}}(),transformDirection:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t,e;return function(i,n){return void 0===t&&(t=new N,e=new N),t.set(i,i,i),e.set(n,n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,i))/i)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var i=this.x,n=this.y,r=this.z;return this.x=n*t.z-r*t.y,this.y=r*t.x-i*t.z,this.z=i*t.y-n*t.x,this},crossVectors:function(t,e){var i=t.x,n=t.y,r=t.z,o=e.x,a=e.y,s=e.z;return this.x=n*s-r*a,this.y=r*o-i*s,this.z=i*a-n*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t;return function(e){return void 0===t&&(t=new N),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new N),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(ad.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return this.setFromMatrixColumn(t,3)},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this},setFromMatrixColumn:function(t,e){if("number"==typeof t){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var i=t;t=e,e=i}return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromAttribute:function(t,e,i){ -return void 0===i&&(i=0),e=e*t.itemSize+i,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this}},F.prototype={constructor:F,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;ethis.max.x||t.ythis.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){var i=e||new I;return i.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)},clampPoint:function(t,e){var i=e||new I;return i.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new I;return function(e){var i=t.copy(e).clamp(this.min,this.max);return i.sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},B.prototype=Object.create(L.prototype),B.prototype.constructor=B,B.prototype.isCubeTexture=!0,Object.defineProperty(B.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var cd=new L,ud=new B,hd=[],ld=[];gt.prototype.setValue=function(t,e){for(var i=this.seq,n=0,r=i.length;n!==r;++n){var o=i[n];o.setValue(t,e[o.id])}};var dd=/([\w\d_]+)(\])?(\[|\.)?/g;bt.prototype.setValue=function(t,e,i){var n=this.map[e];void 0!==n&&n.setValue(t,i,this.renderer)},bt.prototype.set=function(t,e,i){var n=this.map[i];void 0!==n&&n.setValue(t,e[i],this.renderer)},bt.prototype.setOptional=function(t,e,i){var n=e[i];void 0!==n&&this.setValue(t,i,n)},bt.upload=function(t,e,i,n){for(var r=0,o=e.length;r!==o;++r){var a=e[r],s=i[a.id];s.needsUpdate!==!1&&a.setValue(t,s.value,n)}},bt.seqWithValue=function(t,e){for(var i=[],n=0,r=t.length;n!==r;++n){var o=t[n];o.id in e&&i.push(o)}return i},bt.splitDynamic=function(t,e){for(var i=null,n=t.length,r=0,o=0;o!==n;++o){var a=t[o],s=e[a.id];s&&s.dynamic===!0?(null===i&&(i=[]),i.push(a)):(ry&&v>b?vb?y0&&(n.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),n.skinning=this.skinning,n.morphTargets=this.morphTargets,i){var r=e(t.textures),o=e(t.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows;var e=t.clippingPlanes,i=null;if(null!==e){var n=e.length;i=new Array(n);for(var r=0;r!==n;++r)i[r]=e[r].clone()}return this.clippingPlanes=i,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(At.prototype,E.prototype);var fd=0,pd={merge:function(t){for(var e={},i=0;i>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,i){return this.r=t,this.g=e,this.b=i,this},setHSL:function(){function t(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}return function(e,i,n){if(e=ad.euclideanModulo(e,1),i=ad.clamp(i,0,1),n=ad.clamp(n,0,1),0===i)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+i):n+i-n*i,o=2*n-r;this.r=t(o,r,e+1/3),this.g=t(o,r,e),this.b=t(o,r,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var n,r=i[1],o=i[2];switch(r){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,e(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,e(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(n[1])/360,s=parseInt(n[2],10)/100,c=parseInt(n[3],10)/100;return e(n[5]),this.setHSL(a,s,c)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(t)){var u=i[1],h=u.length;if(3===h)return this.r=parseInt(u.charAt(0)+u.charAt(0),16)/255,this.g=parseInt(u.charAt(1)+u.charAt(1),16)/255,this.b=parseInt(u.charAt(2)+u.charAt(2),16)/255,this;if(6===h)return this.r=parseInt(u.charAt(0)+u.charAt(1),16)/255,this.g=parseInt(u.charAt(2)+u.charAt(3),16)/255,this.b=parseInt(u.charAt(4)+u.charAt(5),16)/255,this}if(t&&t.length>0){var u=pp[t];void 0!==u?this.setHex(u):console.warn("THREE.Color: Unknown color "+t)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var i=e>0?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this},convertGammaToLinear:function(){var t=this.r,e=this.g,i=this.b;return this.r=t*t,this.g=e*e,this.b=i*i,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,i,n=t||{h:0,s:0,l:0},r=this.r,o=this.g,a=this.b,s=Math.max(r,o,a),c=Math.min(r,o,a),u=(c+s)/2;if(c===s)e=0,i=0;else{var h=s-c;switch(i=u<=.5?h/(s+c):h/(2-s-c),s){case r:e=(o-a)/h+(or&&(r=u),h>o&&(o=h),l>a&&(a=l)}this.min.set(e,i,n),this.max.set(r,o,a)},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){var i=e||new N;return i.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:function(){var t;return function(e){return void 0===t&&(t=new N),this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=t.constant&&i>=t.constant},clampPoint:function(t,e){var i=e||new N;return i.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new N;return function(e){var i=t.copy(e).clamp(this.min,this.max);return i.sub(e).length()}}(),getBoundingSphere:function(){var t=new N;return function(e){var i=e||new It;return i.center=this.center(),i.radius=.5*this.size(t).length(),i}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new N,new N,new N,new N,new N,new N,new N,new N];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},It.prototype={constructor:It,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new Et;return function(e,i){var n=this.center;void 0!==i?n.copy(i):t.setFromPoints(e).center(n);for(var r=0,o=0,a=e.length;othis.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(t){var e=t||new Et;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}},Lt.prototype={constructor:Lt,isMatrix3:!0,set:function(t,e,i,n,r,o,a,s,c){var u=this.elements;return u[0]=t,u[1]=n,u[2]=a,u[3]=e,u[4]=r,u[5]=s,u[6]=i,u[7]=o,u[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=t.elements;return this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToVector3Array:function(){var t;return function(e,i,n){void 0===t&&(t=new N),void 0===i&&(i=0),void 0===n&&(n=e.length);for(var r=0,o=i;r1))return n.copy(r).multiplyScalar(a).add(e.start)}else if(0===this.distanceToPoint(e.start))return n.copy(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){var e=t||new N;return e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new N,e=new Lt;return function(i,n){var r=this.coplanarPoint(t).applyMatrix4(i),o=n||e.getNormalMatrix(i),a=this.normal.applyMatrix3(o).normalize();return this.constant=-r.dot(a),this}}(),translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}},Ot.prototype={constructor:Ot,set:function(t,e,i,n,r,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(n),a[4].copy(r),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,i=0;i<6;i++)e[i].copy(t.planes[i]);return this},setFromMatrix:function(t){var e=this.planes,i=t.elements,n=i[0],r=i[1],o=i[2],a=i[3],s=i[4],c=i[5],u=i[6],h=i[7],l=i[8],d=i[9],f=i[10],p=i[11],m=i[12],g=i[13],v=i[14],y=i[15];return e[0].setComponents(a-n,h-s,p-l,y-m).normalize(),e[1].setComponents(a+n,h+s,p+l,y+m).normalize(),e[2].setComponents(a+r,h+c,p+d,y+g).normalize(),e[3].setComponents(a-r,h-c,p-d,y-g).normalize(),e[4].setComponents(a-o,h-u,p-f,y-v).normalize(),e[5].setComponents(a+o,h+u,p+f,y+v).normalize(),this},intersectsObject:function(){var t=new It;return function(e){var i=e.geometry;return null===i.boundingSphere&&i.computeBoundingSphere(),t.copy(i.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new It;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,i=t.center,n=-t.radius,r=0;r<6;r++){var o=e[r].distanceToPoint(i);if(o0?i.min.x:i.max.x,e.x=o.normal.x>0?i.max.x:i.min.x,t.y=o.normal.y>0?i.min.y:i.max.y,e.y=o.normal.y>0?i.max.y:i.min.y,t.z=o.normal.z>0?i.min.z:i.max.z,e.z=o.normal.z>0?i.max.z:i.min.z;var a=o.distanceToPoint(t),s=o.distanceToPoint(e);if(a<0&&s<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}};var vp=0;Kt.prototype={constructor:Kt,isBufferAttribute:!0,get count(){return this.array.length/this.itemSize},set needsUpdate(t){t===!0&&this.version++},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.normalized=t.normalized,this.dynamic=t.dynamic,this},copyAt:function(t,e,i){t*=this.itemSize,i*=e.itemSize;for(var n=0,r=this.itemSize;n1){for(var e=0;e1)for(var e=0;e0){r.children=[];for(var o=0;o0&&(n.geometries=a),s.length>0&&(n.materials=s),c.length>0&&(n.textures=c),u.length>0&&(n.images=u)}return n.object=r,n},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(var i=0;i0)for(var f=0;f0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,i,n,r;for(i=0,n=this.faces.length;i0&&(t+=e[i].distanceTo(e[i-1])),this.lineDistances[i]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Et),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new It),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,i){if((t&&t.isGeometry)===!1)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);var n,r=this.vertices.length,o=this.vertices,a=t.vertices,s=this.faces,c=t.faces,u=this.faceVertexUvs[0],h=t.faceVertexUvs[0];void 0===i&&(i=0),void 0!==e&&(n=(new Lt).getNormalMatrix(e));for(var l=0,d=a.length;l=0;i--){var g=f[i];for(this.faces.splice(g,1),a=0,s=this.faceVertexUvs.length;a0,w=v.vertexNormals.length>0,S=1!==v.color.r||1!==v.color.g||1!==v.color.b,A=v.vertexColors.length>0,M=0;if(M=t(M,0,0),M=t(M,1,y),M=t(M,2,b),M=t(M,3,x),M=t(M,4,_),M=t(M,5,w),M=t(M,6,S),M=t(M,7,A),h.push(M),h.push(v.a,v.b,v.c),h.push(v.materialIndex),x){var P=this.faceVertexUvs[0][c];h.push(n(P[0]),n(P[1]),n(P[2]))}if(_&&h.push(e(v.normal)),w){var C=v.vertexNormals;h.push(e(C[0]),e(C[1]),e(C[2]))}if(S&&h.push(i(v.color)),A){var T=v.vertexColors;h.push(i(T[0]),i(T[1]),i(T[2]))}}return r.data={},r.data.vertices=s,r.data.normals=l,f.length>0&&(r.data.colors=f),m.length>0&&(r.data.uvs=[m]),r.data.faces=h,r},clone:function(){return(new ae).copy(this)},copy:function(t){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var e=t.vertices,i=0,n=e.length;i0,a=r[1]&&r[1].length>0,s=t.morphTargets,c=s.length;if(c>0){e=[];for(var u=0;u0){h=[];for(var u=0;u0){var i=new Float32Array(3*t.normals.length);this.addAttribute("normal",new Kt(i,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var n=new Float32Array(3*t.colors.length);this.addAttribute("color",new Kt(n,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var r=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new Kt(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var o=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new Kt(o,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var a=t.vertices.length>65535?Uint32Array:Uint16Array,s=new a(3*t.indices.length);this.setIndex(new Kt(s,1).copyIndicesArray(t.indices))}this.groups=t.groups;for(var c in t.morphTargets){for(var u=[],h=t.morphTargets[c],l=0,d=h.length;l0){var m=new te(4*t.skinIndices.length,4);this.addAttribute("skinIndex",m.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var g=new te(4*t.skinWeights.length,4);this.addAttribute("skinWeight",g.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Et);var t=this.attributes.position.array;void 0!==t?this.boundingBox.setFromArray(t):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var t=new Et,e=new N;return function(){null===this.boundingSphere&&(this.boundingSphere=new It);var i=this.attributes.position;if(i){var n=i.array,r=this.boundingSphere.center;t.setFromArray(n),t.center(r);for(var o=0,a=0,s=n.length;a0&&(t.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(t.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),t},clone:function(){return(new ue).copy(this)},copy:function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var i=t.attributes;for(var n in i){var r=i[n];this.addAttribute(n,r.clone())}for(var o=t.groups,a=0,s=o.length;a0)if(s=d*p-f,c=d*f-p,h=l*g,s>=0)if(c>=-h)if(c<=h){var v=1/g;s*=v,c*=v,u=s*(s+d*c+2*f)+c*(d*s+c+2*p)+m}else c=l,s=Math.max(0,-(d*c+f)),u=-s*s+c*(c+2*p)+m;else c=-l,s=Math.max(0,-(d*c+f)),u=-s*s+c*(c+2*p)+m;else c<=-h?(s=Math.max(0,-(-d*l+f)),c=s>0?-l:Math.min(Math.max(-l,-p),l),u=-s*s+c*(c+2*p)+m):c<=h?(s=0,c=Math.min(Math.max(-l,-p),l),u=c*(c+2*p)+m):(s=Math.max(0,-(d*l+f)),c=s>0?l:Math.min(Math.max(-l,-p),l),u=-s*s+c*(c+2*p)+m);else c=d>0?-l:l,s=Math.max(0,-(d*c+f)),u=-s*s+c*(c+2*p)+m;return o&&o.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(e).multiplyScalar(c).add(t),u}}(),intersectSphere:function(){var t=new N;return function(e,i){t.subVectors(e.center,this.origin);var n=t.dot(this.direction),r=t.dot(t)-n*n,o=e.radius*e.radius;if(r>o)return null;var a=Math.sqrt(o-r),s=n-a,c=n+a;return s<0&&c<0?null:s<0?this.at(c,i):this.at(s,i)}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null},intersectPlane:function(t,e){var i=this.distanceToPlane(t);return null===i?null:this.at(i,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);if(0===e)return!0;var i=t.normal.dot(this.direction);return i*e<0},intersectBox:function(t,e){var i,n,r,o,a,s,c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,l=this.origin;return c>=0?(i=(t.min.x-l.x)*c,n=(t.max.x-l.x)*c):(i=(t.max.x-l.x)*c,n=(t.min.x-l.x)*c),u>=0?(r=(t.min.y-l.y)*u,o=(t.max.y-l.y)*u):(r=(t.max.y-l.y)*u,o=(t.min.y-l.y)*u),i>o||r>n?null:((r>i||i!==i)&&(i=r),(o=0?(a=(t.min.z-l.z)*h,s=(t.max.z-l.z)*h):(a=(t.max.z-l.z)*h,s=(t.min.z-l.z)*h),i>s||a>n?null:((a>i||i!==i)&&(i=a),(s=0?i:n,e)))},intersectsBox:function(){var t=new N;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new N,e=new N,i=new N,n=new N;return function(r,o,a,s,c){e.subVectors(o,r),i.subVectors(a,r),n.crossVectors(e,i);var u,h=this.direction.dot(n);if(h>0){if(s)return null;u=1}else{if(!(h<0))return null;u=-1,h=-h}t.subVectors(this.origin,r);var l=u*this.direction.dot(i.crossVectors(t,i));if(l<0)return null; -var d=u*this.direction.dot(e.cross(t));if(d<0)return null;if(l+d>h)return null;var f=-u*t.dot(n);return f<0?null:this.at(f/h,c)}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}},xe.prototype={constructor:xe,set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},center:function(t){var e=t||new N;return e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){var e=t||new N;return e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var i=e||new N;return this.delta(i).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new N,e=new N;return function(i,n){t.subVectors(i,this.start),e.subVectors(this.end,this.start);var r=e.dot(e),o=e.dot(t),a=o/r;return n&&(a=ad.clamp(a,0,1)),a}}(),closestPointToPoint:function(t,e,i){var n=this.closestPointToPointParameter(t,e),r=i||new N;return this.delta(r).multiplyScalar(n).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}},_e.normal=function(){var t=new N;return function(e,i,n,r){var o=r||new N;o.subVectors(n,i),t.subVectors(e,i),o.cross(t);var a=o.lengthSq();return a>0?o.multiplyScalar(1/Math.sqrt(a)):o.set(0,0,0)}}(),_e.barycoordFromPoint=function(){var t=new N,e=new N,i=new N;return function(n,r,o,a,s){t.subVectors(a,r),e.subVectors(o,r),i.subVectors(n,r);var c=t.dot(t),u=t.dot(e),h=t.dot(i),l=e.dot(e),d=e.dot(i),f=c*l-u*u,p=s||new N;if(0===f)return p.set(-2,-1,-1);var m=1/f,g=(l*h-u*d)*m,v=(c*d-u*h)*m;return p.set(1-g-v,v,g)}}(),_e.containsPoint=function(){var t=new N;return function(e,i,n,r){var o=_e.barycoordFromPoint(e,i,n,r,t);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}(),_e.prototype={constructor:_e,set:function(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this},setFromPointsAndIndices:function(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new N,e=new N;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){var e=t||new N;return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return _e.normal(this.a,this.b,this.c,t)},plane:function(t){var e=t||new Rt;return e.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return _e.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return _e.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t,e,i,n;return function(r,o){void 0===t&&(t=new Rt,e=[new xe,new xe,new xe],i=new N,n=new N);var a=o||new N,s=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(r,i),this.containsPoint(i)===!0)a.copy(i);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var c=0;c0){this.morphTargetBase=-1,this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,e=this.geometry.morphTargets.length;te.far?null:{distance:u,point:v.clone(),object:t}}function i(i,n,r,o,u,h,l,m){a.fromArray(o,3*h),s.fromArray(o,3*l),c.fromArray(o,3*m);var v=e(i,n,r,a,s,c,g);return v&&(u&&(d.fromArray(u,2*h),f.fromArray(u,2*l),p.fromArray(u,2*m),v.uv=t(g,a,s,c,d,f,p)),v.face=new ee(h,l,m,_e.normal(a,s,c)),v.faceIndex=h),v}var n=new O,r=new be,o=new It,a=new N,s=new N,c=new N,u=new N,h=new N,l=new N,d=new I,f=new I,p=new I,m=new N,g=new N,v=new N;return function(m,v){var y=this.geometry,b=this.material,x=this.matrixWorld;if(void 0!==b&&(null===y.boundingSphere&&y.computeBoundingSphere(),o.copy(y.boundingSphere),o.applyMatrix4(x),m.ray.intersectsSphere(o)!==!1&&(n.getInverse(x),r.copy(m.ray).applyMatrix4(n),null===y.boundingBox||r.intersectsBox(y.boundingBox)!==!1))){var _,w;if(y&&y.isBufferGeometry){var S,A,M,P=y.index,C=y.attributes,T=C.position.array;if(void 0!==C.uv&&(_=C.uv.array),null!==P)for(var E=P.array,I=0,L=E.length;I0&&(_=B);for(var U=0,j=z.length;Ur||i.push({distance:Math.sqrt(n),point:this.position,face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),Ne.prototype=Object.assign(Object.create(re.prototype),{constructor:Ne,copy:function(t){re.prototype.copy.call(this,t,!1);for(var e=t.levels,i=0,n=e.length;i1){t.setFromMatrixPosition(i.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var r=t.distanceTo(e);n[0].object.visible=!0;for(var o=1,a=n.length;o=n[o].distance;o++)n[o-1].object.visible=!1,n[o].object.visible=!0;for(;oa)){d.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(d);Sn.far||r.push({distance:S,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else for(var y=0,b=g.length/3-1;ya)){d.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(d);Sn.far||r.push({distance:S,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}else if(s&&s.isGeometry)for(var A=s.vertices,M=A.length,y=0;ya)){d.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(d);Sn.far||r.push({distance:S,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),$e.prototype=Object.assign(Object.create(je.prototype),{constructor:$e,isLineSegments:!0}),Ve.prototype=Object.create(At.prototype),Ve.prototype.constructor=Ve,Ve.prototype.isPointsMaterial=!0,Ve.prototype.copy=function(t){return At.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},Ge.prototype=Object.assign(Object.create(re.prototype),{constructor:Ge,isPoints:!0,raycast:function(){var t=new O,e=new be,i=new It;return function(n,r){function o(t,i){var o=e.distanceSqToPoint(t);if(on.far)return;r.push({distance:u,distanceToRay:Math.sqrt(o),point:s.clone(),index:i,face:null,object:a})}}var a=this,s=this.geometry,c=this.matrixWorld,u=n.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(c),n.ray.intersectsSphere(i)!==!1){t.getInverse(c),e.copy(n.ray).applyMatrix4(t);var h=u/((this.scale.x+this.scale.y+this.scale.z)/3),l=h*h,d=new N;if(s&&s.isBufferGeometry){var f=s.index,p=s.attributes,m=p.position.array;if(null!==f)for(var g=f.array,v=0,y=g.length;v0||0===t.search(/^data\:image\/jpeg/);r.format=n?Al:Ml,r.image=i,r.needsUpdate=!0,void 0!==e&&e(r)},i,n),r},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this}}),ei.prototype=Object.assign(Object.create(re.prototype),{constructor:ei,isLight:!0,copy:function(t){return re.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=re.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),ii.prototype=Object.assign(Object.create(ei.prototype),{constructor:ii,isHemisphereLight:!0,copy:function(t){return ei.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(ni.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),ri.prototype=Object.assign(Object.create(ni.prototype),{constructor:ri,isSpotLightShadow:!0,update:function(t){var e=2*ad.RAD2DEG*t.angle,i=this.mapSize.width/this.mapSize.height,n=t.distance||500,r=this.camera;e===r.fov&&i===r.aspect&&n===r.far||(r.fov=e,r.aspect=i,r.far=n,r.updateProjectionMatrix())}}),oi.prototype=Object.assign(Object.create(ei.prototype),{constructor:oi,isSpotLight:!0,copy:function(t){return ei.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),ai.prototype=Object.assign(Object.create(ei.prototype),{constructor:ai,isPointLight:!0,copy:function(t){return ei.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),si.prototype=Object.assign(Object.create(ni.prototype),{constructor:si}),ci.prototype=Object.assign(Object.create(ei.prototype),{constructor:ci,isDirectionalLight:!0,copy:function(t){return ei.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),ui.prototype=Object.assign(Object.create(ei.prototype),{constructor:ui,isAmbientLight:!0});var wp={arraySlice:function(t,e,i){return wp.isTypedArray(t)?new t.constructor(t.subarray(e,i)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){function e(e,i){return t[e]-t[i]}for(var i=t.length,n=new Array(i),r=0;r!==i;++r)n[r]=r;return n.sort(e),n},sortedArray:function(t,e,i){for(var n=t.length,r=new t.constructor(n),o=0,a=0;a!==n;++o)for(var s=i[o]*e,c=0;c!==e;++c)r[a++]=t[s+c];return r},flattenJSON:function(t,e,i,n){for(var r=1,o=t[0];void 0!==o&&void 0===o[n];)o=t[r++];if(void 0!==o){var a=o[n];if(void 0!==a)if(Array.isArray(a)){do a=o[n],void 0!==a&&(e.push(o.time),i.push.apply(i,a)),o=t[r++];while(void 0!==o)}else if(void 0!==a.toArray){do a=o[n],void 0!==a&&(e.push(o.time),a.toArray(i,i.length)),o=t[r++];while(void 0!==o)}else do a=o[n],void 0!==a&&(e.push(o.time),i.push(a)),o=t[r++];while(void 0!==o)}}};hi.prototype={constructor:hi,evaluate:function(t){var e=this.parameterPositions,i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{var o;i:{n:if(!(t=r)break t;var s=e[1];t=r)break e}o=i,i=0}}for(;i>>1;te;)--o;if(++o,0!==r||o!==n){r>=o&&(o=Math.max(o,1),r=o-1);var a=this.getValueSize();this.times=wp.arraySlice(i,r,o),this.values=wp.arraySlice(this.values,r*a,o*a)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("invalid value size in track",this),t=!1);var i=this.times,n=this.values,r=i.length;0===r&&(console.error("track is empty",this),t=!1);for(var o=null,a=0;a!==r;a++){var s=i[a];if("number"==typeof s&&isNaN(s)){console.error("time is not a valid number",this,a,s),t=!1;break}if(null!==o&&o>s){console.error("out of order keys",this,a,s,o),t=!1;break}o=s}if(void 0!==n&&wp.isTypedArray(n))for(var a=0,c=n.length;a!==c;++a){var u=n[a];if(isNaN(u)){console.error("value is not a valid number",this,a,u),t=!1;break}}return t},optimize:function(){for(var t=this.times,e=this.values,i=this.getValueSize(),n=1,r=1,o=t.length-1;r<=o;++r){var a=!1,s=t[r],c=t[r+1];if(s!==c&&(1!==r||s!==s[0]))for(var u=r*i,h=u-i,l=u+i,d=0;d!==i;++d){var f=e[u+d];if(f!==e[h+d]||f!==e[l+d]){a=!0;break}}if(a){if(r!==n){t[n]=t[r];for(var p=r*i,m=n*i,d=0;d!==i;++d)e[m+d]=e[p+d]}++n}}return n!==t.length&&(this.times=wp.arraySlice(t,0,n),this.values=wp.arraySlice(e,0,n*i)),this}},mi.prototype=Object.assign(Object.create(Sp),{constructor:mi,ValueTypeName:"vector"}),gi.prototype=Object.assign(Object.create(hi.prototype),{constructor:gi,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=(i-e)/(n-e),u=s+a;s!==u;s+=4)D.slerpFlat(r,0,o,s-a,o,s,c);return r}}),vi.prototype=Object.assign(Object.create(Sp),{constructor:vi,ValueTypeName:"quaternion",DefaultInterpolation:Vl,InterpolantFactoryMethodLinear:function(t){return new gi(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),yi.prototype=Object.assign(Object.create(Sp),{constructor:yi,ValueTypeName:"number"}),bi.prototype=Object.assign(Object.create(Sp),{constructor:bi,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:$l,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),xi.prototype=Object.assign(Object.create(Sp),{constructor:xi,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:$l,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),_i.prototype=Object.assign(Object.create(Sp),{constructor:_i,ValueTypeName:"color"}),wi.prototype=Sp,Sp.constructor=wi,Object.assign(wi,{parse:function(t){if(void 0===t.type)throw new Error("track type undefined, can not parse");var e=wi._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var i=[],n=[];wp.flattenJSON(t.keys,i,n,"value"),t.times=i,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){var e,i=t.constructor;if(void 0!==i.toJSON)e=i.toJSON(t);else{e={name:t.name,times:wp.convertArray(t.times,Array),values:wp.convertArray(t.values,Array)};var n=t.getInterpolation();n!==t.DefaultInterpolation&&(e.interpolation=n)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return yi;case"vector":case"vector2":case"vector3":case"vector4":return mi;case"color":return _i;case"quaternion":return vi;case"bool":case"boolean":return xi;case"string":return bi}throw new Error("Unsupported typeName: "+t)}}),Si.prototype={constructor:Si,resetDuration:function(){for(var t=this.tracks,e=0,i=0,n=t.length;i!==n;++i){var r=this.tracks[i];e=Math.max(e,r.times[r.times.length-1])}this.duration=e},trim:function(){for(var t=0;t1){var u=c[1],h=n[u];h||(n[u]=h=[]),h.push(s)}}var l=[];for(var u in n)l.push(Si.CreateFromMorphTargetSequence(u,n[u],e,i));return l},parseAnimation:function(t,e,i){if(!t)return console.error(" no animation in JSONLoader data"),null;for(var n=function(t,e,i,n,r){if(0!==i.length){var o=[],a=[];wp.flattenJSON(i,o,a,n),0!==o.length&&r.push(new t(e,o,a))}},r=[],o=t.name||"default",a=t.length||-1,s=t.fps||30,c=t.hierarchy||[],u=0;u1?t.skinWeights[i+1]:0,s=e>2?t.skinWeights[i+2]:0,c=e>3?t.skinWeights[i+3]:0;a.skinWeights.push(new _t(r,o,s,c))}if(t.skinIndices)for(var i=0,n=t.skinIndices.length;i1?t.skinIndices[i+1]:0,l=e>2?t.skinIndices[i+2]:0,d=e>3?t.skinIndices[i+3]:0;a.skinIndices.push(new _t(u,h,l,d))}a.bones=t.bones,a.bones&&a.bones.length>0&&(a.skinWeights.length!==a.skinIndices.length||a.skinIndices.length!==a.vertices.length)&&console.warn("When skinning, number of vertices ("+a.vertices.length+"), skinIndices ("+a.skinIndices.length+"), and skinWeights ("+a.skinWeights.length+") should match.")}function r(e){if(void 0!==t.morphTargets)for(var i=0,n=t.morphTargets.length;i0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var h=a.faces,l=t.morphColors[0].colors,i=0,n=h.length;i0&&(a.animations=e)}var a=new ae,s=void 0!==t.scale?1/t.scale:1;if(i(s),n(),r(s),o(),a.computeFaceNormals(),a.computeBoundingSphere(),void 0===t.materials||0===t.materials.length)return{geometry:a};var c=Pi.prototype.initMaterials(t.materials,e,this.crossOrigin);return{geometry:a,materials:c}}}),Object.assign(Ti.prototype,{load:function(t,e,i,n){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var r=this,o=new Ye(r.manager);o.load(t,function(t){r.parse(JSON.parse(t),e)},i,n)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var i=this.parseGeometries(t.geometries),n=this.parseImages(t.images,function(){void 0!==e&&e(a)}),r=this.parseTextures(t.textures,n),o=this.parseMaterials(t.materials,r),a=this.parseObject(t.object,i,o);return t.animations&&(a.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(a),a},parseGeometries:function(t){var e={};if(void 0!==t)for(var i=new Ci,n=new Mi,r=0,o=t.length;r0){var o=new qe(e),a=new Qe(o);a.setCrossOrigin(this.crossOrigin);for(var s=0,c=t.length;s0?new Be(s,c):new Se(s,c);break;case"LOD":a=new Ne;break;case"Line":a=new je(r(e.geometry),o(e.material),e.mode);break;case"LineSegments":a=new $e(r(e.geometry),o(e.material));break;case"PointCloud":case"Points":a=new Ge(r(e.geometry),o(e.material));break;case"Sprite":a=new De(o(e.material));break;case"Group":a=new He;break;default:a=new re}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.quaternion&&a.quaternion.fromArray(e.quaternion),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(a.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(a.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&a.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(a.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.children)for(var u in e.children)a.add(this.parseObject(e.children[u],i,n));if("LOD"===e.type)for(var h=e.levels,l=0;l(u-s)*(d-c)-(h-c)*(l-s))return!1;var m,g,v,y,b,x,_,w,S,A,M,P,C,T,E;for(m=l-u,g=d-h,v=s-l,y=c-d,b=u-s,x=h-c,a=0;a=-Number.EPSILON&&T>=-Number.EPSILON&&C>=-Number.EPSILON))return!1;return!0}return function(e,i){var n=e.length;if(n<3)return null;var r,o,a,s=[],c=[],u=[];if(Ap.area(e)>0)for(o=0;o2;){if(l--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),i?u:s;if(r=o,h<=r&&(r=0),o=r+1,h<=o&&(o=0),a=o+1,h<=a&&(a=0),t(e,r,o,a,h,c)){var d,f,p,m,g;for(d=c[r],f=c[o],p=c[a],s.push([e[d],e[f],e[p]]),u.push([c[r],c[o],c[a]]),m=o,g=o+1;g2&&t[e-1].equals(t[0])&&t.pop()}function n(t,e,i){return t.x!==e.x?t.xNumber.EPSILON){var p;if(d>0){if(f<0||f>d)return[];if(p=u*h-c*l,p<0||p>d)return[]}else{if(f>0||f0||pM?[]:x===M?o?[]:[y]:_<=M?[y,b]:[y,S]}function o(t,e,i,n){var r=e.x-t.x,o=e.y-t.y,a=i.x-t.x,s=i.y-t.y,c=n.x-t.x,u=n.y-t.y,h=r*s-o*a,l=r*u-o*c;if(Math.abs(h)>Number.EPSILON){var d=c*s-u*a;return h>0?l>=0&&d>=0:l>=0||d>=0}return l>0}function a(t,e){function i(t,e){var i=y.length-1,n=t-1;n<0&&(n=i);var r=t+1;r>i&&(r=0);var a=o(y[t],y[n],y[r],s[e]);if(!a)return!1;var c=s.length-1,u=e-1;u<0&&(u=c);var h=e+1;return h>c&&(h=0),a=o(s[e],s[u],s[h],y[t]),!!a}function n(t,e){var i,n,o;for(i=0;i0)return!0;return!1}function a(t,i){var n,o,a,s,c;for(n=0;n0)return!0;return!1}for(var s,c,u,h,l,d,f,p,m,g,v,y=t.concat(),b=[],x=[],_=0,w=e.length;_0;){if(A--,A<0){console.log("Infinite Loop! Holes left:"+b.length+", Probably Hole outside Shape!");break}for(u=S;u=0)break;x[f]=!0}if(c>=0)break}}return y}i(t),e.forEach(i);for(var s,c,u,h,l,d,f={},p=t.concat(),m=0,g=e.length;m0)){c=r;break}c=r-1}if(r=c,n[r]===i){var u=r/(o-1);return u}var h=n[r],l=n[r+1],d=l-h,f=(i-h)/d,u=(r+f)/(o-1);return u},getTangent:function(t){var e=1e-4,i=t-e,n=t+e;i<0&&(i=0),n>1&&(n=1);var r=this.getPoint(i),o=this.getPoint(n),a=o.clone().sub(r);return a.normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)}},Ei.create=function(t,e){return t.prototype=Object.create(Ei.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Ii.prototype=Object.create(Ei.prototype),Ii.prototype.constructor=Ii,Ii.prototype.isLineCurve=!0,Ii.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},Ii.prototype.getPointAt=function(t){return this.getPoint(t)},Ii.prototype.getTangent=function(t){var e=this.v2.clone().sub(this.v1);return e.normalize()},Li.prototype=Object.assign(Object.create(Ei.prototype),{constructor:Li,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Ii(e,t))},getPoint:function(t){for(var e=t*this.getLength(),i=this.getCurveLengths(),n=0;n=e){var r=i[n]-e,o=this.curves[n],a=o.getLength(),s=0===a?0:1-r/a;return o.getPointAt(s)}n++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,i=0,n=this.curves.length;i1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},createPointsGeometry:function(t){var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){for(var e=new ae,i=0,n=t.length;ie;)i-=e;ie.length-2?e.length-1:n+1],c=e[n>e.length-3?e.length-1:n+2],u=Mp.interpolate;return new I(u(o.x,a.x,s.x,c.x,r),u(o.y,a.y,s.y,c.y,r))},Di.prototype=Object.create(Ei.prototype),Di.prototype.constructor=Di,Di.prototype.getPoint=function(t){var e=Ap.b3;return new I(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},Di.prototype.getTangent=function(t){var e=Mp.tangentCubicBezier;return new I(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},Ni.prototype=Object.create(Ei.prototype),Ni.prototype.constructor=Ni,Ni.prototype.getPoint=function(t){var e=Ap.b2;return new I(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y))},Ni.prototype.getTangent=function(t){var e=Mp.tangentQuadraticBezier;return new I(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y)).normalize()};var Pp=Object.assign(Object.create(Li.prototype),{fromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,i=t.length;e0){var u=c.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(c);var h=c.getPoint(1);this.currentPoint.copy(h)}});ki.prototype=Object.create(ae.prototype),ki.prototype.constructor=ki,ki.NoTaper=function(t){return 1},ki.SinusoidalTaper=function(t){return Math.sin(Math.PI*t)},ki.FrenetFrames=function(t,e,i){function n(){f[0]=new N,p[0]=new N,o=Number.MAX_VALUE,a=Math.abs(d[0].x),s=Math.abs(d[0].y),c=Math.abs(d[0].z),a<=o&&(o=a,l.set(1,0,0)),s<=o&&(o=s,l.set(0,1,0)),c<=o&&l.set(0,0,1),m.crossVectors(d[0],l).normalize(),f[0].crossVectors(d[0],m),p[0].crossVectors(d[0],f[0])}var r,o,a,s,c,u,h,l=new N,d=[],f=[],p=[],m=new N,g=new O,v=e+1;for(this.tangents=d,this.normals=f,this.binormals=p,u=0;uNumber.EPSILON&&(m.normalize(),r=Math.acos(ad.clamp(d[u-1].dot(d[u]),-1,1)),f[u].applyMatrix4(g.makeRotationAxis(m,r))),p[u].crossVectors(d[u],f[u]);if(i)for(r=Math.acos(ad.clamp(f[0].dot(f[v-1]),-1,1)),r/=v-1,d[0].dot(m.crossVectors(f[0],f[v-1]))>0&&(r=-r),u=1;uNumber.EPSILON){var d=Math.sqrt(h),f=Math.sqrt(c*c+u*u),p=e.x-s/d,m=e.y+a/d,g=i.x-u/f,v=i.y+c/f,y=((g-p)*u-(v-m)*c)/(a*u-s*c);n=p+a*y-t.x,r=m+s*y-t.y;var b=n*n+r*r;if(b<=2)return new I(n,r);o=Math.sqrt(b/2)}else{var x=!1;a>Number.EPSILON?c>Number.EPSILON&&(x=!0):a<-Number.EPSILON?c<-Number.EPSILON&&(x=!0):Math.sign(s)===Math.sign(u)&&(x=!0),x?(n=-s,r=a,o=Math.sqrt(h)):(n=a,r=s,o=Math.sqrt(h/2))}return new I(n/o,r/o)}function r(){if(b){var t=0,e=G*t;for(X=0;X=0;){i=X,n=X-1,n<0&&(n=t.length-1);var r=0,o=_+2*y;for(r=0;r=0;z--){for(U=z/y,j=g*Math.cos(U*Math.PI/2),B=v*Math.sin(U*Math.PI/2),X=0,q=F.length;XNumber.EPSILON){if(u<0&&(a=e[o],c=-c,s=e[r],u=-u),t.ys.y)continue;if(t.y===a.y){if(t.x===a.x)return!0}else{var h=u*(t.x-a.x)-c*(t.y-a.y);if(0===h)return!0;if(h<0)continue;n=!n}}else{if(t.y!==a.y)continue;if(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x)return!0}}return n}var r=Ap.isClockWise,o=this.subPaths;if(0===o.length)return[];if(e===!0)return i(o);var a,s,c,u=[];if(1===o.length)return s=o[0],c=new Bi,c.curves=s.curves,u.push(c),u;var h=!r(o[0].getPoints());h=t?!h:h;var l,d=[],f=[],p=[],m=0;f[m]=void 0,p[m]=[];for(var g=0,v=o.length;g1){for(var y=!1,b=[],x=0,_=f.length;x<_;x++)d[x]=[];for(var x=0,_=f.length;x<_;x++)for(var w=p[x],S=0;S0&&(y||(p=d))}for(var C,g=0,T=f.length;g0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t=.5)for(var o=0;o!==r;++o)t[e+o]=t[i+o]},_slerp:function(t,e,i,n,r){D.slerpFlat(t,e,t,e,t,i,n)},_lerp:function(t,e,i,n,r){for(var o=1-n,a=0;a!==r;++a){var s=e+a;t[s]=t[s]*o+t[i+a]*n}}},Qi.prototype={constructor:Qi,getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,i=e.objectName,n=e.propertyName,r=e.propertyIndex;if(t||(t=Qi.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error(" trying to update node for track: "+this.path+" but it wasn't found.");if(i){var o=e.objectIndex;switch(i){case"materials":if(!t.material)return void console.error(" can not bind to material as node does not have a material",this);if(!t.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);t=t.skeleton.bones;for(var a=0;a0)for(var c=this._interpolants,u=this._propertyBindings,h=0,l=c.length;h!==l;++h)c[h].evaluate(a),u[h].accumulate(n,s)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var i=this._weightInterpolant;if(null!==i){var n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i){var n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopWarping(), -0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var i=this._clip.duration,n=this.loop,r=this._loopCount;if(n===Bl){r===-1&&(this.loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=i)e=i;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{var o=n===jl;if(r===-1&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),e>=i||e<0){var a=Math.floor(e/i);e-=i*a,r+=Math.abs(a);var s=this.repetitions-r;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(0===s){var c=t<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1===(1&r))return this.time=e,i-e}return this.time=e,e},_setEndings:function(t,e,i){var n=this._interpolantSettings;i?(n.endingStart=Wl,n.endingEnd=Wl):(t?n.endingStart=this.zeroSlopeAtStart?Wl:Hl:n.endingStart=Xl,e?n.endingEnd=this.zeroSlopeAtEnd?Wl:Hl:n.endingEnd=Xl)},_scheduleFading:function(t,e,i){var n=this._mixer,r=n.time,o=this._weightInterpolant;null===o&&(o=n._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=r,s[0]=e,a[1]=r+t,s[1]=i,this}},Object.assign(tn.prototype,E.prototype,{clipAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?Si.findByName(i,t):t,o=null!==r?r.uuid:t,a=this._actionsByClip[o],s=null;if(void 0!==a){var c=a.actionByRoot[n];if(void 0!==c)return c;s=a.knownActions[0],null===r&&(r=s._clip)}if(null===r)return null;var u=new Ji(this,r,e);return this._bindAction(u,s),this._addInactiveAction(u,o,n),u},existingAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?Si.findByName(i,t):t,o=r?r.uuid:t,a=this._actionsByClip[o];return void 0!==a?a.actionByRoot[n]||null:null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,i=this._bindings,n=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var r=0;r!==e;++r)t[r].reset();for(var r=0;r!==n;++r)i[r].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,i=this._nActiveActions,n=this.time+=t,r=Math.sign(t),o=this._accuIndex^=1,a=0;a!==i;++a){var s=e[a];s.enabled&&s._update(n,t,r,o)}for(var c=this._bindings,u=this._nActiveBindings,a=0;a!==u;++a)c[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,i=t.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){for(var o=r.knownActions,a=0,s=o.length;a!==s;++a){var c=o[a];this._deactivateAction(c);var u=c._cacheIndex,h=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=u,e[u]=h,e.pop(),this._removeInactiveBindingsForAction(c)}delete n[i]}},uncacheRoot:function(t){var e=t.uuid,i=this._actionsByClip;for(var n in i){var r=i[n].actionByRoot,o=r[e];void 0!==o&&(this._deactivateAction(o),this._removeInactiveAction(o))}var a=this._bindingsByRootAndName,s=a[e];if(void 0!==s)for(var c in s){var u=s[c];u.restoreOriginalState(),this._removeInactiveBinding(u)}},uncacheAction:function(t,e){var i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}),Object.assign(tn.prototype,{_bindAction:function(t,e){var i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,o=t._propertyBindings,a=t._interpolants,s=i.uuid,c=this._bindingsByRootAndName,u=c[s];void 0===u&&(u={},c[s]=u);for(var h=0;h!==r;++h){var l=n[h],d=l.name,f=u[d];if(void 0!==f)o[h]=f;else{if(f=o[h],void 0!==f){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,s,d));continue}var p=e&&e._propertyBindings[h].binding.parsedPath;f=new Ki(Qi.create(i,d,p),l.ValueTypeName,l.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,s,d),o[h]=f}a[h].resultBuffer=f.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}for(var r=t._propertyBindings,o=0,a=r.length;o!==a;++o){var s=r[o];0===s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0===--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e.99999?this.quaternion.set(0,0,0,1):i.y<-.99999?this.quaternion.set(1,0,0,0):(e.set(i.z,0,-i.x).normalize(),t=Math.acos(i.y),this.quaternion.setFromAxisAngle(e,t))}}(),fn.prototype.setLength=function(t,e,i){void 0===e&&(e=.2*t),void 0===i&&(i=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()},fn.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},pn.prototype=Object.create(ae.prototype),pn.prototype.constructor=pn,mn.prototype=Object.create(pn.prototype),mn.prototype.constructor=mn,gn.prototype=Object.create(ae.prototype),gn.prototype.constructor=gn,vn.prototype=Object.create(ue.prototype),vn.prototype.constructor=vn;(function(){function t(){}var e=new N,i=new t,n=new t,r=new t;return t.prototype.init=function(t,e,i,n){this.c0=t,this.c1=i,this.c2=-3*t+3*e-2*i-n,this.c3=2*t-2*e+i+n},t.prototype.initNonuniformCatmullRom=function(t,e,i,n,r,o,a){var s=(e-t)/r-(i-t)/(r+o)+(i-e)/o,c=(i-e)/o-(n-e)/(o+a)+(n-i)/a;s*=o,c*=o,this.init(e,i,s,c)},t.prototype.initCatmullRom=function(t,e,i,n,r){this.init(e,i,r*(i-t),r*(n-e))},t.prototype.calc=function(t){var e=t*t,i=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*i},Ei.create(function(t){this.points=t||[],this.closed=!1},function(t){var o,a,s,c,u=this.points;c=u.length,c<2&&console.log("duh, you need at least 2 points"),o=(c-(this.closed?0:1))*t,a=Math.floor(o),s=o-a,this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/u.length)+1)*u.length:0===s&&a===c-1&&(a=c-2,s=1);var h,l,d,f;if(this.closed||a>0?h=u[(a-1)%c]:(e.subVectors(u[0],u[1]).add(u[0]),h=e),l=u[a%c],d=u[(a+1)%c],this.closed||a+2e.length-2?e.length-1:n+1],c=e[n>e.length-3?e.length-1:n+2],u=Mp.interpolate;return new N(u(o.x,a.x,s.x,c.x,r),u(o.y,a.y,s.y,c.y,r),u(o.z,a.z,s.z,c.z,r))}),Ei.create(function(t,e,i,n){this.v0=t,this.v1=e,this.v2=i,this.v3=n},function(t){var e=Ap.b3;return new N(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),e(t,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),Ei.create(function(t,e,i){this.v0=t,this.v1=e,this.v2=i},function(t){var e=Ap.b2;return new N(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y),e(t,this.v0.z,this.v1.z,this.v2.z))}),Ei.create(function(t,e){this.v1=t,this.v2=e},function(t){if(1===t)return this.v2.clone();var e=new N;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e});Object.defineProperty(t,"AudioContext",{get:function(){return t.getAudioContext()}}),yn.prototype={active:!0,params:null,execute:function(t){var e,i;return this.active&&this._listener&&(i=this.params?this.params.concat(t):t,e=this._listener.apply(this.context,i),this._isOnce&&this.detach()),e},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return!!this._signal&&!!this._listener},isOnce:function(){return this._isOnce},getListener:function(){return this._listener},getSignal:function(){return this._signal},_destroy:function(){delete this._signal,delete this._listener,delete this.context},toString:function(){return"[SignalBinding isOnce:"+this._isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}},xn.prototype={VERSION:"1.0.0",memorize:!1,_shouldPropagate:!0,active:!0,_registerListener:function(t,e,i,n){var r,o=this._indexOfListener(t,i);if(o!==-1){if(r=this._bindings[o],r.isOnce()!==e)throw new Error("You cannot add"+(e?"":"Once")+"() then add"+(e?"Once":"")+"() the same listener without removing the relationship first.")}else r=new yn(this,t,e,i,n),this._addBinding(r);return this.memorize&&this._prevParams&&r.execute(this._prevParams),r},_addBinding:function(t){var e=this._bindings.length;do--e;while(this._bindings[e]&&t._priority<=this._bindings[e]._priority);this._bindings.splice(e+1,0,t)},_indexOfListener:function(t,e){for(var i,n=this._bindings.length;n--;)if(i=this._bindings[n],i._listener===t&&i.context===e)return n;return-1},has:function(t,e){return this._indexOfListener(t,e)!==-1},add:function(t,e,i){return bn(t,"add"),this._registerListener(t,!1,e,i)},addOnce:function(t,e,i){return bn(t,"addOnce"),this._registerListener(t,!0,e,i)},remove:function(t,e){bn(t,"remove");var i=this._indexOfListener(t,e);return i!==-1&&(this._bindings[i]._destroy(),this._bindings.splice(i,1)),t},removeAll:function(){for(var t=this._bindings.length;t--;)this._bindings[t]._destroy();this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(t){if(this.active){var e,i=Array.prototype.slice.call(arguments),n=this._bindings.length;if(this.memorize&&(this._prevParams=i),n){e=this._bindings.slice(),this._shouldPropagate=!0;do n--;while(e[n]&&this._shouldPropagate&&e[n].execute(i)!==!1)}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll(),delete this._bindings,delete this._prevParams},toString:function(){return"[Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}};var Ip={PROTEIN:1,NUCLEIC:2,RNA:3,DNA:4,POLYMER:5,WATER:6,HELIX:7,SHEET:8,BACKBONE:9,SIDECHAIN:10,ALL:11,HETERO:12,ION:13,SACCHARIDE:14};_n.prototype={constructor:_n,type:"selection",setString:function(t,e){if(void 0===t&&(t=this.string||""),t!==this.string){try{this.parse(t)}catch(t){this.selection={error:t.message}}this.string=t,this.test=this.makeAtomTest(),this.residueTest=this.makeResidueTest(),this.chainTest=this.makeChainTest(),this.modelTest=this.makeModelTest(),this.atomOnlyTest=this.makeAtomTest(!0),this.residueOnlyTest=this.makeResidueTest(!0),this.chainOnlyTest=this.makeChainTest(!0),this.modelOnlyTest=this.makeModelTest(!0),e||this.signals.stringChanged.dispatch(this.string)}},parse:function(t){if(this.selection={operator:void 0,rules:[]},t){var e,i,n=this,r=this.selection,o=[];t=t.replace(/\(/g," ( ").replace(/\)/g," ) ").trim(),"("===t.charAt(0)&&")"===t.substr(-1)&&(t=t.slice(1,-1).trim());var a,s,c,u,h,l,d,f,p,m,g=t.split(/\s+/),v=["*","","ALL"],y=function(t){e={operator:t,rules:[]},void 0===r?(r=e,n.selection=e):(r.rules.push(e),o.push(r),r=e)},b=function(t){i=r,r=o.pop(),void 0===r&&(y(t),x(i))},x=function(t){r.rules.push(t)};for(c=0;c0)if("NOT"===a.toUpperCase())u=1;else if(1===u)u=2;else{if(2!==u)throw new Error("something went wrong with 'not'");u=!1,b()}if("AND"!==a.toUpperCase())if("OR"!==a.toUpperCase())if("NOT"!==a.toUpperCase())if(s={},"HETERO"!==a.toUpperCase())if("WATER"!==a.toUpperCase())if("PROTEIN"!==a.toUpperCase())if("NUCLEIC"!==a.toUpperCase())if("RNA"!==a.toUpperCase())if("DNA"!==a.toUpperCase())if("POLYMER"!==a.toUpperCase())if("ION"!==a.toUpperCase())if("SACCHARIDE"!==a.toUpperCase()&&"SUGAR"!==a.toUpperCase())if("HYDROGEN"!==a.toUpperCase())if("SMALL"!==a.toUpperCase())if("NUCLEOPHILIC"!==a.toUpperCase())if("HYDROPHOBIC"!==a.toUpperCase())if("AROMATIC"!==a.toUpperCase())if("AMIDE"!==a.toUpperCase())if("ACIDIC"!==a.toUpperCase())if("BASIC"!==a.toUpperCase())if("CHARGED"!==a.toUpperCase())if("POLAR"!==a.toUpperCase())if("NONPOLAR"!==a.toUpperCase())if("HELIX"!==a.toUpperCase())if("SHEET"!==a.toUpperCase())if("TURN"!==a.toUpperCase())if("BACKBONE"!==a.toUpperCase())if("SIDECHAIN"!==a.toUpperCase())if("SIDECHAINATTACHED"!==a.toUpperCase())if(v.indexOf(a.toUpperCase())===-1)if("@"!==a.charAt(0))if("#"!==a.charAt(0))if("["!==a[0]||"]"!==a[a.length-1])if(a.length>=1&&a.length<=4&&"^"!==a[0]&&":"!==a[0]&&"."!==a[0]&&"%"!==a[0]&&"/"!==a[0]&&isNaN(parseInt(a)))s.resname=a.toUpperCase(),x(s);else{if(s={operator:"AND",rules:[]},d=a.split("/"),d.length>1&&d[1]){if(isNaN(parseInt(d[1])))throw new Error("model must be an integer");s.rules.push({model:parseInt(d[1])})}if(p=d[0].split("%"),p.length>1&&s.rules.push({altloc:p[1]}),h=p[0].split("."),h.length>1&&h[1]){if(h[1].length>4)throw new Error("atomname must be one to four characters");s.rules.push({atomname:h[1].substring(0,4).toUpperCase()})}if(l=h[0].split(":"),l.length>1&&l[1]&&s.rules.push({chainname:l[1]}),m=l[0].split("^"),m.length>1&&s.rules.push({inscode:m[1]}),m[0]){var _,w;if("-"===m[0][0]&&(m[0]=m[0].substr(1),_=!0),m[0].includes("--")&&(m[0]=m[0].replace("--","-"),w=!0),f=m[0].split("-"),1===f.length){if(f=parseInt(f[0]),isNaN(f))throw new Error("resi must be an integer");_&&(f*=-1),s.rules.push({resno:f})}else{if(2!==f.length)throw new Error("resi range must contain one '-'");_&&(f[0]*=-1),w&&(f[1]*=-1),s.rules.push({resno:[parseInt(f[0]),parseInt(f[1])]})}}if(1===s.rules.length)x(s.rules[0]);else{if(!(s.rules.length>1))throw new Error("empty selection chunk");x(s)}}else s.resname=a.substr(1,a.length-2).toUpperCase(),x(s);else s.element=a.substr(1).toUpperCase(),x(s);else{for(var S=a.substr(1).split(","),A=0,M=S.length;A0?e:null},makeAtomTest:function(t){var e,i=["h","g","i"],n=["e","b"];e=t?this._filter(function(t){return void 0!==t.keyword&&t.keyword!==Ip.BACKBONE&&t.keyword!==Ip.SIDECHAIN||(void 0!==t.model||(void 0!==t.chainname||(void 0!==t.resname||(void 0!==t.resno||void 0!==t.sstruc))))}):this.selection;var r=function(t,e){if(void 0===e.atomname&&void 0===e.element&&void 0===e.altloc&&void 0===e.atomindex&&void 0===e.keyword&&void 0===e.inscode&&void 0===e.resname&&void 0===e.sstruc&&void 0===e.resno&&void 0===e.chainname&&void 0===e.model)return-1;if(void 0!==e.keyword){if(e.keyword===Ip.BACKBONE&&!t.isBackbone())return!1;if(e.keyword===Ip.SIDECHAIN&&!t.isSidechain())return!1;if(e.keyword===Ip.HETERO&&!t.isHetero())return!1;if(e.keyword===Ip.PROTEIN&&!t.isProtein())return!1;if(e.keyword===Ip.NUCLEIC&&!t.isNucleic())return!1;if(e.keyword===Ip.RNA&&!t.isRna())return!1;if(e.keyword===Ip.DNA&&!t.isDna())return!1;if(e.keyword===Ip.POLYMER&&!t.isPolymer())return!1;if(e.keyword===Ip.WATER&&!t.isWater())return!1;if(e.keyword===Ip.HELIX&&i.indexOf(t.sstruc)===-1)return!1;if(e.keyword===Ip.SHEET&&n.indexOf(t.sstruc)===-1)return!1;if(e.keyword===Ip.ION&&!t.isIon())return!1;if(e.keyword===Ip.SACCHARIDE&&!t.isSaccharide())return!1}if(void 0!==e.atomname&&e.atomname!==t.atomname)return!1;if(void 0!==e.element&&e.element!==t.element)return!1;if(void 0!==e.altloc&&e.altloc!==t.altloc)return!1;if(void 0!==e.atomindex&&qu(e.atomindex,t.index)<0)return!1;if(void 0!==e.resname&&e.resname!==t.resname)return!1;if(void 0!==e.sstruc&&e.sstruc!==t.sstruc)return!1;if(void 0!==e.resno)if(Array.isArray(e.resno)&&2===e.resno.length){if(e.resno[0]>t.resno||e.resno[1]e.atomindexLast||t.atomEndt.resno||e.resno[1]e.atomindexLast||t.atomEnde.atomindexLast||t.atomEnd>=4,i[r]=e[19===r?3&t|8:t]);return i.join("")}}(),Rp=0,Op=1,Dp=2,Np=3,kp=4,Fp=0,zp=1,Bp=2,Up=3,jp=4,$p=5,Vp=6,Gp=0,Hp=1,Wp=2,Xp=3,qp=4,Yp=5,Zp=6,Kp=["D-BETA-PEPTIDE, C-GAMMA LINKING","D-GAMMA-PEPTIDE, C-DELTA LINKING","D-PEPTIDE COOH CARBOXY TERMINUS","D-PEPTIDE NH3 AMINO TERMINUS","D-PEPTIDE LINKING","L-BETA-PEPTIDE, C-GAMMA LINKING","L-GAMMA-PEPTIDE, C-DELTA LINKING","L-PEPTIDE COOH CARBOXY TERMINUS","L-PEPTIDE NH3 AMINO TERMINUS","L-PEPTIDE LINKING","PEPTIDE LINKING","PEPTIDE-LIKE"],Qp=["RNA OH 3 PRIME TERMINUS","RNA OH 5 PRIME TERMINUS","RNA LINKING"],Jp=["DNA OH 3 PRIME TERMINUS","DNA OH 5 PRIME TERMINUS","DNA LINKING","L-DNA LINKING","L-RNA LINKING"],tm=["D-SACCHARIDE","D-SACCHARIDE 1,4 AND 1,4 LINKING","D-SACCHARIDE 1,4 AND 1,6 LINKING","L-SACCHARIDE","L-SACCHARIDE 1,4 AND 1,4 LINKING","L-SACCHARIDE 1,4 AND 1,6 LINKING","SACCHARIDE"],em=["OTHER"],im=["NON-POLYMER"],nm=im.concat(em,tm),rm={H:1.1,HE:1.4,LI:1.81,BE:1.53,B:1.92,C:1.7,N:1.55,O:1.52,F:1.47,NE:1.54,NA:2.27,MG:1.73, -AL:1.84,SI:2.1,P:1.8,S:1.8,CL:1.75,AR:1.88,K:2.75,CA:2.31,SC:2.3,TI:2.15,V:2.05,CR:2.05,MN:2.05,FE:2.05,CO:2,NI:2,CU:2,ZN:2.1,GA:1.87,GE:2.11,AS:1.85,SE:1.9,BR:1.83,KR:2.02,RB:3.03,SR:2.49,Y:2.4,ZR:2.3,NB:2.15,MO:2.1,TC:2.05,RU:2.05,RH:2,PD:2.05,AG:2.1,CD:2.2,IN:2.2,SN:1.93,SB:2.17,TE:2.06,I:1.98,XE:2.16,CS:3.43,BA:2.68,LA:2.5,CE:2.48,PR:2.47,ND:2.45,PM:2.43,SM:2.42,EU:2.4,GD:2.38,TB:2.37,DY:2.35,HO:2.33,ER:2.32,TM:2.3,YB:2.28,LU:2.27,HF:2.25,TA:2.2,W:2.1,RE:2.05,OS:2,IR:2,PT:2.05,AU:2.1,HG:2.05,TL:1.96,PB:2.02,BI:2.07,PO:1.97,AT:2.02,RN:2.2,FR:3.48,RA:2.83,AC:2,TH:2.4,PA:2,U:2.3,NP:2,PU:2,AM:2,CM:2,BK:2,CF:2,ES:2,FM:2,MD:2,NO:2,LR:2,RF:2,DB:2,SG:2,BH:2,HS:2,MT:2,DS:2,RG:2,CN:2,UUT:2,FL:2,UUP:2,LV:2,UUH:2},om=2,am={H:.31,HE:.28,LI:1.28,BE:.96,B:.84,C:.76,N:.71,O:.66,F:.57,NE:.58,NA:1.66,MG:1.41,AL:1.21,SI:1.11,P:1.07,S:1.05,CL:1.02,AR:1.06,K:2.03,CA:1.76,SC:1.7,TI:1.6,V:1.53,CR:1.39,MN:1.39,FE:1.32,CO:1.26,NI:1.24,CU:1.32,ZN:1.22,GA:1.22,GE:1.2,AS:1.19,SE:1.2,BR:1.2,KR:1.16,RB:2.2,SR:1.95,Y:1.9,ZR:1.75,NB:1.64,MO:1.54,TC:1.47,RU:1.46,RH:1.42,PD:1.39,AG:1.45,CD:1.44,IN:1.42,SN:1.39,SB:1.39,TE:1.38,I:1.39,XE:1.4,CS:2.44,BA:2.15,LA:2.07,CE:2.04,PR:2.03,ND:2.01,PM:1.99,SM:1.98,EU:1.98,GD:1.96,TB:1.94,DY:1.92,HO:1.92,ER:1.89,TM:1.9,YB:1.87,LU:1.87,HF:1.75,TA:1.7,W:1.62,RE:1.51,OS:1.44,IR:1.41,PT:1.36,AU:1.36,HG:1.32,TL:1.45,PB:1.46,BI:1.48,PO:1.4,AT:1.5,RN:1.5,FR:2.6,RA:2.21,AC:2.15,TH:2.06,PA:2,U:1.96,NP:1.9,PU:1.87,AM:1.8,CM:1.69,BK:1.6,CF:1.6,ES:1.6,FM:1.6,MD:1.6,NO:1.6,LR:1.6,RF:1.6,DB:1.6,SG:1.6,BH:1.6,HS:1.6,MT:1.6,DS:1.6,RG:1.6,CN:1.6,UUT:1.6,FL:1.6,UUP:1.6,LV:1.6,UUH:1.6},sm=1.6,cm={ALA:[.17,.5,.33],ARG:[.81,1.81,1],ASN:[.42,.85,.43],ASP:[1.23,3.64,2.41],ASH:[-.07,.43,.5],CYS:[-.24,-.02,.22],GLN:[.58,.77,.19],GLU:[2.02,3.63,1.61],GLH:[-.01,.11,.12],GLY:[.01,1.15,1.14],HIS:[.17,.11,-.06],ILE:[-.31,-1.12,-.81],LEU:[-.56,-1.25,-.69],LYS:[.99,2.8,1.81],MET:[-.23,-.67,-.44],PHE:[-1.13,-1.71,-.58],PRO:[.45,.14,-.31],SER:[.13,.46,.33],THR:[.14,.25,.11],TRP:[-1.85,-2.09,-.24],TYR:[-.94,-.71,.23],VAL:[.07,-.46,-.53]},um=[0,0,0],hm={HIS:"H",ARG:"R",LYS:"K",ILE:"I",PHE:"F",LEU:"L",TRP:"W",ALA:"A",MET:"M",PRO:"P",CYS:"C",ASN:"N",VAL:"V",GLY:"G",SER:"S",GLN:"Q",TYR:"Y",ASP:"D",GLU:"E",THR:"T",ASH:"D",GLH:"E",UNK:""},lm=Object.keys(hm),dm=["A","C","T","G","U"],fm=["DA","DC","DT","DG","DU","TCY","MCY","5CM"],pm=["A","G","DA","DG"],mm=["SOL","WAT","HOH","H2O","W","DOD","D3O"],gm=["118","119","1AL","1CU","2FK","2HP","2OF","3CO","3MT","3NI","3OF","3P8","4MO","4PU","543","6MO","ACT","AG","AL","ALF","AM","ATH","AU","AU3","AUC","AZI","BA","BCT","BEF","BF4","BO4","BR","BS3","BSY","CA","CAC","CD","CD1","CD3","CD5","CE","CHT","CL","CO","CO3","CO5","CON","CR","CS","CSB","CU","CU1","CU3","CUA","CUZ","CYN","DME","DMI","DSC","DTI","DY","E4N","EDR","EMC","ER3","EU","EU3","F","FE","FE2","FPO","GA","GD3","GEP","HAI","HG","HGC","IN","IOD","IR","IR3","IRI","IUM","K","KO4","LA","LCO","LCP","LI","LU","MAC","MG","MH2","MH3","MLI","MLT","MMC","MN","MN3","MN5","MN6","MO1","MO2","MO3","MO4","MO5","MO6","MOO","MOS","MOW","MW1","MW2","MW3","NA","NA2","NA5","NA6","NAO","NAW","NCO","NET","NH4","NI","NI1","NI2","NI3","NO2","NO3","NRU","O4M","OAA","OC1","OC2","OC3","OC4","OC5","OC6","OC7","OC8","OCL","OCM","OCN","OCO","OF1","OF2","OF3","OH","OS","OS4","OXL","PB","PBM","PD","PDV","PER","PI","PO3","PO4","PR","PT","PT4","PTN","RB","RH3","RHD","RU","SB","SCN","SE4","SEK","SM","SMO","SO3","SO4","SR","T1A","TB","TBA","TCN","TEA","TH","THE","TL","TMA","TRA","UNX","V","VN3","VO4","W","WO5","Y1","YB","YB2","YH","YT3","ZCM","ZN","ZN2","ZN3","ZNO","ZO3"],vm=["045","0AT","0BD","0MK","0NZ","0TS","0V4","0XY","0YT","10M","147","149","14T","15L","16G","18T","18Y","1AR","1BW","1GL","1GN","1JB","1LL","1NA","1S3","26M","26Q","26R","26V","26W","26Y","27C","289","291","293","2DG","2F8","2FG","2FL","2FP","2GL","2M4","2M5","32O","34V","3CM","3DO","3DY","3FM","3LR","3MF","3MG","3SA","3ZW","46D","46M","46Z","48Z","4CQ","4GC","4NN","50A","5DI","5GF","5MM","5RP","5SA","5SP","64K","6PG","6SA","7JZ","7SA","A1Q","A2G","AAB","AAL","AAO","ABC","ABD","ABE","ABF","ABL","ACG","ACI","ACR","ACX","ADA","ADG","ADR","AF1","AFD","AFL","AFO","AFP","AFR","AGC","AGH","AGL","AHR","AIG","ALL","ALX","AMU","AOG","AOS","ARA","ARB","ARE","ARI","ASG","ASO","AXP","AXR","B0D","B16","B2G","B4G","B6D","B8D","B9D","BBK","BCD","BDG","BDP","BDR","BEM","BFP","BGC","BGL","BGP","BGS","BHG","BMA","BMX","BNG","BNX","BOG","BRI","BXF","BXP","BXX","BXY","C3X","C4X","C5X","CAP","CBI","CBK","CBS","CDR","CEG","CGF","CHO","CR1","CR6","CRA","CT3","CTO","CTR","CTT","D6G","DAF","DAG","DDA","DDB","DDL","DEL","DFR","DFX","DG0","DGC","DGD","DGM","DGS","DIG","DLF","DLG","DMU","DNO","DOM","DP5","DQQ","DQR","DR2","DR3","DR4","DRI","DSR","DT6","DVC","E4P","E5G","EAG","EBG","EBQ","EGA","EJT","EPG","ERE","ERI","F1P","F1X","F6P","FBP","FCA","FCB","FCT","FDP","FDQ","FFC","FIX","FMO","FRU","FSI","FU4","FUB","FUC","FUD","FUL","FXP","G16","G1P","G2F","G3I","G4D","G4S","G6D","G6P","G6S","GAC","GAD","GAL","GC1","GC4","GCD","GCN","GCO","GCS","GCT","GCU","GCV","GCW","GCX","GE1","GFG","GFP","GIV","GL0","GL2","GL5","GL6","GL7","GL9","GLA","GLB","GLC","GLD","GLF","GLG","GLO","GLP","GLS","GLT","GLW","GMH","GN1","GNX","GP1","GP4","GPH","GPM","GQ1","GQ2","GQ4","GS1","GS4","GSA","GSD","GTE","GTH","GTK","GTR","GTZ","GU0","GU1","GU2","GU3","GU4","GU5","GU6","GU8","GU9","GUF","GUP","GUZ","GYP","GYV","H2P","HDL","HMS","HS2","HSD","HSG","HSH","HSJ","HSQ","HSR","HSU","HSX","HSY","HSZ","IAB","IDG","IDR","IDS","IDT","IDU","IDX","IDY","IMK","IN1","IPT","ISL","KBG","KD2","KDA","KDM","KDO","KFN","KO1","KO2","KTU","L6S","LAG","LAI","LAK","LAO","LAT","LB2","LBT","LCN","LDY","LGC","LGU","LM2","LMT","LMU","LOG","LOX","LPK","LSM","LTM","LVZ","LXB","LXZ","M1F","M3M","M6P","M8C","MA1","MA2","MA3","MAB","MAG","MAL","MAN","MAT","MAV","MAW","MBG","MCU","MDA","MDM","MDP","MFA","MFB","MFU","MG5","MGA","MGL","MLB","MMA","MMN","MN0","MRP","MTT","MUG","MVP","MXY","N1L","N9S","NAA","NAG","NBG","NDG","NED","NG1","NG6","NGA","NGB","NGC","NGE","NGF","NGL","NGS","NGY","NHF","NM6","NM9","NTF","NTO","NTP","NXD","NYT","OPG","OPM","ORP","OX2","P3M","P53","P6P","PA5","PNA","PNG","PNW","PRP","PSJ","PSV","PTQ","QDK","QPS","QV4","R1P","R1X","R2B","R5P","RAA","RAE","RAF","RAM","RAO","RAT","RB5","RBL","RCD","RDP","REL","RER","RF5","RG1","RGG","RHA","RIB","RIP","RNS","RNT","ROB","ROR","RPA","RST","RUB","RUU","RZM","S6P","S7P","SA0","SCR","SDD","SF6","SF9","SG4","SG5","SG6","SG7","SGA","SGC","SGD","SGN","SGS","SHB","SHG","SI3","SIO","SOE","SOL","SSG","SUC","SUP","SUS","T6P","T6T","TAG","TCB","TDG","TGK","TGY","TH1","TIA","TM5","TM6","TM9","TMR","TMX","TOA","TOC","TRE","TYV","UCD","UDC","VG1","X0X","X1X","X2F","X4S","X5S","X6X","XBP","XDN","XDP","XIF","XIM","XLF","XLS","XMM","XUL","XXR","XYP","XYS","YO5","Z3Q","Z6J","Z9M","ZDC","ZDM"],ym=["CA","C","N","O","O1","O2","OC1","OC2","OX1","OXT","H","H1","H2","H3","HA","BB"],bm=["P","O3'","O5'","C5'","C4'","C3'","OP1","OP2","O3*","O5*","C5*","C4*","C3*"],xm={};xm[Hp]={trace:"CA",direction1:"C",direction2:["O","OC1","O1","OX1","OXT"],backboneStart:"N",backboneEnd:"C"},xm[Wp]={trace:["C4'","C4*"],direction1:["C1'","C1*"],direction2:["C3'","C3*"],backboneStart:"P",backboneEnd:["O3'","O3*"]},xm[Xp]={trace:["C3'","C3*"],direction1:["C2'","C2*"],direction2:["O4'","O4*"],backboneStart:"P",backboneEnd:["O3'","O3*"]},xm[qp]={trace:["CA","BB"],backboneStart:["CA","BB"],backboneEnd:["CA","BB"]},xm[Yp]={trace:["C4'","C4*","P"],backboneStart:["C4'","C4*","P"],backboneEnd:["C4'","C4*","P"]},xm[Zp]={trace:["C3'","C3*","C2'","P"],backboneStart:["C3'","C3*","C2'","P"],backboneEnd:["C3'","C3*","C2'","P"]},xm[Gp]={};var _m,wm,Sm,Am,Mm,Pm,Cm,Tm,Em,Im,Lm,Rm,Om,Dm,Nm,km,Fm,zm,Bm,Um,jm,$m,Vm,Gm,Hm,Wm,Xm,qm,Ym,Zm,Km,Qm,Jm,tg,eg,ig,ng,rg,og,ag,sg,cg,ug,hg,lg,dg,fg,pg,mg,gg,vg,yg,bg,xg,_g,wg,Sg,Ag,Mg,Pg,Cg,Tg,Eg,Ig,Lg,Rg,Og,Dg,Ng,kg,Fg,zg,Bg,Ug,jg,$g,Vg,Gg,Hg=[].slice;Ug=function(){var t,e,i,n,r;for(t={},r="Boolean Number String Function Array Date RegExp Undefined Null".split(" "),n=0,e=r.length;ni&&(t=i),t},jg=function(t){return t.length>=3?[].slice.call(t):t[0]},Um=function(t){var e;for(e in t)e<3?(t[e]<0&&(t[e]=0),t[e]>255&&(t[e]=255)):3===e&&(t[e]<0&&(t[e]=0),t[e]>1&&(t[e]=1));return t},Am=Math.PI,Ng=Math.round,Vm=Math.cos,qm=Math.floor,xg=Math.pow,dg=Math.log,Fg=Math.sin,zg=Math.sqrt,Om=Math.atan2,mg=Math.max,Rm=Math.abs,Cm=2*Am,Mm=Am/3,wm=Am/180,Pm=180/Am,Bm=function(){return arguments[0]instanceof _m?arguments[0]:function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(_m,arguments,function(){})},Lm=[],Bm.version="1.1.1",Im={},Tm=[],Em=!1,_m=function(){function t(){var t,e,i,n,r,o,a,s,c;for(o=this,e=[],s=0,n=arguments.length;s3?e[3]:1]},Gg=function(t){return Ng(255*(t<=.00304?12.92*t:1.055*xg(t,1/2.4)-.055))},sg=function(t){return t>Sm.t1?t*t*t:Sm.t2*(t-Sm.t0)},Sm={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},Cg=function(){var t,e,i,n,r,o,a,s;return n=jg(arguments),i=n[0],e=n[1],t=n[2],r=Rg(i,e,t),o=r[0],a=r[1],s=r[2],[116*a-16,500*(o-a),200*(a-s)]},Og=function(t){return(t/=255)<=.04045?t/12.92:xg((t+.055)/1.055,2.4)},Vg=function(t){return t>Sm.t3?xg(t,1/3):t/Sm.t2+Sm.t0},Rg=function(){var t,e,i,n,r,o,a;return n=jg(arguments),i=n[0],e=n[1],t=n[2],i=Og(i),e=Og(e),t=Og(t),r=Vg((.4124564*i+.3575761*e+.1804375*t)/Sm.Xn),o=Vg((.2126729*i+.7151522*e+.072175*t)/Sm.Yn),a=Vg((.0193339*i+.119192*e+.9503041*t)/Sm.Zn),[r,o,a]},Bm.lab=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(_m,Hg.call(arguments).concat(["lab"]),function(){})},Im.lab=ag,_m.prototype.lab=function(){return Cg(this._rgb)},Dm=function(t){var e,i,n,r,o,a,s,c,u,h,l;return t=function(){var e,i,n;for(n=[],i=0,e=t.length;i=0&&e[3]<=1?"rgb":void 0}}),Ym=function(t){var e,i,n,r,o,a;if(t.match(/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/))return 4!==t.length&&7!==t.length||(t=t.substr(1)),3===t.length&&(t=t.split(""),t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),a=parseInt(t,16),r=a>>16,n=a>>8&255,i=255&a,[r,n,i,1];if(t.match(/^#?([A-Fa-f0-9]{8})$/))return 9===t.length&&(t=t.substr(1)),a=parseInt(t,16),r=a>>24&255,n=a>>16&255,i=a>>8&255,e=Ng((255&a)/255*100)/100,[r,n,i,e];if(null!=Im.css&&(o=Im.css(t)))return o;throw"unknown color: "+t},Sg=function(t,e){var i,n,r,o,a,s,c;return null==e&&(e="rgb"),a=t[0],r=t[1],n=t[2],i=t[3],c=a<<16|r<<8|n,s="000000"+c.toString(16),s=s.substr(s.length-6),o="0"+Ng(255*i).toString(16),o=o.substr(o.length-2),"#"+function(){switch(e.toLowerCase()){case"rgba":return s+o;case"argb":return o+s;default:return s}}()},Im.hex=function(t){return Ym(t)},Bm.hex=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(_m,Hg.call(arguments).concat(["hex"]),function(){})},_m.prototype.hex=function(t){return null==t&&(t="rgb"),Sg(this._rgb,t)},Tm.push({p:10,test:function(t){if(1===arguments.length&&"string"===Ug(t))return"hex"}}),Qm=function(){var t,e,i,n,r,o,a,s,c,u,h,l,d,f;if(t=jg(arguments),r=t[0],h=t[1],a=t[2],0===h)c=n=e=255*a;else{for(f=[0,0,0],i=[0,0,0],d=a<.5?a*(1+h):a+h-a*h,l=2*a-d,r/=360,f[0]=r+1/3,f[1]=r,f[2]=r-1/3,o=s=0;s<=2;o=++s)f[o]<0&&(f[o]+=1),f[o]>1&&(f[o]-=1),6*f[o]<1?i[o]=l+6*(d-l)*f[o]:2*f[o]<1?i[o]=d:3*f[o]<2?i[o]=l+(d-l)*(2/3-f[o])*6:i[o]=l;u=[Ng(255*i[0]),Ng(255*i[1]),Ng(255*i[2])],c=u[0],n=u[1],e=u[2]}return t.length>3?[c,n,e,t[3]]:[c,n,e]},Mg=function(t,e,i){var n,r,o,a,s;return void 0!==t&&t.length>=3&&(a=t,t=a[0],e=a[1],i=a[2]),t/=255,e/=255,i/=255,o=Math.min(t,e,i),mg=Math.max(t,e,i),r=(mg+o)/2,mg===o?(s=0,n=Number.NaN):s=r<.5?(mg-o)/(mg+o):(mg-o)/(2-mg-o),t===mg?n=(e-i)/(mg-o):e===mg?n=2+(i-t)/(mg-o):i===mg&&(n=4+(t-e)/(mg-o)),n*=60,n<0&&(n+=360),[n,s,r]},Bm.hsl=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(_m,Hg.call(arguments).concat(["hsl"]),function(){})},Im.hsl=Qm,_m.prototype.hsl=function(){return Mg(this._rgb)},Jm=function(){var t,e,i,n,r,o,a,s,c,u,h,l,d,f,p,m,g,v;if(t=jg(arguments),r=t[0],m=t[1],v=t[2],v*=255,0===m)c=n=e=v;else switch(360===r&&(r=0),r>360&&(r-=360),r<0&&(r+=360),r/=60,o=qm(r),i=r-o,a=v*(1-m),s=v*(1-m*i),g=v*(1-m*(1-i)),o){case 0:u=[v,g,a],c=u[0],n=u[1],e=u[2];break;case 1:h=[s,v,a],c=h[0],n=h[1],e=h[2];break;case 2:l=[a,v,g],c=l[0],n=l[1],e=l[2];break;case 3:d=[a,s,v],c=d[0],n=d[1],e=d[2];break;case 4:f=[g,a,v],c=f[0],n=f[1],e=f[2];break;case 5:p=[v,a,s],c=p[0],n=p[1],e=p[2]}return c=Ng(c),n=Ng(n),e=Ng(e),[c,n,e,t.length>3?t[3]:1]},Pg=function(){var t,e,i,n,r,o,a,s,c;return a=jg(arguments),o=a[0],i=a[1],t=a[2],r=Math.min(o,i,t),mg=Math.max(o,i,t),e=mg-r,c=mg/255,0===mg?(n=Number.NaN,s=0):(s=e/mg,o===mg&&(n=(i-t)/e),i===mg&&(n=2+(t-o)/e),t===mg&&(n=4+(o-i)/e),n*=60,n<0&&(n+=360)),[n,s,c]},Bm.hsv=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(_m,Hg.call(arguments).concat(["hsv"]),function(){})},Im.hsv=Jm,_m.prototype.hsv=function(){return Pg(this._rgb)},yg=function(t){var e,i,n;return"number"===Ug(t)&&t>=0&&t<=16777215?(n=t>>16,i=t>>8&255,e=255&t,[n,i,e,1]):(console.warn("unknown num color: "+t),[0,0,0,1])},Ig=function(){var t,e,i,n;return n=jg(arguments),i=n[0],e=n[1],t=n[2],(i<<16)+(e<<8)+t},Bm.num=function(t){return new _m(t,"num")},_m.prototype.num=function(t){return null==t&&(t="rgb"),Ig(this._rgb,t)},Im.num=yg,Tm.push({p:10,test:function(t){if(1===arguments.length&&"number"===Ug(t)&&t>=0&&t<=16777215)return"num"}}),Gm=function(t){var e,i,n,r,o,a,s,c;if(t=t.toLowerCase(),null!=Bm.colors&&Bm.colors[t])return Ym(Bm.colors[t]);if(o=t.match(/rgb\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*\)/)){for(s=o.slice(1,4),r=a=0;a<=2;r=++a)s[r]=+s[r];s[3]=1}else if(o=t.match(/rgba\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*,\s*([01]|[01]?\.\d+)\)/))for(s=o.slice(1,5),r=c=0;c<=3;r=++c)s[r]=+s[r];else if(o=t.match(/rgb\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/)){for(s=o.slice(1,4),r=e=0;e<=2;r=++e)s[r]=Ng(2.55*s[r]);s[3]=1}else if(o=t.match(/rgba\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/)){for(s=o.slice(1,5),r=i=0;i<=2;r=++i)s[r]=Ng(2.55*s[r]);s[3]=+s[3]}else(o=t.match(/hsl\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/))?(n=o.slice(1,4),n[1]*=.01,n[2]*=.01,s=Qm(n),s[3]=1):(o=t.match(/hsla\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/))&&(n=o.slice(1,4),n[1]*=.01,n[2]*=.01,s=Qm(n),s[3]=+o[4]);return s},wg=function(t){var e;return e=t[3]<1?"rgba":"rgb","rgb"===e?e+"("+t.slice(0,3).map(Ng).join(",")+")":"rgba"===e?e+"("+t.slice(0,3).map(Ng).join(",")+","+t[3]+")":void 0},Dg=function(t){return Ng(100*t)/100},Km=function(t,e){var i;return i=e<1?"hsla":"hsl",t[0]=Dg(t[0]||0),t[1]=Dg(100*t[1])+"%",t[2]=Dg(100*t[2])+"%","hsla"===i&&(t[3]=e),i+"("+t.join(",")+")"},Im.css=function(t){return Gm(t)},Bm.css=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(_m,Hg.call(arguments).concat(["css"]),function(){})},_m.prototype.css=function(t){return null==t&&(t="rgb"),"rgb"===t.slice(0,3)?wg(this._rgb):"hsl"===t.slice(0,3)?Km(this.hsl(),this.alpha()):void 0},Im.named=function(t){return Ym($g[t])},Tm.push({p:20,test:function(t){if(1===arguments.length&&null!=$g[t])return"named"}}),_m.prototype.name=function(t){var e,i;arguments.length&&($g[t]&&(this._rgb=Ym($g[t])),this._rgb[3]=1),e=this.hex();for(i in $g)if(e===$g[i])return i;return e},cg=function(){var t,e,i,n;return n=jg(arguments),i=n[0],t=n[1],e=n[2],e*=wm,[i,Vm(e)*t,Fg(e)*t]},ug=function(){var t,e,i,n,r,o,a,s,c,u,h;return i=jg(arguments),s=i[0],r=i[1],a=i[2],u=cg(s,r,a),t=u[0],e=u[1],n=u[2],h=ag(t,e,n),c=h[0],o=h[1],n=h[2],[lg(c,0,255),lg(o,0,255),lg(n,0,255),i.length>3?i[3]:1]},og=function(){var t,e,i,n,r,o;return o=jg(arguments),r=o[0],t=o[1],e=o[2],i=zg(t*t+e*e),n=(Om(e,t)*Pm+360)%360,0===Ng(1e4*i)&&(n=Number.NaN),[r,i,n]},Tg=function(){var t,e,i,n,r,o,a;return o=jg(arguments),r=o[0],i=o[1],e=o[2],a=Cg(r,i,e),n=a[0],t=a[1],e=a[2],og(n,t,e)},Bm.lch=function(){var t;return t=jg(arguments),new _m(t,"lch")},Bm.hcl=function(){var t;return t=jg(arguments),new _m(t,"hcl")},Im.lch=ug,Im.hcl=function(){var t,e,i,n;return n=jg(arguments),e=n[0],t=n[1],i=n[2],ug([i,t,e])},_m.prototype.lch=function(){return Tg(this._rgb)},_m.prototype.hcl=function(){return Tg(this._rgb).reverse()},_g=function(t){var e,i,n,r,o,a,s,c,u;return null==t&&(t="rgb"),c=jg(arguments),s=c[0],r=c[1],e=c[2],s/=255,r/=255,e/=255,o=1-Math.max(s,Math.max(r,e)),n=o<1?1/(1-o):0,i=(1-s-o)*n,a=(1-r-o)*n,u=(1-e-o)*n,[i,a,u,o]},jm=function(){var t,e,i,n,r,o,a,s,c;return e=jg(arguments),n=e[0],a=e[1],c=e[2],o=e[3],t=e.length>4?e[4]:1,1===o?[0,0,0,t]:(s=n>=1?0:Ng(255*(1-n)*(1-o)),r=a>=1?0:Ng(255*(1-a)*(1-o)),i=c>=1?0:Ng(255*(1-c)*(1-o)),[s,r,i,t])},Im.cmyk=function(){return jm(jg(arguments))},Bm.cmyk=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(_m,Hg.call(arguments).concat(["cmyk"]),function(){})},_m.prototype.cmyk=function(){return _g(this._rgb)},Im.gl=function(){var t,e,i,n,r;for(n=function(){var t,i;t=jg(arguments),i=[];for(e in t)r=t[e],i.push(r);return i}.apply(this,arguments),t=i=0;i<=2;t=++i)n[t]*=255;return n},Bm.gl=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(_m,Hg.call(arguments).concat(["gl"]),function(){})},_m.prototype.gl=function(){var t;return t=this._rgb,[t[0]/255,t[1]/255,t[2]/255,t[3]]},Eg=function(t,e,i){var n;return n=jg(arguments),t=n[0],e=n[1],i=n[2],t=fg(t),e=fg(e),i=fg(i),.2126*t+.7152*e+.0722*i},fg=function(t){return t/=255,t<=.03928?t/12.92:xg((t+.055)/1.055,2.4)},Lm=[],tg=function(t,e,i,n){var r,o,a,s;for(null==i&&(i=.5),null==n&&(n="rgb"),"object"!==Ug(t)&&(t=Bm(t)),"object"!==Ug(e)&&(e=Bm(e)),a=0,o=Lm.length;at?o(i,c):o(c,a)},i=Eg(this._rgb),this._rgb=(i>t?o(Bm("black"),this):o(this,Bm("white"))).rgba()),this):Eg(this._rgb)},Bg=function(t){var e,i,n,r;return r=t/100,r<66?(n=255,i=-155.25485562709179-.44596950469579133*(i=r-2)+104.49216199393888*dg(i),e=r<20?0:-254.76935184120902+.8274096064007395*(e=r-10)+115.67994401066147*dg(e)):(n=351.97690566805693+.114206453784165*(n=r-55)-40.25366309332127*dg(n),i=325.4494125711974+.07943456536662342*(i=r-50)-28.0852963507957*dg(i),e=255),Um([n,i,e])},Lg=function(){var t,e,i,n,r,o,a,s,c;for(a=jg(arguments),o=a[0],i=a[1],t=a[2],r=1e3,n=4e4,e=.4;n-r>e;)c=.5*(n+r),s=Bg(c),s[2]/s[0]>=t/o?n=c:r=c;return Ng(c)},Bm.temperature=Bm.kelvin=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(_m,Hg.call(arguments).concat(["temperature"]),function(){})},Im.temperature=Im.kelvin=Im.K=Bg,_m.prototype.temperature=function(){return Lg(this._rgb)},_m.prototype.kelvin=_m.prototype.temperature,Bm.contrast=function(t,e){var i,n,r,o;return"string"!==(r=Ug(t))&&"number"!==r||(t=new _m(t)),"string"!==(o=Ug(e))&&"number"!==o||(e=new _m(e)),i=t.luminance(),n=e.luminance(),i>n?(i+.05)/(n+.05):(n+.05)/(i+.05)},_m.prototype.get=function(t){var e,i,n,r,o,a;return n=this,o=t.split("."),r=o[0],e=o[1],a=n[r](),e?(i=r.indexOf(e),i>-1?a[i]:console.warn("unknown channel "+e+" in mode "+r)):a},_m.prototype.set=function(t,e){var i,n,r,o,a,s;if(r=this,a=t.split("."),o=a[0],i=a[1],i)if(s=r[o](),n=o.indexOf(i),n>-1)if("string"===Ug(e))switch(e.charAt(0)){case"+":s[n]+=+e;break;case"-":s[n]+=+e;break;case"*":s[n]*=+e.substr(1);break;case"/":s[n]/=+e.substr(1);break;default:s[n]=+e}else s[n]=e;else console.warn("unknown channel "+i+" in mode "+o);else s=e;return r._rgb=Bm(s,o).alpha(r.alpha())._rgb,r},_m.prototype.darken=function(t){var e,i;return null==t&&(t=1),i=this,e=i.lab(),e[0]-=Sm.Kn*t,Bm.lab(e).alpha(i.alpha())},_m.prototype.brighten=function(t){return null==t&&(t=1),this.darken(-t)},_m.prototype.darker=_m.prototype.darken,_m.prototype.brighter=_m.prototype.brighten,_m.prototype.saturate=function(t){var e,i;return null==t&&(t=1),i=this,e=i.lch(),e[1]+=t*Sm.Kn,e[1]<0&&(e[1]=0),Bm.lch(e).alpha(i.alpha())},_m.prototype.desaturate=function(t){return null==t&&(t=1),this.saturate(-t)},_m.prototype.premultiply=function(){var t,e;return e=this.rgb(),t=this.alpha(),Bm(e[0]*t,e[1]*t,e[2]*t,t)},Nm=function(t,e,i){if(!Nm[i])throw"unknown blend mode "+i;return Nm[i](t,e)},km=function(t){return function(e,i){var n,r;return n=Bm(i).rgb(),r=Bm(e).rgb(),Bm(t(n,r),"rgb")}},Xm=function(t){return function(e,i){var n,r,o;for(o=[],n=r=0;r<=3;n=++r)o[n]=t(e[n],i[n]);return o}},vg=function(t,e){return t},gg=function(t,e){return t*e/255},Hm=function(t,e){return t>e?e:t},hg=function(t,e){return t>e?t:e},kg=function(t,e){return 255*(1-(1-t/255)*(1-e/255))},bg=function(t,e){return e<128?2*t*e/255:255*(1-2*(1-t/255)*(1-e/255))},zm=function(t,e){return 255*(1-(1-e/255)/(t/255))},Wm=function(t,e){return 255===t?255:(t=255*(e/255)/(1-t/255),t>255?255:t)},Nm.normal=km(Xm(vg)),Nm.multiply=km(Xm(gg)),Nm.screen=km(Xm(kg)),Nm.overlay=km(Xm(bg)),Nm.darken=km(Xm(Hm)),Nm.lighten=km(Xm(hg)),Nm.dodge=km(Xm(Wm)),Nm.burn=km(Xm(zm)), -Bm.blend=Nm,Bm.analyze=function(t){var e,i,n,r;for(n={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0},i=0,e=t.length;in.max&&(n.max=r),n.count+=1);return n.domain=[n.min,n.max],n.limits=function(t,e){return Bm.limits(n,t,e)},n},Bm.scale=function(t,e){var i,n,r,o,a,s,c,u,h,l,d,f,p,m,g,v,y,b,x,_,w;return h="rgb",l=Bm("#ccc"),m=0,s=!1,a=[0,1],p=[],f=[0,0],i=!1,r=[],d=!1,u=0,c=1,o=!1,n={},_=function(t){var e,i,n,o,a,s,c;if(null==t&&(t=["#fff","#000"]),null!=t&&"string"===Ug(t)&&null!=(null!=(o=Bm.brewer)?o[t]:void 0)&&(t=Bm.brewer[t]),"array"===Ug(t)){for(t=t.slice(0),e=n=0,a=t.length-1;0<=a?n<=a:n>=a;e=0<=a?++n:--n)i=t[e],"string"===Ug(i)&&(t[e]=Bm(i));for(p.length=0,e=c=0,s=t.length-1;0<=s?c<=s:c>=s;e=0<=s?++c:--c)p.push(e/(t.length-1))}return x(),r=t},y=function(t){var e,n;if(null!=i){for(n=i.length-1,e=0;e=i[e];)e++;return e-1}return 0},w=function(t){return t},g=function(t){var e,n,r,o,a;return a=t,i.length>2&&(o=i.length-1,e=y(t),r=i[0]+(i[1]-i[0])*(0+.5*m),n=i[o-1]+(i[o]-i[o-1])*(1-.5*m),a=u+(i[e]+.5*(i[e+1]-i[e])-r)/(n-r)*(c-u)),a},b=function(t,e){var o,a,s,d,m,g,v,b;if(null==e&&(e=!1),isNaN(t))return l;if(e?b=t:i&&i.length>2?(o=y(t),b=o/(i.length-2),b=f[0]+b*(1-f[0]-f[1])):c!==u?(b=(t-u)/(c-u),b=f[0]+b*(1-f[0]-f[1]),b=Math.min(1,Math.max(0,b))):b=1,e||(b=w(b)),d=Math.floor(1e4*b),n[d])a=n[d];else{if("array"===Ug(r))for(s=m=0,v=p.length-1;0<=v?m<=v:m>=v;s=0<=v?++m:--m){if(g=p[s],b<=g){a=r[s];break}if(b>=g&&s===p.length-1){a=r[s];break}if(b>g&&b=h;e=0<=h?++l:--l)p.push(e/(n-1));return a=[u,c],v},v.mode=function(t){return arguments.length?(h=t,x(),v):h},v.range=function(t,e){return _(t,e),v},v.out=function(t){return d=t,v},v.spread=function(t){return arguments.length?(m=t,v):m},v.correctLightness=function(t){return null==t&&(t=!0),o=t,x(),w=o?function(t){var e,i,n,r,o,a,s,c,u;for(e=b(0,!0).lab()[0],i=b(1,!0).lab()[0],s=e>i,n=b(t,!0).lab()[0],o=e+(i-e)*t,r=n-o,c=0,u=1,a=20;Math.abs(r)>.01&&a-- >0;)!function(){return s&&(r*=-1),r<0?(c=t,t+=.5*(u-t)):(u=t,t+=.5*(c-t)),n=b(t,!0).lab()[0],r=n-o}();return t}:function(t){return t},v},v.padding=function(t){return null!=t?("number"===Ug(t)&&(t=[t,t]),f=t,v):f},v.colors=function(){var e,n,r,o,s,c,u,h,l;if(o=0,s="hex",1===arguments.length&&("string"===Ug(arguments[0])?s=arguments[0]:o=arguments[0]),2===arguments.length&&(o=arguments[0],s=arguments[1]),o)return n=a[0],e=a[1]-n,function(){u=[];for(var t=0;0<=o?to;0<=o?t++:t--)u.push(t);return u}.apply(this).map(function(t){return v(n+t/(o-1)*e)[s]()});if(t=[],h=[],i&&i.length>2)for(r=l=1,c=i.length;1<=c?lc;r=1<=c?++l:--l)h.push(.5*(i[r-1]+i[r]));else h=a;return h.map(function(t){return v(t)[s]()})},v},null==Bm.scales&&(Bm.scales={}),Bm.scales.cool=function(){return Bm.scale([Bm.hsl(180,1,.9),Bm.hsl(250,.7,.4)])},Bm.scales.hot=function(){return Bm.scale(["#000","#f00","#ff0","#fff"],[0,.25,.75,1]).mode("rgb")},Bm.analyze=function(t,e,i){var n,r,o,a,s,c,u;if(s={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0},null==i&&(i=function(){return!0}),n=function(t){null==t||isNaN(t)||(s.values.push(t),s.sum+=t,ts.max&&(s.max=t),s.count+=1)},u=function(t,r){if(i(t,r))return n(null!=e&&"function"===Ug(e)?e(t):null!=e&&"string"===Ug(e)||"number"===Ug(e)?t[e]:t)},"array"===Ug(t))for(a=0,o=t.length;a=F;w=1<=F?++O:--O)M.push(C+w/i*(mg-C));M.push(mg)}else if("l"===e.substr(0,1)){if(C<=0)throw"Logarithmic scales are only possible for values > 0";for(T=Math.LOG10E*dg(C),P=Math.LOG10E*dg(mg),M.push(C),w=nt=1,z=i-1;1<=z?nt<=z:nt>=z;w=1<=z?++nt:--nt)M.push(xg(10,T+w/i*(P-T)));M.push(mg)}else if("q"===e.substr(0,1)){for(M.push(C),w=n=1,G=i-1;1<=G?n<=G:n>=G;w=1<=G?++n:--n)D=it.length*w/i,N=qm(D),N===D?M.push(it[N]):(k=D-N,M.push(it[N]*k+it[N+1]*(1-k)));M.push(mg)}else if("k"===e.substr(0,1)){for(I=it.length,g=new Array(I),x=new Array(i),Q=!0,L=0,y=null,y=[],y.push(C),w=r=1,H=i-1;1<=H?r<=H:r>=H;w=1<=H?++r:--r)y.push(C+w/i*(mg-C));for(y.push(mg);Q;){for(S=o=0,W=i-1;0<=W?o<=W:o>=W;S=0<=W?++o:--o)x[S]=0;for(w=a=0,X=I-1;0<=X?a<=X:a>=X;w=0<=X?++a:--a){for(et=it[w],E=Number.MAX_VALUE,S=s=0,q=i-1;0<=q?s<=q:s>=q;S=0<=q?++s:--s)_=Rm(y[S]-et),_=Y;S=0<=Y?++c:--c)R[S]=null;for(w=u=0,Z=I-1;0<=Z?u<=Z:u>=Z;w=0<=Z?++u:--u)b=g[w],null===R[b]?R[b]=it[w]:R[b]+=it[w];for(S=h=0,K=i-1;0<=K?h<=K:h>=K;S=0<=K?++h:--h)R[S]*=1/x[S];for(Q=!1,S=l=0,B=i-1;0<=B?l<=B:l>=B;S=0<=B?++l:--l)if(R[S]!==y[w]){Q=!0;break}y=R,L++,L>200&&(Q=!1)}for(A={},S=d=0,U=i-1;0<=U?d<=U:d>=U;S=0<=U?++d:--d)A[S]=[];for(w=f=0,j=I-1;0<=j?f<=j:f>=j;w=0<=j?++f:--f)b=g[w],A[b].push(it[w]);for(tt=[],S=p=0,$=i-1;0<=$?p<=$:p>=$;S=0<=$?++p:--p)tt.push(A[S][0]),tt.push(A[S][A[S].length-1]);for(tt=tt.sort(function(t,e){return t-e}),M.push(tt[0]),w=m=1,V=tt.length-1;m<=V;w=m+=2)isNaN(tt[w])||M.push(tt[w])}return M},Zm=function(t,e,i){var n,r,o,a;return n=jg(arguments),t=n[0],e=n[1],i=n[2],t/=360,t<1/3?(r=(1-e)/3,a=(1+e*Vm(Cm*t)/Vm(Mm-Cm*t))/3,o=1-(r+a)):t<2/3?(t-=1/3,a=(1-e)/3,o=(1+e*Vm(Cm*t)/Vm(Mm-Cm*t))/3,r=1-(a+o)):(t-=2/3,o=(1-e)/3,r=(1+e*Vm(Cm*t)/Vm(Mm-Cm*t))/3,a=1-(o+r)),a=lg(i*a*3),o=lg(i*o*3),r=lg(i*r*3),[255*a,255*o,255*r,n.length>3?n[3]:1]},Ag=function(){var t,e,i,n,r,o,a,s;return a=jg(arguments),o=a[0],e=a[1],t=a[2],Cm=2*Math.PI,o/=255,e/=255,t/=255,r=Math.min(o,e,t),n=(o+e+t)/3,s=1-r/n,0===s?i=0:(i=(o-e+(o-t))/2,i/=Math.sqrt((o-e)*(o-e)+(o-t)*(e-t)),i=Math.acos(i),t>e&&(i=Cm-i),i/=Cm),[360*i,s,n]},Bm.hsi=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(_m,Hg.call(arguments).concat(["hsi"]),function(){})},Im.hsi=Zm,_m.prototype.hsi=function(){return Ag(this._rgb)},eg=function(t,e,i,n){var r,o,a,s,c,u,h,l,d,f,p,m,g;return"hsl"===n?(m=t.hsl(),g=e.hsl()):"hsv"===n?(m=t.hsv(),g=e.hsv()):"hsi"===n?(m=t.hsi(),g=e.hsi()):"lch"!==n&&"hcl"!==n||(n="hcl",m=t.hcl(),g=e.hcl()),"h"===n.substr(0,1)&&(a=m[0],f=m[1],u=m[2],s=g[0],p=g[1],h=g[2]),isNaN(a)||isNaN(s)?isNaN(a)?isNaN(s)?o=Number.NaN:(o=s,1!==u&&0!==u||"hsv"===n||(d=p)):(o=a,1!==h&&0!==h||"hsv"===n||(d=f)):(r=s>a&&s-a>180?s-(a+360):s180?s+360-a:s-a,o=a+i*r),null==d&&(d=f+i*(p-f)),c=u+i*(h-u),l=Bm[n](o,d,c)},Lm=Lm.concat(function(){var t,e,i,n;for(i=["hsv","hsl","hsi","hcl","lch"],n=[],e=0,t=i.length;e>16&255)/255,e[i+1]=(t>>8&255)/255,e[i+2]=(255&t)/255,e},atomColor:function(){return 16777215},atomColorToArray:function(t,e,i){return this.colorToArray(this.atomColor(t),e,i)},bondColor:function(t,e){return this.atomProxy.index=e?t.atomIndex1:t.atomIndex2,this.atomColor(this.atomProxy)},bondColorToArray:function(t,e,i,n){return this.colorToArray(this.bondColor(t,e),i,n)},volumeColor:function(){return 16777215},volumeColorToArray:function(t,e,i){return this.colorToArray(this.volumeColor(t),e,i)},positionColor:function(){return 16777215},positionColorToArray:function(t,e,i){return this.colorToArray(this.positionColor(t),e,i)}},Pn.prototype=Mn.prototype,Pn.prototype.constructor=Pn,Cn.prototype=Mn.prototype,Cn.prototype.constructor=Cn,Tn.prototype=Mn.prototype,Tn.prototype.constructor=Tn,En.prototype=Mn.prototype,En.prototype.constructor=En,In.prototype=Mn.prototype,In.prototype.constructor=In,Ln.prototype=Mn.prototype,Ln.prototype.constructor=Ln,Rn.prototype=Mn.prototype,Rn.prototype.constructor=Rn,On.prototype=Mn.prototype,On.prototype.constructor=On,Dn.prototype=Mn.prototype,Dn.prototype.constructor=Dn,Nn.prototype=Mn.prototype,Nn.prototype.constructor=Nn,kn.prototype=Mn.prototype,kn.prototype.constructor=kn,Fn.prototype=Mn.prototype,Fn.prototype.constructor=Fn,zn.prototype=Mn.prototype,zn.prototype.constructor=zn,Bn.prototype=Mn.prototype,Bn.prototype.constructor=Bn,Un.prototype=Mn.prototype,Un.prototype.constructor=Un,jn.prototype=Mn.prototype,jn.prototype.constructor=jn,$n.prototype=Mn.prototype,$n.prototype.constructor=$n,Vn.prototype=Mn.prototype,Vn.prototype.constructor=Vn,Gn.prototype=Mn.prototype,Gn.prototype.constructor=Gn,Hn.prototype=Mn.prototype,Hn.prototype.constructor=Hn,An.types={"":Mn,picking:Tn,random:En,uniform:In,atomindex:Ln,residueindex:Rn,chainindex:On,chainname:Dn,chainid:Nn,polymer:kn,modelindex:Fn,entitytype:zn,moleculetype:Bn,sstruc:Un,element:jn,resname:$n,bfactor:Vn,hydrophobicity:Hn,value:Cn,volume:Pn,occupancy:Gn};var Jg=p(),tv="undefined"!=typeof window&&"undefined"!=typeof window.orientation,ev=!1,iv=!1,nv={log:Function.prototype.bind.call(console.log,console),info:Function.prototype.bind.call(console.info,console),warn:Function.prototype.bind.call(console.warn,console),error:Function.prototype.bind.call(console.error,console),time:Function.prototype.bind.call(console.time,console),timeEnd:Function.prototype.bind.call(console.timeEnd,console)};t.Debug=l(h("debug"));var rv='

Your browser/graphics card does not seem to support WebGL.

Find out how to get it here.

',ov=new T,av=new An,sv=new S("datasource"),cv=new S("representatation"),uv=new S("parser"),hv=new S("shader"),lv=new S("decompressor");Yn.prototype={constructor:Yn,type:"",__srcName:void 0,isBinary:function(){return this.binary||this.compressed},onload:function(){},onprogress:function(){},onerror:function(){},read:function(t){this._read(function(e){var i=lv.get(this.compressed);this.compressed&&i?this.data=i(e):((this.binary||this.compressed)&&e instanceof ArrayBuffer&&(e=new Uint8Array(e)),this.data=e),"function"==typeof this.onload&&this.onload(this.data),t()}.bind(this))},_read:function(t){t(this.src)},_chunk:function(t,e){return e=Math.min(this.data.length,e),0===t&&this.data.length===e?this.data:this.isBinary()?this.data.subarray(t,e):this.data.substring(t,e)},chunk:function(t){var e=t+this.chunkSize;return this._chunk(t,e)},peekLines:function(t){var e,i=this.data,n=i.length,r=this.isBinary()?this.newline.charCodeAt(0):this.newline,o=0;for(e=0;en);return s.lines},lineCount:function(){console.warn("lineCount - deprecated");for(var t=this.data,e=t.length,i=this.isBinary()?this.newline.charCodeAt(0):this.newline,n=0,r=0;rthis.data.length))return this.__pointer+=this.chunkSize,this.chunk(t)},nextChunkOfLines:function(){var t=this.nextChunk();if(void 0!==t){var e=this.__pointer>this.data.length,i=this.chunkToLines(t,this.__partialLine,e);return this.__partialLine=i.partialLine,i.lines}},eachChunk:function(t){for(var e=this.chunkSize,i=this.data.length,n=this.chunkCount(),r=0;r=0),o[8]){case"b":i=parseInt(i,10).toString(2);break;case"c":i=String.fromCharCode(parseInt(i,10));break;case"d":case"i":i=parseInt(i,10);break;case"j":i=JSON.stringify(i,null,o[6]?parseInt(o[6]):0);break;case"e":i=o[7]?parseFloat(i).toExponential(o[7]):parseFloat(i).toExponential();break;case"f":i=o[7]?parseFloat(i).toFixed(o[7]):parseFloat(i);break;case"g":i=o[7]?parseFloat(i).toPrecision(o[7]):parseFloat(i);break;case"o":i=i.toString(8);break;case"s":i=String(i),i=o[7]?i.substring(0,o[7]):i;break;case"t":i=String(!!i),i=o[7]?i.substring(0,o[7]):i;break;case"T":i=ar(i),i=o[7]?i.substring(0,o[7]):i;break;case"u":i=parseInt(i,10)>>>0;break;case"v":i=i.valueOf(),i=o[7]?i.substring(0,o[7]):i;break;case"x":i=parseInt(i,10).toString(16);break;case"X":i=parseInt(i,10).toString(16).toUpperCase()}dv.json.test(o[8])?d[d.length]=i:(!dv.number.test(o[8])||f&&!o[3]?p="":(p=f?"+":"-",i=i.toString().replace(dv.sign,"")),s=o[4]?"0"===o[4]?"0":o[4].charAt(1):" ",c=o[6]-(p+i).length,a=o[6]&&c>0?sr(s,c):"",d[d.length]=o[5]?p+i+a:"0"===s?p+a+i:a+p+i)}return d.join("")},or.cache={},or.parse=function(t){for(var e=t,i=[],n=[],r=0;e;){if(null!==(i=dv.text.exec(e)))n[n.length]=i[0];else if(null!==(i=dv.modulo.exec(e)))n[n.length]="%";else{if(null===(i=dv.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(i[2]){r|=1;var o=[],a=i[2],s=[];if(null===(s=dv.key.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o[o.length]=s[1];""!==(a=a.substring(s[0].length));)if(null!==(s=dv.key_access.exec(a)))o[o.length]=s[1];else{if(null===(s=dv.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");o[o.length]=s[1]}i[2]=o}else r|=2;if(3===r)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=i}e=e.substring(i[0].length)}return n};var fv={0:["","0","00","000","0000","00000","000000","0000000"]," ":[""," "," "," "," "," "," "," "],_:["","_","__","___","____","_____","______","_______"]};ur.prototype={clear:function(){this.change(-this.count)},change:function(t){this.count+=t,this.signals.countChanged.dispatch(t,this.count),this.count<0&&nv.warn("Counter.count below zero",this.count)},increment:function(){this.change(1)},decrement:function(){this.change(-1)},listen:function(t){this.change(t.count),t.signals.countChanged.add(this.change,this)},unlisten:function(t){var e=t.signals.countChanged;e.has(this.change,this)&&e.remove(this.change,this)},onZeroOnce:function(t,e){if(0===this.count)t.call(e,0,0);else{var i=function(){0===this.count&&(this.signals.countChanged.remove(i,this),t.apply(e,arguments))};this.signals.countChanged.add(i,this)}},dispose:function(){this.clear(),this.signals.countChanged.dispose()}},hr.prototype={constructor:hr,getBaseObject:function(t){return"StructureView"===t.type&&(t=t.getStructure()),t},addObject:function(t){t=this.getBaseObject(t);var e=this.allocateGidRange(t);return e&&(this.objectList.push(t),this.rangeList.push(e)),this},removeObject:function(t){t=this.getBaseObject(t);var e=this.objectList.indexOf(t);return e!==-1&&(this.objectList.splice(e,1),this.rangeList.splice(e,1),0===this.objectList.length&&(this.nextGid=1)),this},updateObject:function(t,e){t=this.getBaseObject(t);var i=this.objectList.indexOf(t);if(i!==-1){var n=this.rangeList[i];if(n[1]===this.nextGid){var r=this.getGidCount(t);this.nextGid+=r-(n[1]-n[0]),n[1]=this.nextGid}else this.rangeList[i]=this.allocateGidRange(t)}else e||nv.warn("GidPool.updateObject: object not found.");return this},getGidCount:function(t){t=this.getBaseObject(t);var e=0;return"Structure"===t.type?e=t.atomStore.count+t.bondStore.count+t.backboneBondStore.count+t.rungBondStore.count:"Volume"===t.type?e=t.__data.length:nv.warn("GidPool.getGidCount: unknown object type"),e},allocateGidRange:function(t){t=this.getBaseObject(t);var e=this.getGidCount(t);if(e>Math.pow(10,7))return nv.warn("GidPool.allocateGidRange: gidCount too large"),null;var i=this.nextGid;return this.nextGid+=e,this.nextGid>Math.pow(2,24)&&nv.error("GidPool.allocateGidRange: GidPool overflown"),[i,this.nextGid]},getNextGid:function(){return this.nextGid++},getGid:function(t,e){t=this.getBaseObject(t),e=e||0;var i=0,n=this.objectList.indexOf(t);if(n!==-1){var r=this.rangeList[n],o=r[0];i=o+e}else nv.warn("GidPool.getGid: object not found.");return i},getByGid:function(t){var e;return this.objectList.forEach(function(i,n){var r=this.rangeList[n];if(!(t=r[1])){var o=t-r[0];"Structure"===i.type?othis.prevFpsTime+1e3&&(this.lastFps=this.frames,this.prevFpsTime=t,this.frames=0),t}},dr.prototype=Object.create(E.prototype),dr.prototype.constructor=dr,hv.add("shader/chunk/dull_interior_fragment.glsl","#ifdef DULL_INTERIOR\nif( gl_FrontFacing == false ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#endif"),hv.add("shader/chunk/fog_fragment.glsl","#ifdef USE_FOG\nfloat depth = length( vViewPosition );\n#ifdef FOG_EXP2\nfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif"),hv.add("shader/chunk/nearclip_vertex.glsl","#ifdef NEAR_CLIP\nif( vViewPosition.z < nearClip - 5.0 )\ngl_Position.z = 2.0 * gl_Position.w;\n#endif"),hv.add("shader/chunk/nearclip_fragment.glsl","#ifdef NEAR_CLIP\nif( vViewPosition.z < nearClip )\ndiscard;\n#endif"),hv.add("shader/chunk/radiusclip_vertex.glsl","#ifdef RADIUS_CLIP\nif( distance( vViewPosition, vClipCenter ) > clipRadius + 5.0 )\ngl_Position.z = 2.0 * gl_Position.w;\n#endif"),hv.add("shader/chunk/radiusclip_fragment.glsl","#ifdef RADIUS_CLIP\nif( distance( vViewPosition, vClipCenter ) > clipRadius )\ndiscard;\n#endif"),hv.add("shader/chunk/opaque_back_fragment.glsl","#ifdef OPAQUE_BACK\n#ifdef FLIP_SIDED\nif( gl_FrontFacing == true ){\ngl_FragColor.a = 1.0;\n}\n#else\nif( gl_FrontFacing == false ){\ngl_FragColor.a = 1.0;\n}\n#endif\n#endif");var pv=/^(?!\/\/)\s*#include\s+(\S+)/gim,mv={};mr.prototype.constructor=mr;var gv=2*Math.PI,vv=new N,yv=new O,bv=new O,xv=new O,_v=new O;WebGLRenderingContext&&(WebGLRenderingContext.prototype.getShaderParameter=function(){var e=WebGLRenderingContext.prototype.getShaderParameter;return function(){return!t.Debug||e.apply(this,arguments)}}(),WebGLRenderingContext.prototype.getShaderInfoLog=function(){var e=WebGLRenderingContext.prototype.getShaderInfoLog;return function(){return t.Debug?e.apply(this,arguments):""}}(),WebGLRenderingContext.prototype.getProgramParameter=function(){var e=WebGLRenderingContext.prototype.getProgramParameter;return function(i,n){return!t.Debug&&n===WebGLRenderingContext.prototype.LINK_STATUS||e.apply(this,arguments)}}(),WebGLRenderingContext.prototype.getProgramInfoLog=function(){var e=WebGLRenderingContext.prototype.getProgramInfoLog;return function(){return t.Debug?e.apply(this,arguments):""}}());var wv=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]];wv.forEach(function(t){t.forEach(function(t){t[0]*=.0625,t[1]*=.0625})}),Tr.prototype.constructor=Tr;var Sv=2,Av=3,Mv=function(e,i){function n(t){var e=Object.assign({},t);c=d(e.hoverTimeout,c)}function r(t,e){var i,n,r,o=a.pick(t.canvasPosition.x,t.canvasPosition.y),c=o.instance,u=s.getByGid(o.gid);return u&&"AtomProxy"===u.type?i=u:u&&"BondProxy"===u.type?n=u:u&&"Volume"===u.volume.type&&(r=u),(i||n||r)&&t.which===Sv&&e&&(i?h.copy(i):n?h.copy(n.atom1).add(n.atom2).multiplyScalar(.5):r&&h.copy(r),c&&h.applyProjection(c.matrix),a.centerView(!1,h)),{atom:i,bond:n,volume:r,instance:c}}function o(){if(performance.now()-l.lastMoved>c&&(l.moving=!1),!l.moving&&!l.hovering){l.hovering=!0;var t=r(l);u.hovered.dispatch(t)}requestAnimationFrame(o)}var a=e.viewer,s=e.gidPool,c=50;n(i);var u={clicked:new xn,hovered:new xn},h=new N,l={position:new I,down:new I,canvasPosition:new I,moving:!1,hovering:!0,lastMoved:1/0,which:void 0,distance:function(){return l.position.distanceTo(l.down)},setCanvasPosition:function(t){var e=a.renderer.domElement.getBoundingClientRect(),i=t.clientX-e.left,n=t.clientY-e.top;l.canvasPosition.set(i,e.height-n)}};o(),a.renderer.domElement.addEventListener("mousemove",function(t){ -t.preventDefault(),l.moving=!0,l.hovering=!1,l.lastMoved=performance.now(),l.position.set(t.layerX,t.layerY),l.setCanvasPosition(t)}),a.renderer.domElement.addEventListener("mousedown",function(t){t.preventDefault(),l.moving=!1,l.hovering=!1,l.down.set(t.layerX,t.layerY),l.which=t.which,l.setCanvasPosition(t)}),a.renderer.domElement.addEventListener("mouseup",function(e){if(e.preventDefault(),!(l.distance()>3||e.which===Av)){var i=r(l,!0);l.which=void 0,u.clicked.dispatch(i),t.Debug&&nv.log("clicked",i)}}),this.signals=u,this.setParameters=n};Er.prototype.add=function(t){this.count<<5<=t&&this.resize(t),this.words[t>>>5]|=1<>>5]|=1<>>5]^=1<>>5]^=1<>>5)+1,r=(e>>>5)-1,o=0|n;o+7>>5]|=1<>>5]|=1<>>5]&=~(1<>>5]&=~(1<>>5]&=~(1<>>5]&=~(1<>>5]&1<0;)0===this.words[this.count-1]&&this.count--;this.words=this.words.slice(0,this.count)},Er.prototype.resize=function(t){if(this.length=t,!(this.count<<5>t)&&(this.count=t+32>>>5,this.words.length<<5<=t)){var e=new Uint32Array(this.count<<1);e.set(this.words),this.words=e}},Er.prototype.hammingWeight=function(t){return t-=t>>>1&1431655765,t=(858993459&t)+(t>>>2&858993459),16843009*(t+(t>>>4)&252645135)>>>24},Er.prototype.size=function(){for(var t=0,e=this.count,i=0;i=t&&eo?a.set(this[n].subarray(0,o)):a.set(this[n]),this[n]=a}},growIfFull:function(){if(this.count>=this.length){var t=Math.round(1.5*this.length);this.resize(Math.max(256,t))}},copyFrom:function(t,e,i,n){for(var r=0,o=this.__fields.length;r0;)s-=1;a<=s&&(a===o?o=s:s===o&&(o=a),e(a,s),a+=1,s-=1)}while(a<=s);i(n,s),i(a,r)}}nv.time("Store.sort");var n=this,r=new this.constructor(1);i(0,this.count-1),nv.timeEnd("Store.sort")},clear:function(){this.count=0},dispose:function(){delete this.length,delete this.count;for(var t=0,e=this.__fields.length;t0&&(l[i]=A.angleTo(M)),t=Math.cos(b.angleTo(x)),p[i]=180/Math.PI*Math.acos(t),n=b.length(),r=x.length(),d[i]=Math.sqrt(r*n)/Math.max(2,2*(1-t)),f[i]=Math.abs(v.dot(A)),_.copy(b).multiplyScalar(d[i]/n),w.copy(x).multiplyScalar(d[i]/r),_.subVectors(I,_),w.subVectors(L,w),_.toArray(u,e+3),w.toArray(u,e+6),P.subVectors(E,C),P.toArray(m,e),M.copy(A),C.copy(_);for(_.fromArray(u,3),w.fromArray(u,6),A.subVectors(_,w).normalize(),E.index=o.getAtomIndexByType(0,T),C.copy(E),S.copy(E),Rr(S,A,_),S.toArray(u,0),P.subVectors(C,_),P.toArray(m,0),_.fromArray(u,3*s-6),w.fromArray(u,3*s-9),A.subVectors(_,w).normalize(),E.index=o.getAtomIndexByType(s-1,T),C.copy(E),S.copy(E),Rr(S,A,_),S.toArray(u,3*s-3),i=s-3;ie?z=!0:h.bending[B]>t&&(z=!0)),z){if(B-v<4){v=B,z=!1;continue}D.index=R.traceAtomIndex,T=h.axis.subarray(3*v+3,3*B),E=h.center.subarray(3*v,3*B+3),d=Lr(T).normalize(),f=Lr(E),I.fromArray(E),Rr(I,d,f),L.fromArray(E,E.length-3),Rr(L,d,f),d.subVectors(L,I),d.toArray(b,y),f.toArray(x,y),I.toArray(_,y),L.toArray(w,y),p.atomColorToArray(D,S,y),m.atomColorToArray(D,A,y),M.push(g.atomRadius(D)),P.push(u+v),C.push(u+B+1-v),y+=3,v=B,z=!1}return{axis:new Float32Array(b),center:new Float32Array(x),begin:new Float32Array(_),end:new Float32Array(w),color:new Float32Array(S),pickingColor:new Float32Array(A),size:new Float32Array(M),residueOffset:P,residueCount:C}}},Eo.prototype={push:function(t){this.content.push(t),this.bubbleUp(this.content.length-1)},pop:function(){var t=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.sinkDown(0)),t},peek:function(){return this.content[0]},remove:function(t){for(var e=this.content.length,i=0;i0;){var i=Math.floor((t+1)/2)-1,n=this.content[i];if(!(this.scoreFunction(e)":"3/4-Z","?":"X-Y","@":"Y-X",A:"Z+1/3",B:"Z+2/3",C:"X+2/3",D:"Y+1/3",E:"-Y+2/3",F:"X-Y+1/3",G:"Y-X+2/3",H:"-X+1/3",I:"X+1/3",J:"Y+2/3",K:"-Y+1/3",L:"X-Y+2/3",M:"Y-X+1/3",N:"-X+2/3",O:"2/3+X",P:"1/3+Y",Q:"1/3+Z",R:"2/3-Y",S:"1/3+X-Y",T:"2/3+Y-X",U:"1/3-X",V:"2/3-X",W:"1/3-Y",X:"1/3-Z",Y:"2/3+Y",Z:"1/3+Y-X","[":"2/3+X-Y","]":"1/3+X","^":"2/3+Z",_:"2/3-Z","`":"5/6+Z",a:"1/6+Z",b:"5/6-Z",c:"1/6-Z",d:"Z+5/6",e:"Z+1/6",f:"Z+1/4",g:"+Y"},Iv={"P 1":" !#","P -1":" !#$%&","P 1 2 1":" !#$!&","P 1 21 1":" !#$'&","C 1 2 1":" !#$!&()#*)&","P 1 m 1":" !# %#","P 1 c 1":" !# %+","C 1 m 1":" !# %#()#(,#","C 1 c 1":" !# %+()#(,+","P 1 2/m 1":" !# %#$!&$%&","P 1 21/m 1":" !#$)&$%& ,#","C 1 2/m 1":" !# %#$!&$%&()#(,#*)&*,&","P 1 2/c 1":" !#$!-$%& %+","P 1 21/c 1":" !#$%&$)- ,+","C 1 2/c 1":" !#$!-$%& %+()#*)-*,&(,+","P 2 2 2":" !#$%#$!& %&","P 2 2 21":" !#$%+$!- %&","P 21 21 2":" !#$%#*)&(,&","P 21 21 21":" !#*%+$)-(,&","C 2 2 21":" !#$%+$!- %&()#*,+*)-(,&","C 2 2 2":" !#$%#$!& %&()#*,#*)&(,&","F 2 2 2":" !#$%#$!& %& )+$,+$)- ,-(!+*%+*!-(%-()#*,#*)&(,&","I 2 2 2":" !#$%# %&$!&.'/01/.120'2","I 21 21 21":" !#*%+$)-(,&()+$,#*!& %-","P m m 2":" !#$%# %#$!#","P m c 21":" !#$%+ %+$!#","P c c 2":" !#$%# %+$!+","P m a 2":" !#$%#(%#*!#","P c a 21":" !#$%+(%#*!+","P n c 2":" !#$%# ,+$)+","P m n 21":" !#*%+(%+$!#","P b a 2":" !#$%#(,#*)#","P n a 21":" !#$%+(,#*)+","P n n 2":" !#$%#(,+*)+","C m m 2":" !#$%# %#$!#()#*,#(,#*)#","C m c 21":" !#$%+ %+$!#()#*,+(,+*)#","C c c 2":" !#$%# %+$!+()#*,#(,+*)+","A m m 2":" !#$%# %#$!# )+$,+ ,+$)+","A b m 2":" !#$%# ,#$)# )+$,+ %+$!+","A m a 2":" !#$%#(%#*!# )+$,+(,+*)+","A b a 2":" !#$%#(,#*)# )+$,+(%+*!+","F m m 2":" !#$%# %#$!# )+$,+ ,+$)+(!+*%+(%+*!+()#*,#(,#*)#","F d d 2":" !#$%#345675 )+$,+3896:9(!+*%+;49<79()#*,#;85<:5","I m m 2":" !#$%# %#$!#()+*,+(,+*)+","I b a 2":" !#$%#(,#*)#()+*,+ %+$!+","I m a 2":" !#$%#(%#*!#()+*,+ ,+$)+","P 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!#","P 2/n 2/n 2/n":" !#$%#$!& %&*,-()-(,+*)+","P 2/c 2/c 2/m":" !#$%#$!- %-$%& !& %+$!+","P 2/b 2/a 2/n":" !#$%#$!& %&*,&()&(,#*)#","P 21/m 2/m 2/a":" !#*%#$!&(%&$%&(!& %#*!#","P 2/n 21/n 2/a":" !#*%#*)- ,-$%&(!&(,+$)+","P 2/m 2/n 21/a":" !#*%+*!- %&$%&(!-(%+$!#","P 21/c 2/c 2/a":" !#*%#$!-(%-$%&(!& %+*!+","P 21/b 21/a 2/m":" !#$%#*)&(,&$%& !&(,#*)#","P 21/c 21/c 2/n":" !#*,#$)-(%-$%&()& ,+*!+","P 2/b 21/c 21/m":" !#$%+$)- ,&$%& !- ,+$)#","P 21/n 21/n 2/m":" !#$%#*)-(,-$%& !&(,+*)+","P 21/m 21/m 2/n":" !#$%#*'&.,&*,&.'& %#$!#","P 21/b 2/c 21/n":" !#*,+$!-(,&$%&()- %+*)#","P 21/b 21/c 21/a":" !#*%+$)-(,&$%&(!- ,+*)#","P 21/n 21/m 21/a":" !#0%/$'&.12$%&.!2 1#0'/","C 2/m 2/c 21/m":" !#$%+$!- %&$%& !- %+$!#()#*,+*)-(,&*,&()-(,+*)#","C 2/m 2/c 21/a":" !#$,+$)- %&$%& )- ,+$!#()#*%+*!-(,&*,&(!-(%+*)#","C 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!#()#*,#*)&(,&*,&()&(,#*)#","C 2/c 2/c 2/m":" !#$%#$!- %-$%& !& %+$!+()#*,#*)-(,-*,&()&(,+*)+","C 2/m 2/m 2/a":" !#$,#$)& %&$%& )& ,#$!#()#*%#*!&(,&*,&(!&(%#*)#","C 2/c 2/c 2/a":" !#*,#$!&(,&$,-(!- ,+*!+()#$%#*)& %&*%- )-(%+$)+","F 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!# )+$,+$)- ,-$,- )- ,+$)+(!+*%+*!-(%-*%-(!-(%+*!+()#*,#*)&(,&*,&()&(,#*)#","F 2/d 2/d 2/d":" !#$%#$!& %&64=37=345675 )+$,+$)- ,-68>3:>3896:9(!+*%+*!-(%-<4>;7>;49<79()#*,#*)&(,&<8=;:=;85<:5","I 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!#()+*,+*)-(,-*,-()-(,+*)+","I 2/b 2/a 2/m":" !#$%#*)&(,&$%& !&(,#*)#()+*,+$!- %-*,-()- %+$!+","I 21/b 21/c 21/a":" !#*%+$)-(,&$%&(!- ,+*)#()+$,#*!& %-*,- )&(%#$!+","I 21/m 21/m 21/a":" !#$,#$)& %&$%& )& ,#$!#()+*%+*!-(,-*,-(!-(%+*)+","P 4":" !#$%#% #!$#","P 41":" !#$%+% 5!$9","P 42":" !#$%#% +!$+","P 43":" !#$%+% 9!$5","I 4":" !#$%#% #!$#()+*,+,(+)*+","I 41":" !#*,+%(5)$9()+$%#, 9!*5","P -4":" !#$%#!$&% &","I -4":" !#$%#!$&% &()+*,+)*-,(-","P 4/m":" !#$%#% #!$#$%& !&!$&% &","P 42/m":" !#$%#% +!$+$%& !&!$-% -","P 4/n":" !#$%#,(#)*#*,&()&!$&% &","P 42/n":" !#$%#,(+)*+*,-()-!$&% &","I 4/m":" !#$%#% #!$#$%& !&!$&% &()+*,+,(+)*+*,-()-)*-,(-","I 41/a":" !#*,+%(5)$9$,=(!>!$&,(-()+$%#, 9!*5*%> )=)*-% &","P 4 2 2":" !#$%#% #!$#$!& %&! &%$&","P 4 21 2":" !#$%#,(#)*#*)&(,&! &%$&","P 41 2 2":" !#$%+% 5!$9$!& %-! >%$=","P 41 21 2":" !#$%+,(5)*9*)=(,>! &%$-","P 42 2 2":" !#$%#% +!$+$!& %&! -%$-","P 42 21 2":" !#$%#,(+)*+*)-(,-! &%$&","P 43 2 2":" !#$%+% 9!$5$!& %-! =%$>","P 43 21 2":" !#$%+,(9)*5*)>(,=! &%$-","I 4 2 2":" !#$%#% #!$#$!& %&! &%$&()+*,+,(+)*+*)-(,-)(-,*-","I 41 2 2":" !#*,+%(5)$9*!> ,=)(-%$&()+$%#, 9!*5$)=(%>! &,*-","P 4 m m":" !#$%#% #!$# %#$!#%$#! #","P 4 b m":" !#$%#% #!$#(,#*)#,*#)(#","P 42 c m":" !#$%#% +!$+ %+$!+%$#! #","P 42 n m":" !#$%#,(+)*+(,+*)+%$#! #","P 4 c c":" !#$%#% #!$# %+$!+%$+! +","P 4 n c":" !#$%#% #!$#(,+*)+,*+)(+","P 42 m c":" !#$%#% +!$+ %#$!#%$+! +","P 42 b c":" !#$%#% +!$+(,#*)#,*+)(+","I 4 m m":" !#$%#% #!$# %#$!#%$#! #()+*,+,(+)*+(,+*)+,*+)(+","I 4 c m":" !#$%#% #!$# %+$!+%$+! +()+*,+,(+)*+(,#*)#,*#)(#","I 41 m d":" !#*,+%(5)$9 %#*)+%*5) 9()+$%#, 9!*5(,+$!#,$9!(5","I 41 c d":" !#*,+%(5)$9 %+*)#%*9) 5()+$%#, 9!*5(,#$!+,$5!(9","P -4 2 m":" !#$%#% &!$&$!& %&%$#! #","P -4 2 c":" !#$%#% &!$&$!- %-%$+! +","P -4 21 m":" !#$%#% &!$&*)&(,&,*#)(#","P -4 21 c":" !#$%#% &!$&*)-(,-,*+)(+","P -4 m 2":" !#$%#!$&% & %#$!#! &%$&","P -4 c 2":" !#$%#% &!$& %+$!+! -%$-","P -4 b 2":" !#$%#% &!$&(,#*)#)(&,*&","P -4 n 2":" !#$%#% &!$&(,+*)+)(-,*-","I -4 m 2":" !#$%#% &!$& %#$!#! &%$&()+*,+,(-)*-(,+*)+)(-,*-","I -4 c 2":" !#$%#% &!$& %+$!+! -%$-()+*,+,(-)*-(,#*)#)(&,*&","I -4 2 m":" !#$%#% &!$&$!& %&%$#! #()+*,+,(-)*-*)-(,-,*+)(+","I -4 2 d":" !#$%#% &!$&*!>(%>,$9) 9()+*,+,(-)*-$)= ,=%*5!(5","P 4/m 2/m 2/m":" !#$%#% #!$#$!& %&! &%$&$%& !&!$&% & %#$!#%$#! #","P 4/m 2/c 2/c":" !#$%#% #!$#$!- %-! -%$-$%& !&!$&% & %+$!+%$+! +","P 4/n 2/b 2/m":" !#$%#% #!$#$!& %&! &%$&*,&()&)*&,(&(,#*)#,*#)(#","P 4/n 2/n 2/c":" !#$%#% #!$#$!& %&! &%$&*,-()-)*-,(-(,+*)+,*+)(+","P 4/m 21/b 2/m":" !#$%#% #!$#*)&(,&)(&,*&$%& !&!$&% &(,#*)#,*#)(#","P 4/m 21/n 2/c":" !#$%#% #!$#*)-(,-)(-,*-$%& !&!$&% &(,+*)+,*+)(+","P 4/n 21/m 2/m":" !#$%#,(#)*#*)&(,&! &%$&*,&()&!$&% & %#$!#,*#)(#","P 4/n 2/c 2/c":" !#$%#,(#)*#*)-(,-! -%$-*,&()&!$&% & %+$!+,*+)(+","P 42/m 2/m 2/c":" !#$%#% +!$+$!& %&! -%$-$%& !&!$-% - %#$!#%$+! +","P 42/m 2/c 2/m":" !#$%#% +!$+$!- %-! &%$&$%& !&!$-% - %+$!+%$#! #","P 42/n 2/b 2/c":" !#$%#,(+)*+$!- %-)(&,*&*,-()-!$&% &(,#*)#%$+! +","P 42/n 2/n 2/m":" !#$%#,(+)*+$!& %&)(-,*-*,-()-!$&% &(,+*)+%$#! #","P 42/m 21/b 2/c":" !#$%#% +!$+*)&(,&)(-,*-$%& !&!$-% -(,#*)#,*+)(+","P 42/m 21/n 2/m":" !#$%#,./'*/*'-.,-! &%$&$%& !&'*-,.-.,/*'/%$#! #","P 42/n 21/m 2/c":" !#$%#,(+)*+*)-(,-! &%$&*,-()-!$&% & %#$!#,*+)(+","P 42/n 21/c 2/m":" !#$%#,(+)*+*)&(,&! -%$-*,-()-!$&% & %+$!+,*#)(#","I 4/m 2/m 2/m":" !#$%#% #!$#$!& %&! &%$&$%& !&!$&% & %#$!#%$#! #()+*,+,(+)*+*)-(,-)(-,*-*,-()-)*-,(-(,+*)+,*+)(+","I 4/m 2/c 2/m":" !#$%#% #!$#$!- %-! -%$-$%& !&!$&% & %+$!+%$+! +()+*,+,(+)*+*)&(,&)(&,*&*,-()-)*-,(-(,#*)#,*#)(#","I 41/a 2/m 2/d":" !#*,+%(5)$9*!> ,=)(-%$&$,=(!>!$&,(-(,+$!#,$9!(5()+$%#, 9!*5$)=(%>! &,*-*%> )=)*-% & %#*)+%*5) 9","I 41/a 2/c 2/d":" !#*,+%(5)$9*!= ,>)(&%$-$,=(!>!$&,(-(,#$!+,$5!(9()+$%#, 9!*5$)>(%=! -,*&*%> )=)*-% & %+*)#%*9) 5","P 3":" !#%?#@$#","P 31":" !#%?A@$B","P 32":" !#%?B@$A","H 3":" !#%?#@$#CDAEFAGHAIJBKLBMNB","R 3":" !## !!# ","P -3":" !#%?#@$#$%&!@&? &","H -3":" !#%?#@$#$%&!@&? &OPQRSQTUQVWXYZX[]X]Y^W[^ZV^UR_PT_SO_","R -3":" !## !!# $%&&$%%&$","P 3 1 2":" !#%?#@$#%$&@!& ?&","P 3 2 1":" !#%?#@$#! &?%&$@&","P 31 1 2":" !#%?Q@$^%$_@!X ?&","P 31 2 1":" !#%?A@$B! &?%_$@X","P 32 1 2":" !#%?^@$Q%$X@!_ ?&","P 32 2 1":" !#%?B@$A! &?%X$@_","H 3 2":" !#%?#@$#! &?%&$@&OPQRSQTUQY]X[WXVZX]Y^W[^ZV^PO_SR_UT_","R 3 2":" !## !!# %$&$&%&%$","P 3 m 1":" !#%?#@$#%$#@!# ?#","P 3 1 m":" !#%?#@$#! #?%#$@#","P 3 c 1":" !#%?#@$#%$+@!+ ?+","P 3 1 c":" !#%?#@$#! +?%+$@+","H 3 m":" !#%?#@$#%$#@!# ?#OPQRSQTUQRUQTPQOSQ]Y^W[^ZV^WV^ZY^][^","R 3 m":" !## !!# ! # #!#! ","H 3 c":" !#%?#@$#%$+@!+ ?+OPQRSQTUQRU`TP`OS`]Y^W[^ZV^WVaZYa][a","R 3 c":" !## !!# '././'/'.","P -3 1 2/m":" !#%?#@$#%$&@!& ?&$%&!@&? &! #?%#$@#","P -3 1 2/c":" !#%?#@$#%$-@!- ?-$%&!@&? &! +?%+$@+","P -3 2/m 1":" !#%?#@$#! &?%&$@&$%&!@&? &%$#@!# ?#","P -3 2/c 1":" !#%?#@$#! -?%-$@-$%&!@&? &%$+@!+ ?+","H -3 2/m":" !#%?#@$#! &?%&$@&$%&!@&? &%$#@!# ?#OPQRSQTUQY]X[WXVZXVWXYZX[]XRUQTPQOSQ]Y^W[^ZV^PO_SR_UT_UR_PT_SO_WV^ZY^][^","R -3 2/m":" !## !!# %$&$&%&%$$%&&$%%&$! # #!#! ","H -3 2/c":" !#%?#@$#! -?%-$@-$%&!@&? &%$+@!+ ?+OPQRSQTUQY]b[WbVZbVWXYZX[]XRU`TP`OS`]Y^W[^ZV^POcSRcUTcUR_PT_SO_WVaZYa][a","R -3 2/c":" !## !!# 102021210$%&&$%%&$'././'/'.","P 6":" !#%?#@$#$%#!@#? #","P 61":" !#%?A@$B$%/!@d? e","P 65":" !#%?B@$A$%/!@e? d","P 62":" !#%?^@$Q$%#!@^? Q","P 64":" !#%?Q@$^$%#!@Q? ^","P 63":" !#%?#@$#$%+!@+? +","P -6":" !#%?#@$# !&%?&@$&","P 6/m":" !#%?#@$#$%#!@#? #$%&!@&? & !&%?&@$&","P 63/m":" !#%?#@$#$%+!@+? +$%&!@&? & !-%?-@$-","P 6 2 2":" !#%?#@$#$%#!@#? #! &?%&$@&%$&@!& ?&","P 61 2 2":" !#%?Q@$^$%+!@`? a! X?%&$@_%$b@!- ?c","P 65 2 2":" !#%?^@$Q$%+!@a? `! _?%&$@X%$c@!- ?b","P 62 2 2":" !#%?^@$Q$%#!@^? Q! _?%&$@X%$_@!& ?X","P 64 2 2":" !#%?Q@$^$%#!@Q? ^! X?%&$@_%$X@!& ?_","P 63 2 2":" !#%?#@$#$%+!@+? +! &?%&$@&%$-@!- ?-","P 6 m m":" !#%?#@$#$%#!@#? #%$#@!# ?#! #?%#$@#","P 6 c c":" !#%?#@$#$%#!@#? #%$+@!+ ?+! +?%+$@+","P 63 c m":" !#%?#@$#$%+!@+? +%$+@!+ ?+! #?%#$@#","P 63 m c":" !#%?#@$#$%+!@+? +%$#@!# ?#! +?%+$@+","P -6 m 2":" !#%?#@$# !&%?&@$&%$#@!# ?#%$&@!& ?&","P -6 c 2":" !#%?#@$# !-%?-@$-%$+@!+ ?+%$&@!& ?&","P -6 2 m":" !#%?#@$# !&%?&@$&! &?%&$@&! #?%#$@#","P -6 2 c":" !#%?#@$# !-%?-@$-! &?%&$@&! +?%+$@+","P 6/m 2/m 2/m":" !#%?#@$#$%#!@#? #! &?%&$@&%$&@!& ?&$%&!@&? & !&@$&%?&%$#@!# ?#! #?%#$@#","P 6/m 2/c 2/c":" !#%?#@$#$%#!@#? #! -?%-$@-%$-@!- ?-$%&!@&? & !&@$&%?&%$+@!+ ?+! +?%+$@+","P 63/m 2/c 2/m":" !#%?#@$#$%+!@+? +! -?%-$@-%$&@!& ?&$%&!@&? & !-@$-%?-%$+@!+ ?+! #?%#$@#","P 63/m 2/m 2/c":" !#%?#@$#$%+!@+? +! &?%&$@&%$-@!- ?-$%&!@&? & !-@$-%?-%$#@!# ?#! +?%+$@+","P 2 3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ","F 2 3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-((!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- ","I 2 3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-(","P 21 3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(","I 21 3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- ","P 2/m -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& $%& !& %#$!#&$%& !# %#$!%&$!& %# !#$","P 2/n -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& *,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*","F 2/m -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& $%& !& %#$!#&$%& !# %#$!%&$!& %# !#$ )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-($,- )- ,+$)+&*,&()#(,#*)%-*!-(%+(!+*(!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(*%-(!-(%+*!+-$,- )+ ,+$),&*)&(,#()#*()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- *,&()&(,#*)#-*%-(!+(%+*!,-$)- ,+ )+$","F 2/d -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& 64=37=345675=64=375345674=67=3453756 )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(68>3:>3896:9=<8=;:5;85<:4><7>;49;79<(!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(<4>;7>;49<79>68>3:93896:8=<:=;85;:5<()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- <8=;:=;8f<:f><4>;79;49<78>6:>3893:96","I 2/m -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& $%& !& %#$!#&$%& !# %#$!%&$!& %# !#$()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-(*,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*","P 21/a -3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&($%&(!- ,+*)#&$%-(!+ ,#*)%&$!-(,+ )#*","I 21/a -3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&($%&(!- ,+*)#&$%-(!+ ,#*)%&$!-(,+ )#*()+$,#*g& %-+()#$,&*!- %)+(,#$!&*%- *,- )&(%#$!+-*,& )#(%+$!,-*)& %#(!+$","P 4 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$","P 42 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*","F 4 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$ )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(!(-%*-!*+%(+ +,$+)$-, -)#)*#,(&)(&,*(!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&() -,$-)$+, +(#,*#)*&,(&)+!*+%(-!(-%*()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- )(&,*&)*#,(#(+%*+!*-%(-!+)$+, -) -,$","F 41 3 2":" !#$,+*)&(%-# !+$,&*)-(%!# ,+$)&*%-(:3>46=7<98;5;58<976=43>:97<58;>:3=46 )+$%#*!-(,&#()+*%&$!- ,!+(,#*)-$%& :;=4<>765839;94<5:6>83=79:6543>7;=8<(!+*,#$)- %&+ )#$%-*!&(,)#(%+*!&$,- 73=86>:<54;935469:<=8;>7576983=:;>4<()#*%+$!& ,-+(!#*,-$)& %)+ %#$!-*,&(7;>8<=:69435398657<>4;=:5:<94;=73>86","I 4 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-()(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*","P 43 3 2":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(7;>46=:<5839398<5:6=4;>75:<983>7;=46","P 41 3 2":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(:3=8<>7694;5;54697<>83=:97654;=:3>8<","I 41 3 2":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(:3=8<>7694;5;54697<>83=:97654;=:3>8<()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- 7;>46=:<5839398<5:6=4;>75:<983>7;=46","P -4 3 m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! #%$#!$&% & #!$#%$&! &%#! #%$&!$&% ","F -4 3 m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! #%$#!$&% & #!$#%$&! &%#! #%$&!$&% )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(!(+%*+!*-%(- +)$+,$-) -,#)(#,*&)*&,((!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&() +,$+)$-, -(#)*#,*&)(&,+!(+%*-!*-%(()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- )(#,*#)*&,(&(+!*+%*-!(-%+) +,$-)$-, ","I -4 3 m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! #%$#!$&% & #!$#%$&! &%#! #%$&!$&% ()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-()(+,*+)*-,(-(+)*+,*-)(-,+)(+,*-)*-,(", -"P -4 3 n":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(+,*+)*-,(-(+)*+,*-)(-,+)(+,*-)*-,(","F -4 3 c":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(+,*+)*-,(-(+)*+,*-)(-,+)(+,*-)*-,( )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-() #,$#)$&, &(#!*#%*&!(&%+! +%$-!$-% (!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(!(#%*#!*&%(& +!$+%$-! -%#) #,$&)$&, ()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- ! +%$+!$-% - #)$#,$&) &,#!(#%*&!*&%(","I -4 3 d":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(7354<9:6>8;=357<946>:;=857394<>:6=8;()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- :;98657<=43>;9:658<=73>49:;586=7<>43","P 4/m -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! ","P 4/n -3 2/n":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$*,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)(","P 42/m -3 2/n":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)(","P 42/n -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,**,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! ","F 4/m -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(!(-%*-!*+%(+ +,$+)$-, -)#)*#,(&)(&,*$,- )- ,+$)+&*,&()#(,#*)%-*!-(%+(!+*%*+!(+%(-!*-$-) -, +)$+,&,(&)*#,*#)((!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&() -,$-)$+, +(#,*#)*&,(&)+!*+%(-!(-%**%-(!-(%+*!+-$,- )+ ,+$),&*)&(,#()#*,$+) +, -)$-*&)(&,(#)*#,-%(-!*+%*+!(()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- )(&,*&)*#,(#(+%*+!*-%(-!+)$+, -) -,$*,&()&(,#*)#-*%-(!+(%+*!,-$)- ,+ )+$,*#)(#,(&)*&*-!(-%(+!*+%-, -)$+,$+) ","F 4/m -3 2/c":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)( )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-() &,$&)$#, #(#%*#!*&%(&!+!$+% -! -%$$,- )- ,+$)+&*,&()#(,#*)%-*!-(%+(!+*,$#) #, &)$&*&!(&%(#!*#%-% -!$+%$+! (!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(!(&%*&!*#%(# +%$+!$-% -!#)$#, &) &,$*%-(!-(%+*!+-$,- )+ ,+$),&*)&(,#()#*%*#!(#%(&!*&$-! -% +!$+%&, &)$#,$#) ()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- ! -%$-!$+% + #,$#)$&, &)#!*#%(&!(&%**,&()&(,#*)#-*%-(!+(%+*!,-$)- ,+ )+$%$+! +% -!$-$&) &, #)$#,&%(&!*#%*#!(","F 41/d -3 2/m":" !#$,+*)&(%-# !+$,&*)-(%!# ,+$)&*%-(:3>46=7<98;5;58<976=43>:97<58;>:3=4664=3:>;85<79=64>3:5;89<74=6:>385;79<,$+! #%(-)*&*&)(-% #!$+,-%(&)*+,$#! )+$%#*!-(,&#()+*%&$!- ,!+(,#*)-$%& :;=4<>765839;94<5:6>83=79:6543>7;=8<68>37=;49<:5=<8>;753496:4><:=;893756,*#!(+% &)$-*-!(&, +)$#%-, &!$+%*#)((!+*,#$)- %&+ )#$%-*!&(,)#(%+*!&$,- 73=86>:<54;935469:<=8;>7576983=:;>4<<4>;:=389675>68=379;45<:8=<7>;453:96%$#) +,(&!*-$&! -,(#)*+%&% -)$#,*+!(()#*%+$!& ,-+(!#*,-$)& %)+ %#$!-*,&(7;>8<=:69435398657<>4;=:5:<94;=73>86<8=;7>3456:9><4=;:9385678>67=349;:5<%*+)(#, -!$&$-) &%(+!*#,&,(-!*#%$+) ","F 41/d -3 2/c":" !#$,+*)&(%-# !+$,&*)-(%!# ,+$)&*%-(:3>46=7<98;5;58<976=43>:97<58;>:3=46<8>;7=3496:5><8=;793456:8><7=;493:56%*#)(+, &!$-$-! &,(+)*#%&, -!$#%*+)( )+$%#*!-(,&#()+*%&$!- ,!+(,#*)-$%& :;=4<>765839;94<5:6>83=79:6543>7;=8<<4=;:>385679>64=3:9;85<78=67>345;:9<%$+) #,(-!*&$&) -%(#!*+,&%(-)*#,$+! (!+*,#$)- %&+ )#$%-*!&(,)#(%+*!&$,- 73=86>:<54;935469:<=8;>7576983=:;>4<68=37>;45<:9=<4>;:5389674>6:=389;75<,*+!(#% -)$&*-)(&% +!$#,-,(&!*+%$#) ()#*%+$!& ,-+(!#*,-$)& %)+ %#$!-*,&(7;>8<=:69435398657<>4;=:5:<94;=73>8664>3:=;89<75=68>375;49<:4=<:>;853796,$#! +%(&)*-*&!(-, #)$+%-% &)$+,*#!(","I 4/m -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! ()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-()(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,**,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)(","I 41/a -3 2/d":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(:3=8<>7694;5;54697<>83=:97654;=:3>8<$%&(!- ,+*)#&$%-(!+ ,#*)%&$!-(,+ )#*4<97358;=:6>6>:;=8357<94=8;>:694<573()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- 7;>46=:<5839398<5:6=4;>75:<983>7;=46*,- )&(%#$!+-*,& )#(%+$!,-*)& %#(!+$865:;943>7<=<=73>4;9:658>43=7<5869:;","P 1 1 2":" !#$%#","P 1 1 21":" !#$%+","B 1 1 2":" !#$%#(g+*%+","A 1 2 1":" !#$!& )+$)-","C 1 21 1":" !#$)&()#*!&","I 1 2 1":" !#$!&.'/0'2","I 1 21 1":" !#$)&.'/0!-","P 1 1 m":" !# !&","P 1 1 b":" !# )&","B 1 1 m":" !# !&(!+(!-","B 1 1 b":" !# )&(!+()-","P 1 1 2/m":" !# !&$%#$%&","P 1 1 21/m":" !#$%+$%& !-","B 1 1 2/m":" !# !&$%#$%&(!+(!-*%+*%-","P 1 1 2/b":" !#$,#$%& )&","P 1 1 21/b":" !#$%&$,+ )-","B 1 1 2/b":" !#$,#$%& )&(!+*,+*%-()-","P 21 2 2":" !#$!&(%&*%#","P 2 21 2":" !# ,&$)&$%#","P 21 21 2 (a)":" !#*,#.%&$'&","P 21 2 21":" !#$!&(%-*%+","P 2 21 21":" !# %&$)-$,+","C 2 2 21a)":" !#*%+(,&$)-()#$,+ %&*!-","C 2 2 2a":" !#*,#.%&$'&()#$%# ,&*!&","F 2 2 2a":" !#*,#.%&$'& '/*%/.12$!2.!/$,/ %20'2.'#$%# 1&0!&","I 2 2 2a":" !#*,#.%&$'&()+$%+*!- ,-","P 21/m 21/m 2/n a":" !#*,#$)&(%&$%&.'& ,#*!#","P 42 21 2a":" !#*,#%.+'$+$'&.%&! -,*-","I 2 3a":" !#*,#.%&$'&!# ,- '&$%/$# !-*!/$%&.%()+$%+ ,-*!-)+(%&(!-*,#*+()&$)#*,- ,"};Do.prototype={constructor:Do,type:"Assembly",addPart:function(t,e){var i=new No(t,e);return this.partList.push(i),i},getAtomCount:function(t){var e=0;return this.partList.forEach(function(i){e+=i.getAtomCount(t)}),e},getInstanceCount:function(){var t=0;return this.partList.forEach(function(e){t+=e.matrixList.length}),t},isIdentity:function(t){if(1!==this.partList.length)return!1;var e=this.partList[0];if(1!==e.matrixList.length)return!1;var i=new O;if(!i.equals(e.matrixList[0]))return!1;var n=[];return t.eachChain(function(t){n.push(t.chainname)}),n=x(n),e.chainList.length===n.length},getBoundingBox:function(t){var e=new Et;return this.partList.forEach(function(i){var n=i.getBoundingBox(t);e.expandByPoint(n.min),e.expandByPoint(n.max)}),e},getSelection:function(){var t=[];return this.partList.forEach(function(e){t=t.concat(e.chainList)}),Oo(t)}},No.prototype={constructor:No,type:"AssemblyPart",getAtomCount:function(t){var e=0,i=this.chainList;return t.eachChain(function(t){(0===i.length||i.includes(t.chainname))&&(e+=t.atomCount)}),this.matrixList.length*e},getBoundingBox:function(t){var e=new Et,i=new Et,n=this.getSelection(),r=t.getBoundingBox(n);return this.matrixList.forEach(function(t){i.copy(r).applyMatrix4(t),e.expandByPoint(i.min),e.expandByPoint(i.max)}),e},getSelection:function(){return Oo(this.chainList)},getView:function(t){var e=this.getSelection();return e?t.getView(e):t},getInstanceList:function(){for(var t=[],e=0,i=this.matrixList.length;e=t.residueCount)){a.index=o+h,s.index=o+h+l,c.index=a.traceAtomIndex,u.index=s.traceAtomIndex;var d=c.distanceTo(u);if(Math.abs(d-i[l-2])>n)return!1}return!0},i=function(t,i){var n=[5.45,5.18,6.37],r=2.1;return e(t,i,n,r)},n=function(t,i){var n=[6.1,10.4,13],r=1.42;return e(t,i,n,r)},r=function(t){for(var e=t.residueStore,r=t.residueIndexStart,o=0,a=t.residueCount;o1&&a.bending[u]=3&&t.indexOf(n[0])!==-1?n[0]:""}}();Ho.prototype={constructor:Ho,type:"AtomType",atomname:void 0,element:void 0,vdw:void 0,covalent:void 0},Xo.prototype={constructor:Xo,type:"ResidueType",resname:void 0,atomTypeIdList:void 0,atomCount:void 0,getBackboneIndexList:function(){var t,e=[];switch(this.moleculeType){case Up:t=ym;break;case jp:case $p:t=bm;break;default:return e}for(var i=this.structure.atomMap,n=this.atomTypeIdList,r=0,o=this.atomCount;r=2?t(l,e[l],a):i[l]=2;else if(1===i[l]&&c&&c!=l){var d=[l];n[l]=1,r.push(d);for(var f=o.length-1;f>=0;--f){var p=o[f];if(p===l)break;d.push(p),n[p]=1}}}i[a]=2,o.pop()}for(var e=this.getBondGraph(),i=new Int8Array(this.atomCount),n=new Int8Array(this.atomCount),r=[],o=[],a=0;a1){for(e=0;e1){for(e=0;e0){var e=this.residueStore.atomOffset[this.residueIndex];return t.includes(this.index-e)}return!1},isPolymer:function(){if(this.structure.entityList.length>0)return this.entity.isPolymer();var t=this.residueType.moleculeType;return t===Up||t===jp||t===$p},isSidechain:function(){return this.isPolymer()&&!this.isBackbone()},isCg:function(){var t=this.residueType.backboneType;return t===qp||t===Yp||t===Zp},isHetero:function(){return 1===this.residueType.hetero},isProtein:function(){return this.residueType.moleculeType===Up},isNucleic:function(){var t=this.residueType.moleculeType;return t===jp||t===$p},isRna:function(){return this.residueType.moleculeType===jp},isDna:function(){return this.residueType.moleculeType===$p},isWater:function(){return this.residueType.moleculeType===zp},isIon:function(){return this.residueType.moleculeType===Bp},isSaccharide:function(){return this.residueType.moleculeType===Vp},isRing:function(){var t=this.residueType.getRings().flags;return 1===t[this.index-this.residueAtomOffset]},distanceTo:function(t){var e=this.atomStore,i=t.atomStore,n=this.index,r=t.index,o=e.x[n]-i.x[r],a=e.y[n]-i.y[r],s=e.z[n]-i.z[r],c=o*o+a*a+s*s;return Math.sqrt(c)},connectedTo:function(t){var e=this.atomStore,i=t.atomStore,n=this.index,r=t.index;if(e.altloc&&i.altloc){var o=e.altloc[n],a=i.altloc[r];if(0!==o&&0!==a&&32!==o&&32!==a&&o!==a)return!1}var s=e.x[n]-i.x[r],c=e.y[n]-i.y[r],u=e.z[n]-i.z[r],h=s*s+c*c+u*u;if(h<64&&this.isCg())return!0;if(isNaN(h))return!1;var l=this.covalent+t.covalent,d=l+.3,f=l-.5;return hf*f},positionFromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e+0],this.y=t[e+1],this.z=t[e+2],this},positionToArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.index,n=this.atomStore;return t[e+0]=n.x[i],t[e+1]=n.y[i],t[e+2]=n.z[i],t},positionToVector3:function(t){return void 0===t&&(t=new N),t.x=this.x,t.y=this.y,t.z=this.z,t},positionFromVector3:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},getResidueBonds:function(t){var e,i,n,r,o=this.residueAtomOffset,a=this.index-this.residueAtomOffset,s=this.residueType.getBonds(),c=s.atomIndices1,u=s.atomIndices2;for(t||(r=[]),e=c.indexOf(a);e!==-1;){if(n=u[e]+o,t)return n;r.push(n),e=c.indexOf(a,e+1)}for(i=u.indexOf(a);i!==-1;){if(n=c[i]+o,t)return n;r.push(n),i=u.indexOf(a,i+1)}return r},qualifiedName:function(t){var e="";return this.resname&&!t&&(e+="["+this.resname+"]"),void 0!==this.resno&&(e+=this.resno),this.inscode&&(e+="^"+this.inscode),this.chainname&&(e+=":"+this.chainname),this.atomname&&(e+="."+this.atomname),this.altloc&&(e+="%"+this.altloc),this.structure.modelStore.count>1&&(e+="/"+this.modelIndex),e},clone:function(){return new this.constructor(this.structure,this.index)},toObject:function(){return{index:this.index,residueIndex:this.residueIndex,atomno:this.atomno,resname:this.resname,x:this.x,y:this.y,z:this.z,element:this.element,chainname:this.chainname,resno:this.resno,serial:this.serial,vdw:this.vdw,covalent:this.covalent,hetero:this.hetero,bfactor:this.bfactor,altloc:this.altloc,atomname:this.atomname,modelindex:this.modelindex}}},Ko.prototype={constructor:Ko,type:"ResidueProxy",structure:void 0,chainStore:void 0,residueStore:void 0,atomStore:void 0,index:void 0,get entity(){return this.structure.entityList[this.entityIndex]},get entityIndex(){return this.chainStore.entityIndex[this.chainIndex]},get chain(){return this.structure.getChainProxy(this.chainIndex)},get chainIndex(){return this.residueStore.chainIndex[this.index]},set chainIndex(t){this.residueStore.chainIndex[this.index]=t},get atomOffset(){return this.residueStore.atomOffset[this.index]},set atomOffset(t){this.residueStore.atomOffset[this.index]=t},get atomCount(){return this.residueStore.atomCount[this.index]},set atomCount(t){this.residueStore.atomCount[this.index]=t},get atomEnd(){return this.atomOffset+this.atomCount-1},get modelIndex(){return this.chainStore.modelIndex[this.chainIndex]},get chainname(){return this.chainStore.getChainname(this.chainIndex)},get chainid(){return this.chainStore.getChainid(this.chainIndex)},get resno(){return this.residueStore.resno[this.index]},set resno(t){this.residueStore.resno[this.index]=t},get sstruc(){return this.residueStore.getSstruc(this.index)},set sstruc(t){this.residueStore.setSstruc(this.index,t)},get inscode(){return this.residueStore.getInscode(this.index)},set inscode(t){this.residueStore.getInscode(this.index,t)},get residueType(){return this.residueMap.get(this.residueStore.residueTypeId[this.index])},get resname(){return this.residueType.resname},get hetero(){return this.residueType.hetero},get moleculeType(){return this.residueType.moleculeType},get backboneType(){return this.residueType.backboneType},get backboneStartType(){return this.residueType.backboneStartType},get backboneEndType(){return this.residueType.backboneEndType},get traceAtomIndex(){return this.residueType.traceAtomIndex+this.atomOffset},get direction1AtomIndex(){return this.residueType.direction1AtomIndex+this.atomOffset},get direction2AtomIndex(){return this.residueType.direction2AtomIndex+this.atomOffset},get backboneStartAtomIndex(){return this.residueType.backboneStartAtomIndex+this.atomOffset},get backboneEndAtomIndex(){return this.residueType.backboneEndAtomIndex+this.atomOffset},get rungEndAtomIndex(){return this.residueType.rungEndAtomIndex+this.atomOffset},eachAtom:function(t,e){var i,n=this.atomCount,r=this.atomOffset,o=this.structure._ap,a=r+n;if(e&&e.atomOnlyTest){var s=e.atomOnlyTest;for(i=r;i0)return this.entity.isPolymer();var t=this.residueType.moleculeType;return t===Up||t===jp||t===$p},isHetero:function(){return 1===this.residueType.hetero},isWater:function(){return this.residueType.moleculeType===zp},isIon:function(){return this.residueType.moleculeType===Bp},isSaccharide:function(){return this.residueType.moleculeType===Vp},getAtomType:function(t){return this.atomMap.get(this.atomStore.atomTypeId[t])},getResname1:function(){return hm[this.resname.toUpperCase()]||"X"},getBackboneType:function(t){switch(t){case-1:return this.residueType.backboneStartType;case 1:return this.residueType.backboneEndType;default:return this.residueType.backboneType}},getAtomIndexByName:function(t){var e=this.residueType.getAtomIndexByName(t);return void 0!==e&&(e+=this.atomOffset),e},getAtomByName:function(t){return this.residueType.getAtomByName(t)},hasAtomWithName:function(t){return this.residueType.hasAtomWithName(t)},getAtomnameList:function(){console.warn("getAtomnameList - might be expensive");for(var t=this.atomCount,e=this.atomOffset,i=new Array(t),n=0;n=e){if(void 0===t&&(t=this.structure.getResidueProxy()),t.index=i,t.connectedTo(this))return t}else if(i===e-1){void 0===t&&(t=this.structure.getResidueProxy());var n=this.chainStore.residueCount[this.chainIndex];if(t.index=e+n-1,t.connectedTo(this))return t}},getBonds:function(){return this.residueType.getBonds(this)},getRings:function(){return this.residueType.getRings()},qualifiedName:function(t){var e="";return this.resname&&!t&&(e+="["+this.resname+"]"),void 0!==this.resno&&(e+=this.resno),this.inscode&&(e+="^"+this.inscode),this.chain&&(e+=":"+this.chainname),e+="/"+this.modelIndex},clone:function(){return new this.constructor(this.structure,this.index)},toObject:function(){return{index:this.index,chainIndex:this.chainIndex,atomOffset:this.atomOffset,atomCount:this.atomCount,resno:this.resno,resname:this.resname,sstruc:this.sstruc}}},Qo.prototype={constructor:Qo,type:"Polymer",structure:void 0,residueStore:void 0,atomStore:void 0,residueIndexStart:void 0,residueIndexEnd:void 0,residueCount:void 0,get chainIndex(){return this.residueStore.chainIndex[this.residueIndexStart]},get modelIndex(){return this.chainStore.modelIndex[this.chainIndex]},get chainname(){return this.chainStore.getChainname(this.chainIndex)},isProtein:function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isProtein()},isCg:function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isCg()},isNucleic:function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isNucleic()},getMoleculeType:function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.moleculeType},getBackboneType:function(t){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.getBackboneType(t)},getAtomIndexByType:function(t,e){this.isCyclic?t===-1?t=this.residueCount-1:t===this.residueCount&&(t=0):(t!==-1||this.isPrevConnected||(t+=1),t!==this.residueCount||this.isNextNextConnected||(t-=1));var i=this.__residueProxy;i.index=this.residueIndexStart+t;var n;switch(e){case"trace":n=i.traceAtomIndex;break;case"direction1":n=i.direction1AtomIndex;break;case"direction2":n=i.direction2AtomIndex;break;default:var r=i.getAtomByName(e);n=r?r.index:void 0}return n},eachAtom:function(t,e){this.eachResidue(function(i){i.eachAtom(t,e)},e)},eachAtomN:function(t,e,i){var n,r=this.residueCount,o=new Array(t);for(n=0;n=n&&i=t&&e.apply(this,a)}})}},eachDirectionAtomsN:function(t,e){var i=2*t,n=this.atomOffset,r=this.atomCount,o=n+r;if(!(r=n&&i=n&&r=t&&e.apply(this,a)}},c,u)}},eachResidue:function(t){for(var e=this.structure.getResidueProxy(),i=this.residueCount,n=this.residueIndexStart,r=0;r1&&t(new Qo(o,i,u.index)),i=n)):(m!==Gp&&u.index-i>1&&t(new Qo(o,i,u.index)),i=n)}n-i>1&&this.structure.getResidueProxy(i).backboneStartType&&t(new Qo(o,i,n))},qualifiedName:function(){var t=":"+this.chainname+"/"+this.modelIndex;return t},clone:function(){return new this.constructor(this.structure,this.index)},toObject:function(){return{index:this.index,residueOffset:this.residueOffset,residueCount:this.residueCount,chainname:this.chainname}}},ta.prototype={constructor:ta,type:"ModelProxy",structure:void 0,modelStore:void 0,index:void 0,get chainOffset(){return this.modelStore.chainOffset[this.index]},set chainOffset(t){this.modelStore.chainOffset[this.index]=t},get chainCount(){return this.modelStore.chainCount[this.index]},set chainCount(t){this.modelStore.chainCount[this.index]=t},get residueOffset(){return this.chainStore.residueOffset[this.chainOffset]},get atomOffset(){return this.residueStore.atomOffset[this.residueOffset]},get chainEnd(){return this.chainOffset+this.chainCount-1},get residueEnd(){return this.chainStore.residueOffset[this.chainEnd]+this.chainStore.residueCount[this.chainEnd]-1},get atomEnd(){return this.residueStore.atomOffset[this.residueEnd]+this.residueStore.atomCount[this.residueEnd]-1},get residueCount(){return 0===this.chainCount?0:this.residueEnd-this.residueOffset+1},get atomCount(){return 0===this.residueCount?0:this.atomEnd-this.atomOffset+1},eachAtom:function(t,e){this.eachChain(function(i){i.eachAtom(t,e)},e)},eachResidue:function(t,e){this.eachChain(function(i){i.eachResidue(t,e)},e)},eachPolymer:function(t,e){if(e&&e.chainOnlyTest){var i=e.chainOnlyTest;this.eachChain(function(n){i(n)&&n.eachPolymer(t,e)})}else this.eachChain(function(i){i.eachPolymer(t,e)})},eachChain:function(t,e){var i,n=this.chainCount,r=this.chainOffset,o=this.structure._cp,a=r+n;if(e&&e.test){var s=e.chainOnlyTest;if(s)for(i=r;i1?(R=i.atomRadius(A),O=R*b/(.5*L),w.calculateShiftDir(B),y?(D=2*x*R,B.multiplyScalar(D),B.negate(),z.subVectors(M,A).multiplyScalar(Math.max(.1,D/1.88)),A.positionToArray(o,E),M.positionToArray(a,E),L>=2&&(F.addVectors(A,B).add(z).toArray(o,E+3),F.addVectors(M,B).sub(z).toArray(a,E+3),L>=3&&(F.subVectors(A,B).add(z).toArray(o,E+6),F.subVectors(M,B).sub(z).toArray(a,E+6)))):(D=(x-b)*R,B.multiplyScalar(D),2===L?(F.addVectors(A,B).toArray(o,E),F.subVectors(A,B).toArray(o,E+3),F.addVectors(M,B).toArray(a,E),F.subVectors(M,B).toArray(a,E+3)):3===L?(A.positionToArray(o,E),F.addVectors(A,B).toArray(o,E+3),F.subVectors(A,B).toArray(o,E+6),M.positionToArray(a,E),F.addVectors(M,B).toArray(a,E+3),F.subVectors(M,B).toArray(a,E+6)):(A.positionToArray(o,E),M.positionToArray(a,E)))):(A.positionToArray(o,E),M.positionToArray(a,E))),s&&(n.bondColorToArray(w,1,s,E),n.bondColorToArray(w,0,c,E),v&&L>1))for(T=1;T1))for(T=1;T1))for(O=l[k]*b/(y?1:.5*L),T=y?1:0;T1))for(O=f[k]*b/(y?1:.5*L),T=y?1:0;Ta&&(a=e),i>s&&(s=i),u>c&&(c=u)},e),i.min.set(n,r,o),i.max.set(a,s,c),t.Debug&&nv.timeEnd("getBoundingBox"),i},getPrincipalAxes:function(e){t.Debug&&nv.time("getPrincipalAxes");var i=0,n=new Zr(3,this.atomCount),r=n.data;return this.eachAtom(function(t){r[i+0]=t.x,r[i+1]=t.y,r[i+2]=t.z,i+=3},e),t.Debug&&nv.timeEnd("getPrincipalAxes"),uo(n)},atomCenter:function(t){return t?this.getBoundingBox(t).center():this.center.clone()},getSequence:function(t){var e=[],i=this.getResidueProxy();return this.eachAtom(function(t){i.index=t.residueIndex,t.index===i.traceAtomIndex&&e.push(i.getResname1())},t),e},getAtomIndices:function(t){var e;if(t&&t.string)e=[],this.eachAtom(function(t){e.push(t.index)},t);else{var i={what:{index:!0}};e=this.getAtomData(i).index}return e},getChainnameCount:function(t){var e=new Set;return this.eachChain(function(t){t.residueCount&&e.add(t.chainname)},t),e.size},updatePosition:function(t){var e=0;this.eachAtom(function(i){i.positionFromArray(t,e),e+=3})},refreshPosition:function(){this.getBoundingBox(void 0,this.boundingBox),this.boundingBox.center(this.center),this.spatialHash=new bo(this.atomStore,this.boundingBox)},dispose:function(){this.frames&&(this.frames.length=0),this.boxes&&(this.boxes.length=0),this.bondStore.dispose(),this.backboneBondStore.dispose(),this.rungBondStore.dispose(),this.atomStore.dispose(),this.residueStore.dispose(),this.chainStore.dispose(),this.modelStore.dispose(),delete this.bondStore,delete this.atomStore,delete this.residueStore,delete this.chainStore,delete this.modelStore,delete this.frames,delete this.boxes,delete this.cif,delete this.bondSet,delete this.atomSet}},ia.prototype={constructor:ia,type:"Surface",set:function(t,e,i,n,r){this.position=t,this.index=e,this.normal=i,this.color=n,this.atomindex=r,this.size=t.length/3},fromGeometry:function(e){t.Debug&&nv.time("GeometrySurface.fromGeometry");var i;e instanceof ae?(e.computeVertexNormals(!0),i=(new ue).fromGeometry(e)):i=e instanceof ue?e:e[0],i.boundingBox||i.computeBoundingBox(),this.center.copy(i.boundingBox.center()),this.boundingBox.copy(i.boundingBox);var n,r,o,a;if(i instanceof ue){var s=i.attributes,c=!!s.normal&&s.normal.array;(!c||0===c[0]&&0===c[1]&&0===c[2])&&i.computeVertexNormals(),n=s.position.array,o=s.index?s.index.array:null,a=s.normal.array}this.set(n,o,a,r,void 0),t.Debug&&nv.timeEnd("GeometrySurface.setGeometry")},getPosition:function(){return this.position},getColor:function(t){var e,i,n,r=t||{},o=this.size;if("volume"===r.scheme){var a=new N,s=this.position;for(n=av.getScheme(r),i=new Float32Array(3*o),e=0;e65535?Uint32Array:Uint16Array;return new g(r)}return this.index},getAtomindex:function(){return this.atomindex},dispose:function(){}},na.prototype.constructor=na,ra.prototype.constructor=ra,sa.__deps=[oa,aa],ca.__deps=[ua],ua.__deps=[Br,zr,Ur,kr],la.__deps=[wn,Hr,Wr,$r,Vr,Xr,qr,Br,Yr,ho,fo,mo,po,go],da.__deps=[ca,ua,sa,Dr,Nr,vo,yo],ov.add("surf",function(t,e){var i=t.data.args,n=t.data.params;if(i&&(self.volsurf=new da(i[0],i[1],i[2],i[3],i[4])),n){var r=self.volsurf.getSurface(n.isolevel,n.smooth,n.box,n.matrix),o=[r.position.buffer,r.index.buffer];r.normal&&o.push(r.normal.buffer),r.atomindex&&o.push(r.atomindex.buffer),e({sd:r,p:n},o)}},[da]),fa.prototype={constructor:fa,type:"Volume",setData:function(t,e,i,n,r){this.nx=e||1,this.ny=i||1,this.nz=n||1,this.data=t||new Float32Array(1),this.__data=this.data,this.setDataAtomindex(r),delete this.mc,delete this.__isolevel,delete this.__smooth,delete this.__minValue,delete this.__maxValue,delete this.__dataPositionBuffer,delete this.__dataPosition,delete this.__dataBuffer,delete this.__dataMin,delete this.__dataMax,delete this.__dataMean,delete this.__dataRms,this.worker&&this.worker.terminate()},setMatrix:function(t){this.matrix.copy(t);var e=this.boundingBox,i=this.center,n=this.nx-1,r=this.ny-1,o=this.nz-1;e.makeEmpty(),e.expandByPoint(i.set(n,r,o)),e.expandByPoint(i.set(n,r,0)),e.expandByPoint(i.set(n,0,o)),e.expandByPoint(i.set(n,0,0)),e.expandByPoint(i.set(0,r,o)),e.expandByPoint(i.set(0,0,o)),e.expandByPoint(i.set(0,r,0)),e.expandByPoint(i.set(0,0,0)),e.applyMatrix4(this.matrix),e.center(this.center);var a=this.matrix.elements,s=new N(a[0],a[1],a[2]),c=new N(a[4],a[5],a[6]),u=new N(a[8],a[9],a[10]),h=new N,l=this.normalMatrix.elements;h.crossVectors(c,u),l[0]=h.x,l[1]=h.y,l[2]=h.z,h.crossVectors(u,s),l[3]=h.x,l[4]=h.y,l[5]=h.z,h.crossVectors(s,c),l[6]=h.x,l[7]=h.y,l[8]=h.z,this.inverseMatrix.getInverse(this.matrix)},setDataAtomindex:function(t){this.dataAtomindex=t,this.__dataAtomindex=this.dataAtomindex,delete this.__dataAtomindexBuffer},getBox:function(t,e,i){return i||(i=new Et),i.set(t,t),i.expandByScalar(e),i.applyMatrix4(this.inverseMatrix),i.min.round(),i.max.round(),i},__getBox:function(t,e){if(t&&e){this.__box||(this.__box=new Et);var i=this.getBox(t,e,this.__box);return[i.min.toArray(),i.max.toArray()]}},makeSurface:function(t,e,i){var n=new ia("","",t);return n.info.isolevel=e,n.info.smooth=i,n},getSurface:function(t,e,i,n){t=isNaN(t)?this.getValueForSigma(2):t,e=e||0,void 0===this.volsurf&&(this.volsurf=new da(this.__data,this.nx,this.ny,this.nz,this.__dataAtomindex));var r=this.__getBox(i,n),o=this.volsurf.getSurface(t,e,r,this.matrix.elements);return this.makeSurface(o,t,e)},getSurfaceWorker:function(t,e,i,n,r){if(t=isNaN(t)?this.getValueForSigma(2):t,e=e||0,window.Worker){void 0===this.workerPool&&(this.workerPool=new ra("surf",2));var o={},a=this.workerPool.getNextWorker();0===a.postCount&&(o.args=[this.__data,this.nx,this.ny,this.nz,this.__dataAtomindex]),o.params={isolevel:t,smooth:e,box:this.__getBox(i,n),matrix:this.matrix.elements},a.post(o,void 0,function(t){var e=t.data.sd,i=t.data.p;r(this.makeSurface(e,i.isolevel,i.smooth))}.bind(this),function(o){console.warn("Volume.getSurfaceWorker error - trying without worker",o);var a=this.getSurface(t,e,i,n);r(a)}.bind(this))}else{var s=this.getSurface(t,e,i,n);r(s)}},getValueForSigma:function(t){return t=void 0!==t?t:2,this.getDataMean()+t*this.getDataRms()},getSigmaForValue:function(t){return t=void 0!==t?t:0,(t-this.getDataMean())/this.getDataRms()},filterData:function(t,e,i){isNaN(t)&&this.header&&(t=this.header.DMEAN+2*this.header.ARMS),t=void 0===t||isNaN(t)?-(1/0):t,e=void 0!==e?e:1/0,i=i||!1,this.dataPosition||this.makeDataPosition();var n=this.__dataPosition,r=this.__data;if(t!==this.__minValue||e!=this.__maxValue||i!==this.__outside){if(t===-(1/0)&&e===1/0)this.dataPosition=n,this.data=r;else{var o=r.length;this.__dataBuffer||(this.__dataPositionBuffer=new ArrayBuffer(3*o*4),this.__dataBuffer=new ArrayBuffer(4*o));for(var a=new Float32Array(this.__dataPositionBuffer),s=new Float32Array(this.__dataBuffer),c=0,u=0;u=t&&l<=e||i&&(le)){var d=3*c;a[d+0]=n[h+0],a[d+1]=n[h+1],a[d+2]=n[h+2],s[c]=l,c+=1}}this.dataPosition=new Float32Array(this.__dataPositionBuffer,0,3*c),this.data=new Float32Array(this.__dataBuffer,0,c)}this.__minValue=t,this.__maxValue=e,this.__outside=i}},makeDataPosition:function(){for(var t=this.nz,e=this.ny,i=this.nx,n=new Float32Array(i*e*t*3),r=0,o=0;o.9*e[3*n+n])if(o>0)for(r=0;r<3;++r)t[i+r]-=e[3*n+r];else for(r=0;r<3;++r)t[i+r]+=e[3*n+r];return t}},superpose:function(t){var e,i,n=3*this.indices.length,r=this.coords1,o=this.coords2;for(e=0;e0&&this.params.centerPbc){var r=[e[0],e[4],e[8]],o=this.getCircularMean(this.backboneIndices,i,r);this.centerPbc(i,o,r)}this.params.removePbc&&this.removePbc(i,e)}this.indices.length>0&&this.params.superpose&&this.superpose(i),this.frameCache[t]=i,this.boxCache[t]=e,this.frameCacheSize+=1},setNumframes:function(t){t!==this.numframes&&(this.numframes=t,this.signals.gotNumframes.dispatch(t))},dispose:function(){this.frameCache=[],this._disposed=!0,this.player&&this.player.stop()},setPlayer:function(t){this.player=t,this.signals.playerChanged.dispatch(t)},getPath:function(t,e){nv.error("Trajectory.getPath not implemented",t,e)}},hv.add("shader/Mesh.vert","#define STANDARD\nuniform float nearClip;\nuniform vec3 clipCenter;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\nattribute vec3 pickingColor;\nvarying vec3 vPickingColor;\n#elif defined( NOLIGHT )\nvarying vec3 vColor;\n#else\n#include color_pars_vertex\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#endif\n#include common\nvoid main(){\n#if defined( PICKING )\nvPickingColor = pickingColor;\n#elif defined( NOLIGHT )\nvColor = color;\n#else\n#include color_vertex\n#include beginnormal_vertex\n#include defaultnormal_vertex\n#ifndef FLAT_SHADED\nvNormal = normalize( transformedNormal );\n#endif\n#endif\n#include begin_vertex\n#include project_vertex\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvViewPosition = -mvPosition.xyz;\n#endif\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n}"),hv.add("shader/Mesh.frag","#define STANDARD\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float nearClip;\nuniform float clipRadius;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\nuniform float objectId;\nvarying vec3 vPickingColor;\n#elif defined( NOLIGHT )\nvarying vec3 vColor;\n#else\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#include bsdfs\n#include lights_pars\n#include lights_physical_pars_fragment\n#endif\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\n#if defined( PICKING )\ngl_FragColor = vec4( vPickingColor, objectId );\n#elif defined( NOLIGHT )\ngl_FragColor = vec4( vColor, opacity );\n#else\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\n#include normal_flip\n#include normal_fragment\n#include dull_interior_fragment\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#include opaque_back_fragment\n#endif\n}"),ya.prototype={constructor:ya,parameters:{opaqueBack:{updateShader:!0},dullInterior:{updateShader:!0},side:{updateShader:!0,property:!0},opacity:{uniform:!0},clipNear:{updateShader:!0,property:!0},clipRadius:{updateShader:!0,property:!0,uniform:!0},clipCenter:{uniform:!0},flatShaded:{updateShader:!0},background:{updateShader:!0},linewidth:{property:!0},wireframe:{updateVisibility:!0},roughness:{uniform:!0},metalness:{uniform:!0},diffuse:{uniform:!0}},get transparent(){return this.opacity<1||this.forceTransparent},makeMaterial:function(){var t=va(this.side);this.material=new Pt({uniforms:this.uniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:this.transparent,depthWrite:!0,lights:!0,fog:!0,side:t,linewidth:this.linewidth}),this.material.vertexColors=uh,this.material.extensions.derivatives=this.flatShaded,this.material.extensions.fragDepth=this.impostor,this.material.clipNear=this.clipNear,this.wireframeMaterial=new Pt({uniforms:this.uniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:this.transparent,depthWrite:!0,lights:!1,fog:!0,side:t,linewidth:this.linewidth}),this.wireframeMaterial.vertexColors=uh,this.wireframeMaterial.clipNear=this.clipNear,this.pickingMaterial=new Pt({uniforms:this.pickingUniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:!1,depthWrite:!0,lights:!1,fog:!1,side:t,linewidth:this.linewidth}),this.pickingMaterial.vertexColors=uh,this.pickingMaterial.extensions.fragDepth=this.impostor,this.pickingMaterial.clipNear=this.clipNear,this.updateShader()},makeWireframeGeometry:function(){this.makeWireframeIndex();var t=this.geometry,e=this.wireframeIndex,i=new ue;i.attributes=t.attributes,e&&(i.setIndex(new Kt(e,1).setDynamic(this.dynamic)),i.setDrawRange(0,this.wireframeIndexCount)),this.wireframeGeometry=i},makeWireframeIndex:function(){function t(t,i){if(t>i){var n=t; -t=i,i=n}var r=e[t];return void 0===r?(e[t]=[i],!0):!r.includes(i)&&(r.push(i),!0)}var e=[];return function(){var i=this.geometry.index;if(this.wireframe){if(i){var n=i.array,r=n.length;this.geometry.drawRange.count!==1/0&&(r=this.geometry.drawRange.count);var o;if(this.wireframeIndex&&this.wireframeIndex.length>2*r)o=this.wireframeIndex;else{var a=this.geometry.attributes.position.count,s=a>65535?Uint32Array:Uint16Array;o=new s(2*r)}var c=0;e.length=0;for(var u=0;uthis.wireframeGeometry.index.array.length)this.wireframeGeometry.setIndex(new Kt(this.wireframeIndex,1).setDynamic(this.dynamic));else{var t=this.wireframeGeometry.getIndex();t.set(this.wireframeIndex),t.needsUpdate=this.wireframeIndexCount>0,t.updateRange.count=this.wireframeIndexCount}this.wireframeGeometry.setDrawRange(0,this.wireframeIndexCount)},getRenderOrder:function(){var t=0;return"text"===this.type?t=1:this.transparent&&(t="surface"===this.type?3:2),t},getMesh:function(){var t;return this.material||this.makeMaterial(),this.line?t=new $e(this.geometry,this.material):this.point?(t=new Ge(this.geometry,this.material),this.sortParticles&&(t.sortParticles=!0)):t=new Se(this.geometry,this.material),t.frustumCulled=!1,t.renderOrder=this.getRenderOrder(),t},getWireframeMesh:function(){var t;return this.material||this.makeMaterial(),this.wireframeGeometry||this.makeWireframeGeometry(),t=new $e(this.wireframeGeometry,this.wireframeMaterial),t.frustumCulled=!1,t.renderOrder=this.getRenderOrder(),t},getPickingMesh:function(){var t;return this.material||this.makeMaterial(),t=new Se(this.geometry,this.pickingMaterial),t.frustumCulled=!1,t.renderOrder=this.getRenderOrder(),t},getShader:function(t,e){return pr(t,this.getDefines(e))},getVertexShader:function(t){return this.getShader(this.vertexShader,t)},getFragmentShader:function(t){return this.getShader(this.fragmentShader,t)},getDefines:function(t){var e={};return this.clipNear&&(e.NEAR_CLIP=1),this.clipRadius&&(e.RADIUS_CLIP=1),"picking"===t?e.PICKING=1:(("background"===t||this.background)&&(e.NOLIGHT=1),this.flatShaded&&(e.FLAT_SHADED=1),this.opaqueBack&&(e.OPAQUE_BACK=1),this.dullInterior&&(e.DULL_INTERIOR=1)),e},getParameters:function(){var t={};for(var e in this.parameters)t[e]=this[e];return t},addUniforms:function(t){this.uniforms=pd.merge([this.uniforms,t]),this.pickingUniforms=pd.merge([this.pickingUniforms,t])},addAttributes:function(t){var e={f:1,v2:2,v3:3,c:3};for(var i in t){var n,r=t[i];r.value?(this.attributeSize*e[r.type]!==r.value.length&&nv.error("attribute value has wrong length",i),n=r.value):n=new Float32Array(this.attributeSize*e[r.type]),this.geometry.addAttribute(i,new Kt(n,e[r.type]).setDynamic(this.dynamic))}},updateRenderOrder:function(){function t(t){t.renderOrder=e}var e=this.getRenderOrder();this.group.children.forEach(t),this.pickingGroup&&this.pickingGroup.children.forEach(t)},updateShader:function(){var t=this.material,e=this.wireframeMaterial,i=this.pickingMaterial;t.vertexShader=this.getVertexShader(),t.fragmentShader=this.getFragmentShader(),t.needsUpdate=!0,e.vertexShader=this.getShader("Line.vert"),e.fragmentShader=this.getShader("Line.frag"),e.needsUpdate=!0,i.vertexShader=this.getVertexShader("picking"),i.fragmentShader=this.getFragmentShader("picking"),i.needsUpdate=!0},setParameters:function(t){if(t){var e=t,i=this.parameters,n={},r={},o=!1,a=!1;for(var s in e)void 0!==e[s]&&void 0!==i[s]&&(this[s]=e[s],i[s].property&&(i[s].property!==!0?n[i[s].property]=e[s]:n[s]=e[s]),i[s].uniform&&(i[s].uniform!==!0?r[i[s].uniform]=e[s]:r[s]=e[s]),i[s].updateShader&&(o=!0),i[s].updateVisibility&&(a=!0),this.dynamic&&"wireframe"===s&&e[s]===!0&&this.updateWireframeIndex(),"flatShaded"===s&&(this.material.extensions.derivatives=this.flatShaded),"forceTransparent"===s&&(n.transparent=this.transparent));this.setProperties(n),this.setUniforms(r),o&&this.updateShader(),a&&this.setVisibility(this.visible)}},setAttributes:function(t){var e=this.geometry,i=e.attributes;for(var n in t){var r=t[n],o=r.length;if("index"===n){var a=e.getIndex();e.setDrawRange(0,1/0),o>a.array.length?e.setIndex(new Kt(r,1).setDynamic(this.dynamic)):(a.set(r),a.needsUpdate=o>0,a.updateRange.count=o,e.setDrawRange(0,o)),this.indexVersion++,this.wireframe&&this.updateWireframeIndex()}else{var s=i[n];o>s.array.length?e.addAttribute(n,new Kt(r,s.itemSize).setDynamic(this.dynamic)):(i[n].set(r),i[n].needsUpdate=o>0,i[n].updateRange.count=o)}}},setUniforms:function(t){if(t){var e=this.material.uniforms,i=this.wireframeMaterial.uniforms,n=this.pickingMaterial.uniforms;for(var r in t)"opacity"===r&&this.setProperties({transparent:this.transparent}),void 0!==e[r]&&(e[r].value.isVector3?e[r].value.copy(t[r]):e[r].value.set?e[r].value.set(t[r]):e[r].value=t[r]),void 0!==i[r]&&(i[r].value.isVector3?i[r].value.copy(t[r]):i[r].value.set?i[r].value.set(t[r]):i[r].value=t[r]),void 0!==n[r]&&(n[r].value.isVector3?n[r].value.copy(t[r]):n[r].value.set?n[r].value.set(t[r]):n[r].value=t[r])}},setProperties:function(t){if(t){var e=this.material,i=this.wireframeMaterial,n=this.pickingMaterial;for(var r in t){var o=t[r];"transparent"===r?this.updateRenderOrder():"side"===r&&(o=va(o)),void 0!==e[r]&&(e[r]=o),void 0!==i[r]&&(i[r]=o),void 0!==n[r]&&(n[r]=o)}e.needsUpdate=!0,i.needsUpdate=!0,n.needsUpdate=!0}},setVisibility:function(t){this.visible=t,this.wireframe?(this.group.visible=!1,this.wireframeGroup.visible=t,this.pickable&&(this.pickingGroup.visible=!1)):(this.group.visible=t,this.wireframeGroup.visible=!1,this.pickable&&(this.pickingGroup.visible=t))},dispose:function(){this.material&&this.material.dispose(),this.wireframeMaterial&&this.wireframeMaterial.dispose(),this.pickingMaterial&&this.pickingMaterial.dispose(),this.geometry.dispose(),this.wireframeGeometry&&this.wireframeGeometry.dispose()}},ba.prototype=Object.assign(Object.create(ya.prototype),{constructor:ba}),Sa.prototype=Object.assign(Object.create(ba.prototype),{constructor:Sa,applyPositionTransform:function(){},setAttributes:function(){var t=new O,e=new Lt;return function(i){var n,r,o,a,s,c,u,h,l,d,f,p=this.geometry.attributes;i.position&&(n=i.position,a=this.geoPosition,h=this.meshPosition,c=this.transformedGeoPosition,p.position.needsUpdate=!0),i.color&&(r=i.color,l=this.meshColor,p.color.needsUpdate=!0),i.pickingColor&&(o=i.pickingColor,d=this.meshPickingColor,p.pickingColor.needsUpdate=!0);var m=!(!this.updateNormals||!n),g=!(!this.initNormals||!n);(m||g)&&(s=this.geoNormal,f=this.meshNormal,u=this.transformedGeoNormal,p.normal.needsUpdate=!0);for(var v=this.positionCount,y=this.geoPositionCount,b=0;b 0.0 ){\ncameraPos = rayDirection * posT + rayOrigin;\ninterior = true;\nflag2 = true;\nreturn false;\n}else{\ncameraNormal = normalize( cameraPos - cameraSpherePos );\n}\n#else\nif( calcDepth( cameraPos ) <= 0.0 ){\ncameraPos = rayDirection * posT + rayOrigin;\ninterior = true;\nreturn false;\n}else{\ncameraNormal = normalize( cameraPos - cameraSpherePos );\n}\n#endif\nreturn true;\n}\nreturn false;\n}\nvoid main(void){\nbool flag = Impostor( cameraPos, cameraNormal );\n#ifdef NEAR_CLIP\nif( calcClip( cameraPos ) > 0.0 )\ndiscard;\n#endif\ngl_FragDepthEXT = calcDepth( cameraPos );\nif( !flag ){\n#ifdef NEAR_CLIP\nif( flag2 ){\ngl_FragDepthEXT = max( 0.0, calcDepth( vec3( - ( nearClip - 0.5 ) ) ) + ( 0.0000001 / vRadius ) );\n}else if( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n#else\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n#endif\n}\nif (gl_FragDepthEXT < 0.0)\ndiscard;\nif (gl_FragDepthEXT > 1.0)\ndiscard;\n#ifdef PICKING\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\nvec3 vNormal = cameraNormal;\nvec3 vViewPosition = -cameraPos;\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\n#include normal_flip\n#include normal_fragment\nif( interior ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}"),Ma.prototype=Object.assign(Object.create(ya.prototype),{constructor:Ma,setAttributes:function(t){var e,i,n,r,o,a,s,c=this.count,u=this.mappingSize,h=this.geometry.attributes;for(var l in t){i=t[l],e=h[l],n=e.itemSize,r=e.array;for(var d=0;d radius2)\ndiscard;\n#ifdef CAP\nnew_point = front_point;\n_normal = axis;\n#else\nnew_point = ray_target + ( (-a1 - sqrt(d)) / a2 ) * ray_direction;\ndNV = dot(-axis, ray_direction);\nnear = dot(axis, end_cyl) / dNV;\nnew_point2 = ray_direction * near + ray_origin;\nif (dot(new_point2 - end_cyl, new_point2-base) < radius2)\ndiscard;\ninterior = true;\n#endif\n}\nif( end_cap_test > 0.0 )\n{\nfloat dNV = dot(axis, ray_direction);\nif (dNV < 0.0)\ndiscard;\nfloat near = dot(axis, end_cyl) / dNV;\nvec3 end_point = ray_direction * near + ray_origin;\nif( dot(end_point - end_cyl, end_point-base) > radius2 )\ndiscard;\n#ifdef CAP\nnew_point = end_point;\n_normal = axis;\n#else\nnew_point = ray_target + ( (-a1 - sqrt(d)) / a2 ) * ray_direction;\ndNV = dot(-axis, ray_direction);\nnear = dot(-axis, (base)) / dNV;\nnew_point2 = ray_direction * near + ray_origin;\nif (dot(new_point2 - base, new_point2-base) < radius2)\ndiscard;\ninterior = true;\n#endif\n}\ngl_FragDepthEXT = calcDepth( new_point );\n#ifdef NEAR_CLIP\nif( calcClip( new_point ) > 0.0 ){\ndist = (-a1 - sqrt(d)) / a2;\nnew_point = ray_target + dist * ray_direction;\nif( calcClip( new_point ) > 0.0 )\ndiscard;\ninterior = true;\ngl_FragDepthEXT = calcDepth( new_point );\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = max( 0.0, calcDepth( vec3( - ( nearClip - 0.5 ) ) ) + ( 0.0000001 / vRadius ) );\n}\n}else if( gl_FragDepthEXT <= 0.0 ){\ndist = (-a1 - sqrt(d)) / a2;\nnew_point = ray_target + dist * ray_direction;\ninterior = true;\ngl_FragDepthEXT = calcDepth( new_point );\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n}\n#else\nif( gl_FragDepthEXT <= 0.0 ){\ndist = (-a1 - sqrt(d)) / a2;\nnew_point = ray_target + dist * ray_direction;\ninterior = true;\ngl_FragDepthEXT = calcDepth( new_point );\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n}\n#endif\nif (gl_FragDepthEXT < 0.0)\ndiscard;\nif (gl_FragDepthEXT > 1.0)\ndiscard;\n#ifdef PICKING\nif( distSq3( new_point, end_cyl ) < distSq3( new_point, base ) ){\nif( b < 0.0 ){\ngl_FragColor = vec4( vPickingColor, objectId );\n}else{\ngl_FragColor = vec4( vPickingColor2, objectId );\n}\n}else{\nif( b > 0.0 ){\ngl_FragColor = vec4( vPickingColor, objectId );\n}else{\ngl_FragColor = vec4( vPickingColor2, objectId );\n}\n}\n#else\nvec3 vViewPosition = -new_point;\nvec3 vNormal = _normal;\nvec3 vColor;\nif( distSq3( new_point, end_cyl ) < distSq3( new_point, base ) ){\nif( b < 0.0 ){\nvColor = vColor1;\n}else{\nvColor = vColor2;\n}\n}else{\nif( b > 0.0 ){\nvColor = vColor1;\n}else{\nvColor = vColor2;\n}\n}\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\nvec3 normal = normalize( vNormal );\nif( interior ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}"),Ra.prototype=Object.assign(Object.create(Ma.prototype),{constructor:Ra}),Oa.prototype=Object.assign(Object.create(Ra.prototype),{constructor:Oa,parameters:Object.assign({openEnded:{updateShader:!0}},Ra.prototype.parameters),getDefines:function(t){var e=Ra.prototype.getDefines.call(this,t);return this.openEnded||(e.CAP=1),e},setAttributes:function(t){t&&t.position1&&t.position2&&(t.position=vr(t.position1,t.position2)),Ra.prototype.setAttributes.call(this,t)}}),Na.prototype=Object.assign(Object.create(Sa.prototype),{constructor:Na,applyPositionTransform:function(){var t,e=new N,i=new N,n=new N,r=new N(0,1,0);return function(o,a,s){i.fromArray(this._from,s),n.fromArray(this._to,s),o.lookAt(i,n,r),t=this._radius[a],e.set(t,t,i.distanceTo(n)),o.scale(e)}}(),setAttributes:function(t){var e={};t.position1&&t.position2&&(vr(t.position1,t.position2,this._position),this._from.set(t.position1),this._to.set(t.position2),e.position=this._position),t.color&&(e.color=t.color),t.pickingColor&&(e.pickingColor=t.pickingColor),t.radius&&this._radius.set(t.radius),Sa.prototype.setAttributes.call(this,e)}}),za.prototype.constructor=za,za.prototype.type="Shape",Ba.prototype={constructor:Ba,type:"",parameters:{lazy:{type:"boolean"},clipNear:{type:"range",step:1,max:100,min:0,buffer:!0},clipRadius:{type:"number",precision:1,max:1e3,min:0,buffer:!0},clipCenter:{type:"vector3",precision:1,buffer:!0},flatShaded:{type:"boolean",buffer:!0},opacity:{type:"range",step:.01,max:1,min:0,buffer:!0},side:{type:"select",buffer:!0,options:{front:"front",back:"back",double:"double"}},wireframe:{type:"boolean",buffer:!0},linewidth:{type:"integer",max:50,min:1,buffer:!0},colorScheme:{type:"select",update:"color",options:av.getTypes()},colorScale:{type:"select",update:"color",options:av.getScales()},colorValue:{type:"color",update:"color"},colorDomain:{type:"hidden",update:"color"},colorMode:{type:"select",update:"color",options:av.getModes()},roughness:{type:"range",step:.01,max:1,min:0,buffer:!0},metalness:{type:"range",step:.01,max:1,min:0,buffer:!0},diffuse:{type:"color",buffer:!0}},init:function(t){var e=t||{};this.clipNear=d(e.clipNear,0),this.clipRadius=d(e.clipRadius,0),this.clipCenter=d(e.clipCenter,new N),this.flatShaded=d(e.flatShaded,!1),this.side=d(e.side,"double"),this.opacity=d(e.opacity,1),this.wireframe=d(e.wireframe,!1),this.linewidth=d(e.linewidth,2),this.setColor(e.color,e),this.colorScheme=d(e.colorScheme,"uniform"),this.colorScale=d(e.colorScale,""),this.colorValue=d(e.colorValue,9474192),this.colorDomain=d(e.colorDomain,""),this.colorMode=d(e.colorMode,"hcl"),this.visible=d(e.visible,!0),this.quality=d(e.quality,void 0),this.roughness=d(e.roughness,.4),this.metalness=d(e.metalness,0),this.diffuse=d(e.diffuse,16777215),this.lazy=d(e.lazy,!1),this.lazyProps={build:!1,bufferParams:{},what:{}};var i=this.parameters;i.sphereDetail===!0&&(i.sphereDetail={type:"integer",max:3,min:0,rebuild:"impostor"}),i.radialSegments===!0&&(i.radialSegments={type:"integer",max:25,min:5,rebuild:"impostor"}),i.openEnded===!0&&(i.openEnded={type:"boolean",rebuild:"impostor",buffer:!0}),i.disableImpostor===!0&&(i.disableImpostor={type:"boolean",rebuild:!0}),"low"===e.quality?(i.sphereDetail&&(this.sphereDetail=0),i.radialSegments&&(this.radialSegments=5)):"medium"===e.quality?(i.sphereDetail&&(this.sphereDetail=1),i.radialSegments&&(this.radialSegments=10)):"high"===e.quality?(i.sphereDetail&&(this.sphereDetail=2),i.radialSegments&&(this.radialSegments=20)):(i.sphereDetail&&(this.sphereDetail=d(e.sphereDetail,1)),i.radialSegments&&(this.radialSegments=d(e.radialSegments,10))),i.openEnded&&(this.openEnded=d(e.openEnded,!0)),i.disableImpostor&&(this.disableImpostor=d(e.disableImpostor,!1))},getColorParams:function(){return{gidPool:this.gidPool,scheme:this.colorScheme,scale:this.colorScale,value:this.colorValue,domain:this.colorDomain,mode:this.colorMode}},getBufferParams:function(t){return Object.assign({clipNear:this.clipNear,clipRadius:this.clipRadius,clipCenter:this.clipCenter,flatShaded:this.flatShaded,opacity:this.opacity,side:this.side,wireframe:this.wireframe,linewidth:this.linewidth,roughness:this.roughness,metalness:this.metalness,diffuse:this.diffuse},t)},setColor:function(t,e){var i=Object.keys(av.getTypes());return i.includes(t)?e?e.colorScheme=t:this.setParameters({colorScheme:t}):void 0!==t&&(t=new Ct(t).getHex(),e?(e.colorScheme="uniform",e.colorValue=t):this.setParameters({colorScheme:"uniform",colorValue:t})),this},prepare:!1,create:function(){},update:function(){this.build()},build:function(t){return this.lazy&&!this.visible?void(this.lazyProps.build=!0):this.prepare?(this.queue.length()>0?(this.tasks.change(1-this.queue.length()),this.queue.kill()):this.tasks.increment(),void this.queue.push(t||!1)):(this.tasks.increment(),void this.make())},make:function(e,i){t.Debug&&nv.time("Representation.make "+this.type);var n=function(){e?(this.update(e),this.viewer.requestRender(),this.tasks.decrement(),i&&i()):(this.clear(),this.create(),this.manualAttach||this.disposed||(t.Debug&&nv.time("Representation.attach "+this.type),this.attach(function(){t.Debug&&nv.timeEnd("Representation.attach "+this.type),this.tasks.decrement(),i&&i()}.bind(this)))),t.Debug&&nv.timeEnd("Representation.make "+this.type)}.bind(this);this.prepare?this.prepare(n):n()},attach:function(t){this.setVisibility(this.visible),t()},setVisibility:function(t,e){if(this.visible=t,this.visible){var i=this.lazyProps;if(i.build)return i.build=!1,void this.build();(i.bufferParams||i.what)&&this.updateParameters(i.bufferParams,i.what)}return this.bufferList.forEach(function(e){e.setVisibility(t)}),e||this.viewer.requestRender(),this},setParameters:function(t,e,i){var n=t||{},r=this.parameters;e=e||{},i=i||!1;var o={};for(var a in n)void 0!==n[a]&&void 0!==r[a]&&(r[a].int&&(n[a]=parseInt(n[a])),r[a].float&&(n[a]=parseFloat(n[a])),n[a]!==this[a]&&(this[a]=n[a],r[a].buffer&&(r[a].buffer===!0?o[a]=n[a]:o[r[a].buffer]=n[a]),r[a].update&&(e[r[a].update]=!0),!r[a].rebuild||"impostor"===r[a].rebuild&&iv&&!this.disableImpostor||(i=!0)));return i?this.build():this.updateParameters(o,e),this},updateParameters:function(t,e){return this.lazy&&!this.visible?(Object.assign(this.lazyProps.bufferParams,t),void Object.assign(this.lazyProps.what,e)):(this.bufferList.forEach(function(e){e.setParameters(t)}),Object.keys(e).length&&this.update(e),void this.viewer.requestRender())},getParameters:function(){var t={lazy:this.lazy,visible:this.visible,quality:this.quality};return Object.keys(this.parameters).forEach(function(e){"button"===this.parameters.type?t[e]=this[e].bind(this):t[e]=this[e]},this),t},clear:function(){this.bufferList.forEach(function(t){this.viewer.remove(t),t.dispose()},this),this.bufferList.length=0,this.viewer.requestRender()},dispose:function(){this.disposed=!0,this.queue.kill(),this.tasks.dispose(),this.clear()}},Ua.prototype=Object.assign(Object.create(Ba.prototype),{constructor:Ua,type:"buffer",parameters:Object.assign({},Ba.prototype.parameters,{colorScheme:null,colorScale:null,colorValue:null,colorDomain:null,colorMode:null}),create:function(){this.bufferList.push.apply(this.bufferList,this.buffer)},attach:function(t){this.bufferList.forEach(function(t){this.viewer.add(t),t.setParameters(this.getBufferParams())},this),this.setVisibility(this.visible),t()}}),ja.prototype=Object.assign(Object.create(ba.prototype),{constructor:ja,type:"surface"}),$a.prototype.constructor=$a,Va.prototype=Object.assign(Object.create(Ba.prototype),{constructor:Va,type:"surface",parameters:Object.assign({isolevelType:{type:"select",options:{value:"value",sigma:"sigma"}},isolevel:{type:"number",precision:2,max:1e3,min:-1e3},smooth:{type:"integer",precision:1,max:10,min:0},background:{type:"boolean",rebuild:!0 -},opaqueBack:{type:"boolean",buffer:!0},boxSize:{type:"integer",precision:1,max:100,min:0},useWorker:{type:"boolean",rebuild:!0}},Ba.prototype.parameters),init:function(t){var e=t||{};e.colorScheme=d(e.colorScheme,"uniform"),e.colorValue=d(e.colorValue,14540253),this.isolevelType=d(e.isolevelType,"sigma"),this.isolevel=d(e.isolevel,2),this.smooth=d(e.smooth,0),this.background=d(e.background,!1),this.opaqueBack=d(e.opaqueBack,!0),this.boxSize=d(e.boxSize,0),this.useWorker=d(e.useWorker,!0),Ba.prototype.init.call(this,e)},attach:function(t){this.bufferList.forEach(function(t){this.viewer.add(t)},this),this.setVisibility(this.visible),t()},prepare:function(t){if(this.volume){var e;if(e="sigma"===this.isolevelType?this.volume.getValueForSigma(this.isolevel):this.isolevel,!this.surface||this.__isolevel!==e||this.__smooth!==this.smooth||this.__boxSize!==this.boxSize||this.boxSize>0&&!this.__boxCenter.equals(this.boxCenter)){this.__isolevel=e,this.__smooth=this.smooth,this.__boxSize=this.boxSize,this.__boxCenter.copy(this.boxCenter),this.__box.copy(this.box);var i=function(e){this.surface=e,t()}.bind(this);this.useWorker?this.volume.getSurfaceWorker(e,this.smooth,this.boxCenter,this.boxSize,i):i(this.volume.getSurface(e,this.smooth,this.boxCenter,this.boxSize))}else t()}else t()},create:function(){var t=new ja(this.surface.getPosition(),this.surface.getColor(this.getColorParams()),this.surface.getIndex(),this.surface.getNormal(),void 0,this.getBufferParams({background:this.background,opaqueBack:this.opaqueBack,dullInterior:!1})),e=new $a(t);this.bufferList.push(e)},update:function(t){if(0!==this.bufferList.length){t=t||{};var e={};t.position&&(e.position=this.surface.getPosition()),t.color&&(e.color=this.surface.getColor(this.getColorParams())),t.index&&(e.index=this.surface.getIndex()),t.normal&&(e.normal=this.surface.getNormal()),this.bufferList.forEach(function(t){t.setAttributes(e)})}},setParameters:function(t,e,i){return t&&void 0!==t.isolevelType&&this.volume&&("value"===this.isolevelType&&"sigma"===t.isolevelType?this.isolevel=this.volume.getSigmaForValue(this.isolevel):"sigma"===this.isolevelType&&"value"===t.isolevelType&&(this.isolevel=this.volume.getValueForSigma(this.isolevel)),this.isolevelType=t.isolevelType),t&&t.boxCenter&&(this.boxCenter.copy(t.boxCenter),delete t.boxCenter),Ba.prototype.setParameters.call(this,t,e,i),this.volume&&this.volume.getBox(this.boxCenter,this.boxSize,this.box),this.surface&&(void 0!==t.isolevel||void 0!==t.smooth||void 0!==t.boxSize||this.boxSize>0&&!this.__box.equals(this.box))&&this.build({position:!0,color:!0,index:!0,normal:!0}),this},dispose:function(){this.viewer.signals.orientationChanged.remove(this.setBox),Ba.prototype.dispose.call(this)}}),hv.add("shader/Point.vert","uniform float nearClip;\nuniform float clipRadius;\nuniform vec3 clipCenter;\nuniform float size;\nuniform float canvasHeight;\nuniform float pixelRatio;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#include color_pars_vertex\n#include common\nvoid main(){\n#include color_vertex\n#include begin_vertex\n#include project_vertex\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * pixelRatio * ( ( canvasHeight / 2.0 ) / -mvPosition.z );\n#else\ngl_PointSize = size * pixelRatio;\n#endif\nvViewPosition = -mvPosition.xyz;\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n#include radiusclip_vertex\n}"),hv.add("shader/Point.frag","uniform vec3 diffuse;\nuniform float opacity;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#ifdef USE_MAP\nuniform sampler2D map;\n#endif\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\nvec3 outgoingLight = vec3( 0.0 );\nvec4 diffuseColor = vec4( diffuse, 1.0 );\n#ifdef USE_MAP\ndiffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) );\n#endif\n#include color_fragment\n#include alphatest_fragment\noutgoingLight = diffuseColor.rgb;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a * opacity );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n}"),Ha.prototype=Object.assign(Object.create(ya.prototype),{constructor:Ha,parameters:Object.assign({pointSize:{uniform:"size"},sizeAttenuation:{updateShader:!0},sortParticles:{},alphaTest:{updateShader:!0},useTexture:{updateShader:!0},forceTransparent:{},edgeBleach:{uniform:!0}},ya.prototype.parameters),makeMaterial:function(){ya.prototype.makeMaterial.call(this),this.makeTexture(),this.material.uniforms.map.value=this.tex,this.material.blending=lh,this.material.needsUpdate=!0,this.wireframeMaterial.uniforms.map.value=this.tex,this.wireframeMaterial.blending=lh,this.wireframeMaterial.needsUpdate=!0,this.pickingMaterial.uniforms.map.value=this.tex,this.pickingMaterial.blending=lh,this.pickingMaterial.needsUpdate=!0},makeTexture:function(){this.tex&&this.tex.dispose(),this.tex=Ga({delta:this.edgeBleach})},getDefines:function(t){var e=ya.prototype.getDefines.call(this,t);return this.sizeAttenuation&&(e.USE_SIZEATTENUATION=1),this.useTexture&&(e.USE_MAP=1),this.alphaTest>0&&this.alphaTest<=1&&(e.ALPHATEST=this.alphaTest.toPrecision(2)),e},setUniforms:function(t){t&&void 0!==t.edgeBleach&&(this.makeTexture(),t.map=this.tex),ya.prototype.setUniforms.call(this,t)},dispose:function(){ya.prototype.dispose.call(this),this.tex&&this.tex.dispose()}}),Wa.prototype=Object.assign(Object.create(Ba.prototype),{constructor:Wa,type:"dot",parameters:Object.assign({thresholdType:{type:"select",rebuild:!0,options:{value:"value",sigma:"sigma"}},thresholdMin:{type:"number",precision:3,max:1/0,min:-(1/0),rebuild:!0},thresholdMax:{type:"number",precision:3,max:1/0,min:-(1/0),rebuild:!0},thresholdOut:{type:"boolean",rebuild:!0},dotType:{type:"select",rebuild:!0,options:{"":"",sphere:"sphere",point:"point"}},radiusType:{type:"select",options:{"":"",value:"value","abs-value":"abs-value","value-min":"value-min",deviation:"deviation",size:"size"}},radius:{type:"number",precision:3,max:10,min:.001,property:"size"},scale:{type:"number",precision:3,max:10,min:.001},sphereDetail:!0,disableImpostor:!0,pointSize:{type:"number",precision:1,max:100,min:0,buffer:!0},sizeAttenuation:{type:"boolean",buffer:!0},sortParticles:{type:"boolean",rebuild:!0},useTexture:{type:"boolean",buffer:!0},alphaTest:{type:"range",step:.001,max:1,min:0,buffer:!0},forceTransparent:{type:"boolean",buffer:!0},edgeBleach:{type:"range",step:.001,max:1,min:0,buffer:!0}},Ba.prototype.parameters,{colorScheme:{type:"select",update:"color",options:{"":"",value:"value",uniform:"uniform"}}}),defaultSize:.1,init:function(t){var e=t||{};e.colorScheme=d(e.colorScheme,"uniform"),e.colorValue=d(e.colorValue,14540253),this.thresholdType=d(e.thresholdType,"sigma"),this.thresholdMin=d(e.thresholdMin,2),this.thresholdMax=d(e.thresholdMax,1/0),this.thresholdOut=d(e.thresholdOut,!1),this.dotType=d(e.dotType,"point"),this.radius=d(e.radius,.1),this.scale=d(e.scale,1),this.pointSize=d(e.pointSize,1),this.sizeAttenuation=d(e.sizeAttenuation,!0),this.sortParticles=d(e.sortParticles,!1),this.useTexture=d(e.useTexture,!1),this.alphaTest=d(e.alphaTest,.5),this.forceTransparent=d(e.forceTransparent,!1),this.edgeBleach=d(e.edgeBleach,0),Ba.prototype.init.call(this,e)},attach:function(t){this.bufferList.forEach(function(t){this.viewer.add(t)},this),this.setVisibility(this.visible),t()},create:function(){var t,e,i,n;if(this.volume){var r,o,a=this.volume;"sigma"===this.thresholdType?(r=a.getValueForSigma(this.thresholdMin),o=a.getValueForSigma(this.thresholdMax)):(r=this.thresholdMin,o=this.thresholdMax),a.filterData(r,o,this.thresholdOut),t=a.getDataPosition(),e=a.getDataColor(this.getColorParams()),i=a.getDataSize(this.radius,this.scale),n=a.getPickingDataColor(this.getColorParams())}else{var s=this.surface;t=s.getPosition(),e=s.getColor(this.getColorParams()),i=s.getSize(this.radius,this.scale),n=s.getPickingColor(this.getColorParams())}"sphere"===this.dotType?this.dotBuffer=new Ta(t,e,i,n,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!1})):this.dotBuffer=new Ha(t,e,this.getBufferParams({pointSize:this.pointSize,sizeAttenuation:this.sizeAttenuation,sortParticles:this.sortParticles,useTexture:this.useTexture,alphaTest:this.alphaTest,forceTransparent:this.forceTransparent,edgeBleach:this.edgeBleach})),this.bufferList.push(this.dotBuffer)},update:function(t){if(0!==this.bufferList.length){t=t||{};var e={};t.color&&(this.volume?e.color=this.volume.getDataColor(this.getColorParams()):e.color=this.surface.getColor(this.getColorParams())),"sphere"===this.dotType&&(t.radius||t.scale)&&(this.volume?e.radius=this.volume.getDataSize(this.radius,this.scale):e.radius=this.surface.getSize(this.radius,this.scale)),this.dotBuffer.setAttributes(e)}},setParameters:function(t,e,i){return e=e||{},t&&void 0!==t.thresholdType&&this.volume instanceof fa&&("value"===this.thresholdType&&"sigma"===t.thresholdType?(this.thresholdMin=this.volume.getSigmaForValue(this.thresholdMin),this.thresholdMax=this.volume.getSigmaForValue(this.thresholdMax)):"sigma"===this.thresholdType&&"value"===t.thresholdType&&(this.thresholdMin=this.volume.getValueForSigma(this.thresholdMin),this.thresholdMax=this.volume.getValueForSigma(this.thresholdMax)),this.thresholdType=t.thresholdType),t&&void 0!==t.radiusType&&("radius"===t.radiusType?this.radius=this.defaultSize:this.radius=t.radiusType,e.radius=!0,"sphere"!==this.dotType||iv&&!this.disableImpostor||(i=!0)),t&&void 0!==t.radius&&(e.radius=!0,"sphere"!==this.dotType||iv&&!this.disableImpostor||(i=!0)),t&&void 0!==t.scale&&(e.scale=!0,"sphere"!==this.dotType||iv&&!this.disableImpostor||(i=!0)),Ba.prototype.setParameters.call(this,t,e,i),this}}),Xa.prototype=Object.assign(Object.create(Ba.prototype),{constructor:Xa,type:"structure",parameters:Object.assign({radiusType:{type:"select",options:Ir.types},radius:{type:"number",precision:3,max:10,min:.001},scale:{type:"number",precision:3,max:10,min:.001},assembly:null,defaultAssembly:{type:"hidden"}},Ba.prototype.parameters),defaultScale:{vdw:1,covalent:1,bfactor:.01,sstruc:1},defaultSize:1,init:function(t){var e=t||{};if(e.colorScheme=d(e.colorScheme,"element"),this.radius=d(e.radius,"vdw"),this.scale=d(e.scale,1),this.assembly=d(e.assembly,"default"),this.defaultAssembly=d(e.defaultAssembly,""),"auto"===e.quality){var i,n=this.structureView,r=this.getAssembly();i=r?r.getAtomCount(n):n.atomCount,tv&&(i*=4);var o=n.atomStore.count/n.residueStore.count<2;o&&(i*=10),i<15e3?e.quality="high":i<8e4?e.quality="medium":e.quality="low"}Ba.prototype.init.call(this,e)},getAssembly:function(){var t="default"===this.assembly?this.defaultAssembly:this.assembly;return this.structure.biomolDict[t]},create:function(){if(0!==this.structureView.atomCount){var t=this.getAssembly();if(t)t.partList.forEach(function(t,e){var i=t.getView(this.structureView);if(0!==i.atomCount){var n=this.createData(i,e);n&&(n.sview=i,n.instanceList=t.getInstanceList(),this.dataList.push(n))}},this);else{var e=this.createData(this.structureView,0);e&&(e.sview=this.structureView,this.dataList.push(e))}}},createData:function(){console.error("createData not implemented")},update:function(t){return this.lazy&&!this.visible?void Object.assign(this.lazyProps.what,t):void this.dataList.forEach(function(e){e.bufferList.length>0&&this.updateData(t,e)},this)},updateData:function(){console.error("updateData not implemented")},getColorParams:function(){var t=Ba.prototype.getColorParams.call(this);return t.structure=this.structure,t},getAtomParams:function(t,e){return Object.assign({what:t,colorParams:this.getColorParams(),radiusParams:{radius:this.radius,scale:this.scale}},e)},getBondParams:function(t,e){return Object.assign({what:t,colorParams:this.getColorParams(),radiusParams:{radius:this.radius,scale:this.scale}},e)},setSelection:function(t,e){return this.selection.setString(t,e),this},setParameters:function(t,e,i){return e=e||{},t&&void 0!==t.radiusType&&("size"===t.radiusType?this.radius=this.defaultSize:this.radius=t.radiusType,e.radius=!0,iv&&!this.disableImpostor||(i=!0)),t&&void 0!==t.radius&&(e.radius=!0,iv&&!this.disableImpostor||(i=!0)),t&&void 0!==t.scale&&(e.radius=!0,iv&&!this.disableImpostor||(i=!0)),t&&void 0!==t.defaultAssembly&&(i=!0),Ba.prototype.setParameters.call(this,t,e,i),this},getParameters:function(){var t=Object.assign(Ba.prototype.getParameters.call(this),{sele:this.selection?this.selection.string:void 0,defaultAssembly:this.defaultAssembly});return t},attach:function(t){var e=this.viewer,i=this.bufferList;this.dataList.forEach(function(t){t.bufferList.forEach(function(n){i.push(n),e.add(n,t.instanceList)})}),this.setVisibility(this.visible),t()},clear:function(){this.dataList.length=0,Ba.prototype.clear.call(this)},dispose:function(){this.structureView.dispose(),delete this.structure,delete this.structureView,Ba.prototype.dispose.call(this)}}),hv.add("shader/Line.vert","uniform float nearClip;\nuniform vec3 clipCenter;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#include color_pars_vertex\nvoid main(){\n#include color_vertex\n#include begin_vertex\n#include project_vertex\nvViewPosition = -mvPosition.xyz;\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n}"),hv.add("shader/Line.frag","uniform float opacity;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\ngl_FragColor = vec4( vColor, opacity );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n}"),qa.prototype=Object.assign(Object.create(ya.prototype),{constructor:qa,setAttributes:function(t){var e,i,n,r,o,a,s=this.geometry.attributes;t.from&&t.to&&(e=t.from,i=t.to,o=s.position.array,s.position.needsUpdate=!0),t.color&&t.color2&&(n=t.color,r=t.color2,a=s.color.array,s.color.needsUpdate=!0);for(var c,u,h,l,d,f,p,m,g,v,y,b,x=this.size,_=6*x,w=0;w0&&(n="( "+e.join(" ) AND ( ")+" )"),new _n(n)},getStructure:function(){return this.structure.getStructure()},eachBond:function(t,e){this.structure.eachBond(t,this.getSelection(e))},eachAtom:function(t,e){var i=this.getAtomProxy(),n=this.getAtomSet(e),r=this.atomStore.count;if(n&&n.size()=this.V[i][n]&&this.S[i][n]>=this.V[i][n]?(r="S",this.score=this.S[i][n]):this.V[i][n]>=this.H[i][n]?(r="V",this.score=this.V[i][n]):(r="H",this.score=this.H[i][n]),t.Debug&&nv.log("Alignment: SCORE",this.score),t.Debug&&nv.log("Alignment: S, V, H",this.S[i][n],this.V[i][n],this.H[i][n]);i>0&&n>0;)"S"===r?this.S[i][n]===this.S[i-1][n-1]+e(i-1,n-1)?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2=this.seq2[n-1]+this.ali2,--i,--n,r="S"):this.S[i][n]===this.V[i][n]?r="V":this.S[i][n]===this.H[i][n]?r="H":(--i,--n):"V"===r?this.V[i][n]===this.V[i-1][n]+this.gapExtensionPenalty?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i,r="V"):this.V[i][n]===this.S[i-1][n]+this.gap(0)?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i,r="S"):--i:"H"===r?this.H[i][n]===this.H[i][n-1]+this.gapExtensionPenalty?(this.ali1="-"+this.ali1,this.ali2=this.seq2[n-1]+this.ali2,--n,r="H"):this.H[i][n]===this.S[i][n-1]+this.gap(0)?(this.ali1="-"+this.ali1,this.ali2=this.seq2[n-1]+this.ali2,--n,r="S"):--n:nv.error("Alignment: no matrix");for(;i>0;)this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i;for(;n>0;)this.ali1="-"+this.ali1,this.ali2=this.seq2[n-1]+this.ali2,--n;t.Debug&&nv.timeEnd("Alignment.trace"),t.Debug&&nv.log([this.ali1,this.ali2])}},hs.prototype=Object.assign(Object.create(Ka.prototype),{constructor:hs,type:"structure",signals:Object.assign({trajectoryAdded:null,trajectoryRemoved:null,defaultAssemblyChanged:null},Ka.prototype.signals),initSelection:function(t){this.selection=new _n(t),this.structureView=new ss(this.structure,this.selection),this.selection.signals.stringChanged.add(function(){this.structureView.setSelection(this.selection),this.rebuildRepresentations(),this.rebuildTrajectories()},this)},setSelection:function(t){return this.selection.setString(t),this},setDefaultAssembly:function(t){this.defaultAssembly=t,this.reprList.forEach(function(t){t.setParameters({defaultAssembly:this.defaultAssembly})},this),this.signals.defaultAssemblyChanged.dispatch(t)},rebuildRepresentations:function(){this.reprList.forEach(function(t){t.build()})},rebuildTrajectories:function(){this.trajList.slice().forEach(function(t){t.trajectory.setStructure(this.structureView)},this)},addRepresentation:function(t,e){var i=e||{};return i.defaultAssembly=this.defaultAssembly,Ka.prototype.addRepresentation.call(this,t,this.structureView,i)},addTrajectory:function(t,e,i){var n={i:i},r=as(t,this.structureView,e);r.signals.frameChanged.add(function(){this.updateRepresentations({position:!0})},this);var o=new is(this.stage,r,n,this);return this.trajList.push(o),this.signals.trajectoryAdded.dispatch(o),o},removeTrajectory:function(t){var e=this.trajList.indexOf(t);e!==-1&&this.trajList.splice(e,1),t.dispose(),this.signals.trajectoryRemoved.dispatch(t)},dispose:function(){this.stage.gidPool.removeObject(this.structure),this.trajList.slice().forEach(function(t){t.dispose()}),this.trajList.length=0,this.structure.dispose(),Ka.prototype.dispose.call(this)},centerView:function(t,e){t=d(t,!0);var i=this.getCenter(e);if(t){var n;n=e?this.structureView.getBoundingBox(new _n(e)):this.structureView.boundingBox;var r=n.size(),o=Math.max(r.x,r.y,r.z),a=Math.min(r.x,r.y,r.z);t=Math.max(1,o+a/2)}return this.viewer.centerView(t,i),this},getCenter:function(t){return t?this.structure.atomCenter(new _n(t)):this.structure.center},superpose:function(t,e,i,n){return us(this.structureView,t.structureView,e,i,n),this.updateRepresentations({position:!0}),this},setVisibility:function(t){return Ka.prototype.setVisibility.call(this,t),this.trajList.forEach(function(e){e.setVisibility(t)}),this}}),ls.prototype=Object.assign(Object.create(Ka.prototype),{constructor:ls,type:"surface",addRepresentation:function(t,e){return Ka.prototype.addRepresentation.call(this,t,this.surface,e)},dispose:function(){"Volume"===this.surface.type&&this.stage.gidPool.addObject(this.surface),this.surface.dispose(),Ka.prototype.dispose.call(this)},centerView:function(t){var e=this.surface.center;t&&(t=this.surface.boundingBox.size().length()),this.viewer.centerView(t,e)}}),ds.prototype=Object.assign(Object.create(Ka.prototype),{constructor:ds,type:"shape",addRepresentation:function(t,e){return Ka.prototype.addRepresentation.call(this,t,this.shape,e)},centerView:function(t){t=d(t,!0);var e=this.getCenter();if(t){var i=this.shape.boundingBox,n=i.size(),r=Math.max(n.x,n.y,n.z),o=Math.min(n.x,n.y,n.z);t=Math.max(1,r+o/2)}return this.viewer.centerView(t,e),this},getCenter:function(){return this.shape.center},dispose:function(){this.shape.dispose(),Ka.prototype.dispose.call(this)}}),fs.prototype=Object.assign(Object.create(Ka.prototype),{constructor:fs,type:"script",addRepresentation:function(){},removeRepresentation:function(){},run:function(){var t=this;this.setStatus("running"),this.script.call(this.stage,function(){t.setStatus("finished")}),this.setStatus("called")},dispose:function(){this.signals.disposed.dispatch()},setVisibility:function(){},getCenter:function(){}}),ms.prototype={constructor:ms,parameters:{backgroundColor:{type:"color"},quality:{type:"select",options:{auto:"auto",low:"low",medium:"medium",high:"high"}},sampleLevel:{type:"range",step:1,max:5,min:-1},impostor:{type:"boolean"},rotateSpeed:{type:"number",precision:1,max:10,min:0},zoomSpeed:{type:"number",precision:1,max:10,min:0},panSpeed:{type:"number",precision:1,max:10,min:0},clipNear:{type:"range",step:1,max:100,min:0},clipFar:{type:"range",step:1,max:100,min:0},clipDist:{type:"integer",max:200,min:0},fogNear:{type:"range",step:1,max:100,min:0},fogFar:{type:"range",step:1,max:100,min:0},cameraType:{type:"select",options:{perspective:"perspective",orthographic:"orthographic"}},cameraFov:{type:"range",step:1,max:120,min:15},lightColor:{type:"color"},lightIntensity:{type:"number",precision:2,max:10,min:0},ambientColor:{type:"color"},ambientIntensity:{type:"number",precision:2,max:10,min:0},hoverTimeout:{type:"integer",max:1e4,min:10}},setParameters:function(t){var e=Object.assign({},t),i=this.parameters,n=this.viewer,r=n.controls,o=this.pickingControls;for(var a in e)void 0!==e[a]&&i[a]&&(i[a].int&&(e[a]=parseInt(e[a])),i[a].float&&(e[a]=parseFloat(e[a])),i[a].value=e[a]);return void 0!==e.quality&&this.setQuality(e.quality),void 0!==e.impostor&&this.setImpostor(e.impostor),void 0!==e.rotateSpeed&&(r.rotateSpeed=e.rotateSpeed),void 0!==e.zoomSpeed&&(r.zoomSpeed=e.zoomSpeed),void 0!==e.panSpeed&&(r.panSpeed=e.panSpeed),o.setParameters({hoverTimeout:e.hoverTimeout}),n.setClip(e.clipNear,e.clipFar,e.clipDist),n.setFog(void 0,e.fogNear,e.fogFar),n.setCamera(e.cameraType,e.cameraFov),n.setSampling(e.sampleLevel),n.setBackground(e.backgroundColor),n.setLight(e.lightColor,e.lightIntensity,e.ambientColor,e.ambientIntensity),this.signals.parametersChanged.dispatch(this.getParameters()),this},getParameters:function(){var t={};for(var e in this.parameters)t[e]=this.parameters[e].value;return t},defaultFileRepresentation:function(e){if("structure"===e.type){e.setSelection("/0");var i,n,r=e.structure;if(r.biomolDict.BU1){var o=r.biomolDict.BU1;i=o.getAtomCount(r),n=o.getInstanceCount(),e.setDefaultAssembly("BU1")}else i=r.getModelProxy(0).atomCount,n=1;tv&&(i*=4);var a=r.atomStore.count/r.residueStore.count<2;a&&(i*=10);var s="chainname";if(1===r.getChainnameCount("polymer and /0")&&(s="residueindex"),t.Debug&&console.log(i,n,a),n>5&&i>15e3||i>7e5){var c=Math.min(1.5,Math.max(.1,2e3/(i/n)));a&&(c=Math.min(c,.15)),e.addRepresentation("surface",{sele:"polymer",surfaceType:"sas",probeRadius:1.4,scaleFactor:c,colorScheme:s,colorScale:"RdYlBu",useWorker:!1})}else i>25e4?e.addRepresentation("backbone",{lineOnly:!0,colorScheme:s,colorScale:"RdYlBu"}):i>1e5?e.addRepresentation("backbone",{quality:"low",disableImpostor:!0,colorScheme:s,colorScale:"RdYlBu",scale:2}):i>8e4?e.addRepresentation("backbone",{colorScheme:s,colorScale:"RdYlBu",scale:2}):(e.addRepresentation("cartoon",{color:s,colorScale:"RdYlBu",scale:.7,aspectRatio:5,quality:"auto"}),i<5e4&&e.addRepresentation("base",{color:s,colorScale:"RdYlBu",quality:"auto"}),e.addRepresentation("ball+stick",{sele:"hetero and not ( water or ion )",colorScheme:"element",scale:2,aspectRatio:1.5,bondScale:.3,bondSpacing:.75,quality:"auto"}));this.centerView(),e.structure.frames.length&&e.addTrajectory()}else"surface"!==e.type&&"volume"!==e.type||(e.addRepresentation("surface"),this.centerView())},loadFile:function(t,e){var i=Object.assign({},this.defaultFileParams,e),n=new Ka(this,i);n.name=y(t).name,this.addComponent(n);var r=this.tasks;r.increment();var o=function(t){return this.removeComponent(n),n=this.addComponentFromObject(t,i),"script"===n.type&&n.run(),i.defaultRepresentation&&this.defaultFileRepresentation(n),r.decrement(),n}.bind(this),a=function(t){throw n.setStatus(t),r.decrement(),t};return rr(t,i).then(o,a)},addComponent:function(t){return t?(this.compList.push(t),void this.signals.componentAdded.dispatch(t)):void nv.warn("Stage.addComponent: no component given")},addComponentFromObject:function(t,e){var i=ps(this,t,e);return this.addComponent(i),i},removeComponent:function(t){var e=this.compList.indexOf(t);e!==-1&&this.compList.splice(e,1),t.dispose(),this.signals.componentRemoved.dispatch(t)},removeAllComponents:function(t){this.compList.slice().forEach(function(e){t&&e.type!==t||this.removeComponent(e)},this)},handleResize:function(){this.viewer.handleResize()},toggleFullscreen:function(t){function e(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement}function i(){if(!e()&&n.lastFullscreenElement){var t=n.lastFullscreenElement;t.style.width=t.dataset.normalWidth,t.style.height=t.dataset.normalHeight,document.removeEventListener("fullscreenchange",i),document.removeEventListener("mozfullscreenchange",i),document.removeEventListener("webkitfullscreenchange",i),document.removeEventListener("MSFullscreenChange",i),n.handleResize(),n.signals.fullscreenChanged.dispatch(!1)}}if(!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.webkitFullscreenEnabled||document.msFullscreenEnabled))return void nv.log("fullscreen mode (currently) not possible");var n=this;t=t||this.viewer.container,this.lastFullscreenElement=t,e()?document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen():(t.dataset.normalWidth=t.style.width,t.dataset.normalHeight=t.style.height,t.style.width=screen.width+"px",t.style.height=screen.height+"px",t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen(),document.addEventListener("fullscreenchange",i),document.addEventListener("mozfullscreenchange",i),document.addEventListener("webkitfullscreenchange",i),document.addEventListener("MSFullscreenChange",i),this.handleResize(),this.signals.fullscreenChanged.dispatch(!0),setTimeout(function(){n.handleResize()},100))},centerView:function(){if(this.tasks.count>0){var t=function(e,i){0===i&&this.tasks.signals.countChanged.remove(t,this),this.viewer.centerView(!0)};this.tasks.signals.countChanged.add(t,this)}this.viewer.centerView(!0)},setSpin:function(t,e){Array.isArray(t)&&(t=(new N).fromArray(t)),this.viewer.setSpin(t,e)},setOrientation:function(t){this.tasks.onZeroOnce(function(){this.viewer.setOrientation(t)},this)},getOrientation:function(){return this.viewer.getOrientation()},makeImage:function(t){var e=this.viewer,i=this.tasks;return new Promise(function(n,r){function o(){i.increment(),e.makeImage(t).then(function(t){i.decrement(),n(t)}).catch(function(t){i.decrement(),r(t)})}i.onZeroOnce(o)})},setImpostor:function(t){this.parameters.impostor.value=t;var e=["spacefill","ball+stick","licorice","hyperball","backbone","rocket","helixorient","contact","distance","dot"];this.eachRepresentation(function(i){if("script"!==i.type&&e.includes(i.getType())){var n=i.getParameters();n.disableImpostor=!t,i.build(n)}})},setQuality:function(t){this.parameters.quality.value=t;var e=["tube","cartoon","ribbon","trace","rope"],i=["spacefill","ball+stick","licorice","hyperball","backbone","rocket","helixorient","contact","distance","dot"];this.eachRepresentation(function(n){if("script"!==n.type){var r=n.getParameters();if(!e.includes(n.getType())){if(!i.includes(n.getType()))return;if(!r.disableImpostor)return void(n.repr.quality=t)}r.quality=t,n.build(r)}})},eachComponent:function(t,e){this.compList.forEach(function(i,n){e&&i.type!==e||t(i,n)})},eachRepresentation:function(t,e){this.eachComponent(function(e){e.reprList.forEach(function(i){t(i,e)})},e)},getComponentsByName:function(t,e){var i=[];return this.eachComponent(function(e){void 0!==t&&null===e.name.match(t)||i.push(e)},e),new ts(i)},getRepresentationsByName:function(t,e){var i,n;"object"!=typeof t?(i=void 0,n=t):(i=t.comp,n=t.repr);var r=[];return this.eachRepresentation(function(t,e){void 0!==i&&null===e.name.match(i)||void 0!==n&&null===t.name.match(n)||r.push(t)},e),new es(r)},getAnythingByName:function(t){var e=this.getComponentsByName(t).list,i=this.getRepresentationsByName(t).list;return new Ja(e.concat(i))},dispose:function(){this.tasks.dispose()}},gs.prototype={constructor:gs,_animate:function(){var t;if(this._running=!0,this.traj.inProgress||this._stopFlag||(t="forward"===this.direction?this.traj.currentFrame+this.step:this.traj.currentFrame-this.step,(t>=this.end||t=this.end?e=this.start:"backward"===this.direction&&t<=this.start&&(e=this.end),this.traj.setFrame(e),this._stopFlag=!1,this._animate(),this.signals.startedRunning.dispatch()}},pause:function(){this._running&&(this._stopFlag=!0,this.signals.haltedRunning.dispatch())},stop:function(){this.traj.setFrame(this.start),this.pause()}},vs.prototype=Object.assign(Object.create(Xa.prototype),{constructor:vs,type:"axes",parameters:Object.assign({radius:{type:"number",precision:3,max:10,min:.001},sphereDetail:!0,radialSegments:!0,disableImpostor:!0,align:{type:"button"},showAxes:{type:"boolean",rebuild:!0},showBox:{type:"boolean",rebuild:!0}},Ba.prototype.parameters,{assembly:null}),init:function(t){var e=t||{};e.radius=d(e.radius,.5),e.colorValue=d(e.colorValue,"lightgreen"),Xa.prototype.init.call(this,e),this.showAxes=d(e.showAxes,!0),this.showBox=d(e.showBox,!1)},getPrincipalAxes:function(){var t,e=this.getAssembly();return e&&(t=e.partList[0].getSelection()),this.structureView.getView(t).getPrincipalAxes()},align:function(){var t=this.getPrincipalAxes(this.structureView),e=(new N).copy(t[0][1]).sub(t[0][0]).normalize(),i=(new N).copy(t[2][1]).sub(t[2][0]).normalize();this.viewer.alignView(i,e,t[3],!0)},getAxesData:function(t){var e=this.getPrincipalAxes(t),i=new Ct(this.colorValue),n=0,r=0;this.showAxes&&(n+=6,r+=3),this.showBox&&(n+=8,r+=12);var o=new Float32Array(3*n),a=br(n,i.r,i.g,i.b),s=yr(n,this.radius),c=new Float32Array(3*r),u=new Float32Array(3*r),h=br(r,i.r,i.g,i.b),l=yr(r,this.radius),d=0;if(this.showAxes){var f=function(t,e){t.toArray(o,2*d),e.toArray(o,2*d+3),t.toArray(c,d),e.toArray(u,d),d+=3};f(e[0][0],e[0][1]),f(e[1][0],e[1][1]),f(e[2][0],e[2][1])}if(this.showBox){var p=(new N).subVectors(e[0][0],e[0][1]).normalize(),m=(new N).subVectors(e[1][0],e[1][1]).normalize(),g=(new N).subVectors(e[2][0],e[2][1]).normalize(),v=new N,y=new N,b=new N,x=new N,_=new N,w=-(1/0),S=-(1/0),A=-(1/0),M=-(1/0),P=-(1/0),C=-(1/0);t.eachAtom(function(t){Rr(v.copy(t),p,e[3]);var i=x.subVectors(v,e[3]).normalize().dot(p),n=v.distanceTo(e[3]);i>0?n>w&&(w=n):n>S&&(S=n),Rr(y.copy(t),m,e[3]);var r=x.subVectors(y,e[3]).normalize().dot(m),o=y.distanceTo(e[3]);r>0?o>A&&(A=o):o>M&&(M=o),Rr(b.copy(t),g,e[3]);var a=x.subVectors(b,e[3]).normalize().dot(g),s=b.distanceTo(e[3]);a>0?s>P&&(P=s):s>C&&(C=s)});var T=2*d,E=function(t,i,n){_.copy(e[3]).addScaledVector(p,t).addScaledVector(m,i).addScaledVector(g,n),_.toArray(o,T),T+=3};E(w,A,P),E(w,A,-C),E(w,-M,-C),E(w,-M,P),E(-S,-M,-C),E(-S,-M,P),E(-S,A,P),E(-S,A,-C);var I=d,L=function(t,e){_.fromArray(o,2*d+3*t).toArray(c,I),_.fromArray(o,2*d+3*e).toArray(u,I),I+=3};L(0,1),L(0,3),L(0,6),L(1,2),L(1,7),L(2,3),L(2,4),L(3,5),L(4,5),L(4,7),L(5,6),L(6,7)}return{vertexPosition:o,vertexColor:a,vertexRadius:s,edgePosition1:c,edgePosition2:u,edgeColor:h,edgeRadius:l}},create:function(){var t=this.getAxesData(this.structureView);this.sphereBuffer=new Ta(t.vertexPosition,t.vertexColor,t.vertexRadius,void 0,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0})),this.cylinderBuffer=new Da(t.edgePosition1,t.edgePosition2,t.edgeColor,t.edgeColor,t.edgeRadius,void 0,void 0,this.getBufferParams({openEnded:!0,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bufferList:[this.sphereBuffer,this.cylinderBuffer]})},updateData:function(t,e){var i=this.getAxesData(e.sview),n={},r={};t&&!t.position||(n.position=i.vertexPosition,r.position1=i.edgePosition1,r.position2=i.edgePosition2),t&&!t.color||(n.color=i.vertexColor,r.color=i.edgeColor,r.color2=i.edgeColor),t&&!t.radius||(n.radius=i.vertexRadius,r.radius=i.edgeRadius),this.sphereBuffer.setAttributes(n),this.cylinderBuffer.setAttributes(r)}}),cv.add("axes",vs),ys.prototype=Object.assign(Object.create(Xa.prototype),{constructor:ys,type:"ball+stick",defaultSize:.15,parameters:Object.assign({sphereDetail:!0,radialSegments:!0,openEnded:!0,disableImpostor:!0,aspectRatio:{type:"number",precision:1,max:10,min:1},lineOnly:{type:"boolean",rebuild:!0},cylinderOnly:{type:"boolean",rebuild:!0},multipleBond:{type:"select",rebuild:!0,options:{off:"off",symmetric:"symmetric",offset:"offset"}},bondScale:{type:"number",precision:2,max:1,min:.01},bondSpacing:{type:"number",precision:2,max:2,min:.5}},Xa.prototype.parameters),init:function(t){var e=t||{};e.radius=d(e.radius,this.defaultSize),this.aspectRatio=d(e.aspectRatio,2),this.lineOnly=d(e.lineOnly,!1),this.cylinderOnly=d(e.cylinderOnly,!1),this.multipleBond=d(e.multipleBond,"off"),this.bondSpacing=d(e.bondSpacing,1),this.bondScale=d(e.bondScale,.4),Xa.prototype.init.call(this,e)},getAtomParams:function(t,e){return e=Object.assign({radiusParams:{radius:this.radius,scale:this.scale*this.aspectRatio}},e),Xa.prototype.getAtomParams.call(this,t,e)},getAtomData:function(t,e,i){return t.getAtomData(this.getAtomParams(e,i))},getBondParams:function(t,e){return e=Object.assign({multipleBond:this.multipleBond,bondSpacing:this.bondSpacing,bondScale:this.bondScale},e),Xa.prototype.getBondParams.call(this,t,e)},getBondData:function(t,e,i){return t.getBondData(this.getBondParams(e,i))},createData:function(t){var e=this.getBondData(t),i=[];if(this.lineOnly)this.lineBuffer=new qa(e.position1,e.position2,e.color1,e.color2,this.getBufferParams()),i.push(this.lineBuffer);else{var n=new Da(e.position1,e.position2,e.color1,e.color2,e.radius,e.pickingColor1,e.pickingColor2,this.getBufferParams({openEnded:this.openEnded,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}));if(i.push(n),!this.cylinderOnly){var r=this.getAtomData(t),o=new Ta(r.position,r.color,r.radius,r.pickingColor,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0}));i.push(o)}}return{bufferList:i}},updateData:function(t,e){"off"!==this.multipleBond&&t&&t.radius&&(t.position=!0);var i=this.getBondData(e.sview,t);if(this.lineOnly){var n={};t&&!t.position||(n.from=i.position1,n.to=i.position2),t&&!t.color||(n.color=i.color1,n.color2=i.color2),e.bufferList[0].setAttributes(n)}else{var r={};if(t&&!t.position||(r.position1=i.position1,r.position2=i.position2),t&&!t.color||(r.color=i.color1,r.color2=i.color2),t&&!t.radius||(r.radius=i.radius),e.bufferList[0].setAttributes(r),!this.cylinderOnly){var o=this.getAtomData(e.sview,t),a={};t&&!t.position||(a.position=o.position),t&&!t.color||(a.color=o.color),t&&!t.radius||(a.radius=o.radius),e.bufferList[1].setAttributes(a)}}},setParameters:function(t){var e=!1,i={};return t&&(t.aspectRatio||t.bondSpacing||t.bondScale)&&(i.radius=!0,iv&&!this.disableImpostor||(e=!0)),Xa.prototype.setParameters.call(this,t,i,e),this}}),cv.add("ball+stick",ys),bs.prototype=Object.assign(Object.create(ys.prototype),{constructor:bs,type:"backbone",defaultSize:.25,parameters:Object.assign({},ys.prototype.parameters,{multipleBond:null,bondSpacing:null}),init:function(t){var e=t||{};e.aspectRatio=d(e.aspectRatio,1),ys.prototype.init.call(this,e)},getAtomData:function(t,e,i){return t.getBackboneAtomData(this.getAtomParams(e,i))},getBondData:function(t,e,i){var n=this.getBondParams(e,i);return n.colorParams.backbone=!0,t.getBackboneBondData(n)}}),cv.add("backbone",bs),xs.prototype=Object.assign(Object.create(ys.prototype),{constructor:xs,type:"base",defaultSize:.3,parameters:Object.assign({},ys.prototype.parameters,{multipleBond:null,bondSpacing:null}),init:function(t){var e=t||{};e.aspectRatio=d(e.aspectRatio,1),ys.prototype.init.call(this,e)},getAtomData:function(t,e,i){return t.getRungAtomData(this.getAtomParams(e,i))},getBondData:function(t,e,i){var n=this.getBondParams(e,i);return n.colorParams.rung=!0,t.getRungBondData(n)}}),cv.add("base",xs),ws.prototype={constructor:ws,getAtomIterator:function(t,e){function i(){var t=this.get(u);return u+=1,t}function n(i){var n=h[c%4];if(n.index=o.getAtomIndexByType(i,t),e&&i>0&&ie)&&(s=!0,r.add_unsafe(n.index),o.addBond(a,n,1))}s&&r.add_unsafe(a.index)});var a=new Pv(o.count);return a.set_all(!0),nv.timeEnd("Contact within"),{atomSet:r,bondSet:a,bondStore:o}}},Ts.prototype=Object.assign(Object.create(Xa.prototype),{constructor:Ts,type:"contact",defaultSize:.25,parameters:Object.assign({contactType:{type:"select",rebuild:!0,options:{polar:"polar",polarBackbone:"polar backbone"}},maxDistance:{type:"number",precision:1,max:10,min:.1,rebuild:!0},maxAngle:{type:"integer",max:180,min:0,rebuild:!0},radialSegments:!0,disableImpostor:!0},Xa.prototype.parameters),init:function(t){var e=t||{};e.radius=d(e.radius,this.defaultSize),this.contactType=d(e.contactType,"polarBackbone"), -this.maxDistance=d(e.maxDistance,3.5),this.maxAngle=d(e.maxAngle,40),Xa.prototype.init.call(this,e)},getContactData:function(t){var e={polar:Ps,polarBackbone:Cs},i=e[this.contactType](t,this.maxDistance,this.maxAngle);return i},getBondData:function(t,e,i){return t.getBondData(this.getBondParams(e,i))},createData:function(t){var e=this.getContactData(t),i={bondSet:e.bondSet,bondStore:e.bondStore},n=this.getBondData(t,void 0,i),r=new Da(n.position1,n.position2,n.color1,n.color2,n.radius,n.pickingColor1,n.pickingColor2,this.getBufferParams({openEnded:!1,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}));return{bufferList:[r],bondSet:e.bondSet,bondStore:e.bondStore}},updateData:function(t,e){if(!t||t.position){var i=this.getContactData(e.sview);e.bondSet=i.bondSet,e.bondStore=i.bondStore}var n={bondSet:e.bondSet,bondStore:e.bondStore},r=this.getBondData(e.sview,t,n),o={};t&&!t.position||(o.position=vr(r.position1,r.position2),o.position1=r.position1,o.position2=r.position2),t&&!t.color||(o.color=r.color1,o.color2=r.color2),t&&!t.radius||(o.radius=r.radius),e.bufferList[0].setAttributes(o)}}),cv.add("contact",Ts),hv.add("shader/SDFFont.vert","uniform float nearClip;\nuniform float clipRadius;\nuniform vec3 clipCenter;\nuniform float xOffset;\nuniform float yOffset;\nuniform float zOffset;\nuniform bool ortho;\nvarying vec3 vViewPosition;\nvarying vec2 texCoord;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\nattribute vec2 mapping;\nattribute vec2 inputTexCoord;\nattribute float inputSize;\n#include color_pars_vertex\n#include common\nvoid main(void){\n#include color_vertex\ntexCoord = inputTexCoord;\nfloat _zOffset = zOffset;\nif( texCoord.x == 10.0 ){\n_zOffset -= 0.001;\n}\nvec3 pos = position;\nif( ortho ){\npos += normalize( cameraPosition ) * _zOffset;\n}\nvec4 cameraPos = modelViewMatrix * vec4( pos, 1.0 );\nvec4 cameraCornerPos = vec4( cameraPos.xyz, 1.0 );\ncameraCornerPos.xy += mapping * inputSize * 0.01;\ncameraCornerPos.x += xOffset;\ncameraCornerPos.y += yOffset;\nif( !ortho ){\ncameraCornerPos.xyz += normalize( -cameraCornerPos.xyz ) * _zOffset;\n}\ngl_Position = projectionMatrix * cameraCornerPos;\nvViewPosition = -cameraCornerPos.xyz;\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n#include radiusclip_vertex\n}"),hv.add("shader/SDFFont.frag","uniform sampler2D fontTexture;\nuniform float opacity;\nuniform bool showBorder;\nuniform vec3 borderColor;\nuniform float borderWidth;\nuniform vec3 backgroundColor;\nuniform float backgroundOpacity;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec3 vViewPosition;\nvarying vec2 texCoord;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#ifdef SDF\nconst float smoothness = 16.0;\n#else\nconst float smoothness = 256.0;\n#endif\nconst float gamma = 2.2;\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\nif( texCoord.x > 1.0 ){\ngl_FragColor = vec4( backgroundColor, backgroundOpacity );\n}else{\nfloat sdf = texture2D( fontTexture, texCoord ).a;\nif( showBorder ) sdf += borderWidth;\nfloat w = clamp(\nsmoothness * ( abs( dFdx( texCoord.x ) ) + abs( dFdy( texCoord.y ) ) ),\n0.0,\n0.5\n);\nfloat a = smoothstep( 0.5 - w, 0.5 + w, sdf );\na = pow( a, 1.0 / gamma );\nif( a < 0.2 ) discard;\na *= opacity;\nvec3 outgoingLight = vColor;\nif( showBorder && sdf < ( 0.5 + borderWidth ) ){\noutgoingLight = borderColor;\n}\ngl_FragColor = vec4( outgoingLight, a );\n}\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n}");var Nv=function(){var t={};return function(e){var i=JSON.stringify(e);return void 0===t[i]&&(t[i]=new Es(e)),t[i]}}();Es.prototype={constructor:Es,build:function(){var t=this.size+2*this.outline+Math.round(this.size/4),e=this.width/4,i=document.createElement("canvas");i.width=e,i.height=t;var n=i.getContext("2d");n.font=this.style+" "+this.variant+" "+this.weight+" "+this.size+"px "+this.font,n.fillStyle="#FF0000",n.textAlign="left",n.textBaseline="bottom",n.lineJoin="round";for(var r=[],o=3*this.outline,a=0;athis.width&&(this.currentX=0,this.currentY+=this.scratchH),this.currentY+this.scratchH>this.height&&console.warn("canvas to small"),this.mapped[t]={x:this.currentX,y:this.currentY,w:this.scratchW,h:this.scratchH},this.context2.drawImage(this.canvas,0,0,this.scratchW,this.scratchH,this.currentX,this.currentY,this.scratchW,this.scratchH),this.currentX+=this.scratchW),this.mapped[t]},draw:function(t){var e=this.lineHeight,i=this.outline,n=this.context,r=this.scratch,o=this.maxWidth,a=this.colors,s=i,c=e-this.outline,u=n.measureText(t),h=Math.min(o,Math.ceil(u.width+2*s+1));n.clearRect(0,0,h,e);var l,d,f,p,m;if(0===this.outline)for(n.fillText(t,s,c),p=n.getImageData(0,0,h,e),m=p.data,f=3,l=0,d=m.length/4;l0;--l)f=l>1?2*l-2:l,n.strokeStyle=a[f-1],n.lineWidth=f,n.strokeText(t,s,c);n.globalCompositeOperation="multiply",n.fillStyle="#FF00FF",n.fillText(t,s,c),p=n.getImageData(0,0,h,e),m=p.data,f=0;var g=this.gamma;for(l=0,d=m.length/4;l0&&(i-=h,r=r.subarray(0,3*i));var l=new Pv(s.count);return l.set_all(!0),{text:n,position:r,bondSet:l,bondStore:s}},getBondData:function(t,e,i){return t.getBondData(this.getBondParams(e,i))},create:function(){if(0!==this.structureView.atomCount){var t=this.atomPair.length;if(0!==t){var e=this.getDistanceData(this.structureView,this.atomPair),i=new Ct(this.labelColor);this.textBuffer=new Is(e.position,yr(t,this.labelSize),br(t,i.r,i.g,i.b),e.text,this.getBufferParams({fontFamily:this.fontFamily,fontStyle:this.fontStyle,fontWeight:this.fontWeight,sdf:this.sdf,zOffset:this.labelZOffset,opacity:1,visible:this.labelVisible}));var n={bondSet:e.bondSet,bondStore:e.bondStore},r=this.getBondData(this.structureView,void 0,n);this.cylinderBuffer=new Da(r.position1,r.position2,r.color1,r.color2,r.radius,void 0,void 0,this.getBufferParams({openEnded:!1,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bondSet:e.bondSet,bondStore:e.bondStore,position:e.position,bufferList:[this.textBuffer,this.cylinderBuffer]})}}},update:function(t){t.position?this.build():Xa.prototype.update.call(this,t)},updateData:function(t,e){var i={bondSet:e.bondSet,bondStore:e.bondStore},n=this.getBondData(e.sview,t,i),r={},o={},a=this.atomPair.length;if(t.labelSize&&(o.size=yr(a,this.labelSize)),t.labelColor){var s=new Ct(this.labelColor);o.color=br(a,s.r,s.g,s.b)}t.color&&(r.color=n.color1,r.color2=n.color2),(t.radius||t.scale)&&(r.radius=n.radius),this.textBuffer.setAttributes(o),this.cylinderBuffer.setAttributes(r)},setVisibility:function(t,e){return Xa.prototype.setVisibility.call(this,t,!0),this.textBuffer&&this.textBuffer.setVisibility(this.labelVisible&&this.visible),e||this.viewer.requestRender(),this},setParameters:function(t){var e=!1,i={};return t&&t.labelSize&&(i.labelSize=!0),t&&t.labelColor&&(i.labelColor=!0),Xa.prototype.setParameters.call(this,t,i,e),t&&void 0!==t.labelVisible&&this.setVisibility(this.visible),this}}),cv.add("distance",Ls),Rs.prototype=Object.assign(Object.create(ya.prototype),{constructor:Rs,setAttributes:function(t){var e,i,n,r=this.geometry.attributes;t.position&&t.vector&&(e=t.position,i=t.vector,n=r.position.array,r.position.needsUpdate=!0);var o,a,s=this.size,c=this.scale;if(t.position&&t.vector)for(var u=0;u radius2) {\nspaceposition.y = mapping.y * 1.5 * radius1;\nspaceposition.x = mapping.x * 1.5 * radius1;\n} else {\nspaceposition.y = mapping.y * 1.5 * radius2;\nspaceposition.x = mapping.x * 1.5 * radius2;\n}\nspaceposition.w = 1.0;\nvec4 e3 = vec4( 1.0 );\nvec3 e1, e1_temp, e2, e2_temp;\ne3.xyz = normalize(position_atom1-position_atom2);\nif (e3.z == 0.0) { e3.z = 0.0000000000001;}\nif ( (position_atom1.x - position_atom2.x) == 0.0) { position_atom1.x += 0.001;}\nif ( (position_atom1.y - position_atom2.y) == 0.0) { position_atom1.y += 0.001;}\nif ( (position_atom1.z - position_atom2.z) == 0.0) { position_atom1.z += 0.001;}\nvec4 focus = vec4( 1.0 );\nfocus.x = ( position_atom1.x*position_atom1.x - position_atom2.x*position_atom2.x +\n( radius2*radius2 - radius1*radius1 )*e3.x*e3.x/shrink )/(2.0*(position_atom1.x - position_atom2.x));\nfocus.y = ( position_atom1.y*position_atom1.y - position_atom2.y*position_atom2.y +\n( radius2*radius2 - radius1*radius1 )*e3.y*e3.y/shrink )/(2.0*(position_atom1.y - position_atom2.y));\nfocus.z = ( position_atom1.z*position_atom1.z - position_atom2.z*position_atom2.z +\n( radius2*radius2 - radius1*radius1 )*e3.z*e3.z/shrink )/(2.0*(position_atom1.z - position_atom2.z));\ne1.x = 1.0;\ne1.y = 1.0;\ne1.z = ( (e3.x*focus.x + e3.y*focus.y + e3.z*focus.z) - e1.x*e3.x - e1.y*e3.y)/e3.z;\ne1_temp = e1 - focus.xyz;\ne1 = normalize(e1_temp);\ne2_temp = e1.yzx * e3.zxy - e1.zxy * e3.yzx;\ne2 = normalize(e2_temp);\nmat3 R= mat3( e1.xyz, e2.xyz, e3.xyz );\nvertex_position.xyz = R * spaceposition.xyz;\nvertex_position.w = 1.0;\nvertex_position.x += (position_atom1.x+position_atom2.x) / 2.0;\nvertex_position.y += (position_atom1.y+position_atom2.y) / 2.0;\nvertex_position.z += (position_atom1.z+position_atom2.z) / 2.0;\ngl_Position = modelViewProjectionMatrix * vertex_position;\nvec4 i_near, i_far;\nvec4 near = gl_Position;\nnear.z = 0.0 ;\nnear = modelViewProjectionMatrixInverse * near;\ni_near = near;\nvec4 far = gl_Position;\nfar.z = far.w ;\ni_far = modelViewProjectionMatrixInverse * far;\nprime1 = vec4( position_atom1 - (position_atom1 - focus.xyz)*shrink, 1.0 );\nprime2 = vec4( position_atom2 - (position_atom2 - focus.xyz)*shrink, 1.0 );\nfloat Rsquare = (radius1*radius1/shrink) - (\n(position_atom1.x - focus.x)*(position_atom1.x - focus.x) +\n(position_atom1.y - focus.y)*(position_atom1.y - focus.y) +\n(position_atom1.z - focus.z)*(position_atom1.z - focus.z)\n);\nfocus.w = Rsquare;\nmatrix_near = mat4( i_near, i_far, focus, e3 );\ngl_Position.z = 1.0;\n}"),hv.add("shader/HyperballStickImpostor.frag","#define STANDARD\n#define IMPOSTOR\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float nearClip;\nuniform float shrink;\nuniform mat4 modelViewMatrix;\nuniform mat4 modelViewProjectionMatrix;\nuniform mat4 modelViewMatrixInverseTranspose;\nuniform mat4 projectionMatrix;\nvarying mat4 matrix_near;\nvarying vec4 prime1;\nvarying vec4 prime2;\nvarying float vRadius;\nvarying float vRadius2;\n#ifdef PICKING\nuniform float objectId;\nvarying vec3 vPickingColor;\nvarying vec3 vPickingColor2;\n#else\nvarying vec3 vColor1;\nvarying vec3 vColor2;\n#include common\n#include fog_pars_fragment\n#include bsdfs\n#include lights_pars\n#include lights_physical_pars_fragment\n#endif\nbool interior = false;\nfloat calcClip( vec4 cameraPos ){\nreturn dot( cameraPos, vec4( 0.0, 0.0, 1.0, nearClip - 0.5 ) );\n}\nfloat calcClip( vec3 cameraPos ){\nreturn calcClip( vec4( cameraPos, 1.0 ) );\n}\nfloat calcDepth( in vec3 cameraPos ){\nvec2 clipZW = cameraPos.z * projectionMatrix[2].zw + projectionMatrix[3].zw;\nreturn 0.5 + 0.5 * clipZW.x / clipZW.y;\n}\nstruct Ray {\nvec3 origin ;\nvec3 direction ;\n};\nbool cutoff_plane (vec3 M, vec3 cutoff, vec3 x3){\nfloat a = x3.x;\nfloat b = x3.y;\nfloat c = x3.z;\nfloat d = -x3.x*cutoff.x-x3.y*cutoff.y-x3.z*cutoff.z;\nfloat l = a*M.x+b*M.y+c*M.z+d;\nif (l<0.0) {return true;}\nelse{return false;}\n}\nvec3 isect_surf(Ray r, mat4 matrix_coef){\nvec4 direction = vec4(r.direction, 0.0);\nvec4 origin = vec4(r.origin, 1.0);\nfloat a = dot(direction,(matrix_coef*direction));\nfloat b = dot(origin,(matrix_coef*direction));\nfloat c = dot(origin,(matrix_coef*origin));\nfloat delta =b*b-a*c;\ngl_FragColor.a = 1.0;\nif (delta<0.0){\ndiscard;\n}\nfloat t1 =(-b-sqrt(delta))/a;\nreturn r.origin+t1*r.direction;\n}\nvec3 isect_surf2(Ray r, mat4 matrix_coef){\nvec4 direction = vec4(r.direction, 0.0);\nvec4 origin = vec4(r.origin, 1.0);\nfloat a = dot(direction,(matrix_coef*direction));\nfloat b = dot(origin,(matrix_coef*direction));\nfloat c = dot(origin,(matrix_coef*origin));\nfloat delta =b*b-a*c;\ngl_FragColor.a = 1.0;\nif (delta<0.0){\ndiscard;\n}\nfloat t2 =(-b+sqrt(delta))/a;\nreturn r.origin+t2*r.direction;\n}\nRay primary_ray(vec4 near1, vec4 far1){\nvec3 near=near1.xyz/near1.w;\nvec3 far=far1.xyz/far1.w;\nreturn Ray(near,far-near);\n}\nfloat update_z_buffer(vec3 M, mat4 ModelViewP){\nfloat depth1;\nvec4 Ms=(ModelViewP*vec4(M,1.0));\nreturn depth1=(1.0+Ms.z/Ms.w)/2.0;\n}\nvoid main(){\nfloat radius = max( vRadius, vRadius2 );\nvec4 i_near, i_far, focus;\nvec3 e3, e1, e1_temp, e2;\ni_near = vec4(matrix_near[0][0],matrix_near[0][1],matrix_near[0][2],matrix_near[0][3]);\ni_far = vec4(matrix_near[1][0],matrix_near[1][1],matrix_near[1][2],matrix_near[1][3]);\nfocus = vec4(matrix_near[2][0],matrix_near[2][1],matrix_near[2][2],matrix_near[2][3]);\ne3 = vec3(matrix_near[3][0],matrix_near[3][1],matrix_near[3][2]);\ne1.x = 1.0;\ne1.y = 1.0;\ne1.z = ( (e3.x*focus.x + e3.y*focus.y + e3.z*focus.z) - e1.x*e3.x - e1.y*e3.y)/e3.z;\ne1_temp = e1 - focus.xyz;\ne1 = normalize(e1_temp);\ne2 = normalize(cross(e1,e3));\nvec4 equation = focus;\nfloat shrinkfactor = shrink;\nfloat t1 = -1.0/(1.0-shrinkfactor);\nfloat t2 = 1.0/(shrinkfactor);\nvec4 colonne1, colonne2, colonne3, colonne4;\nmat4 mat;\nvec3 equation1 = vec3(t2,t2,t1);\nfloat A1 = - e1.x*equation.x - e1.y*equation.y - e1.z*equation.z;\nfloat A2 = - e2.x*equation.x - e2.y*equation.y - e2.z*equation.z;\nfloat A3 = - e3.x*equation.x - e3.y*equation.y - e3.z*equation.z;\nfloat A11 = equation1.x*e1.x*e1.x + equation1.y*e2.x*e2.x + equation1.z*e3.x*e3.x;\nfloat A21 = equation1.x*e1.x*e1.y + equation1.y*e2.x*e2.y + equation1.z*e3.x*e3.y;\nfloat A31 = equation1.x*e1.x*e1.z + equation1.y*e2.x*e2.z + equation1.z*e3.x*e3.z;\nfloat A41 = equation1.x*e1.x*A1 + equation1.y*e2.x*A2 + equation1.z*e3.x*A3;\nfloat A22 = equation1.x*e1.y*e1.y + equation1.y*e2.y*e2.y + equation1.z*e3.y*e3.y;\nfloat A32 = equation1.x*e1.y*e1.z + equation1.y*e2.y*e2.z + equation1.z*e3.y*e3.z;\nfloat A42 = equation1.x*e1.y*A1 + equation1.y*e2.y*A2 + equation1.z*e3.y*A3;\nfloat A33 = equation1.x*e1.z*e1.z + equation1.y*e2.z*e2.z + equation1.z*e3.z*e3.z;\nfloat A43 = equation1.x*e1.z*A1 + equation1.y*e2.z*A2 + equation1.z*e3.z*A3;\nfloat A44 = equation1.x*A1*A1 + equation1.y*A2*A2 + equation1.z*A3*A3 - equation.w;\ncolonne1 = vec4(A11,A21,A31,A41);\ncolonne2 = vec4(A21,A22,A32,A42);\ncolonne3 = vec4(A31,A32,A33,A43);\ncolonne4 = vec4(A41,A42,A43,A44);\nmat = mat4(colonne1,colonne2,colonne3,colonne4);\nRay ray = primary_ray(i_near,i_far) ;\nvec3 M;\nM = isect_surf(ray, mat);\nif (cutoff_plane(M, prime1.xyz, -e3) || cutoff_plane(M, prime2.xyz, e3)){ discard; }\nvec4 M1 = vec4(M,1.0);\nvec4 M2 = mat*M1;\nvec3 _normal = ( modelViewMatrixInverseTranspose * M2 ).xyz;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix) ;\n#ifdef NEAR_CLIP\nif( calcClip( modelViewMatrix * vec4( M, 1.0 ) ) > 0.0 ){\nM = isect_surf2(ray, mat);\nif( calcClip( modelViewMatrix * vec4( M, 1.0 ) ) > 0.0 )\ndiscard;\ninterior = true;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix) ;\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = max( 0.0, calcDepth( vec3( - ( nearClip - 0.5 ) ) ) + ( 0.0000001 / radius ) );\n}\n}else if( gl_FragDepthEXT <= 0.0 ){\nM = isect_surf2(ray, mat);\ninterior = true;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix);\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / radius );\n}\n}\n#else\nif( gl_FragDepthEXT <= 0.0 ){\nM = isect_surf2(ray, mat);\ninterior = true;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix) ;\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / radius );\n}\n}\n#endif\nif (cutoff_plane(M, prime1.xyz, -e3) || cutoff_plane(M, prime2.xyz, e3)){ discard; }\nif (gl_FragDepthEXT < 0.0)\ndiscard;\nif (gl_FragDepthEXT > 1.0)\ndiscard;\nfloat distance_ratio = ((M.x-prime2.x)*e3.x + (M.y-prime2.y)*e3.y +(M.z-prime2.z)*e3.z) /\ndistance(prime2.xyz,prime1.xyz);\n#ifdef PICKING\nif( distance_ratio > 0.5 ){\ngl_FragColor = vec4( vPickingColor, objectId );\n}else{\ngl_FragColor = vec4( vPickingColor2, objectId );\n}\n#else\nvec3 vViewPosition = -( modelViewMatrix * vec4( M, 1.0 ) ).xyz;\nvec3 vNormal = _normal;\nvec3 vColor;\nif( distance_ratio>0.5 ){\nvColor = vColor1;\n}else{\nvColor = vColor2;\n}\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\nvec3 normal = normalize( vNormal );\nif( interior ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}"),Ns.prototype=Object.assign(Object.create(Ma.prototype),{constructo:Ns});var kv=new O;Fs.prototype=Object.assign(Object.create(Ns.prototype),{constructor:Fs,parameters:Object.assign({shrink:{uniform:!0}},Ns.prototype.parameters)}),Bs.prototype=Object.assign(Object.create(Ds.prototype),{constructor:Bs,type:"hyperball",defaultSize:1,parameters:Object.assign({shrink:{type:"number",precision:3,max:1,min:.001,buffer:!0}},Ds.prototype.parameters,{multipleBond:null,bondSpacing:null}),init:function(t){var e=t||{};e.scale=d(e.scale,.2),e.radius=d(e.radius,"vdw"),this.shrink=d(e.shrink,.12),Ds.prototype.init.call(this,e)},getBondParams:function(t,e){return t&&!t.radius||(e=Object.assign({radius2:!0},e)),Ds.prototype.getBondParams.call(this,t,e)},createData:function(t){var e=t.getAtomData(this.getAtomParams()),i=t.getBondData(this.getBondParams()),n=new Ta(e.position,e.color,e.radius,e.pickingColor,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0}));this.__center=new Float32Array(3*t.bondCount);var r=new zs(i.position1,i.position2,i.color1,i.color2,i.radius1,i.radius2,i.pickingColor1,i.pickingColor2,this.getBufferParams({shrink:this.shrink,radialSegments:this.radialSegments,dullInterior:!0}),this.disableImpostor);return{bufferList:[n,r]}},updateData:function(t,e){var i=e.sview.getAtomData(this.getAtomParams()),n=e.sview.getBondData(this.getBondParams()),r={},o={};if(!t||t.position){r.position=i.position;var a=n.position1,s=n.position2;o.position=vr(a,s,this.__center),o.position1=a,o.position2=s}t&&!t.color||(r.color=i.color,o.color=n.color1,o.color2=n.color2),t&&!t.radius||(r.radius=i.radius,o.radius=n.radius1,o.radius2=n.radius2),e.bufferList[0].setAttributes(r),e.bufferList[1].setAttributes(o)}}),cv.add("hyperball",Bs),Us.prototype={constructor:Us,atomLabel:function(t){var e,i=this.type;switch(i){case"atomname":e=t.atomname;break;case"atomindex":e=""+t.index;break;case"occupancy":e=t.occupancy.toFixed(2);break;case"bfactor":e=t.bfactor.toFixed(2);break;case"serial":e=""+t.serial;break;case"element":e=t.element;break;case"atom":e=t.atomname+"|"+t.index;break;case"resname":e=t.resname;break;case"resno":e=""+t.resno;break;case"res":var n=t.resname.toUpperCase();e=(hm[n]||n)+t.resno;break;case"text":e=this.text[t.index];break;default:e=t.qualifiedName()}return void 0===e?"":e}},Us.types={"":"",atomname:"atom name",atomindex:"atom index",occupancy:"occupancy",bfactor:"b-factor",serial:"serial",element:"element",atom:"atom name + index",resname:"residue name",resno:"residue no",res:"residue name + no",text:"text",qualified:"qualified name"},js.prototype=Object.assign(Object.create(Xa.prototype),{constructor:js,type:"label",parameters:Object.assign({labelType:{type:"select",options:Us.types,rebuild:!0},labelText:{type:"hidden",rebuild:!0},fontFamily:{type:"select",options:{"sans-serif":"sans-serif",monospace:"monospace",serif:"serif"},buffer:!0},fontStyle:{type:"select",options:{normal:"normal",italic:"italic"},buffer:!0},fontWeight:{type:"select",options:{normal:"normal",bold:"bold"},buffer:!0},sdf:{type:"boolean",buffer:!0},xOffset:{type:"number",precision:1,max:20,min:-20,buffer:!0},yOffset:{type:"number",precision:1,max:20,min:-20,buffer:!0},zOffset:{type:"number",precision:1,max:20,min:-20,buffer:!0},attachment:{type:"select",options:{"bottom-left":"bottom-left","bottom-center":"bottom-center","bottom-right":"bottom-right","middle-left":"middle-left","middle-center":"middle-center","middle-right":"middle-right","top-left":"top-left","top-center":"top-center","top-right":"top-right"},rebuild:!0},showBorder:{type:"boolean",buffer:!0},borderColor:{type:"color",buffer:!0},borderWidth:{type:"number",precision:2,max:.3,min:0,buffer:!0},showBackground:{type:"boolean",rebuild:!0},backgroundColor:{type:"color",buffer:!0},backgroundMargin:{type:"number",precision:2,max:2,min:0,rebuild:!0},backgroundOpacity:{type:"range",step:.01,max:1,min:0,buffer:!0}},Xa.prototype.parameters,{side:null,flatShaded:null,wireframe:null,linewidth:null,roughness:null,metalness:null,diffuse:null}),init:function(t){var e=t||{};this.labelType=d(e.labelType,"res"),this.labelText=d(e.labelText,{}),this.fontFamily=d(e.fontFamily,"sans-serif"),this.fontStyle=d(e.fontStyle,"normal"),this.fontWeight=d(e.fontWeight,"bold"),this.sdf=d(e.sdf,"Chrome"===Jg),this.xOffset=d(e.xOffset,0),this.yOffset=d(e.yOffset,0),this.zOffset=d(e.zOffset,.5),this.attachment=d(e.attachment,"bottom-left"),this.showBorder=d(e.showBorder,!1),this.borderColor=d(e.borderColor,"lightgrey"),this.borderWidth=d(e.borderWidth,.15),this.showBackground=d(e.showBackground,!1),this.backgroundColor=d(e.backgroundColor,"lightgrey"),this.backgroundMargin=d(e.backgroundMargin,.5),this.backgroundOpacity=d(e.backgroundOpacity,1),Xa.prototype.init.call(this,e)},createData:function(t){var e={position:!0,color:!0,radius:!0},i=t.getAtomData(this.getAtomParams(e)),n=[],r=new Us(this.labelType,this.labelText);t.eachAtom(function(t){n.push(r.atomLabel(t))});var o=new Is(i.position,i.radius,i.color,n,this.getBufferParams({fontFamily:this.fontFamily,fontStyle:this.fontStyle,fontWeight:this.fontWeight,sdf:this.sdf,xOffset:this.xOffset,yOffset:this.yOffset,zOffset:this.zOffset,attachment:this.attachment,showBorder:this.showBorder,borderColor:this.borderColor,borderWidth:this.borderWidth,showBackground:this.showBackground,backgroundColor:this.backgroundColor,backgroundMargin:this.backgroundMargin,backgroundOpacity:this.backgroundOpacity}));return{bufferList:[o]}},updateData:function(t,e){var i=e.sview.getAtomData(this.getAtomParams(t)),n={};t&&!t.position||(n.position=i.position),t&&!t.radius||(n.size=i.radius),t&&!t.color||(n.color=i.color),e.bufferList[0].setAttributes(n)}}),cv.add("label",js),$s.prototype=Object.assign(Object.create(Xa.prototype),{constructor:$s,type:"line",parameters:Object.assign({multipleBond:{type:"select",rebuild:!0,options:{off:"off",symmetric:"symmetric",offset:"offset"}},bondSpacing:{type:"number",precision:2,max:2,min:.5}},Ba.prototype.parameters,{flatShaded:null,side:null,wireframe:null,roughness:null,metalness:null,diffuse:null}),init:function(t){var e=t||{};this.multipleBond=d(e.multipleBond,"off"),this.bondSpacing=d(e.bondSpacing,1),Xa.prototype.init.call(this,e)},getBondParams:function(t,e){return e=Object.assign({multipleBond:this.multipleBond,bondSpacing:this.bondSpacing, -radiusParams:{radius:.1,scale:1}},e),Xa.prototype.getBondParams.call(this,t,e)},createData:function(t){var e={position:!0,color:!0},i=t.getBondData(this.getBondParams(e)),n=new qa(i.position1,i.position2,i.color1,i.color2,this.getBufferParams());return{bufferList:[n]}},updateData:function(t,e){var i=e.sview.getBondData(this.getBondParams(t)),n={};t&&!t.position||(n.from=i.position1,n.to=i.position2),t&&!t.color||(n.color=i.color1,n.color2=i.color2),e.bufferList[0].setAttributes(n)},setParameters:function(t){var e=!1,i={};return t&&t.bondSpacing&&(i.position=!0),Xa.prototype.setParameters.call(this,t,i,e),this}}),cv.add("line",$s),Gs.__deps=[la,ha,da,Or,Vs],Ws.__deps=[la,da,yr,Or,Vr,zr,Gr,Hs,d],ov.add("molsurf",function(t,e){var i=t.data.args,n=t.data.params;if(i&&n){var r="av"===n.type?Ws:Gs,o=new r(i.coordList,i.radiusList,i.indexList),a=o.getSurface(n.type,n.probeRadius,n.scaleFactor,n.cutoff,!0,n.smooth),s=[a.position.buffer,a.index.buffer];a.normal&&s.push(a.normal.buffer),a.atomindex&&s.push(a.atomindex.buffer),e({sd:a,p:n},s)}},[Gs,Ws]),Xs.prototype={getAtomData:function(){return this.structure.getAtomData({what:{position:!0,radius:!0,index:!0},radiusParams:{radius:"vdw",scale:1}})},makeSurface:function(t,e){var i=new ia("","",t);return i.info.type=e.type,i.info.probeRadius=e.probeRadius,i.info.scaleFactor=e.scaleFactor,i.info.smooth=e.smooth,i.info.cutoff=e.cutoff,i},getSurface:function(t){var e=t||{},i=this.getAtomData(),n=i.position,r=i.radius,o=i.index,a="av"===e.type?Ws:Gs,s=new a(n,r,o),c=s.getSurface(e.type,e.probeRadius,e.scaleFactor,e.cutoff,!0,e.smooth);return this.makeSurface(c,e)},getSurfaceWorker:function(t,e){var i=Object.assign({},t);if(window.Worker){void 0===this.worker&&(this.worker=new na("molsurf"));var n=this.getAtomData(),r=n.position,o=n.radius,a=n.index,s={args:{coordList:r,radiusList:o,indexList:a},params:i},c=[r.buffer,o.buffer,a.buffer];this.worker.post(s,c,function(t){var n=t.data.sd;e(this.makeSurface(n,i))}.bind(this),function(t){console.warn("MolecularSurface.getSurfaceWorker error - trying without worker",t),this.worker.terminate(),this.worker=void 0;var n=this.getSurface(i);e(n)}.bind(this))}else{var u=this.getSurface(i);e(u)}},dispose:function(){this.worker&&this.worker.terminate()}},qs.prototype=Object.assign(Object.create(Xa.prototype),{constructor:qs,type:"surface",parameters:Object.assign({surfaceType:{type:"select",rebuild:!0,options:{vws:"vws",sas:"sas",ms:"ms",ses:"ses",av:"av"}},probeRadius:{type:"number",precision:1,max:20,min:0,rebuild:!0},smooth:{type:"integer",precision:1,max:10,min:0,rebuild:!0},scaleFactor:{type:"number",precision:1,max:5,min:0,rebuild:!0},cutoff:{type:"number",precision:2,max:50,min:0,rebuild:!0},background:{type:"boolean",rebuild:!0},opaqueBack:{type:"boolean",buffer:!0},filterSele:{type:"text"},volume:{type:"hidden"},useWorker:{type:"boolean",rebuild:!0}},Xa.prototype.parameters,{radiusType:null,radius:null,scale:null}),init:function(t){var e=t||{};e.colorScheme=d(e.colorScheme,"uniform"),e.colorValue=d(e.colorValue,14540253),this.surfaceType=d(e.surfaceType,"ms"),this.probeRadius=d(e.probeRadius,1.4),this.smooth=d(e.smooth,2),this.scaleFactor=d(e.scaleFactor,2),this.cutoff=d(e.cutoff,0),this.background=d(e.background,!1),this.opaqueBack=d(e.opaqueBack,!0),this.filterSele=d(e.filterSele,""),this.volume=d(e.volume,void 0),this.useWorker=d(e.useWorker,!0),Xa.prototype.init.call(this,t)},prepareData:function(t,e,i){var n=this.__infoList[e];if(n||(n={},this.__infoList[e]=n),n.molsurf&&n.sele===t.selection.string)i(e);else{n.sele=t.selection.string,n.molsurf=new Xs(t);var r=this.getSurfaceParams(),o=function(t){n.surface=t,i(e)};this.useWorker?n.molsurf.getSurfaceWorker(r,o):o(n.molsurf.getSurface(r))}},prepare:function(t){if((this.__forceNewMolsurf||this.__sele!==this.selection.string||this.__surfaceParams!==JSON.stringify(this.getSurfaceParams()))&&(this.__infoList.forEach(function(t){t.molsurf.dispose()}.bind(this)),this.__infoList.length=0),0===this.structureView.atomCount)return void t();var e=function(){this.__sele=this.selection.string,this.__surfaceParams=JSON.stringify(this.getSurfaceParams()),this.__forceNewMolsurf=!1,t()}.bind(this),i="default"===this.assembly?this.defaultAssembly:this.assembly,n=this.structure.biomolDict[i];n?n.partList.forEach(function(t,i){var r=t.getView(this.structureView);this.prepareData(r,i,function(t){t===n.partList.length-1&&e()}.bind(this))},this):this.prepareData(this.structureView,0,e)},createData:function(t,e){var i=this.__infoList[e],n=new ja(i.surface.getPosition(),i.surface.getColor(this.getColorParams()),i.surface.getFilteredIndex(this.filterSele,t),i.surface.getNormal(),i.surface.getPickingColor(this.getColorParams()),this.getBufferParams({background:this.background,opaqueBack:this.opaqueBack,dullInterior:!1})),r=new $a(n);return{bufferList:[r],info:i}},updateData:function(t,e){var i={};return t.position?(this.__forceNewMolsurf=!0,void this.build()):(t.color&&(i.color=e.info.surface.getColor(this.getColorParams())),t.index&&(i.index=e.info.surface.getFilteredIndex(this.filterSele,e.sview)),void e.bufferList[0].setAttributes(i))},setParameters:function(t,e,i){return e=e||{},t&&t.filterSele&&(e.index=!0),t&&void 0!==t.volume&&(e.color=!0),Xa.prototype.setParameters.call(this,t,e,i),this},getSurfaceParams:function(t){var e=Object.assign({type:this.surfaceType,probeRadius:this.probeRadius,scaleFactor:this.scaleFactor,smooth:this.smooth,cutoff:this.cutoff,useWorker:this.useWorker},t);return e},getColorParams:function(){var t=Xa.prototype.getColorParams.call(this);return t.volume=this.volume,t},clear:function(){Xa.prototype.clear.call(this)},dispose:function(){this.__infoList.forEach(function(t){t.molsurf.dispose()}.bind(this)),this.__infoList.length=0,Xa.prototype.dispose.call(this)}}),cv.add("surface",qs),Ys.prototype=Object.assign(Object.create(Xa.prototype),{constructor:Ys,type:"point",parameters:Object.assign({pointSize:{type:"number",precision:1,max:100,min:0,buffer:!0},sizeAttenuation:{type:"boolean",buffer:!0},sortParticles:{type:"boolean",rebuild:!0},useTexture:{type:"boolean",buffer:!0},alphaTest:{type:"range",step:.001,max:1,min:0,buffer:!0},forceTransparent:{type:"boolean",buffer:!0},edgeBleach:{type:"range",step:.001,max:1,min:0,buffer:!0}},Ba.prototype.parameters,{flatShaded:null,wireframe:null,linewidth:null,roughness:null,metalness:null}),init:function(t){var e=t||{};this.pointSize=d(e.pointSize,1),this.sizeAttenuation=d(e.sizeAttenuation,!0),this.sortParticles=d(e.sortParticles,!1),this.useTexture=d(e.useTexture,!1),this.alphaTest=d(e.alphaTest,.5),this.forceTransparent=d(e.forceTransparent,!1),this.edgeBleach=d(e.edgeBleach,0),Xa.prototype.init.call(this,e)},createData:function(t){var e={position:!0,color:!0},i=t.getAtomData(this.getAtomParams(e)),n=new Ha(i.position,i.color,this.getBufferParams({pointSize:this.pointSize,sizeAttenuation:this.sizeAttenuation,sortParticles:this.sortParticles,useTexture:this.useTexture,alphaTest:this.alphaTest,forceTransparent:this.forceTransparent,edgeBleach:this.edgeBleach}));return{bufferList:[n]}},updateData:function(t,e){var i=e.sview.getAtomData(this.getAtomParams(t)),n={};t&&!t.position||(n.position=i.position),t&&!t.color||(n.color=i.color),e.bufferList[0].setAttributes(n)}}),cv.add("point",Ys),hv.add("shader/Ribbon.vert","#define STANDARD\nuniform float nearClip;\nuniform vec3 clipCenter;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || !defined( PICKING )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\nattribute vec3 dir;\nattribute float size;\n#ifdef PICKING\nattribute vec3 pickingColor;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#endif\n#include common\nvoid main(void){\n#ifdef PICKING\nvPickingColor = pickingColor;\n#else\n#include color_vertex\n#include beginnormal_vertex\n#include defaultnormal_vertex\n#ifndef FLAT_SHADED\nvNormal = normalize( transformedNormal );\n#endif\n#endif\n#include begin_vertex\ntransformed += normalize( dir ) * size;\n#include project_vertex\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || !defined( PICKING )\nvViewPosition = -mvPosition.xyz;\n#endif\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n}"),Zs.prototype=Object.assign(Object.create(ya.prototype),{constructor:Zs,setAttributes:function(t){var e,i,n,r,o,a,s,c,u,h,l,d,f=this.size,p=f/4,m=this.geometry.attributes;t.position&&(e=t.position,s=m.position.array,m.position.needsUpdate=!0),t.normal&&(i=t.normal,c=m.normal.array,m.normal.needsUpdate=!0),t.size&&(n=t.size,u=m.size.array,m.size.needsUpdate=!0),t.dir&&(r=t.dir,h=m.dir.array,m.dir.needsUpdate=!0),t.color&&(o=t.color,l=m.color.array,m.color.needsUpdate=!0),t.pickingColor&&(a=t.pickingColor,d=m.pickingColor.array,m.pickingColor.needsUpdate=!0);var g,v,y,b,x,_,w,S=n?n[0]:null;for(g=0;gw)continue}f=T.substr(5,5).trim(),p=parseInt(T.substr(0,5)),m=parseInt(T.substr(15,5)),A.growIfFull(),A.atomTypeId[M]=S.add(d),A.x[M]=L,A.y[M]=R,A.z[M]=O,A.serial[M]=m,o.addAtom(P,"","",f,p,0,"l"),M+=1}}}t.Debug&&nv.time("GroParser._parse "+this.name);var i,n,r=this.structure,o=this.structureBuilder,a=this.firstModelOnly,s=this.asTrajectory,c=this.cAlphaOnly,u=r.frames,h=r.boxes,l=this.streamer.peekLines(3);r.title=l[0].trim();var d,f,p,m,g=l[2].length-l[2].lastIndexOf(".")-1,v=5+g,y=20,b=20+v,x=20+2*v,_=parseInt(l[1]),w=_+3,S=r.atomMap,A=r.atomStore;A.resize(_);var M=0,P=0,C=0;this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)}),r.unitcell=new cc(h[0][0],h[0][4],h[0][8],90,90,90,"P 1"),o.finalize(),r.finalizeAtoms(),Fo(r),zo(r),r.finalizeBonds(),ko(r,Lv(r)),Vo(r),t.Debug&&nv.timeEnd("GroParser._parse "+this.name)}}),uv.add("gro",uc);var Fv={1:"h",2:"h",3:"i",4:"h",5:"g",6:"h",7:"h",8:"h",9:"h",10:"h","":"h"};hc.prototype=Object.assign(Object.create(sc.prototype),{constructor:hc,type:"pdb",_parse:function(){function e(t,e,U){for(var Z,K,Q=t;Q0)continue;var J,tt,et,it,nt;if(M){if(it=s.split(P),nt=10===it.length?1:0,m=it[2],L&&"CA"!==m)continue;J=parseFloat(it[6-nt]),tt=parseFloat(it[7-nt]),et=parseFloat(it[8-nt])}else{if(m=s.substr(12,4).trim(),L&&"CA"!==m)continue;J=parseFloat(s.substr(30,8)),tt=parseFloat(s.substr(38,8)),et=parseFloat(s.substr(46,8))}if(I&&(Z=3*n,i[Z+0]=J,i[Z+1]=tt,i[Z+2]=et,n+=1,N))continue;var rt;M?(u=parseInt(it[1]),rt="",g="H"===s[0]?1:0,h=nt?"":it[4],l=parseInt(it[5-nt]),p="",d=it[3],v=parseFloat(it[9-nt]),y="",f=0):(u=parseInt(s.substr(6,5)),rt=s.substr(76,2).trim(),g="H"===s[0]?1:0,h=s[21].trim(),l=parseInt(s.substr(22,4)),p=s[26].trim(),d=s.substr(17,4).trim(),v=parseFloat(s.substr(60,6)),y=s[16].trim(),f=parseFloat(s.substr(54,6))),G.growIfFull(),G.atomTypeId[X]=V.add(m,rt),G.x[X]=J,G.y[X]=tt,G.z[X]=et,G.serial[X]=u,G.bfactor[X]=isNaN(v)?0:v,G.altloc[X]=y.charCodeAt(0),G.occupancy[X]=isNaN(f)?0:f,T.addAtom(q,h,h,d,l,g,void 0,p),F[u]=X,X+=1}else if("CONECT"===c){var ot=F[parseInt(s.substr(6,5))],at=[11,16,21,26],st={};if(void 0===ot)continue;for(Z=0;Z<4;++Z){var ct=parseInt(s.substr(at[Z],5));if(!Number.isNaN(ct)&&(ct=F[ct],void 0!==ct))if(ot0)continue;var ot=nt[c].replace(Uv,"");if(C&&"CA"!==ot)continue;var at=parseFloat(nt[y]),st=parseFloat(nt[b]),ct=parseFloat(nt[x]);if(P){var ut=3*n;if(i[ut+0]=at,i[ut+1]=st,i[ut+2]=ct,n+=1,W>0)continue}var ht=nt[u],lt=parseInt(nt[s]),dt=nt[v];dt="?"===dt?"":dt;var ft=nt[a],pt=nt[h],mt="H"===nt[f][0]?1:0,gt=nt[m],vt=parseFloat(nt[_]),yt=parseFloat(nt[w]),bt=nt[d];if(bt="."===bt?"":bt,V.growIfFull(),V.atomTypeId[H]=$.add(ot,gt),V.x[H]=at,V.y[H]=st,V.z[H]=ct,V.serial[H]=parseInt(nt[p]),V.bfactor[H]=isNaN(vt)?0:vt,V.occupancy[H]=isNaN(yt)?0:yt,V.altloc[H]=bt.charCodeAt(0),A.addAtom(W,ft,pt,ht,lt,mt,void 0,dt),t.Debug){var xt=I[pt];void 0!==xt&&xt!==ft&&nv.warn(xt,ft)}I[pt]=ft;var _t=nt[l];L[_t]||(L[_t]=new Set),L[_t].add(S.chainStore.count-1),H+=1}else{nt=o.match(Bv),it=nt.length,F===k.length&&(F=0);for(var wt=0;wt0&&(h=!0))),w>=m&&w0)continue;var C=parseFloat(P.substr(0,10)),T=parseFloat(P.substr(10,10)),E=parseFloat(P.substr(20,10));if(o){var I=3*c;if(s[I+0]=C,s[I+1]=T,s[I+2]=E,c+=1,h)continue}var L=P.substr(31,3).trim(),R=L+(_+1);d.growIfFull(),d.atomTypeId[_]=l.add(R,L),d.x[_]=C,d.y[_]=T,d.z[_]=E,d.serial[_]=_,n.addAtom(S,"","","HET",1,1),_+=1}if(w>=v&&w0)continue;if(o&&S>0)continue;b.index=parseInt(P.substr(0,3))-1+A,x.index=parseInt(P.substr(3,3))-1+A;var O=parseInt(P.substr(6,3));i.bondStore.addBond(b,x,O)}++w}}t.Debug&&nv.time("SdfParser._parse "+this.name);var i=this.structure,n=this.structureBuilder,r=this.firstModelOnly,o=this.asTrajectory,a=this.streamer.peekLines(2);i.id=a[0].trim(),i.title=a[1].trim();var s,c,u=i.frames,h=!1,l=i.atomMap,d=i.atomStore;d.resize(Math.round(this.streamer.data.length/50));var f,p,m,g,v,y,b=i.getAtomProxy(),x=i.getAtomProxy(),_=0,w=0,S=0,A=0;this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)}),n.finalize(),i.finalizeAtoms(),i.finalizeBonds(),Go(i),t.Debug&&nv.timeEnd("SdfParser._parse "+this.name)},_postProcess:function(){Go(this.structure)}}),uv.add("sdf",wc),Sc.prototype=Object.assign(Object.create(sc.prototype),{constructor:Sc,type:"mol2",_parse:function(){function e(t,e,M){for(var P,C=t;CMOLECULE"===T?(y=b,p=0,++g):"@ATOM"===T?(y=x,m=d.count,c&&(n=0,i=new Float32Array(3*v),u.push(i),g>0&&(h=!0))):y="@BOND"===T?_:0;else if(y===b)0===p?(o.title=T,o.id=T):1===p&&(P=T.split(r),v=parseInt(P[0])),++p;else if(y===x){if(P=T.split(r),s&&g>0)continue;var E=parseFloat(P[2]),I=parseFloat(P[3]),L=parseFloat(P[4]);if(c){var R=3*n;if(i[R+0]=E,i[R+1]=I,i[R+2]=L,n+=1,h)continue}var O=P[0],D=P[1],N=P[5].split(".")[0],k=P[6]?parseInt(P[6]):1,F=P[7]?P[7]:"",z=P[8]?parseFloat(P[8]):0;d.growIfFull(),d.atomTypeId[f]=l.add(D,N),d.x[f]=E,d.y[f]=I,d.z[f]=L,d.serial[f]=O,d.bfactor[f]=z,a.addAtom(g,"","",F,k,1),f+=1}else if(y===_){if(s&&g>0)continue;if(c&&g>0)continue;P=T.split(r),w.index=parseInt(P[1])-1+m,S.index=parseInt(P[2])-1+m;var B=A[P[3]];o.bondStore.addBond(w,S,B)}}}t.Debug&&nv.time("Mol2Parser._parse "+this.name);var i,n,r=/\s+/,o=this.structure,a=this.structureBuilder,s=this.firstModelOnly,c=this.asTrajectory,u=o.frames,h=!1,l=o.atomMap,d=o.atomStore;d.resize(Math.round(this.streamer.data.length/60));var f=0,p=0,m=0,g=-1,v=0,y=0,b=1,x=2,_=3,w=o.getAtomProxy(),S=o.getAtomProxy(),A={1:1,2:2,3:3,am:1,ar:1,du:1,un:1,nc:0};this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)}),a.finalize(),o.finalizeAtoms(),Fo(o),jo(o,!0),$o(o,!0),o.finalizeBonds(),Go(o),ko(o,Lv(o)),t.Debug&&nv.timeEnd("Mol2Parser._parse "+this.name)}}),uv.add("mol2",Sc);var $v=["mmtfVersion","mmtfProducer","unitCell","spaceGroup","structureId","title","depositionDate","releaseDate","experimentalMethods","resolution","rFree","rWork","bioAssemblyList","ncsOperatorList","entityList","groupList","numBonds","numAtoms","numGroups","numChains","numModels","groupsPerChain","chainsPerModel"],Vv=["xCoordList","yCoordList","zCoordList","groupIdList","groupTypeList","chainIdList","bFactorList","atomIdList","altLocList","occupancyList","secStructList","insCodeList","sequenceIndexList","chainNameList","bondAtomList","bondOrderList"],Gv=$v.concat(Vv),Hv={0:"i".charCodeAt(0),1:"s".charCodeAt(0),2:"h".charCodeAt(0),3:"e".charCodeAt(0),4:"g".charCodeAt(0),5:"b".charCodeAt(0),6:"t".charCodeAt(0),7:"l".charCodeAt(0),"-1":"".charCodeAt(0)};Wc.prototype=Object.assign(Object.create(sc.prototype),{constructor:Wc,type:"mmtf",_parse:function(){t.Debug&&nv.time("MmtfParser._parse "+this.name);var e,i,n,r,o,a=this.structure,s=Hc(Vc(this.streamer.data)),c=["depositionDate","releaseDate","resolution","rFree","rWork","experimentalMethods"];c.forEach(function(t){void 0!==s[t]&&(a.header[t]=s[t])});var u,h,l,d,f,p;if(a.id=s.structureId,a.title=s.title,this.firstModelOnly||this.asTrajectory){for(f=1,d=s.chainsPerModel[0],l=0,e=0,i=d;e0&&(a.biomolDict[st]=ct)}s.unitCell&&Array.isArray(s.unitCell)&&s.unitCell[0]?a.unitcell=new cc(s.unitCell[0],s.unitCell[1],s.unitCell[2],s.unitCell[3],s.unitCell[4],s.unitCell[5],s.spaceGroup):a.unitcell=void 0,t.Debug&&nv.timeEnd("MmtfParser._parse "+this.name),$o(a,!0),jo(a,!0),a.finalizeAtoms(),a.finalizeBonds(),Vo(a)}}),uv.add("mmtf",Wc),Xc.prototype={constructor:Xc},qc.prototype=Object.assign(Object.create(oc.prototype),{constructor:qc,type:"trajectory",__objName:"frames"}),Yc.prototype=Object.assign(Object.create(qc.prototype),{constructor:Yc,type:"dcd",_parse:function(){t.Debug&&nv.time("DcdParser._parse "+this.name);var e=this.streamer.data;e instanceof Uint8Array&&(e=e.buffer);var i,n,r=new DataView(e),o=this.frames,a=o.coordinates,s=o.boxes,c={},u=0,h=new Int32Array(e,0,23),l=h[0]!==r.getInt32(0);if(84!==h[0])for(n=e.byteLength,i=0;i0)return void nv.error("dcd format with fixed atoms unsupported, aborting");var y=c.NATOM,b=4*y;for(i=0,n=c.NSET;i=o.atomCount+6){r=r.split(a);for(var s=0,l=r.length;sa){var r=i[n].trim();if(""!==r)for(var o=r.split(s),d=0,f=o.length;d=n.elements[s].count&&(s++,c=0);var l=this.parseASCIIElement(n.elements[s].properties,h);this.handleElement(i,n.elements[s].name,l),c++}}return this.postProcess(i)},postProcess:function(t){if(t.useColor){for(var e=0;e=0?i-1:i+e/3)},parseNormalIndex:function(t,e){var i=parseInt(t,10);return 3*(i>=0?i-1:i+e/3)},addVertex:function(t,e,i){var n=this.vertices,r=this.object.geometry.vertices;r.push(n[t+0]),r.push(n[t+1]),r.push(n[t+2]),r.push(n[e+0]),r.push(n[e+1]),r.push(n[e+2]),r.push(n[i+0]),r.push(n[i+1]),r.push(n[i+2])},addVertexLine:function(t){var e=this.vertices,i=this.object.geometry.vertices;i.push(e[t+0]),i.push(e[t+1]),i.push(e[t+2])},addNormal:function(t,e,i){var n=this.normals,r=this.object.geometry.normals;r.push(n[t+0]),r.push(n[t+1]),r.push(n[t+2]),r.push(n[e+0]),r.push(n[e+1]),r.push(n[e+2]),r.push(n[i+0]),r.push(n[i+1]),r.push(n[i+2])},addFace:function(t,e,i,n,r,o,a,s){var c,u=this.vertices.length,h=this.parseVertexIndex(t,u),l=this.parseVertexIndex(e,u),d=this.parseVertexIndex(i,u);if(void 0===n?this.addVertex(h,l,d):(c=this.parseVertexIndex(n,u),this.addVertex(h,l,c),this.addVertex(l,d,c)),void 0!==r){var f=this.normals.length;h=this.parseNormalIndex(r,f),l=r===o?h:this.parseNormalIndex(o,f),d=r===a?h:this.parseNormalIndex(a,f),void 0===n?this.addNormal(h,l,d):(c=this.parseNormalIndex(s,f),this.addNormal(h,l,c),this.addNormal(l,d,c))}},addLineGeometry:function(t){this.object.geometry.type="Line";for(var e=this.vertices.length,i=0,n=t.length;i0?_.addAttribute("normal",new Kt(new Float32Array(x.normals),3)):_.computeVertexNormals(),y.push(_)}}return y}},ou.prototype=Object.assign(Object.create(eu.prototype),{constructor:ou,type:"obj"}),uv.add("obj",ou),au.prototype=Object.assign(Object.create(oc.prototype),{constructor:au,type:"text",__objName:"text",_parse:function(){this.text.data=this.streamer.asText()}}),uv.add("txt",au),uv.add("text",au),su.prototype=Object.assign(Object.create(oc.prototype),{constructor:su,type:"csv",__objName:"table",_parse:function(){var t=this.table.data,e=/\s*,\s*/;this.streamer.eachChunkOfLines(function(i,n){for(var r=i.length,o=0;o");){var i=o();if(!i)return e;e.attributes[i.name]=i.value}return s(/\?>\s*/),e}}function n(){var t=s(/^<([\w-:.]+)\s*/);if(t){for(var e={name:t[1],attributes:{},children:[]};!(c()||u(">")||u("?>")||u("/>"));){var i=o();if(!i)return e;e.attributes[i.name]=i.value}if(s(/^\s*\/>\s*/))return e;s(/\??>\s*/),e.content=r();for(var a;a=n();)e.children.push(a);return s(/^<\/[\w-:.]+>\s*/),e}}function r(){var t=s(/^([^<]*)/);return t?t[1]:""}function o(){var t=s(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(t)return{name:t[1],value:a(t[2])}}function a(t){return t.replace(/^['"]|['"]$/g,"")}function s(e){var i=t.match(e);if(i)return t=t.slice(i[0].length),i}function c(){return 0===t.length}function u(e){return 0===t.indexOf(e)}return t=t.trim(),t=t.replace(//g,""),e()},__domParser:function(t){var e=new window.DOMParser;return e.parseFromString(t,"text/xml")},_parse:function(){t.Debug&&nv.time("XmlParser._parse "+this.name),this.useDomParser?this.streamer.isBinary()||this.string?this.xml.data=this.__domParser(this.streamer.asText()):this.xml.data=this.streamer.data:this.xml.data=this.__xmlParser(this.streamer.asText()),t.Debug&&nv.timeEnd("XmlParser._parse "+this.name)}}),uv.add("xml",uu);var Wv,Xv,qv=mu(),Yv=30,Zv=12,Kv=15,Qv=852,Jv=592,ty=0,ey=1,iy=2,ny=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],ry=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],oy=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],ay=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],sy=0,cy=1,uy=2,hy=4,ly=5,dy=6,fy=0,py=1,my=2,gy=-2,vy=-3,yy=-4,by=-5,xy=8,_y=1,wy=2,Sy=3,Ay=4,My=5,Py=6,Cy=7,Ty=8,Ey=9,Iy=10,Ly=11,Ry=12,Oy=13,Dy=14,Ny=15,ky=16,Fy=17,zy=18,By=19,Uy=20,jy=21,$y=22,Vy=23,Gy=24,Hy=25,Wy=26,Xy=27,qy=28,Yy=29,Zy=30,Ky=31,Qy=32,Jy=852,tb=592,eb=!0,ib=!0,nb=!0;try{String.fromCharCode.apply(null,[0])}catch(t){ib=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){nb=!1}for(var rb=new Uint8Array(256),ob=0;ob<256;ob++)rb[ob]=ob>=252?6:ob>=248?5:ob>=240?4:ob>=224?3:ob>=192?2:1;rb[254]=rb[254]=1;var ab=0,sb=2,cb=4,ub=0,hb=1,lb=2,db=-5,fb={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},pb=Object.prototype.toString;zu.prototype.push=function(t,e){var i,n,r,o,a,s,c=this.strm,u=this.options.chunkSize,h=this.options.dictionary,l=!1;if(this.ended)return!1;n=e===~~e?e:e===!0?cb:ab,"string"==typeof t?c.input=Ou(t):"[object ArrayBuffer]"===pb.call(t)?c.input=new Uint8Array(t):c.input=t,c.next_in=0,c.avail_in=c.input.length;do{if(0===c.avail_out&&(c.output=new Uint8Array(u),c.next_out=0,c.avail_out=u),i=Cu(c,ab),i===lb&&h&&(s="string"==typeof h?Lu(h):"[object ArrayBuffer]"===pb.call(h)?new Uint8Array(h):h,i=Iu(this.strm,s)),i===db&&l===!0&&(i=ub,l=!1),i!==hb&&i!==ub)return this.onEnd(i),this.ended=!0,!1;c.next_out&&(0!==c.avail_out&&i!==hb&&(0!==c.avail_in||n!==cb&&n!==sb)||("string"===this.options.to?(r=Nu(c.output,c.next_out),o=c.next_out-r,a=Du(c.output,r),c.next_out=o,c.avail_out=u-o,o&&du(c.output,c.output,r,o,0),this.onData(a)):this.onData(lu(c.output,c.next_out)))),0===c.avail_in&&0===c.avail_out&&(l=!0)}while((c.avail_in>0||0===c.avail_out)&&i!==hb);return i===hb&&(n=cb),n===cb?(i=Tu(this.strm),this.onEnd(i),this.ended=!0,i===ub):n!==sb||(this.onEnd(ub),c.avail_out=0,!0)},zu.prototype.onData=function(t){this.chunks.push(t)},zu.prototype.onEnd=function(t){t===ub&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=fu(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},lv.add("gz",Uu);var mb="//files.rcsb.org/download/",gb="//mmtf.rcsb.org/v1.0/",vb=gb+"full/",yb=gb+"reduced/";sv.add("rcsb",new ju);var bb="//pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/",xb="/SDF?record_type=3d";sv.add("pubchem",new $u),sv.add("ftp",new Vu),sv.add("http",new Vu),sv.add("https",new Vu);var _b="0.9.2";window.Promise||(window.Promise=n),t.Version=_b,t.setDebug=qn,t.DatasourceRegistry=sv,t.StaticDatasource=Gu,t.ParserRegistry=uv,t.autoLoad=rr,t.RepresentationRegistry=cv,t.ColorMakerRegistry=av,t.ColorMaker=Mn,t.Selection=_n,t.PdbWriter=cr,t.Stage=ms,t.Collection=Ja,t.ComponentCollection=ts,t.RepresentationCollection=es,t.Assembly=Do,t.TrajectoryPlayer=gs,t.superpose=us,t.guessElement=Rv,t.Queue=pa,t.Counter=ur,t.throttle=b,t.download=v,t.getQuery=h,t.getDataInfo=nr,t.getFileInfo=y,t.uniqueArray=x,t.BufferRepresentation=Ua,t.SphereBuffer=Ta,t.EllipsoidBuffer=Ia,t.CylinderBuffer=Da,t.ConeBuffer=ka,t.ArrowBuffer=Fa,t.Shape=za,t.Kdtree=Lo,t.SpatialHash=bo,t.Signal=xn,t.Matrix3=Lt,t.Matrix4=O,t.Vector3=N,t.Quaternion=D,t.Plane=Rt,t.Color=Ct,Object.defineProperty(t,"__esModule",{value:!0})}); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.NGL=t.NGL||{})}(this,function(t){"use strict";function e(){}function i(t,e){return function(){t.apply(e,arguments)}}function n(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],h(t,this)}function r(t,e){for(;3===t._state;)t=t._value;return 0===t._state?void t._deferreds.push(e):(t._handled=!0,void ru(function(){var i=1===t._state?e.onFulfilled:e.onRejected;if(null===i)return void(1===t._state?o:a)(e.promise,t._value);var n;try{n=i(t._value)}catch(t){return void a(e.promise,t)}o(e.promise,n)}))}function o(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var r=e.then;if(e instanceof n)return t._state=3,t._value=e,void s(t);if("function"==typeof r)return void h(i(r,e),t)}t._state=1,t._value=e,s(t)}catch(e){a(t,e)}}function a(t,e){t._state=2,t._value=e,s(t)}function s(t){2===t._state&&0===t._deferreds.length&&ru(function(){t._handled||ou(t._value)});for(var e=0,i=t._deferreds.length;e1?c.pop().toLowerCase():"",u=e.match(/^(.+):\/\/(.+)$/);u&&(n=u[1].toLowerCase(),e=u[2]);var l=e.substring(0,e.lastIndexOf("/")+1);if(r.includes(h)){i=h;var d=e.length-h.length-1;h=e.substr(0,d).split(".").pop().toLowerCase();var f=s.length-h.length-1;s=s.substr(0,f)}else i=!1;return{path:e,name:a,ext:h,base:s,dir:l,compressed:i,protocol:n,src:t}}function b(t,e,i){var n,r,o,a=null,s=0;i||(i={});var c=function(){s=i.leading===!1?0:Date.now(),a=null,o=t.apply(n,r),a||(n=r=null)};return function(){var h=Date.now();s||i.leading!==!1||(s=h);var u=e-(h-s);return n=this,r=arguments,u<=0||u>e?(a&&(clearTimeout(a),a=null),s=h,o=t.apply(n,r),a||(n=r=null)):a||i.trailing===!1||(a=setTimeout(c,u)),o}}function x(t){return t.sort().filter(function(t,e,i){return 0===e||t!==i[e-1]})}function w(t){var e=28672;if(t.length>e){for(var i=[],n=0;n0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function D(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._w=void 0!==n?n:1}function N(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0}function k(t,e){function i(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),e=new Uint16Array([0,1,2,0,2,3]);o=l.createBuffer(),a=l.createBuffer(),l.bindBuffer(l.ARRAY_BUFFER,o),l.bufferData(l.ARRAY_BUFFER,t,l.STATIC_DRAW),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,a),l.bufferData(l.ELEMENT_ARRAY_BUFFER,e,l.STATIC_DRAW),s=n(),c={position:l.getAttribLocation(s,"position"),uv:l.getAttribLocation(s,"uv")},h={uvOffset:l.getUniformLocation(s,"uvOffset"),uvScale:l.getUniformLocation(s,"uvScale"),rotation:l.getUniformLocation(s,"rotation"),scale:l.getUniformLocation(s,"scale"),color:l.getUniformLocation(s,"color"),map:l.getUniformLocation(s,"map"),opacity:l.getUniformLocation(s,"opacity"),modelViewMatrix:l.getUniformLocation(s,"modelViewMatrix"),projectionMatrix:l.getUniformLocation(s,"projectionMatrix"),fogType:l.getUniformLocation(s,"fogType"),fogDensity:l.getUniformLocation(s,"fogDensity"),fogNear:l.getUniformLocation(s,"fogNear"),fogFar:l.getUniformLocation(s,"fogFar"),fogColor:l.getUniformLocation(s,"fogColor"),alphaTest:l.getUniformLocation(s,"alphaTest")};var i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");i.width=8,i.height=8;var r=i.getContext("2d");r.fillStyle="white",r.fillRect(0,0,8,8),u=new L(i),u.needsUpdate=!0}function n(){var e=l.createProgram(),i=l.createShader(l.VERTEX_SHADER),n=l.createShader(l.FRAGMENT_SHADER);return l.shaderSource(i,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),l.shaderSource(n,["precision "+t.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),l.compileShader(i),l.compileShader(n),l.attachShader(e,i),l.attachShader(e,n),l.linkProgram(e),e}function r(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var o,a,s,c,h,u,l=t.context,d=t.state,f=new N,p=new D,m=new N;this.render=function(n,g){if(0!==e.length){void 0===s&&i(),l.useProgram(s),d.initAttributes(),d.enableAttribute(c.position),d.enableAttribute(c.uv),d.disableUnusedAttributes(),d.disable(l.CULL_FACE),d.enable(l.BLEND),l.bindBuffer(l.ARRAY_BUFFER,o),l.vertexAttribPointer(c.position,2,l.FLOAT,!1,16,0),l.vertexAttribPointer(c.uv,2,l.FLOAT,!1,16,8),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,a),l.uniformMatrix4fv(h.projectionMatrix,!1,g.projectionMatrix.elements),d.activeTexture(l.TEXTURE0),l.uniform1i(h.map,0);var v=0,y=0,b=n.fog;b?(l.uniform3f(h.fogColor,b.color.r,b.color.g,b.color.b),b&&b.isFog?(l.uniform1f(h.fogNear,b.near),l.uniform1f(h.fogFar,b.far),l.uniform1i(h.fogType,1),v=1,y=1):b&&b.isFogExp2&&(l.uniform1f(h.fogDensity,b.density),l.uniform1i(h.fogType,2),v=2,y=2)):(l.uniform1i(h.fogType,0),v=0,y=0);for(var x=0,w=e.length;x.001&&E.scale>.001&&(w.x=E.x,w.y=E.y,w.z=E.z,b=E.size*E.scale/p.w,x.x=b*g,x.y=b,d.uniform3f(h.screenPosition,w.x,w.y,w.z),d.uniform2f(h.scale,x.x,x.y),d.uniform1f(h.rotation,E.rotation),d.uniform1f(h.opacity,E.opacity),d.uniform3f(h.color,E.color.r,E.color.g,E.color.b),f.setBlending(E.blending,E.blendEquation,E.blendSrc,E.blendDst),t.setTexture2D(E.texture,1),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0))}}}f.enable(d.CULL_FACE),f.enable(d.DEPTH_TEST),f.setDepthWrite(!0),t.resetGLState()}}}function B(t,e,i,n,r,o,a,s,c,h){t=void 0!==t?t:[],e=void 0!==e?e:sl,L.call(this,t,e,i,n,r,o,a,s,c,h),this.flipY=!1}function U(){this.seq=[],this.map={}}function j(t,e,i){var n=t[0];if(n<=0||n>0)return t;var r=e*i,o=_d[r];if(void 0===o&&(o=new Float32Array(r),_d[r]=o),0!==e){n.toArray(o,0);for(var a=1,s=0;a!==e;++a)s+=i,t[a].toArray(o,s)}return o}function $(t,e){var i=Sd[e];void 0===i&&(i=new Int32Array(e),Sd[e]=i);for(var n=0;n!==e;++n)i[n]=t.allocTextureUnit();return i}function V(t,e){t.uniform1f(this.addr,e)}function G(t,e){t.uniform1i(this.addr,e)}function H(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function W(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function X(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function q(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function Y(t,e){t.uniformMatrix3fv(this.addr,!1,e.elements||e)}function Z(t,e){t.uniformMatrix4fv(this.addr,!1,e.elements||e)}function K(t,e,i){var n=i.allocTextureUnit();t.uniform1i(this.addr,n),i.setTexture2D(e||xd,n)}function Q(t,e,i){var n=i.allocTextureUnit();t.uniform1i(this.addr,n),i.setTextureCube(e||wd,n)}function J(t,e){t.uniform2iv(this.addr,e)}function tt(t,e){t.uniform3iv(this.addr,e)}function et(t,e){t.uniform4iv(this.addr,e)}function it(t){switch(t){case 5126:return V;case 35664:return H;case 35665:return W;case 35666:return X;case 35674:return q;case 35675:return Y;case 35676:return Z;case 35678:return K;case 35680:return Q;case 5124:case 35670:return G;case 35667:case 35671:return J;case 35668:case 35672:return tt;case 35669:case 35673:return et}}function nt(t,e){t.uniform1fv(this.addr,e)}function rt(t,e){t.uniform1iv(this.addr,e)}function ot(t,e){t.uniform2fv(this.addr,j(e,this.size,2))}function at(t,e){t.uniform3fv(this.addr,j(e,this.size,3))}function st(t,e){t.uniform4fv(this.addr,j(e,this.size,4))}function ct(t,e){t.uniformMatrix2fv(this.addr,!1,j(e,this.size,4))}function ht(t,e){t.uniformMatrix3fv(this.addr,!1,j(e,this.size,9))}function ut(t,e){t.uniformMatrix4fv(this.addr,!1,j(e,this.size,16))}function lt(t,e,i){var n=e.length,r=$(i,n);t.uniform1iv(this.addr,r);for(var o=0;o!==n;++o)i.setTexture2D(e[o]||xd,r[o])}function dt(t,e,i){var n=e.length,r=$(i,n);t.uniform1iv(this.addr,r);for(var o=0;o!==n;++o)i.setTextureCube(e[o]||wd,r[o])}function ft(t){switch(t){case 5126:return nt;case 35664:return ot;case 35665:return at;case 35666:return st;case 35674:return ct;case 35675:return ht;case 35676:return ut;case 35678:return lt;case 35680:return dt;case 5124:case 35670:return rt;case 35667:case 35671:return J;case 35668:case 35672:return tt;case 35669:case 35673:return et}}function pt(t,e,i){this.id=t,this.addr=i,this.setValue=it(e.type)}function mt(t,e,i){this.id=t,this.addr=i,this.size=e.size,this.setValue=ft(e.type)}function gt(t){this.id=t,U.call(this)}function vt(t,e){t.seq.push(e),t.map[e.id]=e}function yt(t,e,i){var n=t.name,r=n.length;for(Ad.lastIndex=0;;){var o=Ad.exec(n),a=Ad.lastIndex,s=o[1],c="]"===o[2],h=o[3];if(c&&(s=0|s),void 0===h||"["===h&&a+2===r){vt(i,void 0===h?new pt(s,t,e):new mt(s,t,e));break}var u=i.map,l=u[s];void 0===l&&(l=new gt(s),vt(i,l)),i=l}}function bt(t,e,i){U.call(this),this.renderer=i;for(var n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r=0;r!==n;++r){var o=t.getActiveUniform(e,r),a=o.name,s=t.getUniformLocation(e,a);yt(o,s,this)}}function xt(t,e,i,n,r,o,a){function s(t,e){if(t.width>e||t.height>e){var i=e/Math.max(t.width,t.height),n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");n.width=Math.floor(t.width*i),n.height=Math.floor(t.height*i);var r=n.getContext("2d");return r.drawImage(t,0,0,t.width,t.height,0,0,n.width,n.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+n.width+"x"+n.height,t),n}return t}function c(t){return yd.isPowerOfTwo(t.width)&&yd.isPowerOfTwo(t.height)}function h(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");e.width=yd.nearestPowerOfTwo(t.width),e.height=yd.nearestPowerOfTwo(t.height);var i=e.getContext("2d");return i.drawImage(t,0,0,e.width,e.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+e.width+"x"+e.height,t),e}return t}function u(t){return t.wrapS!==ml||t.wrapT!==ml||t.minFilter!==vl&&t.minFilter!==xl}function l(e){return e===vl||e===yl||e===bl?t.NEAREST:t.LINEAR}function d(t){var e=t.target;e.removeEventListener("dispose",d),p(e),C.textures--}function f(t){var e=t.target;e.removeEventListener("dispose",f),m(e),C.textures--}function p(e){var i=n.get(e);if(e.image&&i.__image__webglTextureCube)t.deleteTexture(i.__image__webglTextureCube);else{if(void 0===i.__webglInit)return;t.deleteTexture(i.__webglTexture)}n.delete(e)}function m(e){var i=n.get(e),r=n.get(e.texture);if(e){if(void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e&&e.isWebGLRenderTargetCube)for(var o=0;o<6;o++)t.deleteFramebuffer(i.__webglFramebuffer[o]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[o]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer);n.delete(e.texture),n.delete(e)}}function g(e,r){var o=n.get(e);if(e.version>0&&o.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(a.complete!==!1)return void x(o,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}i.activeTexture(t.TEXTURE0+r),i.bindTexture(t.TEXTURE_2D,o.__webglTexture)}function v(e,a){var h=n.get(e);if(6===e.image.length)if(e.version>0&&h.__version!==e.version){h.__image__webglTextureCube||(e.addEventListener("dispose",d),h.__image__webglTextureCube=t.createTexture(),C.textures++),i.activeTexture(t.TEXTURE0+a),i.bindTexture(t.TEXTURE_CUBE_MAP,h.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var u=e&&e.isCompressedTexture,l=e.image[0]&&e.image[0].isDataTexture,f=[],p=0;p<6;p++)u||l?f[p]=l?e.image[p].image:e.image[p]:f[p]=s(e.image[p],r.maxCubemapSize);var m=f[0],g=c(m),v=o(e.format),y=o(e.type);b(t.TEXTURE_CUBE_MAP,e,g);for(var p=0;p<6;p++)if(u)for(var x,w=f[p].mipmaps,_=0,S=w.length;_-1?i.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,_,v,x.width,x.height,0,x.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,_,v,x.width,x.height,0,v,y,x.data);else l?i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,v,f[p].width,f[p].height,0,v,y,f[p].data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,v,v,y,f[p]);e.generateMipmaps&&g&&t.generateMipmap(t.TEXTURE_CUBE_MAP),h.__version=e.version,e.onUpdate&&e.onUpdate(e)}else i.activeTexture(t.TEXTURE0+a),i.bindTexture(t.TEXTURE_CUBE_MAP,h.__image__webglTextureCube)}function y(e,r){i.activeTexture(t.TEXTURE0+r),i.bindTexture(t.TEXTURE_CUBE_MAP,n.get(e).__webglTexture)}function b(i,a,s){var c;if(s?(t.texParameteri(i,t.TEXTURE_WRAP_S,o(a.wrapS)),t.texParameteri(i,t.TEXTURE_WRAP_T,o(a.wrapT)),t.texParameteri(i,t.TEXTURE_MAG_FILTER,o(a.magFilter)),t.texParameteri(i,t.TEXTURE_MIN_FILTER,o(a.minFilter))):(t.texParameteri(i,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(i,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),a.wrapS===ml&&a.wrapT===ml||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",a),t.texParameteri(i,t.TEXTURE_MAG_FILTER,l(a.magFilter)),t.texParameteri(i,t.TEXTURE_MIN_FILTER,l(a.minFilter)),a.minFilter!==vl&&a.minFilter!==xl&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",a)),c=e.get("EXT_texture_filter_anisotropic")){if(a.type===El&&null===e.get("OES_texture_float_linear"))return;if(a.type===Il&&null===e.get("OES_texture_half_float_linear"))return;(a.anisotropy>1||n.get(a).__currentAnisotropy)&&(t.texParameterf(i,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),n.get(a).__currentAnisotropy=a.anisotropy)}}function x(e,n,a){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",d),e.__webglTexture=t.createTexture(),C.textures++),i.activeTexture(t.TEXTURE0+a),i.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,n.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,n.unpackAlignment);var l=s(n.image,r.maxTextureSize);u(n)&&c(l)===!1&&(l=h(l));var f=c(l),p=o(n.format),m=o(n.type);b(t.TEXTURE_2D,n,f);var g,v=n.mipmaps;if(n&&n.isDepthTexture){var y=t.DEPTH_COMPONENT;if(n.type===El){if(!T)throw new Error("Float Depth Texture only supported in WebGL2.0");y=t.DEPTH_COMPONENT32F}else T&&(y=t.DEPTH_COMPONENT16);n.format===jl&&(y=t.DEPTH_STENCIL),i.texImage2D(t.TEXTURE_2D,0,y,l.width,l.height,0,p,m,null)}else if(n&&n.isDataTexture)if(v.length>0&&f){for(var x=0,w=v.length;x-1?i.compressedTexImage2D(t.TEXTURE_2D,x,p,g.width,g.height,0,g.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(t.TEXTURE_2D,x,p,g.width,g.height,0,p,m,g.data);else if(v.length>0&&f){for(var x=0,w=v.length;x0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function Rt(t,e){this.normal=void 0!==t?t:new N(1,0,0),this.constant=void 0!==e?e:0}function Ot(t,e,i,n,r,o){this.planes=[void 0!==t?t:new Rt,void 0!==e?e:new Rt,void 0!==i?i:new Rt,void 0!==n?n:new Rt,void 0!==r?r:new Rt,void 0!==o?o:new Rt]}function Dt(t,e,i,n){function r(e,i,n,r){var o=e.geometry,a=null,s=b,c=e.customDepthMaterial;if(n&&(s=x,c=e.customDistanceMaterial),c)a=c;else{var h=!1;i.morphTargets&&(o&&o.isBufferGeometry?h=o.morphAttributes&&o.morphAttributes.position&&o.morphAttributes.position.length>0:o&&o.isGeometry&&(h=o.morphTargets&&o.morphTargets.length>0));var u=e.isSkinnedMesh&&i.skinning,l=0;h&&(l|=g),u&&(l|=v),a=s[l]}if(t.localClippingEnabled&&i.clipShadows===!0&&0!==i.clippingPlanes.length){var d=a.uuid,f=i.uuid,p=w[d];void 0===p&&(p={},w[d]=p);var m=p[f];void 0===m&&(m=a.clone(),p[f]=m),a=m}a.visible=i.visible,a.wireframe=i.wireframe;var y=i.side;return k.renderSingleSided&&y==gu&&(y=pu),k.renderReverseSided&&(y===pu?y=mu:y===mu&&(y=pu)),a.side=y,a.clipShadows=i.clipShadows,a.clippingPlanes=i.clippingPlanes,a.wireframeLinewidth=i.wireframeLinewidth,a.linewidth=i.linewidth,n&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(r),a}function o(t,e,i){if(t.visible!==!1){var n=0!==(t.layers.mask&e.layers.mask);if(n&&(t.isMesh||t.isLine||t.isPoints)&&t.castShadow&&(t.frustumCulled===!1||c.intersectsObject(t)===!0)){var r=t.material;r.visible===!0&&(t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),m.push(t))}for(var a=t.children,s=0,h=a.length;s");return Xt(i)}var i=/#include +<([\w\d.]+)>/g;return t.replace(i,e)}function qt(t){function e(t,e,i,n){for(var r="",o=parseInt(e);o0?t.gammaFactor:1,g=$t(o,n,t.extensions),v=Vt(a),y=r.createProgram();i.isRawShaderMaterial?(f=[v,"\n"].filter(Ht).join("\n"),p=[g,v,"\n"].filter(Ht).join("\n")):(f=["precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+i.__webglShader.name,v,n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+m,"#define MAX_BONES "+n.maxBones,n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+h:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(Ht).join("\n"),p=[g,"precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+i.__webglShader.name,v,n.alphaTest?"#define ALPHATEST "+n.alphaTest:"","#define GAMMA_FACTOR "+m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.envMap?"#define "+l:"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+h:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",n.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",n.toneMapping!==el?"#define TONE_MAPPING":"",n.toneMapping!==el?Mp.tonemapping_pars_fragment:"",n.toneMapping!==el?jt("toneMapping",n.toneMapping):"",n.outputEncoding||n.mapEncoding||n.envMapEncoding||n.emissiveMapEncoding?Mp.encodings_pars_fragment:"",n.mapEncoding?Bt("mapTexelToLinear",n.mapEncoding):"",n.envMapEncoding?Bt("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?Bt("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.outputEncoding?Ut("linearToOutputTexel",n.outputEncoding):"",n.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Ht).join("\n")),s=Xt(s,n),s=Wt(s,n),c=Xt(c,n),c=Wt(c,n),i.isShaderMaterial||(s=qt(s),c=qt(c));var b=f+s,x=p+c,w=kt(r,r.VERTEX_SHADER,b),_=kt(r,r.FRAGMENT_SHADER,x);r.attachShader(y,w),r.attachShader(y,_),void 0!==i.index0AttributeName?r.bindAttribLocation(y,0,i.index0AttributeName):n.morphTargets===!0&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y);var S=r.getProgramInfoLog(y),A=r.getShaderInfoLog(w),M=r.getShaderInfoLog(_),P=!0,C=!0;r.getProgramParameter(y,r.LINK_STATUS)===!1?(P=!1,console.error("THREE.WebGLProgram: shader error: ",r.getError(),"gl.VALIDATE_STATUS",r.getProgramParameter(y,r.VALIDATE_STATUS),"gl.getProgramInfoLog",S,A,M)):""!==S?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",S):""!==A&&""!==M||(C=!1),C&&(this.diagnostics={runnable:P,material:i,programLog:S,vertexShader:{log:A,prefix:f},fragmentShader:{log:M,prefix:p}}),r.deleteShader(w),r.deleteShader(_);var T;this.getUniforms=function(){return void 0===T&&(T=new bt(r,y,t)),T};var E;return this.getAttributes=function(){return void 0===E&&(E=Gt(r,y)),E},this.destroy=function(){r.deleteProgram(y),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=Ep++,this.code=e,this.usedTimes=1,this.program=y,this.vertexShader=w,this.fragmentShader=_,this}function Zt(t,e){function i(t){if(e.floatVertexTextures&&t&&t.skeleton&&t.skeleton.useVertexTexture)return 1024;var i=e.maxVertexUniforms,n=Math.floor((i-20)/4),r=n;return void 0!==t&&t&&t.isSkinnedMesh&&(r=Math.min(t.skeleton.bones.length,r),r0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===gu,flipSided:r.side===mu,depthPacking:void 0!==r.depthPacking&&r.depthPacking};return p},this.getProgramCode=function(t,e){var i=[];if(e.shaderID?i.push(e.shaderID):(i.push(t.fragmentShader),i.push(t.vertexShader)),void 0!==t.defines)for(var n in t.defines)i.push(n),i.push(t.defines[n]);for(var r=0;r65535?Uint32Array:Uint16Array,y=new Kt(new v(o),1);return r(y,t.ELEMENT_ARRAY_BUFFER),n.wireframe=y,y}function h(t,e,i){if(e>i){var n=e;e=i,i=n}var r=t[e];return void 0===r?(t[e]=[i],!0):r.indexOf(i)===-1&&(r.push(i),!0)}var u=new ue(t,e,i);return{getAttributeBuffer:s,getWireframeAttribute:c,update:n}}function de(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var i;switch(e.type){case"DirectionalLight":i={direction:new N,color:new Ct,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new I};break;case"SpotLight":i={position:new N,direction:new N,color:new Ct,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new I};break;case"PointLight":i={position:new N,color:new Ct,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new I};break;case"HemisphereLight":i={direction:new N,skyColor:new Ct,groundColor:new Ct}}return t[e.id]=i,i}}}function fe(t,e,i){function n(){if(void 0!==o)return o;var i=e.get("EXT_texture_filter_anisotropic");return o=null!==i?t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o,a=void 0!==i.precision?i.precision:"highp",s=r(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);var c=i.logarithmicDepthBuffer===!0&&!!e.get("EXT_frag_depth"),h=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),l=t.getParameter(t.MAX_TEXTURE_SIZE),d=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),f=t.getParameter(t.MAX_VERTEX_ATTRIBS),p=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),g=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),v=u>0,y=!!e.get("OES_texture_float"),b=v&&y;return{getMaxAnisotropy:n,getMaxPrecision:r,precision:a,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:l,maxCubemapSize:d,maxAttributes:f,maxVertexUniforms:p,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:b}}function pe(t){var e={};return{get:function(i){if(void 0!==e[i])return e[i];var n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":n=t.getExtension("WEBGL_compressed_texture_etc1");break;default:n=t.getExtension(i)}return null===n&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),e[i]=n,n}}}function me(t,e,i){function n(t){s=t}function r(i){i.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(c=t.UNSIGNED_INT,h=4):(c=t.UNSIGNED_SHORT,h=2)}function o(e,n){t.drawElements(s,n,c,e*h),i.calls++,i.vertices+=n,s===t.TRIANGLES&&(i.faces+=n/3)}function a(n,r,o){var a=e.get("ANGLE_instanced_arrays");return null===a?void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(a.drawElementsInstancedANGLE(s,o,c,r*h,n.maxInstancedCount),i.calls++,i.vertices+=o*n.maxInstancedCount,void(s===t.TRIANGLES&&(i.faces+=n.maxInstancedCount*o/3)))}var s,c,h;return{setMode:n,setIndex:r,render:o,renderInstances:a}}function ge(){function t(){h.value!==n&&(h.value=n,h.needsUpdate=r>0),i.numPlanes=r}function e(t,e,n,r){var o=null!==t?t.length:0,a=null;if(0!==o){if(a=h.value,r!==!0||null===a){var u=n+4*o,l=e.matrixWorldInverse;c.getNormalMatrix(l),(null===a||a.length0?1:-1,p[g]=I.x,p[g+1]=I.y,p[g+2]=I.z,m[v]=O/c,m[v+1]=1-L/u,g+=3,v+=2,T+=1}for(L=0;L65535?Uint32Array:Uint16Array)(l),f=new Float32Array(3*u),p=new Float32Array(3*u),m=new Float32Array(2*u),g=0,v=0,y=0,b=0,x=0;c("z","y","x",-1,-1,i,e,t,o,r,0),c("z","y","x",1,-1,i,e,-t,o,r,1),c("x","z","y",1,1,t,i,e,n,o,2),c("x","z","y",1,-1,t,i,-e,n,o,3),c("x","y","z",1,-1,t,e,i,n,r,4),c("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(new Kt(d,1)),this.addAttribute("position",new Kt(f,3)),this.addAttribute("normal",new Kt(p,3)),this.addAttribute("uv",new Kt(m,2))}function xe(t,e){this.origin=void 0!==t?t:new N,this.direction=void 0!==e?e:new N}function we(t,e){this.start=void 0!==t?t:new N,this.end=void 0!==e?e:new N}function _e(t,e,i){this.a=void 0!==t?t:new N,this.b=void 0!==e?e:new N,this.c=void 0!==i?i:new N}function Se(t){At.call(this),this.type="MeshBasicMaterial",this.color=new Ct(16777215),this.map=null,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Qu,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function Ae(t,e){re.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new he,this.material=void 0!==e?e:new Se({color:16777215*Math.random()}),this.drawMode=ad,this.updateMorphTargets()}function Me(t,e,i,n){he.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};for(var r=t/2,o=e/2,a=Math.floor(i)||1,s=Math.floor(n)||1,c=a+1,h=s+1,u=t/a,l=e/s,d=new Float32Array(c*h*3),f=new Float32Array(c*h*3),p=new Float32Array(c*h*2),m=0,g=0,v=0;v65535?Uint32Array:Uint16Array)(a*s*6),v=0;v=0){var u=o[c];if(void 0!==u){var l=Ut.FLOAT,d=u.array,f=u.normalized;d instanceof Float32Array?l=Ut.FLOAT:d instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):d instanceof Uint16Array?l=Ut.UNSIGNED_SHORT:d instanceof Int16Array?l=Ut.SHORT:d instanceof Uint32Array?l=Ut.UNSIGNED_INT:d instanceof Int32Array?l=Ut.INT:d instanceof Int8Array?l=Ut.BYTE:d instanceof Uint8Array&&(l=Ut.UNSIGNED_BYTE);var p=u.itemSize,m=Xt.getAttributeBuffer(u);if(u&&u.isInterleavedBufferAttribute){var g=u.data,v=g.stride,y=u.offset;g&&g.isInstancedInterleavedBuffer?(Gt.enableAttributeAndDivisor(h,g.meshPerAttribute,r),void 0===i.maxInstancedCount&&(i.maxInstancedCount=g.meshPerAttribute*g.count)):Gt.enableAttribute(h),Ut.bindBuffer(Ut.ARRAY_BUFFER,m),Ut.vertexAttribPointer(h,p,l,f,v*g.array.BYTES_PER_ELEMENT,(n*v+y)*g.array.BYTES_PER_ELEMENT)}else u&&u.isInstancedBufferAttribute?(Gt.enableAttributeAndDivisor(h,u.meshPerAttribute,r),void 0===i.maxInstancedCount&&(i.maxInstancedCount=u.meshPerAttribute*u.count)):Gt.enableAttribute(h),Ut.bindBuffer(Ut.ARRAY_BUFFER,m),Ut.vertexAttribPointer(h,p,l,f,0,n*p*u.array.BYTES_PER_ELEMENT)}else if(void 0!==s){var b=s[c];if(void 0!==b)switch(b.length){case 2:Ut.vertexAttrib2fv(h,b);break;case 3:Ut.vertexAttrib3fv(h,b);break;case 4:Ut.vertexAttrib4fv(h,b);break;default:Ut.vertexAttrib1fv(h,b)}}}}Gt.disableUnusedAttributes()}function u(t,e){return Math.abs(e[0])-Math.abs(t[0])}function l(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.material.program&&e.material.program&&t.material.program!==e.material.program?t.material.program.id-e.material.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function d(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function f(t,e,i,n,r){var o,a;i.transparent?(o=K,a=++Q):(o=Y,a=++Z);var s=o[a];void 0!==s?(s.id=t.id,s.object=t,s.geometry=e,s.material=i,s.z=kt.z,s.group=r):(s={id:t.id,object:t,geometry:e,material:i,z:kt.z,group:r},o.push(s))}function p(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Rt.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),g(Rt)}function m(t){return Rt.center.set(0,0,0),Rt.radius=.7071067811865476,Rt.applyMatrix4(t.matrixWorld),g(Rt)}function g(t){if(!Mt.intersectsSphere(t))return!1;var e=Tt.numPlanes;if(0===e)return!0;var i=it.clippingPlanes,n=t.center,r=-t.radius,o=0;do if(i[o].distanceToPoint(n)=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(var d=0;d=0&&t.numSupportedMorphNormals++}var f=n.__webglShader.uniforms;!t.isShaderMaterial&&!t.isRawShaderMaterial|t.clipping===!0&&(n.numClippingPlanes=Tt.numPlanes,f.clippingPlanes=Tt.uniform),n.fog=e,n.lightsHash=zt.hash,t.lights&&(f.ambientLightColor.value=zt.ambient,f.directionalLights.value=zt.directional,f.spotLights.value=zt.spot,f.pointLights.value=zt.point,f.hemisphereLights.value=zt.hemi,f.directionalShadowMap.value=zt.directionalShadowMap,f.directionalShadowMatrix.value=zt.directionalShadowMatrix,f.spotShadowMap.value=zt.spotShadowMap,f.spotShadowMatrix.value=zt.spotShadowMatrix,f.pointShadowMap.value=zt.pointShadowMap,f.pointShadowMatrix.value=zt.pointShadowMatrix);var p=n.program.getUniforms(),m=bt.seqWithValue(p.seq,f);n.uniformsList=m,n.dynamicUniforms=bt.splitDynamic(m,f)}function x(t){t.side===gu?Gt.disable(Ut.CULL_FACE):Gt.enable(Ut.CULL_FACE),Gt.setFlipSided(t.side===mu),t.transparent===!0?Gt.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha):Gt.setBlending(_u),Gt.setDepthFunc(t.depthFunc),Gt.setDepthTest(t.depthTest),Gt.setDepthWrite(t.depthWrite),Gt.setColorWrite(t.colorWrite),Gt.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function w(t,e,i,n){dt=0;var r=Ht.get(i);if(Et&&(Lt||t!==ct)){var o=t===ct&&i.id===at;Tt.setState(i.clippingPlanes,i.clipShadows,t,r,o)}i.needsUpdate===!1&&(void 0===r.program?i.needsUpdate=!0:i.fog&&r.fog!==e?i.needsUpdate=!0:i.lights&&r.lightsHash!==zt.hash?i.needsUpdate=!0:void 0!==r.numClippingPlanes&&r.numClippingPlanes!==Tt.numPlanes&&(i.needsUpdate=!0)),i.needsUpdate&&(b(i,e,n),i.needsUpdate=!1);var a=!1,s=!1,c=!1,h=r.program,u=h.getUniforms(),l=r.__webglShader.uniforms;if(h.id!==nt&&(Ut.useProgram(h.program),nt=h.id,a=!0,s=!0,c=!0),i.id!==at&&(at=i.id,s=!0),a||t!==ct){if(u.set(Ut,t,"projectionMatrix"),Vt.logarithmicDepthBuffer&&u.setValue(Ut,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),t!==ct&&(ct=t,s=!0,c=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.envMap){var d=u.map.cameraPosition;void 0!==d&&d.setValue(Ut,kt.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&u.setValue(Ut,"viewMatrix",t.matrixWorldInverse),u.set(Ut,it,"toneMappingExposure"),u.set(Ut,it,"toneMappingWhitePoint")}if(i.skinning){u.setOptional(Ut,n,"bindMatrix"),u.setOptional(Ut,n,"bindMatrixInverse");var f=n.skeleton;f&&(Vt.floatVertexTextures&&f.useVertexTexture?(u.set(Ut,f,"boneTexture"),u.set(Ut,f,"boneTextureWidth"),u.set(Ut,f,"boneTextureHeight")):u.setOptional(Ut,f,"boneMatrices"))}s&&(i.lights&&L(l,c),e&&i.fog&&P(l,e),(i.isMeshBasicMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.isMeshDepthMaterial)&&_(l,i),i.isLineBasicMaterial?S(l,i):i.isLineDashedMaterial?(S(l,i),A(l,i)):i.isPointsMaterial?M(l,i):i.isMeshLambertMaterial?C(l,i):i.isMeshPhongMaterial?T(l,i):i.isMeshPhysicalMaterial?I(l,i):i.isMeshStandardMaterial?E(l,i):i.isMeshDepthMaterial?i.displacementMap&&(l.displacementMap.value=i.displacementMap,l.displacementScale.value=i.displacementScale,l.displacementBias.value=i.displacementBias):i.isMeshNormalMaterial&&(l.opacity.value=i.opacity),bt.upload(Ut,r.uniformsList,l,it)),u.set(Ut,n,"modelViewMatrix"),u.set(Ut,n,"normalMatrix"),u.setValue(Ut,"modelMatrix",n.matrixWorld);var p=r.dynamicUniforms;return null!==p&&(bt.evalDynamic(p,l,n,t),bt.upload(Ut,p,l,it)),h}function _(t,e){t.opacity.value=e.opacity,t.diffuse.value=e.color,e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),t.map.value=e.map,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var i;if(e.map?i=e.map:e.specularMap?i=e.specularMap:e.displacementMap?i=e.displacementMap:e.normalMap?i=e.normalMap:e.bumpMap?i=e.bumpMap:e.roughnessMap?i=e.roughnessMap:e.metalnessMap?i=e.metalnessMap:e.alphaMap?i=e.alphaMap:e.emissiveMap&&(i=e.emissiveMap),void 0!==i){i.isWebGLRenderTarget&&(i=i.texture);var n=i.offset,r=i.repeat;t.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}function S(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function A(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function M(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*vt,t.scale.value=.5*U.clientHeight,t.map.value=e.map,null!==e.map){var i=e.map.offset,n=e.map.repeat;t.offsetRepeat.value.set(i.x,i.y,n.x,n.y)}}function P(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}function C(t,e){e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function T(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function E(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function I(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,E(t,e)}function L(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLights.needsUpdate=e,t.pointLights.needsUpdate=e,t.spotLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function R(t){for(var e=0,i=0,n=t.length;i=Vt.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+Vt.maxTextures),dt+=1,t}function B(t){var e;if(t===pl)return Ut.REPEAT;if(t===ml)return Ut.CLAMP_TO_EDGE;if(t===gl)return Ut.MIRRORED_REPEAT;if(t===vl)return Ut.NEAREST;if(t===yl)return Ut.NEAREST_MIPMAP_NEAREST;if(t===bl)return Ut.NEAREST_MIPMAP_LINEAR;if(t===xl)return Ut.LINEAR;if(t===wl)return Ut.LINEAR_MIPMAP_NEAREST;if(t===_l)return Ut.LINEAR_MIPMAP_LINEAR;if(t===Sl)return Ut.UNSIGNED_BYTE;if(t===Ll)return Ut.UNSIGNED_SHORT_4_4_4_4;if(t===Rl)return Ut.UNSIGNED_SHORT_5_5_5_1;if(t===Ol)return Ut.UNSIGNED_SHORT_5_6_5;if(t===Al)return Ut.BYTE;if(t===Ml)return Ut.SHORT;if(t===Pl)return Ut.UNSIGNED_SHORT;if(t===Cl)return Ut.INT;if(t===Tl)return Ut.UNSIGNED_INT;if(t===El)return Ut.FLOAT;if(e=$t.get("OES_texture_half_float"),null!==e&&t===Il)return e.HALF_FLOAT_OES;if(t===Nl)return Ut.ALPHA;if(t===kl)return Ut.RGB;if(t===Fl)return Ut.RGBA;if(t===zl)return Ut.LUMINANCE;if(t===Bl)return Ut.LUMINANCE_ALPHA;if(t===Ul)return Ut.DEPTH_COMPONENT;if(t===jl)return Ut.DEPTH_STENCIL;if(t===Tu)return Ut.FUNC_ADD;if(t===Eu)return Ut.FUNC_SUBTRACT;if(t===Iu)return Ut.FUNC_REVERSE_SUBTRACT;if(t===Ou)return Ut.ZERO;if(t===Du)return Ut.ONE;if(t===Nu)return Ut.SRC_COLOR;if(t===ku)return Ut.ONE_MINUS_SRC_COLOR;if(t===Fu)return Ut.SRC_ALPHA;if(t===zu)return Ut.ONE_MINUS_SRC_ALPHA;if(t===Bu)return Ut.DST_ALPHA;if(t===Uu)return Ut.ONE_MINUS_DST_ALPHA;if(t===ju)return Ut.DST_COLOR;if(t===$u)return Ut.ONE_MINUS_DST_COLOR;if(t===Vu)return Ut.SRC_ALPHA_SATURATE;if(e=$t.get("WEBGL_compressed_texture_s3tc"),null!==e){if(t===$l)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Vl)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Gl)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===Hl)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(e=$t.get("WEBGL_compressed_texture_pvrtc"),null!==e){if(t===Wl)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===Xl)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===ql)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===Yl)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e=$t.get("WEBGL_compressed_texture_etc1"),null!==e&&t===Zl)return e.COMPRESSED_RGB_ETC1_WEBGL;if(e=$t.get("EXT_blend_minmax"),null!==e){if(t===Lu)return e.MIN_EXT;if(t===Ru)return e.MAX_EXT}return e=$t.get("WEBGL_depth_texture"),null!==e&&t===Dl?e.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer",su),t=t||{};var U=void 0!==t.canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),j=void 0!==t.context?t.context:null,$=void 0!==t.alpha&&t.alpha,V=void 0===t.depth||t.depth,G=void 0===t.stencil||t.stencil,H=void 0!==t.antialias&&t.antialias,W=void 0===t.premultipliedAlpha||t.premultipliedAlpha,X=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,q=[],Y=[],Z=-1,K=[],Q=-1,J=new Float32Array(8),tt=[],et=[];this.domElement=U,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=il,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var it=this,nt=null,rt=null,ot=null,at=-1,st="",ct=null,ht=new wt,ut=null,lt=new wt,dt=0,ft=new Ct(0),pt=0,mt=U.width,gt=U.height,vt=1,yt=new wt(0,0,mt,gt),St=!1,At=new wt(0,0,mt,gt),Mt=new Ot,Tt=new ge,Et=!1,Lt=!1,Rt=new It,Nt=new O,kt=new N,zt={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Bt={calls:0,vertices:0,faces:0,points:0};this.info={render:Bt,memory:{geometries:0,textures:0},programs:null};var Ut;try{var jt={alpha:$,depth:V,stencil:G,antialias:H,premultipliedAlpha:W,preserveDrawingBuffer:X};if(Ut=j||U.getContext("webgl",jt)||U.getContext("experimental-webgl",jt),null===Ut)throw null!==U.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===Ut.getShaderPrecisionFormat&&(Ut.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),U.addEventListener("webglcontextlost",o,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var $t=new pe(Ut);$t.get("WEBGL_depth_texture"),$t.get("OES_texture_float"),$t.get("OES_texture_float_linear"),$t.get("OES_texture_half_float"),$t.get("OES_texture_half_float_linear"),$t.get("OES_standard_derivatives"),$t.get("ANGLE_instanced_arrays"),$t.get("OES_element_index_uint")&&(he.MaxIndex=4294967296);var Vt=new fe(Ut,$t,t),Gt=new _t(Ut,$t,B),Ht=new Ft,Wt=new xt(Ut,$t,Gt,Ht,Vt,B,this.info),Xt=new le(Ut,Ht,this.info),qt=new Zt(this,Vt),Yt=new de;this.info.programs=qt.programs;var Kt=new ve(Ut,$t,Bt),Qt=new me(Ut,$t,Bt),Jt=new Te(-1,1,1,-1,0,1),te=new Ce,ee=new Ae(new Me(2,2),new Se({depthTest:!1,depthWrite:!1,fog:!1})),ie=Tp.cube,ne=new Ae(new be(5,5,5),new Pt({uniforms:ie.uniforms,vertexShader:ie.vertexShader,fragmentShader:ie.fragmentShader,side:mu,depthTest:!1,depthWrite:!1,fog:!1}));n(),this.context=Ut,this.capabilities=Vt,this.extensions=$t,this.properties=Ht,this.state=Gt;var re=new Dt(this,zt,Xt,Vt);this.shadowMap=re;var oe=new k(this,tt),ae=new z(this,et);this.getContext=function(){return Ut},this.getContextAttributes=function(){return Ut.getContextAttributes()},this.forceContextLoss=function(){$t.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return Vt.getMaxAnisotropy()},this.getPrecision=function(){return Vt.precision},this.getPixelRatio=function(){return vt},this.setPixelRatio=function(t){void 0!==t&&(vt=t,this.setSize(At.z,At.w,!1))},this.getSize=function(){return{width:mt,height:gt}},this.setSize=function(t,e,i){mt=t,gt=e,U.width=t*vt,U.height=e*vt,i!==!1&&(U.style.width=t+"px",U.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,i,n){Gt.viewport(At.set(t,e,i,n))},this.setScissor=function(t,e,i,n){Gt.scissor(yt.set(t,e,i,n))},this.setScissorTest=function(t){Gt.setScissorTest(St=t)},this.getClearColor=function(){return ft},this.setClearColor=function(t,e){ft.set(t),pt=void 0!==e?e:1,i(ft.r,ft.g,ft.b,pt)},this.getClearAlpha=function(){return pt},this.setClearAlpha=function(t){pt=t,i(ft.r,ft.g,ft.b,pt)},this.clear=function(t,e,i){var n=0;(void 0===t||t)&&(n|=Ut.COLOR_BUFFER_BIT),(void 0===e||e)&&(n|=Ut.DEPTH_BUFFER_BIT),(void 0===i||i)&&(n|=Ut.STENCIL_BUFFER_BIT),Ut.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,i,n){this.setRenderTarget(t),this.clear(e,i,n)},this.resetGLState=r,this.dispose=function(){K=[],Q=-1,Y=[],Z=-1,U.removeEventListener("webglcontextlost",o,!1)},this.renderBufferImmediate=function(t,e,i){Gt.initAttributes();var n=Ht.get(t);t.hasPositions&&!n.position&&(n.position=Ut.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=Ut.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=Ut.createBuffer()),t.hasColors&&!n.color&&(n.color=Ut.createBuffer());var r=e.getAttributes();if(t.hasPositions&&(Ut.bindBuffer(Ut.ARRAY_BUFFER,n.position),Ut.bufferData(Ut.ARRAY_BUFFER,t.positionArray,Ut.DYNAMIC_DRAW),Gt.enableAttribute(r.position),Ut.vertexAttribPointer(r.position,3,Ut.FLOAT,!1,0,0)),t.hasNormals){if(Ut.bindBuffer(Ut.ARRAY_BUFFER,n.normal),!i.isMeshPhongMaterial&&!i.isMeshStandardMaterial&&i.shading===vu)for(var o=0,a=3*t.count;o8&&(f.length=8);for(var v=n.morphAttributes,p=0,m=f.length;p0&&_.renderInstances(n,E,L):_.render(E,L)},this.render=function(t,e,n,r){if((e&&e.isCamera)===!1)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");var o=t.fog;st="",at=-1,ct=null,t.autoUpdate===!0&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),Nt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),Mt.setFromMatrix(Nt),q.length=0,Z=-1,Q=-1,tt.length=0,et.length=0,Lt=this.localClippingEnabled,Et=Tt.init(this.clippingPlanes,Lt,e),v(t,e),Y.length=Z+1,K.length=Q+1,it.sortObjects===!0&&(Y.sort(l),K.sort(d)),Et&&Tt.beginShadows(),R(q),re.render(t,e),D(q,e),Et&&Tt.endShadows(),Bt.calls=0,Bt.vertices=0,Bt.faces=0,Bt.points=0,void 0===n&&(n=null),this.setRenderTarget(n);var a=t.background;if(null===a?i(ft.r,ft.g,ft.b,pt):a&&a.isColor&&(i(a.r,a.g,a.b,1),r=!0),(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),a&&a.isCubeTexture?(te.projectionMatrix.copy(e.projectionMatrix),te.matrixWorld.extractRotation(e.matrixWorld),te.matrixWorldInverse.getInverse(te.matrixWorld),ne.material.uniforms.tCube.value=a,ne.modelViewMatrix.multiplyMatrices(te.matrixWorldInverse,ne.matrixWorld),Xt.update(ne),it.renderBufferDirect(te,null,ne.geometry,ne.material,ne,null)):a&&a.isTexture&&(ee.material.map=a,Xt.update(ee),it.renderBufferDirect(Jt,null,ee.geometry,ee.material,ee,null)),t.overrideMaterial){var s=t.overrideMaterial;y(Y,e,o,s),y(K,e,o,s)}else Gt.setBlending(_u),y(Y,e,o),y(K,e,o);oe.render(t,e),ae.render(t,e,lt),n&&Wt.updateRenderTargetMipmap(n),Gt.setDepthTest(!0),Gt.setDepthWrite(!0),Gt.setColorWrite(!0)},this.setFaceCulling=function(t,e){Gt.setCullFace(t),Gt.setFlipSided(e===lu)},this.allocTextureUnit=F,this.setTexture2D=function(){var t=!1;return function(e,i){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),Wt.setTexture2D(e,i)}}(),this.setTexture=function(){var t=!1;return function(e,i){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),Wt.setTexture2D(e,i)}}(),this.setTextureCube=function(){var t=!1;return function(e,i){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?Wt.setTextureCube(e,i):Wt.setTextureCubeDynamic(e,i)}}(),this.getCurrentRenderTarget=function(){return rt},this.setRenderTarget=function(t){rt=t,t&&void 0===Ht.get(t).__webglFramebuffer&&Wt.setupRenderTarget(t);var e,i=t&&t.isWebGLRenderTargetCube;if(t){var n=Ht.get(t);e=i?n.__webglFramebuffer[t.activeCubeFace]:n.__webglFramebuffer,ht.copy(t.scissor),ut=t.scissorTest,lt.copy(t.viewport)}else e=null,ht.copy(yt).multiplyScalar(vt),ut=St,lt.copy(At).multiplyScalar(vt);if(ot!==e&&(Ut.bindFramebuffer(Ut.FRAMEBUFFER,e),ot=e),Gt.scissor(ht),Gt.setScissorTest(ut),Gt.viewport(lt),i){var r=Ht.get(t.texture);Ut.framebufferTexture2D(Ut.FRAMEBUFFER,Ut.COLOR_ATTACHMENT0,Ut.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,r.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,i,n,r,o){if((t&&t.isWebGLRenderTarget)===!1)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var a=Ht.get(t).__webglFramebuffer;if(a){var s=!1;a!==ot&&(Ut.bindFramebuffer(Ut.FRAMEBUFFER,a),s=!0);try{var c=t.texture,h=c.format,u=c.type;if(h!==Fl&&B(h)!==Ut.getParameter(Ut.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(u===Sl||B(u)===Ut.getParameter(Ut.IMPLEMENTATION_COLOR_READ_TYPE)||u===El&&($t.get("OES_texture_float")||$t.get("WEBGL_color_buffer_float"))||u===Il&&$t.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");Ut.checkFramebufferStatus(Ut.FRAMEBUFFER)===Ut.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&Ut.readPixels(e,i,n,r,B(h),B(u),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&Ut.bindFramebuffer(Ut.FRAMEBUFFER,ot)}}}}function Ie(t,e){this.name="",this.color=new Ct(t),this.density=void 0!==e?e:25e-5}function Le(t,e,i){this.name="",this.color=new Ct(t),this.near=void 0!==e?e:1,this.far=void 0!==i?i:1e3}function Re(){re.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function Oe(t,e,i,n,r){re.call(this),this.lensFlares=[],this.positionScreen=new N,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,i,n,r)}function De(t){At.call(this),this.type="SpriteMaterial",this.color=new Ct(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function Ne(t){re.call(this),this.type="Sprite",this.material=void 0!==t?t:new De}function ke(){re.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Fe(t,e,i,n,r,o,a,s,c,h,u,l){L.call(this,null,o,a,s,c,h,n,r,u,l),this.image={data:t,width:e,height:i},this.magFilter=void 0!==c?c:vl,this.minFilter=void 0!==h?h:vl,this.flipY=!1,this.generateMipmaps=!1}function ze(t,e,i){if(this.useVertexTexture=void 0===i||i,this.identityMatrix=new O,t=t||[],this.bones=t.slice(0),this.useVertexTexture){var n=Math.sqrt(4*this.bones.length);n=yd.nextPowerOfTwo(Math.ceil(n)),n=Math.max(n,4),this.boneTextureWidth=n,this.boneTextureHeight=n,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new Fe(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,Fl,El)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var r=0,o=this.bones.length;r0)&&S.push(A,M,C),(m!==i-1||s65535?Jt:Qt)(S,1)),this.addAttribute("position",h),this.addAttribute("normal",u),this.addAttribute("uv",l),this.boundingSphere=new It(new N,t)}function un(t,e,i,n,r,o,a){ae.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new hn(t,e,i,n,r,o,a))}function ln(t,e){re.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new Ct,new Ct];var i=new un(e,4,2);i.rotateX(-Math.PI/2);for(var n=0,r=8;n0&&f++,e>0&&f++);var p=c(),m=h(),g=new Kt(new(m>65535?Uint32Array:Uint16Array)(m),1),v=new Kt(new Float32Array(3*p),3),y=new Kt(new Float32Array(3*p),3),b=new Kt(new Float32Array(2*p),2),x=0,w=0,_=[],S=i/2,A=0;u(),o===!1&&(t>0&&l(!0),e>0&&l(!1)),this.setIndex(g),this.addAttribute("position",v),this.addAttribute("normal",y),this.addAttribute("uv",b)}function bn(t,e,i,n,r,o){re.call(this),void 0===n&&(n=16776960),void 0===i&&(i=1),void 0===r&&(r=.2*i),void 0===o&&(o=.2*r),this.position.copy(e),this.line=new $e(Up,new je({color:n})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Ae(jp,new Se({color:n})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(i,r,o)}function xn(t,e,i,n){function r(t){var e=t.normalize().clone();e.index=u.vertices.push(e)-1;var i=s(t)/2/Math.PI+.5,n=c(t)/Math.PI+.5;return e.uv=new I(i,1-n),e}function o(t,e,i){var n=new ee(t.index,e.index,i.index,[t.clone(),e.clone(),i.clone()]);u.faces.push(n),b.copy(t).add(e).add(i).divideScalar(3);var r=s(b);u.faceVertexUvs[0].push([h(t.uv,t,r),h(e.uv,e,r),h(i.uv,i,r)])}function a(t,e){for(var i=Math.pow(2,e),n=r(u.vertices[t.a]),a=r(u.vertices[t.b]),s=r(u.vertices[t.c]),c=[],h=0;h<=i;h++){c[h]=[];for(var l=r(n.clone().lerp(s,h/i)),d=r(a.clone().lerp(s,h/i)),f=i-h,p=0;p<=f;p++)0===p&&h===i?c[h][p]=l:c[h][p]=r(l.clone().lerp(d,p/f))}for(var h=0;h.9&&M<.1&&(w<.2&&(x[0].x+=1),_<.2&&(x[1].x+=1),S<.2&&(x[2].x+=1))}for(var l=0,d=this.vertices.length;l65535?Uint32Array:Uint16Array)(u),1),d=new Kt(new Float32Array(3*h),3),f=new Kt(new Float32Array(3*h),3),p=new Kt(new Float32Array(2*h),2),m=0,g=0,v=new N,y=new N,b=new I,x=new N,w=new N,_=new N,S=new N,A=new N;for(s=0;s<=i;++s){var M=s/i*r*Math.PI*2;for(a(M,r,o,t,x),a(M+.01,r,o,t,w),S.subVectors(w,x),A.addVectors(w,x),_.crossVectors(S,A),A.crossVectors(_,S),_.normalize(),A.normalize(),c=0;c<=n;++c){var P=c/n*Math.PI*2,C=-e*Math.cos(P),T=e*Math.sin(P);v.x=x.x+(C*A.x+T*_.x),v.y=x.y+(C*A.y+T*_.y),v.z=x.z+(C*A.z+T*_.z),d.setXYZ(m,v.x,v.y,v.z),y.subVectors(v,x).normalize(),f.setXYZ(m,y.x,y.y,y.z), +b.x=s/i,b.y=c/n,p.setXY(m,b.x,b.y),m++}}for(c=1;c<=i;c++)for(s=1;s<=n;s++){var E=(n+1)*(c-1)+(s-1),L=(n+1)*c+(s-1),R=(n+1)*c+s,O=(n+1)*(c-1)+s;l.setX(g,E),g++,l.setX(g,L),g++,l.setX(g,O),g++,l.setX(g,L),g++,l.setX(g,R),g++,l.setX(g,O),g++}this.setIndex(l),this.addAttribute("position",d),this.addAttribute("normal",f),this.addAttribute("uv",p)}function Sn(t,e,i,n,r){he.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:r},t=t||100,e=e||40,i=Math.floor(i)||8,n=Math.floor(n)||6,r=r||2*Math.PI;var o,a,s=(i+1)*(n+1),c=i*n*2*3,h=new(c>65535?Uint32Array:Uint16Array)(c),u=new Float32Array(3*s),l=new Float32Array(3*s),d=new Float32Array(2*s),f=0,p=0,m=0,g=new N,v=new N,y=new N;for(o=0;o<=i;o++)for(a=0;a<=n;a++){var b=a/n*r,x=o/i*Math.PI*2;v.x=(t+e*Math.cos(x))*Math.cos(b),v.y=(t+e*Math.cos(x))*Math.sin(b),v.z=e*Math.sin(x),u[f]=v.x,u[f+1]=v.y,u[f+2]=v.z,g.x=t*Math.cos(b),g.y=t*Math.sin(b),y.subVectors(v,g).normalize(),l[f]=y.x,l[f+1]=y.y,l[f+2]=y.z,d[p]=a/n,d[p+1]=o/i,f+=3,p+=2}for(o=1;o<=i;o++)for(a=1;a<=n;a++){var w=(n+1)*o+a-1,_=(n+1)*(o-1)+a-1,S=(n+1)*(o-1)+a,A=(n+1)*o+a;h[m]=w,h[m+1]=_,h[m+2]=A,h[m+3]=_,h[m+4]=S,h[m+5]=A,m+=6}this.setIndex(new Kt(h,1)),this.addAttribute("position",new Kt(u,3)),this.addAttribute("normal",new Kt(l,3)),this.addAttribute("uv",new Kt(d,2))}function An(t,e,i,n,r,o){he.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:o},t=t||20,e=e||50,r=void 0!==r?r:0,o=void 0!==o?o:2*Math.PI,i=void 0!==i?Math.max(3,i):8,n=void 0!==n?Math.max(1,n):1;var a,s,c,h=(i+1)*(n+1),u=i*n*2*3,l=new Kt(new(u>65535?Uint32Array:Uint16Array)(u),1),d=new Kt(new Float32Array(3*h),3),f=new Kt(new Float32Array(3*h),3),p=new Kt(new Float32Array(2*h),2),m=0,g=0,v=t,y=(e-t)/n,b=new N,x=new I;for(s=0;s<=n;s++){for(c=0;c<=i;c++)a=r+c/i*o,b.x=v*Math.cos(a),b.y=v*Math.sin(a),d.setXYZ(m,b.x,b.y,b.z),f.setXYZ(m,0,0,1),x.x=(b.x/e+1)/2,x.y=(b.y/e+1)/2,p.setXY(m,x.x,x.y),m++;v+=y}for(s=0;s65535?Uint32Array:Uint16Array)(c),1),u=new Kt(new Float32Array(3*s),3),l=new Kt(new Float32Array(2*s),2),d=0,f=0,p=1/e,m=new N,g=new I;for(o=0;o<=e;o++){var v=i+o*p*n,y=Math.sin(v),b=Math.cos(v);for(a=0;a<=t.length-1;a++)m.x=t[a].x*y,m.y=t[a].y,m.z=t[a].x*b,u.setXYZ(d,m.x,m.y,m.z),g.x=o/e,g.y=a/(t.length-1),l.setXY(d,g.x,g.y),d++}for(o=0;o=0&&e<=7&&Mv[t]?Mv[t][e]:Array(e+1).join(t)}function xr(t,e){function i(){f=[],r(),o(),a()}function n(t,e){return void 0!==t?t:e}function r(){f.push(vr("TITEL %-74s",t.name))}function o(){d.forEach(function(t){f.push(vr("REMARK %-73s",t))}),t.trajectory&&(f.push(vr("REMARK %-73s","Trajectory '"+t.trajectory.name+"'")),f.push(vr("REMARK %-73s","Frame "+t.trajectory.frame)))}function a(){var e=1,i=1;t.eachModel(function(t){f.push(vr("MODEL %-74d",i++)),t.eachAtom(function(t){var i=t.hetero?m:p,r=l?e:t.serial,o=t.atomname;1===o.length&&(o=" "+o),f.push(vr(i,r,o,t.resname,n(t.chainname," "),t.resno,t.x,t.y,t.z,n(t.occurence,1),n(t.bfactor,0),n(t.segid,""),n(t.element,""))),e+=1}),f.push(vr("%-80s","ENDMDL")),i+=1}),f.push(vr("%-80s","END"))}function s(){return i(),f.join("\n")}function c(){return new Blob([s()],{type:"text/plain"})}function h(t,e){t=t||"structure",e=e||"pdb";var i=t+"."+e,n=c();v(n,i)}var u=Object.assign({},e),l=void 0===u.renumberSerial||u.renumberSerial,d=u.remarks||[];Array.isArray(d)||(d=[d]);var f,p="ATOM %5d %-4s %3s %1s%4d %8.3f%8.3f%8.3f%6.2f%6.2f %4s%2s",m="HETATM%5d %-4s %3s %1s%4d %8.3f%8.3f%8.3f%6.2f%6.2f %4s%2s";this.getString=s,this.getBlob=c,this.download=h}function wr(){this.count=0,this.signals={countChanged:new Rn}}function _r(t){this.name=t||"",this.nextGid=1,this.objectList=[],this.rangeList=[]}function Sr(){this.signals={updated:new Rn},this.begin(),this.maxDuration=-(1/0),this.minDuration=1/0,this.avgDuration=14,this.lastDuration=1/0,this.prevFpsTime=0,this.lastFps=1/0,this.lastFrames=1,this.frames=0,this.count=0}function Ar(t,e){function i(t){d.enabled!==!1&&(v=g,g===f.NONE&&(t.keyCode!==d.keys[f.ROTATE]||d.noRotate?t.keyCode!==d.keys[f.ZOOM]||d.noZoom?t.keyCode!==d.keys[f.PAN]||d.noPan||(g=f.PAN):g=f.ZOOM:g=f.ROTATE))}function n(){d.enabled!==!1&&(g=v)}function r(t){d.enabled!==!1&&(g===f.NONE&&(g=t.button),g!==f.ROTATE||d.noRotate?g!==f.ZOOM||d.noZoom?g!==f.PAN||d.noPan||(C.copy(O(t.pageX,t.pageY)),T.copy(C)):(S.copy(O(t.pageX,t.pageY)),A.copy(S)):(x.copy(k(t.pageX,t.pageY)),b.copy(x)),document.addEventListener("mousemove",o,!1),document.addEventListener("mouseup",a,!1),d.dispatchEvent(L))}function o(t){d.enabled!==!1&&(g!==f.ROTATE||d.noRotate?g!==f.ZOOM||d.noZoom?g!==f.PAN||d.noPan||T.copy(O(t.pageX,t.pageY)):A.copy(O(t.pageX,t.pageY)):(b.copy(x),x.copy(k(t.pageX,t.pageY))))}function a(){d.enabled!==!1&&(g=f.NONE,document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",a),d.dispatchEvent(R))}function s(t){if(d.enabled!==!1){var e=0;e=t.wheelDelta?t.wheelDelta/40:t.detail?-t.detail/3:3*-t.deltaY,S.y+=.01*e,d.dispatchEvent(L),d.dispatchEvent(R)}}function c(t){if(d.enabled!==!1){switch(t.touches.length){case 1:g=f.TOUCH_ROTATE,x.copy(k(t.touches[0].pageX,t.touches[0].pageY)),b.copy(x);break;default:g=f.TOUCH_ZOOM_PAN;var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY;P=M=Math.sqrt(e*e+i*i);var n=(t.touches[0].pageX+t.touches[1].pageX)/2,r=(t.touches[0].pageY+t.touches[1].pageY)/2;C.copy(O(n,r)),T.copy(C)}d.dispatchEvent(L)}}function h(t){if(d.enabled!==!1)switch(t.touches.length){case 1:b.copy(x),x.copy(k(t.touches[0].pageX,t.touches[0].pageY));break;default:var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY;P=Math.sqrt(e*e+i*i);var n=(t.touches[0].pageX+t.touches[1].pageX)/2,r=(t.touches[0].pageY+t.touches[1].pageY)/2;T.copy(O(n,r))}}function u(t){if(d.enabled!==!1){switch(t.touches.length){case 0:g=f.NONE;break;case 1:g=f.TOUCH_ROTATE,x.copy(k(t.touches[0].pageX,t.touches[0].pageY)),b.copy(x)}d.dispatchEvent(R)}}function l(t){t.preventDefault()}var d=this,f={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4};this.object=t,this.domElement=void 0!==e?e:document,this.enabled=!0,this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.keys=[65,83,68],this.target=new N;var p=1e-6,m=new N,g=f.NONE,v=f.NONE,y=new N,b=new I,x=new I,w=new N,_=0,S=new I,A=new I,M=0,P=0,C=new I,T=new I;this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.up0=this.object.up.clone();var E={type:"change"},L={type:"start"},R={type:"end"};this.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 t=this.domElement.getBoundingClientRect(),e=this.domElement.ownerDocument.documentElement;this.screen.left=t.left+window.pageXOffset-e.clientLeft,this.screen.top=t.top+window.pageYOffset-e.clientTop,this.screen.width=t.width,this.screen.height=t.height}},this.handleEvent=function(t){"function"==typeof this[t.type]&&this[t.type](t)};var O=function(){var t=new I;return function(e,i){return t.set((e-d.screen.left)/d.screen.width,(i-d.screen.top)/d.screen.height),t}}(),k=function(){var t=new I;return function(e,i){return t.set((e-.5*d.screen.width-d.screen.left)/(.5*d.screen.width),(d.screen.height+2*(d.screen.top-i))/d.screen.width),t}}();this.rotateCamera=function(){var t,e=new N,i=new D,n=new N,r=new N,o=new N,a=new N;return function(){a.set(x.x-b.x,x.y-b.y,0),t=a.length(),t?(y.copy(d.object.position).sub(d.target),n.copy(y).normalize(),r.copy(d.object.up).normalize(),o.crossVectors(r,n).normalize(),r.setLength(x.y-b.y),o.setLength(x.x-b.x),a.copy(r.add(o)),e.crossVectors(a,y).normalize(),t*=d.rotateSpeed,i.setFromAxisAngle(e,t),y.applyQuaternion(i),d.object.up.applyQuaternion(i),w.copy(e),_=t):!d.staticMoving&&_&&(_*=Math.sqrt(1-d.dynamicDampingFactor),y.copy(d.object.position).sub(d.target),i.setFromAxisAngle(w,_),y.applyQuaternion(i),d.object.up.applyQuaternion(i)),b.copy(x)}}(),this.zoomCamera=function(){var t;g===f.TOUCH_ZOOM_PAN?(t=M/P,M=P,y.multiplyScalar(t),void 0===d.object.fov&&(d.object.zoom*=t)):(t=1+(A.y-S.y)*d.zoomSpeed,1!==t&&t>0&&(y.multiplyScalar(t),void 0===d.object.fov&&(d.object.zoom/=t),d.staticMoving?S.copy(A):S.y+=(A.y-S.y)*this.dynamicDampingFactor))},this.panCamera=function(){var t=new I,e=new N,i=new N;return function(){if(t.copy(T).sub(C),t.lengthSq()){if(void 0===d.object.fov){var n=(d.object.right-d.object.left)/d.object.zoom,r=(d.object.top-d.object.bottom)/d.object.zoom;t.x*=n,t.y*=r}else t.multiplyScalar(y.length()*d.panSpeed);i.copy(y).cross(d.object.up).setLength(t.x),i.add(e.copy(d.object.up).setLength(t.y)),d.object.position.add(i),d.target.add(i),d.staticMoving?C.copy(T):C.add(t.subVectors(T,C).multiplyScalar(d.dynamicDampingFactor))}}}(),this.checkDistances=function(){d.noZoom&&d.noPan||(y.lengthSq()>d.maxDistance*d.maxDistance&&(d.object.position.addVectors(d.target,y.setLength(d.maxDistance)),S.copy(A)),y.lengthSq()p&&(d.dispatchEvent(E),m.copy(d.object.position))},this.reset=function(){g=f.NONE,v=f.NONE,d.target.copy(d.target0),d.object.position.copy(d.position0),d.object.up.copy(d.up0),y.subVectors(d.object.position,d.target),d.object.lookAt(d.target),d.dispatchEvent(E),m.copy(d.object.position)},this.dispose=function(){this.domElement.removeEventListener("contextmenu",l,!1),this.domElement.removeEventListener("mousedown",r,!1),this.domElement.removeEventListener("mousewheel",s,!1),this.domElement.removeEventListener("wheel",s,!1),this.domElement.removeEventListener("MozMousePixelScroll",s,!1),this.domElement.removeEventListener("touchstart",c,!1),this.domElement.removeEventListener("touchend",u,!1),this.domElement.removeEventListener("touchmove",h,!1),document.removeEventListener("mousemove",o,!1),document.removeEventListener("mouseup",a,!1),window.removeEventListener("keydown",i,!1),window.removeEventListener("keyup",n,!1)},this.domElement.addEventListener("contextmenu",l,!1),this.domElement.addEventListener("mousedown",r,!1),this.domElement.addEventListener("mousewheel",s,!1),this.domElement.addEventListener("wheel",s,!1),this.domElement.addEventListener("MozMousePixelScroll",s,!1),this.domElement.addEventListener("touchstart",c,!1),this.domElement.addEventListener("touchend",u,!1),this.domElement.addEventListener("touchmove",h,!1),window.addEventListener("keydown",i,!1),window.addEventListener("keyup",n,!1),this.handleResize(),this.update()}function Mr(t){if(void 0===t)return"";var e=[];for(var i in t){var n=t[i];n!==!1&&e.push("#define "+i+" "+n)}return e.join("\n")+"\n"}function Pr(t,e){e=e||{};var i=t+"|";for(var n in e)i+=n+":"+e[n];if(!Cv[i]){var r=Mr(e),o=_v.get("shader/"+t);if(!o)throw"empty shader, '"+t+"'";o=o.replace(Pv,function(t,e){var i="shader/chunk/"+e+".glsl",n=_v.get(i)||Mp[e];return n?n:""}),Cv[i]=r+o}return Cv[i]}function Cr(t,e,i,n){function r(e){var n=e%h,r=Math.floor(e/h),o=n*m,a=r*g;i.camera.setViewOffset(m*h,g*h,o,a,m,g),i.render(),u?v.drawImage(t.domElement,Math.floor(o/2),Math.floor(a/2),Math.ceil(m/2),Math.ceil(g/2)):v.drawImage(t.domElement,Math.floor(o),Math.floor(a),Math.ceil(m),Math.ceil(g)),"function"==typeof l&&l(e+1,f,!1)}function o(){i.setSampling(y),i.camera.view=null,"function"==typeof d&&d(f+1,f,!1)}function a(){for(var t=0;t<=f;++t)t===f?o():r(t)}function s(){function t(){e===f?o():r(e),e+=1}for(var e=0,i=0;i<=f;++i)setTimeout(t,0,i)}var c=n||{},h=void 0!==c.factor?c.factor:2,u=void 0!==c.antialias&&c.antialias,l=c.onProgress,d=c.onFinish;u&&(h*=2);var f=h*h,p=document.createElement("canvas"),m=i.width,g=i.height;u?(p.width=m*h/2,p.height=g*h/2):(p.width=m*h,p.height=g*h);var v=p.getContext("2d"),y=i.sampleLevel;i.setSampling(-1),this.render=a,this.renderAsync=s,this.canvas=p}function Tr(t,e,i,n,r){i=i||1,n=n||0;var o,a,s,c=r?r.length:t.length/i,h=0,u=0;if(r)for(a=0;ae?1:t=h&&e(t[o],l)>0;)t[o+1]=t[o],--o;t[o+1]=l}if(c===-1)break;u=s[c--],h=s[c--]}else{var f=h+u>>1;for(o=h+1,a=u,r(f,o),e(t[h],t[u])>0&&r(h,u),e(t[o],t[u])>0&&r(o,u),e(t[h],t[o])>0&&r(h,o),l=t[o];;){do o++;while(e(t[o],l)<0);do a--;while(e(t[a],l)>0);if(a=a-h?(s[++c]=o,s[++c]=u,u=a-1):(s[++c]=h,s[++c]=a-1,h=o)}return t}function kr(t,e,i,n,r){var o,a,s,c,h=t.height,u=t.width,l=t.getContext("2d"),d=l.getImageData(0,0,u,h).data;for(s=!1,a=0;a=0;a--){for(o=u-1;o>=0;o--)if(c=4*(a*u+o),d[c]!==e||d[c+1]!==i||d[c+2]!==n||d[c+3]!==r){s=!0;break}if(s)break}var m=a;for(s=!1,o=u-1;o>=0;o--){for(a=h-1;a>=0;a--)if(c=4*(a*u+o),d[c]!==e||d[c+1]!==i||d[c+2]!==n||d[c+3]!==r){s=!0;break}if(s)break}var g=o,v=document.createElement("canvas");v.width=g-p,v.height=m-f;var y=v.getContext("2d");return y.drawImage(t,p,f,v.width,v.height,0,0,v.width,v.height),v}function Fr(t,e){function i(e){var i=s;c&&(i*=2),e&&(i=1/i),t.scene.traverse(function(t){var e=t.material;e&&e.linewidth&&(e.linewidth*=i),e&&e.uniforms&&e.uniforms.size&&void 0===e.uniforms.size.__seen&&(e.uniforms.size.value*=i,e.uniforms.size.__seen=!0)}),t.scene.traverse(function(t){var e=t.material;e&&e.uniforms&&e.uniforms.size&&delete e.uniforms.size.__seen})}function n(t){if(a){var e=f,i=0|(h?0:255*e.r),n=0|(h?0:255*e.g),r=0|(h?0:255*e.b),o=0|(h?0:255);return kr(t,i,n,r,o)}return t}function r(t,e,i){"function"==typeof o.onProgress&&o.onProgress(t,e,i)}var o=e||{},a=void 0!==o.trim&&o.trim,s=void 0!==o.factor?o.factor:1,c=void 0!==o.antialias&&o.antialias,h=void 0!==o.transparent&&o.transparent,u=t.renderer,l=t.camera,d=u.getClearAlpha(),f=u.getClearColor();return new Promise(function(e){function o(o,s){var c=n(a.canvas);c.toBlob(function(n){u.setClearAlpha(d),i(!0),t.requestRender(),r(s,s,!0),e(n)},"image/png")}var a=new Cr(u,l,t,{factor:s,antialias:c,onProgress:r,onFinish:o});u.setClearAlpha(h?0:1),i(),a.renderAsync()})}function zr(t,e){var i;t.traverseVisible(function(t){if(t instanceof He&&t.sortParticles){var n=t.geometry.attributes,r=n.position.count;if(0!==r){Iv.multiplyMatrices(e.matrixWorldInverse,t.matrixWorld),Lv.multiplyMatrices(e.projectionMatrix,Iv);var o,a,s,c;for(t.userData.sortData?(o=t.userData.sortData,s=o.__zArray,a=o.__sortArray,c=o.__cmpFn):(s=new Float32Array(r),a=new Uint32Array(r),c=function(t,e){var i=s[t],n=s[e];return i>n?1:i500&&!Q&&K<3&&K!==-1){var i=K;K=3,Z=!0,B(),Q=!0,K=i,t.Debug&&mv.log("rendered still frame")}var n=et;n.spinAxis&&n.spinAngle&&(Dt(n.spinAxis,n.spinAngle*it.lastDuration/16),T()),requestAnimationFrame(C)}function T(){Z||(performance.now()-it.startTime>22&&(it.begin(),Q=!1),Z=!0,requestAnimationFrame(function(){B(),it.update()}))}function E(){var t=et;J=Rt.copy(ot.position).sub(At.target).length(),J||(ot.position.set(0,0,t.cameraZ),J=Math.abs(t.cameraZ)),tt=Math.max(10,.5*Lt),tt+=Tt.center(Rt).length(),(tt===1/0||tt===-(1/0)||isNaN(tt))&&(tt=50);var e=(50-t.clipNear)/50,i=-(50-t.clipFar)/50;ot.near=Math.max(.1,t.clipDist,J-tt*e),ot.far=Math.max(1,J+tt*i);var n=(50-t.fogNear)/50,r=-(50-t.fogFar)/50,o=at.fog;o.color.set(t.fogColor),o.near=Math.max(.1,J-tt*n),o.far=Math.max(1,J+tt*r)}function I(){E();var t=Dn(nt.fov),e=(ot.near+ot.far)/2,i=2*Math.tan(t/2)*e;rt.zoom=X/i}function L(){ot.updateMatrix(),ot.updateMatrixWorld(!0),ot.matrixWorldInverse.getInverse(ot.matrixWorld),ot.updateProjectionMatrix(),Br(at,ot,pt,J,tt),zr(at,ot)}function R(t,e,i,n){ut.visible=t,lt.visible=e,dt.visible=i,ft.visible=n}function O(){Rt.copy(ot.position).sub(At.target).setLength(100*Lt),st.position.copy(ot.position).add(Rt),st.color.set(et.lightColor),st.intensity=et.lightIntensity,ct.color.set(et.ambientColor),ct.intensity=et.ambientIntensity}function k(){pt.clearTarget(gt),R(!1,!0,!1,!1),pt.render(at,ot,gt),M(),pt.setRenderTarget(null)}function F(e){e?pt.clearTarget(e):pt.clear(),R(!1,!1,!0,!1),pt.render(at,ot,e),e?pt.clearTarget(e,!1,!0,!1):pt.clearDepth(),M(),R(!0,!1,!1,t.Debug),pt.render(at,ot,e),M()}function z(){var t=Dv[Math.max(0,Math.min(K,5))],e=1/t.length,i=1/32;bt.tForeground.value=vt.texture;for(var n=vt.width,r=vt.height,o=0;o0?z():F(),Y=!1,void(Z=!1))}function U(){mv.log("scene cleared"),at.remove(ht),o(),pt.clear()}function j(t,e){if(void 0===e?Tt.isEmpty()||kt(Tt.center()):kt(e),t){var i;if(t===!0){var n=It,r=Math.max(n.x,n.y,n.z),o=Math.min(n.x,n.y,n.z);i=r+Math.sqrt(o)}else i=t;var a=Dn(nt.fov),s=W/X,c=Xr&&(r=h),u>o&&(o=u),l>a&&(a=l)}return[Yr([e,i,n]),Yr([r,o,a])]}function Wr(t,e){for(var i=0,n=e.length;ie?(e/=t,t*Math.sqrt(1+e*e)):e>0?(t/=e,e*Math.sqrt(1+t*t)):0}function xo(t,e,i,n,r,o,a,s){for(var c=2*Bv,h=Uv,u=0,l=0,d=0,f=0,p=Math.max(o,30),m=0,g=0,v=0,y=0,b=0,x=0,w=0,_=0,S=0,A=0,M=0,P=0,C=0,T=0,E=0,I=0,L=0,R=4660,O=0,D=0,N=0,k=new Float64Array(a<<3);u>16&32767&256)?D:-D,t[u*e+d]=O;for(f=0;f<2;f++)for(l=0;l>o),f=Math.max(0,e-n-c>>o),p=Math.max(0,i-n-h>>o),y=Math.min(u,t+n-s>>o),x=Math.min(l,e+n-c>>o),w=Math.min(d,i+n-h>>o),_=[],S=a;S<=y;++S)for(var A=f;A<=x;++A)for(var P=p;P<=w;++P){var T=(S*l+A)*d+P,I=b[T];if(I>0)for(var L=I-1,R=C[L],O=M[L],D=R+O,N=R;N>o)+1,l=(a.max.y-c>>o)+1,d=(a.max.z-h>>o)+1,f=u*l*d,p=t.count,m=t.x,g=t.y,v=t.z,y=0,b=new Uint32Array(f),x=new Int32Array(p);for(n=0;n>o,_=g[n]-c>>o,S=v[n]-h>>o,A=(w*l+_)*d+S;1===(b[A]+=1)&&(y+=1),x[n]=A}var M=new Uint16Array(y);for(n=0,r=0;n0&&(b[n]=r+1,M[r]=P,r+=1)}var C=new Uint32Array(y);for(n=1;n0){var L=I-1;E[C[L]+T[L]]=n,T[L]+=1}}this.within=i}function Ro(e,i){t.Debug&&mv.time("BondHash init");var n,r=e.count,o=e.atomIndex1,a=e.atomIndex2,s=new Uint8Array(i),c=new Int32Array(i);for(n=0;ns&&(s=e);var a=o-r;if(0===a)return-1;var h=4*l;if(l+=1,1===a)return u[h]=r,u[h+1]=-1,u[h+2]=-1,u[h+3]=n,h;var f=r+Math.floor(a/2);d=e%3;for(var p,m,g,v,y,b=r,x=o-1;x>b;){for(g=b+x>>1,v=t[3*c[g]+d],m=c[g],c[g]=c[x],c[x]=m,y=b,p=b;pr&&s.pop()}var d,f,p=n(h)%3,m=3*c[u[h]],g=[t[m+0],t[m+1],t[m+2]],v=e(i,g),y=u[h+1],b=u[h+2];if(b===-1&&y===-1)return void((s.size()t[3*c[u[e]]+r])throw"left child is > parent!";n+=o(a,i+1)}if(s!==-1){if(t[3*c[u[s]]+r]0&&(e=":"+x(t).join(" OR :")),new On(e)}function Wo(t){this.name=t||"",this.partList=[]}function Xo(t,e){this.matrixList=t||[],this.chainList=e||[]}function qo(e,i){if(i){t.Debug&&mv.time("assignSecondaryStructure");var n=[];e.eachModel(function(t){t.eachChain(function(t){n.push(t.chainname)})});var r=n.slice().sort(),o=[];r.forEach(function(t){o.push(n.indexOf(t))});var a=i.helices;a=a.filter(function(t){return au(r,t[0])>=0}),a.sort(function(t,e){var i=t[0],n=e[0],a=t[1],s=e[1];if(i===n)return a===s?0:a=0}),c.sort(function(t,e){var i=t[0],n=e[0];if(i===n)return 0;var a=au(r,i),s=au(r,n);return o[a]=r;)e=Math.floor(e/r),o+=n[e%r],i+=1;return i>=5&&mv.warn("chainname overflow"),o},u=e.getAtomProxy(),l=e.getAtomProxy(),d=0,f=0,p=0,m=0,g=[];1===s.count?g.push({mIndex:0,chainname:"A",rStart:0,rCount:1}):e.eachResidueN(2,function(t,e){var i=!1,n=t.backboneType,r=e.backboneType,o=im;m=t.index,t.modelIndex!==e.modelIndex?i=!0:t.moleculeType!==e.moleculeType?i=!0:n!==o&&n===r&&(u.index=t.backboneEndAtomIndex,l.index=e.backboneStartAtomIndex,u.connectedTo(l)||(i=!0)),i||e.index!==s.count-1||(i=!0,m=e.index),i&&(g.push({mIndex:f,chainname:h(d),rStart:p,rCount:m-p+1}),d+=1,t.modelIndex!==e.modelIndex&&(d=0,f+=1),e.index===s.count-1&&m!==e.index&&g.push({mIndex:f,chainname:h(d),rStart:s.count-1,rCount:1}),p=e.index,m=e.index)}),a.count=0,g.forEach(function(t){c(t.mIndex,t.chainname,t.rStart,t.rCount)});var v=0;e.eachModel(function(t){o.chainOffset[t.index]=v,o.chainCount[t.index]-=1,v+=o.chainCount[t.index]})}t.Debug&&mv.timeEnd("calculateChainnames")}function Zo(e){t.Debug&&mv.time("calculateBonds"),Jo(e),ta(e),t.Debug&&mv.timeEnd("calculateBonds")}function Ko(e){var i=e.structure,n=i.getAtomProxy(),r=i.getAtomProxy(),o=e.atomCount,a=e.atomOffset,s=a+o,c=s-1;if(o>500)return void(t.Debug&&mv.warn("more than 500 atoms, skip residue for auto-bonding",e.qualifiedName()));var h,u,l=[],d=[],f=[];if(o>50){var p=new Vo(e,!0),m=e.isCg()?1.2:2.3;for(h=a;h500)return void mv.warn("more than 500 atoms, skip residue for auto-bonding",t.qualifiedName());for(var l=t.getBonds(),d=l.atomIndices1,f=l.atomIndices2,p=l.bondOrders,m=d.length,g=0;g1&&(c.x-=1),s.x<0&&(c.x+=1),s.y>1&&(c.y-=1),s.y<0&&(c.y+=1),s.z>1&&(c.z-=1),s.z<0&&(c.z+=1),t&&c.add(t),h.setPosition(c),h.multiplyMatrices(n.fracToCart,h),h.multiply(n.cartToFrac),e.push(h)}),e}if(e.unitcell){t.Debug&&mv.time("buildUnitcellAssembly");var n=e.unitcell,r=e.center.clone().applyMatrix4(n.cartToFrac),o=Go(n.spacegroup),a=new N,s=new N,c=new N;r.x>1&&(a.x-=1),r.x<0&&(a.x+=1),r.y>1&&(a.y-=1),r.y<0&&(a.y+=1),r.z>1&&(a.z-=1),r.z<0&&(a.z+=1);var h,u=new Wo("UNITCELL"),l=i();if(e.biomolDict.NCS){h=[new O].concat(e.biomolDict.NCS.partList[0].matrixList);var d=[];l.forEach(function(t){h.forEach(function(e){d.push(t.clone().multiply(e))})}),u.addPart(d)}else u.addPart(l);var f=new N,p=new Wo("SUPERCELL"),m=Array.prototype.concat.call(i(),i(f.set(1,1,1)),i(f.set(-1,-1,-1)),i(f.set(1,0,0)),i(f.set(1,1,0)),i(f.set(1,0,1)),i(f.set(0,1,0)),i(f.set(0,1,1)),i(f.set(0,0,1)),i(f.set(-1,0,0)),i(f.set(-1,-1,0)),i(f.set(-1,0,-1)),i(f.set(0,-1,0)),i(f.set(0,-1,-1)),i(f.set(0,0,-1)),i(f.set(1,-1,-1)),i(f.set(1,1,-1)),i(f.set(1,-1,1)),i(f.set(-1,1,1)),i(f.set(-1,-1,1)),i(f.set(-1,1,-1)),i(f.set(0,1,-1)),i(f.set(0,-1,1)),i(f.set(1,0,-1)),i(f.set(-1,0,1)),i(f.set(1,-1,0)),i(f.set(-1,1,0)));if(e.biomolDict.NCS){var g=[];m.forEach(function(t){h.forEach(function(e){g.push(t.clone().multiply(e))})}),p.addPart(g)}else p.addPart(m);e.biomolDict.UNITCELL=u,e.biomolDict.SUPERCELL=p,t.Debug&&mv.timeEnd("buildUnitcellAssembly")}}function ia(t){var e=t.bondHash,i=e.countArray,n=e.offsetArray,r=e.indexArray,o=t.getBondProxy();t.eachResidue(function(t){var e=t.residueType;if(void 0===e.bonds){var a=t.atomOffset,s=[],c=[],h=[],u={};t.eachAtom(function(t){for(var e=t.index,l=n[e],d=i[e],f=0,p=d;fg){var v=g;g=m,m=v}var y=m+"|"+g;void 0===u[y]&&(u[y]=!0,s.push(m-a),c.push(g-a),h.push(o.bondOrder))}}),e.bonds={atomIndices1:s,atomIndices2:c,bondOrders:h}}})}function na(t,e,i){this.structure=t,i=i||Gv(e),this.atomname=e,this.element=i,this.vdw=gm[i],this.covalent=ym[i]}function ra(t){function e(t,e){return t+"|"+e}function i(i,n){n=n||Gv(i);var a=e(i,n),s=r[a];if(void 0===s){var c=new na(t,i,n);s=o.length,r[a]=s,o.push(c)}return s}function n(t){return o[t]}var r={},o=[];this.add=i,this.get=n,this.list=o,this.dict=r,this.toJSON=function(){var t={metadata:{version:.1,type:"AtomMap",generator:"AtomMapExporter"},idDict:r,typeList:o.map(function(t){return t.toJSON()})};return t},this.fromJSON=function(e){r=e.idDict,o=e.typeList.map(function(e){return new na(t,e.atomname,e.element)}),this.list=o,this.dict=r}}function oa(t,e,i,n,r,o){this.structure=t,this.resname=e,this.atomTypeIdList=i,this.hetero=n?1:0,this.chemCompType=r,this.bonds=o,this.rings=void 0,this.atomCount=i.length,this.moleculeType=this.getMoleculeType(),this.backboneType=this.getBackboneType(0),this.backboneEndType=this.getBackboneType(-1),this.backboneStartType=this.getBackboneType(1),this.backboneIndexList=this.getBackboneIndexList();var a=Rm[this.backboneType],s=Rm[this.backboneStartType],c=Rm[this.backboneEndType],h=this.getAtomIndexByName(a.trace);this.traceAtomIndex=void 0!==h?h:-1;var u=this.getAtomIndexByName(a.direction1);this.direction1AtomIndex=void 0!==u?u:-1;var l=this.getAtomIndexByName(a.direction2);this.direction2AtomIndex=void 0!==l?l:-1;var d=this.getAtomIndexByName(s.backboneStart);this.backboneStartAtomIndex=void 0!==d?d:-1;var f=this.getAtomIndexByName(c.backboneEnd);this.backboneEndAtomIndex=void 0!==f?f:-1;var p;p=Pm.includes(e)?this.getAtomIndexByName("N1"):this.getAtomIndexByName("N3"),this.rungEndAtomIndex=void 0!==p?p:-1,this.bondReferenceAtomIndices=[]}function aa(t){function e(t,e,i,n){return t+"|"+e.join(",")+"|"+(i?1:0)+"|"+(n?n:"")}function i(i,n,a,s,c){i=i.toUpperCase();var h=e(i,n,a,s),u=r[h];if(void 0===u){var l=new oa(t,i,n,a,s,c);u=o.length,r[h]=u,o.push(l)}return u}function n(t){return o[t]}var r={},o=[];this.add=i,this.get=n,this.list=o,this.dict=r}function sa(t,e){this.structure=t,this.bondStore=t.bondStore,this.index=e,this._v12=new N,this._v13=new N,this._ap1=this.structure.getAtomProxy(),this._ap2=this.structure.getAtomProxy(),this._ap3=this.structure.getAtomProxy()}function ca(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.atomStore=t.atomStore,this.residueMap=t.residueMap,this.atomMap=t.atomMap,this.bondHash=t.bondHash,this.index=e}function ha(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.atomStore=t.atomStore,this.residueMap=t.residueMap,this.atomMap=t.atomMap,this.index=e}function ua(t,e,i){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.atomStore=t.atomStore,this.residueIndexStart=e,this.residueIndexEnd=i,this.residueCount=i-e+1;var n=this.structure.getResidueProxy(this.residueIndexStart),r=this.structure.getResidueProxy(this.residueIndexEnd);this.isPrevConnected=void 0!==n.getPreviousConnectedResidue();var o=r.getNextConnectedResidue();this.isNextConnected=void 0!==o,this.isNextNextConnected=this.isNextConnected&&void 0!==o.getNextConnectedResidue(),this.isCyclic=r.connectedTo(n),this.__residueProxy=this.structure.getResidueProxy()}function la(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.index=e}function da(t,e){this.structure=t,this.modelStore=t.modelStore,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.index=e}function fa(t,e){this.signals={refreshed:new Rn},this.name=t,this.path=e,this.title="",this.id="",this.header={},this.atomSetCache=void 0,this.atomSetDict={},this.biomolDict={},this.entityList=[],this.unitcell=void 0,this.frames=[],this.boxes=[],this.bondStore=new Do(0),this.backboneBondStore=new Do(0),this.rungBondStore=new Do(0),this.atomStore=new No(0),this.residueStore=new ko(0),this.chainStore=new Fo(0),this.modelStore=new zo(0),this.atomMap=new ra(this),this.residueMap=new aa(this),this.bondHash=void 0,this.spatialHash=void 0,this.atomSet=void 0,this.bondSet=void 0,this.center=void 0,this.boundingBox=void 0,this._bp=this.getBondProxy(), +this._ap=this.getAtomProxy(),this._rp=this.getResidueProxy(),this._cp=this.getChainProxy()}function pa(t,e,i){this.name=t,this.path=e,this.info={},this.center=new N,this.boundingBox=new Et,i instanceof ae||i instanceof he||i instanceof We?this.fromGeometry(i):i&&this.set(i.position,i.index,i.normal,i.color,i.atomindex)}function ma(e){var i=0,n=0,r={},o={},a=URL.createObjectURL(vv.get(e)),s=new window.Worker(a);vv.activeWorkerCount+=1,s.onmessage=function(n){i-=1;var a=n.data.__postId;t.Debug&&mv.timeEnd("Worker.postMessage "+e+" #"+a),r[a]&&r[a].call(s,n),delete r[a],delete o[a]},s.onerror=function(t){if(i-=1,t.data){var n=t.data.__postId;o[n]?o[n].call(s,t):mv.error("Worker.onerror",n,e,t),delete r[n],delete o[n]}else mv.error("Worker.onerror",e,t)},this.name=e,this.post=function(a,c,h,u){r[n]=h,o[n]=u,a=a||{},a.__name=e,a.__postId=n,a.__debug=t.Debug,t.Debug&&mv.time("Worker.postMessage "+e+" #"+n);try{s.postMessage(a,c)}catch(t){mv.error("worker.post:",t),s.postMessage(a)}return i+=1,n+=1,this},this.terminate=function(){s?(s.terminate(),URL.revokeObjectURL(a),vv.activeWorkerCount-=1):mv.log("no worker to terminate")},Object.defineProperties(this,{postCount:{get:function(){return n}},pending:{get:function(){return i}}})}function ga(t,e){e=Math.min(8,e||2);var i=[],n=0;this.name=t,this.maxCount=e,this.post=function(t,e,i,n){var r=this.getNextWorker();return r.post(t,e,i,n),this},this.terminate=function(){i.forEach(function(t){t.terminate()})},this.getNextWorker=function(){for(var r,o=1/0,a=0;a=n){r=new ma(t),i.push(r),n+=1;break}var s=i[a];if(0===s.pending){o=s.pending,r=s;break}s.pending=g){L=m,T=!0;break}if(T)break}if(T)break}for(T=!1,p=o;p=g){I=p,T=!0;break}if(T)break}if(T)break}for(T=!1,d=r;d=g){E=d,T=!0;break}if(T)break}if(T)break}for(T=!1,m=h;m>=a;--m){for(p=c;p>=o;--p){for(d=s;d>=r;--d)if(l=e*i*m+e*p+d,t[l]>=g){D=m,T=!0;break}if(T)break}if(T)break}for(T=!1,p=c;p>=o;--p){for(m=D;m>=a;--m){for(d=s;d>=r;--d)if(l=e*i*m+e*p+d,t[l]>=g){O=p,T=!0;break}if(T)break}if(T)break}for(T=!1,d=s;d>=r;--d){for(p=O;p>=o;--p){for(m=D;m>=a;--m)if(l=e*i*m+e*p+d,t[l]>=g){R=d,T=!0;break}if(T)break}if(T)break}for(v?(r=Math.max(0,E-1),o=Math.max(0,I-1),a=Math.max(0,L-1),s=Math.min(e-1,R+1),c=Math.min(i-1,O+1),h=Math.min(n-1,D+1)):(r=Math.max(1,E-1),o=Math.max(1,I-1),a=Math.max(1,L-1),s=Math.min(e-2,R+1),c=Math.min(i-2,O+1),h=Math.min(n-2,D+1)),m=a;m65535?Uint32Array:Uint16Array;return{position:new Float32Array(_),normal:v?void 0:new Float32Array(S),index:new a(A),atomindex:r?new Int32Array(M):void 0}}}function xa(t,e,i,n){i=i||1,n=n||!0;var r,o=t.length/3,a=e.length/3;n&&(r=new Float32Array(3*o));var s,c=new Float32Array(3*o),h=20,u=new Array(h);for(s=0;s65535?Uint32Array:Uint16Array,a=new o(3*r),s=0;s65535?Uint32Array:Uint16Array;this.meshIndex=new h(c*o*3),this.makeIndex(),La.call(this,this.meshPosition,this.meshColor,this.meshIndex,this.meshNormal,this.meshPickingColor,a),this.initNormals=!0,this.setAttributes({position:t,color:e,pickingColor:i}),this.initNormals=!1}function ka(t,e,i,n,r){var o=r||{},a=d(o.sphereDetail,1);this.geo=new wn(1,a),this._radius=i,Na.call(this,t,e,n,o)}function Fa(t){this.size=this.count,this.attributeSize=this.count*this.mappingSize;var e=this.count*this.mappingIndicesSize,i=this.attributeSize>65535?Uint32Array:Uint16Array;this.index=new i(e),this.makeIndex(),Ia.call(this,null,null,this.index,null,t),this.addAttributes({mapping:{type:this.mappingType,value:null}})}function za(t){this.mapping=new Float32Array([-1,1,-1,-1,1,1,1,-1]),this.mappingIndices=new Uint16Array([0,1,2,1,3,2]),this.mappingIndicesSize=6,this.mappingType="v2",this.mappingSize=4,this.mappingItemSize=2,Fa.call(this,t)}function Ba(t,e,i,n,r){this.impostor=!0,this.count=t.length/3,this.vertexShader="SphereImpostor.vert",this.fragmentShader="SphereImpostor.frag",za.call(this,r),this.addUniforms({projectionMatrixInverse:{value:new O},ortho:{value:0}}),this.addAttributes({radius:{type:"f",value:null}}),this.setAttributes({position:t,color:e,radius:i}),n&&(this.addAttributes({pickingColor:{type:"c",value:null}}),this.setAttributes({pickingColor:n}),this.pickable=!0),this.makeMapping()}function Ua(t,e,i,n,r){var o=r||{};return!pv||o.disableImpostor?new ka(t,e,i,n,r):new Ba(t,e,i,n,r)}function ja(t,e,i,n,r,o,a){var s=a||{},c=d(s.sphereDetail,2);this.updateNormals=!0,this.geo=new wn(1,c),this._radius=i,this._majorAxis=n,this._minorAxis=r,Na.call(this,t,e,o,s)}function $a(t,e,i,n,r,o,a){return new ja(t,e,i,n,r,o,a)}function Va(t,e,i,n,r,o,a,s){var c=s||{},h=d(c.radialSegments,10),u=d(c.openEnded,!0);this.updateNormals=!0;var l=(new O).makeRotationX(Math.PI/2);this.geo=new yn(1,1,1,h,1,u),this.geo.applyMatrix(l);var f=t.length,p=r.length;this._position=new Float32Array(2*f),this._color=new Float32Array(2*f),this._pickingColor=new Float32Array(2*f),this._from=new Float32Array(2*f),this._to=new Float32Array(2*f),this._radius=new Float32Array(2*p),this.__center=new Float32Array(f),Na.call(this,this._position,this._color,this._pickingColor,c),this.setAttributes({position1:t,position2:e,color:i,color2:n,radius:r,pickingColor:o,pickingColor2:a})}function Ga(t){this.mapping=new Float32Array([-1,1,-1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,1]),this.mappingIndices=new Uint16Array([0,1,2,1,4,2,2,4,3,4,5,3]),this.mappingIndicesSize=12,this.mappingType="v3",this.mappingSize=6,this.mappingItemSize=3,Fa.call(this,t)}function Ha(t,e,i,n,r,o,a,s){var c=s||{};this.openEnded=d(c.openEnded,!1),this.impostor=!0,this.count=t.length/3,this.vertexShader="CylinderImpostor.vert",this.fragmentShader="CylinderImpostor.frag",Ga.call(this,c);var h=new rn(new O).onUpdate(function(t){this.value.getInverse(t.modelViewMatrix)});this.addUniforms({modelViewMatrixInverse:h,ortho:{value:0}}),this.addAttributes({position1:{type:"v3",value:null},position2:{type:"v3",value:null},color2:{type:"c",value:null},radius:{type:"f",value:null}}),this.setAttributes({position1:t,position2:e,color:i,color2:n,radius:r}),o&&(this.addAttributes({pickingColor:{type:"c",value:null},pickingColor2:{type:"c",value:null}}),this.setAttributes({pickingColor:o,pickingColor2:a}),this.pickable=!0),this.makeMapping()}function Wa(t,e,i,n,r,o,a,s){var c=s||{};return!pv||c.disableImpostor?new Va(t,e,i,n,r,o,a,s):new Ha(t,e,i,n,r,o,a,s)}function Xa(t,e,i,n,r,o){var a=o||{},s=d(a.radialSegments,60),c=d(a.openEnded,!1);this.updateNormals=!0;var h=(new O).makeRotationX(-Math.PI/2);this.geo=new Tn(1,1,s,1,c),this.geo.applyMatrix(h);var u=t.length,l=n.length;this._position=new Float32Array(u),this._from=new Float32Array(u),this._to=new Float32Array(u),this._radius=new Float32Array(l),Na.call(this,this._position,i,r,a),this.setAttributes({position1:t,position2:e,color:i,radius:n,pickingColor:r})}function qa(t,e,i,n,r,o){return new Xa(t,e,i,n,r,o)}function Ya(t,e,i,n,r,o){function a(t){var e,i,n={};if(t.radius){for(e=0,i=p.length;e65535?Uint32Array:Uint16Array;i=new r(i)}Array.isArray(n)&&(n=new Float32Array(n));var o=new La(t,e,i,n);S.push(o),_.setFromArray(t),x.union(_)}function o(t,e,n){i(t,A),i(e,M),P.push(n),x.expandByPoint(w.fromArray(t))}function a(t,e,n,r,o){i(t,C),i(e,T),E.push(n),i(r,I),i(o,L),x.expandByPoint(w.fromArray(t))}function s(t,e,n,r){i(t,R),i(e,O),i(n,D),k.push(r),x.expandByPoint(w.fromArray(t)),x.expandByPoint(w.fromArray(e))}function c(t,e,n,r){i(t,F),i(e,z),i(n,B),U.push(r),x.expandByPoint(w.fromArray(t)),x.expandByPoint(w.fromArray(e))}function h(t,e,n,r){ +i(t,j),i(e,$),i(n,V),G.push(r),x.expandByPoint(w.fromArray(t)),x.expandByPoint(w.fromArray(e))}function u(){var t=[];if(A.length){var e=new Ua(new Float32Array(A),new Float32Array(M),new Float32Array(P),void 0,{sphereDetail:m,disableImpostor:v});t.push(e)}if(C.length){var i=new $a(new Float32Array(C),new Float32Array(T),new Float32Array(E),new Float32Array(I),new Float32Array(L),void 0,{sphereDetail:m,disableImpostor:v});t.push(i)}if(R.length){var n=new Wa(new Float32Array(R),new Float32Array(O),new Float32Array(D),new Float32Array(D),new Float32Array(k),void 0,void 0,{radialSegments:g,disableImpostor:v,openEnded:y});t.push(n)}if(F.length){var r=new qa(new Float32Array(F),new Float32Array(z),new Float32Array(B),new Float32Array(U),void 0,{radialSegments:g,disableImpostor:v,openEnded:y});t.push(r)}if(j.length){var o=new Ya(new Float32Array(j),new Float32Array($),new Float32Array(V),new Float32Array(G),void 0,{aspectRatio:p,radialSegments:g,disableImpostor:v,openEnded:y});t.push(o)}return S.concat(t)}function l(){S.forEach(function(t){t.dispose()}),S.length=0,A.length=0,M.length=0,P.length=0,C.length=0,T.length=0,E.length=0,I.length=0,L.length=0,R.length=0,O.length=0,D.length=0,k.length=0,F.length=0,z.length=0,B.length=0,U.length=0,j.length=0,$.length=0,V.length=0,G.length=0}this.name=d(t,"shape");var f=e||{},p=d(f.aspectRatio,1.5),m=d(f.sphereDetail,2),g=d(f.radialSegments,50),v=d(f.disableImpostor,!1),y=d(f.openEnded,!1),b=new N,x=new Et,w=new N,_=new Et,S=[],A=[],M=[],P=[],C=[],T=[],E=[],I=[],L=[],R=[],O=[],D=[],k=[],F=[],z=[],B=[],U=[],j=[],$=[],V=[],G=[];Object.defineProperties(this,{center:{get:function(){return x.center(b)}}}),this.boundingBox=x,this.addBuffer=n,this.addMesh=r,this.addSphere=o,this.addEllipsoid=a,this.addCylinder=s,this.addCone=c,this.addArrow=h,this.getBufferList=u,this.dispose=l}function Ka(t,e,i){this.viewer=e,this.gidPool=i?i.gidPool:void 0,this.tasks=new wr,this.queue=new Pa(function(t,e){this.make(t,e)}.bind(this)),this.bufferList=[],this.init(i)}function Qa(t,e,i){Array.isArray(t)||(t=[t]),Ka.call(this,t,e,i),this.buffer=t,this.build()}function Ja(){La.apply(this,arguments)}function ts(t){this.size=t.size,this.side=t.side,this.wireframe=t.wireframe,this.visible=t.visible,this.geometry=t.geometry,this.pickable=t.pickable,this.background=t.background,this.group=new We,this.wireframeGroup=new We,this.pickingGroup=new We;var e=[],i=[],n=t,r=new t.constructor;n.makeMaterial(),r.makeMaterial(),r.geometry=t.geometry,r.wireframeGeometry=t.wireframeGeometry,r.size=t.size,r.attributeSize=t.attributeSize,r.pickable=t.pickable,r.setParameters(t.getParameters()),r.updateShader(),n.setParameters({side:"front"}),r.setParameters({side:"back",opacity:r.opacity}),this.getMesh=function(t){var o,a;return t?(a=r.getPickingMesh(),o=n.getPickingMesh()):(a=r.getMesh(),o=n.getMesh()),e.push(o),i.push(a),this.setParameters({side:this.side}),(new We).add(a,o)},this.getWireframeMesh=function(){return t.getWireframeMesh()},this.getPickingMesh=function(){return this.getMesh(!0)},this.setAttributes=function(e){t.setAttributes(e)},this.setParameters=function(t){t=Object.assign({},t),"front"===t.side?(e.forEach(function(t){t.visible=!0}),i.forEach(function(t){t.visible=!1})):"back"===t.side?(e.forEach(function(t){t.visible=!1}),i.forEach(function(t){t.visible=!0})):"double"===t.side&&(e.forEach(function(t){t.visible=!0}),i.forEach(function(t){t.visible=!0})),void 0!==t.side&&(this.side=t.side),delete t.side,n.setParameters(t),void 0!==t.wireframe&&(this.wireframe=t.wireframe,this.setVisibility(this.visible)),delete t.wireframe,r.setParameters(t)},this.setVisibility=Ia.prototype.setVisibility,this.dispose=function(){n.dispose(),r.dispose()}}function es(t,e,i){Ka.call(this,t,e,i),t instanceof Ma?(this.surface=void 0,this.volume=t):(this.surface=t,this.volume=void 0),this.boxCenter=new N,this.__boxCenter=new N,this.box=new Et,this.__box=new Et,this.setBox=function(){var t=new N;return function(){var i=e.controls.target,n=e.rotationGroup.position;t.copy(n).negate().add(i),t.equals(this.boxCenter)||this.setParameters({boxCenter:t})}.bind(this)}.bind(this)(),this.viewer.signals.orientationChanged.add(this.setBox),this.build()}function is(t){function e(t,e,i){return Math.min(Math.max(t,e),i)}function i(t,e,i,n){var r=i-t,o=n-e;return Math.sqrt(r*r+o*o)}function n(t,i,n){return n=e((n-t)/(i-t),0,1),n*n*(3-2*n)}for(var r=Object.assign({},t),o=d(r.width,256),a=d(r.height,256),s=[o/2,a/2],c=Math.min(o/2,a/2),h=d(r.delta,1/(c+1))*c,u=0,l=0,f=new Uint8Array(o*a*4),p=0,m=f.length;p1&&(l=1),r(e,i,n,o,u,p),r(e,i,n,o,l,m),m.sub(p).normalize(),m.toArray(a,g)}}function s(e,i,n,r,o){for(var a,s=i.next(),c=i.next(),h=i.next(),u=i.size,l=u-1,d=r||0,f=0;f65535?Uint32Array:Uint16Array;this.meshIndex=new p(f),this.makeIndex(),La.call(this,this.meshPosition,this.meshColor,this.meshIndex,this.meshNormal,this.meshPickingColor,c),this.setAttributes({position:t,normal:e,binormal:i,tangent:n,color:r,size:o,pickingColor:a})}function ks(t,e,i){os.call(this,t,e,i)}function Fs(t,e){this.sview1=t,this.sview2=e,this.kdtree2=new Vo(e)}function zs(t,e,i){e=e||3.5,i=i||40;for(var n=new On("( ARG and ( .NE or .NH1 or .NH2 ) ) or ( ASP and .ND2 ) or ( GLN and .NE2 ) or ( HIS and ( .ND1 or .NE2 ) ) or ( LYS and .NZ ) or ( SER and .OG ) or ( THR and .OG1 ) or ( TRP and .NE1 ) or ( TYR and .OH ) or ( PROTEIN and .N )"),r=new On("( ASN and .OD1 ) or ( ASP and ( OD1 or .OD2 ) ) or ( GLN and .OE1 ) or ( GLU and ( .OE1 or .OE2 ) ) or ( HIS and ( .ND1 or .NE2 ) ) or ( SER and .OG ) or ( THR and .OG1 ) or ( TYR and .OH ) or ( PROTEIN and .O )"),o=t.getView(n),a=t.getView(r),s=new Fs(o,a),c=s.within(e),h=c.bondStore,u=t.getAtomProxy(),l=t.getAtomProxy(),d=t.getAtomProxy(),f=t.getAtomProxy(),p=t.getResidueProxy(),m=t.getResidueProxy(),g=new N,v=new N,y=function(t,e,n,r){var o,a;t.atomname===n?(o=t,a=e):(o=e,a=t),p.index=o.residueIndex;var s=p.getAtomIndexByName(r);return g.subVectors(s,o),v.subVectors(s,a),Nn(g.angleTo(v))i&&c.bondSet.flip_unsafe(b)}else("OH"===u.atomname&&"TYR"===u.resname||"OH"===l.atomname&&"TYR"===l.resname)&&(y(u,l,"OH","CZ")||c.bondSet.flip_unsafe(b));return{atomSet:c.atomSet,bondSet:c.bondSet,bondStore:c.bondStore}}function Bs(t,e,i){e=e||3.5,i=i||40;for(var n=new On("( PROTEIN and .N )"),r=new On("( PROTEIN and .O )"),o=t.getView(n),a=t.getView(r),s=new Fs(o,a),c=s.within(e),h=c.bondStore,u=t.getAtomProxy(),l=t.getAtomProxy(),d=t.getAtomProxy(),f=t.getAtomProxy(),p=t.getResidueProxy(),m=t.getResidueProxy(),g=new N,v=new N,y=0,b=h.count;yi&&c.bondSet.flip_unsafe(y)))}}return{atomSet:c.atomSet,bondSet:c.bondSet,bondStore:c.bondStore}}function Us(t,e,i){os.call(this,t,e,i)}function js(t){var e=Object.assign({},t);if(this.font=d(e.font,["sans-serif"]),this.size=d(e.size,36),this.style=d(e.style,"normal"),this.variant=d(e.variant,"normal"),this.weight=d(e.weight,"normal"),this.outline=d(e.outline,0),this.width=d(e.width,1024),this.height=d(e.height,1024),this.gamma=1,"undefined"!=typeof navigator){var i=navigator.userAgent;i.match(/Chrome/)&&i.match(/OS X/)&&(this.gamma=.5)}this.mapped={},this.scratchW=0,this.scratchH=0,this.currentX=0,this.currentY=0,this.build(),this.populate(),this.texture=new qe(this.canvas2),this.texture.flipY=!1,this.texture.needsUpdate=!0}function $s(t,e,i,n,r){var o=r||{};o.forceTransparent=!0,this.fontFamily=d(o.fontFamily,"sans-serif"),this.fontStyle=d(o.fontStyle,"normal"),this.fontWeight=d(o.fontWeight,"bold"),this.fontSize=d(o.fontSize,48),this.sdf=d(o.sdf,"Chrome"===lv),this.xOffset=d(o.xOffset,0),this.yOffset=d(o.yOffset,0),this.zOffset=d(o.zOffset,.5),this.attachment=d(o.attachment,"bottom-left"),this.showBorder=d(o.showBorder,!1),this.borderColor=d(o.borderColor,"lightgrey"),this.borderWidth=d(o.borderWidth,.15),this.showBackground=d(o.showBackground,!1),this.backgroundColor=d(o.backgroundColor,"lightgrey"),this.backgroundMargin=d(o.backgroundMargin,.5),this.backgroundOpacity=d(o.backgroundOpacity,1);for(var a=t.length/3,s=0,c=0;ca?h[u]=-1:(o=Math.sqrt(a-r),h[u]=Math.floor(o)),++u;_[l]=c,w[l]=h}}function o(i){var n,r,o,a,s,c,h,u,l,d,f,m,b,S,P,T,E,I,L=3*i,O=i;n=Math.floor(.5+p*(t[L]+x[0])),r=Math.floor(.5+p*(t[L+1]+x[1])),o=Math.floor(.5+p*(t[L+2]+x[2]));var D,N=e[O],k=w[N],F=0,z=v*y,B=_[N];for(d=0;d=g||S>=v||P>=y)){var U=b*z+S*y+P;if(A)if(M[U]&R){if(M[U]&R){var j=C[U];j!==L&&(a=n+h-Math.floor(.5+p*(t[j]+x[0])),s=r+u-Math.floor(.5+p*(t[j+1]+x[1])),c=o+l-Math.floor(.5+p*(t[j+2]+x[2])),h*h+u*u+l*l=g||f>=v||m>=y)){var z=d*F+f*y+m;if(M[z]&O){if(A){var B=C[z];a=Math.floor(.5+p*(t[B]+x[0])),s=Math.floor(.5+p*(t[B+1]+x[1])),c=Math.floor(.5+p*(t[B+2]+x[2])),h*h+u*u+l*l-1&&a-1&&c-1&&s0);var p,b=m*m,x=new Uint16Array(3);for(t=0;t=b)||(M[r]|=D,A&&M[r]&O&&(o.toArray(t,e,i,x),p=x[0]*a+x[1]*y+x[2],C[r]=C[p])));console.timeEnd("EDTSurface fastdistancemap")}function l(t,e,i,n){var r,o,a,s,c,h,u,l,d,f,p,m,b=new Uint16Array(3),x=0;if(0===i)return x;var w=-1,_=-1,S=-1,A=v*y;for(u=0,d=i;u-1&&_-1&&S-1&&(p=w*A+y*_+S,M[p]&R&&!(M[p]&O)?(e.fromArray(w,_,S,b),s=w-b[0],c=_-b[1],h=S-b[2],f=s*s+c*c+h*h,P[p]=f,M[p]|=O,M[p]|=D,n[x]=w,n[x+1]=_,n[x+2]=S,x+=3):M[p]&R&&M[p]&O&&(s=w-b[0],c=_-b[1],h=S-b[2],f=s*s+c*c+h*h,f-1&&_-1&&S-1&&(p=w*A+y*_+S,M[p]&R&&!(M[p]&O)?(e.fromArray(w,_,S,b),s=w-b[0],c=_-b[1],h=S-b[2],f=s*s+c*c+h*h,P[p]=f,M[p]|=O,M[p]|=D,n[x]=w,n[x+1]=_,n[x+2]=S,x+=3):M[p]&R&&M[p]&O&&(s=w-b[0],c=_-b[1],h=S-b[2],f=s*s+c*c+h*h,f-1&&_-1&&S-1&&(p=w*A+y*_+S,M[p]&R&&!(M[p]&O)?(e.fromArray(w,_,S,b),s=w-b[0],c=_-b[1],h=S-b[2],f=s*s+c*c+h*h,P[p]=f,M[p]|=O,M[p]|=D,n[x]=w,n[x+1]=_,n[x+2]=S,x+=3):M[p]&R&&M[p]&O&&(s=w-b[0],c=_-b[1],h=S-b[2],f=s*s+c*c+h*h,fT&&(T=R)}this.neighbourListLength=27*T+1,this.withinRadii=function(r,o,a,c,d){for(var f=0,p=s(r,h),y=s(o,u),x=s(a,l),w=Math.max(0,p-1),_=Math.max(0,y-1),S=Math.max(0,x-1),C=Math.min(m,p+1),T=Math.min(g,y+1),E=Math.min(v,x+1),I=w;I<=C;++I)for(var L=I*b,R=_;R<=T;++R)for(var O=R*g,D=S;D<=E;++D)for(var N=L+O+D,k=A[N],F=k+M[N],z=k;zP&&(P=A[u]);o(),a(),s(),W=-1}function r(t,e,i){for(var n=0;n=0;){if(o!==n&&o!==r&&h(o,t,e,i))return W=o,o;o=j[++a]}return W=-1,-1}function h(e,i,n,r){var o=3*e,a=M[e],s=t[o]-i,c=t[o+1]-n,h=t[o+2]-r,u=s*s+c*c+h*h;return u=0;)t0&&s65535?Uint32Array:Uint16Array;this.meshIndex=new l(u),this.makeIndex(),La.call(this,this.meshPosition,this.meshColor,this.meshIndex,this.meshNormal,this.meshPickingColor,s),this.vertexShader="Ribbon.vert",this.fragmentShader="Mesh.frag",this.geometry.addAttribute("dir",new Kt(new Float32Array(u),3)),this.geometry.addAttribute("size",new Kt(new Float32Array(h),1)),this.setAttributes({position:t,normal:e,dir:i,color:n,size:r,pickingColor:o})}function hc(t,e,i){os.call(this,t,e,i),this.defaultScale.sstruc*=3}function uc(t,e,i){this.helixbundleList=[],os.call(this,t,e,i)}function lc(t,e,i){ks.call(this,t,e,i)}function dc(t,e,i){os.call(this,t,e,i)}function fc(t,e,i){var n=i||{};this.size=t.length/3,this.vertexShader="Line.vert",this.fragmentShader="Line.frag",this.line=!0;var r=this.size,o=r-1;this.attributeSize=2*o,this.linePosition=new Float32Array(3*o*2),this.lineColor=new Float32Array(3*o*2),Ia.call(this,this.linePosition,this.lineColor,void 0,void 0,n),this.setAttributes({position:t,color:e})}function pc(t,e,i){os.call(this,t,e,i)}function mc(t,e,i){ks.call(this,t,e,i)}function gc(t,e,i){os.call(this,t,e,i)}function vc(t,e){var i=e||{};this.streamer=t,this.name=d(i.name,""),this.path=d(i.path,"")}function yc(t){function e(t){for(var e=l.atomCount[t],r=l.atomOffset[t],o=new Array(e),a=0;a0&&e(g-1),l.growIfFull(),l.resno[g]=w,void 0!==S&&(l.sstruc[g]=S.charCodeAt(0)),void 0!==A&&(l.inscode[g]=A.charCodeAt(0)),l.atomOffset[g]=m,l.atomCount[g]=0,l.count+=1,l.chainIndex[g]=v,d.residueCount[v]+=1),u.count+=1,u.residueIndex[m]=g,l.atomCount[g]+=1,r=t,o=b,a=x,s=w,c=A,h=_},this.finalize=function(){i=a,n=h,g>-1&&e(g)}}function bc(t,e){var i=e||{};this.firstModelOnly=d(i.firstModelOnly,!1),this.asTrajectory=d(i.asTrajectory,!1),this.cAlphaOnly=d(i.cAlphaOnly,!1),vc.call(this,t,i),this.structure=new fa(this.name,this.path),this.structureBuilder=new yc(this.structure)}function xc(t,e,i,n,r,o,a,s){this.a=t||1,this.b=e||1,this.c=i||1,this.alpha=n||90,this.beta=r||90,this.gamma=o||90,this.spacegroup=a||"P 1";var c=Dn(this.alpha),h=Dn(this.beta),u=Dn(this.gamma),l=Math.cos(c),d=Math.cos(h),f=Math.cos(u),p=Math.sin(h),m=Math.sin(u);if(this.volume=this.a*this.b*this.c*Math.sqrt(1-l*l-d*d-f*f+2*l*d*f),void 0===s){var g=this.a*this.b*m/this.volume,v=(d*f-l)/(p*m);this.fracToCart=(new O).set(this.a,0,0,0,this.b*f,this.b*m,0,0,this.c*d,-this.c*p*v,1/g,0,0,0,0,1).transpose(),this.cartToFrac=(new O).getInverse(this.fracToCart)}else this.cartToFrac=s,this.fracToCart=(new O).getInverse(this.cartToFrac)}function wc(t,e){bc.call(this,t,e)}function _c(t,e){bc.call(this,t,e)}function Sc(t,e){bc.call(this,t,e)}function Ac(t){switch(t=t.toLowerCase()){case"polymer":return Hp;case"non-polymer":return Wp;case"macrolide":return Xp;case"water":return qp;default:return Gp}}function Mc(t,e,i,n,r){this.structure=t,this.index=e,this.description=i||"",this.entityType=Ac(n||""),this.chainIndexList=r||[],r.forEach(function(i){t.chainStore.entityIndex[i]=e})}function Pc(t,e){Array.isArray(t[e])||Object.keys(t).forEach(function(e){t[e]=[t[e]]})}function Cc(t){return"?"!==t}function Tc(t,e,i){var n,r,o=e.atomStore,a=e.atomMap,s=t.chem_comp,c=t.chem_comp_atom,h=t.chem_comp_bond;s&&(s.name&&(e.title=s.name.trim().replace(Jv,"")),s.id&&(e.id=s.id.trim().replace(Jv,"")));var u={};if(c){var l,d,f,p;for(r=c.comp_id.length,n=0;n0){o=o.split("(");var c=s(o[0]),h=s(o[1]);Object.keys(c).forEach(function(t){Object.keys(h).forEach(function(e){var i=new O;i.multiplyMatrices(c[t],h[e]),n[t+"x"+e]=i})})}else n=s(o);var u=[];for(var l in n)u.push(n[l]);var d=t;/^(0|[1-9][0-9]*)$/.test(d)&&(d="BU"+d);for(var f=a.asym_id_list[e].split(","),p=0,m=f.length;p_){var S=w;w=_,_=S;var A=p;p=b,b=A}if(0!==w&&0!==_)for(var M=0;M<_;++M)if(o.index=p[M%w],a.index=b[M],o&&a){var P,C=n.pdbx_value_order[c].toLowerCase();"?"===C?P=1:"sing"===C?P=1:"doub"===C?P=2:"trip"===C?P=3:"quad"===C&&(P=4),e.bondStore.addBond(o,a,P)}else mv.log("atoms for connection not found");else mv.warn("no atoms found for",f,y)}}}}function Rc(t,e,i){if(t.entity){Pc(t.entity,"id");for(var n=t.entity,r=n.id.length,o=0;oo&&++s;e=new Int32Array(s)}for(i=0,n=0;in){for(var r=[],o=0;o>>16&65535|0,a=0;0!==i;){a=i>2e3?2e3:i,i-=a;do r=r+e[n++]|0,o=o+r|0;while(--a);r%=65521,o%=65521}return r|o<<16|0}function Ch(){for(var t,e=[],i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}function Th(t,e,i,n){var r=ay,o=n+i;t^=-1;for(var a=n;a>>8^r[255&(t^e[a])];return t^-1}function Eh(t,e){var i,n,r,o,a,s,c,h,u,l,d,f,p,m,g,v,y,b,x,w,_,S,A,M,P;i=t.state,n=t.next_in,M=t.input,r=n+(t.avail_in-5),o=t.next_out,P=t.output,a=o-(e-t.avail_out),s=o+(t.avail_out-257),c=i.dmax,h=i.wsize,u=i.whave,l=i.wnext,d=i.window,f=i.hold,p=i.bits,m=i.lencode,g=i.distcode,v=(1<>>24,f>>>=x,p-=x,x=b>>>16&255,0===x)P[o++]=65535&b;else{if(!(16&x)){if(0===(64&x)){b=m[(65535&b)+(f&(1<>>=x,p-=x),p<15&&(f+=M[n++]<>>24,f>>>=x,p-=x,x=b>>>16&255,!(16&x)){if(0===(64&x)){b=g[(65535&b)+(f&(1<c){t.msg="invalid distance too far back",i.mode=sy;break t}if(f>>>=x,p-=x,x=o-a,_>x){if(x=_-x,x>u&&i.sane){t.msg="invalid distance too far back",i.mode=sy;break t}if(S=0,A=d,0===l){if(S+=h-x,x2;)P[o++]=A[S++],P[o++]=A[S++],P[o++]=A[S++],w-=3;w&&(P[o++]=A[S++],w>1&&(P[o++]=A[S++]))}else{S=o-_;do P[o++]=P[S++],P[o++]=P[S++],P[o++]=P[S++],w-=3;while(w>2);w&&(P[o++]=P[S++],w>1&&(P[o++]=P[S++]))}break}}break}}while(n>3,n-=w,p-=w<<3,f&=(1<=1&&0===I[w];w--);if(_>w&&(_=w),0===w)return r[o++]=20971520,r[o++]=20971520,s.bits=1,0;for(x=1;x0&&(t===dy||1!==w))return-1;for(L[1]=0,y=1;yuy||t===py&&P>ly)return 1;for(var D=0;;){D++,p=y-A,a[b]f?(m=R[O+a[b]],g=T[E+a[b]]):(m=96,g=0),c=1<>A)+h]=p<<24|m<<16|g|0;while(0!==h);for(c=1<>=1;if(0!==c?(C&=c-1,C+=c):C=0,b++,0===--I[y]){if(y===w)break;y=e[i+a[b]]}if(y>_&&(C&l)!==u){for(0===A&&(A=_),d+=x,S=y-A,M=1<uy||t===py&&P>ly)return 1;u=C&l,r[u]=_<<24|S<<16|d-o|0}}return 0!==C&&(r[d+C]=y-A<<24|64<<16|0),s.bits=_,0}function Lh(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function Rh(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Oh(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Oy,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(lb),e.distcode=e.distdyn=new Int32Array(db),e.sane=1,e.back=-1,My):Ty}function Dh(t){var e;return t&&t.state?(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,Oh(t)):Ty}function Nh(t,e){var i,n;return t&&t.state?(n=t.state,e<0?(i=0,e=-e):(i=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15)?Ty:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,Dh(t))):Ty}function kh(t,e){var i,n;return t?(n=new Rh,t.state=n,n.window=null,i=Nh(t,e),i!==My&&(t.state=null),i):Ty}function Fh(t){if(fb){var e;for(ry=new Int32Array(512),oy=new Int32Array(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Ih(xy,t.lens,0,288,ry,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Ih(wy,t.lens,0,32,oy,0,t.work,{bits:5}),fb=!1}t.lencode=ry,t.lenbits=9,t.distcode=oy,t.distbits=5}function zh(t,e,i,n){var r,o=t.state;return null===o.window&&(o.wsize=1<=o.wsize?(Ah(o.window,e,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(r=o.wsize-o.wnext,r>n&&(r=n),Ah(o.window,e,i-n,r,o.wnext),n-=r,n?(Ah(o.window,e,i-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,i.check=Th(i.check,C,2,0),h=0,u=0,i.mode=Dy;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",i.mode=cb;break}if((15&h)!==Ry){t.msg="unknown compression method",i.mode=cb;break}if(h>>>=4,u-=4,_=(15&h)+8,0===i.wbits)i.wbits=_;else if(_>i.wbits){t.msg="invalid window size",i.mode=cb;break}i.dmax=1<<_,t.adler=i.check=1,i.mode=512&h?$y:Gy,h=0,u=0;break;case Dy:for(;u<16;){if(0===s)break t;s--,h+=n[o++]<>8&1),512&i.flags&&(C[0]=255&h,C[1]=h>>>8&255,i.check=Th(i.check,C,2,0)),h=0,u=0,i.mode=Ny;case Ny:for(;u<32;){if(0===s)break t;s--,h+=n[o++]<>>8&255,C[2]=h>>>16&255,C[3]=h>>>24&255,i.check=Th(i.check,C,4,0)),h=0,u=0,i.mode=ky;case ky:for(;u<16;){if(0===s)break t;s--,h+=n[o++]<>8),512&i.flags&&(C[0]=255&h,C[1]=h>>>8&255,i.check=Th(i.check,C,2,0)),h=0,u=0,i.mode=Fy;case Fy:if(1024&i.flags){for(;u<16;){if(0===s)break t;s--,h+=n[o++]<>>8&255,i.check=Th(i.check,C,2,0)),h=0,u=0}else i.head&&(i.head.extra=null);i.mode=zy;case zy:if(1024&i.flags&&(f=i.length,f>s&&(f=s),f&&(i.head&&(_=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),Ah(i.head.extra,n,o,f,_)),512&i.flags&&(i.check=Th(i.check,n,f,o)),s-=f,o+=f,i.length-=f),i.length))break t;i.length=0,i.mode=By;case By:if(2048&i.flags){if(0===s)break t;f=0;do _=n[o+f++],i.head&&_&&i.length<65536&&(i.head.name+=String.fromCharCode(_));while(_&&f>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=Gy;break;case $y:for(;u<32;){if(0===s)break t;s--,h+=n[o++]<>>=7&u,u-=7&u,i.mode=ob;break}for(;u<3;){if(0===s)break t;s--,h+=n[o++]<>>=1,u-=1,3&h){case 0:i.mode=Wy;break;case 1:if(Fh(i),i.mode=Qy,e===Ay){h>>>=2,u-=2;break t}break;case 2:i.mode=Yy;break;case 3:t.msg="invalid block type",i.mode=cb}h>>>=2,u-=2;break;case Wy:for(h>>>=7&u,u-=7&u;u<32;){if(0===s)break t;s--,h+=n[o++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=cb;break}if(i.length=65535&h,h=0,u=0,i.mode=Xy,e===Ay)break t;case Xy:i.mode=qy;case qy:if(f=i.length){if(f>s&&(f=s),f>c&&(f=c),0===f)break t;Ah(r,n,o,f,a),s-=f,o+=f,c-=f,a+=f,i.length-=f;break}i.mode=Gy;break;case Yy:for(;u<14;){if(0===s)break t;s--,h+=n[o++]<>>=5,u-=5,i.ndist=(31&h)+1,h>>>=5,u-=5,i.ncode=(15&h)+4,h>>>=4,u-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=cb;break}i.have=0,i.mode=Zy;case Zy:for(;i.have>>=3,u-=3}for(;i.have<19;)i.lens[T[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,A={bits:i.lenbits},S=Ih(by,i.lens,0,19,i.lencode,0,i.work,A),i.lenbits=A.bits,S){t.msg="invalid code lengths set",i.mode=cb;break}i.have=0,i.mode=Ky;case Ky:for(;i.have>>24,v=P>>>16&255,y=65535&P,!(g<=u);){if(0===s)break t;s--,h+=n[o++]<>>=g,u-=g,i.lens[i.have++]=y;else{if(16===y){for(M=g+2;u>>=g,u-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=cb;break}_=i.lens[i.have-1],f=3+(3&h),h>>>=2,u-=2}else if(17===y){for(M=g+3;u>>=g,u-=g,_=0,f=3+(7&h),h>>>=3,u-=3}else{for(M=g+7;u>>=g,u-=g,_=0,f=11+(127&h),h>>>=7,u-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=cb;break}for(;f--;)i.lens[i.have++]=_}}if(i.mode===cb)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=cb;break}if(i.lenbits=9,A={bits:i.lenbits},S=Ih(xy,i.lens,0,i.nlen,i.lencode,0,i.work,A),i.lenbits=A.bits,S){t.msg="invalid literal/lengths set",i.mode=cb;break}if(i.distbits=6,i.distcode=i.distdyn,A={bits:i.distbits},S=Ih(wy,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,A),i.distbits=A.bits,S){t.msg="invalid distances set",i.mode=cb;break}if(i.mode=Qy,e===Ay)break t;case Qy:i.mode=Jy;case Jy:if(s>=6&&c>=258){t.next_out=a,t.avail_out=c,t.next_in=o,t.avail_in=s,i.hold=h,i.bits=u,Eh(t,d),a=t.next_out,r=t.output,c=t.avail_out,o=t.next_in,n=t.input,s=t.avail_in,h=i.hold,u=i.bits,i.mode===Gy&&(i.back=-1);break}for(i.back=0;P=i.lencode[h&(1<>>24,v=P>>>16&255,y=65535&P,!(g<=u);){if(0===s)break t;s--,h+=n[o++]<>b)],g=P>>>24,v=P>>>16&255,y=65535&P,!(b+g<=u);){if(0===s)break t;s--,h+=n[o++]<>>=b,u-=b,i.back+=b}if(h>>>=g,u-=g,i.back+=g,i.length=y,0===v){i.mode=rb;break}if(32&v){i.back=-1,i.mode=Gy;break}if(64&v){t.msg="invalid literal/length code",i.mode=cb;break}i.extra=15&v,i.mode=tb;case tb:if(i.extra){for(M=i.extra;u>>=i.extra,u-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=eb;case eb:for(;P=i.distcode[h&(1<>>24,v=P>>>16&255,y=65535&P,!(g<=u);){if(0===s)break t;s--,h+=n[o++]<>b)],g=P>>>24,v=P>>>16&255,y=65535&P,!(b+g<=u);){if(0===s)break t;s--,h+=n[o++]<>>=b,u-=b,i.back+=b}if(h>>>=g,u-=g,i.back+=g,64&v){t.msg="invalid distance code",i.mode=cb;break}i.offset=y,i.extra=15&v,i.mode=ib;case ib:if(i.extra){for(M=i.extra;u>>=i.extra,u-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=cb;break}i.mode=nb;case nb:if(0===c)break t;if(f=d-c,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=cb;break}f>i.wnext?(f-=i.wnext,p=i.wsize-f):p=i.wnext-f,f>i.length&&(f=i.length),m=i.window}else m=r,p=a-i.offset,f=i.length;f>c&&(f=c),c-=f,i.length-=f;do r[a++]=m[p++];while(--f);0===i.length&&(i.mode=Jy);break;case rb:if(0===c)break t;r[a++]=i.length,c--,i.mode=Jy;break;case ob:if(i.wrap){for(;u<32;){if(0===s)break t;s--,h|=n[o++]<>>6,e[o++]=128|63&i):i<65536?(e[o++]=224|i>>>12,e[o++]=128|i>>>6&63,e[o++]=128|63&i):(e[o++]=240|i>>>18,e[o++]=128|i>>>12&63,e[o++]=128|i>>>6&63,e[o++]=128|63&i);return e}function Gh(t,e){if(e<65537&&(t.subarray&&mb||!t.subarray&&pb))return String.fromCharCode.apply(null,Sh(t,e));for(var i="",n=0;n4)s[n++]=65533,i+=o-1;else{for(r&=2===o?31:3===o?15:7;o>1&&i1?s[n++]=65533:r<65536?s[n++]=r:(r-=65536,s[n++]=55296|r>>10&1023,s[n++]=56320|1023&r)}return Gh(s,n)}function Xh(t,e){var i;for(e=e||t.length,e>t.length&&(e=t.length),i=e-1;i>=0&&128===(192&t[i]);)i--;return i<0?e:0===i?e:i+gb[t[i]]>e?i:e}function qh(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}function Yh(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}function Zh(t){if(!(this instanceof Zh))return new Zh(t);this.options=_h({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0===(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new qh,this.strm.avail_out=0;var i=kh(this.strm,e.windowBits);if(i!==wb)throw new Error(Mb[i]);this.header=new Yh,jh(this.strm,this.header)}function Kh(t,e){var i=new Zh(e);if(i.push(t,!0),i.err)throw i.msg;return i.result}function Qh(t){var e;t instanceof ArrayBuffer&&(t=new Uint8Array(t));try{e=Kh(t)}catch(i){e=t}return e}function Jh(){this.getUrl=function(t){var e,i=y(t),n=i.name.substr(0,4);return!["pdb","cif"].includes(i.ext)||i.compressed!==!1&&"gz"!==i.compressed?"mmtf"===i.ext?e=i.base.endsWith(".bb")?Ib+n:Eb+n:i.ext?(mv.warn("unsupported ext",i.ext),e=Eb+n):e=Eb+n:e=Cb+i.path,f()+e},this.getExt=function(t){var e=y(t);if("mmtf"===e.ext||!e.ext)return"mmtf"}}function tu(){this.getUrl=function(t){var e,i=y(t),n=i.name;return i.ext&&"sdf"!==i.ext?(mv.warn("unsupported ext",i.ext),e=Lb+n+Rb):e=Lb+n+Rb,f()+e},this.getExt=function(t){var e=y(t);if(!e.ext||"sdf"===e.ext)return"sdf"}}function eu(){this.getUrl=function(t){return t}}function iu(t){t=t||"",this.getUrl=function(e){var i=y(e);return m(t+i.path)}}!function(t){t.console=t.console||{};for(var e,i,n=t.console,r={},o=function(){},a="memory".split(","),s="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(",");e=a.pop();)n[e]||(n[e]=r);for(;i=s.pop();)n[i]||(n[i]=o)}("undefined"==typeof window?self:window),HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(t,e,i){for(var n=window.atob(this.toDataURL(e,i).split(",")[1]),r=n.length,o=r>>2,a=new Uint8Array(r),s=new Uint32Array(a.buffer,0,o),c=0,h=0;c-9007199254740992&&t<9007199254740992&&Math.floor(t)===t}),Number.isNaN||(Number.isNaN=function(t){return t!==t}),Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert first argument to object");for(var e,i=Object(t),n=!1,r=1;r1?arguments[1]:void 0,s=a?Number(a):0;s!=s&&(s=0);var c=Math.min(Math.max(s,0),n);if(o+c>n)return!1;for(var h=-1;++hi.length)&&(e=i.length),e-=t.length;var n=i.indexOf(t,e);return n!==-1&&n===e}),String.prototype.includes||(String.prototype.includes=function(t,e){return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&this.indexOf(t,e)!==-1}),Array.prototype.includes||(Array.prototype.includes=function(t){if(null==this)throw new TypeError("Array.prototype.includes called on null or undefined");var e=Object(this),i=parseInt(e.length,10)||0;if(0===i)return!1;var n,r=parseInt(arguments[1],10)||0;r>=0?n=r:(n=i+r,n<0&&(n=0));for(var o;n0?1:-1)*Math.floor(Math.abs(e)):e},n=Math.pow(2,53)-1,r=function(t){var e=i(t);return Math.min(Math.max(e,0),n)};return function(t){var i=this,n=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var o,a=arguments.length>1?arguments[1]:void 0;if("undefined"!=typeof a){if(!e(a))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(o=arguments[2])}for(var s,c=r(n.length),h=e(i)?Object(new i(c)):new Array(c),u=0;ue?1:0}return function(e,i,n){var r=0,o=e.length-1;for(n||(n=t);r<=o;){var a=r+o>>1,s=n(i,e[a]);if(s>0)r=a+1;else{if(!(s<0))return a;o=a-1}}return-r-1}}();void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&!function(){Object.assign=function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i>=4,i[r]=e[19===r?3&t|8:t]);return i.join("")}}(),clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e),t*t*(3-2*t))},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e),t*t*t*(t*(6*t-15)+10))},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*yd.DEG2RAD},radToDeg:function(t){return t*yd.RAD2DEG},isPowerOfTwo:function(t){return 0===(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t++,t}};I.prototype={constructor:I,isVector2:!0,get width(){return this.x},set width(t){this.x=t},get height(){return this.y},set height(t){this.y=t},set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t):(this.x=0,this.y=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t,e;return function(i,n){return void 0===t&&(t=new I,e=new I),t.set(i,i),e.set(n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,i))/i)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromAttribute:function(t,e,i){return void 0===i&&(i=0),e=e*t.itemSize+i,this.x=t.array[e],this.y=t.array[e+1],this},rotateAround:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*i-o*n+t.x,this.y=r*n+o*i+t.y,this}},L.DEFAULT_IMAGE=void 0,L.DEFAULT_MAPPING=al,L.prototype={constructor:L,isTexture:!0,set needsUpdate(t){t===!0&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){function e(t){var e;return void 0!==t.toDataURL?e=t:(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0,t.width,t.height)),e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var i={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var n=this.image;void 0===n.uuid&&(n.uuid=yd.generateUUID()),void 0===t.images[n.uuid]&&(t.images[n.uuid]={uuid:n.uuid,url:e(n)}),i.image=n.uuid}return t.textures[this.uuid]=i,i},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===al){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case pl:t.x=t.x-Math.floor(t.x);break;case ml:t.x=t.x<0?0:1;break;case gl:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case pl:t.y=t.y-Math.floor(t.y);break;case ml:t.y=t.y<0?0:1;break;case gl:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}},Object.assign(L.prototype,E.prototype);var bd=0;O.prototype={constructor:O,isMatrix4:!0,set:function(t,e,i,n,r,o,a,s,c,h,u,l,d,f,p,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=r,g[5]=o,g[9]=a,g[13]=s,g[2]=c,g[6]=h,g[10]=u,g[14]=l,g[3]=d,g[7]=f,g[11]=p,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new O).fromArray(this.elements)},copy:function(t){return this.elements.set(t.elements),this},copyPosition:function(t){var e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this},extractBasis:function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this},extractRotation:function(){var t;return function(e){void 0===t&&(t=new N);var i=this.elements,n=e.elements,r=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length(),a=1/t.setFromMatrixColumn(e,2).length();return i[0]=n[0]*r,i[1]=n[1]*r,i[2]=n[2]*r,i[4]=n[4]*o,i[5]=n[5]*o,i[6]=n[6]*o,i[8]=n[8]*a,i[9]=n[9]*a,i[10]=n[10]*a,this}}(),makeRotationFromEuler:function(t){(t&&t.isEuler)===!1&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,i=t.x,n=t.y,r=t.z,o=Math.cos(i),a=Math.sin(i),s=Math.cos(n),c=Math.sin(n),h=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){var l=o*h,d=o*u,f=a*h,p=a*u;e[0]=s*h,e[4]=-s*u,e[8]=c,e[1]=d+f*c,e[5]=l-p*c,e[9]=-a*s,e[2]=p-l*c,e[6]=f+d*c,e[10]=o*s}else if("YXZ"===t.order){var m=s*h,g=s*u,v=c*h,y=c*u;e[0]=m+y*a,e[4]=v*a-g,e[8]=o*c,e[1]=o*u,e[5]=o*h,e[9]=-a,e[2]=g*a-v,e[6]=y+m*a,e[10]=o*s}else if("ZXY"===t.order){var m=s*h,g=s*u,v=c*h,y=c*u;e[0]=m-y*a,e[4]=-o*u,e[8]=v+g*a,e[1]=g+v*a,e[5]=o*h,e[9]=y-m*a,e[2]=-o*c,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){var l=o*h,d=o*u,f=a*h,p=a*u;e[0]=s*h,e[4]=f*c-d,e[8]=l*c+p,e[1]=s*u,e[5]=p*c+l,e[9]=d*c-f,e[2]=-c,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){var b=o*s,x=o*c,w=a*s,_=a*c;e[0]=s*h,e[4]=_-b*u,e[8]=w*u+x,e[1]=u,e[5]=o*h,e[9]=-a*h,e[2]=-c*h,e[6]=x*u+w,e[10]=b-_*u}else if("XZY"===t.order){var b=o*s,x=o*c,w=a*s,_=a*c;e[0]=s*h,e[4]=-u,e[8]=c*h,e[1]=b*u+_,e[5]=o*h,e[9]=x*u-w,e[2]=w*u-x,e[6]=a*h,e[10]=_*u+b}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,i=t.x,n=t.y,r=t.z,o=t.w,a=i+i,s=n+n,c=r+r,h=i*a,u=i*s,l=i*c,d=n*s,f=n*c,p=r*c,m=o*a,g=o*s,v=o*c;return e[0]=1-(d+p),e[4]=u-v,e[8]=l+g,e[1]=u+v,e[5]=1-(h+p),e[9]=f-m,e[2]=l-g,e[6]=f+m,e[10]=1-(h+d),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t,e,i;return function(n,r,o){void 0===t&&(t=new N,e=new N,i=new N);var a=this.elements;return i.subVectors(n,r).normalize(),0===i.lengthSq()&&(i.z=1),t.crossVectors(o,i).normalize(),0===t.lengthSq()&&(i.z+=1e-4,t.crossVectors(o,i).normalize()),e.crossVectors(i,t),a[0]=t.x,a[4]=e.x,a[8]=i.x,a[1]=t.y,a[5]=e.y,a[9]=i.y,a[2]=t.z,a[6]=e.z,a[10]=i.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,n=e.elements,r=this.elements,o=i[0],a=i[4],s=i[8],c=i[12],h=i[1],u=i[5],l=i[9],d=i[13],f=i[2],p=i[6],m=i[10],g=i[14],v=i[3],y=i[7],b=i[11],x=i[15],w=n[0],_=n[4],S=n[8],A=n[12],M=n[1],P=n[5],C=n[9],T=n[13],E=n[2],I=n[6],L=n[10],R=n[14],O=n[3],D=n[7],N=n[11],k=n[15];return r[0]=o*w+a*M+s*E+c*O,r[4]=o*_+a*P+s*I+c*D,r[8]=o*S+a*C+s*L+c*N,r[12]=o*A+a*T+s*R+c*k,r[1]=h*w+u*M+l*E+d*O,r[5]=h*_+u*P+l*I+d*D,r[9]=h*S+u*C+l*L+d*N,r[13]=h*A+u*T+l*R+d*k,r[2]=f*w+p*M+m*E+g*O,r[6]=f*_+p*P+m*I+g*D,r[10]=f*S+p*C+m*L+g*N,r[14]=f*A+p*T+m*R+g*k,r[3]=v*w+y*M+b*E+x*O,r[7]=v*_+y*P+b*I+x*D,r[11]=v*S+y*C+b*L+x*N,r[15]=v*A+y*T+b*R+x*k,this},multiplyToArray:function(t,e,i){var n=this.elements;return this.multiplyMatrices(t,e),i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i[4]=n[4],i[5]=n[5],i[6]=n[6],i[7]=n[7],i[8]=n[8],i[9]=n[9],i[10]=n[10],i[11]=n[11],i[12]=n[12],i[13]=n[13],i[14]=n[14],i[15]=n[15],this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToVector3Array:function(){var t;return function(e,i,n){void 0===t&&(t=new N),void 0===i&&(i=0),void 0===n&&(n=e.length);for(var r=0,o=i;r0?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(u-c)*e,this._y=(o-h)*e,this._z=(a-r)*e):n>s&&n>l?(e=2*Math.sqrt(1+n-s-l),this._w=(u-c)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(o+h)/e):s>l?(e=2*Math.sqrt(1+s-n-l),this._w=(o-h)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(c+u)/e):(e=2*Math.sqrt(1+l-n-s),this._w=(a-r)/e,this._x=(o+h)/e,this._y=(c+u)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e,i=1e-6;return function(n,r){return void 0===t&&(t=new N),e=n.dot(r)+1,eMath.abs(n.z)?t.set(-n.y,n.x,0):t.set(0,-n.z,n.y)):t.crossVectors(n,r),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var i=t._x,n=t._y,r=t._z,o=t._w,a=e._x,s=e._y,c=e._z,h=e._w;return this._x=i*h+o*a+n*c-r*s,this._y=n*h+o*s+r*a-i*c,this._z=r*h+o*c+i*s-n*a,this._w=o*h-i*a-n*s-r*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var i=this._x,n=this._y,r=this._z,o=this._w,a=o*t._w+i*t._x+n*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=i,this._y=n,this._z=r,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(i+this._x),this._y=.5*(n+this._y),this._z=.5*(r+this._z),this;var c=Math.atan2(s,a),h=Math.sin((1-e)*c)/s,u=Math.sin(e*c)/s;return this._w=o*h+this._w*u,this._x=i*h+this._x*u,this._y=n*h+this._y*u,this._z=r*h+this._z*u,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},Object.assign(D,{slerp:function(t,e,i,n){return i.copy(t).slerp(e,n)},slerpFlat:function(t,e,i,n,r,o,a){var s=i[n+0],c=i[n+1],h=i[n+2],u=i[n+3],l=r[o+0],d=r[o+1],f=r[o+2],p=r[o+3];if(u!==p||s!==l||c!==d||h!==f){var m=1-a,g=s*l+c*d+h*f+u*p,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var b=Math.sqrt(y),x=Math.atan2(b,g*v);m=Math.sin(m*x)/b,a=Math.sin(a*x)/b}var w=a*v;if(s=s*m+l*w,c=c*m+d*w,h=h*m+f*w,u=u*m+p*w,m===1-a){var _=1/Math.sqrt(s*s+c*c+h*h+u*u);s*=_,c*=_,h*=_,u*=_}}t[e]=s,t[e+1]=c,t[e+2]=h,t[e+3]=u}}),N.prototype={constructor:N,isVector3:!0,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t;return function(e){return(e&&e.isEuler)===!1&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===t&&(t=new D),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t;return function(e,i){return void 0===t&&(t=new D),this.applyQuaternion(t.setFromAxisAngle(e,i))}}(),applyMatrix3:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n+r[12],this.y=r[1]*e+r[5]*i+r[9]*n+r[13],this.z=r[2]*e+r[6]*i+r[10]*n+r[14],this},applyProjection:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements,o=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*o,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*o,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*o,this},applyQuaternion:function(t){var e=this.x,i=this.y,n=this.z,r=t.x,o=t.y,a=t.z,s=t.w,c=s*e+o*n-a*i,h=s*i+a*e-r*n,u=s*n+r*i-o*e,l=-r*e-o*i-a*n;return this.x=c*s+l*-r+h*-a-u*-o,this.y=h*s+l*-o+u*-r-c*-a,this.z=u*s+l*-a+c*-o-h*-r,this},project:function(){var t;return function(e){return void 0===t&&(t=new O),t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyProjection(t)}}(),unproject:function(){var t;return function(e){return void 0===t&&(t=new O),t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyProjection(t)}}(),transformDirection:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t,e;return function(i,n){return void 0===t&&(t=new N,e=new N),t.set(i,i,i),e.set(n,n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,i))/i)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var i=this.x,n=this.y,r=this.z;return this.x=n*t.z-r*t.y,this.y=r*t.x-i*t.z,this.z=i*t.y-n*t.x,this},crossVectors:function(t,e){var i=t.x,n=t.y,r=t.z,o=e.x,a=e.y,s=e.z;return this.x=n*s-r*a,this.y=r*o-i*s,this.z=i*a-n*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t;return function(e){return void 0===t&&(t=new N),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new N),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(yd.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return this.setFromMatrixColumn(t,3)},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this},setFromMatrixColumn:function(t,e){if("number"==typeof t){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var i=t;t=e,e=i}return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromAttribute:function(t,e,i){return void 0===i&&(i=0),e=e*t.itemSize+i,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this}},F.prototype={constructor:F,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;ethis.max.x||t.ythis.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){var i=e||new I;return i.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)},clampPoint:function(t,e){var i=e||new I;return i.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new I;return function(e){var i=t.copy(e).clamp(this.min,this.max);return i.sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},B.prototype=Object.create(L.prototype),B.prototype.constructor=B,B.prototype.isCubeTexture=!0,Object.defineProperty(B.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var xd=new L,wd=new B,_d=[],Sd=[];gt.prototype.setValue=function(t,e){for(var i=this.seq,n=0,r=i.length;n!==r;++n){var o=i[n];o.setValue(t,e[o.id])}};var Ad=/([\w\d_]+)(\])?(\[|\.)?/g;bt.prototype.setValue=function(t,e,i){var n=this.map[e];void 0!==n&&n.setValue(t,i,this.renderer)},bt.prototype.set=function(t,e,i){var n=this.map[i];void 0!==n&&n.setValue(t,e[i],this.renderer)},bt.prototype.setOptional=function(t,e,i){var n=e[i];void 0!==n&&this.setValue(t,i,n)},bt.upload=function(t,e,i,n){for(var r=0,o=e.length;r!==o;++r){var a=e[r],s=i[a.id];s.needsUpdate!==!1&&a.setValue(t,s.value,n)}},bt.seqWithValue=function(t,e){for(var i=[],n=0,r=t.length;n!==r;++n){var o=t[n];o.id in e&&i.push(o)}return i},bt.splitDynamic=function(t,e){for(var i=null,n=t.length,r=0,o=0;o!==n;++o){var a=t[o],s=e[a.id];s&&s.dynamic===!0?(null===i&&(i=[]),i.push(a)):(ry&&v>b?vb?y0&&(n.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),n.skinning=this.skinning,n.morphTargets=this.morphTargets,i){var r=e(t.textures),o=e(t.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows;var e=t.clippingPlanes,i=null;if(null!==e){var n=e.length;i=new Array(n);for(var r=0;r!==n;++r)i[r]=e[r].clone()}return this.clippingPlanes=i,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(At.prototype,E.prototype);var Md=0,Pd={merge:function(t){for(var e={},i=0;i>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,i){return this.r=t,this.g=e,this.b=i,this},setHSL:function(){function t(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}return function(e,i,n){if(e=yd.euclideanModulo(e,1),i=yd.clamp(i,0,1),n=yd.clamp(n,0,1),0===i)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+i):n+i-n*i,o=2*n-r;this.r=t(o,r,e+1/3),this.g=t(o,r,e),this.b=t(o,r,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var n,r=i[1],o=i[2];switch(r){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,e(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,e(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(n[1])/360,s=parseInt(n[2],10)/100,c=parseInt(n[3],10)/100;return e(n[5]),this.setHSL(a,s,c)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(t)){var h=i[1],u=h.length;if(3===u)return this.r=parseInt(h.charAt(0)+h.charAt(0),16)/255,this.g=parseInt(h.charAt(1)+h.charAt(1),16)/255,this.b=parseInt(h.charAt(2)+h.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(h.charAt(0)+h.charAt(1),16)/255,this.g=parseInt(h.charAt(2)+h.charAt(3),16)/255,this.b=parseInt(h.charAt(4)+h.charAt(5),16)/255,this}if(t&&t.length>0){var h=Pp[t];void 0!==h?this.setHex(h):console.warn("THREE.Color: Unknown color "+t)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var i=e>0?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this},convertGammaToLinear:function(){var t=this.r,e=this.g,i=this.b;return this.r=t*t,this.g=e*e,this.b=i*i,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,i,n=t||{h:0,s:0,l:0},r=this.r,o=this.g,a=this.b,s=Math.max(r,o,a),c=Math.min(r,o,a),h=(c+s)/2;if(c===s)e=0,i=0;else{var u=s-c;switch(i=h<=.5?u/(s+c):u/(2-s-c),s){case r:e=(o-a)/u+(or&&(r=h),u>o&&(o=u),l>a&&(a=l)}this.min.set(e,i,n),this.max.set(r,o,a)},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){var i=e||new N;return i.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:function(){var t;return function(e){return void 0===t&&(t=new N),this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=t.constant&&i>=t.constant},clampPoint:function(t,e){var i=e||new N;return i.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new N;return function(e){var i=t.copy(e).clamp(this.min,this.max);return i.sub(e).length()}}(),getBoundingSphere:function(){var t=new N;return function(e){var i=e||new It;return i.center=this.center(),i.radius=.5*this.size(t).length(),i}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new N,new N,new N,new N,new N,new N,new N,new N];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},It.prototype={constructor:It,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new Et;return function(e,i){var n=this.center;void 0!==i?n.copy(i):t.setFromPoints(e).center(n);for(var r=0,o=0,a=e.length;othis.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(t){var e=t||new Et;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}},Lt.prototype={constructor:Lt,isMatrix3:!0,set:function(t,e,i,n,r,o,a,s,c){var h=this.elements;return h[0]=t,h[1]=n,h[2]=a,h[3]=e,h[4]=r,h[5]=s,h[6]=i,h[7]=o,h[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=t.elements;return this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToVector3Array:function(){var t;return function(e,i,n){void 0===t&&(t=new N),void 0===i&&(i=0),void 0===n&&(n=e.length);for(var r=0,o=i;r1))return n.copy(r).multiplyScalar(a).add(e.start)}else if(0===this.distanceToPoint(e.start))return n.copy(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){var e=t||new N;return e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new N,e=new Lt;return function(i,n){var r=this.coplanarPoint(t).applyMatrix4(i),o=n||e.getNormalMatrix(i),a=this.normal.applyMatrix3(o).normalize();return this.constant=-r.dot(a),this}}(),translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}},Ot.prototype={constructor:Ot,set:function(t,e,i,n,r,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(n),a[4].copy(r),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,i=0;i<6;i++)e[i].copy(t.planes[i]);return this},setFromMatrix:function(t){var e=this.planes,i=t.elements,n=i[0],r=i[1],o=i[2],a=i[3],s=i[4],c=i[5],h=i[6],u=i[7],l=i[8],d=i[9],f=i[10],p=i[11],m=i[12],g=i[13],v=i[14],y=i[15];return e[0].setComponents(a-n,u-s,p-l,y-m).normalize(),e[1].setComponents(a+n,u+s,p+l,y+m).normalize(),e[2].setComponents(a+r,u+c,p+d,y+g).normalize(),e[3].setComponents(a-r,u-c,p-d,y-g).normalize(),e[4].setComponents(a-o,u-h,p-f,y-v).normalize(),e[5].setComponents(a+o,u+h,p+f,y+v).normalize(),this},intersectsObject:function(){var t=new It;return function(e){var i=e.geometry;return null===i.boundingSphere&&i.computeBoundingSphere(),t.copy(i.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new It;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,i=t.center,n=-t.radius,r=0;r<6;r++){var o=e[r].distanceToPoint(i);if(o0?i.min.x:i.max.x,e.x=o.normal.x>0?i.max.x:i.min.x,t.y=o.normal.y>0?i.min.y:i.max.y,e.y=o.normal.y>0?i.max.y:i.min.y,t.z=o.normal.z>0?i.min.z:i.max.z,e.z=o.normal.z>0?i.max.z:i.min.z;var a=o.distanceToPoint(t),s=o.distanceToPoint(e);if(a<0&&s<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}};var Ep=0;Kt.prototype={constructor:Kt,isBufferAttribute:!0,get count(){return this.array.length/this.itemSize},set needsUpdate(t){t===!0&&this.version++},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.normalized=t.normalized,this.dynamic=t.dynamic,this},copyAt:function(t,e,i){t*=this.itemSize,i*=e.itemSize;for(var n=0,r=this.itemSize;n1){for(var e=0;e1)for(var e=0;e0){r.children=[];for(var o=0;o0&&(n.geometries=a),s.length>0&&(n.materials=s),c.length>0&&(n.textures=c),h.length>0&&(n.images=h)}return n.object=r,n},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(var i=0;i0)for(var f=0;f0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,i,n,r;for(i=0,n=this.faces.length;i0&&(t+=e[i].distanceTo(e[i-1])),this.lineDistances[i]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Et),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new It),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,i){if((t&&t.isGeometry)===!1)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);var n,r=this.vertices.length,o=this.vertices,a=t.vertices,s=this.faces,c=t.faces,h=this.faceVertexUvs[0],u=t.faceVertexUvs[0];void 0===i&&(i=0),void 0!==e&&(n=(new Lt).getNormalMatrix(e));for(var l=0,d=a.length;l=0;i--){var g=f[i];for(this.faces.splice(g,1),a=0,s=this.faceVertexUvs.length;a0,_=v.vertexNormals.length>0,S=1!==v.color.r||1!==v.color.g||1!==v.color.b,A=v.vertexColors.length>0,M=0;if(M=t(M,0,0),M=t(M,1,y),M=t(M,2,b),M=t(M,3,x),M=t(M,4,w),M=t(M,5,_),M=t(M,6,S),M=t(M,7,A),u.push(M),u.push(v.a,v.b,v.c),u.push(v.materialIndex),x){var P=this.faceVertexUvs[0][c];u.push(n(P[0]),n(P[1]),n(P[2]))}if(w&&u.push(e(v.normal)),_){var C=v.vertexNormals;u.push(e(C[0]),e(C[1]),e(C[2]))}if(S&&u.push(i(v.color)),A){var T=v.vertexColors;u.push(i(T[0]),i(T[1]),i(T[2]))}}return r.data={},r.data.vertices=s,r.data.normals=l,f.length>0&&(r.data.colors=f),m.length>0&&(r.data.uvs=[m]),r.data.faces=u,r},clone:function(){return(new ae).copy(this)},copy:function(t){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var e=t.vertices,i=0,n=e.length;i0,a=r[1]&&r[1].length>0,s=t.morphTargets,c=s.length;if(c>0){e=[];for(var h=0;h0){u=[];for(var h=0;h0){var i=new Float32Array(3*t.normals.length);this.addAttribute("normal",new Kt(i,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var n=new Float32Array(3*t.colors.length);this.addAttribute("color",new Kt(n,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var r=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new Kt(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var o=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new Kt(o,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var a=t.vertices.length>65535?Uint32Array:Uint16Array,s=new a(3*t.indices.length);this.setIndex(new Kt(s,1).copyIndicesArray(t.indices))}this.groups=t.groups;for(var c in t.morphTargets){for(var h=[],u=t.morphTargets[c],l=0,d=u.length;l0){var m=new te(4*t.skinIndices.length,4);this.addAttribute("skinIndex",m.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var g=new te(4*t.skinWeights.length,4);this.addAttribute("skinWeight",g.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Et);var t=this.attributes.position.array;void 0!==t?this.boundingBox.setFromArray(t):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var t=new Et,e=new N;return function(){null===this.boundingSphere&&(this.boundingSphere=new It);var i=this.attributes.position;if(i){var n=i.array,r=this.boundingSphere.center;t.setFromArray(n),t.center(r);for(var o=0,a=0,s=n.length;a0&&(t.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(t.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),t},clone:function(){return(new he).copy(this)},copy:function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var i=t.attributes;for(var n in i){var r=i[n];this.addAttribute(n,r.clone())}for(var o=t.groups,a=0,s=o.length;a0)if(s=d*p-f,c=d*f-p,u=l*g,s>=0)if(c>=-u)if(c<=u){var v=1/g;s*=v,c*=v,h=s*(s+d*c+2*f)+c*(d*s+c+2*p)+m}else c=l,s=Math.max(0,-(d*c+f)),h=-s*s+c*(c+2*p)+m;else c=-l,s=Math.max(0,-(d*c+f)),h=-s*s+c*(c+2*p)+m;else c<=-u?(s=Math.max(0,-(-d*l+f)),c=s>0?-l:Math.min(Math.max(-l,-p),l),h=-s*s+c*(c+2*p)+m):c<=u?(s=0,c=Math.min(Math.max(-l,-p),l),h=c*(c+2*p)+m):(s=Math.max(0,-(d*l+f)),c=s>0?l:Math.min(Math.max(-l,-p),l),h=-s*s+c*(c+2*p)+m);else c=d>0?-l:l,s=Math.max(0,-(d*c+f)),h=-s*s+c*(c+2*p)+m;return o&&o.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(e).multiplyScalar(c).add(t),h}}(),intersectSphere:function(){var t=new N;return function(e,i){t.subVectors(e.center,this.origin);var n=t.dot(this.direction),r=t.dot(t)-n*n,o=e.radius*e.radius;if(r>o)return null;var a=Math.sqrt(o-r),s=n-a,c=n+a;return s<0&&c<0?null:s<0?this.at(c,i):this.at(s,i)}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null},intersectPlane:function(t,e){var i=this.distanceToPlane(t);return null===i?null:this.at(i,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);if(0===e)return!0;var i=t.normal.dot(this.direction);return i*e<0},intersectBox:function(t,e){var i,n,r,o,a,s,c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,l=this.origin;return c>=0?(i=(t.min.x-l.x)*c,n=(t.max.x-l.x)*c):(i=(t.max.x-l.x)*c,n=(t.min.x-l.x)*c),h>=0?(r=(t.min.y-l.y)*h,o=(t.max.y-l.y)*h):(r=(t.max.y-l.y)*h,o=(t.min.y-l.y)*h),i>o||r>n?null:((r>i||i!==i)&&(i=r),(o=0?(a=(t.min.z-l.z)*u,s=(t.max.z-l.z)*u):(a=(t.max.z-l.z)*u,s=(t.min.z-l.z)*u),i>s||a>n?null:((a>i||i!==i)&&(i=a),(s=0?i:n,e)))},intersectsBox:function(){var t=new N;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new N,e=new N,i=new N,n=new N;return function(r,o,a,s,c){e.subVectors(o,r),i.subVectors(a,r),n.crossVectors(e,i);var h,u=this.direction.dot(n);if(u>0){if(s)return null;h=1}else{if(!(u<0))return null; +h=-1,u=-u}t.subVectors(this.origin,r);var l=h*this.direction.dot(i.crossVectors(t,i));if(l<0)return null;var d=h*this.direction.dot(e.cross(t));if(d<0)return null;if(l+d>u)return null;var f=-h*t.dot(n);return f<0?null:this.at(f/u,c)}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}},we.prototype={constructor:we,set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},center:function(t){var e=t||new N;return e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){var e=t||new N;return e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var i=e||new N;return this.delta(i).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new N,e=new N;return function(i,n){t.subVectors(i,this.start),e.subVectors(this.end,this.start);var r=e.dot(e),o=e.dot(t),a=o/r;return n&&(a=yd.clamp(a,0,1)),a}}(),closestPointToPoint:function(t,e,i){var n=this.closestPointToPointParameter(t,e),r=i||new N;return this.delta(r).multiplyScalar(n).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}},_e.normal=function(){var t=new N;return function(e,i,n,r){var o=r||new N;o.subVectors(n,i),t.subVectors(e,i),o.cross(t);var a=o.lengthSq();return a>0?o.multiplyScalar(1/Math.sqrt(a)):o.set(0,0,0)}}(),_e.barycoordFromPoint=function(){var t=new N,e=new N,i=new N;return function(n,r,o,a,s){t.subVectors(a,r),e.subVectors(o,r),i.subVectors(n,r);var c=t.dot(t),h=t.dot(e),u=t.dot(i),l=e.dot(e),d=e.dot(i),f=c*l-h*h,p=s||new N;if(0===f)return p.set(-2,-1,-1);var m=1/f,g=(l*u-h*d)*m,v=(c*d-h*u)*m;return p.set(1-g-v,v,g)}}(),_e.containsPoint=function(){var t=new N;return function(e,i,n,r){var o=_e.barycoordFromPoint(e,i,n,r,t);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}(),_e.prototype={constructor:_e,set:function(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this},setFromPointsAndIndices:function(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new N,e=new N;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){var e=t||new N;return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return _e.normal(this.a,this.b,this.c,t)},plane:function(t){var e=t||new Rt;return e.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return _e.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return _e.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t,e,i,n;return function(r,o){void 0===t&&(t=new Rt,e=[new we,new we,new we],i=new N,n=new N);var a=o||new N,s=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(r,i),this.containsPoint(i)===!0)a.copy(i);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var c=0;c0){this.morphTargetBase=-1,this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,e=this.geometry.morphTargets.length;te.far?null:{distance:h,point:v.clone(),object:t}}function i(i,n,r,o,h,u,l,m){a.fromArray(o,3*u),s.fromArray(o,3*l),c.fromArray(o,3*m);var v=e(i,n,r,a,s,c,g);return v&&(h&&(d.fromArray(h,2*u),f.fromArray(h,2*l),p.fromArray(h,2*m),v.uv=t(g,a,s,c,d,f,p)),v.face=new ee(u,l,m,_e.normal(a,s,c)),v.faceIndex=u),v}var n=new O,r=new xe,o=new It,a=new N,s=new N,c=new N,h=new N,u=new N,l=new N,d=new I,f=new I,p=new I,m=new N,g=new N,v=new N;return function(m,v){var y=this.geometry,b=this.material,x=this.matrixWorld;if(void 0!==b&&(null===y.boundingSphere&&y.computeBoundingSphere(),o.copy(y.boundingSphere),o.applyMatrix4(x),m.ray.intersectsSphere(o)!==!1&&(n.getInverse(x),r.copy(m.ray).applyMatrix4(n),null===y.boundingBox||r.intersectsBox(y.boundingBox)!==!1))){var w,_;if(y&&y.isBufferGeometry){var S,A,M,P=y.index,C=y.attributes,T=C.position.array;if(void 0!==C.uv&&(w=C.uv.array),null!==P)for(var E=P.array,I=0,L=E.length;I0&&(w=B);for(var U=0,j=z.length;Ur||i.push({distance:Math.sqrt(n),point:this.position,face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),ke.prototype=Object.assign(Object.create(re.prototype),{constructor:ke,copy:function(t){re.prototype.copy.call(this,t,!1);for(var e=t.levels,i=0,n=e.length;i1){t.setFromMatrixPosition(i.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var r=t.distanceTo(e);n[0].object.visible=!0;for(var o=1,a=n.length;o=n[o].distance;o++)n[o-1].object.visible=!1,n[o].object.visible=!0;for(;oa)){d.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(d);Sn.far||r.push({distance:S,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else for(var y=0,b=g.length/3-1;ya)){d.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(d);Sn.far||r.push({distance:S,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}else if(s&&s.isGeometry)for(var A=s.vertices,M=A.length,y=0;ya)){d.applyMatrix4(this.matrixWorld);var S=n.ray.origin.distanceTo(d);Sn.far||r.push({distance:S,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Ve.prototype=Object.assign(Object.create($e.prototype),{constructor:Ve,isLineSegments:!0}),Ge.prototype=Object.create(At.prototype),Ge.prototype.constructor=Ge,Ge.prototype.isPointsMaterial=!0,Ge.prototype.copy=function(t){return At.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},He.prototype=Object.assign(Object.create(re.prototype),{constructor:He,isPoints:!0,raycast:function(){var t=new O,e=new xe,i=new It;return function(n,r){function o(t,i){var o=e.distanceSqToPoint(t);if(on.far)return;r.push({distance:h,distanceToRay:Math.sqrt(o),point:s.clone(),index:i,face:null,object:a})}}var a=this,s=this.geometry,c=this.matrixWorld,h=n.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(c),n.ray.intersectsSphere(i)!==!1){t.getInverse(c),e.copy(n.ray).applyMatrix4(t);var u=h/((this.scale.x+this.scale.y+this.scale.z)/3),l=u*u,d=new N;if(s&&s.isBufferGeometry){var f=s.index,p=s.attributes,m=p.position.array;if(null!==f)for(var g=f.array,v=0,y=g.length;v0||0===t.search(/^data\:image\/jpeg/);r.format=n?kl:Fl,r.image=i,r.needsUpdate=!0,void 0!==e&&e(r)},i,n),r},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this}}),ni.prototype=Object.assign(Object.create(re.prototype),{constructor:ni,isLight:!0,copy:function(t){return re.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=re.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),ri.prototype=Object.assign(Object.create(ni.prototype),{constructor:ri,isHemisphereLight:!0,copy:function(t){return ni.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(oi.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),ai.prototype=Object.assign(Object.create(oi.prototype),{constructor:ai,isSpotLightShadow:!0,update:function(t){var e=2*yd.RAD2DEG*t.angle,i=this.mapSize.width/this.mapSize.height,n=t.distance||500,r=this.camera;e===r.fov&&i===r.aspect&&n===r.far||(r.fov=e,r.aspect=i,r.far=n,r.updateProjectionMatrix())}}),si.prototype=Object.assign(Object.create(ni.prototype),{constructor:si,isSpotLight:!0,copy:function(t){return ni.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),ci.prototype=Object.assign(Object.create(ni.prototype),{constructor:ci,isPointLight:!0,copy:function(t){return ni.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),hi.prototype=Object.assign(Object.create(oi.prototype),{constructor:hi}),ui.prototype=Object.assign(Object.create(ni.prototype),{constructor:ui,isDirectionalLight:!0,copy:function(t){return ni.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),li.prototype=Object.assign(Object.create(ni.prototype),{constructor:li,isAmbientLight:!0});var Dp={arraySlice:function(t,e,i){return Dp.isTypedArray(t)?new t.constructor(t.subarray(e,i)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){function e(e,i){return t[e]-t[i]}for(var i=t.length,n=new Array(i),r=0;r!==i;++r)n[r]=r;return n.sort(e),n},sortedArray:function(t,e,i){for(var n=t.length,r=new t.constructor(n),o=0,a=0;a!==n;++o)for(var s=i[o]*e,c=0;c!==e;++c)r[a++]=t[s+c];return r},flattenJSON:function(t,e,i,n){for(var r=1,o=t[0];void 0!==o&&void 0===o[n];)o=t[r++];if(void 0!==o){var a=o[n];if(void 0!==a)if(Array.isArray(a)){do a=o[n],void 0!==a&&(e.push(o.time),i.push.apply(i,a)),o=t[r++];while(void 0!==o)}else if(void 0!==a.toArray){do a=o[n],void 0!==a&&(e.push(o.time),a.toArray(i,i.length)),o=t[r++];while(void 0!==o)}else do a=o[n],void 0!==a&&(e.push(o.time),i.push(a)),o=t[r++];while(void 0!==o)}}};di.prototype={constructor:di,evaluate:function(t){var e=this.parameterPositions,i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{var o;i:{n:if(!(t=r)break t;var s=e[1];t=r)break e}o=i,i=0}}for(;i>>1;te;)--o;if(++o,0!==r||o!==n){r>=o&&(o=Math.max(o,1),r=o-1);var a=this.getValueSize();this.times=Dp.arraySlice(i,r,o),this.values=Dp.arraySlice(this.values,r*a,o*a)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("invalid value size in track",this),t=!1);var i=this.times,n=this.values,r=i.length;0===r&&(console.error("track is empty",this),t=!1);for(var o=null,a=0;a!==r;a++){var s=i[a];if("number"==typeof s&&isNaN(s)){console.error("time is not a valid number",this,a,s),t=!1;break}if(null!==o&&o>s){console.error("out of order keys",this,a,s,o),t=!1;break}o=s}if(void 0!==n&&Dp.isTypedArray(n))for(var a=0,c=n.length;a!==c;++a){var h=n[a];if(isNaN(h)){console.error("value is not a valid number",this,a,h),t=!1;break}}return t},optimize:function(){for(var t=this.times,e=this.values,i=this.getValueSize(),n=1,r=1,o=t.length-1;r<=o;++r){var a=!1,s=t[r],c=t[r+1];if(s!==c&&(1!==r||s!==s[0]))for(var h=r*i,u=h-i,l=h+i,d=0;d!==i;++d){var f=e[h+d];if(f!==e[u+d]||f!==e[l+d]){a=!0;break}}if(a){if(r!==n){t[n]=t[r];for(var p=r*i,m=n*i,d=0;d!==i;++d)e[m+d]=e[p+d]}++n}}return n!==t.length&&(this.times=Dp.arraySlice(t,0,n),this.values=Dp.arraySlice(e,0,n*i)),this}},vi.prototype=Object.assign(Object.create(Np),{constructor:vi,ValueTypeName:"vector"}),yi.prototype=Object.assign(Object.create(di.prototype),{constructor:yi,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=(i-e)/(n-e),h=s+a;s!==h;s+=4)D.slerpFlat(r,0,o,s-a,o,s,c);return r}}),bi.prototype=Object.assign(Object.create(Np),{constructor:bi,ValueTypeName:"quaternion",DefaultInterpolation:ed,InterpolantFactoryMethodLinear:function(t){return new yi(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),xi.prototype=Object.assign(Object.create(Np),{constructor:xi,ValueTypeName:"number"}),wi.prototype=Object.assign(Object.create(Np),{constructor:wi,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:td,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),_i.prototype=Object.assign(Object.create(Np),{constructor:_i,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:td,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Si.prototype=Object.assign(Object.create(Np),{constructor:Si,ValueTypeName:"color"}),Ai.prototype=Np,Np.constructor=Ai,Object.assign(Ai,{parse:function(t){if(void 0===t.type)throw new Error("track type undefined, can not parse");var e=Ai._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var i=[],n=[];Dp.flattenJSON(t.keys,i,n,"value"),t.times=i,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){var e,i=t.constructor;if(void 0!==i.toJSON)e=i.toJSON(t);else{e={name:t.name,times:Dp.convertArray(t.times,Array),values:Dp.convertArray(t.values,Array)};var n=t.getInterpolation();n!==t.DefaultInterpolation&&(e.interpolation=n)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return xi;case"vector":case"vector2":case"vector3":case"vector4":return vi;case"color":return Si;case"quaternion":return bi;case"bool":case"boolean":return _i;case"string":return wi}throw new Error("Unsupported typeName: "+t)}}),Mi.prototype={constructor:Mi,resetDuration:function(){for(var t=this.tracks,e=0,i=0,n=t.length;i!==n;++i){var r=this.tracks[i];e=Math.max(e,r.times[r.times.length-1])}this.duration=e},trim:function(){for(var t=0;t1){var h=c[1],u=n[h];u||(n[h]=u=[]),u.push(s)}}var l=[];for(var h in n)l.push(Mi.CreateFromMorphTargetSequence(h,n[h],e,i));return l},parseAnimation:function(t,e,i){if(!t)return console.error(" no animation in JSONLoader data"),null;for(var n=function(t,e,i,n,r){if(0!==i.length){var o=[],a=[];Dp.flattenJSON(i,o,a,n),0!==o.length&&r.push(new t(e,o,a))}},r=[],o=t.name||"default",a=t.length||-1,s=t.fps||30,c=t.hierarchy||[],h=0;h1?t.skinWeights[i+1]:0,s=e>2?t.skinWeights[i+2]:0,c=e>3?t.skinWeights[i+3]:0;a.skinWeights.push(new wt(r,o,s,c))}if(t.skinIndices)for(var i=0,n=t.skinIndices.length;i1?t.skinIndices[i+1]:0,l=e>2?t.skinIndices[i+2]:0,d=e>3?t.skinIndices[i+3]:0;a.skinIndices.push(new wt(h,u,l,d))}a.bones=t.bones,a.bones&&a.bones.length>0&&(a.skinWeights.length!==a.skinIndices.length||a.skinIndices.length!==a.vertices.length)&&console.warn("When skinning, number of vertices ("+a.vertices.length+"), skinIndices ("+a.skinIndices.length+"), and skinWeights ("+a.skinWeights.length+") should match.")}function r(e){if(void 0!==t.morphTargets)for(var i=0,n=t.morphTargets.length;i0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var u=a.faces,l=t.morphColors[0].colors,i=0,n=u.length;i0&&(a.animations=e)}var a=new ae,s=void 0!==t.scale?1/t.scale:1;if(i(s),n(),r(s),o(),a.computeFaceNormals(),a.computeBoundingSphere(),void 0===t.materials||0===t.materials.length)return{geometry:a};var c=Ti.prototype.initMaterials(t.materials,e,this.crossOrigin);return{geometry:a,materials:c}}}),Object.assign(Ii.prototype,{load:function(t,e,i,n){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var r=this,o=new Ke(r.manager);o.load(t,function(t){r.parse(JSON.parse(t),e)},i,n)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var i=this.parseGeometries(t.geometries),n=this.parseImages(t.images,function(){void 0!==e&&e(a)}),r=this.parseTextures(t.textures,n),o=this.parseMaterials(t.materials,r),a=this.parseObject(t.object,i,o);return t.animations&&(a.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(a),a},parseGeometries:function(t){var e={};if(void 0!==t)for(var i=new Ei,n=new Ci,r=0,o=t.length;r0){var o=new Ze(e),a=new ti(o);a.setCrossOrigin(this.crossOrigin);for(var s=0,c=t.length;s0?new Ue(s,c):new Ae(s,c);break;case"LOD":a=new ke;break;case"Line":a=new $e(r(e.geometry),o(e.material),e.mode);break;case"LineSegments":a=new Ve(r(e.geometry),o(e.material));break;case"PointCloud":case"Points":a=new He(r(e.geometry),o(e.material));break;case"Sprite":a=new Ne(o(e.material));break;case"Group":a=new We;break;default:a=new re}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.quaternion&&a.quaternion.fromArray(e.quaternion),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(a.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(a.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&a.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(a.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.children)for(var h in e.children)a.add(this.parseObject(e.children[h],i,n));if("LOD"===e.type)for(var u=e.levels,l=0;l(h-s)*(d-c)-(u-c)*(l-s))return!1;var m,g,v,y,b,x,w,_,S,A,M,P,C,T,E;for(m=l-h,g=d-u,v=s-l,y=c-d,b=h-s,x=u-c,a=0;a=-Number.EPSILON&&T>=-Number.EPSILON&&C>=-Number.EPSILON))return!1;return!0}return function(e,i){var n=e.length;if(n<3)return null;var r,o,a,s=[],c=[],h=[];if(kp.area(e)>0)for(o=0;o2;){if(l--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),i?h:s;if(r=o,u<=r&&(r=0),o=r+1,u<=o&&(o=0),a=o+1,u<=a&&(a=0),t(e,r,o,a,u,c)){var d,f,p,m,g;for(d=c[r],f=c[o],p=c[a],s.push([e[d],e[f],e[p]]),h.push([c[r],c[o],c[a]]),m=o,g=o+1;g2&&t[e-1].equals(t[0])&&t.pop()}function n(t,e,i){return t.x!==e.x?t.xNumber.EPSILON){var p;if(d>0){if(f<0||f>d)return[];if(p=h*u-c*l,p<0||p>d)return[]}else{if(f>0||f0||pM?[]:x===M?o?[]:[y]:w<=M?[y,b]:[y,S]}function o(t,e,i,n){var r=e.x-t.x,o=e.y-t.y,a=i.x-t.x,s=i.y-t.y,c=n.x-t.x,h=n.y-t.y,u=r*s-o*a,l=r*h-o*c;if(Math.abs(u)>Number.EPSILON){var d=c*s-h*a;return u>0?l>=0&&d>=0:l>=0||d>=0}return l>0}function a(t,e){function i(t,e){var i=y.length-1,n=t-1;n<0&&(n=i);var r=t+1;r>i&&(r=0);var a=o(y[t],y[n],y[r],s[e]);if(!a)return!1;var c=s.length-1,h=e-1;h<0&&(h=c);var u=e+1;return u>c&&(u=0),a=o(s[e],s[h],s[u],y[t]),!!a}function n(t,e){var i,n,o;for(i=0;i0)return!0;return!1}function a(t,i){var n,o,a,s,c;for(n=0;n0)return!0;return!1}for(var s,c,h,u,l,d,f,p,m,g,v,y=t.concat(),b=[],x=[],w=0,_=e.length;w<_;w++)b.push(w);for(var S=0,A=2*b.length;b.length>0;){if(A--,A<0){console.log("Infinite Loop! Holes left:"+b.length+", Probably Hole outside Shape!");break}for(h=S;h=0)break;x[f]=!0}if(c>=0)break}}return y}i(t),e.forEach(i);for(var s,c,h,u,l,d,f={},p=t.concat(),m=0,g=e.length;m0)){c=r;break}c=r-1}if(r=c,n[r]===i){var h=r/(o-1);return h}var u=n[r],l=n[r+1],d=l-u,f=(i-u)/d,h=(r+f)/(o-1);return h},getTangent:function(t){var e=1e-4,i=t-e,n=t+e;i<0&&(i=0),n>1&&(n=1);var r=this.getPoint(i),o=this.getPoint(n),a=o.clone().sub(r);return a.normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)}},Li.create=function(t,e){return t.prototype=Object.create(Li.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Ri.prototype=Object.create(Li.prototype),Ri.prototype.constructor=Ri,Ri.prototype.isLineCurve=!0,Ri.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},Ri.prototype.getPointAt=function(t){return this.getPoint(t)},Ri.prototype.getTangent=function(t){var e=this.v2.clone().sub(this.v1);return e.normalize()},Oi.prototype=Object.assign(Object.create(Li.prototype),{constructor:Oi,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Ri(e,t))},getPoint:function(t){for(var e=t*this.getLength(),i=this.getCurveLengths(),n=0;n=e){var r=i[n]-e,o=this.curves[n],a=o.getLength(),s=0===a?0:1-r/a;return o.getPointAt(s)}n++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,i=0,n=this.curves.length;i1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},createPointsGeometry:function(t){var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){for(var e=new ae,i=0,n=t.length;ie;)i-=e;ie.length-2?e.length-1:n+1],c=e[n>e.length-3?e.length-1:n+2],h=Fp.interpolate;return new I(h(o.x,a.x,s.x,c.x,r),h(o.y,a.y,s.y,c.y,r))},ki.prototype=Object.create(Li.prototype),ki.prototype.constructor=ki,ki.prototype.getPoint=function(t){var e=kp.b3;return new I(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},ki.prototype.getTangent=function(t){var e=Fp.tangentCubicBezier;return new I(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},Fi.prototype=Object.create(Li.prototype),Fi.prototype.constructor=Fi,Fi.prototype.getPoint=function(t){var e=kp.b2;return new I(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y))},Fi.prototype.getTangent=function(t){var e=Fp.tangentQuadraticBezier;return new I(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y)).normalize()};var zp=Object.assign(Object.create(Oi.prototype),{fromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,i=t.length;e0){var h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);var u=c.getPoint(1);this.currentPoint.copy(u)}});zi.prototype=Object.create(ae.prototype),zi.prototype.constructor=zi,zi.NoTaper=function(t){return 1},zi.SinusoidalTaper=function(t){return Math.sin(Math.PI*t)},zi.FrenetFrames=function(t,e,i){function n(){f[0]=new N,p[0]=new N,o=Number.MAX_VALUE,a=Math.abs(d[0].x),s=Math.abs(d[0].y),c=Math.abs(d[0].z),a<=o&&(o=a,l.set(1,0,0)),s<=o&&(o=s,l.set(0,1,0)),c<=o&&l.set(0,0,1),m.crossVectors(d[0],l).normalize(),f[0].crossVectors(d[0],m),p[0].crossVectors(d[0],f[0])}var r,o,a,s,c,h,u,l=new N,d=[],f=[],p=[],m=new N,g=new O,v=e+1;for(this.tangents=d,this.normals=f,this.binormals=p,h=0;hNumber.EPSILON&&(m.normalize(),r=Math.acos(yd.clamp(d[h-1].dot(d[h]),-1,1)),f[h].applyMatrix4(g.makeRotationAxis(m,r))),p[h].crossVectors(d[h],f[h]);if(i)for(r=Math.acos(yd.clamp(f[0].dot(f[v-1]),-1,1)),r/=v-1,d[0].dot(m.crossVectors(f[0],f[v-1]))>0&&(r=-r),h=1;hNumber.EPSILON){var d=Math.sqrt(u),f=Math.sqrt(c*c+h*h),p=e.x-s/d,m=e.y+a/d,g=i.x-h/f,v=i.y+c/f,y=((g-p)*h-(v-m)*c)/(a*h-s*c);n=p+a*y-t.x,r=m+s*y-t.y;var b=n*n+r*r;if(b<=2)return new I(n,r);o=Math.sqrt(b/2)}else{var x=!1;a>Number.EPSILON?c>Number.EPSILON&&(x=!0):a<-Number.EPSILON?c<-Number.EPSILON&&(x=!0):Math.sign(s)===Math.sign(h)&&(x=!0),x?(n=-s,r=a,o=Math.sqrt(u)):(n=a,r=s,o=Math.sqrt(u/2))}return new I(n/o,r/o)}function r(){if(b){var t=0,e=G*t;for(X=0;X=0;){i=X,n=X-1,n<0&&(n=t.length-1);var r=0,o=w+2*y;for(r=0;r=0;z--){for(U=z/y,j=g*Math.cos(U*Math.PI/2),B=v*Math.sin(U*Math.PI/2),X=0,q=F.length;XNumber.EPSILON){if(h<0&&(a=e[o],c=-c,s=e[r],h=-h),t.ys.y)continue;if(t.y===a.y){if(t.x===a.x)return!0}else{var u=h*(t.x-a.x)-c*(t.y-a.y);if(0===u)return!0;if(u<0)continue;n=!n}}else{if(t.y!==a.y)continue;if(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x)return!0}}return n}var r=kp.isClockWise,o=this.subPaths;if(0===o.length)return[];if(e===!0)return i(o);var a,s,c,h=[];if(1===o.length)return s=o[0],c=new ji,c.curves=s.curves,h.push(c),h;var u=!r(o[0].getPoints());u=t?!u:u;var l,d=[],f=[],p=[],m=0;f[m]=void 0,p[m]=[];for(var g=0,v=o.length;g1){for(var y=!1,b=[],x=0,w=f.length;x0&&(y||(p=d))}for(var C,g=0,T=f.length;g0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t=.5)for(var o=0;o!==r;++o)t[e+o]=t[i+o]},_slerp:function(t,e,i,n,r){D.slerpFlat(t,e,t,e,t,i,n)},_lerp:function(t,e,i,n,r){for(var o=1-n,a=0;a!==r;++a){var s=e+a;t[s]=t[s]*o+t[i+a]*n}}},tn.prototype={constructor:tn,getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,i=e.objectName,n=e.propertyName,r=e.propertyIndex;if(t||(t=tn.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error(" trying to update node for track: "+this.path+" but it wasn't found.");if(i){var o=e.objectIndex;switch(i){case"materials":if(!t.material)return void console.error(" can not bind to material as node does not have a material",this);if(!t.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);t=t.skeleton.bones;for(var a=0;a0)for(var c=this._interpolants,h=this._propertyBindings,u=0,l=c.length;u!==l;++u)c[u].evaluate(a),h[u].accumulate(n,s)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var i=this._weightInterpolant;if(null!==i){var n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i){var n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var i=this._clip.duration,n=this.loop,r=this._loopCount;if(n===Kl){r===-1&&(this.loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=i)e=i;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{var o=n===Jl;if(r===-1&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),e>=i||e<0){var a=Math.floor(e/i);e-=i*a,r+=Math.abs(a);var s=this.repetitions-r;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(0===s){var c=t<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1===(1&r))return this.time=e,i-e}return this.time=e,e},_setEndings:function(t,e,i){var n=this._interpolantSettings;i?(n.endingStart=rd,n.endingEnd=rd):(t?n.endingStart=this.zeroSlopeAtStart?rd:nd:n.endingStart=od,e?n.endingEnd=this.zeroSlopeAtEnd?rd:nd:n.endingEnd=od)},_scheduleFading:function(t,e,i){var n=this._mixer,r=n.time,o=this._weightInterpolant;null===o&&(o=n._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=r,s[0]=e,a[1]=r+t,s[1]=i,this}},Object.assign(nn.prototype,E.prototype,{clipAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?Mi.findByName(i,t):t,o=null!==r?r.uuid:t,a=this._actionsByClip[o],s=null;if(void 0!==a){var c=a.actionByRoot[n];if(void 0!==c)return c;s=a.knownActions[0],null===r&&(r=s._clip)}if(null===r)return null;var h=new en(this,r,e);return this._bindAction(h,s),this._addInactiveAction(h,o,n),h},existingAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?Mi.findByName(i,t):t,o=r?r.uuid:t,a=this._actionsByClip[o];return void 0!==a?a.actionByRoot[n]||null:null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,i=this._bindings,n=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var r=0;r!==e;++r)t[r].reset();for(var r=0;r!==n;++r)i[r].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,i=this._nActiveActions,n=this.time+=t,r=Math.sign(t),o=this._accuIndex^=1,a=0;a!==i;++a){var s=e[a];s.enabled&&s._update(n,t,r,o)}for(var c=this._bindings,h=this._nActiveBindings,a=0;a!==h;++a)c[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,i=t.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){for(var o=r.knownActions,a=0,s=o.length;a!==s;++a){var c=o[a];this._deactivateAction(c);var h=c._cacheIndex,u=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=h,e[h]=u,e.pop(),this._removeInactiveBindingsForAction(c)}delete n[i]}},uncacheRoot:function(t){var e=t.uuid,i=this._actionsByClip;for(var n in i){var r=i[n].actionByRoot,o=r[e];void 0!==o&&(this._deactivateAction(o),this._removeInactiveAction(o))}var a=this._bindingsByRootAndName,s=a[e];if(void 0!==s)for(var c in s){var h=s[c];h.restoreOriginalState(),this._removeInactiveBinding(h)}},uncacheAction:function(t,e){var i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}),Object.assign(nn.prototype,{_bindAction:function(t,e){var i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,o=t._propertyBindings,a=t._interpolants,s=i.uuid,c=this._bindingsByRootAndName,h=c[s];void 0===h&&(h={},c[s]=h);for(var u=0;u!==r;++u){var l=n[u],d=l.name,f=h[d];if(void 0!==f)o[u]=f;else{if(f=o[u],void 0!==f){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,s,d));continue}var p=e&&e._propertyBindings[u].binding.parsedPath;f=new Ji(tn.create(i,d,p),l.ValueTypeName,l.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,s,d),o[u]=f}a[u].resultBuffer=f.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}for(var r=t._propertyBindings,o=0,a=r.length;o!==a;++o){var s=r[o];0===s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0===--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e.99999?this.quaternion.set(0,0,0,1):i.y<-.99999?this.quaternion.set(1,0,0,0):(e.set(i.z,0,-i.x).normalize(),t=Math.acos(i.y),this.quaternion.setFromAxisAngle(e,t))}}(),bn.prototype.setLength=function(t,e,i){void 0===e&&(e=.2*t),void 0===i&&(i=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()},bn.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},xn.prototype=Object.create(ae.prototype),xn.prototype.constructor=xn,wn.prototype=Object.create(xn.prototype),wn.prototype.constructor=wn,_n.prototype=Object.create(he.prototype),_n.prototype.constructor=_n,Sn.prototype=Object.create(he.prototype),Sn.prototype.constructor=Sn,An.prototype=Object.create(he.prototype),An.prototype.constructor=An,Mn.prototype=Object.create(ae.prototype),Mn.prototype.constructor=Mn,Pn.prototype=Object.create(he.prototype),Pn.prototype.constructor=Pn,Cn.prototype=Object.create(ae.prototype),Cn.prototype.constructor=Cn,Tn.prototype=Object.create(he.prototype),Tn.prototype.constructor=Tn,En.prototype=Object.create(he.prototype),En.prototype.constructor=En;(function(){function t(){}var e=new N,i=new t,n=new t,r=new t;return t.prototype.init=function(t,e,i,n){this.c0=t,this.c1=i,this.c2=-3*t+3*e-2*i-n,this.c3=2*t-2*e+i+n},t.prototype.initNonuniformCatmullRom=function(t,e,i,n,r,o,a){var s=(e-t)/r-(i-t)/(r+o)+(i-e)/o,c=(i-e)/o-(n-e)/(o+a)+(n-i)/a;s*=o,c*=o,this.init(e,i,s,c)},t.prototype.initCatmullRom=function(t,e,i,n,r){this.init(e,i,r*(i-t),r*(n-e))},t.prototype.calc=function(t){var e=t*t,i=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*i},Li.create(function(t){this.points=t||[],this.closed=!1},function(t){var o,a,s,c,h=this.points;c=h.length,c<2&&console.log("duh, you need at least 2 points"),o=(c-(this.closed?0:1))*t,a=Math.floor(o),s=o-a,this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/h.length)+1)*h.length:0===s&&a===c-1&&(a=c-2,s=1);var u,l,d,f;if(this.closed||a>0?u=h[(a-1)%c]:(e.subVectors(h[0],h[1]).add(h[0]),u=e),l=h[a%c],d=h[(a+1)%c],this.closed||a+2e.length-2?e.length-1:n+1],c=e[n>e.length-3?e.length-1:n+2],h=Fp.interpolate;return new N(h(o.x,a.x,s.x,c.x,r),h(o.y,a.y,s.y,c.y,r),h(o.z,a.z,s.z,c.z,r))}),Li.create(function(t,e,i,n){this.v0=t,this.v1=e,this.v2=i,this.v3=n},function(t){var e=kp.b3;return new N(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),e(t,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),Li.create(function(t,e,i){this.v0=t,this.v1=e,this.v2=i},function(t){var e=kp.b2;return new N(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y),e(t,this.v0.z,this.v1.z,this.v2.z))}),Li.create(function(t,e){this.v1=t,this.v2=e},function(t){if(1===t)return this.v2.clone();var e=new N;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e});Object.defineProperty(t,"AudioContext",{get:function(){return t.getAudioContext()}}),In.prototype={active:!0,params:null,execute:function(t){var e,i;return this.active&&this._listener&&(i=this.params?this.params.concat(t):t,e=this._listener.apply(this.context,i),this._isOnce&&this.detach()),e},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return!!this._signal&&!!this._listener},isOnce:function(){return this._isOnce},getListener:function(){return this._listener},getSignal:function(){return this._signal},_destroy:function(){delete this._signal,delete this._listener,delete this.context},toString:function(){return"[SignalBinding isOnce:"+this._isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}},Rn.prototype={VERSION:"1.0.0",memorize:!1,_shouldPropagate:!0,active:!0,_registerListener:function(t,e,i,n){var r,o=this._indexOfListener(t,i);if(o!==-1){if(r=this._bindings[o],r.isOnce()!==e)throw new Error("You cannot add"+(e?"":"Once")+"() then add"+(e?"Once":"")+"() the same listener without removing the relationship first.")}else r=new In(this,t,e,i,n),this._addBinding(r);return this.memorize&&this._prevParams&&r.execute(this._prevParams),r},_addBinding:function(t){var e=this._bindings.length;do--e;while(this._bindings[e]&&t._priority<=this._bindings[e]._priority);this._bindings.splice(e+1,0,t)},_indexOfListener:function(t,e){for(var i,n=this._bindings.length;n--;)if(i=this._bindings[n],i._listener===t&&i.context===e)return n;return-1},has:function(t,e){return this._indexOfListener(t,e)!==-1},add:function(t,e,i){return Ln(t,"add"),this._registerListener(t,!1,e,i)},addOnce:function(t,e,i){return Ln(t,"addOnce"),this._registerListener(t,!0,e,i)},remove:function(t,e){Ln(t,"remove");var i=this._indexOfListener(t,e);return i!==-1&&(this._bindings[i]._destroy(),this._bindings.splice(i,1)),t},removeAll:function(){for(var t=this._bindings.length;t--;)this._bindings[t]._destroy();this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(t){if(this.active){var e,i=Array.prototype.slice.call(arguments),n=this._bindings.length;if(this.memorize&&(this._prevParams=i),n){e=this._bindings.slice(),this._shouldPropagate=!0;do n--;while(e[n]&&this._shouldPropagate&&e[n].execute(i)!==!1)}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll(),delete this._bindings,delete this._prevParams},toString:function(){return"[Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}};var $p={PROTEIN:1,NUCLEIC:2,RNA:3,DNA:4,POLYMER:5,WATER:6,HELIX:7,SHEET:8,BACKBONE:9,SIDECHAIN:10,ALL:11,HETERO:12,ION:13,SACCHARIDE:14};On.prototype={constructor:On,type:"selection",setString:function(t,e){if(void 0===t&&(t=this.string||""),t!==this.string){try{this.parse(t)}catch(t){this.selection={error:t.message}}this.string=t,this.test=this.makeAtomTest(),this.residueTest=this.makeResidueTest(),this.chainTest=this.makeChainTest(),this.modelTest=this.makeModelTest(),this.atomOnlyTest=this.makeAtomTest(!0),this.residueOnlyTest=this.makeResidueTest(!0),this.chainOnlyTest=this.makeChainTest(!0),this.modelOnlyTest=this.makeModelTest(!0),e||this.signals.stringChanged.dispatch(this.string)}},parse:function(t){if(this.selection={operator:void 0,rules:[]},t){var e,i,n=this,r=this.selection,o=[];t=t.replace(/\(/g," ( ").replace(/\)/g," ) ").trim(),"("===t.charAt(0)&&")"===t.substr(-1)&&(t=t.slice(1,-1).trim());var a,s,c,h,u,l,d,f,p,m,g=t.split(/\s+/),v=["*","","ALL"],y=function(t){e={operator:t,rules:[]},void 0===r?(r=e,n.selection=e):(r.rules.push(e),o.push(r),r=e)},b=function(t){i=r,r=o.pop(),void 0===r&&(y(t),x(i))},x=function(t){r.rules.push(t)};for(c=0;c0)if("NOT"===a.toUpperCase())h=1;else if(1===h)h=2;else{if(2!==h)throw new Error("something went wrong with 'not'");h=!1,b()}if("AND"!==a.toUpperCase())if("OR"!==a.toUpperCase())if("NOT"!==a.toUpperCase())if(s={},"HETERO"!==a.toUpperCase())if("WATER"!==a.toUpperCase())if("PROTEIN"!==a.toUpperCase())if("NUCLEIC"!==a.toUpperCase())if("RNA"!==a.toUpperCase())if("DNA"!==a.toUpperCase())if("POLYMER"!==a.toUpperCase())if("ION"!==a.toUpperCase())if("SACCHARIDE"!==a.toUpperCase()&&"SUGAR"!==a.toUpperCase())if("HYDROGEN"!==a.toUpperCase())if("SMALL"!==a.toUpperCase())if("NUCLEOPHILIC"!==a.toUpperCase())if("HYDROPHOBIC"!==a.toUpperCase())if("AROMATIC"!==a.toUpperCase())if("AMIDE"!==a.toUpperCase())if("ACIDIC"!==a.toUpperCase())if("BASIC"!==a.toUpperCase())if("CHARGED"!==a.toUpperCase())if("POLAR"!==a.toUpperCase())if("NONPOLAR"!==a.toUpperCase())if("HELIX"!==a.toUpperCase())if("SHEET"!==a.toUpperCase())if("TURN"!==a.toUpperCase())if("BACKBONE"!==a.toUpperCase())if("SIDECHAIN"!==a.toUpperCase())if("SIDECHAINATTACHED"!==a.toUpperCase())if(v.indexOf(a.toUpperCase())===-1)if("@"!==a.charAt(0))if("#"!==a.charAt(0))if("["!==a[0]||"]"!==a[a.length-1])if(a.length>=1&&a.length<=4&&"^"!==a[0]&&":"!==a[0]&&"."!==a[0]&&"%"!==a[0]&&"/"!==a[0]&&isNaN(parseInt(a)))s.resname=a.toUpperCase(),x(s);else{if(s={operator:"AND",rules:[]},d=a.split("/"),d.length>1&&d[1]){if(isNaN(parseInt(d[1])))throw new Error("model must be an integer");s.rules.push({model:parseInt(d[1])})}if(p=d[0].split("%"),p.length>1&&s.rules.push({altloc:p[1]}),u=p[0].split("."),u.length>1&&u[1]){if(u[1].length>4)throw new Error("atomname must be one to four characters");s.rules.push({atomname:u[1].substring(0,4).toUpperCase()})}if(l=u[0].split(":"),l.length>1&&l[1]&&s.rules.push({chainname:l[1]}),m=l[0].split("^"),m.length>1&&s.rules.push({inscode:m[1]}),m[0]){var w,_;if("-"===m[0][0]&&(m[0]=m[0].substr(1),w=!0),m[0].includes("--")&&(m[0]=m[0].replace("--","-"),_=!0),f=m[0].split("-"),1===f.length){if(f=parseInt(f[0]),isNaN(f))throw new Error("resi must be an integer");w&&(f*=-1),s.rules.push({resno:f})}else{if(2!==f.length)throw new Error("resi range must contain one '-'");w&&(f[0]*=-1),_&&(f[1]*=-1),s.rules.push({resno:[parseInt(f[0]),parseInt(f[1])]})}}if(1===s.rules.length)x(s.rules[0]);else{if(!(s.rules.length>1))throw new Error("empty selection chunk");x(s)}}else s.resname=a.substr(1,a.length-2).toUpperCase(),x(s);else s.element=a.substr(1).toUpperCase(),x(s);else{for(var S=a.substr(1).split(","),A=0,M=S.length;A0?e:null},makeAtomTest:function(t){var e,i=["h","g","i"],n=["e","b"];e=t?this._filter(function(t){return void 0!==t.keyword&&t.keyword!==$p.BACKBONE&&t.keyword!==$p.SIDECHAIN||(void 0!==t.model||(void 0!==t.chainname||(void 0!==t.resname||(void 0!==t.resno||void 0!==t.sstruc))))}):this.selection;var r=function(t,e){if(void 0===e.atomname&&void 0===e.element&&void 0===e.altloc&&void 0===e.atomindex&&void 0===e.keyword&&void 0===e.inscode&&void 0===e.resname&&void 0===e.sstruc&&void 0===e.resno&&void 0===e.chainname&&void 0===e.model)return-1;if(void 0!==e.keyword){if(e.keyword===$p.BACKBONE&&!t.isBackbone())return!1;if(e.keyword===$p.SIDECHAIN&&!t.isSidechain())return!1;if(e.keyword===$p.HETERO&&!t.isHetero())return!1;if(e.keyword===$p.PROTEIN&&!t.isProtein())return!1;if(e.keyword===$p.NUCLEIC&&!t.isNucleic())return!1;if(e.keyword===$p.RNA&&!t.isRna())return!1;if(e.keyword===$p.DNA&&!t.isDna())return!1;if(e.keyword===$p.POLYMER&&!t.isPolymer())return!1;if(e.keyword===$p.WATER&&!t.isWater())return!1;if(e.keyword===$p.HELIX&&i.indexOf(t.sstruc)===-1)return!1;if(e.keyword===$p.SHEET&&n.indexOf(t.sstruc)===-1)return!1;if(e.keyword===$p.ION&&!t.isIon())return!1;if(e.keyword===$p.SACCHARIDE&&!t.isSaccharide())return!1}if(void 0!==e.atomname&&e.atomname!==t.atomname)return!1;if(void 0!==e.element&&e.element!==t.element)return!1;if(void 0!==e.altloc&&e.altloc!==t.altloc)return!1;if(void 0!==e.atomindex&&au(e.atomindex,t.index)<0)return!1;if(void 0!==e.resname&&e.resname!==t.resname)return!1;if(void 0!==e.sstruc&&e.sstruc!==t.sstruc)return!1;if(void 0!==e.resno)if(Array.isArray(e.resno)&&2===e.resno.length){if(e.resno[0]>t.resno||e.resno[1]e.atomindexLast||t.atomEndt.resno||e.resno[1]e.atomindexLast||t.atomEnde.atomindexLast||t.atomEnd>=4,i[r]=e[19===r?3&t|8:t]);return i.join("")}}(),Gp=0,Hp=1,Wp=2,Xp=3,qp=4,Yp=0,Zp=1,Kp=2,Qp=3,Jp=4,tm=5,em=6,im=0,nm=1,rm=2,om=3,am=4,sm=5,cm=6,hm=["D-BETA-PEPTIDE, C-GAMMA LINKING","D-GAMMA-PEPTIDE, C-DELTA LINKING","D-PEPTIDE COOH CARBOXY TERMINUS","D-PEPTIDE NH3 AMINO TERMINUS","D-PEPTIDE LINKING","L-BETA-PEPTIDE, C-GAMMA LINKING","L-GAMMA-PEPTIDE, C-DELTA LINKING","L-PEPTIDE COOH CARBOXY TERMINUS","L-PEPTIDE NH3 AMINO TERMINUS","L-PEPTIDE LINKING","PEPTIDE LINKING","PEPTIDE-LIKE"],um=["RNA OH 3 PRIME TERMINUS","RNA OH 5 PRIME TERMINUS","RNA LINKING"],lm=["DNA OH 3 PRIME TERMINUS","DNA OH 5 PRIME TERMINUS","DNA LINKING","L-DNA LINKING","L-RNA LINKING"],dm=["D-SACCHARIDE","D-SACCHARIDE 1,4 AND 1,4 LINKING","D-SACCHARIDE 1,4 AND 1,6 LINKING","L-SACCHARIDE","L-SACCHARIDE 1,4 AND 1,4 LINKING","L-SACCHARIDE 1,4 AND 1,6 LINKING","SACCHARIDE"],fm=["OTHER"],pm=["NON-POLYMER"],mm=pm.concat(fm,dm),gm={H:1.1,HE:1.4,LI:1.81,BE:1.53,B:1.92,C:1.7,N:1.55,O:1.52,F:1.47,NE:1.54,NA:2.27,MG:1.73,AL:1.84,SI:2.1,P:1.8,S:1.8,CL:1.75,AR:1.88,K:2.75,CA:2.31,SC:2.3,TI:2.15,V:2.05,CR:2.05,MN:2.05,FE:2.05,CO:2,NI:2,CU:2,ZN:2.1,GA:1.87,GE:2.11,AS:1.85,SE:1.9,BR:1.83,KR:2.02,RB:3.03,SR:2.49,Y:2.4,ZR:2.3,NB:2.15,MO:2.1,TC:2.05,RU:2.05,RH:2,PD:2.05,AG:2.1,CD:2.2,IN:2.2,SN:1.93,SB:2.17,TE:2.06,I:1.98,XE:2.16,CS:3.43,BA:2.68,LA:2.5,CE:2.48,PR:2.47,ND:2.45,PM:2.43,SM:2.42,EU:2.4,GD:2.38,TB:2.37,DY:2.35,HO:2.33,ER:2.32,TM:2.3,YB:2.28,LU:2.27,HF:2.25,TA:2.2,W:2.1,RE:2.05,OS:2,IR:2,PT:2.05,AU:2.1,HG:2.05,TL:1.96,PB:2.02,BI:2.07,PO:1.97,AT:2.02,RN:2.2,FR:3.48,RA:2.83,AC:2,TH:2.4,PA:2,U:2.3,NP:2,PU:2,AM:2,CM:2,BK:2,CF:2,ES:2,FM:2,MD:2,NO:2,LR:2,RF:2,DB:2,SG:2,BH:2,HS:2,MT:2,DS:2,RG:2,CN:2,UUT:2,FL:2,UUP:2,LV:2,UUH:2},vm=2,ym={H:.31,HE:.28,LI:1.28,BE:.96,B:.84,C:.76,N:.71,O:.66,F:.57,NE:.58,NA:1.66,MG:1.41,AL:1.21,SI:1.11,P:1.07,S:1.05,CL:1.02,AR:1.06,K:2.03,CA:1.76,SC:1.7,TI:1.6,V:1.53,CR:1.39,MN:1.39,FE:1.32,CO:1.26,NI:1.24,CU:1.32,ZN:1.22,GA:1.22,GE:1.2,AS:1.19,SE:1.2,BR:1.2,KR:1.16,RB:2.2,SR:1.95,Y:1.9,ZR:1.75,NB:1.64,MO:1.54,TC:1.47,RU:1.46,RH:1.42,PD:1.39,AG:1.45,CD:1.44,IN:1.42,SN:1.39,SB:1.39,TE:1.38,I:1.39,XE:1.4,CS:2.44,BA:2.15,LA:2.07,CE:2.04,PR:2.03,ND:2.01,PM:1.99,SM:1.98,EU:1.98,GD:1.96,TB:1.94,DY:1.92,HO:1.92,ER:1.89,TM:1.9,YB:1.87,LU:1.87,HF:1.75,TA:1.7,W:1.62,RE:1.51,OS:1.44,IR:1.41,PT:1.36,AU:1.36,HG:1.32,TL:1.45,PB:1.46,BI:1.48,PO:1.4,AT:1.5,RN:1.5,FR:2.6,RA:2.21,AC:2.15,TH:2.06,PA:2,U:1.96,NP:1.9,PU:1.87,AM:1.8,CM:1.69,BK:1.6,CF:1.6,ES:1.6,FM:1.6,MD:1.6,NO:1.6,LR:1.6,RF:1.6,DB:1.6,SG:1.6,BH:1.6,HS:1.6,MT:1.6,DS:1.6,RG:1.6,CN:1.6,UUT:1.6,FL:1.6,UUP:1.6,LV:1.6,UUH:1.6},bm=1.6,xm={ALA:[.17,.5,.33],ARG:[.81,1.81,1],ASN:[.42,.85,.43],ASP:[1.23,3.64,2.41],ASH:[-.07,.43,.5],CYS:[-.24,-.02,.22],GLN:[.58,.77,.19],GLU:[2.02,3.63,1.61],GLH:[-.01,.11,.12],GLY:[.01,1.15,1.14],HIS:[.17,.11,-.06],ILE:[-.31,-1.12,-.81],LEU:[-.56,-1.25,-.69],LYS:[.99,2.8,1.81],MET:[-.23,-.67,-.44],PHE:[-1.13,-1.71,-.58],PRO:[.45,.14,-.31],SER:[.13,.46,.33],THR:[.14,.25,.11],TRP:[-1.85,-2.09,-.24],TYR:[-.94,-.71,.23],VAL:[.07,-.46,-.53]},wm=[0,0,0],_m={HIS:"H",ARG:"R",LYS:"K",ILE:"I",PHE:"F",LEU:"L",TRP:"W",ALA:"A",MET:"M",PRO:"P",CYS:"C",ASN:"N",VAL:"V",GLY:"G",SER:"S",GLN:"Q",TYR:"Y",ASP:"D",GLU:"E",THR:"T",ASH:"D",GLH:"E",UNK:""},Sm=Object.keys(_m),Am=["A","C","T","G","U"],Mm=["DA","DC","DT","DG","DU","TCY","MCY","5CM"],Pm=["A","G","DA","DG"],Cm=["SOL","WAT","HOH","H2O","W","DOD","D3O"],Tm=["118","119","1AL","1CU","2FK","2HP","2OF","3CO","3MT","3NI","3OF","3P8","4MO","4PU","543","6MO","ACT","AG","AL","ALF","AM","ATH","AU","AU3","AUC","AZI","BA","BCT","BEF","BF4","BO4","BR","BS3","BSY","CA","CAC","CD","CD1","CD3","CD5","CE","CHT","CL","CO","CO3","CO5","CON","CR","CS","CSB","CU","CU1","CU3","CUA","CUZ","CYN","DME","DMI","DSC","DTI","DY","E4N","EDR","EMC","ER3","EU","EU3","F","FE","FE2","FPO","GA","GD3","GEP","HAI","HG","HGC","IN","IOD","IR","IR3","IRI","IUM","K","KO4","LA","LCO","LCP","LI","LU","MAC","MG","MH2","MH3","MLI","MLT","MMC","MN","MN3","MN5","MN6","MO1","MO2","MO3","MO4","MO5","MO6","MOO","MOS","MOW","MW1","MW2","MW3","NA","NA2","NA5","NA6","NAO","NAW","NCO","NET","NH4","NI","NI1","NI2","NI3","NO2","NO3","NRU","O4M","OAA","OC1","OC2","OC3","OC4","OC5","OC6","OC7","OC8","OCL","OCM","OCN","OCO","OF1","OF2","OF3","OH","OS","OS4","OXL","PB","PBM","PD","PDV","PER","PI","PO3","PO4","PR","PT","PT4","PTN","RB","RH3","RHD","RU","SB","SCN","SE4","SEK","SM","SMO","SO3","SO4","SR","T1A","TB","TBA","TCN","TEA","TH","THE","TL","TMA","TRA","UNX","V","VN3","VO4","W","WO5","Y1","YB","YB2","YH","YT3","ZCM","ZN","ZN2","ZN3","ZNO","ZO3"],Em=["045","0AT","0BD","0MK","0NZ","0TS","0V4","0XY","0YT","10M","147","149","14T","15L","16G","18T","18Y","1AR","1BW","1GL","1GN","1JB","1LL","1NA","1S3","26M","26Q","26R","26V","26W","26Y","27C","289","291","293","2DG","2F8","2FG","2FL","2FP","2GL","2M4","2M5","32O","34V","3CM","3DO","3DY","3FM","3LR","3MF","3MG","3SA","3ZW","46D","46M","46Z","48Z","4CQ","4GC","4NN","50A","5DI","5GF","5MM","5RP","5SA","5SP","64K","6PG","6SA","7JZ","7SA","A1Q","A2G","AAB","AAL","AAO","ABC","ABD","ABE","ABF","ABL","ACG","ACI","ACR","ACX","ADA","ADG","ADR","AF1","AFD","AFL","AFO","AFP","AFR","AGC","AGH","AGL","AHR","AIG","ALL","ALX","AMU","AOG","AOS","ARA","ARB","ARE","ARI","ASG","ASO","AXP","AXR","B0D","B16","B2G","B4G","B6D","B8D","B9D","BBK","BCD","BDG","BDP","BDR","BEM","BFP","BGC","BGL","BGP","BGS","BHG","BMA","BMX","BNG","BNX","BOG","BRI","BXF","BXP","BXX","BXY","C3X","C4X","C5X","CAP","CBI","CBK","CBS","CDR","CEG","CGF","CHO","CR1","CR6","CRA","CT3","CTO","CTR","CTT","D6G","DAF","DAG","DDA","DDB","DDL","DEL","DFR","DFX","DG0","DGC","DGD","DGM","DGS","DIG","DLF","DLG","DMU","DNO","DOM","DP5","DQQ","DQR","DR2","DR3","DR4","DRI","DSR","DT6","DVC","E4P","E5G","EAG","EBG","EBQ","EGA","EJT","EPG","ERE","ERI","F1P","F1X","F6P","FBP","FCA","FCB","FCT","FDP","FDQ","FFC","FIX","FMO","FRU","FSI","FU4","FUB","FUC","FUD","FUL","FXP","G16","G1P","G2F","G3I","G4D","G4S","G6D","G6P","G6S","GAC","GAD","GAL","GC1","GC4","GCD","GCN","GCO","GCS","GCT","GCU","GCV","GCW","GCX","GE1","GFG","GFP","GIV","GL0","GL2","GL5","GL6","GL7","GL9","GLA","GLB","GLC","GLD","GLF","GLG","GLO","GLP","GLS","GLT","GLW","GMH","GN1","GNX","GP1","GP4","GPH","GPM","GQ1","GQ2","GQ4","GS1","GS4","GSA","GSD","GTE","GTH","GTK","GTR","GTZ","GU0","GU1","GU2","GU3","GU4","GU5","GU6","GU8","GU9","GUF","GUP","GUZ","GYP","GYV","H2P","HDL","HMS","HS2","HSD","HSG","HSH","HSJ","HSQ","HSR","HSU","HSX","HSY","HSZ","IAB","IDG","IDR","IDS","IDT","IDU","IDX","IDY","IMK","IN1","IPT","ISL","KBG","KD2","KDA","KDM","KDO","KFN","KO1","KO2","KTU","L6S","LAG","LAI","LAK","LAO","LAT","LB2","LBT","LCN","LDY","LGC","LGU","LM2","LMT","LMU","LOG","LOX","LPK","LSM","LTM","LVZ","LXB","LXZ","M1F","M3M","M6P","M8C","MA1","MA2","MA3","MAB","MAG","MAL","MAN","MAT","MAV","MAW","MBG","MCU","MDA","MDM","MDP","MFA","MFB","MFU","MG5","MGA","MGL","MLB","MMA","MMN","MN0","MRP","MTT","MUG","MVP","MXY","N1L","N9S","NAA","NAG","NBG","NDG","NED","NG1","NG6","NGA","NGB","NGC","NGE","NGF","NGL","NGS","NGY","NHF","NM6","NM9","NTF","NTO","NTP","NXD","NYT","OPG","OPM","ORP","OX2","P3M","P53","P6P","PA5","PNA","PNG","PNW","PRP","PSJ","PSV","PTQ","QDK","QPS","QV4","R1P","R1X","R2B","R5P","RAA","RAE","RAF","RAM","RAO","RAT","RB5","RBL","RCD","RDP","REL","RER","RF5","RG1","RGG","RHA","RIB","RIP","RNS","RNT","ROB","ROR","RPA","RST","RUB","RUU","RZM","S6P","S7P","SA0","SCR","SDD","SF6","SF9","SG4","SG5","SG6","SG7","SGA","SGC","SGD","SGN","SGS","SHB","SHG","SI3","SIO","SOE","SOL","SSG","SUC","SUP","SUS","T6P","T6T","TAG","TCB","TDG","TGK","TGY","TH1","TIA","TM5","TM6","TM9","TMR","TMX","TOA","TOC","TRE","TYV","UCD","UDC","VG1","X0X","X1X","X2F","X4S","X5S","X6X","XBP","XDN","XDP","XIF","XIM","XLF","XLS","XMM","XUL","XXR","XYP","XYS","YO5","Z3Q","Z6J","Z9M","ZDC","ZDM"],Im=["CA","C","N","O","O1","O2","OC1","OC2","OX1","OXT","H","H1","H2","H3","HA","BB"],Lm=["P","O3'","O5'","C5'","C4'","C3'","OP1","OP2","O3*","O5*","C5*","C4*","C3*"],Rm={};Rm[nm]={trace:"CA",direction1:"C",direction2:["O","OC1","O1","OX1","OXT"],backboneStart:"N",backboneEnd:"C"},Rm[rm]={trace:["C4'","C4*"],direction1:["C1'","C1*"],direction2:["C3'","C3*"],backboneStart:"P",backboneEnd:["O3'","O3*"]},Rm[om]={trace:["C3'","C3*"],direction1:["C2'","C2*"],direction2:["O4'","O4*"],backboneStart:"P",backboneEnd:["O3'","O3*"]},Rm[am]={trace:["CA","BB"],backboneStart:["CA","BB"],backboneEnd:["CA","BB"]},Rm[sm]={trace:["C4'","C4*","P"],backboneStart:["C4'","C4*","P"],backboneEnd:["C4'","C4*","P"]},Rm[cm]={trace:["C3'","C3*","C2'","P"],backboneStart:["C3'","C3*","C2'","P"],backboneEnd:["C3'","C3*","C2'","P"]},Rm[im]={};var Om,Dm,Nm,km,Fm,zm,Bm,Um,jm,$m,Vm,Gm,Hm,Wm,Xm,qm,Ym,Zm,Km,Qm,Jm,tg,eg,ig,ng,rg,og,ag,sg,cg,hg,ug,lg,dg,fg,pg,mg,gg,vg,yg,bg,xg,wg,_g,Sg,Ag,Mg,Pg,Cg,Tg,Eg,Ig,Lg,Rg,Og,Dg,Ng,kg,Fg,zg,Bg,Ug,jg,$g,Vg,Gg,Hg,Wg,Xg,qg,Yg,Zg,Kg,Qg,Jg,tv,ev,iv,nv=[].slice;Qg=function(){var t,e,i,n,r;for(t={},r="Boolean Number String Function Array Date RegExp Undefined Null".split(" "),n=0,e=r.length;ni&&(t=i),t},Jg=function(t){return t.length>=3?[].slice.call(t):t[0]},Qm=function(t){var e;for(e in t)e<3?(t[e]<0&&(t[e]=0),t[e]>255&&(t[e]=255)):3===e&&(t[e]<0&&(t[e]=0),t[e]>1&&(t[e]=1));return t},km=Math.PI,Xg=Math.round,eg=Math.cos,ag=Math.floor,Rg=Math.pow,Ag=Math.log,Yg=Math.sin,Zg=Math.sqrt,Hm=Math.atan2,Cg=Math.max,Gm=Math.abs,Bm=2*km,Fm=km/3,Dm=km/180,zm=180/km,Km=function(){return arguments[0]instanceof Om?arguments[0]:function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(Om,arguments,function(){})},Vm=[],Km.version="1.1.1",$m={},Um=[],jm=!1,Om=function(){function t(){var t,e,i,n,r,o,a,s,c;for(o=this,e=[],s=0,n=arguments.length;s3?e[3]:1]},iv=function(t){return Xg(255*(t<=.00304?12.92*t:1.055*Rg(t,1/2.4)-.055))},bg=function(t){return t>Nm.t1?t*t*t:Nm.t2*(t-Nm.t0)},Nm={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},Bg=function(){var t,e,i,n,r,o,a,s;return n=Jg(arguments),i=n[0],e=n[1],t=n[2],r=Gg(i,e,t),o=r[0],a=r[1],s=r[2],[116*a-16,500*(o-a),200*(a-s)]},Hg=function(t){return(t/=255)<=.04045?t/12.92:Rg((t+.055)/1.055,2.4)},ev=function(t){return t>Nm.t3?Rg(t,1/3):t/Nm.t2+Nm.t0},Gg=function(){var t,e,i,n,r,o,a;return n=Jg(arguments),i=n[0],e=n[1],t=n[2],i=Hg(i),e=Hg(e),t=Hg(t),r=ev((.4124564*i+.3575761*e+.1804375*t)/Nm.Xn),o=ev((.2126729*i+.7151522*e+.072175*t)/Nm.Yn),a=ev((.0193339*i+.119192*e+.9503041*t)/Nm.Zn),[r,o,a]},Km.lab=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(Om,nv.call(arguments).concat(["lab"]),function(){})},$m.lab=yg,Om.prototype.lab=function(){return Bg(this._rgb)},Wm=function(t){var e,i,n,r,o,a,s,c,h,u,l;return t=function(){var e,i,n;for(n=[],i=0,e=t.length;i=0&&e[3]<=1?"rgb":void 0}}),sg=function(t){var e,i,n,r,o,a;if(t.match(/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/))return 4!==t.length&&7!==t.length||(t=t.substr(1)),3===t.length&&(t=t.split(""),t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),a=parseInt(t,16),r=a>>16,n=a>>8&255,i=255&a,[r,n,i,1];if(t.match(/^#?([A-Fa-f0-9]{8})$/))return 9===t.length&&(t=t.substr(1)),a=parseInt(t,16),r=a>>24&255,n=a>>16&255,i=a>>8&255,e=Xg((255&a)/255*100)/100,[r,n,i,e];if(null!=$m.css&&(o=$m.css(t)))return o;throw"unknown color: "+t},Ng=function(t,e){var i,n,r,o,a,s,c;return null==e&&(e="rgb"),a=t[0],r=t[1],n=t[2],i=t[3],c=a<<16|r<<8|n,s="000000"+c.toString(16),s=s.substr(s.length-6),o="0"+Xg(255*i).toString(16),o=o.substr(o.length-2),"#"+function(){switch(e.toLowerCase()){case"rgba":return s+o;case"argb":return o+s;default:return s}}()},$m.hex=function(t){return sg(t)},Km.hex=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(Om,nv.call(arguments).concat(["hex"]),function(){})},Om.prototype.hex=function(t){return null==t&&(t="rgb"),Ng(this._rgb,t)},Um.push({p:10,test:function(t){if(1===arguments.length&&"string"===Qg(t))return"hex"}}),ug=function(){var t,e,i,n,r,o,a,s,c,h,u,l,d,f;if(t=Jg(arguments),r=t[0],u=t[1],a=t[2],0===u)c=n=e=255*a;else{for(f=[0,0,0],i=[0,0,0],d=a<.5?a*(1+u):a+u-a*u,l=2*a-d,r/=360,f[0]=r+1/3,f[1]=r,f[2]=r-1/3,o=s=0;s<=2;o=++s)f[o]<0&&(f[o]+=1),f[o]>1&&(f[o]-=1),6*f[o]<1?i[o]=l+6*(d-l)*f[o]:2*f[o]<1?i[o]=d:3*f[o]<2?i[o]=l+(d-l)*(2/3-f[o])*6:i[o]=l;h=[Xg(255*i[0]),Xg(255*i[1]),Xg(255*i[2])],c=h[0],n=h[1],e=h[2]}return t.length>3?[c,n,e,t[3]]:[c,n,e]},Fg=function(t,e,i){var n,r,o,a,s;return void 0!==t&&t.length>=3&&(a=t,t=a[0],e=a[1],i=a[2]),t/=255,e/=255,i/=255,o=Math.min(t,e,i),Cg=Math.max(t,e,i),r=(Cg+o)/2,Cg===o?(s=0,n=Number.NaN):s=r<.5?(Cg-o)/(Cg+o):(Cg-o)/(2-Cg-o),t===Cg?n=(e-i)/(Cg-o):e===Cg?n=2+(i-t)/(Cg-o):i===Cg&&(n=4+(t-e)/(Cg-o)),n*=60,n<0&&(n+=360),[n,s,r]},Km.hsl=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(Om,nv.call(arguments).concat(["hsl"]),function(){})},$m.hsl=ug,Om.prototype.hsl=function(){return Fg(this._rgb)},lg=function(){var t,e,i,n,r,o,a,s,c,h,u,l,d,f,p,m,g,v;if(t=Jg(arguments),r=t[0],m=t[1],v=t[2],v*=255,0===m)c=n=e=v;else switch(360===r&&(r=0),r>360&&(r-=360),r<0&&(r+=360),r/=60,o=ag(r),i=r-o,a=v*(1-m),s=v*(1-m*i),g=v*(1-m*(1-i)),o){case 0:h=[v,g,a],c=h[0],n=h[1],e=h[2];break;case 1:u=[s,v,a],c=u[0],n=u[1],e=u[2];break;case 2:l=[a,v,g],c=l[0],n=l[1],e=l[2];break;case 3:d=[a,s,v],c=d[0],n=d[1],e=d[2];break;case 4:f=[g,a,v],c=f[0],n=f[1],e=f[2];break;case 5:p=[v,a,s],c=p[0],n=p[1],e=p[2]}return c=Xg(c),n=Xg(n),e=Xg(e),[c,n,e,t.length>3?t[3]:1]},zg=function(){var t,e,i,n,r,o,a,s,c;return a=Jg(arguments),o=a[0],i=a[1],t=a[2],r=Math.min(o,i,t),Cg=Math.max(o,i,t),e=Cg-r,c=Cg/255,0===Cg?(n=Number.NaN,s=0):(s=e/Cg,o===Cg&&(n=(i-t)/e),i===Cg&&(n=2+(t-o)/e),t===Cg&&(n=4+(o-i)/e),n*=60,n<0&&(n+=360)),[n,s,c]},Km.hsv=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(Om,nv.call(arguments).concat(["hsv"]),function(){})},$m.hsv=lg,Om.prototype.hsv=function(){return zg(this._rgb)},Ig=function(t){var e,i,n;return"number"===Qg(t)&&t>=0&&t<=16777215?(n=t>>16,i=t>>8&255,e=255&t,[n,i,e,1]):(console.warn("unknown num color: "+t),[0,0,0,1])},$g=function(){var t,e,i,n;return n=Jg(arguments),i=n[0],e=n[1],t=n[2],(i<<16)+(e<<8)+t},Km.num=function(t){return new Om(t,"num")},Om.prototype.num=function(t){return null==t&&(t="rgb"),$g(this._rgb,t)},$m.num=Ig,Um.push({p:10,test:function(t){if(1===arguments.length&&"number"===Qg(t)&&t>=0&&t<=16777215)return"num"}}),ig=function(t){var e,i,n,r,o,a,s,c;if(t=t.toLowerCase(),null!=Km.colors&&Km.colors[t])return sg(Km.colors[t]);if(o=t.match(/rgb\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*\)/)){for(s=o.slice(1,4),r=a=0;a<=2;r=++a)s[r]=+s[r];s[3]=1}else if(o=t.match(/rgba\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*,\s*([01]|[01]?\.\d+)\)/))for(s=o.slice(1,5),r=c=0;c<=3;r=++c)s[r]=+s[r];else if(o=t.match(/rgb\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/)){for(s=o.slice(1,4),r=e=0;e<=2;r=++e)s[r]=Xg(2.55*s[r]);s[3]=1}else if(o=t.match(/rgba\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/)){for(s=o.slice(1,5),r=i=0;i<=2;r=++i)s[r]=Xg(2.55*s[r]);s[3]=+s[3]}else(o=t.match(/hsl\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/))?(n=o.slice(1,4),n[1]*=.01,n[2]*=.01,s=ug(n),s[3]=1):(o=t.match(/hsla\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/))&&(n=o.slice(1,4),n[1]*=.01,n[2]*=.01,s=ug(n),s[3]=+o[4]);return s},Dg=function(t){var e;return e=t[3]<1?"rgba":"rgb","rgb"===e?e+"("+t.slice(0,3).map(Xg).join(",")+")":"rgba"===e?e+"("+t.slice(0,3).map(Xg).join(",")+","+t[3]+")":void 0},Wg=function(t){return Xg(100*t)/100},hg=function(t,e){var i;return i=e<1?"hsla":"hsl",t[0]=Wg(t[0]||0),t[1]=Wg(100*t[1])+"%",t[2]=Wg(100*t[2])+"%","hsla"===i&&(t[3]=e),i+"("+t.join(",")+")"},$m.css=function(t){return ig(t)},Km.css=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(Om,nv.call(arguments).concat(["css"]),function(){})},Om.prototype.css=function(t){return null==t&&(t="rgb"),"rgb"===t.slice(0,3)?Dg(this._rgb):"hsl"===t.slice(0,3)?hg(this.hsl(),this.alpha()):void 0},$m.named=function(t){return sg(tv[t])},Um.push({p:20,test:function(t){if(1===arguments.length&&null!=tv[t])return"named"}}),Om.prototype.name=function(t){var e,i;arguments.length&&(tv[t]&&(this._rgb=sg(tv[t])),this._rgb[3]=1),e=this.hex();for(i in tv)if(e===tv[i])return i;return e},xg=function(){var t,e,i,n;return n=Jg(arguments),i=n[0],t=n[1],e=n[2],e*=Dm,[i,eg(e)*t,Yg(e)*t]},wg=function(){var t,e,i,n,r,o,a,s,c,h,u;return i=Jg(arguments),s=i[0],r=i[1],a=i[2],h=xg(s,r,a),t=h[0],e=h[1],n=h[2],u=yg(t,e,n),c=u[0],o=u[1],n=u[2],[Sg(c,0,255),Sg(o,0,255),Sg(n,0,255),i.length>3?i[3]:1]},vg=function(){var t,e,i,n,r,o;return o=Jg(arguments),r=o[0],t=o[1],e=o[2],i=Zg(t*t+e*e),n=(Hm(e,t)*zm+360)%360,0===Xg(1e4*i)&&(n=Number.NaN),[r,i,n]},Ug=function(){var t,e,i,n,r,o,a;return o=Jg(arguments),r=o[0],i=o[1],e=o[2],a=Bg(r,i,e),n=a[0],t=a[1],e=a[2],vg(n,t,e)},Km.lch=function(){var t;return t=Jg(arguments),new Om(t,"lch")},Km.hcl=function(){var t;return t=Jg(arguments),new Om(t,"hcl")},$m.lch=wg,$m.hcl=function(){var t,e,i,n;return n=Jg(arguments),e=n[0],t=n[1],i=n[2],wg([i,t,e])},Om.prototype.lch=function(){return Ug(this._rgb)},Om.prototype.hcl=function(){return Ug(this._rgb).reverse()},Og=function(t){var e,i,n,r,o,a,s,c,h;return null==t&&(t="rgb"),c=Jg(arguments),s=c[0],r=c[1],e=c[2],s/=255,r/=255,e/=255,o=1-Math.max(s,Math.max(r,e)),n=o<1?1/(1-o):0,i=(1-s-o)*n,a=(1-r-o)*n,h=(1-e-o)*n,[i,a,h,o]},Jm=function(){var t,e,i,n,r,o,a,s,c;return e=Jg(arguments),n=e[0],a=e[1],c=e[2],o=e[3],t=e.length>4?e[4]:1,1===o?[0,0,0,t]:(s=n>=1?0:Xg(255*(1-n)*(1-o)),r=a>=1?0:Xg(255*(1-a)*(1-o)),i=c>=1?0:Xg(255*(1-c)*(1-o)),[s,r,i,t])},$m.cmyk=function(){return Jm(Jg(arguments))},Km.cmyk=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(Om,nv.call(arguments).concat(["cmyk"]),function(){})},Om.prototype.cmyk=function(){return Og(this._rgb)},$m.gl=function(){var t,e,i,n,r;for(n=function(){var t,i;t=Jg(arguments),i=[];for(e in t)r=t[e],i.push(r);return i}.apply(this,arguments),t=i=0;i<=2;t=++i)n[t]*=255;return n},Km.gl=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(Om,nv.call(arguments).concat(["gl"]),function(){})},Om.prototype.gl=function(){var t;return t=this._rgb,[t[0]/255,t[1]/255,t[2]/255,t[3]]},jg=function(t,e,i){var n;return n=Jg(arguments),t=n[0],e=n[1],i=n[2],t=Mg(t),e=Mg(e),i=Mg(i),.2126*t+.7152*e+.0722*i},Mg=function(t){return t/=255,t<=.03928?t/12.92:Rg((t+.055)/1.055,2.4)},Vm=[],dg=function(t,e,i,n){var r,o,a,s;for(null==i&&(i=.5),null==n&&(n="rgb"),"object"!==Qg(t)&&(t=Km(t)),"object"!==Qg(e)&&(e=Km(e)),a=0,o=Vm.length;at?o(i,c):o(c,a)},i=jg(this._rgb),this._rgb=(i>t?o(Km("black"),this):o(this,Km("white"))).rgba()),this):jg(this._rgb)},Kg=function(t){var e,i,n,r;return r=t/100,r<66?(n=255,i=-155.25485562709179-.44596950469579133*(i=r-2)+104.49216199393888*Ag(i),e=r<20?0:-254.76935184120902+.8274096064007395*(e=r-10)+115.67994401066147*Ag(e)):(n=351.97690566805693+.114206453784165*(n=r-55)-40.25366309332127*Ag(n),i=325.4494125711974+.07943456536662342*(i=r-50)-28.0852963507957*Ag(i),e=255),Qm([n,i,e])},Vg=function(){var t,e,i,n,r,o,a,s,c;for(a=Jg(arguments),o=a[0],i=a[1],t=a[2],r=1e3,n=4e4,e=.4;n-r>e;)c=.5*(n+r),s=Kg(c),s[2]/s[0]>=t/o?n=c:r=c;return Xg(c)},Km.temperature=Km.kelvin=function(){ +return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(Om,nv.call(arguments).concat(["temperature"]),function(){})},$m.temperature=$m.kelvin=$m.K=Kg,Om.prototype.temperature=function(){return Vg(this._rgb)},Om.prototype.kelvin=Om.prototype.temperature,Km.contrast=function(t,e){var i,n,r,o;return"string"!==(r=Qg(t))&&"number"!==r||(t=new Om(t)),"string"!==(o=Qg(e))&&"number"!==o||(e=new Om(e)),i=t.luminance(),n=e.luminance(),i>n?(i+.05)/(n+.05):(n+.05)/(i+.05)},Om.prototype.get=function(t){var e,i,n,r,o,a;return n=this,o=t.split("."),r=o[0],e=o[1],a=n[r](),e?(i=r.indexOf(e),i>-1?a[i]:console.warn("unknown channel "+e+" in mode "+r)):a},Om.prototype.set=function(t,e){var i,n,r,o,a,s;if(r=this,a=t.split("."),o=a[0],i=a[1],i)if(s=r[o](),n=o.indexOf(i),n>-1)if("string"===Qg(e))switch(e.charAt(0)){case"+":s[n]+=+e;break;case"-":s[n]+=+e;break;case"*":s[n]*=+e.substr(1);break;case"/":s[n]/=+e.substr(1);break;default:s[n]=+e}else s[n]=e;else console.warn("unknown channel "+i+" in mode "+o);else s=e;return r._rgb=Km(s,o).alpha(r.alpha())._rgb,r},Om.prototype.darken=function(t){var e,i;return null==t&&(t=1),i=this,e=i.lab(),e[0]-=Nm.Kn*t,Km.lab(e).alpha(i.alpha())},Om.prototype.brighten=function(t){return null==t&&(t=1),this.darken(-t)},Om.prototype.darker=Om.prototype.darken,Om.prototype.brighter=Om.prototype.brighten,Om.prototype.saturate=function(t){var e,i;return null==t&&(t=1),i=this,e=i.lch(),e[1]+=t*Nm.Kn,e[1]<0&&(e[1]=0),Km.lch(e).alpha(i.alpha())},Om.prototype.desaturate=function(t){return null==t&&(t=1),this.saturate(-t)},Om.prototype.premultiply=function(){var t,e;return e=this.rgb(),t=this.alpha(),Km(e[0]*t,e[1]*t,e[2]*t,t)},Xm=function(t,e,i){if(!Xm[i])throw"unknown blend mode "+i;return Xm[i](t,e)},qm=function(t){return function(e,i){var n,r;return n=Km(i).rgb(),r=Km(e).rgb(),Km(t(n,r),"rgb")}},og=function(t){return function(e,i){var n,r,o;for(o=[],n=r=0;r<=3;n=++r)o[n]=t(e[n],i[n]);return o}},Eg=function(t,e){return t},Tg=function(t,e){return t*e/255},ng=function(t,e){return t>e?e:t},_g=function(t,e){return t>e?t:e},qg=function(t,e){return 255*(1-(1-t/255)*(1-e/255))},Lg=function(t,e){return e<128?2*t*e/255:255*(1-2*(1-t/255)*(1-e/255))},Zm=function(t,e){return 255*(1-(1-e/255)/(t/255))},rg=function(t,e){return 255===t?255:(t=255*(e/255)/(1-t/255),t>255?255:t)},Xm.normal=qm(og(Eg)),Xm.multiply=qm(og(Tg)),Xm.screen=qm(og(qg)),Xm.overlay=qm(og(Lg)),Xm.darken=qm(og(ng)),Xm.lighten=qm(og(_g)),Xm.dodge=qm(og(rg)),Xm.burn=qm(og(Zm)),Km.blend=Xm,Km.analyze=function(t){var e,i,n,r;for(n={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0},i=0,e=t.length;in.max&&(n.max=r),n.count+=1);return n.domain=[n.min,n.max],n.limits=function(t,e){return Km.limits(n,t,e)},n},Km.scale=function(t,e){var i,n,r,o,a,s,c,h,u,l,d,f,p,m,g,v,y,b,x,w,_;return u="rgb",l=Km("#ccc"),m=0,s=!1,a=[0,1],p=[],f=[0,0],i=!1,r=[],d=!1,h=0,c=1,o=!1,n={},w=function(t){var e,i,n,o,a,s,c;if(null==t&&(t=["#fff","#000"]),null!=t&&"string"===Qg(t)&&null!=(null!=(o=Km.brewer)?o[t]:void 0)&&(t=Km.brewer[t]),"array"===Qg(t)){for(t=t.slice(0),e=n=0,a=t.length-1;0<=a?n<=a:n>=a;e=0<=a?++n:--n)i=t[e],"string"===Qg(i)&&(t[e]=Km(i));for(p.length=0,e=c=0,s=t.length-1;0<=s?c<=s:c>=s;e=0<=s?++c:--c)p.push(e/(t.length-1))}return x(),r=t},y=function(t){var e,n;if(null!=i){for(n=i.length-1,e=0;e=i[e];)e++;return e-1}return 0},_=function(t){return t},g=function(t){var e,n,r,o,a;return a=t,i.length>2&&(o=i.length-1,e=y(t),r=i[0]+(i[1]-i[0])*(0+.5*m),n=i[o-1]+(i[o]-i[o-1])*(1-.5*m),a=h+(i[e]+.5*(i[e+1]-i[e])-r)/(n-r)*(c-h)),a},b=function(t,e){var o,a,s,d,m,g,v,b;if(null==e&&(e=!1),isNaN(t))return l;if(e?b=t:i&&i.length>2?(o=y(t),b=o/(i.length-2),b=f[0]+b*(1-f[0]-f[1])):c!==h?(b=(t-h)/(c-h),b=f[0]+b*(1-f[0]-f[1]),b=Math.min(1,Math.max(0,b))):b=1,e||(b=_(b)),d=Math.floor(1e4*b),n[d])a=n[d];else{if("array"===Qg(r))for(s=m=0,v=p.length-1;0<=v?m<=v:m>=v;s=0<=v?++m:--m){if(g=p[s],b<=g){a=r[s];break}if(b>=g&&s===p.length-1){a=r[s];break}if(b>g&&b=u;e=0<=u?++l:--l)p.push(e/(n-1));return a=[h,c],v},v.mode=function(t){return arguments.length?(u=t,x(),v):u},v.range=function(t,e){return w(t,e),v},v.out=function(t){return d=t,v},v.spread=function(t){return arguments.length?(m=t,v):m},v.correctLightness=function(t){return null==t&&(t=!0),o=t,x(),_=o?function(t){var e,i,n,r,o,a,s,c,h;for(e=b(0,!0).lab()[0],i=b(1,!0).lab()[0],s=e>i,n=b(t,!0).lab()[0],o=e+(i-e)*t,r=n-o,c=0,h=1,a=20;Math.abs(r)>.01&&a-- >0;)!function(){return s&&(r*=-1),r<0?(c=t,t+=.5*(h-t)):(h=t,t+=.5*(c-t)),n=b(t,!0).lab()[0],r=n-o}();return t}:function(t){return t},v},v.padding=function(t){return null!=t?("number"===Qg(t)&&(t=[t,t]),f=t,v):f},v.colors=function(){var e,n,r,o,s,c,h,u,l;if(o=0,s="hex",1===arguments.length&&("string"===Qg(arguments[0])?s=arguments[0]:o=arguments[0]),2===arguments.length&&(o=arguments[0],s=arguments[1]),o)return n=a[0],e=a[1]-n,function(){h=[];for(var t=0;0<=o?to;0<=o?t++:t--)h.push(t);return h}.apply(this).map(function(t){return v(n+t/(o-1)*e)[s]()});if(t=[],u=[],i&&i.length>2)for(r=l=1,c=i.length;1<=c?lc;r=1<=c?++l:--l)u.push(.5*(i[r-1]+i[r]));else u=a;return u.map(function(t){return v(t)[s]()})},v},null==Km.scales&&(Km.scales={}),Km.scales.cool=function(){return Km.scale([Km.hsl(180,1,.9),Km.hsl(250,.7,.4)])},Km.scales.hot=function(){return Km.scale(["#000","#f00","#ff0","#fff"],[0,.25,.75,1]).mode("rgb")},Km.analyze=function(t,e,i){var n,r,o,a,s,c,h;if(s={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0},null==i&&(i=function(){return!0}),n=function(t){null==t||isNaN(t)||(s.values.push(t),s.sum+=t,ts.max&&(s.max=t),s.count+=1)},h=function(t,r){if(i(t,r))return n(null!=e&&"function"===Qg(e)?e(t):null!=e&&"string"===Qg(e)||"number"===Qg(e)?t[e]:t)},"array"===Qg(t))for(a=0,o=t.length;a=F;_=1<=F?++O:--O)M.push(C+_/i*(Cg-C));M.push(Cg)}else if("l"===e.substr(0,1)){if(C<=0)throw"Logarithmic scales are only possible for values > 0";for(T=Math.LOG10E*Ag(C),P=Math.LOG10E*Ag(Cg),M.push(C),_=nt=1,z=i-1;1<=z?nt<=z:nt>=z;_=1<=z?++nt:--nt)M.push(Rg(10,T+_/i*(P-T)));M.push(Cg)}else if("q"===e.substr(0,1)){for(M.push(C),_=n=1,G=i-1;1<=G?n<=G:n>=G;_=1<=G?++n:--n)D=it.length*_/i,N=ag(D),N===D?M.push(it[N]):(k=D-N,M.push(it[N]*k+it[N+1]*(1-k)));M.push(Cg)}else if("k"===e.substr(0,1)){for(I=it.length,g=new Array(I),x=new Array(i),Q=!0,L=0,y=null,y=[],y.push(C),_=r=1,H=i-1;1<=H?r<=H:r>=H;_=1<=H?++r:--r)y.push(C+_/i*(Cg-C));for(y.push(Cg);Q;){for(S=o=0,W=i-1;0<=W?o<=W:o>=W;S=0<=W?++o:--o)x[S]=0;for(_=a=0,X=I-1;0<=X?a<=X:a>=X;_=0<=X?++a:--a){for(et=it[_],E=Number.MAX_VALUE,S=s=0,q=i-1;0<=q?s<=q:s>=q;S=0<=q?++s:--s)w=Gm(y[S]-et),w=Y;S=0<=Y?++c:--c)R[S]=null;for(_=h=0,Z=I-1;0<=Z?h<=Z:h>=Z;_=0<=Z?++h:--h)b=g[_],null===R[b]?R[b]=it[_]:R[b]+=it[_];for(S=u=0,K=i-1;0<=K?u<=K:u>=K;S=0<=K?++u:--u)R[S]*=1/x[S];for(Q=!1,S=l=0,B=i-1;0<=B?l<=B:l>=B;S=0<=B?++l:--l)if(R[S]!==y[_]){Q=!0;break}y=R,L++,L>200&&(Q=!1)}for(A={},S=d=0,U=i-1;0<=U?d<=U:d>=U;S=0<=U?++d:--d)A[S]=[];for(_=f=0,j=I-1;0<=j?f<=j:f>=j;_=0<=j?++f:--f)b=g[_],A[b].push(it[_]);for(tt=[],S=p=0,$=i-1;0<=$?p<=$:p>=$;S=0<=$?++p:--p)tt.push(A[S][0]),tt.push(A[S][A[S].length-1]);for(tt=tt.sort(function(t,e){return t-e}),M.push(tt[0]),_=m=1,V=tt.length-1;m<=V;_=m+=2)isNaN(tt[_])||M.push(tt[_])}return M},cg=function(t,e,i){var n,r,o,a;return n=Jg(arguments),t=n[0],e=n[1],i=n[2],t/=360,t<1/3?(r=(1-e)/3,a=(1+e*eg(Bm*t)/eg(Fm-Bm*t))/3,o=1-(r+a)):t<2/3?(t-=1/3,a=(1-e)/3,o=(1+e*eg(Bm*t)/eg(Fm-Bm*t))/3,r=1-(a+o)):(t-=2/3,o=(1-e)/3,r=(1+e*eg(Bm*t)/eg(Fm-Bm*t))/3,a=1-(o+r)),a=Sg(i*a*3),o=Sg(i*o*3),r=Sg(i*r*3),[255*a,255*o,255*r,n.length>3?n[3]:1]},kg=function(){var t,e,i,n,r,o,a,s;return a=Jg(arguments),o=a[0],e=a[1],t=a[2],Bm=2*Math.PI,o/=255,e/=255,t/=255,r=Math.min(o,e,t),n=(o+e+t)/3,s=1-r/n,0===s?i=0:(i=(o-e+(o-t))/2,i/=Math.sqrt((o-e)*(o-e)+(o-t)*(e-t)),i=Math.acos(i),t>e&&(i=Bm-i),i/=Bm),[360*i,s,n]},Km.hsi=function(){return function(t,e,i){i.prototype=t.prototype;var n=new i,r=t.apply(n,e);return Object(r)===r?r:n}(Om,nv.call(arguments).concat(["hsi"]),function(){})},$m.hsi=cg,Om.prototype.hsi=function(){return kg(this._rgb)},fg=function(t,e,i,n){var r,o,a,s,c,h,u,l,d,f,p,m,g;return"hsl"===n?(m=t.hsl(),g=e.hsl()):"hsv"===n?(m=t.hsv(),g=e.hsv()):"hsi"===n?(m=t.hsi(),g=e.hsi()):"lch"!==n&&"hcl"!==n||(n="hcl",m=t.hcl(),g=e.hcl()),"h"===n.substr(0,1)&&(a=m[0],f=m[1],h=m[2],s=g[0],p=g[1],u=g[2]),isNaN(a)||isNaN(s)?isNaN(a)?isNaN(s)?o=Number.NaN:(o=s,1!==h&&0!==h||"hsv"===n||(d=p)):(o=a,1!==u&&0!==u||"hsv"===n||(d=f)):(r=s>a&&s-a>180?s-(a+360):s180?s+360-a:s-a,o=a+i*r),null==d&&(d=f+i*(p-f)),c=h+i*(u-h),l=Km[n](o,d,c)},Vm=Vm.concat(function(){var t,e,i,n;for(i=["hsv","hsl","hsi","hcl","lch"],n=[],e=0,t=i.length;e>16&255)/255,e[i+1]=(t>>8&255)/255,e[i+2]=(255&t)/255,e},atomColor:function(){return 16777215},atomColorToArray:function(t,e,i){return this.colorToArray(this.atomColor(t),e,i)},bondColor:function(t,e){return this.atomProxy.index=e?t.atomIndex1:t.atomIndex2,this.atomColor(this.atomProxy)},bondColorToArray:function(t,e,i,n){return this.colorToArray(this.bondColor(t,e),i,n)},volumeColor:function(){return 16777215},volumeColorToArray:function(t,e,i){return this.colorToArray(this.volumeColor(t),e,i)},positionColor:function(){return 16777215},positionColorToArray:function(t,e,i){return this.colorToArray(this.positionColor(t),e,i)}},zn.prototype=Fn.prototype,zn.prototype.constructor=zn,Bn.prototype=Fn.prototype,Bn.prototype.constructor=Bn,Un.prototype=Fn.prototype,Un.prototype.constructor=Un,jn.prototype=Fn.prototype,jn.prototype.constructor=jn,$n.prototype=Fn.prototype,$n.prototype.constructor=$n,Vn.prototype=Fn.prototype,Vn.prototype.constructor=Vn,Gn.prototype=Fn.prototype,Gn.prototype.constructor=Gn,Hn.prototype=Fn.prototype,Hn.prototype.constructor=Hn,Wn.prototype=Fn.prototype,Wn.prototype.constructor=Wn,Xn.prototype=Fn.prototype,Xn.prototype.constructor=Xn,qn.prototype=Fn.prototype,qn.prototype.constructor=qn,Yn.prototype=Fn.prototype,Yn.prototype.constructor=Yn,Zn.prototype=Fn.prototype,Zn.prototype.constructor=Zn,Kn.prototype=Fn.prototype,Kn.prototype.constructor=Kn,Qn.prototype=Fn.prototype,Qn.prototype.constructor=Qn,Jn.prototype=Fn.prototype,Jn.prototype.constructor=Jn,tr.prototype=Fn.prototype,tr.prototype.constructor=tr,er.prototype=Fn.prototype,er.prototype.constructor=er,ir.prototype=Fn.prototype,ir.prototype.constructor=ir,nr.prototype=Fn.prototype,nr.prototype.constructor=nr,kn.types={"":Fn,picking:Un,random:jn,uniform:$n,atomindex:Vn,residueindex:Gn,chainindex:Hn,chainname:Wn,chainid:Xn,polymer:qn,modelindex:Yn,entitytype:Zn,moleculetype:Kn,sstruc:Qn,element:Jn,resname:tr,bfactor:er,hydrophobicity:nr,value:Bn,volume:zn,occupancy:ir};var lv=p(),dv="undefined"!=typeof window&&"undefined"!=typeof window.orientation,fv=!1,pv=!1,mv={log:Function.prototype.bind.call(console.log,console),info:Function.prototype.bind.call(console.info,console),warn:Function.prototype.bind.call(console.warn,console),error:Function.prototype.bind.call(console.error,console),time:Function.prototype.bind.call(console.time,console),timeEnd:Function.prototype.bind.call(console.timeEnd,console)};t.Debug=l(u("debug"));var gv='

Your browser/graphics card does not seem to support WebGL.

Find out how to get it here.

',vv=new T,yv=new kn,bv=new S("datasource"),xv=new S("representatation"),wv=new S("parser"),_v=new S("shader"),Sv=new S("decompressor");sr.prototype={constructor:sr,type:"",__srcName:void 0,isBinary:function(){return this.binary||this.compressed},onload:function(){},onprogress:function(){},onerror:function(){},read:function(t){this._read(function(e){var i=Sv.get(this.compressed);this.compressed&&i?this.data=i(e):((this.binary||this.compressed)&&e instanceof ArrayBuffer&&(e=new Uint8Array(e)),this.data=e),"function"==typeof this.onload&&this.onload(this.data),t()}.bind(this))},_read:function(t){t(this.src)},_chunk:function(t,e){return e=Math.min(this.data.length,e),0===t&&this.data.length===e?this.data:this.isBinary()?this.data.subarray(t,e):this.data.substring(t,e)},chunk:function(t){var e=t+this.chunkSize;return this._chunk(t,e)},peekLines:function(t){var e,i=this.data,n=i.length,r=this.isBinary()?this.newline.charCodeAt(0):this.newline,o=0;for(e=0;en);return s.lines},lineCount:function(){console.warn("lineCount - deprecated");for(var t=this.data,e=t.length,i=this.isBinary()?this.newline.charCodeAt(0):this.newline,n=0,r=0;rthis.data.length))return this.__pointer+=this.chunkSize,this.chunk(t)},nextChunkOfLines:function(){var t=this.nextChunk();if(void 0!==t){var e=this.__pointer>this.data.length,i=this.chunkToLines(t,this.__partialLine,e);return this.__partialLine=i.partialLine,i.lines}},eachChunk:function(t){for(var e=this.chunkSize,i=this.data.length,n=this.chunkCount(),r=0;r=0),o[8]){case"b":i=parseInt(i,10).toString(2);break;case"c":i=String.fromCharCode(parseInt(i,10));break;case"d":case"i":i=parseInt(i,10);break;case"j":i=JSON.stringify(i,null,o[6]?parseInt(o[6]):0);break;case"e":i=o[7]?parseFloat(i).toExponential(o[7]):parseFloat(i).toExponential();break;case"f":i=o[7]?parseFloat(i).toFixed(o[7]):parseFloat(i);break;case"g":i=o[7]?parseFloat(i).toPrecision(o[7]):parseFloat(i);break;case"o":i=i.toString(8);break;case"s":i=String(i),i=o[7]?i.substring(0,o[7]):i;break;case"t":i=String(!!i),i=o[7]?i.substring(0,o[7]):i;break;case"T":i=yr(i),i=o[7]?i.substring(0,o[7]):i;break;case"u":i=parseInt(i,10)>>>0;break;case"v":i=i.valueOf(),i=o[7]?i.substring(0,o[7]):i;break;case"x":i=parseInt(i,10).toString(16);break;case"X":i=parseInt(i,10).toString(16).toUpperCase()}Av.json.test(o[8])?d[d.length]=i:(!Av.number.test(o[8])||f&&!o[3]?p="":(p=f?"+":"-",i=i.toString().replace(Av.sign,"")),s=o[4]?"0"===o[4]?"0":o[4].charAt(1):" ",c=o[6]-(p+i).length,a=o[6]&&c>0?br(s,c):"",d[d.length]=o[5]?p+i+a:"0"===s?p+a+i:a+p+i)}return d.join("")},vr.cache={},vr.parse=function(t){for(var e=t,i=[],n=[],r=0;e;){if(null!==(i=Av.text.exec(e)))n[n.length]=i[0];else if(null!==(i=Av.modulo.exec(e)))n[n.length]="%";else{if(null===(i=Av.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(i[2]){r|=1;var o=[],a=i[2],s=[];if(null===(s=Av.key.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o[o.length]=s[1];""!==(a=a.substring(s[0].length));)if(null!==(s=Av.key_access.exec(a)))o[o.length]=s[1];else{if(null===(s=Av.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");o[o.length]=s[1]}i[2]=o}else r|=2;if(3===r)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=i}e=e.substring(i[0].length)}return n};var Mv={0:["","0","00","000","0000","00000","000000","0000000"]," ":[""," "," "," "," "," "," "," "],_:["","_","__","___","____","_____","______","_______"]};wr.prototype={clear:function(){this.change(-this.count)},change:function(t){this.count+=t,this.signals.countChanged.dispatch(t,this.count),this.count<0&&mv.warn("Counter.count below zero",this.count)},increment:function(){this.change(1)},decrement:function(){this.change(-1)},listen:function(t){this.change(t.count),t.signals.countChanged.add(this.change,this)},unlisten:function(t){var e=t.signals.countChanged;e.has(this.change,this)&&e.remove(this.change,this)},onZeroOnce:function(t,e){if(0===this.count)t.call(e,0,0);else{var i=function(){0===this.count&&(this.signals.countChanged.remove(i,this),t.apply(e,arguments))};this.signals.countChanged.add(i,this)}},dispose:function(){this.clear(),this.signals.countChanged.dispose()}},_r.prototype={constructor:_r,getBaseObject:function(t){return"StructureView"===t.type&&(t=t.getStructure()),t},addObject:function(t){t=this.getBaseObject(t);var e=this.allocateGidRange(t);return e&&(this.objectList.push(t),this.rangeList.push(e)),this},removeObject:function(t){t=this.getBaseObject(t);var e=this.objectList.indexOf(t);return e!==-1&&(this.objectList.splice(e,1),this.rangeList.splice(e,1),0===this.objectList.length&&(this.nextGid=1)),this},updateObject:function(t,e){t=this.getBaseObject(t);var i=this.objectList.indexOf(t);if(i!==-1){var n=this.rangeList[i];if(n[1]===this.nextGid){var r=this.getGidCount(t);this.nextGid+=r-(n[1]-n[0]),n[1]=this.nextGid}else this.rangeList[i]=this.allocateGidRange(t)}else e||mv.warn("GidPool.updateObject: object not found.");return this},getGidCount:function(t){t=this.getBaseObject(t);var e=0;return"Structure"===t.type?e=t.atomStore.count+t.bondStore.count+t.backboneBondStore.count+t.rungBondStore.count:"Volume"===t.type?e=t.__data.length:mv.warn("GidPool.getGidCount: unknown object type"),e},allocateGidRange:function(t){t=this.getBaseObject(t);var e=this.getGidCount(t);if(e>Math.pow(10,7))return mv.warn("GidPool.allocateGidRange: gidCount too large"),null;var i=this.nextGid;return this.nextGid+=e,this.nextGid>Math.pow(2,24)&&mv.error("GidPool.allocateGidRange: GidPool overflown"),[i,this.nextGid]},getNextGid:function(){return this.nextGid++},getGid:function(t,e){t=this.getBaseObject(t),e=e||0;var i=0,n=this.objectList.indexOf(t);if(n!==-1){var r=this.rangeList[n],o=r[0];i=o+e}else mv.warn("GidPool.getGid: object not found.");return i},getByGid:function(t){var e;return this.objectList.forEach(function(i,n){var r=this.rangeList[n];if(!(t=r[1])){var o=t-r[0];"Structure"===i.type?othis.prevFpsTime+1e3&&(this.lastFps=this.frames,this.prevFpsTime=t,this.frames=0),t}},Ar.prototype=Object.create(E.prototype),Ar.prototype.constructor=Ar,_v.add("shader/chunk/dull_interior_fragment.glsl","#ifdef DULL_INTERIOR\nif( gl_FrontFacing == false ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#endif"),_v.add("shader/chunk/fog_fragment.glsl","#ifdef USE_FOG\nfloat depth = length( vViewPosition );\n#ifdef FOG_EXP2\nfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif"),_v.add("shader/chunk/nearclip_vertex.glsl","#ifdef NEAR_CLIP\nif( vViewPosition.z < nearClip - 5.0 )\ngl_Position.z = 2.0 * gl_Position.w;\n#endif"),_v.add("shader/chunk/nearclip_fragment.glsl","#ifdef NEAR_CLIP\nif( vViewPosition.z < nearClip )\ndiscard;\n#endif"),_v.add("shader/chunk/radiusclip_vertex.glsl","#ifdef RADIUS_CLIP\nif( distance( vViewPosition, vClipCenter ) > clipRadius + 5.0 )\ngl_Position.z = 2.0 * gl_Position.w;\n#endif"),_v.add("shader/chunk/radiusclip_fragment.glsl","#ifdef RADIUS_CLIP\nif( distance( vViewPosition, vClipCenter ) > clipRadius )\ndiscard;\n#endif"),_v.add("shader/chunk/opaque_back_fragment.glsl","#ifdef OPAQUE_BACK\n#ifdef FLIP_SIDED\nif( gl_FrontFacing == true ){\ngl_FragColor.a = 1.0;\n}\n#else\nif( gl_FrontFacing == false ){\ngl_FragColor.a = 1.0;\n}\n#endif\n#endif");var Pv=/^(?!\/\/)\s*#include\s+(\S+)/gim,Cv={};Cr.prototype.constructor=Cr; +var Tv=2*Math.PI,Ev=(new Float32Array(4),new Float32Array(4),new N),Iv=new O,Lv=new O,Rv=new O,Ov=new O;WebGLRenderingContext&&(WebGLRenderingContext.prototype.getShaderParameter=function(){var e=WebGLRenderingContext.prototype.getShaderParameter;return function(){return!t.Debug||e.apply(this,arguments)}}(),WebGLRenderingContext.prototype.getShaderInfoLog=function(){var e=WebGLRenderingContext.prototype.getShaderInfoLog;return function(){return t.Debug?e.apply(this,arguments):""}}(),WebGLRenderingContext.prototype.getProgramParameter=function(){var e=WebGLRenderingContext.prototype.getProgramParameter;return function(i,n){return!t.Debug&&n===WebGLRenderingContext.prototype.LINK_STATUS||e.apply(this,arguments)}}(),WebGLRenderingContext.prototype.getProgramInfoLog=function(){var e=WebGLRenderingContext.prototype.getProgramInfoLog;return function(){return t.Debug?e.apply(this,arguments):""}}());var Dv=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]];Dv.forEach(function(t){t.forEach(function(t){t[0]*=.0625,t[1]*=.0625})}),Ur.prototype.constructor=Ur;var Nv=2,kv=3,Fv=function(e,i){function n(t){var e=Object.assign({},t);c=d(e.hoverTimeout,c)}function r(t,e){var i,n,r,o=a.pick(t.canvasPosition.x,t.canvasPosition.y),c=o.instance,h=s.getByGid(o.gid);return h&&"AtomProxy"===h.type?i=h:h&&"BondProxy"===h.type?n=h:h&&"Volume"===h.volume.type&&(r=h),(i||n||r)&&t.which===Nv&&e&&(i?u.copy(i):n?u.copy(n.atom1).add(n.atom2).multiplyScalar(.5):r&&u.copy(r),c&&u.applyProjection(c.matrix),a.centerView(!1,u)),{atom:i,bond:n,volume:r,instance:c}}function o(){if(performance.now()-l.lastMoved>c&&(l.moving=!1),!l.moving&&!l.hovering){l.hovering=!0;var t=r(l);h.hovered.dispatch(t)}requestAnimationFrame(o)}var a=e.viewer,s=e.gidPool,c=50;n(i);var h={clicked:new Rn,hovered:new Rn},u=new N,l={position:new I,down:new I,canvasPosition:new I,moving:!1,hovering:!0,lastMoved:1/0,which:void 0,distance:function(){return l.position.distanceTo(l.down)},setCanvasPosition:function(t){var e=a.renderer.domElement.getBoundingClientRect(),i=t.clientX-e.left,n=t.clientY-e.top;l.canvasPosition.set(i,e.height-n)}};o(),a.renderer.domElement.addEventListener("mousemove",function(t){t.preventDefault(),l.moving=!0,l.hovering=!1,l.lastMoved=performance.now(),l.position.set(t.layerX,t.layerY),l.setCanvasPosition(t)}),a.renderer.domElement.addEventListener("mousedown",function(t){t.preventDefault(),l.moving=!1,l.hovering=!1,l.down.set(t.layerX,t.layerY),l.which=t.which,l.setCanvasPosition(t)}),a.renderer.domElement.addEventListener("mouseup",function(e){if(e.preventDefault(),!(l.distance()>3||e.which===kv)){var i=r(l,!0);l.which=void 0,h.clicked.dispatch(i),t.Debug&&mv.log("clicked",i)}}),this.signals=h,this.setParameters=n};jr.prototype.add=function(t){this.count<<5<=t&&this.resize(t),this.words[t>>>5]|=1<>>5]|=1<>>5]^=1<>>5]^=1<>>5)+1,r=(e>>>5)-1,o=0|n;o+7>>5]|=1<>>5]|=1<>>5]&=~(1<>>5]&=~(1<>>5]&=~(1<>>5]&=~(1<>>5]&1<0;)0===this.words[this.count-1]&&this.count--;this.words=this.words.slice(0,this.count)},jr.prototype.resize=function(t){if(this.length=t,!(this.count<<5>t)&&(this.count=t+32>>>5,this.words.length<<5<=t)){var e=new Uint32Array(this.count<<1);e.set(this.words),this.words=e}},jr.prototype.hammingWeight=function(t){return t-=t>>>1&1431655765,t=(858993459&t)+(t>>>2&858993459),16843009*(t+(t>>>4)&252645135)>>>24},jr.prototype.size=function(){for(var t=0,e=this.count,i=0;i=t&&eo?a.set(this[n].subarray(0,o)):a.set(this[n]),this[n]=a}},growIfFull:function(){if(this.count>=this.length){var t=Math.round(1.5*this.length);this.resize(Math.max(256,t))}},copyFrom:function(t,e,i,n){for(var r=0,o=this.__fields.length;r0;)s-=1;a<=s&&(a===o?o=s:s===o&&(o=a),e(a,s),a+=1,s-=1)}while(a<=s);i(n,s),i(a,r)}}mv.time("Store.sort");var n=this,r=new this.constructor(1);i(0,this.count-1),mv.timeEnd("Store.sort")},clear:function(){this.count=0},dispose:function(){delete this.length,delete this.count;for(var t=0,e=this.__fields.length;t0&&(l[i]=A.angleTo(M)),t=Math.cos(b.angleTo(x)),p[i]=180/Math.PI*Math.acos(t),n=b.length(),r=x.length(),d[i]=Math.sqrt(r*n)/Math.max(2,2*(1-t)),f[i]=Math.abs(v.dot(A)),w.copy(b).multiplyScalar(d[i]/n),_.copy(x).multiplyScalar(d[i]/r),w.subVectors(I,w),_.subVectors(L,_),w.toArray(h,e+3),_.toArray(h,e+6),P.subVectors(E,C),P.toArray(m,e),M.copy(A),C.copy(w);for(w.fromArray(h,3),_.fromArray(h,6),A.subVectors(w,_).normalize(),E.index=o.getAtomIndexByType(0,T),C.copy(E),S.copy(E),Gr(S,A,w),S.toArray(h,0),P.subVectors(C,w),P.toArray(m,0),w.fromArray(h,3*s-6),_.fromArray(h,3*s-9),A.subVectors(w,_).normalize(),E.index=o.getAtomIndexByType(s-1,T),C.copy(E),S.copy(E),Gr(S,A,w),S.toArray(h,3*s-3),i=s-3;ie?z=!0:u.bending[B]>t&&(z=!0)),z){if(B-v<4){v=B,z=!1;continue}D.index=R.traceAtomIndex,T=u.axis.subarray(3*v+3,3*B),E=u.center.subarray(3*v,3*B+3),d=Vr(T).normalize(),f=Vr(E),I.fromArray(E),Gr(I,d,f),L.fromArray(E,E.length-3),Gr(L,d,f),d.subVectors(L,I),d.toArray(b,y),f.toArray(x,y),I.toArray(w,y),L.toArray(_,y),p.atomColorToArray(D,S,y),m.atomColorToArray(D,A,y),M.push(g.atomRadius(D)),P.push(h+v),C.push(h+B+1-v),y+=3,v=B,z=!1}return{axis:new Float32Array(b),center:new Float32Array(x),begin:new Float32Array(w),end:new Float32Array(_),color:new Float32Array(S),pickingColor:new Float32Array(A),size:new Float32Array(M),residueOffset:P,residueCount:C}}},jo.prototype={push:function(t){this.content.push(t),this.bubbleUp(this.content.length-1)},pop:function(){var t=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.sinkDown(0)),t},peek:function(){return this.content[0]},remove:function(t){for(var e=this.content.length,i=0;i0;){var i=Math.floor((t+1)/2)-1,n=this.content[i];if(!(this.scoreFunction(e)":"3/4-Z","?":"X-Y","@":"Y-X",A:"Z+1/3",B:"Z+2/3",C:"X+2/3",D:"Y+1/3",E:"-Y+2/3",F:"X-Y+1/3",G:"Y-X+2/3",H:"-X+1/3",I:"X+1/3",J:"Y+2/3",K:"-Y+1/3",L:"X-Y+2/3",M:"Y-X+1/3",N:"-X+2/3",O:"2/3+X",P:"1/3+Y",Q:"1/3+Z",R:"2/3-Y",S:"1/3+X-Y",T:"2/3+Y-X",U:"1/3-X",V:"2/3-X",W:"1/3-Y",X:"1/3-Z",Y:"2/3+Y",Z:"1/3+Y-X","[":"2/3+X-Y","]":"1/3+X","^":"2/3+Z",_:"2/3-Z","`":"5/6+Z",a:"1/6+Z",b:"5/6-Z",c:"1/6-Z",d:"Z+5/6",e:"Z+1/6",f:"Z+1/4",g:"+Y"},$v={"P 1":" !#","P -1":" !#$%&","P 1 2 1":" !#$!&","P 1 21 1":" !#$'&","C 1 2 1":" !#$!&()#*)&","P 1 m 1":" !# %#","P 1 c 1":" !# %+","C 1 m 1":" !# %#()#(,#","C 1 c 1":" !# %+()#(,+","P 1 2/m 1":" !# %#$!&$%&","P 1 21/m 1":" !#$)&$%& ,#","C 1 2/m 1":" !# %#$!&$%&()#(,#*)&*,&","P 1 2/c 1":" !#$!-$%& %+","P 1 21/c 1":" !#$%&$)- ,+","C 1 2/c 1":" !#$!-$%& %+()#*)-*,&(,+","P 2 2 2":" !#$%#$!& %&","P 2 2 21":" !#$%+$!- %&","P 21 21 2":" !#$%#*)&(,&","P 21 21 21":" !#*%+$)-(,&","C 2 2 21":" !#$%+$!- %&()#*,+*)-(,&","C 2 2 2":" !#$%#$!& %&()#*,#*)&(,&","F 2 2 2":" !#$%#$!& %& )+$,+$)- ,-(!+*%+*!-(%-()#*,#*)&(,&","I 2 2 2":" !#$%# %&$!&.'/01/.120'2","I 21 21 21":" !#*%+$)-(,&()+$,#*!& %-","P m m 2":" !#$%# %#$!#","P m c 21":" !#$%+ %+$!#","P c c 2":" !#$%# %+$!+","P m a 2":" !#$%#(%#*!#","P c a 21":" !#$%+(%#*!+","P n c 2":" !#$%# ,+$)+","P m n 21":" !#*%+(%+$!#","P b a 2":" !#$%#(,#*)#","P n a 21":" !#$%+(,#*)+","P n n 2":" !#$%#(,+*)+","C m m 2":" !#$%# %#$!#()#*,#(,#*)#","C m c 21":" !#$%+ %+$!#()#*,+(,+*)#","C c c 2":" !#$%# %+$!+()#*,#(,+*)+","A m m 2":" !#$%# %#$!# )+$,+ ,+$)+","A b m 2":" !#$%# ,#$)# )+$,+ %+$!+","A m a 2":" !#$%#(%#*!# )+$,+(,+*)+","A b a 2":" !#$%#(,#*)# )+$,+(%+*!+","F m m 2":" !#$%# %#$!# )+$,+ ,+$)+(!+*%+(%+*!+()#*,#(,#*)#","F d d 2":" !#$%#345675 )+$,+3896:9(!+*%+;49<79()#*,#;85<:5","I m m 2":" !#$%# %#$!#()+*,+(,+*)+","I b a 2":" !#$%#(,#*)#()+*,+ %+$!+","I m a 2":" !#$%#(%#*!#()+*,+ ,+$)+","P 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!#","P 2/n 2/n 2/n":" !#$%#$!& %&*,-()-(,+*)+","P 2/c 2/c 2/m":" !#$%#$!- %-$%& !& %+$!+","P 2/b 2/a 2/n":" !#$%#$!& %&*,&()&(,#*)#","P 21/m 2/m 2/a":" !#*%#$!&(%&$%&(!& %#*!#","P 2/n 21/n 2/a":" !#*%#*)- ,-$%&(!&(,+$)+","P 2/m 2/n 21/a":" !#*%+*!- %&$%&(!-(%+$!#","P 21/c 2/c 2/a":" !#*%#$!-(%-$%&(!& %+*!+","P 21/b 21/a 2/m":" !#$%#*)&(,&$%& !&(,#*)#","P 21/c 21/c 2/n":" !#*,#$)-(%-$%&()& ,+*!+","P 2/b 21/c 21/m":" !#$%+$)- ,&$%& !- ,+$)#","P 21/n 21/n 2/m":" !#$%#*)-(,-$%& !&(,+*)+","P 21/m 21/m 2/n":" !#$%#*'&.,&*,&.'& %#$!#","P 21/b 2/c 21/n":" !#*,+$!-(,&$%&()- %+*)#","P 21/b 21/c 21/a":" !#*%+$)-(,&$%&(!- ,+*)#","P 21/n 21/m 21/a":" !#0%/$'&.12$%&.!2 1#0'/","C 2/m 2/c 21/m":" !#$%+$!- %&$%& !- %+$!#()#*,+*)-(,&*,&()-(,+*)#","C 2/m 2/c 21/a":" !#$,+$)- %&$%& )- ,+$!#()#*%+*!-(,&*,&(!-(%+*)#","C 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!#()#*,#*)&(,&*,&()&(,#*)#","C 2/c 2/c 2/m":" !#$%#$!- %-$%& !& %+$!+()#*,#*)-(,-*,&()&(,+*)+","C 2/m 2/m 2/a":" !#$,#$)& %&$%& )& ,#$!#()#*%#*!&(,&*,&(!&(%#*)#","C 2/c 2/c 2/a":" !#*,#$!&(,&$,-(!- ,+*!+()#$%#*)& %&*%- )-(%+$)+","F 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!# )+$,+$)- ,-$,- )- ,+$)+(!+*%+*!-(%-*%-(!-(%+*!+()#*,#*)&(,&*,&()&(,#*)#","F 2/d 2/d 2/d":" !#$%#$!& %&64=37=345675 )+$,+$)- ,-68>3:>3896:9(!+*%+*!-(%-<4>;7>;49<79()#*,#*)&(,&<8=;:=;85<:5","I 2/m 2/m 2/m":" !#$%#$!& %&$%& !& %#$!#()+*,+*)-(,-*,-()-(,+*)+","I 2/b 2/a 2/m":" !#$%#*)&(,&$%& !&(,#*)#()+*,+$!- %-*,-()- %+$!+","I 21/b 21/c 21/a":" !#*%+$)-(,&$%&(!- ,+*)#()+$,#*!& %-*,- )&(%#$!+","I 21/m 21/m 21/a":" !#$,#$)& %&$%& )& ,#$!#()+*%+*!-(,-*,-(!-(%+*)+","P 4":" !#$%#% #!$#","P 41":" !#$%+% 5!$9","P 42":" !#$%#% +!$+","P 43":" !#$%+% 9!$5","I 4":" !#$%#% #!$#()+*,+,(+)*+","I 41":" !#*,+%(5)$9()+$%#, 9!*5","P -4":" !#$%#!$&% &","I -4":" !#$%#!$&% &()+*,+)*-,(-","P 4/m":" !#$%#% #!$#$%& !&!$&% &","P 42/m":" !#$%#% +!$+$%& !&!$-% -","P 4/n":" !#$%#,(#)*#*,&()&!$&% &","P 42/n":" !#$%#,(+)*+*,-()-!$&% &","I 4/m":" !#$%#% #!$#$%& !&!$&% &()+*,+,(+)*+*,-()-)*-,(-","I 41/a":" !#*,+%(5)$9$,=(!>!$&,(-()+$%#, 9!*5*%> )=)*-% &","P 4 2 2":" !#$%#% #!$#$!& %&! &%$&","P 4 21 2":" !#$%#,(#)*#*)&(,&! &%$&","P 41 2 2":" !#$%+% 5!$9$!& %-! >%$=","P 41 21 2":" !#$%+,(5)*9*)=(,>! &%$-","P 42 2 2":" !#$%#% +!$+$!& %&! -%$-","P 42 21 2":" !#$%#,(+)*+*)-(,-! &%$&","P 43 2 2":" !#$%+% 9!$5$!& %-! =%$>","P 43 21 2":" !#$%+,(9)*5*)>(,=! &%$-","I 4 2 2":" !#$%#% #!$#$!& %&! &%$&()+*,+,(+)*+*)-(,-)(-,*-","I 41 2 2":" !#*,+%(5)$9*!> ,=)(-%$&()+$%#, 9!*5$)=(%>! &,*-","P 4 m m":" !#$%#% #!$# %#$!#%$#! #","P 4 b m":" !#$%#% #!$#(,#*)#,*#)(#","P 42 c m":" !#$%#% +!$+ %+$!+%$#! #","P 42 n m":" !#$%#,(+)*+(,+*)+%$#! #","P 4 c c":" !#$%#% #!$# %+$!+%$+! +","P 4 n c":" !#$%#% #!$#(,+*)+,*+)(+","P 42 m c":" !#$%#% +!$+ %#$!#%$+! +","P 42 b c":" !#$%#% +!$+(,#*)#,*+)(+","I 4 m m":" !#$%#% #!$# %#$!#%$#! #()+*,+,(+)*+(,+*)+,*+)(+","I 4 c m":" !#$%#% #!$# %+$!+%$+! +()+*,+,(+)*+(,#*)#,*#)(#","I 41 m d":" !#*,+%(5)$9 %#*)+%*5) 9()+$%#, 9!*5(,+$!#,$9!(5","I 41 c d":" !#*,+%(5)$9 %+*)#%*9) 5()+$%#, 9!*5(,#$!+,$5!(9","P -4 2 m":" !#$%#% &!$&$!& %&%$#! #","P -4 2 c":" !#$%#% &!$&$!- %-%$+! +","P -4 21 m":" !#$%#% &!$&*)&(,&,*#)(#","P -4 21 c":" !#$%#% &!$&*)-(,-,*+)(+","P -4 m 2":" !#$%#!$&% & %#$!#! &%$&","P -4 c 2":" !#$%#% &!$& %+$!+! -%$-","P -4 b 2":" !#$%#% &!$&(,#*)#)(&,*&","P -4 n 2":" !#$%#% &!$&(,+*)+)(-,*-","I -4 m 2":" !#$%#% &!$& %#$!#! &%$&()+*,+,(-)*-(,+*)+)(-,*-","I -4 c 2":" !#$%#% &!$& %+$!+! -%$-()+*,+,(-)*-(,#*)#)(&,*&","I -4 2 m":" !#$%#% &!$&$!& %&%$#! #()+*,+,(-)*-*)-(,-,*+)(+","I -4 2 d":" !#$%#% &!$&*!>(%>,$9) 9()+*,+,(-)*-$)= ,=%*5!(5","P 4/m 2/m 2/m":" !#$%#% #!$#$!& %&! &%$&$%& !&!$&% & %#$!#%$#! #","P 4/m 2/c 2/c":" !#$%#% #!$#$!- %-! -%$-$%& !&!$&% & %+$!+%$+! +","P 4/n 2/b 2/m":" !#$%#% #!$#$!& %&! &%$&*,&()&)*&,(&(,#*)#,*#)(#","P 4/n 2/n 2/c":" !#$%#% #!$#$!& %&! &%$&*,-()-)*-,(-(,+*)+,*+)(+","P 4/m 21/b 2/m":" !#$%#% #!$#*)&(,&)(&,*&$%& !&!$&% &(,#*)#,*#)(#","P 4/m 21/n 2/c":" !#$%#% #!$#*)-(,-)(-,*-$%& !&!$&% &(,+*)+,*+)(+","P 4/n 21/m 2/m":" !#$%#,(#)*#*)&(,&! &%$&*,&()&!$&% & %#$!#,*#)(#","P 4/n 2/c 2/c":" !#$%#,(#)*#*)-(,-! -%$-*,&()&!$&% & %+$!+,*+)(+","P 42/m 2/m 2/c":" !#$%#% +!$+$!& %&! -%$-$%& !&!$-% - %#$!#%$+! +","P 42/m 2/c 2/m":" !#$%#% +!$+$!- %-! &%$&$%& !&!$-% - %+$!+%$#! #","P 42/n 2/b 2/c":" !#$%#,(+)*+$!- %-)(&,*&*,-()-!$&% &(,#*)#%$+! +","P 42/n 2/n 2/m":" !#$%#,(+)*+$!& %&)(-,*-*,-()-!$&% &(,+*)+%$#! #","P 42/m 21/b 2/c":" !#$%#% +!$+*)&(,&)(-,*-$%& !&!$-% -(,#*)#,*+)(+","P 42/m 21/n 2/m":" !#$%#,./'*/*'-.,-! &%$&$%& !&'*-,.-.,/*'/%$#! #","P 42/n 21/m 2/c":" !#$%#,(+)*+*)-(,-! &%$&*,-()-!$&% & %#$!#,*+)(+","P 42/n 21/c 2/m":" !#$%#,(+)*+*)&(,&! -%$-*,-()-!$&% & %+$!+,*#)(#","I 4/m 2/m 2/m":" !#$%#% #!$#$!& %&! &%$&$%& !&!$&% & %#$!#%$#! #()+*,+,(+)*+*)-(,-)(-,*-*,-()-)*-,(-(,+*)+,*+)(+","I 4/m 2/c 2/m":" !#$%#% #!$#$!- %-! -%$-$%& !&!$&% & %+$!+%$+! +()+*,+,(+)*+*)&(,&)(&,*&*,-()-)*-,(-(,#*)#,*#)(#","I 41/a 2/m 2/d":" !#*,+%(5)$9*!> ,=)(-%$&$,=(!>!$&,(-(,+$!#,$9!(5()+$%#, 9!*5$)=(%>! &,*-*%> )=)*-% & %#*)+%*5) 9","I 41/a 2/c 2/d":" !#*,+%(5)$9*!= ,>)(&%$-$,=(!>!$&,(-(,#$!+,$5!(9()+$%#, 9!*5$)>(%=! -,*&*%> )=)*-% & %+*)#%*9) 5","P 3":" !#%?#@$#","P 31":" !#%?A@$B","P 32":" !#%?B@$A","H 3":" !#%?#@$#CDAEFAGHAIJBKLBMNB","R 3":" !## !!# ","P -3":" !#%?#@$#$%&!@&? &","H -3":" !#%?#@$#$%&!@&? &OPQRSQTUQVWXYZX[]X]Y^W[^ZV^UR_PT_SO_","R -3":" !## !!# $%&&$%%&$","P 3 1 2":" !#%?#@$#%$&@!& ?&","P 3 2 1":" !#%?#@$#! &?%&$@&","P 31 1 2":" !#%?Q@$^%$_@!X ?&","P 31 2 1":" !#%?A@$B! &?%_$@X","P 32 1 2":" !#%?^@$Q%$X@!_ ?&","P 32 2 1":" !#%?B@$A! &?%X$@_","H 3 2":" !#%?#@$#! &?%&$@&OPQRSQTUQY]X[WXVZX]Y^W[^ZV^PO_SR_UT_","R 3 2":" !## !!# %$&$&%&%$","P 3 m 1":" !#%?#@$#%$#@!# ?#","P 3 1 m":" !#%?#@$#! #?%#$@#","P 3 c 1":" !#%?#@$#%$+@!+ ?+","P 3 1 c":" !#%?#@$#! +?%+$@+","H 3 m":" !#%?#@$#%$#@!# ?#OPQRSQTUQRUQTPQOSQ]Y^W[^ZV^WV^ZY^][^","R 3 m":" !## !!# ! # #!#! ","H 3 c":" !#%?#@$#%$+@!+ ?+OPQRSQTUQRU`TP`OS`]Y^W[^ZV^WVaZYa][a","R 3 c":" !## !!# '././'/'.","P -3 1 2/m":" !#%?#@$#%$&@!& ?&$%&!@&? &! #?%#$@#","P -3 1 2/c":" !#%?#@$#%$-@!- ?-$%&!@&? &! +?%+$@+","P -3 2/m 1":" !#%?#@$#! &?%&$@&$%&!@&? &%$#@!# ?#","P -3 2/c 1":" !#%?#@$#! -?%-$@-$%&!@&? &%$+@!+ ?+","H -3 2/m":" !#%?#@$#! &?%&$@&$%&!@&? &%$#@!# ?#OPQRSQTUQY]X[WXVZXVWXYZX[]XRUQTPQOSQ]Y^W[^ZV^PO_SR_UT_UR_PT_SO_WV^ZY^][^","R -3 2/m":" !## !!# %$&$&%&%$$%&&$%%&$! # #!#! ","H -3 2/c":" !#%?#@$#! -?%-$@-$%&!@&? &%$+@!+ ?+OPQRSQTUQY]b[WbVZbVWXYZX[]XRU`TP`OS`]Y^W[^ZV^POcSRcUTcUR_PT_SO_WVaZYa][a","R -3 2/c":" !## !!# 102021210$%&&$%%&$'././'/'.","P 6":" !#%?#@$#$%#!@#? #","P 61":" !#%?A@$B$%/!@d? e","P 65":" !#%?B@$A$%/!@e? d","P 62":" !#%?^@$Q$%#!@^? Q","P 64":" !#%?Q@$^$%#!@Q? ^","P 63":" !#%?#@$#$%+!@+? +","P -6":" !#%?#@$# !&%?&@$&","P 6/m":" !#%?#@$#$%#!@#? #$%&!@&? & !&%?&@$&","P 63/m":" !#%?#@$#$%+!@+? +$%&!@&? & !-%?-@$-","P 6 2 2":" !#%?#@$#$%#!@#? #! &?%&$@&%$&@!& ?&","P 61 2 2":" !#%?Q@$^$%+!@`? a! X?%&$@_%$b@!- ?c","P 65 2 2":" !#%?^@$Q$%+!@a? `! _?%&$@X%$c@!- ?b","P 62 2 2":" !#%?^@$Q$%#!@^? Q! _?%&$@X%$_@!& ?X","P 64 2 2":" !#%?Q@$^$%#!@Q? ^! X?%&$@_%$X@!& ?_","P 63 2 2":" !#%?#@$#$%+!@+? +! &?%&$@&%$-@!- ?-","P 6 m m":" !#%?#@$#$%#!@#? #%$#@!# ?#! #?%#$@#","P 6 c c":" !#%?#@$#$%#!@#? #%$+@!+ ?+! +?%+$@+","P 63 c m":" !#%?#@$#$%+!@+? +%$+@!+ ?+! #?%#$@#","P 63 m c":" !#%?#@$#$%+!@+? +%$#@!# ?#! +?%+$@+","P -6 m 2":" !#%?#@$# !&%?&@$&%$#@!# ?#%$&@!& ?&","P -6 c 2":" !#%?#@$# !-%?-@$-%$+@!+ ?+%$&@!& ?&","P -6 2 m":" !#%?#@$# !&%?&@$&! &?%&$@&! #?%#$@#","P -6 2 c":" !#%?#@$# !-%?-@$-! &?%&$@&! +?%+$@+","P 6/m 2/m 2/m":" !#%?#@$#$%#!@#? #! &?%&$@&%$&@!& ?&$%&!@&? & !&@$&%?&%$#@!# ?#! #?%#$@#","P 6/m 2/c 2/c":" !#%?#@$#$%#!@#? #! -?%-$@-%$-@!- ?-$%&!@&? & !&@$&%?&%$+@!+ ?+! +?%+$@+","P 63/m 2/c 2/m":" !#%?#@$#$%+!@+? +! -?%-$@-%$&@!& ?&$%&!@&? & !-@$-%?-%$+@!+ ?+! #?%#$@#","P 63/m 2/m 2/c":" !#%?#@$#$%+!@+? +! &?%&$@&%$-@!- ?-$%&!@&? & !-@$-%?-%$#@!# ?#! +?%+$@+","P 2 3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ","F 2 3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-((!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- ","I 2 3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-(","P 21 3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(","I 21 3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- ","P 2/m -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& $%& !& %#$!#&$%& !# %#$!%&$!& %# !#$","P 2/n -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& *,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*","F 2/m -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& $%& !& %#$!#&$%& !# %#$!%&$!& %# !#$ )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-($,- )- ,+$)+&*,&()#(,#*)%-*!-(%+(!+*(!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(*%-(!-(%+*!+-$,- )+ ,+$),&*)&(,#()#*()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- *,&()&(,#*)#-*%-(!+(%+*!,-$)- ,+ )+$", +"F 2/d -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& 64=37=345675=64=375345674=67=3453756 )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(68>3:>3896:9=<8=;:5;85<:4><7>;49;79<(!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(<4>;7>;49<79>68>3:93896:8=<:=;85;:5<()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- <8=;:=;8f<:f><4>;79;49<78>6:>3893:96","I 2/m -3":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& $%& !& %#$!#&$%& !# %#$!%&$!& %# !#$()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-(*,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*","P 21/a -3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&($%&(!- ,+*)#&$%-(!+ ,#*)%&$!-(,+ )#*","I 21/a -3":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&($%&(!- ,+*)#&$%-(!+ ,#*)%&$!-(,+ )#*()+$,#*g& %-+()#$,&*!- %)+(,#$!&*%- *,- )&(%#$!+-*,& )#(%+$!,-*)& %#(!+$","P 4 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$","P 42 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*","F 4 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$ )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(!(-%*-!*+%(+ +,$+)$-, -)#)*#,(&)(&,*(!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&() -,$-)$+, +(#,*#)*&,(&)+!*+%(-!(-%*()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- )(&,*&)*#,(#(+%*+!*-%(-!+)$+, -) -,$","F 41 3 2":" !#$,+*)&(%-# !+$,&*)-(%!# ,+$)&*%-(:3>46=7<98;5;58<976=43>:97<58;>:3=46 )+$%#*!-(,&#()+*%&$!- ,!+(,#*)-$%& :;=4<>765839;94<5:6>83=79:6543>7;=8<(!+*,#$)- %&+ )#$%-*!&(,)#(%+*!&$,- 73=86>:<54;935469:<=8;>7576983=:;>4<()#*%+$!& ,-+(!#*,-$)& %)+ %#$!-*,&(7;>8<=:69435398657<>4;=:5:<94;=73>86","I 4 3 2":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-()(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*","P 43 3 2":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(7;>46=:<5839398<5:6=4;>75:<983>7;=46","P 41 3 2":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(:3=8<>7694;5;54697<>83=:97654;=:3>8<","I 41 3 2":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(:3=8<>7694;5;54697<>83=:97654;=:3>8<()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- 7;>46=:<5839398<5:6=4;>75:<983>7;=46","P -4 3 m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! #%$#!$&% & #!$#%$&! &%#! #%$&!$&% ","F -4 3 m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! #%$#!$&% & #!$#%$&! &%#! #%$&!$&% )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(!(+%*+!*-%(- +)$+,$-) -,#)(#,*&)*&,((!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&() +,$+)$-, -(#)*#,*&)(&,+!(+%*-!*-%(()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- )(#,*#)*&,(&(+!*+%*-!(-%+) +,$-)$-, ","I -4 3 m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! #%$#!$&% & #!$#%$&! &%#! #%$&!$&% ()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-()(+,*+)*-,(-(+)*+,*-)(-,+)(+,*-)*-,(","P -4 3 n":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(+,*+)*-,(-(+)*+,*-)(-,+)(+,*-)*-,(","F -4 3 c":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(+,*+)*-,(-(+)*+,*-)(-,+)(+,*-)*-,( )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-() #,$#)$&, &(#!*#%*&!(&%+! +%$-!$-% (!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(!(#%*#!*&%(& +!$+%$-! -%#) #,$&)$&, ()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- ! +%$+!$-% - #)$#,$&) &,#!(#%*&!*&%(","I -4 3 d":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(7354<9:6>8;=357<946>:;=857394<>:6=8;()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- :;98657<=43>;9:658<=73>49:;586=7<>43","P 4/m -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! ","P 4/n -3 2/n":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$*,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)(","P 42/m -3 2/n":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)(","P 42/n -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,**,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! ","F 4/m -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-(!(-%*-!*+%(+ +,$+)$-, -)#)*#,(&)(&,*$,- )- ,+$)+&*,&()#(,#*)%-*!-(%+(!+*%*+!(+%(-!*-$-) -, +)$+,&,(&)*#,*#)((!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&() -,$-)$+, +(#,*#)*&,(&)+!*+%(-!(-%**%-(!-(%+*!+-$,- )+ ,+$),&*)&(,#()#*,$+) +, -)$-*&)(&,(#)*#,-%(-!*+%*+!(()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- )(&,*&)*#,(#(+%*+!*-%(-!+)$+, -) -,$*,&()&(,#*)#-*%-(!+(%+*!,-$)- ,+ )+$,*#)(#,(&)*&*-!(-%(+!*+%-, -)$+,$+) ","F 4/m -3 2/c":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& )(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,*$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)( )+$,+$)- ,-#()#*,&*)&(,!+(%+*!-*%-() &,$&)$#, #(#%*#!*&%(&!+!$+% -! -%$$,- )- ,+$)+&*,&()#(,#*)%-*!-(%+(!+*,$#) #, &)$&*&!(&%(#!*#%-% -!$+%$+! (!+*%+*!-(%-+ )+$,-$)- ,)#(,#*)&*,&(!(&%*&!*#%(# +%$+!$-% -!#)$#, &) &,$*%-(!-(%+*!+-$,- )+ ,+$),&*)&(,#()#*%*#!(#%(&!*&$-! -% +!$+%&, &)$#,$#) ()#*,#*)&(,&+(!+*%-*!-(%)+ ,+$)-$,- ! -%$-!$+% + #,$#)$&, &)#!*#%(&!(&%**,&()&(,#*)#-*%-(!+(%+*!,-$)- ,+ )+$%$+! +% -!$-$&) &, #)$#,&%(&!*#%*#!(","F 41/d -3 2/m":" !#$,+*)&(%-# !+$,&*)-(%!# ,+$)&*%-(:3>46=7<98;5;58<976=43>:97<58;>:3=4664=3:>;85<79=64>3:5;89<74=6:>385;79<,$+! #%(-)*&*&)(-% #!$+,-%(&)*+,$#! )+$%#*!-(,&#()+*%&$!- ,!+(,#*)-$%& :;=4<>765839;94<5:6>83=79:6543>7;=8<68>37=;49<:5=<8>;753496:4><:=;893756,*#!(+% &)$-*-!(&, +)$#%-, &!$+%*#)((!+*,#$)- %&+ )#$%-*!&(,)#(%+*!&$,- 73=86>:<54;935469:<=8;>7576983=:;>4<<4>;:=389675>68=379;45<:8=<7>;453:96%$#) +,(&!*-$&! -,(#)*+%&% -)$#,*+!(()#*%+$!& ,-+(!#*,-$)& %)+ %#$!-*,&(7;>8<=:69435398657<>4;=:5:<94;=73>86<8=;7>3456:9><4=;:9385678>67=349;:5<%*+)(#, -!$&$-) &%(+!*#,&,(-!*#%$+) ","F 41/d -3 2/c":" !#$,+*)&(%-# !+$,&*)-(%!# ,+$)&*%-(:3>46=7<98;5;58<976=43>:97<58;>:3=46<8>;7=3496:5><8=;793456:8><7=;493:56%*#)(+, &!$-$-! &,(+)*#%&, -!$#%*+)( )+$%#*!-(,&#()+*%&$!- ,!+(,#*)-$%& :;=4<>765839;94<5:6>83=79:6543>7;=8<<4=;:>385679>64=3:9;85<78=67>345;:9<%$+) #,(-!*&$&) -%(#!*+,&%(-)*#,$+! (!+*,#$)- %&+ )#$%-*!&(,)#(%+*!&$,- 73=86>:<54;935469:<=8;>7576983=:;>4<68=37>;45<:9=<4>;:5389674>6:=389;75<,*+!(#% -)$&*-)(&% +!$#,-,(&!*+%$#) ()#*%+$!& ,-+(!#*,-$)& %)+ %#$!-*,&(7;>8<=:69435398657<>4;=:5:<94;=73>8664>3:=;89<75=68>375;49<:4=<:>;853796,$#! +%(&)*-*&!(-, #)$+%-% &)$+,*#!(","I 4/m -3 2/m":" !#$%#$!& %&# !#$%&$!& %!# %#$!&$%& ! &%$&!$#% # #%$#!$&% &!#!$#% &! &%$$%& !& %#$!#&$%& !# %#$!%&$!& %# !#$%$#! #% &!$&$&! &% #!$#%&% &!$#%$#! ()+*,+*)-(,-+()+*,-*)-(,)+(,+*)-*,-()(-,*-)*+,(+(+,*+)*-,(-)+)*+,(-)(-,**,-()-(,+*)+-*,-()+(,+*),-*)-(,+()+*,*+)(+,(-)*-*-)(-,(+)*+,-,(-)*+,*+)(","I 41/a -3 2/d":" !#*%+$)-(,&# !+*%-$)&(,!# %+*)-$,&(:3=8<>7694;5;54697<>83=:97654;=:3>8<$%&(!- ,+*)#&$%-(!+ ,#*)%&$!-(,+ )#*4<97358;=:6>6>:;=8357<94=8;>:694<573()+$,#*!& %-+()#$,&*!- %)+(,#$!&*%- 7;>46=:<5839398<5:6=4;>75:<983>7;=46*,- )&(%#$!+-*,& )#(%+$!,-*)& %#(!+$865:;943>7<=<=73>4;9:658>43=7<5869:;","P 1 1 2":" !#$%#","P 1 1 21":" !#$%+","B 1 1 2":" !#$%#(g+*%+","A 1 2 1":" !#$!& )+$)-","C 1 21 1":" !#$)&()#*!&","I 1 2 1":" !#$!&.'/0'2","I 1 21 1":" !#$)&.'/0!-","P 1 1 m":" !# !&","P 1 1 b":" !# )&","B 1 1 m":" !# !&(!+(!-","B 1 1 b":" !# )&(!+()-","P 1 1 2/m":" !# !&$%#$%&","P 1 1 21/m":" !#$%+$%& !-","B 1 1 2/m":" !# !&$%#$%&(!+(!-*%+*%-","P 1 1 2/b":" !#$,#$%& )&","P 1 1 21/b":" !#$%&$,+ )-","B 1 1 2/b":" !#$,#$%& )&(!+*,+*%-()-","P 21 2 2":" !#$!&(%&*%#","P 2 21 2":" !# ,&$)&$%#","P 21 21 2 (a)":" !#*,#.%&$'&","P 21 2 21":" !#$!&(%-*%+","P 2 21 21":" !# %&$)-$,+","C 2 2 21a)":" !#*%+(,&$)-()#$,+ %&*!-","C 2 2 2a":" !#*,#.%&$'&()#$%# ,&*!&","F 2 2 2a":" !#*,#.%&$'& '/*%/.12$!2.!/$,/ %20'2.'#$%# 1&0!&","I 2 2 2a":" !#*,#.%&$'&()+$%+*!- ,-","P 21/m 21/m 2/n a":" !#*,#$)&(%&$%&.'& ,#*!#","P 42 21 2a":" !#*,#%.+'$+$'&.%&! -,*-","I 2 3a":" !#*,#.%&$'&!# ,- '&$%/$# !-*!/$%&.%()+$%+ ,-*!-)+(%&(!-*,#*+()&$)#*,- ,"};Wo.prototype={constructor:Wo,type:"Assembly",addPart:function(t,e){var i=new Xo(t,e);return this.partList.push(i),i},getAtomCount:function(t){var e=0;return this.partList.forEach(function(i){e+=i.getAtomCount(t)}),e},getInstanceCount:function(){var t=0;return this.partList.forEach(function(e){t+=e.matrixList.length}),t},isIdentity:function(t){if(1!==this.partList.length)return!1;var e=this.partList[0];if(1!==e.matrixList.length)return!1;var i=new O;if(!i.equals(e.matrixList[0]))return!1;var n=[];return t.eachChain(function(t){n.push(t.chainname)}),n=x(n),e.chainList.length===n.length},getBoundingBox:function(t){var e=new Et;return this.partList.forEach(function(i){var n=i.getBoundingBox(t);e.expandByPoint(n.min),e.expandByPoint(n.max)}),e},getSelection:function(){var t=[];return this.partList.forEach(function(e){t=t.concat(e.chainList)}),Ho(t)}},Xo.prototype={constructor:Xo,type:"AssemblyPart",getAtomCount:function(t){var e=0,i=this.chainList;return t.eachChain(function(t){(0===i.length||i.includes(t.chainname))&&(e+=t.atomCount)}),this.matrixList.length*e},getBoundingBox:function(t){var e=new Et,i=new Et,n=this.getSelection(),r=t.getBoundingBox(n);return this.matrixList.forEach(function(t){i.copy(r).applyMatrix4(t),e.expandByPoint(i.min),e.expandByPoint(i.max)}),e},getSelection:function(){return Ho(this.chainList)},getView:function(t){var e=this.getSelection();return e?t.getView(e):t},getInstanceList:function(){for(var t=[],e=0,i=this.matrixList.length;e=t.residueCount)){a.index=o+u,s.index=o+u+l,c.index=a.traceAtomIndex,h.index=s.traceAtomIndex;var d=c.distanceTo(h);if(Math.abs(d-i[l-2])>n)return!1}return!0},i=function(t,i){var n=[5.45,5.18,6.37],r=2.1;return e(t,i,n,r)},n=function(t,i){var n=[6.1,10.4,13],r=1.42;return e(t,i,n,r)},r=function(t){for(var e=t.residueStore,r=t.residueIndexStart,o=0,a=t.residueCount;o1&&a.bending[h]=3&&t.indexOf(n[0])!==-1?n[0]:""}}();na.prototype={constructor:na,type:"AtomType",atomname:void 0,element:void 0,vdw:void 0,covalent:void 0},oa.prototype={constructor:oa,type:"ResidueType",resname:void 0,atomTypeIdList:void 0,atomCount:void 0,getBackboneIndexList:function(){var t,e=[];switch(this.moleculeType){case Qp:t=Im;break;case Jp:case tm:t=Lm;break;default:return e}for(var i=this.structure.atomMap,n=this.atomTypeIdList,r=0,o=this.atomCount;r=2?t(l,e[l],a):i[l]=2;else if(1===i[l]&&c&&c!=l){var d=[l];n[l]=1,r.push(d);for(var f=o.length-1;f>=0;--f){var p=o[f];if(p===l)break;d.push(p),n[p]=1}}}i[a]=2,o.pop()}for(var e=this.getBondGraph(),i=new Int8Array(this.atomCount),n=new Int8Array(this.atomCount),r=[],o=[],a=0;a1){for(e=0;e1){for(e=0;e0){var e=this.residueStore.atomOffset[this.residueIndex];return t.includes(this.index-e)}return!1},isPolymer:function(){if(this.structure.entityList.length>0)return this.entity.isPolymer();var t=this.residueType.moleculeType;return t===Qp||t===Jp||t===tm},isSidechain:function(){return this.isPolymer()&&!this.isBackbone()},isCg:function(){var t=this.residueType.backboneType;return t===am||t===sm||t===cm},isHetero:function(){return 1===this.residueType.hetero},isProtein:function(){return this.residueType.moleculeType===Qp},isNucleic:function(){var t=this.residueType.moleculeType;return t===Jp||t===tm},isRna:function(){return this.residueType.moleculeType===Jp},isDna:function(){return this.residueType.moleculeType===tm},isWater:function(){return this.residueType.moleculeType===Zp},isIon:function(){return this.residueType.moleculeType===Kp},isSaccharide:function(){return this.residueType.moleculeType===em},isRing:function(){var t=this.residueType.getRings().flags;return 1===t[this.index-this.residueAtomOffset]},distanceTo:function(t){var e=this.atomStore,i=t.atomStore,n=this.index,r=t.index,o=e.x[n]-i.x[r],a=e.y[n]-i.y[r],s=e.z[n]-i.z[r],c=o*o+a*a+s*s;return Math.sqrt(c)},connectedTo:function(t){var e=this.atomStore,i=t.atomStore,n=this.index,r=t.index;if(e.altloc&&i.altloc){var o=e.altloc[n],a=i.altloc[r];if(0!==o&&0!==a&&32!==o&&32!==a&&o!==a)return!1}var s=e.x[n]-i.x[r],c=e.y[n]-i.y[r],h=e.z[n]-i.z[r],u=s*s+c*c+h*h;if(u<64&&this.isCg())return!0;if(isNaN(u))return!1;var l=this.covalent+t.covalent,d=l+.3,f=l-.5;return uf*f},positionFromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e+0],this.y=t[e+1],this.z=t[e+2],this},positionToArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.index,n=this.atomStore;return t[e+0]=n.x[i],t[e+1]=n.y[i],t[e+2]=n.z[i],t},positionToVector3:function(t){return void 0===t&&(t=new N),t.x=this.x,t.y=this.y,t.z=this.z,t},positionFromVector3:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},getResidueBonds:function(t){var e,i,n,r,o=this.residueAtomOffset,a=this.index-this.residueAtomOffset,s=this.residueType.getBonds(),c=s.atomIndices1,h=s.atomIndices2;for(t||(r=[]),e=c.indexOf(a);e!==-1;){if(n=h[e]+o,t)return n;r.push(n),e=c.indexOf(a,e+1)}for(i=h.indexOf(a);i!==-1;){if(n=c[i]+o,t)return n;r.push(n),i=h.indexOf(a,i+1)}return r},qualifiedName:function(t){var e="";return this.resname&&!t&&(e+="["+this.resname+"]"),void 0!==this.resno&&(e+=this.resno),this.inscode&&(e+="^"+this.inscode),this.chainname&&(e+=":"+this.chainname),this.atomname&&(e+="."+this.atomname),this.altloc&&(e+="%"+this.altloc),this.structure.modelStore.count>1&&(e+="/"+this.modelIndex),e},clone:function(){return new this.constructor(this.structure,this.index)},toObject:function(){return{index:this.index,residueIndex:this.residueIndex,atomno:this.atomno,resname:this.resname,x:this.x,y:this.y,z:this.z,element:this.element,chainname:this.chainname,resno:this.resno,serial:this.serial,vdw:this.vdw,covalent:this.covalent,hetero:this.hetero,bfactor:this.bfactor,altloc:this.altloc,atomname:this.atomname,modelindex:this.modelindex}}},ha.prototype={constructor:ha,type:"ResidueProxy",structure:void 0,chainStore:void 0,residueStore:void 0,atomStore:void 0,index:void 0,get entity(){return this.structure.entityList[this.entityIndex]},get entityIndex(){return this.chainStore.entityIndex[this.chainIndex]},get chain(){return this.structure.getChainProxy(this.chainIndex)},get chainIndex(){return this.residueStore.chainIndex[this.index]},set chainIndex(t){this.residueStore.chainIndex[this.index]=t},get atomOffset(){return this.residueStore.atomOffset[this.index]},set atomOffset(t){this.residueStore.atomOffset[this.index]=t},get atomCount(){return this.residueStore.atomCount[this.index]},set atomCount(t){this.residueStore.atomCount[this.index]=t},get atomEnd(){return this.atomOffset+this.atomCount-1},get modelIndex(){return this.chainStore.modelIndex[this.chainIndex]},get chainname(){return this.chainStore.getChainname(this.chainIndex)},get chainid(){return this.chainStore.getChainid(this.chainIndex)},get resno(){return this.residueStore.resno[this.index]},set resno(t){this.residueStore.resno[this.index]=t},get sstruc(){return this.residueStore.getSstruc(this.index)},set sstruc(t){this.residueStore.setSstruc(this.index,t)},get inscode(){return this.residueStore.getInscode(this.index)},set inscode(t){this.residueStore.getInscode(this.index,t)},get residueType(){return this.residueMap.get(this.residueStore.residueTypeId[this.index])},get resname(){return this.residueType.resname},get hetero(){return this.residueType.hetero},get moleculeType(){return this.residueType.moleculeType},get backboneType(){return this.residueType.backboneType},get backboneStartType(){return this.residueType.backboneStartType},get backboneEndType(){return this.residueType.backboneEndType},get traceAtomIndex(){return this.residueType.traceAtomIndex+this.atomOffset},get direction1AtomIndex(){return this.residueType.direction1AtomIndex+this.atomOffset},get direction2AtomIndex(){return this.residueType.direction2AtomIndex+this.atomOffset},get backboneStartAtomIndex(){return this.residueType.backboneStartAtomIndex+this.atomOffset},get backboneEndAtomIndex(){return this.residueType.backboneEndAtomIndex+this.atomOffset},get rungEndAtomIndex(){return this.residueType.rungEndAtomIndex+this.atomOffset},eachAtom:function(t,e){var i,n=this.atomCount,r=this.atomOffset,o=this.structure._ap,a=r+n;if(e&&e.atomOnlyTest){var s=e.atomOnlyTest;for(i=r;i0)return this.entity.isPolymer();var t=this.residueType.moleculeType;return t===Qp||t===Jp||t===tm},isHetero:function(){return 1===this.residueType.hetero},isWater:function(){return this.residueType.moleculeType===Zp},isIon:function(){return this.residueType.moleculeType===Kp},isSaccharide:function(){return this.residueType.moleculeType===em},getAtomType:function(t){return this.atomMap.get(this.atomStore.atomTypeId[t])},getResname1:function(){return _m[this.resname.toUpperCase()]||"X"},getBackboneType:function(t){switch(t){case-1:return this.residueType.backboneStartType;case 1:return this.residueType.backboneEndType;default:return this.residueType.backboneType}},getAtomIndexByName:function(t){var e=this.residueType.getAtomIndexByName(t);return void 0!==e&&(e+=this.atomOffset),e},getAtomByName:function(t){return this.residueType.getAtomByName(t)},hasAtomWithName:function(t){return this.residueType.hasAtomWithName(t)},getAtomnameList:function(){console.warn("getAtomnameList - might be expensive");for(var t=this.atomCount,e=this.atomOffset,i=new Array(t),n=0;n=e){if(void 0===t&&(t=this.structure.getResidueProxy()),t.index=i,t.connectedTo(this))return t}else if(i===e-1){void 0===t&&(t=this.structure.getResidueProxy());var n=this.chainStore.residueCount[this.chainIndex];if(t.index=e+n-1,t.connectedTo(this))return t}},getBonds:function(){return this.residueType.getBonds(this)},getRings:function(){return this.residueType.getRings()},qualifiedName:function(t){var e="";return this.resname&&!t&&(e+="["+this.resname+"]"),void 0!==this.resno&&(e+=this.resno),this.inscode&&(e+="^"+this.inscode),this.chain&&(e+=":"+this.chainname),e+="/"+this.modelIndex},clone:function(){return new this.constructor(this.structure,this.index)},toObject:function(){return{index:this.index,chainIndex:this.chainIndex,atomOffset:this.atomOffset,atomCount:this.atomCount,resno:this.resno,resname:this.resname,sstruc:this.sstruc}}},ua.prototype={constructor:ua,type:"Polymer",structure:void 0,residueStore:void 0,atomStore:void 0,residueIndexStart:void 0,residueIndexEnd:void 0,residueCount:void 0,get chainIndex(){return this.residueStore.chainIndex[this.residueIndexStart]},get modelIndex(){return this.chainStore.modelIndex[this.chainIndex]},get chainname(){return this.chainStore.getChainname(this.chainIndex)},isProtein:function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isProtein()},isCg:function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isCg()},isNucleic:function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isNucleic()},getMoleculeType:function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.moleculeType},getBackboneType:function(t){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.getBackboneType(t)},getAtomIndexByType:function(t,e){this.isCyclic?t===-1?t=this.residueCount-1:t===this.residueCount&&(t=0):(t!==-1||this.isPrevConnected||(t+=1),t!==this.residueCount||this.isNextNextConnected||(t-=1));var i=this.__residueProxy;i.index=this.residueIndexStart+t;var n;switch(e){case"trace":n=i.traceAtomIndex;break;case"direction1":n=i.direction1AtomIndex;break;case"direction2":n=i.direction2AtomIndex;break;default:var r=i.getAtomByName(e);n=r?r.index:void 0}return n},eachAtom:function(t,e){this.eachResidue(function(i){i.eachAtom(t,e)},e)},eachAtomN:function(t,e,i){var n,r=this.residueCount,o=new Array(t);for(n=0;n=n&&i=t&&e.apply(this,a)}})}},eachDirectionAtomsN:function(t,e){var i=2*t,n=this.atomOffset,r=this.atomCount,o=n+r;if(!(r=n&&i=n&&r=t&&e.apply(this,a)}},c,h)}},eachResidue:function(t){for(var e=this.structure.getResidueProxy(),i=this.residueCount,n=this.residueIndexStart,r=0;r1&&t(new ua(o,i,h.index)),i=n)):(m!==im&&h.index-i>1&&t(new ua(o,i,h.index)),i=n)}n-i>1&&this.structure.getResidueProxy(i).backboneStartType&&t(new ua(o,i,n))},qualifiedName:function(){var t=":"+this.chainname+"/"+this.modelIndex;return t},clone:function(){return new this.constructor(this.structure,this.index)},toObject:function(){return{index:this.index,residueOffset:this.residueOffset,residueCount:this.residueCount,chainname:this.chainname}}},da.prototype={constructor:da,type:"ModelProxy",structure:void 0,modelStore:void 0,index:void 0,get chainOffset(){return this.modelStore.chainOffset[this.index]},set chainOffset(t){this.modelStore.chainOffset[this.index]=t},get chainCount(){return this.modelStore.chainCount[this.index]},set chainCount(t){this.modelStore.chainCount[this.index]=t},get residueOffset(){return this.chainStore.residueOffset[this.chainOffset]},get atomOffset(){return this.residueStore.atomOffset[this.residueOffset]},get chainEnd(){return this.chainOffset+this.chainCount-1},get residueEnd(){return this.chainStore.residueOffset[this.chainEnd]+this.chainStore.residueCount[this.chainEnd]-1},get atomEnd(){return this.residueStore.atomOffset[this.residueEnd]+this.residueStore.atomCount[this.residueEnd]-1},get residueCount(){return 0===this.chainCount?0:this.residueEnd-this.residueOffset+1},get atomCount(){return 0===this.residueCount?0:this.atomEnd-this.atomOffset+1},eachAtom:function(t,e){this.eachChain(function(i){i.eachAtom(t,e)},e)},eachResidue:function(t,e){this.eachChain(function(i){i.eachResidue(t,e)},e)},eachPolymer:function(t,e){if(e&&e.chainOnlyTest){var i=e.chainOnlyTest;this.eachChain(function(n){i(n)&&n.eachPolymer(t,e)})}else this.eachChain(function(i){i.eachPolymer(t,e)})},eachChain:function(t,e){var i,n=this.chainCount,r=this.chainOffset,o=this.structure._cp,a=r+n;if(e&&e.test){var s=e.chainOnlyTest;if(s)for(i=r;i1?(R=i.atomRadius(A),O=R*b/(.5*L),_.calculateShiftDir(B),y?(D=2*x*R,B.multiplyScalar(D),B.negate(),z.subVectors(M,A).multiplyScalar(Math.max(.1,D/1.88)),A.positionToArray(o,E),M.positionToArray(a,E),L>=2&&(F.addVectors(A,B).add(z).toArray(o,E+3),F.addVectors(M,B).sub(z).toArray(a,E+3),L>=3&&(F.subVectors(A,B).add(z).toArray(o,E+6),F.subVectors(M,B).sub(z).toArray(a,E+6)))):(D=(x-b)*R,B.multiplyScalar(D),2===L?(F.addVectors(A,B).toArray(o,E),F.subVectors(A,B).toArray(o,E+3),F.addVectors(M,B).toArray(a,E),F.subVectors(M,B).toArray(a,E+3)):3===L?(A.positionToArray(o,E),F.addVectors(A,B).toArray(o,E+3),F.subVectors(A,B).toArray(o,E+6),M.positionToArray(a,E),F.addVectors(M,B).toArray(a,E+3),F.subVectors(M,B).toArray(a,E+6)):(A.positionToArray(o,E),M.positionToArray(a,E)))):(A.positionToArray(o,E),M.positionToArray(a,E))),s&&(n.bondColorToArray(_,1,s,E),n.bondColorToArray(_,0,c,E),v&&L>1))for(T=1;T1))for(T=1;T1))for(O=l[k]*b/(y?1:.5*L),T=y?1:0;T1))for(O=f[k]*b/(y?1:.5*L),T=y?1:0;Ta&&(a=e),i>s&&(s=i),h>c&&(c=h)},e),i.min.set(n,r,o),i.max.set(a,s,c),t.Debug&&mv.timeEnd("getBoundingBox"),i},getPrincipalAxes:function(e){t.Debug&&mv.time("getPrincipalAxes");var i=0,n=new co(3,this.atomCount),r=n.data;return this.eachAtom(function(t){r[i+0]=t.x,r[i+1]=t.y,r[i+2]=t.z,i+=3},e),t.Debug&&mv.timeEnd("getPrincipalAxes"),_o(n)},atomCenter:function(t){return t?this.getBoundingBox(t).center():this.center.clone()},getSequence:function(t){var e=[],i=this.getResidueProxy();return this.eachAtom(function(t){i.index=t.residueIndex,t.index===i.traceAtomIndex&&e.push(i.getResname1())},t),e},getAtomIndices:function(t){var e;if(t&&t.string)e=[],this.eachAtom(function(t){e.push(t.index)},t);else{var i={what:{index:!0}};e=this.getAtomData(i).index}return e},getChainnameCount:function(t){var e=new Set;return this.eachChain(function(t){t.residueCount&&e.add(t.chainname)},t),e.size},updatePosition:function(t){var e=0;this.eachAtom(function(i){i.positionFromArray(t,e),e+=3})},refreshPosition:function(){this.getBoundingBox(void 0,this.boundingBox),this.boundingBox.center(this.center),this.spatialHash=new Lo(this.atomStore,this.boundingBox)},dispose:function(){this.frames&&(this.frames.length=0),this.boxes&&(this.boxes.length=0),this.bondStore.dispose(),this.backboneBondStore.dispose(),this.rungBondStore.dispose(),this.atomStore.dispose(),this.residueStore.dispose(),this.chainStore.dispose(),this.modelStore.dispose(),delete this.bondStore,delete this.atomStore,delete this.residueStore,delete this.chainStore,delete this.modelStore,delete this.frames,delete this.boxes,delete this.cif,delete this.bondSet,delete this.atomSet}},pa.prototype={constructor:pa,type:"Surface",set:function(t,e,i,n,r){this.position=t,this.index=e,this.normal=i,this.color=n,this.atomindex=r,this.size=t.length/3},fromGeometry:function(e){t.Debug&&mv.time("GeometrySurface.fromGeometry");var i;e instanceof ae?(e.computeVertexNormals(!0),i=(new he).fromGeometry(e)):i=e instanceof he?e:e[0],i.boundingBox||i.computeBoundingBox(),this.center.copy(i.boundingBox.center()),this.boundingBox.copy(i.boundingBox);var n,r,o,a;if(i instanceof he){var s=i.attributes,c=!!s.normal&&s.normal.array;(!c||0===c[0]&&0===c[1]&&0===c[2])&&i.computeVertexNormals(),n=s.position.array,o=s.index?s.index.array:null,a=s.normal.array}this.set(n,o,a,r,void 0),t.Debug&&mv.timeEnd("GeometrySurface.setGeometry")},getPosition:function(){return this.position},getColor:function(t){var e,i,n,r=t||{},o=this.size;if("volume"===r.scheme){var a=new N,s=this.position;for(n=yv.getScheme(r),i=new Float32Array(3*o),e=0;e65535?Uint32Array:Uint16Array;return new g(r)}return this.index},getAtomindex:function(){return this.atomindex},dispose:function(){}},ma.prototype.constructor=ma,ga.prototype.constructor=ga,ba.__deps=[va,ya],xa.__deps=[wa],wa.__deps=[Kr,Zr,Qr,qr],Sa.__deps=[Dn,no,ro,to,eo,oo,ao,Kr,so,So,Mo,Co,Po,To],Aa.__deps=[xa,wa,ba,Wr,Xr,Eo,Io],vv.add("surf",function(t,e){var i=t.data.args,n=t.data.params;if(i&&(self.volsurf=new Aa(i[0],i[1],i[2],i[3],i[4])),n){var r=self.volsurf.getSurface(n.isolevel,n.smooth,n.box,n.matrix),o=[r.position.buffer,r.index.buffer];r.normal&&o.push(r.normal.buffer),r.atomindex&&o.push(r.atomindex.buffer),e({sd:r,p:n},o)}},[Aa]),Ma.prototype={constructor:Ma,type:"Volume",setData:function(t,e,i,n,r){this.nx=e||1,this.ny=i||1,this.nz=n||1,this.data=t||new Float32Array(1),this.__data=this.data,this.setDataAtomindex(r),delete this.mc,delete this.__isolevel,delete this.__smooth,delete this.__minValue,delete this.__maxValue,delete this.__dataPositionBuffer,delete this.__dataPosition,delete this.__dataBuffer,delete this.__dataMin,delete this.__dataMax,delete this.__dataMean,delete this.__dataRms,this.worker&&this.worker.terminate()},setMatrix:function(t){this.matrix.copy(t);var e=this.boundingBox,i=this.center,n=this.nx-1,r=this.ny-1,o=this.nz-1;e.makeEmpty(),e.expandByPoint(i.set(n,r,o)),e.expandByPoint(i.set(n,r,0)),e.expandByPoint(i.set(n,0,o)),e.expandByPoint(i.set(n,0,0)),e.expandByPoint(i.set(0,r,o)),e.expandByPoint(i.set(0,0,o)),e.expandByPoint(i.set(0,r,0)),e.expandByPoint(i.set(0,0,0)),e.applyMatrix4(this.matrix),e.center(this.center);var a=this.matrix.elements,s=new N(a[0],a[1],a[2]),c=new N(a[4],a[5],a[6]),h=new N(a[8],a[9],a[10]),u=new N,l=this.normalMatrix.elements;u.crossVectors(c,h),l[0]=u.x,l[1]=u.y,l[2]=u.z,u.crossVectors(h,s),l[3]=u.x,l[4]=u.y,l[5]=u.z,u.crossVectors(s,c),l[6]=u.x,l[7]=u.y,l[8]=u.z,this.inverseMatrix.getInverse(this.matrix)},setDataAtomindex:function(t){this.dataAtomindex=t,this.__dataAtomindex=this.dataAtomindex,delete this.__dataAtomindexBuffer},getBox:function(t,e,i){return i||(i=new Et),i.set(t,t),i.expandByScalar(e),i.applyMatrix4(this.inverseMatrix),i.min.round(),i.max.round(),i},__getBox:function(t,e){if(t&&e){this.__box||(this.__box=new Et);var i=this.getBox(t,e,this.__box);return[i.min.toArray(),i.max.toArray()]}},makeSurface:function(t,e,i){var n=new pa("","",t);return n.info.isolevel=e,n.info.smooth=i,n},getSurface:function(t,e,i,n){t=isNaN(t)?this.getValueForSigma(2):t,e=e||0,void 0===this.volsurf&&(this.volsurf=new Aa(this.__data,this.nx,this.ny,this.nz,this.__dataAtomindex));var r=this.__getBox(i,n),o=this.volsurf.getSurface(t,e,r,this.matrix.elements);return this.makeSurface(o,t,e)},getSurfaceWorker:function(t,e,i,n,r){if(t=isNaN(t)?this.getValueForSigma(2):t,e=e||0,window.Worker){void 0===this.workerPool&&(this.workerPool=new ga("surf",2));var o={},a=this.workerPool.getNextWorker();0===a.postCount&&(o.args=[this.__data,this.nx,this.ny,this.nz,this.__dataAtomindex]),o.params={isolevel:t,smooth:e,box:this.__getBox(i,n),matrix:this.matrix.elements},a.post(o,void 0,function(t){var e=t.data.sd,i=t.data.p;r(this.makeSurface(e,i.isolevel,i.smooth))}.bind(this),function(o){console.warn("Volume.getSurfaceWorker error - trying without worker",o);var a=this.getSurface(t,e,i,n);r(a)}.bind(this))}else{var s=this.getSurface(t,e,i,n);r(s)}},getValueForSigma:function(t){return t=void 0!==t?t:2,this.getDataMean()+t*this.getDataRms()},getSigmaForValue:function(t){return t=void 0!==t?t:0,(t-this.getDataMean())/this.getDataRms()},filterData:function(t,e,i){isNaN(t)&&this.header&&(t=this.header.DMEAN+2*this.header.ARMS),t=void 0===t||isNaN(t)?-(1/0):t,e=void 0!==e?e:1/0,i=i||!1,this.dataPosition||this.makeDataPosition();var n=this.__dataPosition,r=this.__data;if(t!==this.__minValue||e!=this.__maxValue||i!==this.__outside){if(t===-(1/0)&&e===1/0)this.dataPosition=n,this.data=r;else{var o=r.length;this.__dataBuffer||(this.__dataPositionBuffer=new ArrayBuffer(3*o*4),this.__dataBuffer=new ArrayBuffer(4*o));for(var a=new Float32Array(this.__dataPositionBuffer),s=new Float32Array(this.__dataBuffer),c=0,h=0;h=t&&l<=e||i&&(le)){var d=3*c;a[d+0]=n[u+0],a[d+1]=n[u+1],a[d+2]=n[u+2],s[c]=l,c+=1}}this.dataPosition=new Float32Array(this.__dataPositionBuffer,0,3*c),this.data=new Float32Array(this.__dataBuffer,0,c)}this.__minValue=t,this.__maxValue=e,this.__outside=i}},makeDataPosition:function(){for(var t=this.nz,e=this.ny,i=this.nx,n=new Float32Array(i*e*t*3),r=0,o=0;o.9*e[3*n+n])if(o>0)for(r=0;r<3;++r)t[i+r]-=e[3*n+r];else for(r=0;r<3;++r)t[i+r]+=e[3*n+r];return t}},superpose:function(t){var e,i,n=3*this.indices.length,r=this.coords1,o=this.coords2;for(e=0;e0&&this.params.centerPbc){var r=[e[0],e[4],e[8]],o=this.getCircularMean(this.backboneIndices,i,r);this.centerPbc(i,o,r)}this.params.removePbc&&this.removePbc(i,e)}this.indices.length>0&&this.params.superpose&&this.superpose(i),this.frameCache[t]=i,this.boxCache[t]=e,this.frameCacheSize+=1},setNumframes:function(t){t!==this.numframes&&(this.numframes=t,this.signals.gotNumframes.dispatch(t))},dispose:function(){this.frameCache=[],this._disposed=!0,this.player&&this.player.stop()},setPlayer:function(t){this.player=t,this.signals.playerChanged.dispatch(t)},getPath:function(t,e){mv.error("Trajectory.getPath not implemented",t,e)}},_v.add("shader/Mesh.vert","#define STANDARD\nuniform float nearClip;\nuniform vec3 clipCenter;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\nattribute vec3 pickingColor;\nvarying vec3 vPickingColor;\n#elif defined( NOLIGHT )\nvarying vec3 vColor;\n#else\n#include color_pars_vertex\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#endif\n#include common\nvoid main(){\n#if defined( PICKING )\nvPickingColor = pickingColor;\n#elif defined( NOLIGHT )\nvColor = color;\n#else\n#include color_vertex\n#include beginnormal_vertex\n#include defaultnormal_vertex\n#ifndef FLAT_SHADED\nvNormal = normalize( transformedNormal );\n#endif\n#endif\n#include begin_vertex\n#include project_vertex\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvViewPosition = -mvPosition.xyz;\n#endif\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n}"),_v.add("shader/Mesh.frag","#define STANDARD\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float nearClip;\nuniform float clipRadius;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\nuniform float objectId;\nvarying vec3 vPickingColor;\n#elif defined( NOLIGHT )\nvarying vec3 vColor;\n#else\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#include bsdfs\n#include lights_pars\n#include lights_physical_pars_fragment\n#endif\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\n#if defined( PICKING )\ngl_FragColor = vec4( vPickingColor, objectId );\n#elif defined( NOLIGHT )\ngl_FragColor = vec4( vColor, opacity );\n#else\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\n#include normal_flip\n#include normal_fragment\n#include dull_interior_fragment\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#include opaque_back_fragment\n#endif\n}"), +Ia.prototype={constructor:Ia,parameters:{opaqueBack:{updateShader:!0},dullInterior:{updateShader:!0},side:{updateShader:!0,property:!0},opacity:{uniform:!0},clipNear:{updateShader:!0,property:!0},clipRadius:{updateShader:!0,property:!0,uniform:!0},clipCenter:{uniform:!0},flatShaded:{updateShader:!0},background:{updateShader:!0},linewidth:{property:!0},wireframe:{updateVisibility:!0},roughness:{uniform:!0},metalness:{uniform:!0},diffuse:{uniform:!0}},get transparent(){return this.opacity<1||this.forceTransparent},makeMaterial:function(){var t=Ea(this.side);this.material=new Pt({uniforms:this.uniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:this.transparent,depthWrite:!0,lights:!0,fog:!0,side:t,linewidth:this.linewidth}),this.material.vertexColors=wu,this.material.extensions.derivatives=this.flatShaded,this.material.extensions.fragDepth=this.impostor,this.material.clipNear=this.clipNear,this.wireframeMaterial=new Pt({uniforms:this.uniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:this.transparent,depthWrite:!0,lights:!1,fog:!0,side:t,linewidth:this.linewidth}),this.wireframeMaterial.vertexColors=wu,this.wireframeMaterial.clipNear=this.clipNear,this.pickingMaterial=new Pt({uniforms:this.pickingUniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:!1,depthWrite:!0,lights:!1,fog:!1,side:t,linewidth:this.linewidth}),this.pickingMaterial.vertexColors=wu,this.pickingMaterial.extensions.fragDepth=this.impostor,this.pickingMaterial.clipNear=this.clipNear,this.updateShader()},makeWireframeGeometry:function(){this.makeWireframeIndex();var t=this.geometry,e=this.wireframeIndex,i=new he;i.attributes=t.attributes,e&&(i.setIndex(new Kt(e,1).setDynamic(this.dynamic)),i.setDrawRange(0,this.wireframeIndexCount)),this.wireframeGeometry=i},makeWireframeIndex:function(){function t(t,i){if(t>i){var n=t;t=i,i=n}var r=e[t];return void 0===r?(e[t]=[i],!0):!r.includes(i)&&(r.push(i),!0)}var e=[];return function(){var i=this.geometry.index;if(this.wireframe){if(i){var n=i.array,r=n.length;this.geometry.drawRange.count!==1/0&&(r=this.geometry.drawRange.count);var o;if(this.wireframeIndex&&this.wireframeIndex.length>2*r)o=this.wireframeIndex;else{var a=this.geometry.attributes.position.count,s=a>65535?Uint32Array:Uint16Array;o=new s(2*r)}var c=0;e.length=0;for(var h=0;hthis.wireframeGeometry.index.array.length)this.wireframeGeometry.setIndex(new Kt(this.wireframeIndex,1).setDynamic(this.dynamic));else{var t=this.wireframeGeometry.getIndex();t.set(this.wireframeIndex),t.needsUpdate=this.wireframeIndexCount>0,t.updateRange.count=this.wireframeIndexCount}this.wireframeGeometry.setDrawRange(0,this.wireframeIndexCount)},getRenderOrder:function(){var t=0;return"text"===this.type?t=1:this.transparent&&(t="surface"===this.type?3:2),t},getMesh:function(){var t;return this.material||this.makeMaterial(),this.line?t=new Ve(this.geometry,this.material):this.point?(t=new He(this.geometry,this.material),this.sortParticles&&(t.sortParticles=!0)):t=new Ae(this.geometry,this.material),t.frustumCulled=!1,t.renderOrder=this.getRenderOrder(),t},getWireframeMesh:function(){var t;return this.material||this.makeMaterial(),this.wireframeGeometry||this.makeWireframeGeometry(),t=new Ve(this.wireframeGeometry,this.wireframeMaterial),t.frustumCulled=!1,t.renderOrder=this.getRenderOrder(),t},getPickingMesh:function(){var t;return this.material||this.makeMaterial(),t=new Ae(this.geometry,this.pickingMaterial),t.frustumCulled=!1,t.renderOrder=this.getRenderOrder(),t},getShader:function(t,e){return Pr(t,this.getDefines(e))},getVertexShader:function(t){return this.getShader(this.vertexShader,t)},getFragmentShader:function(t){return this.getShader(this.fragmentShader,t)},getDefines:function(t){var e={};return this.clipNear&&(e.NEAR_CLIP=1),this.clipRadius&&(e.RADIUS_CLIP=1),"picking"===t?e.PICKING=1:(("background"===t||this.background)&&(e.NOLIGHT=1),this.flatShaded&&(e.FLAT_SHADED=1),this.opaqueBack&&(e.OPAQUE_BACK=1),this.dullInterior&&(e.DULL_INTERIOR=1)),e},getParameters:function(){var t={};for(var e in this.parameters)t[e]=this[e];return t},addUniforms:function(t){this.uniforms=Pd.merge([this.uniforms,t]),this.pickingUniforms=Pd.merge([this.pickingUniforms,t])},addAttributes:function(t){var e={f:1,v2:2,v3:3,c:3};for(var i in t){var n,r=t[i];r.value?(this.attributeSize*e[r.type]!==r.value.length&&mv.error("attribute value has wrong length",i),n=r.value):n=new Float32Array(this.attributeSize*e[r.type]),this.geometry.addAttribute(i,new Kt(n,e[r.type]).setDynamic(this.dynamic))}},updateRenderOrder:function(){function t(t){t.renderOrder=e}var e=this.getRenderOrder();this.group.children.forEach(t),this.pickingGroup&&this.pickingGroup.children.forEach(t)},updateShader:function(){var t=this.material,e=this.wireframeMaterial,i=this.pickingMaterial;t.vertexShader=this.getVertexShader(),t.fragmentShader=this.getFragmentShader(),t.needsUpdate=!0,e.vertexShader=this.getShader("Line.vert"),e.fragmentShader=this.getShader("Line.frag"),e.needsUpdate=!0,i.vertexShader=this.getVertexShader("picking"),i.fragmentShader=this.getFragmentShader("picking"),i.needsUpdate=!0},setParameters:function(t){if(t){var e=t,i=this.parameters,n={},r={},o=!1,a=!1;for(var s in e)void 0!==e[s]&&void 0!==i[s]&&(this[s]=e[s],i[s].property&&(i[s].property!==!0?n[i[s].property]=e[s]:n[s]=e[s]),i[s].uniform&&(i[s].uniform!==!0?r[i[s].uniform]=e[s]:r[s]=e[s]),i[s].updateShader&&(o=!0),i[s].updateVisibility&&(a=!0),this.dynamic&&"wireframe"===s&&e[s]===!0&&this.updateWireframeIndex(),"flatShaded"===s&&(this.material.extensions.derivatives=this.flatShaded),"forceTransparent"===s&&(n.transparent=this.transparent));this.setProperties(n),this.setUniforms(r),o&&this.updateShader(),a&&this.setVisibility(this.visible)}},setAttributes:function(t){var e=this.geometry,i=e.attributes;for(var n in t){var r=t[n],o=r.length;if("index"===n){var a=e.getIndex();e.setDrawRange(0,1/0),o>a.array.length?e.setIndex(new Kt(r,1).setDynamic(this.dynamic)):(a.set(r),a.needsUpdate=o>0,a.updateRange.count=o,e.setDrawRange(0,o)),this.indexVersion++,this.wireframe&&this.updateWireframeIndex()}else{var s=i[n];o>s.array.length?e.addAttribute(n,new Kt(r,s.itemSize).setDynamic(this.dynamic)):(i[n].set(r),i[n].needsUpdate=o>0,i[n].updateRange.count=o)}}},setUniforms:function(t){if(t){var e=this.material.uniforms,i=this.wireframeMaterial.uniforms,n=this.pickingMaterial.uniforms;for(var r in t)"opacity"===r&&this.setProperties({transparent:this.transparent}),void 0!==e[r]&&(e[r].value.isVector3?e[r].value.copy(t[r]):e[r].value.set?e[r].value.set(t[r]):e[r].value=t[r]),void 0!==i[r]&&(i[r].value.isVector3?i[r].value.copy(t[r]):i[r].value.set?i[r].value.set(t[r]):i[r].value=t[r]),void 0!==n[r]&&(n[r].value.isVector3?n[r].value.copy(t[r]):n[r].value.set?n[r].value.set(t[r]):n[r].value=t[r])}},setProperties:function(t){if(t){var e=this.material,i=this.wireframeMaterial,n=this.pickingMaterial;for(var r in t){var o=t[r];"transparent"===r?this.updateRenderOrder():"side"===r&&(o=Ea(o)),void 0!==e[r]&&(e[r]=o),void 0!==i[r]&&(i[r]=o),void 0!==n[r]&&(n[r]=o)}e.needsUpdate=!0,i.needsUpdate=!0,n.needsUpdate=!0}},setVisibility:function(t){this.visible=t,this.wireframe?(this.group.visible=!1,this.wireframeGroup.visible=t,this.pickable&&(this.pickingGroup.visible=!1)):(this.group.visible=t,this.wireframeGroup.visible=!1,this.pickable&&(this.pickingGroup.visible=t))},dispose:function(){this.material&&this.material.dispose(),this.wireframeMaterial&&this.wireframeMaterial.dispose(),this.pickingMaterial&&this.pickingMaterial.dispose(),this.geometry.dispose(),this.wireframeGeometry&&this.wireframeGeometry.dispose()}},La.prototype=Object.assign(Object.create(Ia.prototype),{constructor:La}),Na.prototype=Object.assign(Object.create(La.prototype),{constructor:Na,applyPositionTransform:function(){},setAttributes:function(){var t=new O,e=new Lt;return function(i){var n,r,o,a,s,c,h,u,l,d,f,p=this.geometry.attributes;i.position&&(n=i.position,a=this.geoPosition,u=this.meshPosition,c=this.transformedGeoPosition,p.position.needsUpdate=!0),i.color&&(r=i.color,l=this.meshColor,p.color.needsUpdate=!0),i.pickingColor&&(o=i.pickingColor,d=this.meshPickingColor,p.pickingColor.needsUpdate=!0);var m=!(!this.updateNormals||!n),g=!(!this.initNormals||!n);(m||g)&&(s=this.geoNormal,f=this.meshNormal,h=this.transformedGeoNormal,p.normal.needsUpdate=!0);for(var v=this.positionCount,y=this.geoPositionCount,b=0;b 0.0 ){\ncameraPos = rayDirection * posT + rayOrigin;\ninterior = true;\nflag2 = true;\nreturn false;\n}else{\ncameraNormal = normalize( cameraPos - cameraSpherePos );\n}\n#else\nif( calcDepth( cameraPos ) <= 0.0 ){\ncameraPos = rayDirection * posT + rayOrigin;\ninterior = true;\nreturn false;\n}else{\ncameraNormal = normalize( cameraPos - cameraSpherePos );\n}\n#endif\nreturn true;\n}\nreturn false;\n}\nvoid main(void){\nbool flag = Impostor( cameraPos, cameraNormal );\n#ifdef NEAR_CLIP\nif( calcClip( cameraPos ) > 0.0 )\ndiscard;\n#endif\ngl_FragDepthEXT = calcDepth( cameraPos );\nif( !flag ){\n#ifdef NEAR_CLIP\nif( flag2 ){\ngl_FragDepthEXT = max( 0.0, calcDepth( vec3( - ( nearClip - 0.5 ) ) ) + ( 0.0000001 / vRadius ) );\n}else if( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n#else\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n#endif\n}\nif (gl_FragDepthEXT < 0.0)\ndiscard;\nif (gl_FragDepthEXT > 1.0)\ndiscard;\n#ifdef PICKING\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\nvec3 vNormal = cameraNormal;\nvec3 vViewPosition = -cameraPos;\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\n#include normal_flip\n#include normal_fragment\nif( interior ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}"),Fa.prototype=Object.assign(Object.create(Ia.prototype),{constructor:Fa,setAttributes:function(t){var e,i,n,r,o,a,s,c=this.count,h=this.mappingSize,u=this.geometry.attributes;for(var l in t){i=t[l],e=u[l],n=e.itemSize,r=e.array;for(var d=0;d radius2)\ndiscard;\n#ifdef CAP\nnew_point = front_point;\n_normal = axis;\n#else\nnew_point = ray_target + ( (-a1 - sqrt(d)) / a2 ) * ray_direction;\ndNV = dot(-axis, ray_direction);\nnear = dot(axis, end_cyl) / dNV;\nnew_point2 = ray_direction * near + ray_origin;\nif (dot(new_point2 - end_cyl, new_point2-base) < radius2)\ndiscard;\ninterior = true;\n#endif\n}\nif( end_cap_test > 0.0 )\n{\nfloat dNV = dot(axis, ray_direction);\nif (dNV < 0.0)\ndiscard;\nfloat near = dot(axis, end_cyl) / dNV;\nvec3 end_point = ray_direction * near + ray_origin;\nif( dot(end_point - end_cyl, end_point-base) > radius2 )\ndiscard;\n#ifdef CAP\nnew_point = end_point;\n_normal = axis;\n#else\nnew_point = ray_target + ( (-a1 - sqrt(d)) / a2 ) * ray_direction;\ndNV = dot(-axis, ray_direction);\nnear = dot(-axis, (base)) / dNV;\nnew_point2 = ray_direction * near + ray_origin;\nif (dot(new_point2 - base, new_point2-base) < radius2)\ndiscard;\ninterior = true;\n#endif\n}\ngl_FragDepthEXT = calcDepth( new_point );\n#ifdef NEAR_CLIP\nif( calcClip( new_point ) > 0.0 ){\ndist = (-a1 - sqrt(d)) / a2;\nnew_point = ray_target + dist * ray_direction;\nif( calcClip( new_point ) > 0.0 )\ndiscard;\ninterior = true;\ngl_FragDepthEXT = calcDepth( new_point );\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = max( 0.0, calcDepth( vec3( - ( nearClip - 0.5 ) ) ) + ( 0.0000001 / vRadius ) );\n}\n}else if( gl_FragDepthEXT <= 0.0 ){\ndist = (-a1 - sqrt(d)) / a2;\nnew_point = ray_target + dist * ray_direction;\ninterior = true;\ngl_FragDepthEXT = calcDepth( new_point );\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n}\n#else\nif( gl_FragDepthEXT <= 0.0 ){\ndist = (-a1 - sqrt(d)) / a2;\nnew_point = ray_target + dist * ray_direction;\ninterior = true;\ngl_FragDepthEXT = calcDepth( new_point );\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / vRadius );\n}\n}\n#endif\nif (gl_FragDepthEXT < 0.0)\ndiscard;\nif (gl_FragDepthEXT > 1.0)\ndiscard;\n#ifdef PICKING\nif( distSq3( new_point, end_cyl ) < distSq3( new_point, base ) ){\nif( b < 0.0 ){\ngl_FragColor = vec4( vPickingColor, objectId );\n}else{\ngl_FragColor = vec4( vPickingColor2, objectId );\n}\n}else{\nif( b > 0.0 ){\ngl_FragColor = vec4( vPickingColor, objectId );\n}else{\ngl_FragColor = vec4( vPickingColor2, objectId );\n}\n}\n#else\nvec3 vViewPosition = -new_point;\nvec3 vNormal = _normal;\nvec3 vColor;\nif( distSq3( new_point, end_cyl ) < distSq3( new_point, base ) ){\nif( b < 0.0 ){\nvColor = vColor1;\n}else{\nvColor = vColor2;\n}\n}else{\nif( b > 0.0 ){\nvColor = vColor1;\n}else{\nvColor = vColor2;\n}\n}\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\nvec3 normal = normalize( vNormal );\nif( interior ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}"),Ga.prototype=Object.assign(Object.create(Fa.prototype),{constructor:Ga}),Ha.prototype=Object.assign(Object.create(Ga.prototype),{constructor:Ha,parameters:Object.assign({openEnded:{updateShader:!0}},Ga.prototype.parameters),getDefines:function(t){var e=Ga.prototype.getDefines.call(this,t);return this.openEnded||(e.CAP=1),e},setAttributes:function(t){t&&t.position1&&t.position2&&(t.position=Er(t.position1,t.position2)),Ga.prototype.setAttributes.call(this,t)}}),Xa.prototype=Object.assign(Object.create(Na.prototype),{constructor:Xa,applyPositionTransform:function(){var t,e=new N,i=new N,n=new N,r=new N(0,1,0);return function(o,a,s){i.fromArray(this._from,s),n.fromArray(this._to,s),o.lookAt(i,n,r),t=this._radius[a],e.set(t,t,i.distanceTo(n)),o.scale(e)}}(),setAttributes:function(t){var e={};t.position1&&t.position2&&(Er(t.position1,t.position2,this._position),this._from.set(t.position1),this._to.set(t.position2),e.position=this._position),t.color&&(e.color=t.color),t.pickingColor&&(e.pickingColor=t.pickingColor),t.radius&&this._radius.set(t.radius),Na.prototype.setAttributes.call(this,e)}}),Za.prototype.constructor=Za,Za.prototype.type="Shape",Ka.prototype={constructor:Ka,type:"",parameters:{lazy:{type:"boolean"},clipNear:{type:"range",step:1,max:100,min:0,buffer:!0},clipRadius:{type:"number",precision:1,max:1e3,min:0,buffer:!0},clipCenter:{type:"vector3",precision:1,buffer:!0},flatShaded:{type:"boolean",buffer:!0},opacity:{type:"range",step:.01,max:1,min:0,buffer:!0},side:{type:"select",buffer:!0,options:{front:"front",back:"back",double:"double"}},wireframe:{type:"boolean",buffer:!0},linewidth:{type:"integer",max:50,min:1,buffer:!0},colorScheme:{type:"select",update:"color",options:yv.getTypes()},colorScale:{type:"select",update:"color",options:yv.getScales()},colorValue:{type:"color",update:"color"},colorDomain:{type:"hidden",update:"color"},colorMode:{type:"select",update:"color",options:yv.getModes()},roughness:{type:"range",step:.01,max:1,min:0,buffer:!0},metalness:{type:"range",step:.01,max:1,min:0,buffer:!0},diffuse:{type:"color",buffer:!0}},init:function(t){var e=t||{};this.clipNear=d(e.clipNear,0),this.clipRadius=d(e.clipRadius,0),this.clipCenter=d(e.clipCenter,new N),this.flatShaded=d(e.flatShaded,!1),this.side=d(e.side,"double"),this.opacity=d(e.opacity,1),this.wireframe=d(e.wireframe,!1),this.linewidth=d(e.linewidth,2),this.setColor(e.color,e),this.colorScheme=d(e.colorScheme,"uniform"),this.colorScale=d(e.colorScale,""),this.colorValue=d(e.colorValue,9474192),this.colorDomain=d(e.colorDomain,""),this.colorMode=d(e.colorMode,"hcl"),this.visible=d(e.visible,!0),this.quality=d(e.quality,void 0),this.roughness=d(e.roughness,.4),this.metalness=d(e.metalness,0),this.diffuse=d(e.diffuse,16777215),this.lazy=d(e.lazy,!1),this.lazyProps={build:!1,bufferParams:{},what:{}};var i=this.parameters;i.sphereDetail===!0&&(i.sphereDetail={type:"integer",max:3,min:0,rebuild:"impostor"}),i.radialSegments===!0&&(i.radialSegments={type:"integer",max:25,min:5,rebuild:"impostor"}),i.openEnded===!0&&(i.openEnded={type:"boolean",rebuild:"impostor",buffer:!0}),i.disableImpostor===!0&&(i.disableImpostor={type:"boolean",rebuild:!0}),"low"===e.quality?(i.sphereDetail&&(this.sphereDetail=0),i.radialSegments&&(this.radialSegments=5)):"medium"===e.quality?(i.sphereDetail&&(this.sphereDetail=1),i.radialSegments&&(this.radialSegments=10)):"high"===e.quality?(i.sphereDetail&&(this.sphereDetail=2),i.radialSegments&&(this.radialSegments=20)):(i.sphereDetail&&(this.sphereDetail=d(e.sphereDetail,1)),i.radialSegments&&(this.radialSegments=d(e.radialSegments,10))),i.openEnded&&(this.openEnded=d(e.openEnded,!0)),i.disableImpostor&&(this.disableImpostor=d(e.disableImpostor,!1))},getColorParams:function(){return{gidPool:this.gidPool,scheme:this.colorScheme,scale:this.colorScale,value:this.colorValue,domain:this.colorDomain,mode:this.colorMode}},getBufferParams:function(t){return Object.assign({clipNear:this.clipNear,clipRadius:this.clipRadius,clipCenter:this.clipCenter,flatShaded:this.flatShaded,opacity:this.opacity,side:this.side,wireframe:this.wireframe,linewidth:this.linewidth,roughness:this.roughness,metalness:this.metalness,diffuse:this.diffuse},t)},setColor:function(t,e){var i=Object.keys(yv.getTypes());return i.includes(t)?e?e.colorScheme=t:this.setParameters({colorScheme:t}):void 0!==t&&(t=new Ct(t).getHex(),e?(e.colorScheme="uniform",e.colorValue=t):this.setParameters({colorScheme:"uniform",colorValue:t})),this},prepare:!1,create:function(){},update:function(){this.build()},build:function(t){return this.lazy&&!this.visible?void(this.lazyProps.build=!0):this.prepare?(this.queue.length()>0?(this.tasks.change(1-this.queue.length()),this.queue.kill()):this.tasks.increment(),void this.queue.push(t||!1)):(this.tasks.increment(),void this.make())},make:function(e,i){t.Debug&&mv.time("Representation.make "+this.type);var n=function(){e?(this.update(e),this.viewer.requestRender(),this.tasks.decrement(),i&&i()):(this.clear(),this.create(),this.manualAttach||this.disposed||(t.Debug&&mv.time("Representation.attach "+this.type),this.attach(function(){t.Debug&&mv.timeEnd("Representation.attach "+this.type),this.tasks.decrement(),i&&i()}.bind(this)))),t.Debug&&mv.timeEnd("Representation.make "+this.type)}.bind(this);this.prepare?this.prepare(n):n()},attach:function(t){this.setVisibility(this.visible),t()},setVisibility:function(t,e){if(this.visible=t,this.visible){var i=this.lazyProps;if(i.build)return i.build=!1,void this.build();(i.bufferParams||i.what)&&this.updateParameters(i.bufferParams,i.what)}return this.bufferList.forEach(function(e){e.setVisibility(t)}),e||this.viewer.requestRender(),this},setParameters:function(t,e,i){var n=t||{},r=this.parameters;e=e||{},i=i||!1;var o={};for(var a in n)void 0!==n[a]&&void 0!==r[a]&&(r[a].int&&(n[a]=parseInt(n[a])),r[a].float&&(n[a]=parseFloat(n[a])),n[a]!==this[a]&&(this[a]=n[a],r[a].buffer&&(r[a].buffer===!0?o[a]=n[a]:o[r[a].buffer]=n[a]), +r[a].update&&(e[r[a].update]=!0),!r[a].rebuild||"impostor"===r[a].rebuild&&pv&&!this.disableImpostor||(i=!0)));return i?this.build():this.updateParameters(o,e),this},updateParameters:function(t,e){return this.lazy&&!this.visible?(Object.assign(this.lazyProps.bufferParams,t),void Object.assign(this.lazyProps.what,e)):(this.bufferList.forEach(function(e){e.setParameters(t)}),Object.keys(e).length&&this.update(e),void this.viewer.requestRender())},getParameters:function(){var t={lazy:this.lazy,visible:this.visible,quality:this.quality};return Object.keys(this.parameters).forEach(function(e){"button"===this.parameters.type?t[e]=this[e].bind(this):t[e]=this[e]},this),t},clear:function(){this.bufferList.forEach(function(t){this.viewer.remove(t),t.dispose()},this),this.bufferList.length=0,this.viewer.requestRender()},dispose:function(){this.disposed=!0,this.queue.kill(),this.tasks.dispose(),this.clear()}},Qa.prototype=Object.assign(Object.create(Ka.prototype),{constructor:Qa,type:"buffer",parameters:Object.assign({},Ka.prototype.parameters,{colorScheme:null,colorScale:null,colorValue:null,colorDomain:null,colorMode:null}),create:function(){this.bufferList.push.apply(this.bufferList,this.buffer)},attach:function(t){this.bufferList.forEach(function(t){this.viewer.add(t),t.setParameters(this.getBufferParams())},this),this.setVisibility(this.visible),t()}}),Ja.prototype=Object.assign(Object.create(La.prototype),{constructor:Ja,type:"surface"}),ts.prototype.constructor=ts,es.prototype=Object.assign(Object.create(Ka.prototype),{constructor:es,type:"surface",parameters:Object.assign({isolevelType:{type:"select",options:{value:"value",sigma:"sigma"}},isolevel:{type:"number",precision:2,max:1e3,min:-1e3},smooth:{type:"integer",precision:1,max:10,min:0},background:{type:"boolean",rebuild:!0},opaqueBack:{type:"boolean",buffer:!0},boxSize:{type:"integer",precision:1,max:100,min:0},useWorker:{type:"boolean",rebuild:!0}},Ka.prototype.parameters),init:function(t){var e=t||{};e.colorScheme=d(e.colorScheme,"uniform"),e.colorValue=d(e.colorValue,14540253),this.isolevelType=d(e.isolevelType,"sigma"),this.isolevel=d(e.isolevel,2),this.smooth=d(e.smooth,0),this.background=d(e.background,!1),this.opaqueBack=d(e.opaqueBack,!0),this.boxSize=d(e.boxSize,0),this.useWorker=d(e.useWorker,!0),Ka.prototype.init.call(this,e)},attach:function(t){this.bufferList.forEach(function(t){this.viewer.add(t)},this),this.setVisibility(this.visible),t()},prepare:function(t){if(this.volume){var e;if(e="sigma"===this.isolevelType?this.volume.getValueForSigma(this.isolevel):this.isolevel,!this.surface||this.__isolevel!==e||this.__smooth!==this.smooth||this.__boxSize!==this.boxSize||this.boxSize>0&&!this.__boxCenter.equals(this.boxCenter)){this.__isolevel=e,this.__smooth=this.smooth,this.__boxSize=this.boxSize,this.__boxCenter.copy(this.boxCenter),this.__box.copy(this.box);var i=function(e){this.surface=e,t()}.bind(this);this.useWorker?this.volume.getSurfaceWorker(e,this.smooth,this.boxCenter,this.boxSize,i):i(this.volume.getSurface(e,this.smooth,this.boxCenter,this.boxSize))}else t()}else t()},create:function(){var t=new Ja(this.surface.getPosition(),this.surface.getColor(this.getColorParams()),this.surface.getIndex(),this.surface.getNormal(),void 0,this.getBufferParams({background:this.background,opaqueBack:this.opaqueBack,dullInterior:!1})),e=new ts(t);this.bufferList.push(e)},update:function(t){if(0!==this.bufferList.length){t=t||{};var e={};t.position&&(e.position=this.surface.getPosition()),t.color&&(e.color=this.surface.getColor(this.getColorParams())),t.index&&(e.index=this.surface.getIndex()),t.normal&&(e.normal=this.surface.getNormal()),this.bufferList.forEach(function(t){t.setAttributes(e)})}},setParameters:function(t,e,i){return t&&void 0!==t.isolevelType&&this.volume&&("value"===this.isolevelType&&"sigma"===t.isolevelType?this.isolevel=this.volume.getSigmaForValue(this.isolevel):"sigma"===this.isolevelType&&"value"===t.isolevelType&&(this.isolevel=this.volume.getValueForSigma(this.isolevel)),this.isolevelType=t.isolevelType),t&&t.boxCenter&&(this.boxCenter.copy(t.boxCenter),delete t.boxCenter),Ka.prototype.setParameters.call(this,t,e,i),this.volume&&this.volume.getBox(this.boxCenter,this.boxSize,this.box),this.surface&&(void 0!==t.isolevel||void 0!==t.smooth||void 0!==t.boxSize||this.boxSize>0&&!this.__box.equals(this.box))&&this.build({position:!0,color:!0,index:!0,normal:!0}),this},dispose:function(){this.viewer.signals.orientationChanged.remove(this.setBox),Ka.prototype.dispose.call(this)}}),_v.add("shader/Point.vert","uniform float nearClip;\nuniform float clipRadius;\nuniform vec3 clipCenter;\nuniform float size;\nuniform float canvasHeight;\nuniform float pixelRatio;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#include color_pars_vertex\n#include common\nvoid main(){\n#include color_vertex\n#include begin_vertex\n#include project_vertex\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * pixelRatio * ( ( canvasHeight / 2.0 ) / -mvPosition.z );\n#else\ngl_PointSize = size * pixelRatio;\n#endif\nvViewPosition = -mvPosition.xyz;\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n#include radiusclip_vertex\n}"),_v.add("shader/Point.frag","uniform vec3 diffuse;\nuniform float opacity;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#ifdef USE_MAP\nuniform sampler2D map;\n#endif\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\nvec3 outgoingLight = vec3( 0.0 );\nvec4 diffuseColor = vec4( diffuse, 1.0 );\n#ifdef USE_MAP\ndiffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) );\n#endif\n#include color_fragment\n#include alphatest_fragment\noutgoingLight = diffuseColor.rgb;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a * opacity );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n}"),ns.prototype=Object.assign(Object.create(Ia.prototype),{constructor:ns,parameters:Object.assign({pointSize:{uniform:"size"},sizeAttenuation:{updateShader:!0},sortParticles:{},alphaTest:{updateShader:!0},useTexture:{updateShader:!0},forceTransparent:{},edgeBleach:{uniform:!0}},Ia.prototype.parameters),makeMaterial:function(){Ia.prototype.makeMaterial.call(this),this.makeTexture(),this.material.uniforms.map.value=this.tex,this.material.blending=Su,this.material.needsUpdate=!0,this.wireframeMaterial.uniforms.map.value=this.tex,this.wireframeMaterial.blending=Su,this.wireframeMaterial.needsUpdate=!0,this.pickingMaterial.uniforms.map.value=this.tex,this.pickingMaterial.blending=Su,this.pickingMaterial.needsUpdate=!0},makeTexture:function(){this.tex&&this.tex.dispose(),this.tex=is({delta:this.edgeBleach})},getDefines:function(t){var e=Ia.prototype.getDefines.call(this,t);return this.sizeAttenuation&&(e.USE_SIZEATTENUATION=1),this.useTexture&&(e.USE_MAP=1),this.alphaTest>0&&this.alphaTest<=1&&(e.ALPHATEST=this.alphaTest.toPrecision(2)),e},setUniforms:function(t){t&&void 0!==t.edgeBleach&&(this.makeTexture(),t.map=this.tex),Ia.prototype.setUniforms.call(this,t)},dispose:function(){Ia.prototype.dispose.call(this),this.tex&&this.tex.dispose()}}),rs.prototype=Object.assign(Object.create(Ka.prototype),{constructor:rs,type:"dot",parameters:Object.assign({thresholdType:{type:"select",rebuild:!0,options:{value:"value",sigma:"sigma"}},thresholdMin:{type:"number",precision:3,max:1/0,min:-(1/0),rebuild:!0},thresholdMax:{type:"number",precision:3,max:1/0,min:-(1/0),rebuild:!0},thresholdOut:{type:"boolean",rebuild:!0},dotType:{type:"select",rebuild:!0,options:{"":"",sphere:"sphere",point:"point"}},radiusType:{type:"select",options:{"":"",value:"value","abs-value":"abs-value","value-min":"value-min",deviation:"deviation",size:"size"}},radius:{type:"number",precision:3,max:10,min:.001,property:"size"},scale:{type:"number",precision:3,max:10,min:.001},sphereDetail:!0,disableImpostor:!0,pointSize:{type:"number",precision:1,max:100,min:0,buffer:!0},sizeAttenuation:{type:"boolean",buffer:!0},sortParticles:{type:"boolean",rebuild:!0},useTexture:{type:"boolean",buffer:!0},alphaTest:{type:"range",step:.001,max:1,min:0,buffer:!0},forceTransparent:{type:"boolean",buffer:!0},edgeBleach:{type:"range",step:.001,max:1,min:0,buffer:!0}},Ka.prototype.parameters,{colorScheme:{type:"select",update:"color",options:{"":"",value:"value",uniform:"uniform"}}}),defaultSize:.1,init:function(t){var e=t||{};e.colorScheme=d(e.colorScheme,"uniform"),e.colorValue=d(e.colorValue,14540253),this.thresholdType=d(e.thresholdType,"sigma"),this.thresholdMin=d(e.thresholdMin,2),this.thresholdMax=d(e.thresholdMax,1/0),this.thresholdOut=d(e.thresholdOut,!1),this.dotType=d(e.dotType,"point"),this.radius=d(e.radius,.1),this.scale=d(e.scale,1),this.pointSize=d(e.pointSize,1),this.sizeAttenuation=d(e.sizeAttenuation,!0),this.sortParticles=d(e.sortParticles,!1),this.useTexture=d(e.useTexture,!1),this.alphaTest=d(e.alphaTest,.5),this.forceTransparent=d(e.forceTransparent,!1),this.edgeBleach=d(e.edgeBleach,0),Ka.prototype.init.call(this,e)},attach:function(t){this.bufferList.forEach(function(t){this.viewer.add(t)},this),this.setVisibility(this.visible),t()},create:function(){var t,e,i,n;if(this.volume){var r,o,a=this.volume;"sigma"===this.thresholdType?(r=a.getValueForSigma(this.thresholdMin),o=a.getValueForSigma(this.thresholdMax)):(r=this.thresholdMin,o=this.thresholdMax),a.filterData(r,o,this.thresholdOut),t=a.getDataPosition(),e=a.getDataColor(this.getColorParams()),i=a.getDataSize(this.radius,this.scale),n=a.getPickingDataColor(this.getColorParams())}else{var s=this.surface;t=s.getPosition(),e=s.getColor(this.getColorParams()),i=s.getSize(this.radius,this.scale),n=s.getPickingColor(this.getColorParams())}"sphere"===this.dotType?this.dotBuffer=new Ua(t,e,i,n,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!1})):this.dotBuffer=new ns(t,e,this.getBufferParams({pointSize:this.pointSize,sizeAttenuation:this.sizeAttenuation,sortParticles:this.sortParticles,useTexture:this.useTexture,alphaTest:this.alphaTest,forceTransparent:this.forceTransparent,edgeBleach:this.edgeBleach})),this.bufferList.push(this.dotBuffer)},update:function(t){if(0!==this.bufferList.length){t=t||{};var e={};t.color&&(this.volume?e.color=this.volume.getDataColor(this.getColorParams()):e.color=this.surface.getColor(this.getColorParams())),"sphere"===this.dotType&&(t.radius||t.scale)&&(this.volume?e.radius=this.volume.getDataSize(this.radius,this.scale):e.radius=this.surface.getSize(this.radius,this.scale)),this.dotBuffer.setAttributes(e)}},setParameters:function(t,e,i){return e=e||{},t&&void 0!==t.thresholdType&&this.volume instanceof Ma&&("value"===this.thresholdType&&"sigma"===t.thresholdType?(this.thresholdMin=this.volume.getSigmaForValue(this.thresholdMin),this.thresholdMax=this.volume.getSigmaForValue(this.thresholdMax)):"sigma"===this.thresholdType&&"value"===t.thresholdType&&(this.thresholdMin=this.volume.getValueForSigma(this.thresholdMin),this.thresholdMax=this.volume.getValueForSigma(this.thresholdMax)),this.thresholdType=t.thresholdType),t&&void 0!==t.radiusType&&("radius"===t.radiusType?this.radius=this.defaultSize:this.radius=t.radiusType,e.radius=!0,"sphere"!==this.dotType||pv&&!this.disableImpostor||(i=!0)),t&&void 0!==t.radius&&(e.radius=!0,"sphere"!==this.dotType||pv&&!this.disableImpostor||(i=!0)),t&&void 0!==t.scale&&(e.scale=!0,"sphere"!==this.dotType||pv&&!this.disableImpostor||(i=!0)),Ka.prototype.setParameters.call(this,t,e,i),this}}),os.prototype=Object.assign(Object.create(Ka.prototype),{constructor:os,type:"structure",parameters:Object.assign({radiusType:{type:"select",options:$r.types},radius:{type:"number",precision:3,max:10,min:.001},scale:{type:"number",precision:3,max:10,min:.001},assembly:null,defaultAssembly:{type:"hidden"}},Ka.prototype.parameters),defaultScale:{vdw:1,covalent:1,bfactor:.01,sstruc:1},defaultSize:1,init:function(t){var e=t||{};if(e.colorScheme=d(e.colorScheme,"element"),this.radius=d(e.radius,"vdw"),this.scale=d(e.scale,1),this.assembly=d(e.assembly,"default"),this.defaultAssembly=d(e.defaultAssembly,""),"auto"===e.quality){var i,n=this.structureView,r=this.getAssembly();i=r?r.getAtomCount(n):n.atomCount,dv&&(i*=4);var o=n.atomStore.count/n.residueStore.count<2;o&&(i*=10),i<15e3?e.quality="high":i<8e4?e.quality="medium":e.quality="low"}Ka.prototype.init.call(this,e)},getAssembly:function(){var t="default"===this.assembly?this.defaultAssembly:this.assembly;return this.structure.biomolDict[t]},create:function(){if(0!==this.structureView.atomCount){var t=this.getAssembly();if(t)t.partList.forEach(function(t,e){var i=t.getView(this.structureView);if(0!==i.atomCount){var n=this.createData(i,e);n&&(n.sview=i,n.instanceList=t.getInstanceList(),this.dataList.push(n))}},this);else{var e=this.createData(this.structureView,0);e&&(e.sview=this.structureView,this.dataList.push(e))}}},createData:function(){console.error("createData not implemented")},update:function(t){return this.lazy&&!this.visible?void Object.assign(this.lazyProps.what,t):void this.dataList.forEach(function(e){e.bufferList.length>0&&this.updateData(t,e)},this)},updateData:function(){console.error("updateData not implemented")},getColorParams:function(){var t=Ka.prototype.getColorParams.call(this);return t.structure=this.structure,t},getAtomParams:function(t,e){return Object.assign({what:t,colorParams:this.getColorParams(),radiusParams:{radius:this.radius,scale:this.scale}},e)},getBondParams:function(t,e){return Object.assign({what:t,colorParams:this.getColorParams(),radiusParams:{radius:this.radius,scale:this.scale}},e)},setSelection:function(t,e){return this.selection.setString(t,e),this},setParameters:function(t,e,i){return e=e||{},t&&void 0!==t.radiusType&&("size"===t.radiusType?this.radius=this.defaultSize:this.radius=t.radiusType,e.radius=!0,pv&&!this.disableImpostor||(i=!0)),t&&void 0!==t.radius&&(e.radius=!0,pv&&!this.disableImpostor||(i=!0)),t&&void 0!==t.scale&&(e.radius=!0,pv&&!this.disableImpostor||(i=!0)),t&&void 0!==t.defaultAssembly&&(i=!0),Ka.prototype.setParameters.call(this,t,e,i),this},getParameters:function(){var t=Object.assign(Ka.prototype.getParameters.call(this),{sele:this.selection?this.selection.string:void 0,defaultAssembly:this.defaultAssembly});return t},attach:function(t){var e=this.viewer,i=this.bufferList;this.dataList.forEach(function(t){t.bufferList.forEach(function(n){i.push(n),e.add(n,t.instanceList)})}),this.setVisibility(this.visible),t()},clear:function(){this.dataList.length=0,Ka.prototype.clear.call(this)},dispose:function(){this.structureView.dispose(),delete this.structure,delete this.structureView,Ka.prototype.dispose.call(this)}}),_v.add("shader/Line.vert","uniform float nearClip;\nuniform vec3 clipCenter;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#include color_pars_vertex\nvoid main(){\n#include color_vertex\n#include begin_vertex\n#include project_vertex\nvViewPosition = -mvPosition.xyz;\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n}"),_v.add("shader/Line.frag","uniform float opacity;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec3 vViewPosition;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\ngl_FragColor = vec4( vColor, opacity );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n}"),as.prototype=Object.assign(Object.create(Ia.prototype),{constructor:as,setAttributes:function(t){var e,i,n,r,o,a,s=this.geometry.attributes;t.from&&t.to&&(e=t.from,i=t.to,o=s.position.array,s.position.needsUpdate=!0),t.color&&t.color2&&(n=t.color,r=t.color2,a=s.color.array,s.color.needsUpdate=!0);for(var c,h,u,l,d,f,p,m,g,v,y,b,x=this.size,w=6*x,_=0;_0&&(n="( "+e.join(" ) AND ( ")+" )"),new On(n)},getStructure:function(){return this.structure.getStructure()},eachBond:function(t,e){this.structure.eachBond(t,this.getSelection(e))},eachAtom:function(t,e){var i=this.getAtomProxy(),n=this.getAtomSet(e),r=this.atomStore.count;if(n&&n.size()=this.V[i][n]&&this.S[i][n]>=this.V[i][n]?(r="S",this.score=this.S[i][n]):this.V[i][n]>=this.H[i][n]?(r="V",this.score=this.V[i][n]):(r="H",this.score=this.H[i][n]),t.Debug&&mv.log("Alignment: SCORE",this.score),t.Debug&&mv.log("Alignment: S, V, H",this.S[i][n],this.V[i][n],this.H[i][n]);i>0&&n>0;)"S"===r?this.S[i][n]===this.S[i-1][n-1]+e(i-1,n-1)?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2=this.seq2[n-1]+this.ali2,--i,--n,r="S"):this.S[i][n]===this.V[i][n]?r="V":this.S[i][n]===this.H[i][n]?r="H":(--i,--n):"V"===r?this.V[i][n]===this.V[i-1][n]+this.gapExtensionPenalty?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i,r="V"):this.V[i][n]===this.S[i-1][n]+this.gap(0)?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i,r="S"):--i:"H"===r?this.H[i][n]===this.H[i][n-1]+this.gapExtensionPenalty?(this.ali1="-"+this.ali1,this.ali2=this.seq2[n-1]+this.ali2,--n,r="H"):this.H[i][n]===this.S[i][n-1]+this.gap(0)?(this.ali1="-"+this.ali1,this.ali2=this.seq2[n-1]+this.ali2,--n,r="S"):--n:mv.error("Alignment: no matrix");for(;i>0;)this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i;for(;n>0;)this.ali1="-"+this.ali1,this.ali2=this.seq2[n-1]+this.ali2,--n;t.Debug&&mv.timeEnd("Alignment.trace"),t.Debug&&mv.log([this.ali1,this.ali2])}},_s.prototype=Object.assign(Object.create(hs.prototype),{constructor:_s,type:"structure",signals:Object.assign({trajectoryAdded:null,trajectoryRemoved:null,defaultAssemblyChanged:null},hs.prototype.signals),initSelection:function(t){this.selection=new On(t),this.structureView=new bs(this.structure,this.selection),this.selection.signals.stringChanged.add(function(){this.structureView.setSelection(this.selection),this.rebuildRepresentations(),this.rebuildTrajectories()},this)},setSelection:function(t){return this.selection.setString(t),this},setDefaultAssembly:function(t){this.defaultAssembly=t,this.reprList.forEach(function(t){t.setParameters({defaultAssembly:this.defaultAssembly})},this),this.signals.defaultAssemblyChanged.dispatch(t)},rebuildRepresentations:function(){this.reprList.forEach(function(t){t.build()})},rebuildTrajectories:function(){this.trajList.slice().forEach(function(t){t.trajectory.setStructure(this.structureView)},this)},addRepresentation:function(t,e){var i=e||{};return i.defaultAssembly=this.defaultAssembly,hs.prototype.addRepresentation.call(this,t,this.structureView,i)},addTrajectory:function(t,e,i){var n={i:i},r=ys(t,this.structureView,e);r.signals.frameChanged.add(function(){this.updateRepresentations({position:!0})},this);var o=new ps(this.stage,r,n,this);return this.trajList.push(o),this.signals.trajectoryAdded.dispatch(o),o},removeTrajectory:function(t){var e=this.trajList.indexOf(t);e!==-1&&this.trajList.splice(e,1),t.dispose(),this.signals.trajectoryRemoved.dispatch(t)},dispose:function(){this.stage.gidPool.removeObject(this.structure),this.trajList.slice().forEach(function(t){t.dispose()}),this.trajList.length=0,this.structure.dispose(),hs.prototype.dispose.call(this)},centerView:function(t,e){t=d(t,!0);var i=this.getCenter(e);if(t){var n;n=e?this.structureView.getBoundingBox(new On(e)):this.structureView.boundingBox;var r=n.size(),o=Math.max(r.x,r.y,r.z),a=Math.min(r.x,r.y,r.z);t=Math.max(1,o+a/2)}return this.viewer.centerView(t,i),this},getCenter:function(t){return t?this.structure.atomCenter(new On(t)):this.structure.center},superpose:function(t,e,i,n){return ws(this.structureView,t.structureView,e,i,n),this.updateRepresentations({position:!0}),this},setVisibility:function(t){return hs.prototype.setVisibility.call(this,t),this.trajList.forEach(function(e){e.setVisibility(t)}),this}}),Ss.prototype=Object.assign(Object.create(hs.prototype),{constructor:Ss,type:"surface",addRepresentation:function(t,e){return hs.prototype.addRepresentation.call(this,t,this.surface,e)},dispose:function(){"Volume"===this.surface.type&&this.stage.gidPool.addObject(this.surface),this.surface.dispose(),hs.prototype.dispose.call(this)},centerView:function(t){var e=this.surface.center;t&&(t=this.surface.boundingBox.size().length()),this.viewer.centerView(t,e)}}),As.prototype=Object.assign(Object.create(hs.prototype),{constructor:As,type:"shape",addRepresentation:function(t,e){return hs.prototype.addRepresentation.call(this,t,this.shape,e)},centerView:function(t){t=d(t,!0);var e=this.getCenter();if(t){var i=this.shape.boundingBox,n=i.size(),r=Math.max(n.x,n.y,n.z),o=Math.min(n.x,n.y,n.z);t=Math.max(1,r+o/2)}return this.viewer.centerView(t,e),this},getCenter:function(){return this.shape.center},dispose:function(){this.shape.dispose(),hs.prototype.dispose.call(this)}}),Ms.prototype=Object.assign(Object.create(hs.prototype),{constructor:Ms,type:"script",addRepresentation:function(){},removeRepresentation:function(){},run:function(){var t=this;this.setStatus("running"),this.script.call(this.stage,function(){t.setStatus("finished")}),this.setStatus("called")},dispose:function(){this.signals.disposed.dispatch()},setVisibility:function(){},getCenter:function(){}}),Cs.prototype={constructor:Cs,parameters:{backgroundColor:{type:"color"},quality:{type:"select",options:{auto:"auto",low:"low",medium:"medium",high:"high"}},sampleLevel:{type:"range",step:1,max:5,min:-1},impostor:{type:"boolean"},rotateSpeed:{type:"number",precision:1,max:10,min:0},zoomSpeed:{type:"number",precision:1,max:10,min:0},panSpeed:{type:"number",precision:1,max:10,min:0},clipNear:{type:"range",step:1,max:100,min:0},clipFar:{type:"range",step:1,max:100,min:0},clipDist:{type:"integer",max:200,min:0},fogNear:{type:"range",step:1,max:100,min:0},fogFar:{type:"range",step:1,max:100,min:0},cameraType:{type:"select",options:{perspective:"perspective",orthographic:"orthographic"}},cameraFov:{type:"range",step:1,max:120,min:15},lightColor:{type:"color"},lightIntensity:{type:"number",precision:2,max:10,min:0},ambientColor:{type:"color"},ambientIntensity:{type:"number",precision:2,max:10,min:0},hoverTimeout:{type:"integer",max:1e4,min:10}},setParameters:function(t){var e=Object.assign({},t),i=this.parameters,n=this.viewer,r=n.controls,o=this.pickingControls;for(var a in e)void 0!==e[a]&&i[a]&&(i[a].int&&(e[a]=parseInt(e[a])),i[a].float&&(e[a]=parseFloat(e[a])),i[a].value=e[a]);return void 0!==e.quality&&this.setQuality(e.quality),void 0!==e.impostor&&this.setImpostor(e.impostor),void 0!==e.rotateSpeed&&(r.rotateSpeed=e.rotateSpeed),void 0!==e.zoomSpeed&&(r.zoomSpeed=e.zoomSpeed),void 0!==e.panSpeed&&(r.panSpeed=e.panSpeed),o.setParameters({hoverTimeout:e.hoverTimeout}),n.setClip(e.clipNear,e.clipFar,e.clipDist),n.setFog(void 0,e.fogNear,e.fogFar),n.setCamera(e.cameraType,e.cameraFov),n.setSampling(e.sampleLevel),n.setBackground(e.backgroundColor),n.setLight(e.lightColor,e.lightIntensity,e.ambientColor,e.ambientIntensity),this.signals.parametersChanged.dispatch(this.getParameters()),this},getParameters:function(){var t={};for(var e in this.parameters)t[e]=this.parameters[e].value;return t},defaultFileRepresentation:function(e){if("structure"===e.type){e.setSelection("/0");var i,n,r=e.structure;if(r.biomolDict.BU1){var o=r.biomolDict.BU1;i=o.getAtomCount(r),n=o.getInstanceCount(),e.setDefaultAssembly("BU1")}else i=r.getModelProxy(0).atomCount,n=1;dv&&(i*=4);var a=r.atomStore.count/r.residueStore.count<2;a&&(i*=10);var s="chainname";if(1===r.getChainnameCount("polymer and /0")&&(s="residueindex"),t.Debug&&console.log(i,n,a),n>5&&i>15e3||i>7e5){var c=Math.min(1.5,Math.max(.1,2e3/(i/n)));a&&(c=Math.min(c,.15)),e.addRepresentation("surface",{sele:"polymer",surfaceType:"sas",probeRadius:1.4,scaleFactor:c,colorScheme:s,colorScale:"RdYlBu",useWorker:!1})}else i>25e4?e.addRepresentation("backbone",{lineOnly:!0,colorScheme:s,colorScale:"RdYlBu"}):i>1e5?e.addRepresentation("backbone",{quality:"low",disableImpostor:!0,colorScheme:s,colorScale:"RdYlBu",scale:2}):i>8e4?e.addRepresentation("backbone",{colorScheme:s,colorScale:"RdYlBu",scale:2}):(e.addRepresentation("cartoon",{color:s,colorScale:"RdYlBu",scale:.7,aspectRatio:5,quality:"auto"}),i<5e4&&e.addRepresentation("base",{color:s,colorScale:"RdYlBu",quality:"auto"}),e.addRepresentation("ball+stick",{sele:"hetero and not ( water or ion )",colorScheme:"element",scale:2,aspectRatio:1.5,bondScale:.3,bondSpacing:.75,quality:"auto"}));this.centerView(),e.structure.frames.length&&e.addTrajectory()}else"surface"!==e.type&&"volume"!==e.type||(e.addRepresentation("surface"),this.centerView())},loadFile:function(t,e){var i=Object.assign({},this.defaultFileParams,e),n=new hs(this,i);n.name=y(t).name,this.addComponent(n);var r=this.tasks;r.increment();var o=function(t){return this.removeComponent(n),n=this.addComponentFromObject(t,i),"script"===n.type&&n.run(),i.defaultRepresentation&&this.defaultFileRepresentation(n),r.decrement(),n}.bind(this),a=function(t){throw n.setStatus(t),r.decrement(),t};return gr(t,i).then(o,a)},addComponent:function(t){return t?(this.compList.push(t),void this.signals.componentAdded.dispatch(t)):void mv.warn("Stage.addComponent: no component given")},addComponentFromObject:function(t,e){var i=Ps(this,t,e);return this.addComponent(i),i},removeComponent:function(t){var e=this.compList.indexOf(t);e!==-1&&this.compList.splice(e,1),t.dispose(),this.signals.componentRemoved.dispatch(t)},removeAllComponents:function(t){this.compList.slice().forEach(function(e){t&&e.type!==t||this.removeComponent(e)},this)},handleResize:function(){this.viewer.handleResize()},toggleFullscreen:function(t){function e(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement}function i(){if(!e()&&n.lastFullscreenElement){var t=n.lastFullscreenElement;t.style.width=t.dataset.normalWidth,t.style.height=t.dataset.normalHeight,document.removeEventListener("fullscreenchange",i),document.removeEventListener("mozfullscreenchange",i),document.removeEventListener("webkitfullscreenchange",i),document.removeEventListener("MSFullscreenChange",i),n.handleResize(),n.signals.fullscreenChanged.dispatch(!1)}}if(!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.webkitFullscreenEnabled||document.msFullscreenEnabled))return void mv.log("fullscreen mode (currently) not possible");var n=this;t=t||this.viewer.container,this.lastFullscreenElement=t,e()?document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen():(t.dataset.normalWidth=t.style.width,t.dataset.normalHeight=t.style.height,t.style.width=screen.width+"px",t.style.height=screen.height+"px",t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen(),document.addEventListener("fullscreenchange",i),document.addEventListener("mozfullscreenchange",i),document.addEventListener("webkitfullscreenchange",i),document.addEventListener("MSFullscreenChange",i),this.handleResize(),this.signals.fullscreenChanged.dispatch(!0),setTimeout(function(){n.handleResize()},100))},centerView:function(){if(this.tasks.count>0){var t=function(e,i){0===i&&this.tasks.signals.countChanged.remove(t,this),this.viewer.centerView(!0)};this.tasks.signals.countChanged.add(t,this)}this.viewer.centerView(!0)},setSpin:function(t,e){Array.isArray(t)&&(t=(new N).fromArray(t)),this.viewer.setSpin(t,e)},setOrientation:function(t){this.tasks.onZeroOnce(function(){this.viewer.setOrientation(t)},this)},getOrientation:function(){return this.viewer.getOrientation()},makeImage:function(t){var e=this.viewer,i=this.tasks;return new Promise(function(n,r){function o(){i.increment(),e.makeImage(t).then(function(t){i.decrement(),n(t)}).catch(function(t){i.decrement(),r(t)})}i.onZeroOnce(o)})},setImpostor:function(t){this.parameters.impostor.value=t;var e=["spacefill","ball+stick","licorice","hyperball","backbone","rocket","helixorient","contact","distance","dot"];this.eachRepresentation(function(i){if("script"!==i.type&&e.includes(i.getType())){var n=i.getParameters();n.disableImpostor=!t,i.build(n)}})},setQuality:function(t){this.parameters.quality.value=t;var e=["tube","cartoon","ribbon","trace","rope"],i=["spacefill","ball+stick","licorice","hyperball","backbone","rocket","helixorient","contact","distance","dot"];this.eachRepresentation(function(n){if("script"!==n.type){var r=n.getParameters();if(!e.includes(n.getType())){if(!i.includes(n.getType()))return;if(!r.disableImpostor)return void(n.repr.quality=t)}r.quality=t,n.build(r)}})},eachComponent:function(t,e){this.compList.forEach(function(i,n){e&&i.type!==e||t(i,n)})},eachRepresentation:function(t,e){this.eachComponent(function(e){e.reprList.forEach(function(i){t(i,e)})},e)},getComponentsByName:function(t,e){var i=[];return this.eachComponent(function(e){void 0!==t&&null===e.name.match(t)||i.push(e)},e),new ds(i)},getRepresentationsByName:function(t,e){var i,n;"object"!=typeof t?(i=void 0,n=t):(i=t.comp,n=t.repr);var r=[];return this.eachRepresentation(function(t,e){void 0!==i&&null===e.name.match(i)||void 0!==n&&null===t.name.match(n)||r.push(t)},e),new fs(r)},getAnythingByName:function(t){var e=this.getComponentsByName(t).list,i=this.getRepresentationsByName(t).list;return new ls(e.concat(i))},dispose:function(){this.tasks.dispose()}},Ts.prototype={constructor:Ts,_animate:function(){var t;if(this._running=!0,this.traj.inProgress||this._stopFlag||(t="forward"===this.direction?this.traj.currentFrame+this.step:this.traj.currentFrame-this.step,(t>=this.end||t=this.end?e=this.start:"backward"===this.direction&&t<=this.start&&(e=this.end),this.traj.setFrame(e),this._stopFlag=!1,this._animate(),this.signals.startedRunning.dispatch()}},pause:function(){this._running&&(this._stopFlag=!0,this.signals.haltedRunning.dispatch())},stop:function(){this.traj.setFrame(this.start),this.pause()}},Es.prototype=Object.assign(Object.create(os.prototype),{constructor:Es,type:"axes",parameters:Object.assign({radius:{type:"number",precision:3,max:10,min:.001},sphereDetail:!0,radialSegments:!0,disableImpostor:!0,align:{type:"button"},showAxes:{type:"boolean",rebuild:!0},showBox:{type:"boolean",rebuild:!0}},Ka.prototype.parameters,{assembly:null}),init:function(t){var e=t||{};e.radius=d(e.radius,.5),e.colorValue=d(e.colorValue,"lightgreen"),os.prototype.init.call(this,e),this.showAxes=d(e.showAxes,!0),this.showBox=d(e.showBox,!1)},getPrincipalAxes:function(){var t,e=this.getAssembly();return e&&(t=e.partList[0].getSelection()),this.structureView.getView(t).getPrincipalAxes()},align:function(){var t=this.getPrincipalAxes(this.structureView),e=(new N).copy(t[0][1]).sub(t[0][0]).normalize(),i=(new N).copy(t[2][1]).sub(t[2][0]).normalize();this.viewer.alignView(i,e,t[3],!0)},getAxesData:function(t){var e=this.getPrincipalAxes(t),i=new Ct(this.colorValue),n=0,r=0;this.showAxes&&(n+=6,r+=3),this.showBox&&(n+=8,r+=12);var o=new Float32Array(3*n),a=Lr(n,i.r,i.g,i.b),s=Ir(n,this.radius),c=new Float32Array(3*r),h=new Float32Array(3*r),u=Lr(r,i.r,i.g,i.b),l=Ir(r,this.radius),d=0;if(this.showAxes){var f=function(t,e){t.toArray(o,2*d),e.toArray(o,2*d+3),t.toArray(c,d),e.toArray(h,d),d+=3};f(e[0][0],e[0][1]),f(e[1][0],e[1][1]),f(e[2][0],e[2][1])}if(this.showBox){var p=(new N).subVectors(e[0][0],e[0][1]).normalize(),m=(new N).subVectors(e[1][0],e[1][1]).normalize(),g=(new N).subVectors(e[2][0],e[2][1]).normalize(),v=new N,y=new N,b=new N,x=new N,w=new N,_=-(1/0),S=-(1/0),A=-(1/0),M=-(1/0),P=-(1/0),C=-(1/0);t.eachAtom(function(t){Gr(v.copy(t),p,e[3]);var i=x.subVectors(v,e[3]).normalize().dot(p),n=v.distanceTo(e[3]);i>0?n>_&&(_=n):n>S&&(S=n),Gr(y.copy(t),m,e[3]);var r=x.subVectors(y,e[3]).normalize().dot(m),o=y.distanceTo(e[3]);r>0?o>A&&(A=o):o>M&&(M=o),Gr(b.copy(t),g,e[3]);var a=x.subVectors(b,e[3]).normalize().dot(g),s=b.distanceTo(e[3]);a>0?s>P&&(P=s):s>C&&(C=s)});var T=2*d,E=function(t,i,n){w.copy(e[3]).addScaledVector(p,t).addScaledVector(m,i).addScaledVector(g,n),w.toArray(o,T),T+=3};E(_,A,P),E(_,A,-C),E(_,-M,-C),E(_,-M,P),E(-S,-M,-C),E(-S,-M,P),E(-S,A,P),E(-S,A,-C);var I=d,L=function(t,e){w.fromArray(o,2*d+3*t).toArray(c,I),w.fromArray(o,2*d+3*e).toArray(h,I),I+=3};L(0,1),L(0,3),L(0,6),L(1,2),L(1,7),L(2,3),L(2,4),L(3,5),L(4,5),L(4,7),L(5,6),L(6,7)}return{vertexPosition:o,vertexColor:a,vertexRadius:s,edgePosition1:c,edgePosition2:h,edgeColor:u,edgeRadius:l}},create:function(){var t=this.getAxesData(this.structureView);this.sphereBuffer=new Ua(t.vertexPosition,t.vertexColor,t.vertexRadius,void 0,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0})),this.cylinderBuffer=new Wa(t.edgePosition1,t.edgePosition2,t.edgeColor,t.edgeColor,t.edgeRadius,void 0,void 0,this.getBufferParams({openEnded:!0,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bufferList:[this.sphereBuffer,this.cylinderBuffer]})},updateData:function(t,e){var i=this.getAxesData(e.sview),n={},r={};t&&!t.position||(n.position=i.vertexPosition,r.position1=i.edgePosition1,r.position2=i.edgePosition2),t&&!t.color||(n.color=i.vertexColor,r.color=i.edgeColor,r.color2=i.edgeColor),t&&!t.radius||(n.radius=i.vertexRadius,r.radius=i.edgeRadius),this.sphereBuffer.setAttributes(n),this.cylinderBuffer.setAttributes(r)}}),xv.add("axes",Es),Is.prototype=Object.assign(Object.create(os.prototype),{constructor:Is,type:"ball+stick",defaultSize:.15,parameters:Object.assign({sphereDetail:!0,radialSegments:!0,openEnded:!0,disableImpostor:!0,aspectRatio:{type:"number",precision:1,max:10,min:1},lineOnly:{type:"boolean",rebuild:!0},cylinderOnly:{type:"boolean",rebuild:!0},multipleBond:{type:"select",rebuild:!0,options:{off:"off",symmetric:"symmetric",offset:"offset"}},bondScale:{type:"number",precision:2,max:1,min:.01},bondSpacing:{type:"number",precision:2,max:2,min:.5}},os.prototype.parameters),init:function(t){var e=t||{};e.radius=d(e.radius,this.defaultSize),this.aspectRatio=d(e.aspectRatio,2),this.lineOnly=d(e.lineOnly,!1),this.cylinderOnly=d(e.cylinderOnly,!1),this.multipleBond=d(e.multipleBond,"off"),this.bondSpacing=d(e.bondSpacing,1),this.bondScale=d(e.bondScale,.4),os.prototype.init.call(this,e)},getAtomParams:function(t,e){return e=Object.assign({radiusParams:{radius:this.radius,scale:this.scale*this.aspectRatio}},e),os.prototype.getAtomParams.call(this,t,e)},getAtomData:function(t,e,i){return t.getAtomData(this.getAtomParams(e,i))},getBondParams:function(t,e){return e=Object.assign({multipleBond:this.multipleBond,bondSpacing:this.bondSpacing,bondScale:this.bondScale},e),os.prototype.getBondParams.call(this,t,e)},getBondData:function(t,e,i){return t.getBondData(this.getBondParams(e,i))},createData:function(t){var e=this.getBondData(t),i=[];if(this.lineOnly)this.lineBuffer=new as(e.position1,e.position2,e.color1,e.color2,this.getBufferParams()),i.push(this.lineBuffer);else{var n=new Wa(e.position1,e.position2,e.color1,e.color2,e.radius,e.pickingColor1,e.pickingColor2,this.getBufferParams({openEnded:this.openEnded,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}));if(i.push(n),!this.cylinderOnly){var r=this.getAtomData(t),o=new Ua(r.position,r.color,r.radius,r.pickingColor,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0}));i.push(o)}}return{bufferList:i}},updateData:function(t,e){"off"!==this.multipleBond&&t&&t.radius&&(t.position=!0);var i=this.getBondData(e.sview,t);if(this.lineOnly){var n={};t&&!t.position||(n.from=i.position1,n.to=i.position2),t&&!t.color||(n.color=i.color1,n.color2=i.color2),e.bufferList[0].setAttributes(n)}else{var r={};if(t&&!t.position||(r.position1=i.position1,r.position2=i.position2),t&&!t.color||(r.color=i.color1,r.color2=i.color2),t&&!t.radius||(r.radius=i.radius),e.bufferList[0].setAttributes(r),!this.cylinderOnly){var o=this.getAtomData(e.sview,t),a={};t&&!t.position||(a.position=o.position),t&&!t.color||(a.color=o.color),t&&!t.radius||(a.radius=o.radius),e.bufferList[1].setAttributes(a)}}},setParameters:function(t){var e=!1,i={};return t&&(t.aspectRatio||t.bondSpacing||t.bondScale)&&(i.radius=!0,pv&&!this.disableImpostor||(e=!0)),os.prototype.setParameters.call(this,t,i,e),this}}),xv.add("ball+stick",Is),Ls.prototype=Object.assign(Object.create(Is.prototype),{constructor:Ls,type:"backbone",defaultSize:.25,parameters:Object.assign({},Is.prototype.parameters,{multipleBond:null,bondSpacing:null}),init:function(t){var e=t||{};e.aspectRatio=d(e.aspectRatio,1),Is.prototype.init.call(this,e)},getAtomData:function(t,e,i){return t.getBackboneAtomData(this.getAtomParams(e,i))},getBondData:function(t,e,i){var n=this.getBondParams(e,i);return n.colorParams.backbone=!0,t.getBackboneBondData(n)}}),xv.add("backbone",Ls),Rs.prototype=Object.assign(Object.create(Is.prototype),{constructor:Rs,type:"base",defaultSize:.3,parameters:Object.assign({},Is.prototype.parameters,{multipleBond:null,bondSpacing:null}),init:function(t){var e=t||{};e.aspectRatio=d(e.aspectRatio,1),Is.prototype.init.call(this,e)},getAtomData:function(t,e,i){return t.getRungAtomData(this.getAtomParams(e,i))},getBondData:function(t,e,i){var n=this.getBondParams(e,i);return n.colorParams.rung=!0,t.getRungBondData(n)}}),xv.add("base",Rs),Ds.prototype={constructor:Ds,getAtomIterator:function(t,e){function i(){var t=this.get(h);return h+=1,t}function n(i){var n=u[c%4];if(n.index=o.getAtomIndexByType(i,t),e&&i>0&&ie)&&(s=!0,r.add_unsafe(n.index),o.addBond(a,n,1))}s&&r.add_unsafe(a.index)});var a=new zv(o.count);return a.set_all(!0),mv.timeEnd("Contact within"),{atomSet:r,bondSet:a,bondStore:o}}},Us.prototype=Object.assign(Object.create(os.prototype),{ +constructor:Us,type:"contact",defaultSize:.25,parameters:Object.assign({contactType:{type:"select",rebuild:!0,options:{polar:"polar",polarBackbone:"polar backbone"}},maxDistance:{type:"number",precision:1,max:10,min:.1,rebuild:!0},maxAngle:{type:"integer",max:180,min:0,rebuild:!0},radialSegments:!0,disableImpostor:!0},os.prototype.parameters),init:function(t){var e=t||{};e.radius=d(e.radius,this.defaultSize),this.contactType=d(e.contactType,"polarBackbone"),this.maxDistance=d(e.maxDistance,3.5),this.maxAngle=d(e.maxAngle,40),os.prototype.init.call(this,e)},getContactData:function(t){var e={polar:zs,polarBackbone:Bs},i=e[this.contactType](t,this.maxDistance,this.maxAngle);return i},getBondData:function(t,e,i){return t.getBondData(this.getBondParams(e,i))},createData:function(t){var e=this.getContactData(t),i={bondSet:e.bondSet,bondStore:e.bondStore},n=this.getBondData(t,void 0,i),r=new Wa(n.position1,n.position2,n.color1,n.color2,n.radius,n.pickingColor1,n.pickingColor2,this.getBufferParams({openEnded:!1,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}));return{bufferList:[r],bondSet:e.bondSet,bondStore:e.bondStore}},updateData:function(t,e){if(!t||t.position){var i=this.getContactData(e.sview);e.bondSet=i.bondSet,e.bondStore=i.bondStore}var n={bondSet:e.bondSet,bondStore:e.bondStore},r=this.getBondData(e.sview,t,n),o={};t&&!t.position||(o.position=Er(r.position1,r.position2),o.position1=r.position1,o.position2=r.position2),t&&!t.color||(o.color=r.color1,o.color2=r.color2),t&&!t.radius||(o.radius=r.radius),e.bufferList[0].setAttributes(o)}}),xv.add("contact",Us),_v.add("shader/SDFFont.vert","uniform float nearClip;\nuniform float clipRadius;\nuniform vec3 clipCenter;\nuniform float xOffset;\nuniform float yOffset;\nuniform float zOffset;\nuniform bool ortho;\nvarying vec3 vViewPosition;\nvarying vec2 texCoord;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\nattribute vec2 mapping;\nattribute vec2 inputTexCoord;\nattribute float inputSize;\n#include color_pars_vertex\n#include common\nvoid main(void){\n#include color_vertex\ntexCoord = inputTexCoord;\nfloat _zOffset = zOffset;\nif( texCoord.x == 10.0 ){\n_zOffset -= 0.001;\n}\nvec3 pos = position;\nif( ortho ){\npos += normalize( cameraPosition ) * _zOffset;\n}\nvec4 cameraPos = modelViewMatrix * vec4( pos, 1.0 );\nvec4 cameraCornerPos = vec4( cameraPos.xyz, 1.0 );\ncameraCornerPos.xy += mapping * inputSize * 0.01;\ncameraCornerPos.x += xOffset;\ncameraCornerPos.y += yOffset;\nif( !ortho ){\ncameraCornerPos.xyz += normalize( -cameraCornerPos.xyz ) * _zOffset;\n}\ngl_Position = projectionMatrix * cameraCornerPos;\nvViewPosition = -cameraCornerPos.xyz;\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n#include radiusclip_vertex\n}"),_v.add("shader/SDFFont.frag","uniform sampler2D fontTexture;\nuniform float opacity;\nuniform bool showBorder;\nuniform vec3 borderColor;\nuniform float borderWidth;\nuniform vec3 backgroundColor;\nuniform float backgroundOpacity;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec3 vViewPosition;\nvarying vec2 texCoord;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#ifdef SDF\nconst float smoothness = 16.0;\n#else\nconst float smoothness = 256.0;\n#endif\nconst float gamma = 2.2;\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\nif( texCoord.x > 1.0 ){\ngl_FragColor = vec4( backgroundColor, backgroundOpacity );\n}else{\nfloat sdf = texture2D( fontTexture, texCoord ).a;\nif( showBorder ) sdf += borderWidth;\nfloat w = clamp(\nsmoothness * ( abs( dFdx( texCoord.x ) ) + abs( dFdy( texCoord.y ) ) ),\n0.0,\n0.5\n);\nfloat a = smoothstep( 0.5 - w, 0.5 + w, sdf );\na = pow( a, 1.0 / gamma );\nif( a < 0.2 ) discard;\na *= opacity;\nvec3 outgoingLight = vColor;\nif( showBorder && sdf < ( 0.5 + borderWidth ) ){\noutgoingLight = borderColor;\n}\ngl_FragColor = vec4( outgoingLight, a );\n}\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n}");var Xv=function(){var t={};return function(e){var i=JSON.stringify(e);return void 0===t[i]&&(t[i]=new js(e)),t[i]}}();js.prototype={constructor:js,build:function(){var t=this.size+2*this.outline+Math.round(this.size/4),e=this.width/4,i=document.createElement("canvas");i.width=e,i.height=t;var n=i.getContext("2d");n.font=this.style+" "+this.variant+" "+this.weight+" "+this.size+"px "+this.font,n.fillStyle="#FF0000",n.textAlign="left",n.textBaseline="bottom",n.lineJoin="round";for(var r=[],o=3*this.outline,a=0;athis.width&&(this.currentX=0,this.currentY+=this.scratchH),this.currentY+this.scratchH>this.height&&console.warn("canvas to small"),this.mapped[t]={x:this.currentX,y:this.currentY,w:this.scratchW,h:this.scratchH},this.context2.drawImage(this.canvas,0,0,this.scratchW,this.scratchH,this.currentX,this.currentY,this.scratchW,this.scratchH),this.currentX+=this.scratchW),this.mapped[t]},draw:function(t){var e=this.lineHeight,i=this.outline,n=this.context,r=this.scratch,o=this.maxWidth,a=this.colors,s=i,c=e-this.outline,h=n.measureText(t),u=Math.min(o,Math.ceil(h.width+2*s+1));n.clearRect(0,0,u,e);var l,d,f,p,m;if(0===this.outline)for(n.fillText(t,s,c),p=n.getImageData(0,0,u,e),m=p.data,f=3,l=0,d=m.length/4;l0;--l)f=l>1?2*l-2:l,n.strokeStyle=a[f-1],n.lineWidth=f,n.strokeText(t,s,c);n.globalCompositeOperation="multiply",n.fillStyle="#FF00FF",n.fillText(t,s,c),p=n.getImageData(0,0,u,e),m=p.data,f=0;var g=this.gamma;for(l=0,d=m.length/4;l0&&(i-=u,r=r.subarray(0,3*i));var l=new zv(s.count);return l.set_all(!0),{text:n,position:r,bondSet:l,bondStore:s}},getBondData:function(t,e,i){return t.getBondData(this.getBondParams(e,i))},create:function(){if(0!==this.structureView.atomCount){var t=this.atomPair.length;if(0!==t){var e=this.getDistanceData(this.structureView,this.atomPair),i=new Ct(this.labelColor);this.textBuffer=new $s(e.position,Ir(t,this.labelSize),Lr(t,i.r,i.g,i.b),e.text,this.getBufferParams({fontFamily:this.fontFamily,fontStyle:this.fontStyle,fontWeight:this.fontWeight,sdf:this.sdf,zOffset:this.labelZOffset,opacity:1,visible:this.labelVisible}));var n={bondSet:e.bondSet,bondStore:e.bondStore},r=this.getBondData(this.structureView,void 0,n);this.cylinderBuffer=new Wa(r.position1,r.position2,r.color1,r.color2,r.radius,void 0,void 0,this.getBufferParams({openEnded:!1,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bondSet:e.bondSet,bondStore:e.bondStore,position:e.position,bufferList:[this.textBuffer,this.cylinderBuffer]})}}},update:function(t){t.position?this.build():os.prototype.update.call(this,t)},updateData:function(t,e){var i={bondSet:e.bondSet,bondStore:e.bondStore},n=this.getBondData(e.sview,t,i),r={},o={},a=this.atomPair.length;if(t.labelSize&&(o.size=Ir(a,this.labelSize)),t.labelColor){var s=new Ct(this.labelColor);o.color=Lr(a,s.r,s.g,s.b)}t.color&&(r.color=n.color1,r.color2=n.color2),(t.radius||t.scale)&&(r.radius=n.radius),this.textBuffer.setAttributes(o),this.cylinderBuffer.setAttributes(r)},setVisibility:function(t,e){return os.prototype.setVisibility.call(this,t,!0),this.textBuffer&&this.textBuffer.setVisibility(this.labelVisible&&this.visible),e||this.viewer.requestRender(),this},setParameters:function(t){var e=!1,i={};return t&&t.labelSize&&(i.labelSize=!0),t&&t.labelColor&&(i.labelColor=!0),os.prototype.setParameters.call(this,t,i,e),t&&void 0!==t.labelVisible&&this.setVisibility(this.visible),this}}),xv.add("distance",Vs),Gs.prototype=Object.assign(Object.create(Ia.prototype),{constructor:Gs,setAttributes:function(t){var e,i,n,r=this.geometry.attributes;t.position&&t.vector&&(e=t.position,i=t.vector,n=r.position.array,r.position.needsUpdate=!0);var o,a,s=this.size,c=this.scale;if(t.position&&t.vector)for(var h=0;h radius2) {\nspaceposition.y = mapping.y * 1.5 * radius1;\nspaceposition.x = mapping.x * 1.5 * radius1;\n} else {\nspaceposition.y = mapping.y * 1.5 * radius2;\nspaceposition.x = mapping.x * 1.5 * radius2;\n}\nspaceposition.w = 1.0;\nvec4 e3 = vec4( 1.0 );\nvec3 e1, e1_temp, e2, e2_temp;\ne3.xyz = normalize(position_atom1-position_atom2);\nif (e3.z == 0.0) { e3.z = 0.0000000000001;}\nif ( (position_atom1.x - position_atom2.x) == 0.0) { position_atom1.x += 0.001;}\nif ( (position_atom1.y - position_atom2.y) == 0.0) { position_atom1.y += 0.001;}\nif ( (position_atom1.z - position_atom2.z) == 0.0) { position_atom1.z += 0.001;}\nvec4 focus = vec4( 1.0 );\nfocus.x = ( position_atom1.x*position_atom1.x - position_atom2.x*position_atom2.x +\n( radius2*radius2 - radius1*radius1 )*e3.x*e3.x/shrink )/(2.0*(position_atom1.x - position_atom2.x));\nfocus.y = ( position_atom1.y*position_atom1.y - position_atom2.y*position_atom2.y +\n( radius2*radius2 - radius1*radius1 )*e3.y*e3.y/shrink )/(2.0*(position_atom1.y - position_atom2.y));\nfocus.z = ( position_atom1.z*position_atom1.z - position_atom2.z*position_atom2.z +\n( radius2*radius2 - radius1*radius1 )*e3.z*e3.z/shrink )/(2.0*(position_atom1.z - position_atom2.z));\ne1.x = 1.0;\ne1.y = 1.0;\ne1.z = ( (e3.x*focus.x + e3.y*focus.y + e3.z*focus.z) - e1.x*e3.x - e1.y*e3.y)/e3.z;\ne1_temp = e1 - focus.xyz;\ne1 = normalize(e1_temp);\ne2_temp = e1.yzx * e3.zxy - e1.zxy * e3.yzx;\ne2 = normalize(e2_temp);\nmat3 R= mat3( e1.xyz, e2.xyz, e3.xyz );\nvertex_position.xyz = R * spaceposition.xyz;\nvertex_position.w = 1.0;\nvertex_position.x += (position_atom1.x+position_atom2.x) / 2.0;\nvertex_position.y += (position_atom1.y+position_atom2.y) / 2.0;\nvertex_position.z += (position_atom1.z+position_atom2.z) / 2.0;\ngl_Position = modelViewProjectionMatrix * vertex_position;\nvec4 i_near, i_far;\nvec4 near = gl_Position;\nnear.z = 0.0 ;\nnear = modelViewProjectionMatrixInverse * near;\ni_near = near;\nvec4 far = gl_Position;\nfar.z = far.w ;\ni_far = modelViewProjectionMatrixInverse * far;\nprime1 = vec4( position_atom1 - (position_atom1 - focus.xyz)*shrink, 1.0 );\nprime2 = vec4( position_atom2 - (position_atom2 - focus.xyz)*shrink, 1.0 );\nfloat Rsquare = (radius1*radius1/shrink) - (\n(position_atom1.x - focus.x)*(position_atom1.x - focus.x) +\n(position_atom1.y - focus.y)*(position_atom1.y - focus.y) +\n(position_atom1.z - focus.z)*(position_atom1.z - focus.z)\n);\nfocus.w = Rsquare;\nmatrix_near = mat4( i_near, i_far, focus, e3 );\ngl_Position.z = 1.0;\n}"),_v.add("shader/HyperballStickImpostor.frag","#define STANDARD\n#define IMPOSTOR\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\nuniform float nearClip;\nuniform float shrink;\nuniform mat4 modelViewMatrix;\nuniform mat4 modelViewProjectionMatrix;\nuniform mat4 modelViewMatrixInverseTranspose;\nuniform mat4 projectionMatrix;\nvarying mat4 matrix_near;\nvarying vec4 prime1;\nvarying vec4 prime2;\nvarying float vRadius;\nvarying float vRadius2;\n#ifdef PICKING\nuniform float objectId;\nvarying vec3 vPickingColor;\nvarying vec3 vPickingColor2;\n#else\nvarying vec3 vColor1;\nvarying vec3 vColor2;\n#include common\n#include fog_pars_fragment\n#include bsdfs\n#include lights_pars\n#include lights_physical_pars_fragment\n#endif\nbool interior = false;\nfloat calcClip( vec4 cameraPos ){\nreturn dot( cameraPos, vec4( 0.0, 0.0, 1.0, nearClip - 0.5 ) );\n}\nfloat calcClip( vec3 cameraPos ){\nreturn calcClip( vec4( cameraPos, 1.0 ) );\n}\nfloat calcDepth( in vec3 cameraPos ){\nvec2 clipZW = cameraPos.z * projectionMatrix[2].zw + projectionMatrix[3].zw;\nreturn 0.5 + 0.5 * clipZW.x / clipZW.y;\n}\nstruct Ray {\nvec3 origin ;\nvec3 direction ;\n};\nbool cutoff_plane (vec3 M, vec3 cutoff, vec3 x3){\nfloat a = x3.x;\nfloat b = x3.y;\nfloat c = x3.z;\nfloat d = -x3.x*cutoff.x-x3.y*cutoff.y-x3.z*cutoff.z;\nfloat l = a*M.x+b*M.y+c*M.z+d;\nif (l<0.0) {return true;}\nelse{return false;}\n}\nvec3 isect_surf(Ray r, mat4 matrix_coef){\nvec4 direction = vec4(r.direction, 0.0);\nvec4 origin = vec4(r.origin, 1.0);\nfloat a = dot(direction,(matrix_coef*direction));\nfloat b = dot(origin,(matrix_coef*direction));\nfloat c = dot(origin,(matrix_coef*origin));\nfloat delta =b*b-a*c;\ngl_FragColor.a = 1.0;\nif (delta<0.0){\ndiscard;\n}\nfloat t1 =(-b-sqrt(delta))/a;\nreturn r.origin+t1*r.direction;\n}\nvec3 isect_surf2(Ray r, mat4 matrix_coef){\nvec4 direction = vec4(r.direction, 0.0);\nvec4 origin = vec4(r.origin, 1.0);\nfloat a = dot(direction,(matrix_coef*direction));\nfloat b = dot(origin,(matrix_coef*direction));\nfloat c = dot(origin,(matrix_coef*origin));\nfloat delta =b*b-a*c;\ngl_FragColor.a = 1.0;\nif (delta<0.0){\ndiscard;\n}\nfloat t2 =(-b+sqrt(delta))/a;\nreturn r.origin+t2*r.direction;\n}\nRay primary_ray(vec4 near1, vec4 far1){\nvec3 near=near1.xyz/near1.w;\nvec3 far=far1.xyz/far1.w;\nreturn Ray(near,far-near);\n}\nfloat update_z_buffer(vec3 M, mat4 ModelViewP){\nfloat depth1;\nvec4 Ms=(ModelViewP*vec4(M,1.0));\nreturn depth1=(1.0+Ms.z/Ms.w)/2.0;\n}\nvoid main(){\nfloat radius = max( vRadius, vRadius2 );\nvec4 i_near, i_far, focus;\nvec3 e3, e1, e1_temp, e2;\ni_near = vec4(matrix_near[0][0],matrix_near[0][1],matrix_near[0][2],matrix_near[0][3]);\ni_far = vec4(matrix_near[1][0],matrix_near[1][1],matrix_near[1][2],matrix_near[1][3]);\nfocus = vec4(matrix_near[2][0],matrix_near[2][1],matrix_near[2][2],matrix_near[2][3]);\ne3 = vec3(matrix_near[3][0],matrix_near[3][1],matrix_near[3][2]);\ne1.x = 1.0;\ne1.y = 1.0;\ne1.z = ( (e3.x*focus.x + e3.y*focus.y + e3.z*focus.z) - e1.x*e3.x - e1.y*e3.y)/e3.z;\ne1_temp = e1 - focus.xyz;\ne1 = normalize(e1_temp);\ne2 = normalize(cross(e1,e3));\nvec4 equation = focus;\nfloat shrinkfactor = shrink;\nfloat t1 = -1.0/(1.0-shrinkfactor);\nfloat t2 = 1.0/(shrinkfactor);\nvec4 colonne1, colonne2, colonne3, colonne4;\nmat4 mat;\nvec3 equation1 = vec3(t2,t2,t1);\nfloat A1 = - e1.x*equation.x - e1.y*equation.y - e1.z*equation.z;\nfloat A2 = - e2.x*equation.x - e2.y*equation.y - e2.z*equation.z;\nfloat A3 = - e3.x*equation.x - e3.y*equation.y - e3.z*equation.z;\nfloat A11 = equation1.x*e1.x*e1.x + equation1.y*e2.x*e2.x + equation1.z*e3.x*e3.x;\nfloat A21 = equation1.x*e1.x*e1.y + equation1.y*e2.x*e2.y + equation1.z*e3.x*e3.y;\nfloat A31 = equation1.x*e1.x*e1.z + equation1.y*e2.x*e2.z + equation1.z*e3.x*e3.z;\nfloat A41 = equation1.x*e1.x*A1 + equation1.y*e2.x*A2 + equation1.z*e3.x*A3;\nfloat A22 = equation1.x*e1.y*e1.y + equation1.y*e2.y*e2.y + equation1.z*e3.y*e3.y;\nfloat A32 = equation1.x*e1.y*e1.z + equation1.y*e2.y*e2.z + equation1.z*e3.y*e3.z;\nfloat A42 = equation1.x*e1.y*A1 + equation1.y*e2.y*A2 + equation1.z*e3.y*A3;\nfloat A33 = equation1.x*e1.z*e1.z + equation1.y*e2.z*e2.z + equation1.z*e3.z*e3.z;\nfloat A43 = equation1.x*e1.z*A1 + equation1.y*e2.z*A2 + equation1.z*e3.z*A3;\nfloat A44 = equation1.x*A1*A1 + equation1.y*A2*A2 + equation1.z*A3*A3 - equation.w;\ncolonne1 = vec4(A11,A21,A31,A41);\ncolonne2 = vec4(A21,A22,A32,A42);\ncolonne3 = vec4(A31,A32,A33,A43);\ncolonne4 = vec4(A41,A42,A43,A44);\nmat = mat4(colonne1,colonne2,colonne3,colonne4);\nRay ray = primary_ray(i_near,i_far) ;\nvec3 M;\nM = isect_surf(ray, mat);\nif (cutoff_plane(M, prime1.xyz, -e3) || cutoff_plane(M, prime2.xyz, e3)){ discard; }\nvec4 M1 = vec4(M,1.0);\nvec4 M2 = mat*M1;\nvec3 _normal = ( modelViewMatrixInverseTranspose * M2 ).xyz;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix) ;\n#ifdef NEAR_CLIP\nif( calcClip( modelViewMatrix * vec4( M, 1.0 ) ) > 0.0 ){\nM = isect_surf2(ray, mat);\nif( calcClip( modelViewMatrix * vec4( M, 1.0 ) ) > 0.0 )\ndiscard;\ninterior = true;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix) ;\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = max( 0.0, calcDepth( vec3( - ( nearClip - 0.5 ) ) ) + ( 0.0000001 / radius ) );\n}\n}else if( gl_FragDepthEXT <= 0.0 ){\nM = isect_surf2(ray, mat);\ninterior = true;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix);\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / radius );\n}\n}\n#else\nif( gl_FragDepthEXT <= 0.0 ){\nM = isect_surf2(ray, mat);\ninterior = true;\ngl_FragDepthEXT = update_z_buffer(M, modelViewProjectionMatrix) ;\nif( gl_FragDepthEXT >= 0.0 ){\ngl_FragDepthEXT = 0.0 + ( 0.0000001 / radius );\n}\n}\n#endif\nif (cutoff_plane(M, prime1.xyz, -e3) || cutoff_plane(M, prime2.xyz, e3)){ discard; }\nif (gl_FragDepthEXT < 0.0)\ndiscard;\nif (gl_FragDepthEXT > 1.0)\ndiscard;\nfloat distance_ratio = ((M.x-prime2.x)*e3.x + (M.y-prime2.y)*e3.y +(M.z-prime2.z)*e3.z) /\ndistance(prime2.xyz,prime1.xyz);\n#ifdef PICKING\nif( distance_ratio > 0.5 ){\ngl_FragColor = vec4( vPickingColor, objectId );\n}else{\ngl_FragColor = vec4( vPickingColor2, objectId );\n}\n#else\nvec3 vViewPosition = -( modelViewMatrix * vec4( M, 1.0 ) ).xyz;\nvec3 vNormal = _normal;\nvec3 vColor;\nif( distance_ratio>0.5 ){\nvColor = vColor1;\n}else{\nvColor = vColor2;\n}\nvec4 diffuseColor = vec4( diffuse, opacity );\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\nvec3 totalEmissiveLight = emissive;\n#include color_fragment\n#include roughnessmap_fragment\n#include metalnessmap_fragment\nvec3 normal = normalize( vNormal );\nif( interior ){\nnormal = vec3( 0.0, 0.0, 0.4 );\n}\n#include lights_physical_fragment\n#include lights_template\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}"),Xs.prototype=Object.assign(Object.create(Fa.prototype),{constructo:Xs});var qv=new O;Ys.prototype=Object.assign(Object.create(Xs.prototype),{constructor:Ys,parameters:Object.assign({shrink:{uniform:!0}},Xs.prototype.parameters)}),Ks.prototype=Object.assign(Object.create(Ws.prototype),{constructor:Ks,type:"hyperball",defaultSize:1,parameters:Object.assign({shrink:{type:"number",precision:3,max:1,min:.001,buffer:!0}},Ws.prototype.parameters,{multipleBond:null,bondSpacing:null}),init:function(t){var e=t||{};e.scale=d(e.scale,.2),e.radius=d(e.radius,"vdw"),this.shrink=d(e.shrink,.12),Ws.prototype.init.call(this,e)},getBondParams:function(t,e){return t&&!t.radius||(e=Object.assign({radius2:!0},e)),Ws.prototype.getBondParams.call(this,t,e)},createData:function(t){var e=t.getAtomData(this.getAtomParams()),i=t.getBondData(this.getBondParams()),n=new Ua(e.position,e.color,e.radius,e.pickingColor,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0}));this.__center=new Float32Array(3*t.bondCount);var r=new Zs(i.position1,i.position2,i.color1,i.color2,i.radius1,i.radius2,i.pickingColor1,i.pickingColor2,this.getBufferParams({shrink:this.shrink,radialSegments:this.radialSegments,dullInterior:!0}),this.disableImpostor);return{bufferList:[n,r]}},updateData:function(t,e){var i=e.sview.getAtomData(this.getAtomParams()),n=e.sview.getBondData(this.getBondParams()),r={},o={};if(!t||t.position){r.position=i.position;var a=n.position1,s=n.position2;o.position=Er(a,s,this.__center),o.position1=a,o.position2=s}t&&!t.color||(r.color=i.color,o.color=n.color1,o.color2=n.color2),t&&!t.radius||(r.radius=i.radius,o.radius=n.radius1,o.radius2=n.radius2),e.bufferList[0].setAttributes(r),e.bufferList[1].setAttributes(o)}}),xv.add("hyperball",Ks),Qs.prototype={constructor:Qs,atomLabel:function(t){var e,i=this.type;switch(i){case"atomname":e=t.atomname;break;case"atomindex":e=""+t.index;break;case"occupancy":e=t.occupancy.toFixed(2);break;case"bfactor":e=t.bfactor.toFixed(2);break;case"serial":e=""+t.serial;break;case"element":e=t.element;break;case"atom":e=t.atomname+"|"+t.index;break;case"resname":e=t.resname;break;case"resno":e=""+t.resno;break;case"res":var n=t.resname.toUpperCase();e=(_m[n]||n)+t.resno;break;case"text":e=this.text[t.index];break;default:e=t.qualifiedName()}return void 0===e?"":e}},Qs.types={"":"",atomname:"atom name",atomindex:"atom index",occupancy:"occupancy",bfactor:"b-factor",serial:"serial",element:"element",atom:"atom name + index",resname:"residue name",resno:"residue no",res:"residue name + no",text:"text",qualified:"qualified name"},Js.prototype=Object.assign(Object.create(os.prototype),{constructor:Js,type:"label",parameters:Object.assign({labelType:{type:"select",options:Qs.types,rebuild:!0},labelText:{type:"hidden",rebuild:!0},fontFamily:{type:"select",options:{"sans-serif":"sans-serif",monospace:"monospace",serif:"serif"},buffer:!0},fontStyle:{type:"select",options:{normal:"normal",italic:"italic"},buffer:!0},fontWeight:{type:"select",options:{normal:"normal",bold:"bold"},buffer:!0},sdf:{type:"boolean",buffer:!0},xOffset:{type:"number",precision:1,max:20,min:-20,buffer:!0},yOffset:{type:"number",precision:1,max:20,min:-20,buffer:!0},zOffset:{type:"number",precision:1,max:20,min:-20,buffer:!0},attachment:{type:"select",options:{"bottom-left":"bottom-left","bottom-center":"bottom-center","bottom-right":"bottom-right","middle-left":"middle-left","middle-center":"middle-center","middle-right":"middle-right","top-left":"top-left","top-center":"top-center","top-right":"top-right"},rebuild:!0},showBorder:{type:"boolean",buffer:!0},borderColor:{type:"color",buffer:!0},borderWidth:{type:"number",precision:2,max:.3,min:0,buffer:!0},showBackground:{type:"boolean",rebuild:!0},backgroundColor:{type:"color",buffer:!0},backgroundMargin:{type:"number",precision:2,max:2,min:0,rebuild:!0},backgroundOpacity:{type:"range",step:.01,max:1,min:0,buffer:!0}},os.prototype.parameters,{side:null,flatShaded:null,wireframe:null,linewidth:null,roughness:null,metalness:null,diffuse:null}),init:function(t){var e=t||{};this.labelType=d(e.labelType,"res"),this.labelText=d(e.labelText,{}),this.fontFamily=d(e.fontFamily,"sans-serif"),this.fontStyle=d(e.fontStyle,"normal"),this.fontWeight=d(e.fontWeight,"bold"),this.sdf=d(e.sdf,"Chrome"===lv),this.xOffset=d(e.xOffset,0),this.yOffset=d(e.yOffset,0),this.zOffset=d(e.zOffset,.5),this.attachment=d(e.attachment,"bottom-left"),this.showBorder=d(e.showBorder,!1),this.borderColor=d(e.borderColor,"lightgrey"),this.borderWidth=d(e.borderWidth,.15),this.showBackground=d(e.showBackground,!1),this.backgroundColor=d(e.backgroundColor,"lightgrey"),this.backgroundMargin=d(e.backgroundMargin,.5),this.backgroundOpacity=d(e.backgroundOpacity,1),os.prototype.init.call(this,e)},createData:function(t){var e={position:!0,color:!0,radius:!0},i=t.getAtomData(this.getAtomParams(e)),n=[],r=new Qs(this.labelType,this.labelText);t.eachAtom(function(t){n.push(r.atomLabel(t))});var o=new $s(i.position,i.radius,i.color,n,this.getBufferParams({fontFamily:this.fontFamily,fontStyle:this.fontStyle,fontWeight:this.fontWeight,sdf:this.sdf,xOffset:this.xOffset,yOffset:this.yOffset,zOffset:this.zOffset,attachment:this.attachment,showBorder:this.showBorder,borderColor:this.borderColor,borderWidth:this.borderWidth,showBackground:this.showBackground,backgroundColor:this.backgroundColor,backgroundMargin:this.backgroundMargin,backgroundOpacity:this.backgroundOpacity}));return{bufferList:[o]}},updateData:function(t,e){var i=e.sview.getAtomData(this.getAtomParams(t)),n={};t&&!t.position||(n.position=i.position),t&&!t.radius||(n.size=i.radius),t&&!t.color||(n.color=i.color),e.bufferList[0].setAttributes(n)}}),xv.add("label",Js),tc.prototype=Object.assign(Object.create(os.prototype),{constructor:tc,type:"line",parameters:Object.assign({multipleBond:{type:"select",rebuild:!0,options:{ +off:"off",symmetric:"symmetric",offset:"offset"}},bondSpacing:{type:"number",precision:2,max:2,min:.5}},Ka.prototype.parameters,{flatShaded:null,side:null,wireframe:null,roughness:null,metalness:null,diffuse:null}),init:function(t){var e=t||{};this.multipleBond=d(e.multipleBond,"off"),this.bondSpacing=d(e.bondSpacing,1),os.prototype.init.call(this,e)},getBondParams:function(t,e){return e=Object.assign({multipleBond:this.multipleBond,bondSpacing:this.bondSpacing,radiusParams:{radius:.1,scale:1}},e),os.prototype.getBondParams.call(this,t,e)},createData:function(t){var e={position:!0,color:!0},i=t.getBondData(this.getBondParams(e)),n=new as(i.position1,i.position2,i.color1,i.color2,this.getBufferParams());return{bufferList:[n]}},updateData:function(t,e){var i=e.sview.getBondData(this.getBondParams(t)),n={};t&&!t.position||(n.from=i.position1,n.to=i.position2),t&&!t.color||(n.color=i.color1,n.color2=i.color2),e.bufferList[0].setAttributes(n)},setParameters:function(t){var e=!1,i={};return t&&t.bondSpacing&&(i.position=!0),os.prototype.setParameters.call(this,t,i,e),this}}),xv.add("line",tc),ic.__deps=[Sa,_a,Aa,Hr,ec],rc.__deps=[Sa,Aa,Ir,Hr,eo,Zr,io,nc,d],vv.add("molsurf",function(t,e){var i=t.data.args,n=t.data.params;if(i&&n){var r="av"===n.type?rc:ic,o=new r(i.coordList,i.radiusList,i.indexList),a=o.getSurface(n.type,n.probeRadius,n.scaleFactor,n.cutoff,!0,n.smooth),s=[a.position.buffer,a.index.buffer];a.normal&&s.push(a.normal.buffer),a.atomindex&&s.push(a.atomindex.buffer),e({sd:a,p:n},s)}},[ic,rc]),oc.prototype={getAtomData:function(){return this.structure.getAtomData({what:{position:!0,radius:!0,index:!0},radiusParams:{radius:"vdw",scale:1}})},makeSurface:function(t,e){var i=new pa("","",t);return i.info.type=e.type,i.info.probeRadius=e.probeRadius,i.info.scaleFactor=e.scaleFactor,i.info.smooth=e.smooth,i.info.cutoff=e.cutoff,i},getSurface:function(t){var e=t||{},i=this.getAtomData(),n=i.position,r=i.radius,o=i.index,a="av"===e.type?rc:ic,s=new a(n,r,o),c=s.getSurface(e.type,e.probeRadius,e.scaleFactor,e.cutoff,!0,e.smooth);return this.makeSurface(c,e)},getSurfaceWorker:function(t,e){var i=Object.assign({},t);if(window.Worker){void 0===this.worker&&(this.worker=new ma("molsurf"));var n=this.getAtomData(),r=n.position,o=n.radius,a=n.index,s={args:{coordList:r,radiusList:o,indexList:a},params:i},c=[r.buffer,o.buffer,a.buffer];this.worker.post(s,c,function(t){var n=t.data.sd;e(this.makeSurface(n,i))}.bind(this),function(t){console.warn("MolecularSurface.getSurfaceWorker error - trying without worker",t),this.worker.terminate(),this.worker=void 0;var n=this.getSurface(i);e(n)}.bind(this))}else{var h=this.getSurface(i);e(h)}},dispose:function(){this.worker&&this.worker.terminate()}},ac.prototype=Object.assign(Object.create(os.prototype),{constructor:ac,type:"surface",parameters:Object.assign({surfaceType:{type:"select",rebuild:!0,options:{vws:"vws",sas:"sas",ms:"ms",ses:"ses",av:"av"}},probeRadius:{type:"number",precision:1,max:20,min:0,rebuild:!0},smooth:{type:"integer",precision:1,max:10,min:0,rebuild:!0},scaleFactor:{type:"number",precision:1,max:5,min:0,rebuild:!0},cutoff:{type:"number",precision:2,max:50,min:0,rebuild:!0},background:{type:"boolean",rebuild:!0},opaqueBack:{type:"boolean",buffer:!0},filterSele:{type:"text"},volume:{type:"hidden"},useWorker:{type:"boolean",rebuild:!0}},os.prototype.parameters,{radiusType:null,radius:null,scale:null}),init:function(t){var e=t||{};e.colorScheme=d(e.colorScheme,"uniform"),e.colorValue=d(e.colorValue,14540253),this.surfaceType=d(e.surfaceType,"ms"),this.probeRadius=d(e.probeRadius,1.4),this.smooth=d(e.smooth,2),this.scaleFactor=d(e.scaleFactor,2),this.cutoff=d(e.cutoff,0),this.background=d(e.background,!1),this.opaqueBack=d(e.opaqueBack,!0),this.filterSele=d(e.filterSele,""),this.volume=d(e.volume,void 0),this.useWorker=d(e.useWorker,!0),os.prototype.init.call(this,t)},prepareData:function(t,e,i){var n=this.__infoList[e];if(n||(n={},this.__infoList[e]=n),n.molsurf&&n.sele===t.selection.string)i(e);else{n.sele=t.selection.string,n.molsurf=new oc(t);var r=this.getSurfaceParams(),o=function(t){n.surface=t,i(e)};this.useWorker?n.molsurf.getSurfaceWorker(r,o):o(n.molsurf.getSurface(r))}},prepare:function(t){if((this.__forceNewMolsurf||this.__sele!==this.selection.string||this.__surfaceParams!==JSON.stringify(this.getSurfaceParams()))&&(this.__infoList.forEach(function(t){t.molsurf.dispose()}.bind(this)),this.__infoList.length=0),0===this.structureView.atomCount)return void t();var e=function(){this.__sele=this.selection.string,this.__surfaceParams=JSON.stringify(this.getSurfaceParams()),this.__forceNewMolsurf=!1,t()}.bind(this),i="default"===this.assembly?this.defaultAssembly:this.assembly,n=this.structure.biomolDict[i];n?n.partList.forEach(function(t,i){var r=t.getView(this.structureView);this.prepareData(r,i,function(t){t===n.partList.length-1&&e()}.bind(this))},this):this.prepareData(this.structureView,0,e)},createData:function(t,e){var i=this.__infoList[e],n=new Ja(i.surface.getPosition(),i.surface.getColor(this.getColorParams()),i.surface.getFilteredIndex(this.filterSele,t),i.surface.getNormal(),i.surface.getPickingColor(this.getColorParams()),this.getBufferParams({background:this.background,opaqueBack:this.opaqueBack,dullInterior:!1})),r=new ts(n);return{bufferList:[r],info:i}},updateData:function(t,e){var i={};return t.position?(this.__forceNewMolsurf=!0,void this.build()):(t.color&&(i.color=e.info.surface.getColor(this.getColorParams())),t.index&&(i.index=e.info.surface.getFilteredIndex(this.filterSele,e.sview)),void e.bufferList[0].setAttributes(i))},setParameters:function(t,e,i){return e=e||{},t&&t.filterSele&&(e.index=!0),t&&void 0!==t.volume&&(e.color=!0),os.prototype.setParameters.call(this,t,e,i),this},getSurfaceParams:function(t){var e=Object.assign({type:this.surfaceType,probeRadius:this.probeRadius,scaleFactor:this.scaleFactor,smooth:this.smooth,cutoff:this.cutoff,useWorker:this.useWorker},t);return e},getColorParams:function(){var t=os.prototype.getColorParams.call(this);return t.volume=this.volume,t},clear:function(){os.prototype.clear.call(this)},dispose:function(){this.__infoList.forEach(function(t){t.molsurf.dispose()}.bind(this)),this.__infoList.length=0,os.prototype.dispose.call(this)}}),xv.add("surface",ac),sc.prototype=Object.assign(Object.create(os.prototype),{constructor:sc,type:"point",parameters:Object.assign({pointSize:{type:"number",precision:1,max:100,min:0,buffer:!0},sizeAttenuation:{type:"boolean",buffer:!0},sortParticles:{type:"boolean",rebuild:!0},useTexture:{type:"boolean",buffer:!0},alphaTest:{type:"range",step:.001,max:1,min:0,buffer:!0},forceTransparent:{type:"boolean",buffer:!0},edgeBleach:{type:"range",step:.001,max:1,min:0,buffer:!0}},Ka.prototype.parameters,{flatShaded:null,wireframe:null,linewidth:null,roughness:null,metalness:null}),init:function(t){var e=t||{};this.pointSize=d(e.pointSize,1),this.sizeAttenuation=d(e.sizeAttenuation,!0),this.sortParticles=d(e.sortParticles,!1),this.useTexture=d(e.useTexture,!1),this.alphaTest=d(e.alphaTest,.5),this.forceTransparent=d(e.forceTransparent,!1),this.edgeBleach=d(e.edgeBleach,0),os.prototype.init.call(this,e)},createData:function(t){var e={position:!0,color:!0},i=t.getAtomData(this.getAtomParams(e)),n=new ns(i.position,i.color,this.getBufferParams({pointSize:this.pointSize,sizeAttenuation:this.sizeAttenuation,sortParticles:this.sortParticles,useTexture:this.useTexture,alphaTest:this.alphaTest,forceTransparent:this.forceTransparent,edgeBleach:this.edgeBleach}));return{bufferList:[n]}},updateData:function(t,e){var i=e.sview.getAtomData(this.getAtomParams(t)),n={};t&&!t.position||(n.position=i.position),t&&!t.color||(n.color=i.color),e.bufferList[0].setAttributes(n)}}),xv.add("point",sc),_v.add("shader/Ribbon.vert","#define STANDARD\nuniform float nearClip;\nuniform vec3 clipCenter;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || !defined( PICKING )\nvarying vec3 vViewPosition;\n#endif\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\nattribute vec3 dir;\nattribute float size;\n#ifdef PICKING\nattribute vec3 pickingColor;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#endif\n#include common\nvoid main(void){\n#ifdef PICKING\nvPickingColor = pickingColor;\n#else\n#include color_vertex\n#include beginnormal_vertex\n#include defaultnormal_vertex\n#ifndef FLAT_SHADED\nvNormal = normalize( transformedNormal );\n#endif\n#endif\n#include begin_vertex\ntransformed += normalize( dir ) * size;\n#include project_vertex\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || !defined( PICKING )\nvViewPosition = -mvPosition.xyz;\n#endif\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n}"),cc.prototype=Object.assign(Object.create(Ia.prototype),{constructor:cc,setAttributes:function(t){var e,i,n,r,o,a,s,c,h,u,l,d,f=this.size,p=f/4,m=this.geometry.attributes;t.position&&(e=t.position,s=m.position.array,m.position.needsUpdate=!0),t.normal&&(i=t.normal,c=m.normal.array,m.normal.needsUpdate=!0),t.size&&(n=t.size,h=m.size.array,m.size.needsUpdate=!0),t.dir&&(r=t.dir,u=m.dir.array,m.dir.needsUpdate=!0),t.color&&(o=t.color,l=m.color.array,m.color.needsUpdate=!0),t.pickingColor&&(a=t.pickingColor,d=m.pickingColor.array,m.pickingColor.needsUpdate=!0);var g,v,y,b,x,w,_,S=n?n[0]:null;for(g=0;g_)continue}f=T.substr(5,5).trim(),p=parseInt(T.substr(0,5)),m=parseInt(T.substr(15,5)),A.growIfFull(),A.atomTypeId[M]=S.add(d),A.x[M]=L,A.y[M]=R,A.z[M]=O,A.serial[M]=m,o.addAtom(P,"","",f,p,0,"l"),M+=1}}}t.Debug&&mv.time("GroParser._parse "+this.name);var i,n,r=this.structure,o=this.structureBuilder,a=this.firstModelOnly,s=this.asTrajectory,c=this.cAlphaOnly,h=r.frames,u=r.boxes,l=this.streamer.peekLines(3);r.title=l[0].trim();var d,f,p,m,g=l[2].length-l[2].lastIndexOf(".")-1,v=5+g,y=20,b=20+v,x=20+2*v,w=parseInt(l[1]),_=w+3,S=r.atomMap,A=r.atomStore;A.resize(w);var M=0,P=0,C=0;this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)}),r.unitcell=new xc(u[0][0],u[0][4],u[0][8],90,90,90,"P 1"),o.finalize(),r.finalizeAtoms(),Yo(r),Zo(r),r.finalizeBonds(),qo(r,Vv(r)),ea(r),t.Debug&&mv.timeEnd("GroParser._parse "+this.name)}}),wv.add("gro",wc);var Yv={1:"h",2:"h",3:"i",4:"h",5:"g",6:"h",7:"h",8:"h",9:"h",10:"h","":"h"};_c.prototype=Object.assign(Object.create(bc.prototype),{constructor:_c,type:"pdb",_parse:function(){function e(t,e,U){for(var Z,K,Q=t;Q0)continue;var J,tt,et,it,nt;if(M){if(it=s.split(P),nt=10===it.length?1:0,m=it[2],L&&"CA"!==m)continue;J=parseFloat(it[6-nt]),tt=parseFloat(it[7-nt]),et=parseFloat(it[8-nt])}else{if(m=s.substr(12,4).trim(),L&&"CA"!==m)continue;J=parseFloat(s.substr(30,8)),tt=parseFloat(s.substr(38,8)),et=parseFloat(s.substr(46,8))}if(I&&(Z=3*n,i[Z+0]=J,i[Z+1]=tt,i[Z+2]=et,n+=1,N))continue;var rt;M?(h=parseInt(it[1]),rt="",g="H"===s[0]?1:0,u=nt?"":it[4],l=parseInt(it[5-nt]),p="",d=it[3],v=parseFloat(it[9-nt]),y="",f=0):(h=parseInt(s.substr(6,5)),rt=s.substr(76,2).trim(),g="H"===s[0]?1:0,u=s[21].trim(),l=parseInt(s.substr(22,4)),p=s[26].trim(),d=s.substr(17,4).trim(),v=parseFloat(s.substr(60,6)),y=s[16].trim(),f=parseFloat(s.substr(54,6))),G.growIfFull(),G.atomTypeId[X]=V.add(m,rt),G.x[X]=J,G.y[X]=tt,G.z[X]=et,G.serial[X]=h,G.bfactor[X]=isNaN(v)?0:v,G.altloc[X]=y.charCodeAt(0),G.occupancy[X]=isNaN(f)?0:f,T.addAtom(q,u,u,d,l,g,void 0,p),F[h]=X,X+=1}else if("CONECT"===c){var ot=F[parseInt(s.substr(6,5))],at=[11,16,21,26],st={};if(void 0===ot)continue;for(Z=0;Z<4;++Z){var ct=parseInt(s.substr(at[Z],5));if(!Number.isNaN(ct)&&(ct=F[ct],void 0!==ct))if(ot0)continue;var ot=nt[c].replace(Qv,"");if(C&&"CA"!==ot)continue;var at=parseFloat(nt[y]),st=parseFloat(nt[b]),ct=parseFloat(nt[x]);if(P){var ht=3*n;if(i[ht+0]=at,i[ht+1]=st,i[ht+2]=ct,n+=1,W>0)continue}var ut=nt[h],lt=parseInt(nt[s]),dt=nt[v];dt="?"===dt?"":dt;var ft=nt[a],pt=nt[u],mt="H"===nt[f][0]?1:0,gt=nt[m],vt=parseFloat(nt[w]),yt=parseFloat(nt[_]),bt=nt[d];if(bt="."===bt?"":bt,V.growIfFull(),V.atomTypeId[H]=$.add(ot,gt),V.x[H]=at,V.y[H]=st,V.z[H]=ct,V.serial[H]=parseInt(nt[p]),V.bfactor[H]=isNaN(vt)?0:vt,V.occupancy[H]=isNaN(yt)?0:yt,V.altloc[H]=bt.charCodeAt(0),A.addAtom(W,ft,pt,ut,lt,mt,void 0,dt),t.Debug){var xt=I[pt];void 0!==xt&&xt!==ft&&mv.warn(xt,ft)}I[pt]=ft;var wt=nt[l];L[wt]||(L[wt]=new Set),L[wt].add(S.chainStore.count-1),H+=1}else{nt=o.match(Kv),it=nt.length,F===k.length&&(F=0);for(var _t=0;_t0&&(u=!0))),_>=m&&_0)continue;var C=parseFloat(P.substr(0,10)),T=parseFloat(P.substr(10,10)),E=parseFloat(P.substr(20,10));if(o){var I=3*c;if(s[I+0]=C,s[I+1]=T,s[I+2]=E,c+=1,u)continue}var L=P.substr(31,3).trim(),R=L+(w+1);d.growIfFull(),d.atomTypeId[w]=l.add(R,L),d.x[w]=C,d.y[w]=T,d.z[w]=E,d.serial[w]=w,n.addAtom(S,"","","HET",1,1),w+=1}if(_>=v&&_0)continue;if(o&&S>0)continue;b.index=parseInt(P.substr(0,3))-1+A,x.index=parseInt(P.substr(3,3))-1+A;var O=parseInt(P.substr(6,3));i.bondStore.addBond(b,x,O)}++_}}t.Debug&&mv.time("SdfParser._parse "+this.name);var i=this.structure,n=this.structureBuilder,r=this.firstModelOnly,o=this.asTrajectory,a=this.streamer.peekLines(2);i.id=a[0].trim(),i.title=a[1].trim();var s,c,h=i.frames,u=!1,l=i.atomMap,d=i.atomStore;d.resize(Math.round(this.streamer.data.length/50));var f,p,m,g,v,y,b=i.getAtomProxy(),x=i.getAtomProxy(),w=0,_=0,S=0,A=0;this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)}),n.finalize(),i.finalizeAtoms(),i.finalizeBonds(),ia(i),t.Debug&&mv.timeEnd("SdfParser._parse "+this.name)},_postProcess:function(){ia(this.structure)}}),wv.add("sdf",Dc),Nc.prototype=Object.assign(Object.create(bc.prototype),{constructor:Nc,type:"mol2",_parse:function(){function e(t,e,M){for(var P,C=t;CMOLECULE"===T?(y=b,p=0,++g):"@ATOM"===T?(y=x,m=d.count,c&&(n=0,i=new Float32Array(3*v),h.push(i),g>0&&(u=!0))):y="@BOND"===T?w:0;else if(y===b)0===p?(o.title=T,o.id=T):1===p&&(P=T.split(r),v=parseInt(P[0])),++p;else if(y===x){if(P=T.split(r),s&&g>0)continue;var E=parseFloat(P[2]),I=parseFloat(P[3]),L=parseFloat(P[4]);if(c){var R=3*n;if(i[R+0]=E,i[R+1]=I,i[R+2]=L,n+=1,u)continue}var O=P[0],D=P[1],N=P[5].split(".")[0],k=P[6]?parseInt(P[6]):1,F=P[7]?P[7]:"",z=P[8]?parseFloat(P[8]):0;d.growIfFull(),d.atomTypeId[f]=l.add(D,N),d.x[f]=E,d.y[f]=I,d.z[f]=L,d.serial[f]=O,d.bfactor[f]=z,a.addAtom(g,"","",F,k,1),f+=1}else if(y===w){if(s&&g>0)continue;if(c&&g>0)continue;P=T.split(r),_.index=parseInt(P[1])-1+m,S.index=parseInt(P[2])-1+m;var B=A[P[3]];o.bondStore.addBond(_,S,B)}}}t.Debug&&mv.time("Mol2Parser._parse "+this.name);var i,n,r=/\s+/,o=this.structure,a=this.structureBuilder,s=this.firstModelOnly,c=this.asTrajectory,h=o.frames,u=!1,l=o.atomMap,d=o.atomStore;d.resize(Math.round(this.streamer.data.length/60));var f=0,p=0,m=0,g=-1,v=0,y=0,b=1,x=2,w=3,_=o.getAtomProxy(),S=o.getAtomProxy(),A={1:1,2:2,3:3,am:1,ar:1,du:1,un:1,nc:0};this.streamer.eachChunkOfLines(function(t){e(0,t.length,t)}),a.finalize(),o.finalizeAtoms(),Yo(o),Jo(o,!0),ta(o,!0),o.finalizeBonds(),ia(o),qo(o,Vv(o)),t.Debug&&mv.timeEnd("Mol2Parser._parse "+this.name)}}),wv.add("mol2",Nc);var ty=["mmtfVersion","mmtfProducer","unitCell","spaceGroup","structureId","title","depositionDate","releaseDate","experimentalMethods","resolution","rFree","rWork","bioAssemblyList","ncsOperatorList","entityList","groupList","numBonds","numAtoms","numGroups","numChains","numModels","groupsPerChain","chainsPerModel"],ey=["xCoordList","yCoordList","zCoordList","groupIdList","groupTypeList","chainIdList","bFactorList","atomIdList","altLocList","occupancyList","secStructList","insCodeList","sequenceIndexList","chainNameList","bondAtomList","bondOrderList"],iy=ty.concat(ey),ny={0:"i".charCodeAt(0),1:"s".charCodeAt(0),2:"h".charCodeAt(0),3:"e".charCodeAt(0),4:"g".charCodeAt(0),5:"b".charCodeAt(0),6:"t".charCodeAt(0),7:"l".charCodeAt(0),"-1":"".charCodeAt(0)};rh.prototype=Object.assign(Object.create(bc.prototype),{constructor:rh,type:"mmtf",_parse:function(){t.Debug&&mv.time("MmtfParser._parse "+this.name);var e,i,n,r,o,a=this.structure,s=nh(eh(this.streamer.data)),c=["depositionDate","releaseDate","resolution","rFree","rWork","experimentalMethods"];c.forEach(function(t){void 0!==s[t]&&(a.header[t]=s[t])});var h,u,l,d,f,p;if(a.id=s.structureId,a.title=s.title,this.firstModelOnly||this.asTrajectory){for(f=1,d=s.chainsPerModel[0],l=0,e=0,i=d;e0&&(a.biomolDict[st]=ct)}s.unitCell&&Array.isArray(s.unitCell)&&s.unitCell[0]?a.unitcell=new xc(s.unitCell[0],s.unitCell[1],s.unitCell[2],s.unitCell[3],s.unitCell[4],s.unitCell[5],s.spaceGroup):a.unitcell=void 0,t.Debug&&mv.timeEnd("MmtfParser._parse "+this.name),ta(a,!0),Jo(a,!0),a.finalizeAtoms(),a.finalizeBonds(),ea(a)}}),wv.add("mmtf",rh),oh.prototype={constructor:oh},ah.prototype=Object.assign(Object.create(vc.prototype),{constructor:ah,type:"trajectory",__objName:"frames"}),sh.prototype=Object.assign(Object.create(ah.prototype),{constructor:sh,type:"dcd",_parse:function(){t.Debug&&mv.time("DcdParser._parse "+this.name);var e=this.streamer.data;e instanceof Uint8Array&&(e=e.buffer);var i,n,r=new DataView(e),o=this.frames,a=o.coordinates,s=o.boxes,c={},h=0,u=new Int32Array(e,0,23),l=u[0]!==r.getInt32(0);if(84!==u[0])for(n=e.byteLength,i=0;i0)return void mv.error("dcd format with fixed atoms unsupported, aborting");var y=c.NATOM,b=4*y;for(i=0,n=c.NSET;i=o.atomCount+6){r=r.split(a);for(var s=0,l=r.length;sa){var r=i[n].trim();if(""!==r)for(var o=r.split(s),d=0,f=o.length;d=n.elements[s].count&&(s++,c=0);var l=this.parseASCIIElement(n.elements[s].properties,u);this.handleElement(i,n.elements[s].name,l),c++}}return this.postProcess(i)},postProcess:function(t){if(t.useColor){for(var e=0;e=0?i-1:i+e/3)},parseNormalIndex:function(t,e){var i=parseInt(t,10);return 3*(i>=0?i-1:i+e/3)},addVertex:function(t,e,i){var n=this.vertices,r=this.object.geometry.vertices;r.push(n[t+0]),r.push(n[t+1]),r.push(n[t+2]),r.push(n[e+0]),r.push(n[e+1]),r.push(n[e+2]),r.push(n[i+0]),r.push(n[i+1]),r.push(n[i+2])},addVertexLine:function(t){var e=this.vertices,i=this.object.geometry.vertices;i.push(e[t+0]),i.push(e[t+1]),i.push(e[t+2])},addNormal:function(t,e,i){var n=this.normals,r=this.object.geometry.normals;r.push(n[t+0]),r.push(n[t+1]),r.push(n[t+2]),r.push(n[e+0]),r.push(n[e+1]),r.push(n[e+2]),r.push(n[i+0]),r.push(n[i+1]),r.push(n[i+2])},addFace:function(t,e,i,n,r,o,a,s){var c,h=this.vertices.length,u=this.parseVertexIndex(t,h),l=this.parseVertexIndex(e,h),d=this.parseVertexIndex(i,h);if(void 0===n?this.addVertex(u,l,d):(c=this.parseVertexIndex(n,h),this.addVertex(u,l,c),this.addVertex(l,d,c)),void 0!==r){var f=this.normals.length;u=this.parseNormalIndex(r,f),l=r===o?u:this.parseNormalIndex(o,f),d=r===a?u:this.parseNormalIndex(a,f),void 0===n?this.addNormal(u,l,d):(c=this.parseNormalIndex(s,f),this.addNormal(u,l,c),this.addNormal(l,d,c))}},addLineGeometry:function(t){this.object.geometry.type="Line";for(var e=this.vertices.length,i=0,n=t.length;i0?w.addAttribute("normal",new Kt(new Float32Array(x.normals),3)):w.computeVertexNormals(),y.push(w)}}return y}},vh.prototype=Object.assign(Object.create(fh.prototype),{constructor:vh,type:"obj"}),wv.add("obj",vh),yh.prototype=Object.assign(Object.create(vc.prototype),{constructor:yh,type:"text",__objName:"text",_parse:function(){this.text.data=this.streamer.asText()}}),wv.add("txt",yh),wv.add("text",yh),bh.prototype=Object.assign(Object.create(vc.prototype),{constructor:bh,type:"csv",__objName:"table",_parse:function(){var t=this.table.data,e=/\s*,\s*/;this.streamer.eachChunkOfLines(function(i,n){for(var r=i.length,o=0;o");){var i=o();if(!i)return e;e.attributes[i.name]=i.value}return s(/\?>\s*/),e}}function n(){var t=s(/^<([\w-:.]+)\s*/);if(t){for(var e={name:t[1],attributes:{},children:[]};!(c()||h(">")||h("?>")||h("/>"));){var i=o();if(!i)return e;e.attributes[i.name]=i.value}if(s(/^\s*\/>\s*/))return e;s(/\??>\s*/),e.content=r();for(var a;a=n();)e.children.push(a);return s(/^<\/[\w-:.]+>\s*/),e}}function r(){var t=s(/^([^<]*)/);return t?t[1]:""}function o(){var t=s(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(t)return{name:t[1],value:a(t[2])}}function a(t){return t.replace(/^['"]|['"]$/g,"")}function s(e){var i=t.match(e);if(i)return t=t.slice(i[0].length),i}function c(){return 0===t.length}function h(e){return 0===t.indexOf(e)}return t=t.trim(),t=t.replace(//g,""),e()},__domParser:function(t){var e=new window.DOMParser;return e.parseFromString(t,"text/xml")},_parse:function(){t.Debug&&mv.time("XmlParser._parse "+this.name),this.useDomParser?this.streamer.isBinary()||this.string?this.xml.data=this.__domParser(this.streamer.asText()):this.xml.data=this.streamer.data:this.xml.data=this.__xmlParser(this.streamer.asText()),t.Debug&&mv.timeEnd("XmlParser._parse "+this.name)}}),wv.add("xml",wh);var ry,oy,ay=Ch(),sy=30,cy=12,hy=15,uy=852,ly=592,dy=0,fy=1,py=2,my=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],gy=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],vy=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],yy=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],by=0,xy=1,wy=2,_y=4,Sy=5,Ay=6,My=0,Py=1,Cy=2,Ty=-2,Ey=-3,Iy=-4,Ly=-5,Ry=8,Oy=1,Dy=2,Ny=3,ky=4,Fy=5,zy=6,By=7,Uy=8,jy=9,$y=10,Vy=11,Gy=12,Hy=13,Wy=14,Xy=15,qy=16,Yy=17,Zy=18,Ky=19,Qy=20,Jy=21,tb=22,eb=23,ib=24,nb=25,rb=26,ob=27,ab=28,sb=29,cb=30,hb=31,ub=32,lb=852,db=592,fb=!0,pb=!0,mb=!0;try{String.fromCharCode.apply(null,[0])}catch(t){pb=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){mb=!1}for(var gb=new Uint8Array(256),vb=0;vb<256;vb++)gb[vb]=vb>=252?6:vb>=248?5:vb>=240?4:vb>=224?3:vb>=192?2:1;gb[254]=gb[254]=1;var yb=0,bb=2,xb=4,wb=0,_b=1,Sb=2,Ab=-5,Mb={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Pb=Object.prototype.toString;Zh.prototype.push=function(t,e){var i,n,r,o,a,s,c=this.strm,h=this.options.chunkSize,u=this.options.dictionary,l=!1;if(this.ended)return!1;n=e===~~e?e:e===!0?xb:yb,"string"==typeof t?c.input=Hh(t):"[object ArrayBuffer]"===Pb.call(t)?c.input=new Uint8Array(t):c.input=t,c.next_in=0,c.avail_in=c.input.length;do{if(0===c.avail_out&&(c.output=new Uint8Array(h),c.next_out=0,c.avail_out=h),i=Bh(c,yb),i===Sb&&u&&(s="string"==typeof u?Vh(u):"[object ArrayBuffer]"===Pb.call(u)?new Uint8Array(u):u,i=$h(this.strm,s)),i===Ab&&l===!0&&(i=wb,l=!1),i!==_b&&i!==wb)return this.onEnd(i),this.ended=!0,!1;c.next_out&&(0!==c.avail_out&&i!==_b&&(0!==c.avail_in||n!==xb&&n!==bb)||("string"===this.options.to?(r=Xh(c.output,c.next_out),o=c.next_out-r,a=Wh(c.output,r),c.next_out=o,c.avail_out=h-o,o&&Ah(c.output,c.output,r,o,0),this.onData(a)):this.onData(Sh(c.output,c.next_out)))),0===c.avail_in&&0===c.avail_out&&(l=!0)}while((c.avail_in>0||0===c.avail_out)&&i!==_b);return i===_b&&(n=xb),n===xb?(i=Uh(this.strm),this.onEnd(i),this.ended=!0,i===wb):n!==bb||(this.onEnd(wb),c.avail_out=0,!0)},Zh.prototype.onData=function(t){this.chunks.push(t)},Zh.prototype.onEnd=function(t){t===wb&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Mh(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},Sv.add("gz",Qh);var Cb="//files.rcsb.org/download/",Tb="//mmtf.rcsb.org/v1.0/",Eb=Tb+"full/",Ib=Tb+"reduced/";bv.add("rcsb",new Jh);var Lb="//pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/",Rb="/SDF?record_type=3d";bv.add("pubchem",new tu),bv.add("ftp",new eu),bv.add("http",new eu),bv.add("https",new eu);var Ob="0.9.3";window.Promise||(window.Promise=n),t.Version=Ob,t.setDebug=ar,t.DatasourceRegistry=bv,t.StaticDatasource=iu,t.ParserRegistry=wv,t.autoLoad=gr,t.RepresentationRegistry=xv,t.ColorMakerRegistry=yv,t.ColorMaker=Fn,t.Selection=On,t.PdbWriter=xr,t.Stage=Cs,t.Collection=ls,t.ComponentCollection=ds,t.RepresentationCollection=fs,t.Assembly=Wo,t.TrajectoryPlayer=Ts,t.superpose=ws,t.guessElement=Gv,t.Queue=Pa,t.Counter=wr,t.throttle=b,t.download=v,t.getQuery=u,t.getDataInfo=mr,t.getFileInfo=y,t.uniqueArray=x,t.BufferRepresentation=Qa,t.SphereBuffer=Ua,t.EllipsoidBuffer=$a,t.CylinderBuffer=Wa,t.ConeBuffer=qa,t.ArrowBuffer=Ya,t.Shape=Za,t.Kdtree=Vo,t.SpatialHash=Lo,t.Signal=Rn,t.Matrix3=Lt,t.Matrix4=O,t.Vector3=N,t.Quaternion=D,t.Plane=Rt,t.Color=Ct,Object.defineProperty(t,"__esModule",{value:!0})}); diff --git a/package.json b/package.json index 4d1a082a8..380ccba09 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ngl", - "version": "0.9.3-dev.1", + "version": "0.9.3", "description": "Scalable molecular graphics for the web", "main": "dist/ngl.js", "scripts": {