From 43faebe42eca768e36b007966d7b085e1872a534 Mon Sep 17 00:00:00 2001
From: HammadTheOne <30986043+HammadTheOne@users.noreply.github.com>
Date: Mon, 15 Feb 2021 14:01:04 -0500
Subject: [PATCH] 0.6.1 Patch for NGL fixes (#544)

* Added ref instead of id

* Updated package for 0.6.1 release
---
 CHANGELOG.md                                  |  4 ++
 DESCRIPTION                                   |  2 +-
 R/internal.R                                  | 46 +++++++++----------
 dash_bio/NglMoleculeViewer.py                 |  6 +--
 dash_bio/async-nglmoleculeviewer.js           |  2 +-
 dash_bio/bundle.js                            |  2 +-
 dash_bio/metadata.json                        |  6 +--
 dash_bio/package-info.json                    |  2 +-
 inst/deps/async-nglmoleculeviewer.js          |  2 +-
 inst/deps/bundle.js                           |  2 +-
 man/dashbioNglMoleculeViewer.Rd               |  2 +-
 package.json                                  |  2 +-
 src/lib/components/NglMoleculeViewer.react.js |  6 +--
 src/lib/fragments/NglMoleculeViewer.react.js  | 37 +++++++++++++--
 14 files changed, 76 insertions(+), 45 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 17dc6806d..3a3fb8c96 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # Changelog
 
+## [0.6.1] - 2021-02-15
+### Fixed
+* [#544](https://github.com/plotly/dash-bio/pull/544) Miscellaneous fixes for NglMoleculeViewer component.
+
 ## [0.6.0] - 2021-01-28
 ### Added
 * [#537](https://github.com/plotly/dash-bio/pull/537) Added Dash-IGV component.
diff --git a/DESCRIPTION b/DESCRIPTION
index f40f2f6e9..786ce175b 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
 Package: dashBio
 Title: Open-source Bioinformatics Components for Dash
-Version: 0.6.0
+Version: 0.6.1
 Description: A suite of components that makes it simpler to analyze and visualize bioinformatics data and interact with them in a Dash application.
 Depends: R (>= 3.0.2), manhattanly
 Imports: dash
diff --git a/R/internal.R b/R/internal.R
index cf740ff9a..b3e4b6a19 100644
--- a/R/internal.R
+++ b/R/internal.R
@@ -1,138 +1,138 @@
 .dashBio_js_metadata <- function() {
 deps_metadata <- list(`dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-alignment.js',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, async = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-circos.js',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, async = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-ideogram.js',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, async = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-igv.js',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, async = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-moleculeviewer2.js',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, async = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-moleculeviewer3.js',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, async = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-needle.js',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, async = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-nglmoleculeviewer.js',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, async = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-onco.js',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, async = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-sequence.js',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, async = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-speck.js',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, async = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-alignment.js.map',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, dynamic = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-circos.js.map',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, dynamic = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-ideogram.js.map',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, dynamic = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-igv.js.map',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, dynamic = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-moleculeviewer2.js.map',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, dynamic = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-moleculeviewer3.js.map',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, dynamic = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-needle.js.map',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, dynamic = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-nglmoleculeviewer.js.map',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, dynamic = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-onco.js.map',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, dynamic = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-sequence.js.map',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, dynamic = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'async-speck.js.map',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
 all_files = FALSE, dynamic = TRUE), class = "html_dependency"),
 `dash_bio` = structure(list(name = "dash_bio",
-version = "0.6.0", src = list(href = NULL,
+version = "0.6.1", src = list(href = NULL,
 file = "deps"), meta = NULL,
 script = 'bundle.js',
 stylesheet = NULL, head = NULL, attachment = NULL, package = "dashBio",
diff --git a/dash_bio/NglMoleculeViewer.py b/dash_bio/NglMoleculeViewer.py
index fedc14059..8ad97faeb 100644
--- a/dash_bio/NglMoleculeViewer.py
+++ b/dash_bio/NglMoleculeViewer.py
@@ -15,9 +15,9 @@ class NglMoleculeViewer(Component):
 Keyword arguments:
 - id (string; optional): The ID of this component, used to identify dash components in callbacks.
 The ID needs to be unique across all of the components in an app.
-- width (string | number; default '500px'): The width (in px or as a number) of the container
+- width (string | number; default '600px'): The width (in px or as a number) of the container
 in which the molecules will be displayed.
-- height (string | number; default '500px'): The height (in px or as a number) of the container
+- height (string | number; default '600px'): The height (in px or as a number) of the container
 in which the molecules will be displayed.
 - stageParameters (dict; default {
     quality: 'medium',
@@ -75,7 +75,7 @@ class NglMoleculeViewer(Component):
 ext: file extensions (pdb or cif)
 selectedValue: pdbString
 chain: ALL if the whole molecule shoud be displayed, e.g. A for showing only chain A
-aaRange: ALL if the whole molecule shoud be displayed, e.g. 1:50 for showing only 50 atoms
+aaRange: ALL if the whole molecule should be displayed, e.g. 1:50 for showing only 50 atoms
 color: chain color
 chosen.atoms: string of the chosen Atoms, e.g. 50,100,150
               --> chosen eatoms changed to colored 'ball'
diff --git a/dash_bio/async-nglmoleculeviewer.js b/dash_bio/async-nglmoleculeviewer.js
index 382255e93..a3eb75b69 100644
--- a/dash_bio/async-nglmoleculeviewer.js
+++ b/dash_bio/async-nglmoleculeviewer.js
@@ -91,4 +91,4 @@ function Ds(t,e,i,r,n){this._listener=e,this._isOnce=i,this.context=r,this._sign
  * @param {Float32Array} points - points
  * @param {Function} metric - metric
  */
-function Pp(t,e){for(var i=t.length/3,r=0,n=new Uint32Array(i),o=0;o<i;++o)n[o]=o;var a=new Int32Array(4*i),s=0,c=0;var u=function e(i,o,u,h){i>r&&(r=i);var l=h-u;if(0===l)return-1;var p=4*s;if(s+=1,1===l)return a[p]=u,a[p+1]=-1,a[p+2]=-1,a[p+3]=o,p;var d,f,m,g,v,y=u+Math.floor(l/2);c=i%3;for(var b=u,x=h-1;x>b;){for(g=t[3*n[m=b+x>>1]+c],f=n[m],n[m]=n[x],n[x]=f,v=b,d=b;d<x;++d)t[3*n[d]+c]<g&&(f=n[v],n[v]=n[d],n[d]=f,++v);if(f=n[x],n[x]=n[v],n[v]=f,y===(m=v))break;y<m?x=m-1:b=m+1}return a[p]=y,a[p+1]=e(i+1,p,u,y),a[p+2]=e(i+1,p,y+1,h),a[p+3]=o,p}(0,-1,0,i);this.rootIndex=u,this.maxDepth=r,this.nearest=function(i,r,o){var s=new Mp((function(t){return-t[1]}));!function c(u){var h,l,p=function t(e){var i=a[e+3];return-1===i?0:t(i)+1}(u)%3,d=3*n[a[u]],f=[t[d+0],t[d+1],t[d+2]],m=e(i,f);function g(t,e){s.push([t,e]),s.size()>r&&s.pop()}var v=a[u+1],y=a[u+2];if(-1!==y||-1!==v){c(h=-1===y?v:-1===v?y:i[p]<=t[d+p]?v:y),(s.size()<r||m<s.peek()[1])&&m<=o&&g(u,m);for(var b=[],x=0;x<3;x+=1)b[x]=x===p?i[x]:t[d+x];var _=e(b,f);(s.size()<r||Math.abs(_)<s.peek()[1])&&Math.abs(_)<=o&&-1!==(l=h===v?y:v)&&c(l)}else(s.size()<r||m<s.peek()[1])&&m<=o&&g(u,m)}(u);for(var c=[],h=0,l=Math.min(s.size(),r);h<l;h+=1)c.push(s.content[h]);return c},this.indices=n,this.nodes=a,this.verify=function e(i,r){var o=1;if(void 0===i&&(i=u,r=0),-1===i)throw new Error("node is null");var s=r%3,c=a[i+1],h=a[i+2];if(-1!==c){if(t[3*n[a[c]]+s]>t[3*n[a[i]]+s])throw new Error("left child is > parent!");o+=e(c,r+1)}if(-1!==h){if(t[3*n[a[h]]+s]<t[3*n[a[i]]+s])throw new Error("right child is < parent!");o+=e(h,r+1)}return o}}function Tp(t,e){var i;gc&&mc.time("Kdtree build"),i=e?function(t,e){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return i*i+r*r+n*n}:function(t,e){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return Math.sqrt(i*i+r*r+n*n)};var r=new Float32Array(3*t.atomCount),n=new Uint32Array(t.atomCount),o=0;t.eachAtom((function(t){r[o+0]=t.x,r[o+1]=t.y,r[o+2]=t.z,n[o/3]=t.index,o+=3})),this.atomIndices=n,this.points=r,this.kdtree=new Pp(r,i),gc&&mc.timeEnd("Kdtree build")}Sp.prototype={constructor:Sp,getCenterIterator:function(t){var e=this.getPosition().center,i=e.length/3,r=0,n=-1,o=[new O,new O,new O,new O];return{size:i,next:function(){var t=this.get(n);return n+=1,t},get:function(n){n=Math.min(i-1,Math.max(0,n));var a=o[r%4],s=3*n;if(a.fromArray(e,s),t){var c,u,h,l=Math.min(t,n,i-n-1);for(u=1;u<=l;++u)c=3*u,h=(l+1-u)/(l+1),a.x+=h*e[s-c+0]+h*e[s+c+0],a.y+=h*e[s-c+1]+h*e[s+c+1],a.z+=h*e[s-c+2]+h*e[s+c+2];a.x/=l+1,a.y/=l+1,a.z/=l+1}return r+=1,a},reset:function(){r=0,n=-1}}},getColor:function(t){var e=this.polymer,i=e.structure,r=e.residueCount,n=e.residueIndexStart,o=new Float32Array(3*r),a=t||{};a.structure=i;for(var s=yc.getScheme(a),c=i.getResidueProxy(),u=i.getAtomProxy(),h=0;h<r;++h)c.index=n+h,u.index=c.traceAtomIndex,s.atomColorToArray(u,o,3*h);return{color:o}},getPicking:function(){for(var t=this.polymer,e=t.structure,i=t.residueCount,r=t.residueIndexStart,n=new Float32Array(i),o=e.getResidueProxy(),a=0;a<i;++a)o.index=r+a,n[a]=o.traceAtomIndex;return{picking:new $h(n,e)}},getSize:function(t,e){for(var i=this.polymer,r=i.structure,n=i.residueCount,o=i.residueIndexStart,a=new Float32Array(n),s=new Il(t,e),c=r.getResidueProxy(),u=r.getAtomProxy(),h=0;h<n;++h)c.index=o+h,u.index=c.traceAtomIndex,a[h]=s.atomRadius(u);return{size:a}},getPosition:function(){var t,e,i,r,n,o=this.polymer,a=o.structure,s=o.residueCount,c=s-3,u=new Float32Array(3*s),h=new Float32Array(3*s),l=new Float32Array(s),p=new Float32Array(s),d=new Float32Array(s),f=new Float32Array(s),m=new Float32Array(3*s),g=new O,v=new O,y=new O,b=new O,x=new O,_=new O,w=new O,S=new O,A=new O,M=new O,P=new O,T=new O(0,0,0),E="trace",C=a.getAtomProxy(),I=a.getAtomProxy(o.getAtomIndexByType(0,E)),R=a.getAtomProxy(o.getAtomIndexByType(1,E)),L=a.getAtomProxy(o.getAtomIndexByType(2,E));for(i=0;i<c;++i)C.index=I.index,I.index=R.index,R.index=L.index,L.index=o.getAtomIndexByType(i+3,E),e=3*i,g.subVectors(I,C),v.subVectors(R,I),y.subVectors(L,R),b.subVectors(g,v),x.subVectors(v,y),A.crossVectors(b,x).normalize(),A.toArray(h,e),i>0&&(l[i]=A.angleTo(M)),t=Math.cos(b.angleTo(x)),f[i]=180/Math.PI*Math.acos(t),r=b.length(),n=x.length(),p[i]=Math.sqrt(n*r)/Math.max(2,2*(1-t)),d[i]=Math.abs(v.dot(A)),_.copy(b).multiplyScalar(p[i]/r),w.copy(x).multiplyScalar(p[i]/n),_.subVectors(I,_),w.subVectors(R,w),_.toArray(u,e+3),w.toArray(u,e+6),P.subVectors(C,T),P.toArray(m,e),M.copy(A),T.copy(_);for(_.fromArray(u,3),w.fromArray(u,6),A.subVectors(_,w).normalize(),C.index=o.getAtomIndexByType(0,E),T.copy(C),S.copy(C),wh(S,A,_),S.toArray(u,0),P.subVectors(T,_),P.toArray(m,0),_.fromArray(u,3*s-6),w.fromArray(u,3*s-9),A.subVectors(_,w).normalize(),C.index=o.getAtomIndexByType(s-1,E),T.copy(C),S.copy(C),wh(S,A,_),S.toArray(u,3*s-3),i=s-3;i<s;++i)_.fromArray(u,3*i),C.index=o.getAtomIndexByType(i,E),T.copy(C),P.subVectors(T,_),P.toArray(m,3*i);var N=new Float32Array(s),D=new Float32Array(s),k=new Float32Array(s),F=new Float32Array(s);for(N[1]=p[0],D[1]=f[0],k[1]=p[0],i=2;i<s-2;++i)N[i]=.5*(p[i-2]+p[i-1]),D[i]=.5*(f[i-2]+f[i-1]),k[i]=.5*(d[i-2]+d[i-1]),_.fromArray(h,3*(i-2)),w.fromArray(h,3*(i-1)),F[i]=180/Math.PI*Math.acos(Math.cos(_.angleTo(w)));N[s-2]=p[s-4],D[s-2]=f[s-4],k[s-2]=d[s-4];var B=new Float32Array(3*s);for(uu(h,B,0,0,3),uu(h,B,0,3,3),i=2;i<s-2;++i)_.fromArray(h,3*(i-2)),w.fromArray(h,3*(i-1)),A.addVectors(w,_).multiplyScalar(.5).normalize(),A.toArray(B,3*i);return uu(h,B,3*s-12,3*s-6,3),uu(h,B,3*s-12,3*s-3,3),{center:u,axis:B,bending:F,radius:N,rise:k,twist:D,resdir:m}}},Ap.prototype={constructor:Ap,getAxis:function(t,e,i,r,n,o){t=t||30,e=e||2.5,i=void 0!==i&&i;var a=this.polymer,s=a.structure,c=a.residueCount,u=a.residueIndexStart,h=this.position,l=r||{};l.structure=s;for(var p,d,f=yc.getScheme(l),m=new Il(n,o),g=0,v=0,y=[],b=[],x=[],_=[],w=[],S=[],A=[],M=[],P=[],T=[],E=[],C=new O,I=new O,R=s.getResidueProxy(),L=s.getResidueProxy(),N=s.getAtomProxy(),D=new O,k=new O,F=!1,B=0;B<c;++B)if(R.index=u+B,D.fromArray(h.center,3*B),B===c-1?F=!0:(L.index=u+B+1,k.fromArray(h.center,3*B+3),i&&R.sstruc!==L.sstruc?F=!0:D.distanceTo(k)>e?F=!0:h.bending[B]>t&&(F=!0)),F){if(B-g<4){g=B,F=!1;continue}N.index=R.traceAtomIndex,T=h.axis.subarray(3*g+3,3*B),E=h.center.subarray(3*g,3*B+3),p=_h(T).normalize(),d=_h(E),C.fromArray(E),wh(C,p,d),I.fromArray(E,E.length-3),wh(I,p,d),p.subVectors(I,C),p.toArray(y,v),d.toArray(b,v),C.toArray(x,v),I.toArray(_,v),f.atomColorToArray(N,w,v),S.push(N.index),A.push(m.atomRadius(N)),M.push(u+g),P.push(u+B+1-g),v+=3,g=B,F=!1}var z=new Float32Array(S);return{axis:new Float32Array(y),center:new Float32Array(b),begin:new Float32Array(x),end:new Float32Array(_),color:new Float32Array(w),picking:new $h(z,s),size:new Float32Array(A),residueOffset:M,residueCount:P}}},Mp.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;i<e;i++)if(this.content[i]===t){var r=this.content.pop();return void(i!==e-1&&(this.content[i]=r,this.scoreFunction(r)<this.scoreFunction(t)?this.bubbleUp(i):this.sinkDown(i)))}throw new Error("Node not found.")},size:function(){return this.content.length},bubbleUp:function(t){for(var e=this.content[t];t>0;){var i=Math.floor((t+1)/2)-1,r=this.content[i];if(!(this.scoreFunction(e)<this.scoreFunction(r)))break;this.content[i]=e,this.content[t]=r,t=i}},sinkDown:function(t){for(var e,i=this.content.length,r=this.content[t],n=this.scoreFunction(r);;){var o=2*(t+1),a=o-1,s=null;if(a<i){var c=this.content[a];(e=this.scoreFunction(c))<n&&(s=a)}if(o<i){var u=this.content[o];this.scoreFunction(u)<(null===s?n:e)&&(s=o)}if(null===s)break;this.content[t]=this.content[s],this.content[s]=r,t=s}}},Tp.prototype={nearest:(vp=new Float32Array(3),function(t,e,i){t.toArray?t.toArray(vp):t.positionToArray&&t.positionToArray(vp);for(var r=this.kdtree.nearest(vp,e,i),n=this.kdtree.indices,o=this.kdtree.nodes,a=this.atomIndices,s=[],c=0,u=r.length;c<u;++c){var h=r[c],l=h[0],p=h[1];s.push({index:a[n[o[l]]],distance:p})}return s})};var Ep={" ":"X","!":"Y","#":"Z",$:"-X","%":"-Y","&":"-Z","'":"Y+1/2","(":"1/2+X",")":"1/2+Y","*":"1/2-X","+":"1/2+Z",",":"1/2-Y","-":"1/2-Z",".":"X+1/2","/":"Z+1/2",0:"-X+1/2",1:"-Y+1/2",2:"-Z+1/2",3:"1/4+X",4:"1/4-Y",5:"1/4+Z",6:"1/4-X",7:"1/4+Y",8:"3/4-Y",9:"3/4+Z",":":"3/4+Y",";":"3/4+X","<":"3/4-X","=":"1/4-Z",">":"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"},Cp={"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":" !#*,#.%&$'&!# ,- '&$%/$# !-*!/$%&.%()+$%+ ,-*!-)+(%&(!-*,#*+()&$)#*,- ,"};function Ip(t){var e="";return t.length>0&&(e=":"+ko(t).join(" OR :")),new nc(e)}var Rp=function(t){this.name=t||"",this.partList=[]},Lp={type:{}};Lp.type.get=function(){return"Assembly"},Rp.prototype.addPart=function(t,e){var i=new Op(t,e);return this.partList.push(i),i},Rp.prototype._getCount=function(t,e){var i=0;return this.partList.forEach((function(r){i+=r[e](t)})),i},Rp.prototype.getAtomCount=function(t){return this._getCount(t,"getAtomCount")},Rp.prototype.getResidueCount=function(t){return this._getCount(t,"getResidueCount")},Rp.prototype.getInstanceCount=function(){var t=0;return this.partList.forEach((function(e){t+=e.matrixList.length})),t},Rp.prototype.isIdentity=function(t){if(1!==this.partList.length)return!1;var e=this.partList[0];if(1!==e.matrixList.length)return!1;if(!(new N).equals(e.matrixList[0]))return!1;var i=[];return t.eachChain((function(t){i.push(t.chainname)})),i=ko(i),e.chainList.length===i.length},Rp.prototype.getBoundingBox=function(t){var e=new jt;return this.partList.forEach((function(i){var r=i.getBoundingBox(t);e.expandByPoint(r.min),e.expandByPoint(r.max)})),e},Rp.prototype.getCenter=function(t){return this.getBoundingBox(t).getCenter()},Rp.prototype.getSelection=function(){var t=[];return this.partList.forEach((function(e){t=t.concat(e.chainList)})),Ip(t)},Object.defineProperties(Rp.prototype,Lp);var Op=function(t,e){this.matrixList=t||[],this.chainList=e||[]},Np={type:{}};function Dp(t,e){if(e){gc&&mc.time("assignSecondaryStructure");var i=[];t.eachModel((function(t){t.eachChain((function(t){i.push(t.chainname)}))}));var r=i.slice().sort(),n=[];r.forEach((function(t){n.push(i.indexOf(t))}));var o=e.helices;(o=o.filter((function(t){return No(r,t[0])>=0}))).sort((function(t,e){var i=t[0],o=e[0],a=t[1],s=e[1];if(i===o)return a===s?0:a<s?-1:1;var c=No(r,i),u=No(r,o);return n[c]<n[u]?-1:1}));var a=t.residueStore;t.eachModel((function(t){var e=0,i=o.length;if(0!==i){var r=o[e],n=!1,s=!1;t.eachChain((function(t){var c=!1;if(t.chainname===r[0])for(var u=t.residueCount,h=t.residueOffset,l=h+u,p=h;p<l;++p)if(a.resno[p]===r[1]&&a.getInscode(p)===r[2]&&(n=!0),n&&(a.sstruc[p]=r[6],a.resno[p]===r[4]&&a.getInscode(p)===r[5]&&(n=!1,(e+=1)<i?(p=h-1,r=o[e],c=t.chainname!==r[0]):s=!0)),c||s)return}))}}));var s=e.sheets;(s=s.filter((function(t){return No(r,t[0])>=0}))).sort((function(t,e){var i=t[0],o=e[0];if(i===o)return 0;var a=No(r,i),s=No(r,o);return n[a]<n[s]?-1:1}));var c="e".charCodeAt(0);t.eachModel((function(t){var e=0,i=s.length;if(0!==i){var r=s[e],n=!1,o=!1;t.eachChain((function(t){var u=!1;if(t.chainname===r[0])for(var h=t.residueCount,l=t.residueOffset,p=l+h,d=l;d<p;++d)if(a.resno[d]===r[1]&&a.getInscode(d)===r[2]&&(n=!0),n&&(a.sstruc[d]=c,a.resno[d]===r[4]&&a.getInscode(d)===r[5]&&(n=!1,(e+=1)<i?(d=l-1,r=s[e],u=t.chainname!==r[0]):o=!0)),u||o)return}))}})),gc&&mc.timeEnd("assignSecondaryStructure")}}Np.type.get=function(){return"AssemblyPart"},Op.prototype._getCount=function(t,e){var i=0,r=this.chainList;return t.eachChain((function(t){(0===r.length||r.includes(t.chainname))&&(i+=t[e])})),this.matrixList.length*i},Op.prototype.getAtomCount=function(t){return this._getCount(t,"atomCount")},Op.prototype.getResidueCount=function(t){return this._getCount(t,"residueCount")},Op.prototype.getBoundingBox=function(t){var e=new jt,i=new jt,r=this.getSelection(),n=t.getBoundingBox(r);return this.matrixList.forEach((function(t){i.copy(n).applyMatrix4(t),e.expandByPoint(i.min),e.expandByPoint(i.max)})),e},Op.prototype.getSelection=function(){return Ip(this.chainList)},Op.prototype.getView=function(t){var e=this.getSelection();return e?t.getView(e):t},Op.prototype.getInstanceList=function(){for(var t=[],e=0,i=this.matrixList.length;e<i;++e)t.push({id:e+1,name:e,matrix:this.matrixList[e]});return t},Object.defineProperties(Op.prototype,Np);var kp,Fp,Bp,zp=(kp=function(t,e,i,r){for(var n=t.structure,o=t.residueIndexStart,a=n.getResidueProxy(),s=n.getResidueProxy(),c=n.getAtomProxy(),u=n.getAtomProxy(),h=Math.max(0,e-2);h<=e;++h)for(var l=2;l<5;++l)if(!(h+l>=t.residueCount)){a.index=o+h,s.index=o+h+l,c.index=a.traceAtomIndex,u.index=s.traceAtomIndex;var p=c.distanceTo(u);if(Math.abs(p-i[l-2])>r)return!1}return!0},Fp=function(t,e){return kp(t,e,[5.45,5.18,6.37],2.1)},Bp=function(t,e){return kp(t,e,[6.1,10.4,13],1.42)},function(t){gc&&mc.time("calculateSecondaryStructure"),t.eachPolymer((function(t){if(!(t.residueCount<4)){if(t.isCg())!function(t){for(var e=t.residueStore,i=t.residueIndexStart,r=new Ap(t).position,n=new O,o=new O,a=0,s=t.residueCount;a<s;++a){n.fromArray(r.center,3*a),o.fromArray(r.center,3*a+3);var c=n.distanceTo(o);c<2&&c>1&&r.bending[a]<20&&(e.sstruc[i+a]="h".charCodeAt(0),e.sstruc[i+a+1]="h".charCodeAt(0))}}(t);else{if(!t.isProtein())return;!function(t){for(var e=t.residueStore,i=t.residueIndexStart,r=0,n=t.residueCount;r<n;++r){var o="c";Fp(t,r)?o="h":Bp(t,r)&&(o="s"),e.sstruc[i+r]=o.charCodeAt(0)}}(t)}var e,i=0;t.eachResidue((function(t){t.sstruc===e?i+=1:(1===i&&(t.index-=1,t.sstruc="c"),i=1,e=t.sstruc)}))}})),gc&&mc.timeEnd("calculateSecondaryStructure")});function Up(t){gc&&mc.time("calculateChainnames");var e=!0;if(t.eachChain((function(t){t.chainname&&(e=!1)})),e){var i="ABCDEFGHIJKLMNOPQRSTUVWXYZ",r=i.length,n=t.modelStore,o=t.chainStore,a=t.residueStore,s=function(t){for(var e=t,n=0,o=i[e%r];e>=r;)e=Math.floor(e/r),o+=i[e%r],n+=1;return n>=5&&mc.warn("chainname overflow"),o},c=t.getAtomProxy(),u=t.getAtomProxy(),h=0,l=0,p=0,d=0,f=[];1===a.count?f.push({mIndex:0,chainname:"A",rStart:0,rCount:1}):t.eachResidueN(2,(function(t,e){var i=!1,r=t.backboneType,n=e.backboneType;d=t.index,t.modelIndex!==e.modelIndex?i=!0:t.moleculeType!==e.moleculeType?i=!0:0!==r&&r===n&&(c.index=t.backboneEndAtomIndex,u.index=e.backboneStartAtomIndex,c.connectedTo(u)||(i=!0)),i||e.index!==a.count-1||(i=!0,d=e.index),i&&(f.push({mIndex:l,chainname:s(h),rStart:p,rCount:d-p+1}),h+=1,t.modelIndex!==e.modelIndex&&(h=0,l+=1),e.index===a.count-1&&d!==e.index&&f.push({mIndex:l,chainname:s(h),rStart:a.count-1,rCount:1}),p=e.index,d=e.index)})),o.count=0,f.forEach((function(t){!function(t,e,i,r){for(var s=o.count,c=0;c<r;++c)a.chainIndex[i+c]=s;o.growIfFull(),o.modelIndex[s]=t,o.setChainname(s,e),o.setChainid(s,e),o.residueOffset[s]=i,o.residueCount[s]=r,o.count+=1,n.chainCount[t]+=1}(t.mIndex,t.chainname,t.rStart,t.rCount)}));var m=0;t.eachModel((function(t){n.chainOffset[t.index]=m,n.chainCount[t.index]-=1,m+=n.chainCount[t.index]}))}gc&&mc.timeEnd("calculateChainnames")}function jp(t){gc&&mc.time("calculateBonds"),Gp(t),Vp(t),gc&&mc.timeEnd("calculateBonds")}function Gp(t,e){gc&&mc.time("calculateBondsWithin");var i=t.bondStore,r=t.rungBondStore,n=t.getAtomSet(!1),o=t.getAtomProxy(),a=t.getAtomProxy(),s=t.getBondProxy(),c=e?null:function(t){gc&&mc.time("calculateAtomBondMap");var e=[];return t.eachBond((function(t){var i=t.atomIndex1,r=t.atomIndex2;void 0===e[i]&&(e[i]=[]),e[i][r]=t.index})),gc&&mc.timeEnd("calculateAtomBondMap"),e}(t);t.eachResidue((function(t){if(!e){var u=t.atomCount,h=t.atomOffset;if(u>500)return void mc.warn("more than 500 atoms, skip residue for auto-bonding",t.qualifiedName());for(var l=t.getBonds(),p=l.atomIndices1,d=l.atomIndices2,f=l.bondOrders,m=p.length,g=0;g<m;++g){var v=p[g]+h,y=d[g]+h,b=c[v];if(void 0!==b&&void 0!==(b=b[y]))s.index=b,f[t.residueType.getBondIndex(v,y)]=s.bondOrder;else o.index=v,a.index=y,i.addBond(o,a,f[g])}}var x=t.residueType.traceAtomIndex,_=t.residueType.rungEndAtomIndex;-1!==x&&-1!==_&&(o.index=t.traceAtomIndex,a.index=t.rungEndAtomIndex,r.addBond(o,a),n.set(o.index),n.set(a.index))})),t.atomSetDict.rung=n,gc&&mc.timeEnd("calculateBondsWithin")}function Vp(t,e){gc&&mc.time("calculateBondsBetween");var i=t.bondStore,r=t.backboneBondStore,n=t.getAtomSet(!1),o=t.getAtomProxy(),a=t.getAtomProxy();function s(t,s){var c=t.backboneType,u=s.backboneType;0!==c&&c===u&&(o.index=t.backboneEndAtomIndex,a.index=s.backboneStartAtomIndex,o.connectedTo(a)&&(e||i.addBond(o,a,1),o.index=t.traceAtomIndex,a.index=s.traceAtomIndex,r.addBond(o,a),n.set(o.index),n.set(a.index)))}0===r.count&&r.resize(t.residueStore.count),t.eachResidueN(2,s);var c=t.getResidueProxy(),u=t.getResidueProxy();t.eachChain((function(t){0!==t.residueCount&&(c.index=t.residueOffset,u.index=t.residueOffset+t.residueCount-1,s(u,c))})),t.atomSetDict.backbone=n,gc&&mc.timeEnd("calculateBondsBetween")}function $p(t){if(t.unitcell){gc&&mc.time("buildUnitcellAssembly");var e=t.unitcell,i=t.center.clone().applyMatrix4(e.cartToFrac),r=function(t){var e=Cp[t],i={};if(void 0===e)return console.warn("getSymmetryOperations: spacegroup '"+t+"' not found in symop library"),i;for(var r=[],n=0,o=e.length;n<o;n+=3){for(var a=[],s=0;s<3;++s)a.push(Ep[e[n+s]]);r.push(a)}var c=/^[1-9]$/;return r.forEach((function(t){var e=0,r=(new N).set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1),n=r.elements;i[t]=r,t.forEach((function(t){for(var i=!1,r=!1,o=0,a=t.length;o<a;++o){var s=t[o];if("-"===s)i=!0;else if("+"===s)i=!1;else if("/"===s)r=!0;else if("X"===s)n[0+e]=i?-1:1;else if("Y"===s)n[4+e]=i?-1:1;else if("Z"===s)n[8+e]=i?-1:1;else if(c.test(s)){var u=parseInt(s);r?n[12+e]/=u:n[12+e]=u}else mc.warn('getSymmetryOperations: unknown token "'+s+'"')}e+=1}))})),i}(e.spacegroup),n=new O,o=new O,a=new O;i.x>1&&(n.x-=1),i.x<0&&(n.x+=1),i.y>1&&(n.y-=1),i.y<0&&(n.y+=1),i.z>1&&(n.z-=1),i.z<0&&(n.z+=1);var s,c=new Rp("UNITCELL"),u=m();if(t.biomolDict.NCS){s=[new N].concat(t.biomolDict.NCS.partList[0].matrixList);var h=[];u.forEach((function(t){s.forEach((function(e){h.push(t.clone().multiply(e))}))})),c.addPart(h)}else c.addPart(u);var l=new O,p=new Rp("SUPERCELL"),d=Array.prototype.concat.call(m(l.set(1,0,0)),m(l.set(0,1,0)),m(l.set(0,0,1)),m(l.set(-1,0,0)),m(l.set(0,-1,0)),m(l.set(0,0,-1)),m(l.set(1,1,0)),m(l.set(1,0,1)),m(l.set(0,1,1)),m(l.set(-1,-1,0)),m(l.set(-1,0,-1)),m(l.set(0,-1,-1)),m(l.set(1,-1,-1)),m(l.set(1,1,-1)),m(l.set(1,-1,1)),m(l.set(-1,1,1)),m(l.set(-1,-1,1)),m(l.set(-1,1,-1)),m(l.set(0,1,-1)),m(l.set(0,-1,1)),m(l.set(1,0,-1)),m(l.set(-1,0,1)),m(l.set(1,-1,0)),m(l.set(-1,1,0)),m(),m(l.set(1,1,1)),m(l.set(-1,-1,-1)));if(t.biomolDict.NCS){var f=[];d.forEach((function(t){s.forEach((function(e){f.push(t.clone().multiply(e))}))})),p.addPart(f)}else p.addPart(d);t.biomolDict.UNITCELL=c,t.biomolDict.SUPERCELL=p,gc&&mc.timeEnd("buildUnitcellAssembly")}function m(t){var s=[];return Object.keys(r).forEach((function(c){var u=r[c].clone();o.copy(i).applyMatrix4(u),a.setFromMatrixPosition(u),a.sub(n),o.x>1&&(a.x-=1),o.x<0&&(a.x+=1),o.y>1&&(a.y-=1),o.y<0&&(a.y+=1),o.z>1&&(a.z-=1),o.z<0&&(a.z+=1),t&&a.add(t),u.setPosition(a),u.multiplyMatrices(e.fracToCart,u),u.multiply(e.cartToFrac),s.push(u)})),s}}var Hp=["H","C","O","N","S","P"],Wp=["NA","CL","FE"];function Xp(t){var e=t.trim().toUpperCase();parseInt(e.charAt(0))&&(e=e.substr(1)),parseInt(e.charAt(0))&&(e=e.substr(1));var i=e.length;if(0===i)return"";if(1===i)return e;if(2===i){if(-1!==Wp.indexOf(e))return e;if(-1!==Hp.indexOf(e[0]))return e[0]}return i>=3&&-1!==Hp.indexOf(e[0])?e[0]:""}function qp(t){var e=t.bondHash,i=e.countArray,r=e.offsetArray,n=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=r[e],p=0,d=i[e];p<d;++p){o.index=n[l+p];var f=o.atomIndex1,m=o.atomIndex2;if(f>m){var g=m;m=f,f=g}var v=f+"|"+m;void 0===h[v]&&(h[v]=!0,s.push(f-a),c.push(m-a),u.push(o.bondOrder))}})),e.bonds={atomIndices1:s,atomIndices2:c,bondOrders:u}}}))}var Yp=function(t,e,i){this.structure=t,i=i||Xp(e),this.atomname=e,this.element=i,this.vdw=ml[i],this.covalent=gl[i]};var Zp=function(t){this.structure=t,this.dict={},this.list=[]};Zp.prototype.add=function(t,e){var i=function(t,e){return t+"|"+e}(t=t.toUpperCase(),e=e?e.toUpperCase():Xp(t)),r=this.dict[i];if(void 0===r){var n=new Yp(this.structure,t,e);r=this.list.length,this.dict[i]=r,this.list.push(n)}return r},Zp.prototype.get=function(t){return this.list[t]};var Kp=function(t,e,i,r,n,o){this.structure=t,this.resname=e,this.atomTypeIdList=i,this.hetero=r?1:0,this.chemCompType=n,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=Cl[this.backboneType],s=Cl[this.backboneStartType],c=Cl[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 p=this.getAtomIndexByName(s.backboneStart);this.backboneStartAtomIndex=void 0!==p?p:-1;var d,f=this.getAtomIndexByName(c.backboneEnd);this.backboneEndAtomIndex=void 0!==f?f:-1,d=Sl.includes(e)?this.getAtomIndexByName("N1"):this.getAtomIndexByName("N3"),this.rungEndAtomIndex=void 0!==d?d:-1,this.bondReferenceAtomIndices=[]};Kp.prototype.getBackboneIndexList=function(){var t,e=[];switch(this.moleculeType){case 3:t=Tl;break;case 4:case 5:t=El;break;default:return e}for(var i=this.structure.atomMap,r=this.atomTypeIdList,n=0,o=this.atomCount;n<o;++n){var a=i.get(r[n]);t.includes(a.atomname)&&e.push(n)}return e},Kp.prototype.getMoleculeType=function(){return this.isProtein()?3:this.isRna()?4:this.isDna()?5:this.isWater()?1:this.isIon()?2:this.isSaccharide()?6:0},Kp.prototype.getBackboneType=function(t){return this.hasProteinBackbone(t)?1:this.hasRnaBackbone(t)?2:this.hasDnaBackbone(t)?3:this.hasCgProteinBackbone(t)?4:this.hasCgRnaBackbone(t)?5:this.hasCgDnaBackbone(t)?6:0},Kp.prototype.isProtein=function(){return this.chemCompType?sl.includes(this.chemCompType):this.hasAtomWithName("CA","C","N")||xl.includes(this.resname)},Kp.prototype.isCg=function(){var t=this.backboneType;return 4===t||5===t||6===t},Kp.prototype.isNucleic=function(){return this.isRna()||this.isDna()},Kp.prototype.isRna=function(){return this.chemCompType?cl.includes(this.chemCompType):this.hasAtomWithName(["P","O3'","O3*"],["C4'","C4*"],["O2'","O2*","F2'","F2*"])||_l.includes(this.resname)&&this.hasAtomWithName(["O2'","O2*","F2'","F2*"])},Kp.prototype.isDna=function(){return this.chemCompType?ul.includes(this.chemCompType):this.hasAtomWithName(["P","O3'","O3*"],["C3'","C3*"])&&!this.hasAtomWithName(["O2'","O2*","F2'","F2*"])||wl.includes(this.resname)},Kp.prototype.isHetero=function(){return 1===this.hetero},Kp.prototype.isIon=function(){return Ml.includes(this.resname)},Kp.prototype.isWater=function(){return Al.includes(this.resname)},Kp.prototype.isSaccharide=function(){return this.chemCompType?hl.includes(this.chemCompType):Pl.includes(this.resname)},Kp.prototype.hasBackboneAtoms=function(t,e){var i=Cl[e];return-1===t?this.hasAtomWithName(i.trace,i.backboneEnd,i.direction1,i.direction2):0===t?this.hasAtomWithName(i.trace,i.direction1,i.direction2):1===t?this.hasAtomWithName(i.trace,i.backboneStart,i.direction1,i.direction2):this.hasAtomWithName(i.trace,i.backboneStart,i.backboneEnd,i.direction1,i.direction2)},Kp.prototype.hasProteinBackbone=function(t){return this.isProtein()&&this.hasBackboneAtoms(t,1)},Kp.prototype.hasRnaBackbone=function(t){return this.isRna()&&this.hasBackboneAtoms(t,2)},Kp.prototype.hasDnaBackbone=function(t){return this.isDna()&&this.hasBackboneAtoms(t,3)},Kp.prototype.hasCgProteinBackbone=function(t){return this.isProtein()&&this.hasBackboneAtoms(t,4)},Kp.prototype.hasCgRnaBackbone=function(t){return this.isRna()&&this.hasBackboneAtoms(t,5)},Kp.prototype.hasCgDnaBackbone=function(t){return this.isDna()&&this.hasBackboneAtoms(t,6)},Kp.prototype.hasBackbone=function(t){return this.hasProteinBackbone(t)||this.hasRnaBackbone(t)||this.hasDnaBackbone(t)||this.hasCgProteinBackbone(t)||this.hasCgRnaBackbone(t)||this.hasCgDnaBackbone(t)},Kp.prototype.getAtomIndexByName=function(t){var e=this.atomCount,i=this.structure.atomMap,r=this.atomTypeIdList;if(Array.isArray(t))for(var n=0;n<e;++n){var o=r[n];if(t.includes(i.get(o).atomname))return n}else for(var a=0;a<e;++a){var s=r[a];if(t===i.get(s).atomname)return a}},Kp.prototype.hasAtomWithName=function(){for(var t=arguments,e=this,i=arguments.length,r=0;r<i;++r)if(void 0!==t[r]&&void 0===e.getAtomIndexByName(t[r]))return!1;return!0},Kp.prototype.getBonds=function(t){return void 0===this.bonds&&(this.bonds=function(t){var e=t.structure,i=e.getAtomProxy(),r=e.getAtomProxy(),n=t.atomCount,o=t.atomOffset,a=o+n-1;if(!(n>500)){var s,c,u=[],h=[],l=[];if(n>50){var p=new Tp(t,!0),d=t.isCg()?1.2:2.3;for(s=o;s<a;++s){i.index=s;var f=i.covalent+d+.3,m=p.nearest(i,1/0,f*f),g=m.length;for(c=0;c<g;++c)r.index=m[c].index,i.index<r.index&&i.connectedTo(r)&&(u.push(i.index-o),h.push(r.index-o),l.push(1))}}else for(s=o;s<a;++s)for(i.index=s,c=s+1;c<=a;++c)r.index=c,i.connectedTo(r)&&(u.push(s-o),h.push(c-o),l.push(1));return{atomIndices1:u,atomIndices2:h,bondOrders:l}}gc&&mc.warn("more than 500 atoms, skip residue for auto-bonding",t.qualifiedName())}(t)),this.bonds},Kp.prototype.getRings=function(){return void 0===this.rings&&this.calculateRings(),this.rings},Kp.prototype.getBondGraph=function(){return void 0===this.bondGraph&&this.calculateBondGraph(),this.bondGraph},Kp.prototype.calculateBondGraph=function(){for(var t=this.bondGraph={},e=this.getBonds(),i=e.atomIndices1.length,r=e.atomIndices1,n=e.atomIndices2,o=0;o<i;++o){var a=r[o],s=n[o];(t[a]=t[a]||[]).push(s),(t[s]=t[s]||[]).push(a)}},Kp.prototype.calculateRings=function(){var t=this.getBondGraph(),e=new Int8Array(this.atomCount),i=new Int8Array(this.atomCount),r=[],n=[];function o(a,s,c){if(e[a])throw new Error("DFS revisited atom");e[a]=1,n.push(a);for(var u=s.length,h=0;h<u;++h){var l=s[h];if(0===e[l])t[l]&&t[l].length>=2?o(l,t[l],a):e[l]=2;else if(1===e[l]&&c&&c!==l){var p=[l];i[l]=1,r.push(p);for(var d=n.length-1;d>=0;--d){var f=n[d];if(f===l)break;p.push(f),i[f]=1}}}e[a]=2,n.pop()}for(var a=0;a<this.atomCount;++a)if(!e[a]){var s=t[a];!s||s.length<2?e[a]=2:(n.length=0,o(a,s))}this.rings={flags:i,rings:r}},Kp.prototype.assignBondReferenceAtomIndices=function(){var t=this.getBondGraph(),e=this.getRings(),i=e.flags,r=e.rings,n=this.bonds.atomIndices1,o=this.bonds.atomIndices2,a=this.bonds.bondOrders,s=this.bondReferenceAtomIndices,c=this.bonds.atomIndices1.length;s.length=0;for(var u=0;u<c;++u)if(!(a[u]<=1)){var h=n[u],l=o[u];if(i[h]&&i[l]){for(var p=0;p<r.length&&void 0===s[u];++p)for(var d=r[p],f=null,m=!1,g=0;g<d.length;++g){var v=d[g];if(v===h||v===l?m=!0:f=v,m&&null!==f){s[u]=f;break}}if(void 0!==s[u])continue}if(t[h].length>1)for(var y=0;y<t[h].length;++y){var b=t[h][y];if(b!==l){s[u]=b;break}}else if(t[l].length>1)for(var x=0;x<t[l].length;++x){var _=t[l][x];if(_!==h){s[u]=_;break}}else;}},Kp.prototype.getBondIndex=function(t,e){for(var i=this.bonds,r=i.atomIndices1,n=i.atomIndices2,o=r.indexOf(t),a=n.indexOf(e),s=a;-1!==o;){for(;-1!==a;){if(o===a)return o;a=n.indexOf(e,a+1)}o=r.indexOf(t,o+1),a=s}},Kp.prototype.getBondReferenceAtomIndex=function(t,e){var i=this.getBondIndex(t,e);if(void 0!==i)return 0===this.bondReferenceAtomIndices.length&&this.assignBondReferenceAtomIndices(),this.bondReferenceAtomIndices[i]};var Qp=function(t){this.structure=t,this.dict={},this.list=[]};Qp.prototype.add=function(t,e,i,r,n){var o=function(t,e,i,r){return t+"|"+e.join(",")+"|"+(i?1:0)+"|"+(r||"")}(t=t.toUpperCase(),e,i,r),a=this.dict[o];if(void 0===a){var s=new Kp(this.structure,t,e,i,r,n);a=this.list.length,this.dict[o]=a,this.list.push(s)}return a},Qp.prototype.get=function(t){return this.list[t]};var Jp=function(t,e){this.structure=t,this.bondStore=t.bondStore,this.index=e,this._v12=new O,this._v13=new O,this._ap1=this.structure.getAtomProxy(),this._ap2=this.structure.getAtomProxy(),this._ap3=this.structure.getAtomProxy()},td={atom1:{},atom2:{},atomIndex1:{},atomIndex2:{},bondOrder:{}};td.atom1.get=function(){return this.structure.getAtomProxy(this.atomIndex1)},td.atom2.get=function(){return this.structure.getAtomProxy(this.atomIndex2)},td.atomIndex1.get=function(){return this.bondStore.atomIndex1[this.index]},td.atomIndex1.set=function(t){this.bondStore.atomIndex1[this.index]=t},td.atomIndex2.get=function(){return this.bondStore.atomIndex2[this.index]},td.atomIndex2.set=function(t){this.bondStore.atomIndex2[this.index]=t},td.bondOrder.get=function(){return this.bondStore.bondOrder[this.index]},td.bondOrder.set=function(t){this.bondStore.bondOrder[this.index]=t},Jp.prototype.getReferenceAtomIndex=function(){var t=this._ap1,e=this._ap2;if(t.index=this.atomIndex1,e.index=this.atomIndex2,t.residueIndex===e.residueIndex){var i=t.index-t.residueAtomOffset,r=e.index-e.residueAtomOffset,n=t.residueType.getBondReferenceAtomIndex(i,r);if(void 0!==n)return n+t.residueAtomOffset;console.warn("No reference atom found",t.index,e.index)}},Jp.prototype.calculateShiftDir=function(t){t||(t=new O);var e=this._ap1,i=this._ap2,r=this._ap3,n=this._v12,o=this._v13;e.index=this.atomIndex1,i.index=this.atomIndex2;var a=this.getReferenceAtomIndex();n.subVectors(e,i).normalize(),void 0!==a?(r.index=a,o.subVectors(e,r)):o.copy(e),o.normalize();var s=n.dot(o);return 1-Math.abs(s)<1e-5&&(o.set(1,0,0),s=n.dot(o),1-Math.abs(s)<1e-5&&(o.set(0,1,0),s=n.dot(o))),t.copy(o.sub(n.multiplyScalar(s))).normalize()},Jp.prototype.qualifiedName=function(){return this.atomIndex1+"="+this.atomIndex2},Jp.prototype.clone=function(){return new this.constructor(this.structure,this.index)},Jp.prototype.toObject=function(){return{atomIndex1:this.atomIndex1,atomIndex2:this.atomIndex2,bondOrder:this.bondOrder}},Object.defineProperties(Jp.prototype,td);var ed=function(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},id={bondHash:{},entity:{},entityIndex:{},modelIndex:{},chainIndex:{},residue:{},residueIndex:{},sstruc:{},inscode:{},resno:{},chainname:{},chainid:{},residueType:{},atomType:{},residueAtomOffset:{},resname:{},hetero:{},atomname:{},element:{},vdw:{},covalent:{},x:{},y:{},z:{},serial:{},bfactor:{},occupancy:{},altloc:{}};id.bondHash.get=function(){return this.structure.bondHash},id.entity.get=function(){return this.structure.entityList[this.entityIndex]},id.entityIndex.get=function(){return this.chainStore.entityIndex[this.chainIndex]},id.modelIndex.get=function(){return this.chainStore.modelIndex[this.chainIndex]},id.chainIndex.get=function(){return this.residueStore.chainIndex[this.residueIndex]},id.residue.get=function(){return console.warn("residue - might be expensive"),this.structure.getResidueProxy(this.residueIndex)},id.residueIndex.get=function(){return this.atomStore.residueIndex[this.index]},id.residueIndex.set=function(t){this.atomStore.residueIndex[this.index]=t},id.sstruc.get=function(){return this.residueStore.getSstruc(this.residueIndex)},id.inscode.get=function(){return this.residueStore.getInscode(this.residueIndex)},id.resno.get=function(){return this.residueStore.resno[this.residueIndex]},id.chainname.get=function(){return this.chainStore.getChainname(this.chainIndex)},id.chainid.get=function(){return this.chainStore.getChainid(this.chainIndex)},id.residueType.get=function(){return this.residueMap.get(this.residueStore.residueTypeId[this.residueIndex])},id.atomType.get=function(){return this.atomMap.get(this.atomStore.atomTypeId[this.index])},id.residueAtomOffset.get=function(){return this.residueStore.atomOffset[this.residueIndex]},id.resname.get=function(){return this.residueType.resname},id.hetero.get=function(){return this.residueType.hetero},id.atomname.get=function(){return this.atomType.atomname},id.element.get=function(){return this.atomType.element},id.vdw.get=function(){return this.atomType.vdw},id.covalent.get=function(){return this.atomType.covalent},id.x.get=function(){return this.atomStore.x[this.index]},id.x.set=function(t){this.atomStore.x[this.index]=t},id.y.get=function(){return this.atomStore.y[this.index]},id.y.set=function(t){this.atomStore.y[this.index]=t},id.z.get=function(){return this.atomStore.z[this.index]},id.z.set=function(t){this.atomStore.z[this.index]=t},id.serial.get=function(){return this.atomStore.serial[this.index]},id.serial.set=function(t){this.atomStore.serial[this.index]=t},id.bfactor.get=function(){return this.atomStore.bfactor[this.index]},id.bfactor.set=function(t){this.atomStore.bfactor[this.index]=t},id.occupancy.get=function(){return this.atomStore.occupancy[this.index]},id.occupancy.set=function(t){this.atomStore.occupancy[this.index]=t},id.altloc.get=function(){return this.atomStore.getAltloc(this.index)},id.altloc.set=function(t){this.atomStore.setAltloc(this.index,t)},ed.prototype.eachBond=function(t,e){e=e||this.structure._bp;for(var i=this.index,r=this.bondHash,n=r.indexArray,o=r.countArray[i],a=r.offsetArray[i],s=0;s<o;++s)e.index=n[a+s],t(e)},ed.prototype.eachBondedAtom=function(t,e){e=e||this.structure._ap;var i=this.index;this.eachBond((function(r){i!==r.atomIndex1?e.index=r.atomIndex1:e.index=r.atomIndex2,t(e)}))},ed.prototype.isBackbone=function(){var t=this.residueType.backboneIndexList;if(t.length>0){var e=this.residueStore.atomOffset[this.residueIndex];return t.includes(this.index-e)}return!1},ed.prototype.isPolymer=function(){if(this.structure.entityList.length>0)return this.entity.isPolymer();var t=this.residueType.moleculeType;return 3===t||4===t||5===t},ed.prototype.isSidechain=function(){return this.isPolymer()&&!this.isBackbone()},ed.prototype.isCg=function(){var t=this.residueType.backboneType;return 4===t||5===t||6===t},ed.prototype.isHetero=function(){return 1===this.residueType.hetero},ed.prototype.isProtein=function(){return 3===this.residueType.moleculeType},ed.prototype.isNucleic=function(){var t=this.residueType.moleculeType;return 4===t||5===t},ed.prototype.isRna=function(){return 4===this.residueType.moleculeType},ed.prototype.isDna=function(){return 5===this.residueType.moleculeType},ed.prototype.isWater=function(){return 1===this.residueType.moleculeType},ed.prototype.isIon=function(){return 2===this.residueType.moleculeType},ed.prototype.isSaccharide=function(){return 6===this.residueType.moleculeType},ed.prototype.isHelix=function(){return pl.includes(this.sstruc)},ed.prototype.isSheet=function(){return dl.includes(this.sstruc)},ed.prototype.isTurn=function(){return fl.includes(this.sstruc)&&this.isProtein()},ed.prototype.isBonded=function(){return 0!==this.bondHash.countArray[this.index]},ed.prototype.isRing=function(){return 1===this.residueType.getRings().flags[this.index-this.residueAtomOffset]},ed.prototype.distanceTo=function(t){var e=this.atomStore,i=t.atomStore,r=this.index,n=t.index,o=e.x[r]-i.x[n],a=e.y[r]-i.y[n],s=e.z[r]-i.z[n],c=o*o+a*a+s*s;return Math.sqrt(c)},ed.prototype.connectedTo=function(t){var e=this.atomStore,i=t.atomStore,r=this.index,n=t.index;if(e.altloc&&i.altloc){var o=e.altloc[r],a=i.altloc[n];if(0!==o&&0!==a&&32!==o&&32!==a&&o!==a)return!1}var s=e.x[r]-i.x[n],c=e.y[r]-i.y[n],u=e.z[r]-i.z[n],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,p=l+.3,d=l-.5;return h<p*p&&h>d*d},ed.prototype.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},ed.prototype.positionToArray=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.index,r=this.atomStore;return t[e+0]=r.x[i],t[e+1]=r.y[i],t[e+2]=r.z[i],t},ed.prototype.positionToVector3=function(t){return void 0===t&&(t=new O),t.x=this.x,t.y=this.y,t.z=this.z,t},ed.prototype.positionFromVector3=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},ed.prototype.getResidueBonds=function(t){var e,i,r,n,o=this.residueAtomOffset,a=this.index-this.residueAtomOffset,s=this.residueType.getBonds(),c=s.atomIndices1,u=s.atomIndices2;for(t||(n=[]),e=c.indexOf(a);-1!==e;){if(r=u[e]+o,t)return r;n.push(r),e=c.indexOf(a,e+1)}for(i=u.indexOf(a);-1!==i;){if(r=c[i]+o,t)return r;n.push(r),i=u.indexOf(a,i+1)}return n},ed.prototype.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},ed.prototype.clone=function(){return new this.constructor(this.structure,this.index)},ed.prototype.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}},Object.defineProperties(ed.prototype,id);var rd=function(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},nd={entity:{},entityIndex:{},chain:{},chainIndex:{},atomOffset:{},atomCount:{},atomEnd:{},modelIndex:{},chainname:{},chainid:{},resno:{},sstruc:{},inscode:{},residueType:{},resname:{},hetero:{},moleculeType:{},backboneType:{},backboneStartType:{},backboneEndType:{},traceAtomIndex:{},direction1AtomIndex:{},direction2AtomIndex:{},backboneStartAtomIndex:{},backboneEndAtomIndex:{},rungEndAtomIndex:{}};nd.entity.get=function(){return this.structure.entityList[this.entityIndex]},nd.entityIndex.get=function(){return this.chainStore.entityIndex[this.chainIndex]},nd.chain.get=function(){return this.structure.getChainProxy(this.chainIndex)},nd.chainIndex.get=function(){return this.residueStore.chainIndex[this.index]},nd.chainIndex.set=function(t){this.residueStore.chainIndex[this.index]=t},nd.atomOffset.get=function(){return this.residueStore.atomOffset[this.index]},nd.atomOffset.set=function(t){this.residueStore.atomOffset[this.index]=t},nd.atomCount.get=function(){return this.residueStore.atomCount[this.index]},nd.atomCount.set=function(t){this.residueStore.atomCount[this.index]=t},nd.atomEnd.get=function(){return this.atomOffset+this.atomCount-1},nd.modelIndex.get=function(){return this.chainStore.modelIndex[this.chainIndex]},nd.chainname.get=function(){return this.chainStore.getChainname(this.chainIndex)},nd.chainid.get=function(){return this.chainStore.getChainid(this.chainIndex)},nd.resno.get=function(){return this.residueStore.resno[this.index]},nd.resno.set=function(t){this.residueStore.resno[this.index]=t},nd.sstruc.get=function(){return this.residueStore.getSstruc(this.index)},nd.sstruc.set=function(t){this.residueStore.setSstruc(this.index,t)},nd.inscode.get=function(){return this.residueStore.getInscode(this.index)},nd.inscode.set=function(t){this.residueStore.getInscode(this.index,t)},nd.residueType.get=function(){return this.residueMap.get(this.residueStore.residueTypeId[this.index])},nd.resname.get=function(){return this.residueType.resname},nd.hetero.get=function(){return this.residueType.hetero},nd.moleculeType.get=function(){return this.residueType.moleculeType},nd.backboneType.get=function(){return this.residueType.backboneType},nd.backboneStartType.get=function(){return this.residueType.backboneStartType},nd.backboneEndType.get=function(){return this.residueType.backboneEndType},nd.traceAtomIndex.get=function(){return this.residueType.traceAtomIndex+this.atomOffset},nd.direction1AtomIndex.get=function(){return this.residueType.direction1AtomIndex+this.atomOffset},nd.direction2AtomIndex.get=function(){return this.residueType.direction2AtomIndex+this.atomOffset},nd.backboneStartAtomIndex.get=function(){return this.residueType.backboneStartAtomIndex+this.atomOffset},nd.backboneEndAtomIndex.get=function(){return this.residueType.backboneEndAtomIndex+this.atomOffset},nd.rungEndAtomIndex.get=function(){return this.residueType.rungEndAtomIndex+this.atomOffset},rd.prototype.eachAtom=function(t,e){var i,r=this.atomCount,n=this.atomOffset,o=this.structure._ap,a=n+r;if(e&&e.atomOnlyTest){var s=e.atomOnlyTest;for(i=n;i<a;++i)o.index=i,s(o)&&t(o)}else for(i=n;i<a;++i)o.index=i,t(o)},rd.prototype.isProtein=function(){return 3===this.residueType.moleculeType},rd.prototype.isNucleic=function(){var t=this.residueType.moleculeType;return 4===t||5===t},rd.prototype.isRna=function(){return 4===this.residueType.moleculeType},rd.prototype.isDna=function(){return 5===this.residueType.moleculeType},rd.prototype.isCg=function(){var t=this.residueType.backboneType;return 4===t||5===t||6===t},rd.prototype.isPolymer=function(){if(this.structure.entityList.length>0)return this.entity.isPolymer();var t=this.residueType.moleculeType;return 3===t||4===t||5===t},rd.prototype.isHetero=function(){return 1===this.residueType.hetero},rd.prototype.isWater=function(){return 1===this.residueType.moleculeType},rd.prototype.isIon=function(){return 2===this.residueType.moleculeType},rd.prototype.isSaccharide=function(){return 6===this.residueType.moleculeType},rd.prototype.isHelix=function(){return pl.includes(this.sstruc)},rd.prototype.isSheet=function(){return dl.includes(this.sstruc)},rd.prototype.isTurn=function(){return fl.includes(this.sstruc)&&this.isProtein()},rd.prototype.getAtomType=function(t){return this.atomMap.get(this.atomStore.atomTypeId[t])},rd.prototype.getResname1=function(){return bl[this.resname.toUpperCase()]||"X"},rd.prototype.getBackboneType=function(t){switch(t){case-1:return this.residueType.backboneStartType;case 1:return this.residueType.backboneEndType;default:return this.residueType.backboneType}},rd.prototype.getAtomIndexByName=function(t){var e=this.residueType.getAtomIndexByName(t);return void 0!==e&&(e+=this.atomOffset),e},rd.prototype.getAtomByName=function(t){return this.residueType.getAtomByName(t)},rd.prototype.hasAtomWithName=function(t){return this.residueType.hasAtomWithName(t)},rd.prototype.getAtomnameList=function(){console.warn("getAtomnameList - might be expensive");for(var t=this.atomCount,e=this.atomOffset,i=new Array(t),r=0;r<t;++r)i[r]=this.getAtomType(e+r).atomname;return i},rd.prototype.connectedTo=function(t){var e=this.structure.getAtomProxy(this.backboneEndAtomIndex),i=this.structure.getAtomProxy(t.backboneStartAtomIndex);return!(!e||!i)&&e.connectedTo(i)},rd.prototype.getNextConnectedResidue=function(){var t=this.chainStore.residueOffset[this.chainIndex],e=this.chainStore.residueCount[this.chainIndex],i=this.index+1;if(i<t+e){var r=this.structure.getResidueProxy(i);if(this.connectedTo(r))return r}else if(i===t+e){var n=this.structure.getResidueProxy(t);if(this.connectedTo(n))return n}},rd.prototype.getPreviousConnectedResidue=function(){var t=this.chainStore.residueOffset[this.chainIndex],e=this.index-1;if(e>=t){var i=this.structure.getResidueProxy(e);if(i.connectedTo(this))return i}else if(e===t-1){var r=this.chainStore.residueCount[this.chainIndex],n=this.structure.getResidueProxy(t+r-1);if(n.connectedTo(this))return n}},rd.prototype.getBonds=function(){return this.residueType.getBonds(this)},rd.prototype.getRings=function(){return this.residueType.getRings()},rd.prototype.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},rd.prototype.clone=function(){return new this.constructor(this.structure,this.index)},rd.prototype.toObject=function(){return{index:this.index,chainIndex:this.chainIndex,atomOffset:this.atomOffset,atomCount:this.atomCount,resno:this.resno,resname:this.resname,sstruc:this.sstruc}},Object.defineProperties(rd.prototype,nd);var od=function(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 r=this.structure.getResidueProxy(this.residueIndexStart),n=this.structure.getResidueProxy(this.residueIndexEnd);this.isPrevConnected=void 0!==r.getPreviousConnectedResidue();var o=n.getNextConnectedResidue();this.isNextConnected=void 0!==o,this.isNextNextConnected=this.isNextConnected&&void 0!==o.getNextConnectedResidue(),this.isCyclic=n.connectedTo(r),this.__residueProxy=this.structure.getResidueProxy()},ad={chainIndex:{},modelIndex:{},chainname:{}};ad.chainIndex.get=function(){return this.residueStore.chainIndex[this.residueIndexStart]},ad.modelIndex.get=function(){return this.chainStore.modelIndex[this.chainIndex]},ad.chainname.get=function(){return this.chainStore.getChainname(this.chainIndex)},od.prototype.isProtein=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isProtein()},od.prototype.isCg=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isCg()},od.prototype.isNucleic=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isNucleic()},od.prototype.getMoleculeType=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.moleculeType},od.prototype.getBackboneType=function(t){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.getBackboneType(t)},od.prototype.getAtomIndexByType=function(t,e){this.isCyclic?-1===t?t=this.residueCount-1:t===this.residueCount&&(t=0):(-1!==t||this.isPrevConnected||(t+=1),t!==this.residueCount||this.isNextNextConnected||(t-=1));var i,r=this.__residueProxy;switch(r.index=this.residueIndexStart+t,e){case"trace":i=r.traceAtomIndex;break;case"direction1":i=r.direction1AtomIndex;break;case"direction2":i=r.direction2AtomIndex;break;default:var n=r.getAtomByName(e);i=n?n.index:void 0}return i},od.prototype.eachAtom=function(t,e){this.eachResidue((function(i){i.eachAtom(t,e)}),e)},od.prototype.eachAtomN=function(t,e,i){var r,n=this.residueCount,o=new Array(t);for(r=0;r<t;++r)o[r]=this.structure.getAtomProxy(this.getAtomIndexByType(r,i));e.apply(this,o);for(var a=t;a<n;++a){for(r=1;r<t;++r)o[r-1].index=o[r].index;o[t-1].index=this.getAtomIndexByType(a,i),e.apply(this,o)}},od.prototype.eachAtomN2=function(t,e,i){var r=this.atomOffset,n=this.atomCount,o=r+n;if(!(n<t)){for(var a=new Array(t),s=0;s<t;++s)a[s]=this.structure.getAtomProxy();var c=this.structure.atomSetCache["__"+i];void 0===c&&(mc.warn("no precomputed atomSet for: "+i),c=this.structure.getAtomSet(!1),this.eachResidue((function(t){var e=t.getAtomByName(i);c.set(e.index)})));var u=0;c.forEach((function(i){if(i>=r&&i<o){for(var n=1;n<t;++n)a[n-1].index=a[n].index;a[t-1].index=i,(u+=1)>=t&&e.apply(this,a)}}))}},od.prototype.eachResidue=function(t){for(var e=this.structure.getResidueProxy(),i=this.residueCount,r=this.residueIndexStart,n=0;n<i;++n)e.index=r+n,t(e)},od.prototype.qualifiedName=function(){var t=this.structure.getResidueProxy(this.residueIndexStart),e=this.structure.getResidueProxy(this.residueIndexEnd);return t.qualifiedName()+" - "+e.qualifiedName()},Object.defineProperties(od.prototype,ad);var sd=function(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.index=e},cd={entity:{},model:{},entityIndex:{},modelIndex:{},residueOffset:{},residueCount:{},residueEnd:{},atomOffset:{},atomEnd:{},atomCount:{},chainname:{},chainid:{}};cd.entity.get=function(){return this.structure.entityList[this.entityIndex]},cd.model.get=function(){return this.structure.getModelProxy(this.modelIndex)},cd.entityIndex.get=function(){return this.chainStore.entityIndex[this.index]},cd.entityIndex.set=function(t){this.chainStore.entityIndex[this.index]=t},cd.modelIndex.get=function(){return this.chainStore.modelIndex[this.index]},cd.modelIndex.set=function(t){this.chainStore.modelIndex[this.index]=t},cd.residueOffset.get=function(){return this.chainStore.residueOffset[this.index]},cd.residueOffset.set=function(t){this.chainStore.residueOffset[this.index]=t},cd.residueCount.get=function(){return this.chainStore.residueCount[this.index]},cd.residueCount.set=function(t){this.chainStore.residueCount[this.index]=t},cd.residueEnd.get=function(){return this.residueOffset+this.residueCount-1},cd.atomOffset.get=function(){return this.residueStore.atomOffset[this.residueOffset]},cd.atomEnd.get=function(){return this.residueStore.atomOffset[this.residueEnd]+this.residueStore.atomCount[this.residueEnd]-1},cd.atomCount.get=function(){return 0===this.residueCount?0:this.atomEnd-this.atomOffset+1},cd.chainname.get=function(){return this.chainStore.getChainname(this.index)},cd.chainname.set=function(t){this.chainStore.setChainname(this.index,t)},cd.chainid.get=function(){return this.chainStore.getChainid(this.index)},cd.chainid.set=function(t){this.chainStore.setChainid(this.index,t)},sd.prototype.eachAtom=function(t,e){this.eachResidue((function(i){i.eachAtom(t,e)}),e)},sd.prototype.eachResidue=function(t,e){var i,r=this.residueCount,n=this.residueOffset,o=this.structure._rp,a=n+r;if(e&&e.test){var s=e.residueOnlyTest;if(s)for(i=n;i<a;++i)o.index=i,s(o)&&t(o,e);else for(i=n;i<a;++i)o.index=i,t(o,e)}else for(i=n;i<a;++i)o.index=i,t(o)},sd.prototype.eachResidueN=function(t,e){var i,r=this.residueCount,n=this.residueOffset,o=n+r;if(!(r<t)){var a=new Array(t);for(i=0;i<t;++i)a[i]=this.structure.getResidueProxy(n+i);e.apply(this,a);for(var s=n+t;s<o;++s){for(i=0;i<t;++i)a[i].index+=1;e.apply(this,a)}}},sd.prototype.eachPolymer=function(t,e){for(var i,r,n=e?e.residueOnlyTest:void 0,o=this.model.structure,a=this.residueCount,s=this.residueOffset,c=s+a,u=this.structure.getResidueProxy(),h=this.structure.getResidueProxy(s),l=this.structure.getAtomProxy(),p=this.structure.getAtomProxy(),d=!0,f=s+1;f<c;++f){u.index=h.index,h.index=f,d&&(i=u.index,d=!1),r=h.index;var m=d?u.backboneEndType:u.backboneType,g=h.backboneType;0!==m&&m===g?(l.index=u.backboneEndAtomIndex,p.index=h.backboneStartAtomIndex,l&&p&&l.connectedTo(p)&&(!n||n(u)&&n(h))||(u.index-i>1&&t(new od(o,i,u.index)),i=r)):(0!==m&&u.index-i>1&&t(new od(o,i,u.index)),i=r)}r-i>1&&this.structure.getResidueProxy(i).backboneStartType&&t(new od(o,i,r))},sd.prototype.qualifiedName=function(){return":"+this.chainname+"/"+this.modelIndex},sd.prototype.clone=function(){return new this.constructor(this.structure,this.index)},sd.prototype.toObject=function(){return{index:this.index,residueOffset:this.residueOffset,residueCount:this.residueCount,chainname:this.chainname}},Object.defineProperties(sd.prototype,cd);var ud=function(t,e){this.structure=t,this.modelStore=t.modelStore,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.index=e},hd={chainOffset:{},chainCount:{},residueOffset:{},atomOffset:{},chainEnd:{},residueEnd:{},atomEnd:{},residueCount:{},atomCount:{}};hd.chainOffset.get=function(){return this.modelStore.chainOffset[this.index]},hd.chainOffset.set=function(t){this.modelStore.chainOffset[this.index]=t},hd.chainCount.get=function(){return this.modelStore.chainCount[this.index]},hd.chainCount.set=function(t){this.modelStore.chainCount[this.index]=t},hd.residueOffset.get=function(){return this.chainStore.residueOffset[this.chainOffset]},hd.atomOffset.get=function(){return this.residueStore.atomOffset[this.residueOffset]},hd.chainEnd.get=function(){return this.chainOffset+this.chainCount-1},hd.residueEnd.get=function(){return this.chainStore.residueOffset[this.chainEnd]+this.chainStore.residueCount[this.chainEnd]-1},hd.atomEnd.get=function(){return this.residueStore.atomOffset[this.residueEnd]+this.residueStore.atomCount[this.residueEnd]-1},hd.residueCount.get=function(){return 0===this.chainCount?0:this.residueEnd-this.residueOffset+1},hd.atomCount.get=function(){return 0===this.residueCount?0:this.atomEnd-this.atomOffset+1},ud.prototype.eachAtom=function(t,e){this.eachChain((function(i){i.eachAtom(t,e)}),e)},ud.prototype.eachResidue=function(t,e){this.eachChain((function(i){i.eachResidue(t,e)}),e)},ud.prototype.eachPolymer=function(t,e){if(e&&e.chainOnlyTest){var i=e.chainOnlyTest;this.eachChain((function(r){i(r)&&r.eachPolymer(t,e)}))}else this.eachChain((function(i){i.eachPolymer(t,e)}))},ud.prototype.eachChain=function(t,e){var i,r=this.chainCount,n=this.chainOffset,o=this.structure._cp,a=n+r;if(e&&e.test){var s=e.chainOnlyTest;if(s)for(i=n;i<a;++i)o.index=i,s(o)&&t(o,e);else for(i=n;i<a;++i)o.index=i,t(o,e)}else for(i=n;i<a;++i)o.index=i,t(o)},ud.prototype.qualifiedName=function(){return"/"+this.index},ud.prototype.clone=function(){return new this.constructor(this.structure,this.index)},ud.prototype.toObject=function(){return{index:this.index,chainOffset:this.chainOffset,chainCount:this.chainCount}},Object.defineProperties(ud.prototype,hd);var ld=function(t,e){this.signals={refreshed:new Fs},this.init(t,e)},pd={type:{}};function dd(t,e){var i=[],r=!1;if(e){for(var n=0,o=e.length;n<o;++n)i.push(e[n]);a()}function a(){var e=i.shift();void 0!==e?(r=!0,setTimeout((function(){!function(e){t(e,a)}(e)}))):r=!1}this.push=function(t){i.push(t),r||a()},this.kill=function(){i.length=0},this.length=function(){return i.length}}ld.prototype.init=function(t,e){this.name=t,this.path=e,this.title="",this.id="",this.header={},this.extraData={},this.atomSetCache=void 0,this.atomSetDict={},this.biomolDict={},this.entityList=[],this.unitcell=void 0,this.frames=[],this.boxes=[],this.validation=void 0,this.bondStore=new yp(0),this.backboneBondStore=new yp(0),this.rungBondStore=new yp(0),this.atomStore=new bp(0),this.residueStore=new xp(0),this.chainStore=new _p(0),this.modelStore=new wp(0),this.atomMap=new Zp(this),this.residueMap=new Qp(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()},pd.type.get=function(){return"Structure"},ld.prototype.finalizeAtoms=function(){this.atomSet=this.getAtomSet(),this.atomCount=this.atomStore.count,this.boundingBox=this.getBoundingBox(),this.center=this.boundingBox.getCenter(),this.spatialHash=new Kl(this.atomStore,this.boundingBox)},ld.prototype.finalizeBonds=function(){for(var t in this.bondSet=this.getBondSet(),this.bondCount=this.bondStore.count,this.bondHash=new mp(this.bondStore,this.atomStore.count),this.atomSetCache={},this.atomSetDict.rung||(this.atomSetDict.rung=this.getAtomSet(!1)),this.atomSetDict)this.atomSetCache["__"+t]=this.atomSetDict[t].clone()},ld.prototype.getBondProxy=function(t){return new Jp(this,t)},ld.prototype.getAtomProxy=function(t){return new ed(this,t)},ld.prototype.getResidueProxy=function(t){return new rd(this,t)},ld.prototype.getChainProxy=function(t){return new sd(this,t)},ld.prototype.getModelProxy=function(t){return new ud(this,t)},ld.prototype.getBondSet=function(){var t=this.bondStore.count,e=new al(t),i=this.atomSet;if(i)for(var r=this.getBondProxy(),n=0;n<t;++n)r.index=n,i.isSet(r.atomIndex1,r.atomIndex2)&&e.set(r.index);else e.setAll();return e},ld.prototype.getBackboneBondSet=function(){var t=this.backboneBondStore.count,e=new al(t),i=this.atomSetCache.__backbone;if(i){var r=this.getBondProxy();r.bondStore=this.backboneBondStore;for(var n=0;n<t;++n)r.index=n,i.isSet(r.atomIndex1,r.atomIndex2)&&e.set(r.index)}else e.set_all(!0);return e},ld.prototype.getRungBondSet=function(){var t=this.rungBondStore.count,e=new al(t),i=this.atomSetCache.__rung;if(i){var r=this.getBondProxy();r.bondStore=this.rungBondStore;for(var n=0;n<t;++n)r.index=n,i.isSet(r.atomIndex1,r.atomIndex2)&&e.set(r.index)}else e.set_all(!0);return e},ld.prototype.getAtomSet=function(t){var e,i=this.atomStore.count;if(t instanceof al)e=t;else if(t&&t.test){var r=t.string;r in this.atomSetCache?e=this.atomSetCache[r]:(e=new al(i),this.eachAtom((function(t){e.set(t.index)}),t),this.atomSetCache[r]=e)}else e=!1===t?new al(i):new al(i,!0);return e},ld.prototype.getAtomSetWithinSelection=function(t,e){var i=this.spatialHash,r=this.getAtomSet(!1),n=this.getAtomProxy();return this.getAtomSet(t).forEach((function(t){n.index=t,i.within(n.x,n.y,n.z,e).forEach((function(t){r.set(t)}))})),r},ld.prototype.getAtomSetWithinPoint=function(t,e){var i=t,r=this.getAtomSet(!1);return this.spatialHash.within(i.x,i.y,i.z,e).forEach((function(t){r.set(t)})),r},ld.prototype.getAtomSetWithinVolume=function(t,e,i,r,n){for(var o=new dp(t,i,r,n),a=o.getDataPosition(),s=a.length,c=o.matrix.getMaxScaleOnAxis(),u=this.getAtomSet(!1),h=0;h<s;h+=3)this.spatialHash.within(a[h],a[h+1],a[h+2],c).forEach((function(t){u.set(t)}));return u},ld.prototype.getAtomSetWithinGroup=function(t){var e=this.atomStore.residueIndex,i=this.getAtomSet(!1),r=this.getResidueProxy();return this.getAtomSet(t).forEach((function(t){r.index=e[t];for(var n=r.atomOffset;n<=r.atomEnd;++n)i.set(n)})),i},ld.prototype.getSelection=function(){return!1},ld.prototype.getStructure=function(){return this},ld.prototype.eachEntity=function(t,e){this.entityList.forEach((function(i){void 0!==e&&i.getEntityType()!==e||t(i)}))},ld.prototype.eachBond=function(t,e){var i,r=this.getBondProxy();if(e&&e.test&&(i=this.getBondSet(e),this.bondSet&&i.intersection(this.bondSet)),i)i.forEach((function(e){r.index=e,t(r)}));else for(var n=this.bondStore.count,o=0;o<n;++o)r.index=o,t(r)},ld.prototype.eachAtom=function(t,e){if(e&&e.test)this.eachModel((function(i){i.eachAtom(t,e)}),e);else for(var i=this.atomStore.count,r=this.getAtomProxy(),n=0;n<i;++n)r.index=n,t(r)},ld.prototype.eachResidue=function(t,e){var i;if(e&&e.test){var r=this.modelStore.count,n=this.getModelProxy(),o=e.modelOnlyTest;if(o)for(i=0;i<r;++i)n.index=i,o(n)&&n.eachResidue(t,e);else for(i=0;i<r;++i)n.index=i,n.eachResidue(t,e)}else{var a=this.residueStore.count,s=this.getResidueProxy();for(i=0;i<a;++i)s.index=i,t(s)}},ld.prototype.eachResidueN=function(t,e){var i,r,n=this.residueStore.count;if(!(n<t)){var o=new Array(t);for(i=0;i<t;++i)o[i]=this.getResidueProxy(i);for(e.apply(this,o),r=t;r<n;++r){for(i=0;i<t;++i)o[i].index+=1;e.apply(this,o)}}},ld.prototype.eachPolymer=function(t,e){if(e&&e.modelOnlyTest){var i=e.modelOnlyTest;this.eachModel((function(r){i(r)&&r.eachPolymer(t,e)}))}else this.eachModel((function(i){i.eachPolymer(t,e)}))},ld.prototype.eachChain=function(t,e){if(e&&e.test)this.eachModel((function(i){i.eachChain(t,e)}));else for(var i=this.chainStore.count,r=this.getChainProxy(),n=0;n<i;++n)r.index=n,t(r)},ld.prototype.eachModel=function(t,e){var i,r=this.modelStore.count,n=this.getModelProxy();if(e&&e.test){var o=e.modelOnlyTest;if(o)for(i=0;i<r;++i)n.index=i,o(n)&&t(n,e);else for(i=0;i<r;++i)n.index=i,t(n,e)}else for(i=0;i<r;++i)n.index=i,t(n)},ld.prototype.getAtomData=function(t){var e=Object.assign({},t);e.colorParams&&(e.colorParams.structure=this.getStructure());var i,r,n,o,a,s,c,u=e.what,h=Eo(e.atomSet,this.atomSet),l={},p=this.getAtomProxy(),d=h.getSize();return u&&!u.position||(n=new Float32Array(3*d),l.position=n),u&&!u.color||(o=new Float32Array(3*d),l.color=o,r=yc.getScheme(e.colorParams)),u&&!u.picking||(a=new Float32Array(d),l.picking=new $h(a,this.getStructure())),u&&!u.radius||(s=new Float32Array(d),l.radius=s,i=new Il(e.radiusParams.radius,e.radiusParams.scale)),u&&!u.index||(c=new Float32Array(d),l.index=c),h.forEach((function(t,e){var u=3*e;p.index=t,n&&p.positionToArray(n,u),o&&r.atomColorToArray(p,o,u),a&&(a[e]=t),s&&(s[e]=i.atomRadius(p)),c&&(c[e]=t)})),l},ld.prototype.getBondData=function(t){var e=Object.assign({},t);e.colorParams&&(e.colorParams.structure=this.getStructure());var i,r,n,o,a,s,c,u,h,l=e.what,p=Eo(e.bondSet,this.bondSet),d=Eo(e.multipleBond,"off"),f="off"!==d,m="offset"===d,g=Eo(e.bondScale,.4),v=Eo(e.bondSpacing,1),y={},b=this.getBondProxy();e.bondStore&&(b.bondStore=e.bondStore);var x,_=this.getAtomProxy(),w=this.getAtomProxy();if(f){var S=b.bondStore.bondOrder;x=0,p.forEach((function(t){x+=S[t]}))}else x=p.getSize();l&&!l.position||(n=new Float32Array(3*x),o=new Float32Array(3*x),y.position1=n,y.position2=o),l&&!l.color||(a=new Float32Array(3*x),s=new Float32Array(3*x),y.color=a,y.color2=s,r=yc.getScheme(e.colorParams)),l&&!l.picking||(c=new Float32Array(x),y.picking=new Wh(c,this.getStructure(),e.bondStore)),(!l||l.radius||f&&l.position)&&(i=new Il(e.radiusParams.radius,e.radiusParams.scale)),l&&!l.radius||(u=new Float32Array(x),y.radius=u,e.radius2&&(h=new Float32Array(x),y.radius2=h));var A,M,P,T,E,C,I,R=0,L=new O,N=new O,D=new O;return p.forEach((function(t){if(M=3*R,b.index=t,_.index=b.atomIndex1,w.index=b.atomIndex2,T=b.bondOrder,n&&(f&&T>1?(E=i.atomRadius(_),C=E*g/(.5*T),b.calculateShiftDir(D),m?(I=2*v*E,D.multiplyScalar(I),D.negate(),N.subVectors(w,_).multiplyScalar(Math.max(.1,I/1.88)),_.positionToArray(n,M),w.positionToArray(o,M),T>=2&&(L.addVectors(_,D).add(N).toArray(n,M+3),L.addVectors(w,D).sub(N).toArray(o,M+3),T>=3&&(L.subVectors(_,D).add(N).toArray(n,M+6),L.subVectors(w,D).sub(N).toArray(o,M+6)))):(I=(v-g)*E,D.multiplyScalar(I),2===T?(L.addVectors(_,D).toArray(n,M),L.subVectors(_,D).toArray(n,M+3),L.addVectors(w,D).toArray(o,M),L.subVectors(w,D).toArray(o,M+3)):3===T?(_.positionToArray(n,M),L.addVectors(_,D).toArray(n,M+3),L.subVectors(_,D).toArray(n,M+6),w.positionToArray(o,M),L.addVectors(w,D).toArray(o,M+3),L.subVectors(w,D).toArray(o,M+6)):(_.positionToArray(n,M),w.positionToArray(o,M)))):(_.positionToArray(n,M),w.positionToArray(o,M))),a&&(r.bondColorToArray(b,1,a,M),r.bondColorToArray(b,0,s,M),f&&T>1))for(A=1;A<T;++A)hu(a,M,P=3*A+M,3),hu(s,M,P,3);if(c&&(c[R]=t,f&&T>1))for(A=1;A<T;++A)c[R+A]=t;if(u&&(u[R]=i.atomRadius(_),f&&T>1))for(C=u[R]*g/(m?1:.5*T),A=m?1:0;A<T;++A)u[R+A]=C;if(h&&(h[R]=i.atomRadius(w),f&&T>1))for(C=h[R]*g/(m?1:.5*T),A=m?1:0;A<T;++A)h[R+A]=C;R+=f?T:1})),y},ld.prototype.getBackboneAtomData=function(t){return t=Object.assign({atomSet:this.atomSetCache.__backbone},t),this.getAtomData(t)},ld.prototype.getBackboneBondData=function(t){return t=Object.assign({bondSet:this.getBackboneBondSet(),bondStore:this.backboneBondStore},t),this.getBondData(t)},ld.prototype.getRungAtomData=function(t){return t=Object.assign({atomSet:this.atomSetCache.__rung},t),this.getAtomData(t)},ld.prototype.getRungBondData=function(t){return t=Object.assign({bondSet:this.getRungBondSet(),bondStore:this.rungBondStore},t),this.getBondData(t)},ld.prototype.getBoundingBox=function(t,e){gc&&mc.time("getBoundingBox"),e=e||new jt;var i=1/0,r=1/0,n=1/0,o=-1/0,a=-1/0,s=-1/0;return this.eachAtom((function(t){var e=t.x,c=t.y,u=t.z;e<i&&(i=e),c<r&&(r=c),u<n&&(n=u),e>o&&(o=e),c>a&&(a=c),u>s&&(s=u)}),t),e.min.set(i,r,n),e.max.set(o,a,s),gc&&mc.timeEnd("getBoundingBox"),e},ld.prototype.getPrincipalAxes=function(t){gc&&mc.time("getPrincipalAxes");var e=0,i=new Rl(3,this.atomCount),r=i.data;return this.eachAtom((function(t){r[e+0]=t.x,r[e+1]=t.y,r[e+2]=t.z,e+=3}),t),gc&&mc.timeEnd("getPrincipalAxes"),new Zl(i)},ld.prototype.atomCenter=function(t){return t?this.getBoundingBox(t).getCenter():this.center.clone()},ld.prototype.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},ld.prototype.getAtomIndices=function(t){var e;if(t&&t.string)e=[],this.eachAtom((function(t){e.push(t.index)}),t);else{e=this.getAtomData({what:{index:!0}}).index}return e},ld.prototype.getChainnameCount=function(t){var e=new Set;return this.eachChain((function(t){t.residueCount&&e.add(t.chainname)}),t),e.size},ld.prototype.updatePosition=function(t){var e=0;this.eachAtom((function(i){i.positionFromArray(t,e),e+=3}))},ld.prototype.refreshPosition=function(){this.getBoundingBox(void 0,this.boundingBox),this.boundingBox.getCenter(this.center),this.spatialHash=new Kl(this.atomStore,this.boundingBox)},ld.prototype.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},Object.defineProperties(ld.prototype,pd);var fd=function(t,e){var i;"function"==typeof t.eachAtom?i=t.atomCount:t instanceof Float32Array&&(i=t.length/3);var r=new Rl(3,i),n=new Rl(3,i);this.coords1t=new Rl(i,3),this.coords2t=new Rl(i,3),this.A=new Rl(3,3),this.W=new Rl(1,3),this.U=new Rl(3,3),this.V=new Rl(3,3),this.VH=new Rl(3,3),this.R=new Rl(3,3),this.tmp=new Rl(3,3),this.c=new Rl(3,3),this.c.data.set([1,0,0,0,1,0,0,0,-1]),this.prepCoords(t,r),this.prepCoords(e,n),this._superpose(r,n)};fd.prototype._superpose=function(t,e){var i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S;this.mean1=Dl(t),this.mean2=Dl(e),kl(t,this.mean1),kl(e,this.mean2),Ll(this.coords1t,t),Ll(this.coords2t,e),Ol(this.A,this.coords2t,this.coords1t),zl(this.A,this.W,this.U,this.V),i=this.V,r=this.VH,n=i.data,o=r.data,a=n[4],s=n[8],c=n[5],u=n[7],h=n[0],l=h*a,p=h*c,d=n[3],f=n[1],m=d*f,g=n[2],v=d*g,y=n[6],_=1/(l*s-p*u-m*s+v*u+(b=y*f)*c-(x=y*g)*a),o[0]=(a*s-c*u)*_,o[1]=-(f*s-g*u)*_,o[2]=-(-f*c+g*a)*_,o[3]=-(d*s-c*y)*_,o[4]=(h*s-x)*_,o[5]=-(p-v)*_,o[6]=-(-d*u+a*y)*_,o[7]=-(h*u-b)*_,o[8]=(l-m)*_,Nl(this.R,this.U,this.VH),w=this.R,(S=w.data)[0]*S[4]*S[8]-S[0]*S[5]*S[7]-S[3]*S[1]*S[8]+S[3]*S[2]*S[7]+S[6]*S[1]*S[5]-S[6]*S[2]*S[4]<0&&(gc&&mc.log("R not a right handed system"),Nl(this.tmp,this.c,this.VH),Nl(this.R,this.U,this.tmp))},fd.prototype.prepCoords=function(t,e){var i=0,r=e.data;"function"==typeof t.eachAtom?t.eachAtom((function(t){r[i+0]=t.x,r[i+1]=t.y,r[i+2]=t.z,i+=3})):t instanceof Float32Array?r.set(t):mc.warn("prepCoords: input type unknown")},fd.prototype.transform=function(t){var e;"function"==typeof t.eachAtom?e=t.atomCount:t instanceof Float32Array&&(e=t.length/3);var i=new Rl(3,e),r=new Rl(e,3);this.prepCoords(t,i),kl(i,this.mean1),Ol(r,this.R,i),Ll(i,r),function(t,e){var i,r,n=0,o=t.rows,a=t.cols,s=t.data;for(i=0;i<o;++i)for(r=0;r<a;++r,++n)s[n]+=e[r]}(i,this.mean2);var n=0,o=i.data;"function"==typeof t.eachAtom?t.eachAtom((function(t){t.x=o[n+0],t.y=o[n+1],t.z=o[n+2],n+=3})):t instanceof Float32Array?t.set(o.subarray(0,3*e)):mc.warn("transform: input type unknown")};var md=function(t,e){this.signals={startedRunning:new Fs,haltedRunning:new Fs};var i=Object.assign({},e);t.signals.playerChanged.add((function(t){t!==this&&this.pause()}),this);var r=Eo(t.numframes,1);this.traj=t,this.start=Eo(i.start,0),this.end=Math.min(Eo(i.end,r-1),r-1),this.step=Eo(i.step,Math.ceil((r+1)/100)),this.timeout=Eo(i.timeout,50),this.interpolateType=Eo(i.interpolateType,""),this.interpolateStep=Eo(i.interpolateStep,5),this.mode=Eo(i.mode,"loop"),this.direction=Eo(i.direction,"forward"),this._stopFlag=!1,this._running=!1,t.signals.gotNumframes.add((function(t){this.end=Math.min(Eo(i.end,t-1),t-1)}),this)};md.prototype._animate=function(){var t,e,i,r;(this._running=!0,this.traj.inProgress||this._stopFlag||(((t="forward"===this.direction?this.traj.currentFrame+this.step:this.traj.currentFrame-this.step)>=this.end||t<this.start)&&("once"===this.mode?(this.pause(),t="forward"===this.direction?this.end:this.start):t="forward"===this.direction?this.start:this.end),this.interpolateType||this.traj.setFrame(t)),this._stopFlag)?this._running=!1:!this.traj.inProgress&&this.interpolateType?("forward"===this.direction?(e=Math.max(this.start,t-this.step),i=Math.max(this.start,t-2*this.step),r=Math.max(this.start,t-3*this.step)):(e=Math.min(this.end,t+this.step),i=Math.min(this.end,t+2*this.step),r=Math.min(this.end,t+3*this.step)),this._interpolate(t,e,i,r,1/this.interpolateStep,0)):setTimeout(this._animate.bind(this),this.timeout)},md.prototype._interpolate=function(t,e,i,r,n,o){if((o+=n)<=1){var a=Math.round(this.timeout*n);this.traj.setFrameInterpolated(t,e,i,r,o,this.interpolateType,function(){setTimeout(function(){this._interpolate(t,e,i,r,n,o)}.bind(this),a)}.bind(this))}else setTimeout(this._animate.bind(this),0)},md.prototype.toggle=function(){this._running?this.pause():this.play()},md.prototype.play=function(){if(!this._running){this.traj.player!==this&&this.traj.setPlayer(this);var t=this.traj.currentFrame,e=Math.ceil(t/this.step)*this.step;"forward"===this.direction&&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()}},md.prototype.pause=function(){this._running&&(this._stopFlag=!0,this.signals.haltedRunning.dispatch())},md.prototype.stop=function(){this.traj.setFrame(this.start),this.pause()};var gd=function(t,e,i){this.signals={gotNumframes:new Fs,frameChanged:new Fs,selectionChanged:new Fs,playerChanged:new Fs};var r=i||{};r.centerPbc=Eo(r.centerPbc,!0),r.removePbc=Eo(r.removePbc,!0),r.superpose=Eo(r.superpose,!0),this.setParameters(r),this.name=t.replace(/^.*[\\/]/,""),this.selection=new nc(Eo(r.sele,"backbone and not hydrogen")),this.selection.signals.stringChanged.add((function(){this.makeIndices(),this.resetCache()}),this),this.setStructure(e),this.setPlayer(new md(this)),this.trajPath=t,this.numframes=void 0,this.getNumframes()};function vd(t){return"front"===t?0:"back"===t?1:2}gd.prototype.setStructure=function(t){this.structure=t,this.atomCount=t.atomCount,this.makeAtomIndices(),this.saveInitialStructure(),this.backboneIndices=this.getIndices(new nc("backbone and not hydrogen")),this.makeIndices(),this.frameCache=[],this.boxCache=[],this.pathCache=[],this.frameCacheSize=0,this.currentFrame=-1},gd.prototype.saveInitialStructure=function(){var t=0,e=new Float32Array(3*this.atomCount);this.structure.eachAtom((function(i){e[t+0]=i.x,e[t+1]=i.y,e[t+2]=i.z,t+=3})),this.initialStructure=e},gd.prototype.setSelection=function(t){return this.selection.setString(t),this},gd.prototype.getIndices=function(t){var e;if(t&&t.test){var i=0,r=t.test;e=[],this.structure.eachAtom((function(t){r(t)&&e.push(i),i+=1}))}else e=this.structure.getAtomIndices(this.selection);return e},gd.prototype.makeIndices=function(){var t,e;this.indices=this.getIndices(this.selection);var i=3*this.indices.length;this.coords1=new Float32Array(i),this.coords2=new Float32Array(i);var r=this.initialStructure,n=this.coords2;for(t=0;t<i;t+=3)e=3*this.indices[t/3],n[t+0]=r[e+0],n[t+1]=r[e+1],n[t+2]=r[e+2]},gd.prototype.makeAtomIndices=function(){mc.error("Trajectory.makeAtomIndices not implemented")},gd.prototype.getNumframes=function(){mc.error("Trajectory.loadFrame not implemented")},gd.prototype.resetCache=function(){return this.frameCache=[],this.boxCache=[],this.pathCache=[],this.frameCacheSize=0,this.setFrame(this.currentFrame),this},gd.prototype.setParameters=function(t){var e=t,i=!1;void 0!==e.centerPbc&&e.centerPbc!==this.centerPbc&&(this.centerPbc=e.centerPbc,i=!0),void 0!==e.removePbc&&e.removePbc!==this.removePbc&&(this.removePbc=e.removePbc,i=!0),void 0!==e.superpose&&e.superpose!==this.superpose&&(this.superpose=e.superpose,i=!0),i&&this.resetCache()},gd.prototype.setFrame=function(t,e){return void 0===t?this:(this.inProgress=!0,-1===(t=parseInt(t))||this.frameCache[t]?this.updateStructure(t,e):this.loadFrame(t,function(){this.updateStructure(t,e)}.bind(this)),this)},gd.prototype.interpolate=function(t,e,i,r,n,o,a){var s,c=this.frameCache,u=c[t],h=c[e],l=c[i],p=c[r],d=u.length,f=new Float32Array(d);if("spline"===o)for(s=0;s<d;s+=3)f[s+0]=Is(p[s+0],l[s+0],h[s+0],u[s+0],n,1),f[s+1]=Is(p[s+1],l[s+1],h[s+1],u[s+1],n,1),f[s+2]=Is(p[s+2],l[s+2],h[s+2],u[s+2],n,1);else for(s=0;s<d;s+=3)f[s+0]=Cs(h[s+0],u[s+0],n),f[s+1]=Cs(h[s+1],u[s+1],n),f[s+2]=Cs(h[s+2],u[s+2],n);this.structure.updatePosition(f),this.currentFrame=t,this.signals.frameChanged.dispatch(t),"function"==typeof a&&a()},gd.prototype.setFrameInterpolated=function(t,e,i,r,n,o,a){if(void 0===t)return this;var s=this.frameCache,c=[];return s[r]||c.push(r),s[i]||c.push(i),s[e]||c.push(e),s[t]||c.push(t),c.length?this.loadFrame(c,function(){this.interpolate(t,e,i,r,n,o,a)}.bind(this)):this.interpolate(t,e,i,r,n,o,a),this},gd.prototype.loadFrame=function(t,e){if(Array.isArray(t)){var i,r=function(t,r){this._loadFrame(t,r),0===i.length()&&"function"==typeof e&&e()}.bind(this);i=new dd(r,t)}else this._loadFrame(t,e)},gd.prototype._loadFrame=function(t,e){mc.error("Trajectory._loadFrame not implemented",t,e)},gd.prototype.updateStructure=function(t,e){this._disposed||(-1===t?this.structure.updatePosition(this.initialStructure):this.structure.updatePosition(this.frameCache[t]),this.structure.trajectory={name:this.trajPath,frame:t},"function"==typeof e&&e(),this.currentFrame=t,this.inProgress=!1,this.signals.frameChanged.dispatch(t))},gd.prototype.getCircularMean=function(t,e,i){return[ru(e,i[0],3,0,t),ru(e,i[1],3,1,t),ru(e,i[2],3,2,t)]},gd.prototype.doSuperpose=function(t){var e,i,r=3*this.indices.length,n=this.coords1,o=this.coords2;for(e=0;e<r;e+=3)i=3*this.indices[e/3],n[e+0]=t[i+0],n[e+1]=t[i+1],n[e+2]=t[i+2];new fd(n,o).transform(t)},gd.prototype.process=function(t,e,i,r){if(this.setNumframes(r),e){if(this.backboneIndices.length>0&&this.centerPbc){var n=[e[0],e[4],e[8]];!function(t,e,i){if(0!==i[0]&&0!==i[8]&&0!==i[4]){var r,n=t.length,o=i[0],a=i[1],s=i[2],c=-e[0]+o+o/2,u=-e[1]+a+a/2,h=-e[2]+s+s/2;for(r=0;r<n;r+=3)t[r+0]=(t[r+0]+c)%o,t[r+1]=(t[r+1]+u)%a,t[r+2]=(t[r+2]+h)%s}}(i,this.getCircularMean(this.backboneIndices,i,n),n)}this.removePbc&&function(t,e){if(0!==e[0]&&0!==e[8]&&0!==e[4]){var i,r,n,o,a=t.length;for(i=3;i<a;i+=3)for(r=0;r<3;++r)if(o=t[i+r]-t[i-3+r],Math.abs(o)>.9*e[3*r+r])if(o>0)for(n=0;n<3;++n)t[i+n]-=e[3*r+n];else for(n=0;n<3;++n)t[i+n]+=e[3*r+n]}}(i,e)}this.indices.length>0&&this.superpose&&this.doSuperpose(i),this.frameCache[t]=i,this.boxCache[t]=e,this.frameCacheSize+=1},gd.prototype.setNumframes=function(t){t!==this.numframes&&(this.numframes=t,this.signals.gotNumframes.dispatch(t))},gd.prototype.dispose=function(){this.frameCache=[],this._disposed=!0,this.player&&this.player.stop()},gd.prototype.setPlayer=function(t){this.player=t,this.signals.playerChanged.dispatch(t)},gd.prototype.getPath=function(t,e){mc.error("Trajectory.getPath not implemented",t,e)},wc.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 )\n#include unpack_color\nattribute float primitiveId;\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 = unpackColor( primitiveId );\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}"),wc.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 )\nif( opacity < 0.7 )\ndiscard;\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}");var yd={f:1,v2:2,v3:3,c:3};function bd(t,e){t.matrix.copy(e),t.matrix.decompose(t.position,t.quaternion,t.scale),t.matrixWorldNeedsUpdate=!0}var xd=function(t,e){var i=t||{},r=e||{};this.opaqueBack=Eo(r.opaqueBack,!1),this.dullInterior=Eo(r.dullInterior,!1),this.side=Eo(r.side,"double"),this.opacity=Eo(r.opacity,1),this.depthWrite=Eo(r.depthWrite,!0),this.clipNear=Eo(r.clipNear,0),this.clipRadius=Eo(r.clipRadius,0),this.clipCenter=Eo(r.clipCenter,new O),this.flatShaded=Eo(r.flatShaded,!1),this.background=Eo(r.background,!1),this.linewidth=Eo(r.linewidth,1),this.wireframe=Eo(r.wireframe,!1),this.wireframeLinewidth=Eo(r.wireframeLinewidth,1),this.roughness=Eo(r.roughness,.4),this.metalness=Eo(r.metalness,0),this.diffuse=Eo(r.diffuse,16777215),this.forceTransparent=Eo(r.forceTransparent,!1),this.disablePicking=Eo(r.disablePicking,!1),this.geometry=new _e,this.indexVersion=0,this.wireframeIndexVersion=-1,this.uniforms=Mt.merge([At.common,{fogColor:{value:null},fogNear:{value:0},fogFar:{value:0},opacity:{value:this.opacity},nearClip:{value:0},clipRadius:{value:this.clipRadius},clipCenter:{value:this.clipCenter}},{emissive:{value:new St(0)},roughness:{value:this.roughness},metalness:{value:this.metalness}},At.ambient,At.lights]),this.uniforms.diffuse.value.set(this.diffuse),this.pickingUniforms={nearClip:{value:0},objectId:{value:0},opacity:{value:this.opacity}},this.group=new Ci,this.wireframeGroup=new Ci,this.pickingGroup=new Ci,this.matrix=Eo(r.matrix,new N);var n=i.position||i.position1;this._positionDataSize=n?n.length/3:0,this.addAttributes({position:{type:"v3",value:i.position},color:{type:"c",value:i.color},primitiveId:{type:"f",value:i.primitiveId}}),i.index&&this.initIndex(i.index),this.picking=i.picking,this.makeWireframeGeometry()},_d={parameters:{},matrix:{},transparent:{},size:{},attributeSize:{},pickable:{},dynamic:{},vertexShader:{},fragmentShader:{}};_d.parameters.get=function(){return{opaqueBack:{updateShader:!0},dullInterior:{updateShader:!0},side:{updateShader:!0,property:!0},opacity:{uniform:!0},depthWrite:{property:!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},matrix:{}}},_d.matrix.set=function(t){this.setMatrix(t)},_d.matrix.get=function(){return this.group.matrix.clone()},_d.transparent.get=function(){return this.opacity<1||this.forceTransparent},_d.size.get=function(){return this._positionDataSize},_d.attributeSize.get=function(){return this.size},_d.pickable.get=function(){return!!this.picking&&!this.disablePicking},_d.dynamic.get=function(){return!0},_d.vertexShader.get=function(){},_d.fragmentShader.get=function(){},xd.prototype.setMatrix=function(t){bd(this.group,t),bd(this.wireframeGroup,t),bd(this.pickingGroup,t)},xd.prototype.initIndex=function(t){this.geometry.setIndex(new me(t,1)),this.geometry.getIndex().setDynamic(this.dynamic)},xd.prototype.makeMaterial=function(){var t=vd(this.side),e=new zt({uniforms:this.uniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:this.transparent,depthWrite:this.depthWrite,lights:!0,fog:!0,side:t,linewidth:this.linewidth});e.vertexColors=2,e.extensions.derivatives=this.flatShaded,e.extensions.fragDepth=this.isImpostor,e.clipNear=this.clipNear;var i=new zt({uniforms:this.uniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:this.transparent,depthWrite:this.depthWrite,lights:!1,fog:!0,side:t,linewidth:this.linewidth});i.vertexColors=2,i.clipNear=this.clipNear;var r=new zt({uniforms:this.pickingUniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:!1,depthWrite:this.depthWrite,lights:!1,fog:!1,side:t,linewidth:this.linewidth,blending:0});r.vertexColors=2,r.extensions.fragDepth=this.isImpostor,r.clipNear=this.clipNear,this.material=e,this.wireframeMaterial=i,this.pickingMaterial=r,this.updateShader()},xd.prototype.makeWireframeGeometry=function(){this.makeWireframeIndex();var t=this.geometry,e=this.wireframeIndex,i=new _e;i.attributes=t.attributes,e&&(i.setIndex(new me(e,1).setDynamic(this.dynamic)),i.setDrawRange(0,this.wireframeIndexCount)),this.wireframeGeometry=i},xd.prototype.makeWireframeIndex=function(){var t=[];function e(e,i){if(e>i){var r=e;e=i,i=r}var n=t[e];return void 0===n?(t[e]=[i],!0):!n.includes(i)&&(n.push(i),!0)}var i=this.geometry,r=i.index;if(this.wireframe)if(r){var n,o=r.array,a=o.length;if(i.drawRange.count!==1/0&&(a=i.drawRange.count),this.wireframeIndex&&this.wireframeIndex.length>2*a)n=this.wireframeIndex;else n=zo(2*a,i.attributes.position.count);var s=0;t.length=0;for(var c=0;c<a;c+=3){var u=o[c+0],h=o[c+1],l=o[c+2];e(u,h)&&(n[s+0]=u,n[s+1]=h,s+=2),e(h,l)&&(n[s+0]=h,n[s+1]=l,s+=2),e(l,u)&&(n[s+0]=l,n[s+1]=u,s+=2)}this.wireframeIndex=n,this.wireframeIndexCount=s,this.wireframeIndexVersion=this.indexVersion}else{var p,d=i.attributes.position.count;p=this.wireframeIndex&&this.wireframeIndex.length>2*d?this.wireframeIndex:zo(2*d,d);for(var f=0,m=0;f<d;f+=3)p[m+0]=f,p[m+1]=f+1,p[m+2]=f+1,p[m+3]=f+2,p[m+4]=f+2,p[m+5]=f,m+=6;this.wireframeIndex=p,this.wireframeIndexCount=2*d,this.wireframeIndexVersion=this.indexVersion}else this.wireframeIndex=new Uint16Array(0),this.wireframeIndexCount=0},xd.prototype.updateWireframeIndex=function(){if(this.wireframeGeometry.setDrawRange(0,1/0),this.wireframeIndexVersion<this.indexVersion&&this.makeWireframeIndex(),this.wireframeIndex.length>this.wireframeGeometry.index.array.length)this.wireframeGeometry.setIndex(new me(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)},xd.prototype.getRenderOrder=function(){var t=0;return this.isText?t=1:this.transparent&&(t=this.isSurface?3:2),t},xd.prototype._getMesh=function(t){this.material||this.makeMaterial();var e,i=this.geometry,r=this[t];return this.isLine?e=new Mi(i,r):this.isPoint?(e=new Ei(i,r),this.sortParticles&&(e.sortParticles=!0)):e=new Ie(i,r),e.frustumCulled=!1,e.renderOrder=this.getRenderOrder(),e},xd.prototype.getMesh=function(){return this._getMesh("material")},xd.prototype.getWireframeMesh=function(){var t;return this.material||this.makeMaterial(),this.wireframeGeometry||this.makeWireframeGeometry(),(t=new Mi(this.wireframeGeometry,this.wireframeMaterial)).frustumCulled=!1,t.renderOrder=this.getRenderOrder(),t},xd.prototype.getPickingMesh=function(){return this._getMesh("pickingMaterial")},xd.prototype.getShader=function(t,e){return qc(t,this.getDefines(e))},xd.prototype.getVertexShader=function(t){return this.getShader(this.vertexShader,t)},xd.prototype.getFragmentShader=function(t){return this.getShader(this.fragmentShader,t)},xd.prototype.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},xd.prototype.getParameters=function(){var t={};for(var e in this.parameters)t[e]=this[e];return t},xd.prototype.addUniforms=function(t){this.uniforms=Mt.merge([this.uniforms,t]),this.pickingUniforms=Mt.merge([this.pickingUniforms,t])},xd.prototype.addAttributes=function(t){for(var e in t){var i=void 0,r=t[e],n=this.attributeSize*yd[r.type];r.value?(n!==r.value.length&&mc.error("attribute value has wrong length",e),i=r.value):i=Bo("float32",n),this.geometry.addAttribute(e,new me(i,yd[r.type]).setDynamic(this.dynamic))}},xd.prototype.updateRenderOrder=function(){var t=this.getRenderOrder();function e(e){e.renderOrder=t}this.group.children.forEach(e),this.pickingGroup&&this.pickingGroup.children.forEach(e)},xd.prototype.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},xd.prototype.setParameters=function(t){if(t){var e=t,i=this.parameters,r={},n={},o=!1,a=!1;for(var s in e){var c=e[s];void 0!==c&&(void 0!==i[s]&&(this[s]=c,i[s].property&&(!0!==i[s].property?r[i[s].property]=c:r[s]=c),i[s].uniform&&(!0!==i[s].uniform?n[i[s].uniform]=c:n[s]=c),i[s].updateShader&&(o=!0),i[s].updateVisibility&&(a=!0),this.dynamic&&"wireframe"===s&&!0===c&&this.updateWireframeIndex(),"flatShaded"===s&&(this.material.extensions.derivatives=this.flatShaded),"forceTransparent"===s&&(r.transparent=this.transparent)))}this.setProperties(r),this.setUniforms(n),o&&this.updateShader(),a&&this.setVisibility(this.visible)}},xd.prototype.setAttributes=function(t){var e=this.geometry,i=e.attributes;for(var r in t)if("picking"!==r){var n=t[r],o=n.length;if("index"===r){var a=e.getIndex();e.setDrawRange(0,1/0),o>a.array.length?e.setIndex(new me(n,1).setDynamic(this.dynamic)):(a.set(n),a.needsUpdate=o>0,a.updateRange.count=o,e.setDrawRange(0,o)),this.indexVersion++,this.wireframe&&this.updateWireframeIndex()}else{var s=i[r];o>s.array.length?e.addAttribute(r,new me(n,s.itemSize).setDynamic(this.dynamic)):(i[r].set(n),i[r].needsUpdate=o>0,i[r].updateRange.count=o)}}},xd.prototype.setUniforms=function(t){if(t){var e=this.material.uniforms,i=this.wireframeMaterial.uniforms,r=this.pickingMaterial.uniforms;for(var n in t)"opacity"===n&&this.setProperties({transparent:this.transparent}),void 0!==e[n]&&(e[n].value.isVector3?e[n].value.copy(t[n]):e[n].value.set?e[n].value.set(t[n]):e[n].value=t[n]),void 0!==i[n]&&(i[n].value.isVector3?i[n].value.copy(t[n]):i[n].value.set?i[n].value.set(t[n]):i[n].value=t[n]),void 0!==r[n]&&(r[n].value.isVector3?r[n].value.copy(t[n]):r[n].value.set?r[n].value.set(t[n]):r[n].value=t[n])}},xd.prototype.setProperties=function(t){if(t){var e=this.material,i=this.wireframeMaterial,r=this.pickingMaterial;for(var n in t){var o=t[n];"transparent"===n?this.updateRenderOrder():"side"===n&&(o=vd(o)),void 0!==e[n]&&(e[n]=o),void 0!==i[n]&&(i[n]=o),void 0!==r[n]&&(r[n]=o)}e.needsUpdate=!0,i.needsUpdate=!0,r.needsUpdate=!0}},xd.prototype.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))},xd.prototype.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()},Object.defineProperties(xd.prototype,_d);var wd=function(t){function e(e,i){var r=e||{};!r.primitiveId&&r.position&&(r.primitiveId=su(r.position.length/3)),t.call(this,r,i),this.addAttributes({normal:{type:"v3",value:r.normal}}),void 0===r.normal&&this.geometry.computeVertexNormals()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={vertexShader:{},fragmentShader:{}};return i.vertexShader.get=function(){return"Mesh.vert"},i.fragmentShader.get=function(){return"Mesh.frag"},Object.defineProperties(e.prototype,i),e}(xd),Sd=new N,Ad=new Vt,Md=function(t){function e(e,i,r){var n,o=e||{},a=i||{},s=r.attributes.position.array,c=r.attributes.normal.array,u=r.index?r.index.array:void 0,h=o.position.length/3,l=s.length/3,p=h*l,d=new Float32Array(3*p),f=new Float32Array(3*p),m=new Float32Array(3*p);u&&(n=zo(h*u.length,p)),t.call(this,{position:d,color:m,index:n,normal:f,primitiveId:o.primitiveId||cu(h,l),picking:o.picking},a),this.setAttributes(o),this.geoPosition=s,this.geoNormal=c,this.geoIndex=u,this.positionCount=h,this.geoPositionCount=l,this.transformedGeoPosition=new Float32Array(3*l),this.transformedGeoNormal=new Float32Array(3*l),this.meshPosition=d,this.meshColor=m,this.meshIndex=n,this.meshNormal=f,this.meshIndex=n,this.makeIndex()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={updateNormals:{}};return e.prototype.applyPositionTransform=function(){},e.prototype.setAttributes=function(t,e){var i,r,n,o,a,s,c,u,h,l=this.geometry.attributes,p=this.updateNormals;t.position&&(i=t.position,n=this.geoPosition,c=this.meshPosition,a=this.transformedGeoPosition,l.position.needsUpdate=!0,(p||e)&&(o=this.geoNormal,h=this.meshNormal,s=this.transformedGeoNormal,l.normal.needsUpdate=!0)),t.color&&(r=t.color,u=this.meshColor,l.color.needsUpdate=!0);for(var d=this.positionCount,f=this.geoPositionCount,m=0;m<d;++m){var g=void 0,v=void 0,y=m*f*3,b=3*m;if(i&&(a.set(n),Sd.makeTranslation(i[b],i[b+1],i[b+2]),this.applyPositionTransform(Sd,m,b),Ah(Sd.elements,a),c.set(a,y),p?(s.set(o),Ad.getNormalMatrix(Sd),Mh(Ad.elements,s),h.set(s,y)):e&&h.set(o,y)),r)for(g=0;g<f;++g)u[v=y+3*g]=r[b],u[v+1]=r[b+1],u[v+2]=r[b+2]}},e.prototype.makeIndex=function(){var t=this.geoIndex,e=this.meshIndex;if(t)for(var i=this.positionCount,r=this.geoPositionCount,n=3*(t.length/3),o=0;o<i;++o){var a=o*n,s=a+n;e.set(t,a);for(var c=a;c<s;++c)e[c]+=o*r}},i.updateNormals.get=function(){return!1},Object.defineProperties(e.prototype,i),e}(wd),Pd=new O,Td=function(t){function e(e,i){var r=i||{},n=new Gi(1,Eo(r.sphereDetail,1));t.call(this,e,r,n),this.setAttributes(e,!0)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.applyPositionTransform=function(t,e){var i=this._radius[e];Pd.set(i,i,i),t.scale(Pd)},e.prototype.setAttributes=function(e,i){e.radius&&(this._radius=e.radius),t.prototype.setAttributes.call(this,e,i)},e}(Md);wc.add("shader/SphereImpostor.vert","uniform mat4 projectionMatrixInverse;\nuniform float nearClip;\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\nattribute vec2 mapping;\nattribute float radius;\n#ifdef PICKING\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#endif\n#include matrix_scale\nconst mat4 D = mat4(\n1.0, 0.0, 0.0, 0.0,\n0.0, 1.0, 0.0, 0.0,\n0.0, 0.0, 1.0, 0.0,\n0.0, 0.0, 0.0, -1.0\n);\nmat4 transpose( in mat4 inMatrix ) {\nvec4 i0 = inMatrix[0];\nvec4 i1 = inMatrix[1];\nvec4 i2 = inMatrix[2];\nvec4 i3 = inMatrix[3];\nmat4 outMatrix = mat4(\nvec4(i0.x, i1.x, i2.x, i3.x),\nvec4(i0.y, i1.y, i2.y, i3.y),\nvec4(i0.z, i1.z, i2.z, i3.z),\nvec4(i0.w, i1.w, i2.w, i3.w)\n);\nreturn outMatrix;\n}\nvoid ComputePointSizeAndPositionInClipCoordSphere(){\nvec2 xbc;\nvec2 ybc;\nmat4 T = mat4(\nradius, 0.0, 0.0, 0.0,\n0.0, radius, 0.0, 0.0,\n0.0, 0.0, radius, 0.0,\nposition.x, position.y, position.z, 1.0\n);\nmat4 R = transpose( projectionMatrix * modelViewMatrix * T );\nfloat A = dot( R[ 3 ], D * R[ 3 ] );\nfloat B = -2.0 * dot( R[ 0 ], D * R[ 3 ] );\nfloat C = dot( R[ 0 ], D * R[ 0 ] );\nxbc[ 0 ] = ( -B - sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nxbc[ 1 ] = ( -B + sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nfloat sx = abs( xbc[ 0 ] - xbc[ 1 ] ) * 0.5;\nA = dot( R[ 3 ], D * R[ 3 ] );\nB = -2.0 * dot( R[ 1 ], D * R[ 3 ] );\nC = dot( R[ 1 ], D * R[ 1 ] );\nybc[ 0 ] = ( -B - sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nybc[ 1 ] = ( -B + sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nfloat sy = abs( ybc[ 0 ] - ybc[ 1 ] ) * 0.5;\ngl_Position.xy = vec2( 0.5 * ( xbc.x + xbc.y ), 0.5 * ( ybc.x + ybc.y ) );\ngl_Position.xy -= mapping * vec2( sx, sy );\ngl_Position.xy *= gl_Position.w;\n}\nvoid main(void){\n#ifdef PICKING\nvPickingColor = unpackColor( primitiveId );\n#else\n#include color_vertex\n#endif\nvRadius = radius * matrixScale( modelViewMatrix );\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nmvPosition.z -= vRadius;\ngl_Position = projectionMatrix * vec4( mvPosition.xyz, 1.0 );\nComputePointSizeAndPositionInClipCoordSphere();\nvRadiusSq = vRadius * vRadius;\nvec4 vPoint4 = projectionMatrixInverse * gl_Position;\nvPoint = vPoint4.xyz / vPoint4.w;\nvPointViewPosition = -mvPosition.xyz / mvPosition.w;\n}"),wc.add("shader/SphereImpostor.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 mat4 projectionMatrix;\nuniform float ortho;\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n#ifdef PICKING\nuniform float objectId;\nvarying vec3 vPickingColor;\n#else\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\nbool flag2 = false;\nbool interior = false;\nvec3 cameraPos;\nvec3 cameraNormal;\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}\nfloat calcClip( vec3 cameraPos ){\nreturn dot( vec4( cameraPos, 1.0 ), vec4( 0.0, 0.0, 1.0, nearClip - 0.5 ) );\n}\nbool Impostor( out vec3 cameraPos, out vec3 cameraNormal ){\nvec3 cameraSpherePos = -vPointViewPosition;\ncameraSpherePos.z += vRadius;\nvec3 rayOrigin = mix( vec3( 0.0, 0.0, 0.0 ), vPoint, ortho );\nvec3 rayDirection = mix( normalize( vPoint ), vec3( 0.0, 0.0, 1.0 ), ortho );\nvec3 cameraSphereDir = mix( cameraSpherePos, rayOrigin - cameraSpherePos, ortho );\nfloat B = dot( rayDirection, cameraSphereDir );\nfloat det = B * B + vRadiusSq - dot( cameraSphereDir, cameraSphereDir );\nif( det < 0.0 ){\ndiscard;\nreturn false;\n}else{\nfloat sqrtDet = sqrt( det );\nfloat posT = mix( B + sqrtDet, B + sqrtDet, ortho );\nfloat negT = mix( B - sqrtDet, sqrtDet - B, ortho );\ncameraPos = rayDirection * negT + rayOrigin;\n#ifdef NEAR_CLIP\nif( calcDepth( cameraPos ) <= 0.0 ){\ncameraPos = rayDirection * posT + rayOrigin;\ninterior = true;\nreturn false;\n}else if( calcClip( cameraPos ) > 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}");var Ed=function(t){function e(e,i){t.call(this,e,i),this.index=zo(this.indexSize,this.attributeSize),this.makeIndex(),this.initIndex(this.index,1),this.addAttributes({mapping:{type:this.mappingType,value:null}}),this.setAttributes({primitiveId:su(this.size)})}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={attributeSize:{},indexSize:{},mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return i.attributeSize.get=function(){return this.size*this.mappingSize},i.indexSize.get=function(){return this.size*this.mappingIndicesSize},i.mapping.get=function(){},i.mappingIndices.get=function(){},i.mappingIndicesSize.get=function(){},i.mappingType.get=function(){},i.mappingSize.get=function(){},i.mappingItemSize.get=function(){},e.prototype.addAttributes=function(e){var i={};for(var r in e){var n=e[r];i[r]={type:n.type,value:null}}t.prototype.addAttributes.call(this,i)},e.prototype.getAttributeIndex=function(t){return 3*t*this.mappingSize},e.prototype.setAttributes=function(t){t&&!t.position&&t.position1&&t.position2&&(t.position=nu(t.position1,t.position2));var e,i,r,n,o,a,s,c=this.size,u=this.mappingSize,h=this.geometry.attributes;for(var l in t)if("index"!==l&&"picking"!==l){i=t[l],r=(e=h[l]).itemSize,n=e.array;for(var p=0;p<c;++p){a=(o=p*r)*u;for(var d=0;d<u;++d){s=a+r*d;for(var f=0;f<r;++f)n[s+f]=i[o+f]}}e.needsUpdate=!0}},e.prototype.makeMapping=function(){for(var t=this.size,e=this.mapping,i=this.mappingSize,r=this.mappingItemSize,n=this.geometry.attributes.mapping.array,o=0;o<t;o++)n.set(e,o*r*i)},e.prototype.makeIndex=function(){for(var t,e,i=this.size,r=this.mappingSize,n=this.mappingIndices,o=this.mappingIndicesSize,a=this.index,s=0;s<i;s++){t=s*o,e=s*r,a.set(n,t);for(var c=0;c<o;++c)a[t+c]+=e}},Object.defineProperties(e.prototype,i),e}(xd),Cd=new Float32Array([-1,1,-1,-1,1,1,1,-1]),Id=new Uint16Array([0,1,2,1,3,2]),Rd=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return i.mapping.get=function(){return Cd},i.mappingIndices.get=function(){return Id},i.mappingIndicesSize.get=function(){return 6},i.mappingType.get=function(){return"v2"},i.mappingSize.get=function(){return 4},i.mappingItemSize.get=function(){return 2},Object.defineProperties(e.prototype,i),e}(Ed),Ld=function(t){function e(e,i){t.call(this,e,i),this.addUniforms({projectionMatrixInverse:{value:new N},ortho:{value:0}}),this.addAttributes({radius:{type:"f",value:null}}),this.setAttributes(e),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isImpostor:{},vertexShader:{},fragmentShader:{}};return i.isImpostor.get=function(){return!0},i.vertexShader.get=function(){return"SphereImpostor.vert"},i.fragmentShader.get=function(){return"SphereImpostor.frag"},Object.defineProperties(e.prototype,i),e}(Rd),Od=function(t,e){return!dc||e&&e.disableImpostor?new Td(t,e):new Ld(t,e)},Nd=new O,Dd=new O,kd=new O,Fd=new O(0,0,0),Bd=function(t){function e(e,i){var r=i||{},n=new Gi(1,Eo(r.sphereDetail,2));t.call(this,e,r,n),this.setAttributes(e,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,i){Dd.fromArray(this._majorAxis,i),kd.fromArray(this._minorAxis,i),t.lookAt(Fd,Dd,kd),Nd.set(this._radius[e],kd.length(),Dd.length()),t.scale(Nd)},e.prototype.setAttributes=function(e,i){e.radius&&(this._radius=e.radius),e.majorAxis&&(this._majorAxis=e.majorAxis),e.minorAxis&&(this._minorAxis=e.minorAxis),t.prototype.setAttributes.call(this,e,i)},i.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,i),e}(Md),zd=function(t,e){return new Bd(t,e)},Ud=new O,jd=new O,Gd=new O,Vd=new O(0,1,0),$d=function(t){function e(e,i){var r=e||{},n=i||{},o=Eo(n.radialSegments,10),a=Eo(n.openEnded,!0),s=(new N).makeRotationX(Math.PI/2),c=new pr(1,1,1,o,1,a);c.applyMatrix(s);var u=r.position1.length,h=r.radius.length,l=c.attributes.position.array.length/3,p=u/3,d=new Float32Array(2*p*l);cu(p,l,0,d),cu(p,l,p*l,d);var f=new Float32Array(2*u),m=new Float32Array(2*u);t.call(this,{position:f,color:m,primitiveId:d,picking:r.picking},n,c),this.__center=new Float32Array(u),this._position=f,this._color=m,this._from=new Float32Array(2*u),this._to=new Float32Array(2*u),this._radius=new Float32Array(2*h),this.setAttributes(r,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,i){jd.fromArray(this._from,i),Gd.fromArray(this._to,i),t.lookAt(jd,Gd,Vd);var r=this._radius[e];Ud.set(r,r,jd.distanceTo(Gd)),t.scale(Ud)},e.prototype.setAttributes=function(e,i){var r={};e.position1&&e.position2&&(nu(e.position1,e.position2,this.__center),nu(e.position1,this.__center,this._position),nu(this.__center,e.position2,this._position,e.position1.length),this._from.set(e.position1),this._from.set(this.__center,e.position1.length),this._to.set(this.__center),this._to.set(e.position2,this.__center.length),r.position=this._position),e.color&&e.color2&&(this._color.set(e.color),this._color.set(e.color2,e.color.length),r.color=this._color),e.radius&&(this._radius.set(e.radius),this._radius.set(e.radius,e.radius.length),r.radius=this._radius),t.prototype.setAttributes.call(this,r,i)},i.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,i),e}(Md);wc.add("shader/CylinderImpostor.vert","\nattribute vec3 mapping;\nattribute vec3 position1;\nattribute vec3 position2;\nattribute float radius;\nvarying vec3 axis;\nvarying vec4 base_radius;\nvarying vec4 end_b;\nvarying vec3 U;\nvarying vec3 V;\nvarying vec4 w;\n#ifdef PICKING\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\nattribute vec3 color2;\nvarying vec3 vColor1;\nvarying vec3 vColor2;\n#endif\nuniform mat4 modelViewMatrixInverse;\nuniform float ortho;\n#include matrix_scale\nvoid main(){\n#ifdef PICKING\nvPickingColor = unpackColor( primitiveId );\n#else\nvColor1 = color;\nvColor2 = color2;\n#endif\nbase_radius.w = radius * matrixScale( modelViewMatrix );\nvec3 center = position;\nvec3 dir = normalize( position2 - position1 );\nfloat ext = length( position2 - position1 ) / 2.0;\nvec3 cam_dir;\nif( ortho == 0.0 ){\ncam_dir = ( modelViewMatrixInverse * vec4( 0, 0, 0, 1 ) ).xyz - center;\n}else{\ncam_dir = ( modelViewMatrixInverse * vec4( 0, 0, 1, 0 ) ).xyz;\n}\ncam_dir = normalize( cam_dir );\nvec3 ldir;\nfloat b = dot( cam_dir, dir );\nend_b.w = b;\nif( b < 0.0 )\nldir = -ext * dir;\nelse\nldir = ext * dir;\nvec3 left = normalize( cross( cam_dir, ldir ) );\nleft = radius * left;\nvec3 up = radius * normalize( cross( left, ldir ) );\naxis = normalize( normalMatrix * ldir );\nU = normalize( normalMatrix * up );\nV = normalize( normalMatrix * left );\nvec4 base4 = modelViewMatrix * vec4( center - ldir, 1.0 );\nbase_radius.xyz = base4.xyz / base4.w;\nvec4 top_position = modelViewMatrix * vec4( center + ldir, 1.0 );\nvec4 end4 = top_position;\nend_b.xyz = end4.xyz / end4.w;\nw = modelViewMatrix * vec4(\ncenter + mapping.x*ldir + mapping.y*left + mapping.z*up, 1.0\n);\ngl_Position = projectionMatrix * w;\ngl_Position.z = 0.99;\n}"),wc.add("shader/CylinderImpostor.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 mat4 projectionMatrix;\nuniform float ortho;\nvarying vec3 axis;\nvarying vec4 base_radius;\nvarying vec4 end_b;\nvarying vec3 U;\nvarying vec3 V;\nvarying vec4 w;\n#ifdef PICKING\nuniform float objectId;\nvarying vec3 vPickingColor;\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 distSq3( vec3 v3a, vec3 v3b ){\nreturn (\n( v3a.x - v3b.x ) * ( v3a.x - v3b.x ) +\n( v3a.y - v3b.y ) * ( v3a.y - v3b.y ) +\n( v3a.z - v3b.z ) * ( v3a.z - v3b.z )\n);\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}\nfloat calcClip( vec3 cameraPos ){\nreturn dot( vec4( cameraPos, 1.0 ), vec4( 0.0, 0.0, 1.0, nearClip - 0.5 ) );\n}\nvoid main(){\nvec3 point = w.xyz / w.w;\nvec3 base = base_radius.xyz;\nfloat vRadius = base_radius.w;\nvec3 end = end_b.xyz;\nfloat b = end_b.w;\nvec3 end_cyl = end;\nvec3 surface_point = point;\nvec3 ray_target = surface_point;\nvec3 ray_origin = vec3(0.0);\nvec3 ray_direction = mix(normalize(ray_origin - ray_target), vec3(0.0, 0.0, 1.0), ortho);\nmat3 basis = mat3( U, V, axis );\nvec3 diff = ray_target - 0.5 * (base + end_cyl);\nvec3 P = diff * basis;\nfloat dz = dot( axis, ray_direction );\nfloat radius2 = vRadius*vRadius;\nvec3 D = vec3(dot(U, ray_direction),\ndot(V, ray_direction),\ndz);\nfloat a0 = P.x*P.x + P.y*P.y - radius2;\nfloat a1 = P.x*D.x + P.y*D.y;\nfloat a2 = D.x*D.x + D.y*D.y;\nfloat d = a1*a1 - a0*a2;\nif (d < 0.0)\ndiscard;\nfloat dist = (-a1 + sqrt(d)) / a2;\nvec3 new_point = ray_target + dist * ray_direction;\nvec3 tmp_point = new_point - base;\nvec3 _normal = normalize( tmp_point - axis * dot(tmp_point, axis) );\nray_origin = mix( ray_origin, surface_point, ortho );\nfloat front_cap_test = dot( tmp_point, axis );\nfloat end_cap_test = dot((new_point - end_cyl), axis);\n#ifndef CAP\nvec3 new_point2 = ray_target + ( (-a1 - sqrt(d)) / a2 ) * ray_direction;\nvec3 tmp_point2 = new_point2 - base;\n#endif\nif (front_cap_test < 0.0)\n{\nfloat dNV = dot(-axis, ray_direction);\nif (dNV < 0.0)\ndiscard;\nfloat near = dot(-axis, (base)) / dNV;\nvec3 front_point = ray_direction * near + ray_origin;\nif (dot(front_point - base, front_point-base) > 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\ngl_FragColor = vec4( vPickingColor, objectId );\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}");var Hd=new Float32Array([-1,1,-1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,1]),Wd=new Uint16Array([0,1,2,1,4,2,2,4,3,4,5,3]),Xd=function(t){function e(e,i){t.call(this,e,i);var r=i||{};this.openEnded=Eo(r.openEnded,!1),this.addUniforms({modelViewMatrixInverse:{value:new N},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(e),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={parameters:{},isImpostor:{},vertexShader:{},fragmentShader:{}};return i.parameters.get=function(){return Object.assign.call(this,{openEnded:{updateShader:!0}},t.prototype.parameters)},e.prototype.getDefines=function(e){var i=t.prototype.getDefines.call(this,e);return this.openEnded||(i.CAP=1),i},i.isImpostor.get=function(){return!0},i.vertexShader.get=function(){return"CylinderImpostor.vert"},i.fragmentShader.get=function(){return"CylinderImpostor.frag"},Object.defineProperties(e.prototype,i),e}(function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return i.mapping.get=function(){return Hd},i.mappingIndices.get=function(){return Wd},i.mappingIndicesSize.get=function(){return 12},i.mappingType.get=function(){return"v3"},i.mappingSize.get=function(){return 6},i.mappingItemSize.get=function(){return 3},Object.defineProperties(e.prototype,i),e}(Ed)),qd=function(t,e){return!dc||e&&e.disableImpostor?new $d(t,e):new Xd(t,e)},Yd=new O,Zd=new O,Kd=new O,Qd=new O(0,1,0),Jd=function(t){function e(e,i){var r=i||{},n=Eo(r.radialSegments,60),o=Eo(r.openEnded,!1),a=(new N).makeRotationX(-Math.PI/2),s=new fr(1,1,n,1,o);s.applyMatrix(a);var c=e.position1.length,u=e.radius.length,h=new Float32Array(c);t.call(this,{position:h,color:e.color,picking:e.picking},r,s),this._position=h,this._from=new Float32Array(c),this._to=new Float32Array(c),this._radius=new Float32Array(u),this.setAttributes(e,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,i){Zd.fromArray(this._from,i),Kd.fromArray(this._to,i),t.lookAt(Zd,Kd,Qd);var r=this._radius[e];Yd.set(r,r,Zd.distanceTo(Kd)),t.scale(Yd)},e.prototype.setAttributes=function(e,i){var r={};e.position1&&e.position2&&(nu(e.position1,e.position2,this._position),this._from.set(e.position1),this._to.set(e.position2),r.position=this._position),e.color&&(r.color=e.color),e.radius&&this._radius.set(e.radius),t.prototype.setAttributes.call(this,r,i)},i.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,i),e}(Md),tf=function(t,e){return new Jd(t,e)},ef=function(t){this.geometryList=t,this.boundingBox=null};ef.prototype.computeBoundingBox=function(){var t=this;this.boundingBox?this.boundingBox.empty():this.boundingBox=new jt,this.geometryList.forEach((function(e){e.boundingBox||e.computeBoundingBox(),t.boundingBox.union(e.boundingBox)}))};var rf=function(t,e){var i=t||{},r=e||{};this.aspectRatio=Eo(r.aspectRatio,1.5),this.wireframe=Eo(r.wireframe,!1),this.splitPosition=new Float32Array(i.position1.length),this.cylinderRadius=new Float32Array(i.radius.length);var n=this.makeAttributes(i),o={radialSegments:Eo(r.radialSegments,50),openEnded:Eo(r.openEnded,!1),disableImpostor:Eo(r.disableImpostor,!1)};this.cylinderBuffer=new qd(n.cylinder,o),this.coneBuffer=new tf(n.cone,o),this.geometry=new ef([this.cylinderBuffer.geometry,this.coneBuffer.geometry]),this.group=new Ci,this.wireframeGroup=new Ci,this.pickingGroup=new Ci,this.matrix=Eo(r.matrix,new N),this.picking=i.picking},nf={matrix:{},pickable:{}};nf.matrix.set=function(t){xd.prototype.setMatrix.call(this,t)},nf.matrix.get=function(){return this.group.matrix.clone()},nf.pickable.get=function(){return!!this.picking},rf.prototype.makeAttributes=function(t){var e,i,r=this.splitPosition,n=this.cylinderRadius,o=this.aspectRatio,a={},s={};if(t.radius){for(e=0,i=n.length;e<i;++e)n[e]=t.radius[e]/o;a.radius=n,s.radius=t.radius}if(t.position1&&t.position2){var c=new O,u=new O,h=new O,l=new O;for(e=0,i=r.length;e<i;e+=3){c.fromArray(t.position1,e),u.fromArray(t.position2,e),h.subVectors(c,u);var p=h.length(),d=n[e/3]*o*2,f=Math.min(p,d);h.setLength(f),l.copy(u).add(h),l.toArray(r,e)}a.position1=t.position1,a.position2=r,s.position1=r,s.position2=t.position2}return t.color&&(a.color=t.color,a.color2=t.color,s.color=t.color),{cylinder:a,cone:s}},rf.prototype.getMesh=function(t){return(new Ci).add(this.cylinderBuffer.getMesh(t),this.coneBuffer.getMesh(t))},rf.prototype.getWireframeMesh=function(){return(new Ci).add(this.cylinderBuffer.getWireframeMesh(),this.coneBuffer.getWireframeMesh())},rf.prototype.getPickingMesh=function(){return(new Ci).add(this.cylinderBuffer.getPickingMesh(),this.coneBuffer.getPickingMesh())},rf.prototype.setAttributes=function(t){var e=this.makeAttributes(t);this.cylinderBuffer.setAttributes(e.cylinder),this.coneBuffer.setAttributes(e.cone)},rf.prototype.setParameters=function(t){(t=Object.assign({},t))&&void 0!==t.matrix&&(this.matrix=t.matrix),delete t.matrix,t&&void 0!==t.wireframe&&(this.wireframe=t.wireframe,this.setVisibility(this.visible)),this.cylinderBuffer.setParameters(t),this.coneBuffer.setParameters(t)},rf.prototype.setVisibility=function(){xd.prototype.setVisibility.apply(this,arguments)},rf.prototype.dispose=function(){this.cylinderBuffer.dispose(),this.coneBuffer.dispose()},Object.defineProperties(rf.prototype,nf),wc.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;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvarying vec3 vViewPosition;\n#endif\nvarying vec2 texCoord;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#endif\nattribute vec2 mapping;\nattribute vec2 inputTexCoord;\nattribute float inputSize;\n#include matrix_scale\n#include common\nvoid main(void){\n#if defined( PICKING )\nvPickingColor = unpackColor( primitiveId );\n#else\n#include color_vertex\n#endif\ntexCoord = inputTexCoord;\nfloat scale = matrixScale( modelViewMatrix );\nfloat _zOffset = zOffset * scale;\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 * scale;\ncameraCornerPos.x += xOffset * scale;\ncameraCornerPos.y += yOffset * scale;\nif( !ortho ){\ncameraCornerPos.xyz += normalize( -cameraCornerPos.xyz ) * _zOffset;\n}\ngl_Position = projectionMatrix * cameraCornerPos;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvViewPosition = -cameraCornerPos.xyz;\n#endif\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n#include radiusclip_vertex\n}"),wc.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#if defined( PICKING )\nuniform float objectId;\nvarying vec3 vPickingColor;\nconst vec3 vColor = vec3( 0.0 );\n#else\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#endif\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#if defined( PICKING )\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}");var of={};var af=function(t){var e=Object.assign({},t);if(this.font=Eo(e.font,["sans-serif"]),this.size=Eo(e.size,36),this.style=Eo(e.style,"normal"),this.variant=Eo(e.variant,"normal"),this.weight=Eo(e.weight,"normal"),this.outline=Eo(e.outline,0),this.width=Eo(e.width,2048),this.height=Eo(e.height,2048),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 Ri(this.canvas2),this.texture.flipY=!1,this.texture.needsUpdate=!0};af.prototype.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 r=i.getContext("2d");r.font=this.style+" "+this.variant+" "+this.weight+" "+this.size+"px "+this.font,r.fillStyle="#FF0000",r.textAlign="left",r.textBaseline="bottom",r.lineJoin="round";for(var n=[],o=3*this.outline,a=0;a<o;++a){var s=("00"+Math.max(0,8*-a+128-8*!a).toString(16)).slice(-2);n.push("#"+s+s+s)}var c=new Uint8Array(e*t*2);this.canvas=i,this.context=r,this.lineHeight=t,this.maxWidth=e,this.colors=n,this.scratch=c,this.data=new Uint8Array(this.width*this.height*4),this.canvas2=document.createElement("canvas"),this.canvas2.width=this.width,this.canvas2.height=this.height,this.context2=this.canvas2.getContext("2d")},af.prototype.map=function(t){return void 0===this.mapped[t]&&(this.draw(t),this.currentX+this.scratchW>this.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]},af.prototype.get=function(t){return this.mapped[t]||this.placeholder},af.prototype.draw=function(t){var e,i,r,n,o,a=this.lineHeight,s=this.outline,c=this.context,u=this.scratch,h=this.maxWidth,l=this.colors,p=s,d=a-this.outline,f=c.measureText(t),m=Math.min(h,Math.ceil(f.width+2*p+1));if(c.clearRect(0,0,m,a),0===this.outline)for(c.fillText(t,p,d),r=3,e=0,i=(o=(n=c.getImageData(0,0,m,a)).data).length/4;e<i;++e)u[e]=o[r],r+=4;else{for(c.globalCompositeOperation="source-over",e=s+1;e>0;--e)r=e>1?2*e-2:e,c.strokeStyle=l[r-1],c.lineWidth=r,c.strokeText(t,p,d);c.globalCompositeOperation="multiply",c.fillStyle="#FF00FF",c.fillText(t,p,d),o=(n=c.getImageData(0,0,m,a)).data,r=0;var g=this.gamma;for(e=0,i=o.length/4;e<i;++e){var v=o[r],y=v?o[r+1]/v:1;.5===g&&(y=Math.sqrt(y));var b=256-v,x=b+(v-b)*(y=Math.min(1,Math.max(0,y)));u[e]=Math.max(0,Math.min(255,x+2)),o[r+3]=u[e],r+=4}}c.putImageData(n,0,0),this.scratchW=m,this.scratchH=a},af.prototype.populate=function(){this.placeholder=this.map(String.fromCharCode(65533));for(var t=0;t<127;++t)this.map(String.fromCharCode(t));for(var e=128;e<255;++e)this.map(String.fromCharCode(e));for(var i=880;i<1023;++i)this.map(String.fromCharCode(i));for(var r=1024;r<1279;++r)this.map(String.fromCharCode(r));this.map(String.fromCharCode(8491))};var sf=function(t){function e(e,i){var r=e||{},n=i||{};n.forceTransparent=!0;for(var o=r.position.length/3,a=0,s=0;s<o;++s)a+=r.text[s].length;var c=a;n.showBackground&&(c+=o),t.call(this,{position:new Float32Array(3*c),color:new Float32Array(3*c),picking:new Qh},n),this.fontFamily=Eo(n.fontFamily,"sans-serif"),this.fontStyle=Eo(n.fontStyle,"normal"),this.fontWeight=Eo(n.fontWeight,"bold"),this.fontSize=Eo(n.fontSize,48),this.sdf=Eo(n.sdf,"Chrome"===hc),this.xOffset=Eo(n.xOffset,0),this.yOffset=Eo(n.yOffset,0),this.zOffset=Eo(n.zOffset,.5),this.attachment=Eo(n.attachment,"bottom-left"),this.showBorder=Eo(n.showBorder,!1),this.borderColor=Eo(n.borderColor,"lightgrey"),this.borderWidth=Eo(n.borderWidth,.15),this.showBackground=Eo(n.showBackground,!1),this.backgroundColor=Eo(n.backgroundColor,"lightgrey"),this.backgroundMargin=Eo(n.backgroundMargin,.5),this.backgroundOpacity=Eo(n.backgroundOpacity,1),this.text=r.text,this.positionCount=o,this.addUniforms({fontTexture:{value:null},xOffset:{value:this.xOffset},yOffset:{value:this.yOffset},zOffset:{value:this.zOffset},ortho:{value:!1},showBorder:{value:this.showBorder},borderColor:{value:new St(this.borderColor)},borderWidth:{value:this.borderWidth},backgroundColor:{value:new St(this.backgroundColor)},backgroundOpacity:{value:this.backgroundOpacity}}),this.addAttributes({inputTexCoord:{type:"v2",value:null},inputSize:{type:"f",value:null}}),this.setAttributes(e),this.makeTexture(),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={parameters:{},wireframe:{},isText:{},vertexShader:{},fragmentShader:{}};return i.parameters.get=function(){return Object.assign.call(this,{fontFamily:{uniform:!0},fontStyle:{uniform:!0},fontWeight:{uniform:!0},fontSize:{uniform:!0},sdf:{updateShader:!0,uniform:!0},xOffset:{uniform:!0},yOffset:{uniform:!0},zOffset:{uniform:!0},showBorder:{uniform:!0},borderColor:{uniform:!0},borderWidth:{uniform:!0},backgroundColor:{uniform:!0},backgroundOpacity:{uniform:!0}},t.prototype.parameters,{flatShaded:void 0})},e.prototype.makeMaterial=function(){t.prototype.makeMaterial.call(this);var e=this.texture,i=this.material;i.extensions.derivatives=!0,i.lights=!1,i.uniforms.fontTexture.value=e,i.needsUpdate=!0;var r=this.wireframeMaterial;r.extensions.derivatives=!0,r.lights=!1,r.uniforms.fontTexture.value=e,r.needsUpdate=!0;var n=this.pickingMaterial;n.extensions.derivatives=!0,n.lights=!1,n.uniforms.fontTexture.value=e,n.needsUpdate=!0},e.prototype.setAttributes=function(t){var e,i,r,n,o,a,s=this.text,c=this.geometry.attributes;t.position&&(e=t.position,n=c.position.array,c.position.needsUpdate=!0),t.size&&(i=t.size,o=c.inputSize.array,c.inputSize.needsUpdate=!0),t.color&&(r=t.color,a=c.color.array,c.color.needsUpdate=!0);for(var u,h,l,p,d=this.positionCount,f=0,m=0;m<d;++m)for(h=3*m,p=s[m].length,this.showBackground&&(p+=1),l=0;l<p;++l,++f)for(var g=0;g<4;g++)u=4*f*3+3*g,e&&(n[u]=e[h],n[u+1]=e[h+1],n[u+2]=e[h+2]),i&&(o[4*f+g]=i[m]),r&&(a[u]=r[h],a[u+1]=r[h+1],a[u+2]=r[h+2])},e.prototype.makeTexture=function(){var t,e;this.textAtlas=(t={font:[this.fontFamily],style:this.fontStyle,weight:this.fontWeight,size:this.fontSize,outline:this.sdf?5:0},e=JSON.stringify(t),void 0===of[e]&&(of[e]=new af(t)),of[e]),this.texture=this.textAtlas.texture},e.prototype.makeMapping=function(){for(var t,e,i,r,n,o,a,s,c=this.textAtlas,u=this.text,h=this.attachment,l=c.lineHeight*this.backgroundMargin*.1-10,p=this.geometry.attributes.inputTexCoord.array,d=this.geometry.attributes.mapping.array,f=this.positionCount,m=0,g=0;g<f;++g){for(r=0,o=(i=u[g]).length,n=0;n<o;++n)r+=(t=c.get(i[n])).w-2*c.outline;for(s=h.startsWith("top")?c.lineHeight/1.25:h.startsWith("middle")?c.lineHeight/2.5:0,a=h.endsWith("right")?r:h.endsWith("center")?r/2:0,a+=c.outline,s+=c.outline,this.showBackground&&(d[(e=2*m*4)+0]=-c.lineHeight/6-a-l,d[e+1]=c.lineHeight-s+l,d[e+2]=-c.lineHeight/6-a-l,d[e+3]=0-s-l,d[e+4]=r+c.lineHeight/6-a+2*c.outline+l,d[e+5]=c.lineHeight-s+l,d[e+6]=r+c.lineHeight/6-a+2*c.outline+l,d[e+7]=0-s-l,p[e+0]=10,p[e+2]=10,p[e+4]=10,p[e+6]=10,m+=1),r=0,n=0;n<o;++n,++m){t=c.get(i[n]),d[(e=2*m*4)+0]=r-a,d[e+1]=t.h-s,d[e+2]=r-a,d[e+3]=0-s,d[e+4]=r+t.w-a,d[e+5]=t.h-s,d[e+6]=r+t.w-a,d[e+7]=0-s;var v=c.width,y=c.height,b=[t.x/v,t.y/y,t.x/v,(t.y+t.h)/y,(t.x+t.w)/v,t.y/y,(t.x+t.w)/v,(t.y+t.h)/y];p.set(b,e),r+=t.w-2*c.outline}}this.geometry.attributes.inputTexCoord.needsUpdate=!0,this.geometry.attributes.mapping.needsUpdate=!0},e.prototype.getDefines=function(e){var i=t.prototype.getDefines.call(this,e);return this.sdf&&(i.SDF=1),i},e.prototype.setUniforms=function(e){!e||void 0===e.fontFamily&&void 0===e.fontStyle&&void 0===e.fontWeight&&void 0===e.fontSize&&void 0===e.sdf||(this.makeTexture(),this.makeMapping(),this.texture.needsUpdate=!0,e.fontTexture=this.texture),t.prototype.setUniforms.call(this,e)},i.wireframe.set=function(t){},i.wireframe.get=function(){return!1},i.isText.get=function(){return!0},i.vertexShader.get=function(){return"SDFFont.vert"},i.fragmentShader.get=function(){return"SDFFont.frag"},Object.defineProperties(e.prototype,i),e}(Rd);function cf(t,e){void 0!==t.toArray?t=t.toArray():void 0!==t.x?t=[t.x,t.y,t.z]:void 0!==t.r&&(t=[t.r,t.g,t.b]),e.push.apply(e,t)}var uf=new O,hf=new jt,lf=function(t,e){this.name=Eo(t,"shape");var i=e||{};this.aspectRatio=Eo(i.aspectRatio,1.5),this.sphereDetail=Eo(i.sphereDetail,2),this.radialSegments=Eo(i.radialSegments,50),this.disableImpostor=Eo(i.disableImpostor,!1),this.openEnded=Eo(i.openEnded,!1),this.labelParams=Eo(i.labelParams,{}),this.boundingBox=new jt,this.bufferList=[],this.meshCount=0,this.spherePosition=[],this.sphereColor=[],this.sphereRadius=[],this.sphereName=[],this.ellipsoidPosition=[],this.ellipsoidColor=[],this.ellipsoidRadius=[],this.ellipsoidMajorAxis=[],this.ellipsoidMinorAxis=[],this.ellipsoidName=[],this.cylinderPosition1=[],this.cylinderPosition2=[],this.cylinderColor=[],this.cylinderRadius=[],this.cylinderName=[],this.conePosition1=[],this.conePosition2=[],this.coneColor=[],this.coneRadius=[],this.coneName=[],this.arrowPosition1=[],this.arrowPosition2=[],this.arrowColor=[],this.arrowRadius=[],this.arrowName=[],this.labelPosition=[],this.labelColor=[],this.labelSize=[],this.labelText=[]},pf={center:{},type:{}};lf.prototype.addBuffer=function(t){this.bufferList.push(t);var e=t.geometry;return e.boundingBox||e.computeBoundingBox(),this.boundingBox.union(e.boundingBox),this},lf.prototype.addMesh=function(t,e,i,r,n){t=$o(t),e=$o(e),Array.isArray(i)&&(i=zo(i,t.length)),r&&(r=$o(r));var o={position:t,color:e,index:i,normal:r},a=new Jh(this,Object.assign({serial:this.meshCount,name:n},o)),s=new wd(Object.assign({picking:a},o));return this.bufferList.push(s),hf.setFromArray(t),this.boundingBox.union(hf),this.meshCount+=1,this},lf.prototype.addSphere=function(t,e,i,r){return cf(t,this.spherePosition),cf(e,this.sphereColor),this.sphereRadius.push(i),this.sphereName.push(r),this.boundingBox.expandByPoint(uf.fromArray(t)),this},lf.prototype.addEllipsoid=function(t,e,i,r,n,o){return cf(t,this.ellipsoidPosition),cf(e,this.ellipsoidColor),this.ellipsoidRadius.push(i),cf(r,this.ellipsoidMajorAxis),cf(n,this.ellipsoidMinorAxis),this.ellipsoidName.push(o),this.boundingBox.expandByPoint(uf.fromArray(t)),this},lf.prototype.addCylinder=function(t,e,i,r,n){return cf(t,this.cylinderPosition1),cf(e,this.cylinderPosition2),cf(i,this.cylinderColor),this.cylinderRadius.push(r),this.cylinderName.push(n),this.boundingBox.expandByPoint(uf.fromArray(t)),this.boundingBox.expandByPoint(uf.fromArray(e)),this},lf.prototype.addCone=function(t,e,i,r,n){return cf(t,this.conePosition1),cf(e,this.conePosition2),cf(i,this.coneColor),this.coneRadius.push(r),this.coneName.push(n),this.boundingBox.expandByPoint(uf.fromArray(t)),this.boundingBox.expandByPoint(uf.fromArray(e)),this},lf.prototype.addArrow=function(t,e,i,r,n){return cf(t,this.arrowPosition1),cf(e,this.arrowPosition2),cf(i,this.arrowColor),this.arrowRadius.push(r),this.arrowName.push(n),this.boundingBox.expandByPoint(uf.fromArray(t)),this.boundingBox.expandByPoint(uf.fromArray(e)),this},lf.prototype.addLabel=function(t,e,i,r){return cf(t,this.labelPosition),cf(e,this.labelColor),this.labelSize.push(i),this.labelText.push(r),this.boundingBox.expandByPoint(uf.fromArray(t)),this},lf.prototype.getBufferList=function(){var t=[];if(this.spherePosition.length){var e=new Od({position:new Float32Array(this.spherePosition),color:new Float32Array(this.sphereColor),radius:new Float32Array(this.sphereRadius),picking:new tl(this)},{sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor});t.push(e)}if(this.ellipsoidPosition.length){var i=new zd({position:new Float32Array(this.ellipsoidPosition),color:new Float32Array(this.ellipsoidColor),radius:new Float32Array(this.ellipsoidRadius),majorAxis:new Float32Array(this.ellipsoidMajorAxis),minorAxis:new Float32Array(this.ellipsoidMinorAxis),picking:new Kh(this)},{sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor});t.push(i)}if(this.cylinderPosition1.length){var r=new qd({position1:new Float32Array(this.cylinderPosition1),position2:new Float32Array(this.cylinderPosition2),color:new Float32Array(this.cylinderColor),color2:new Float32Array(this.cylinderColor),radius:new Float32Array(this.cylinderRadius),picking:new Gh(this)},{radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,openEnded:this.openEnded});t.push(r)}if(this.conePosition1.length){var n=new tf({position1:new Float32Array(this.conePosition1),position2:new Float32Array(this.conePosition2),color:new Float32Array(this.coneColor),radius:new Float32Array(this.coneRadius),picking:new qh(this)},{radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,openEnded:this.openEnded});t.push(n)}if(this.arrowPosition1.length){var o=new rf({position1:new Float32Array(this.arrowPosition1),position2:new Float32Array(this.arrowPosition2),color:new Float32Array(this.arrowColor),radius:new Float32Array(this.arrowRadius),picking:new Vh(this)},{aspectRatio:this.aspectRatio,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,openEnded:this.openEnded});t.push(o)}if(this.labelPosition.length){var a=new sf({position:new Float32Array(this.labelPosition),color:new Float32Array(this.labelColor),size:new Float32Array(this.labelSize),text:this.labelText},this.labelParams);t.push(a)}return this.bufferList.concat(t)},lf.prototype.dispose=function(){this.bufferList.forEach((function(t){t.dispose()})),this.bufferList.length=0,this.spherePosition.length=0,this.sphereColor.length=0,this.sphereRadius.length=0,this.sphereName.length=0,this.ellipsoidPosition.length=0,this.ellipsoidColor.length=0,this.ellipsoidRadius.length=0,this.ellipsoidMajorAxis.length=0,this.ellipsoidMinorAxis.length=0,this.ellipsoidName.length=0,this.cylinderPosition1.length=0,this.cylinderPosition2.length=0,this.cylinderColor.length=0,this.cylinderRadius.length=0,this.cylinderName.length=0,this.conePosition1.length=0,this.conePosition2.length=0,this.coneColor.length=0,this.coneRadius.length=0,this.coneName.length=0,this.arrowPosition1.length=0,this.arrowPosition2.length=0,this.arrowColor.length=0,this.arrowRadius.length=0,this.arrowName.length=0,this.labelPosition.length=0,this.labelColor.length=0,this.labelSize.length=0,this.labelText.length=0},pf.center.get=function(){return this._center||(this._center=this.boundingBox.getCenter()),this._center},pf.type.get=function(){return"Shape"},Object.defineProperties(lf.prototype,pf);var df=function(t,e,i){this.type="",this.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},depthWrite:{type:"boolean",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:{}},colorScale:{type:"select",update:"color",options:yc.getScales()},colorReverse:{type:"boolean",update:"color"},colorValue:{type:"color",update:"color"},colorDomain:{type:"hidden",update:"color"},colorMode:{type:"select",update:"color",options:yc.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},matrix:{type:"hidden",buffer:!0},disablePicking:{type:"boolean",rebuild:!0}},this.viewer=e,this.tasks=new $c,this.queue=new dd(this.make.bind(this)),this.bufferList=[],this.parameters.colorScheme&&(this.parameters.colorScheme.options=yc.getSchemes())};df.prototype.init=function(t){var e=t||{};this.clipNear=Eo(e.clipNear,0),this.clipRadius=Eo(e.clipRadius,0),this.clipCenter=Eo(e.clipCenter,new O),this.flatShaded=Eo(e.flatShaded,!1),this.side=Eo(e.side,"double"),this.opacity=Eo(e.opacity,1),this.depthWrite=Eo(e.depthWrite,!0),this.wireframe=Eo(e.wireframe,!1),this.linewidth=Eo(e.linewidth,2),this.setColor(e.color,e),this.colorScheme=Eo(e.colorScheme,"uniform"),this.colorScale=Eo(e.colorScale,""),this.colorReverse=Eo(e.colorReverse,!1),this.colorValue=Eo(e.colorValue,9474192),this.colorDomain=Eo(e.colorDomain,void 0),this.colorMode=Eo(e.colorMode,"hcl"),this.visible=Eo(e.visible,!0),this.quality=Eo(e.quality,void 0),this.roughness=Eo(e.roughness,.4),this.metalness=Eo(e.metalness,0),this.diffuse=Eo(e.diffuse,16777215),this.lazy=Eo(e.lazy,!1),this.lazyProps={build:!1,bufferParams:{},what:{}},this.matrix=Eo(e.matrix,new N),this.disablePicking=Eo(e.disablePicking,!1);var i=this.parameters;!0===i.sphereDetail&&(i.sphereDetail={type:"integer",max:3,min:0,rebuild:"impostor"}),!0===i.radialSegments&&(i.radialSegments={type:"integer",max:25,min:5,rebuild:"impostor"}),!0===i.openEnded&&(i.openEnded={type:"boolean",rebuild:"impostor",buffer:!0}),!0===i.disableImpostor&&(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=Eo(e.sphereDetail,1)),i.radialSegments&&(this.radialSegments=Eo(e.radialSegments,10))),i.openEnded&&(this.openEnded=Eo(e.openEnded,!0)),i.disableImpostor&&(this.disableImpostor=Eo(e.disableImpostor,!1))},df.prototype.getColorParams=function(t){return Object.assign({scheme:this.colorScheme,scale:this.colorScale,reverse:this.colorReverse,value:this.colorValue,domain:this.colorDomain,mode:this.colorMode},t)},df.prototype.getBufferParams=function(t){return Object.assign({clipNear:this.clipNear,clipRadius:this.clipRadius,clipCenter:this.clipCenter,flatShaded:this.flatShaded,opacity:this.opacity,depthWrite:this.depthWrite,side:this.side,wireframe:this.wireframe,linewidth:this.linewidth,roughness:this.roughness,metalness:this.metalness,diffuse:this.diffuse,matrix:this.matrix,disablePicking:this.disablePicking},t)},df.prototype.setColor=function(t,e){return Object.keys(yc.getSchemes()).includes(t)?e?e.colorScheme=t:this.setParameters({colorScheme:t}):void 0!==t&&(t=new St(t).getHex(),e?(e.colorScheme="uniform",e.colorValue=t):this.setParameters({colorScheme:"uniform",colorValue:t})),this},df.prototype.create=function(){},df.prototype.update=function(){this.build()},df.prototype.build=function(t){if(!this.lazy||this.visible){if(!this.prepare)return this.tasks.increment(),void this.make();this.queue.length()>0?(this.tasks.change(1-this.queue.length()),this.queue.kill()):this.tasks.increment(),this.queue.push(t||!1)}else this.lazyProps.build=!0},df.prototype.make=function(t,e){gc&&mc.time("Representation.make "+this.type);var i=function(){t?(this.update(t),this.viewer.requestRender(),this.tasks.decrement(),e&&e()):(this.clear(),this.create(),this.manualAttach||this.disposed||(gc&&mc.time("Representation.attach "+this.type),this.attach(function(){gc&&mc.timeEnd("Representation.attach "+this.type),this.tasks.decrement(),e&&e()}.bind(this)))),gc&&mc.timeEnd("Representation.make "+this.type)}.bind(this);this.prepare?this.prepare(i):i()},df.prototype.attach=function(t){this.setVisibility(this.visible),t()},df.prototype.setVisibility=function(t,e){if(this.visible=t,this.visible){var i=this.lazyProps,r=i.bufferParams,n=i.what;if(i.build)return i.build=!1,void this.build();(Object.keys(r).length||Object.keys(n).length)&&(i.bufferParams={},i.what={},this.updateParameters(r,n))}return this.bufferList.forEach((function(e){e.setVisibility(t)})),e||this.viewer.requestRender(),this},df.prototype.setParameters=function(t,e,i){var r=t||{},n=this.parameters;e=e||{},i=i||!1;var o={};for(var a in r)void 0!==r[a]&&void 0!==n[a]&&(n[a].int&&(r[a]=parseInt(r[a])),n[a].float&&(r[a]=parseFloat(r[a])),(r[a]!==this[a]||r[a].equals&&!r[a].equals(this[a]))&&(this[a].set?this[a].set(r[a]):this[a]=r[a],n[a].buffer&&(!0===n[a].buffer?o[a]=r[a]:o[n[a].buffer]=r[a]),n[a].update&&(e[n[a].update]=!0),!n[a].rebuild||"impostor"===n[a].rebuild&&dc&&!this.disableImpostor||(i=!0)));return i?this.build():this.updateParameters(o,e),this},df.prototype.updateParameters=function(t,e){if(this.lazy&&!this.visible)return 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),this.viewer.requestRender()},df.prototype.getParameters=function(){var t=this,e={lazy:this.lazy,visible:this.visible,quality:this.quality};return Object.keys(this.parameters).forEach((function(i){null!==t.parameters[i]&&(e[i]=t[i])})),e},df.prototype.clear=function(){var t=this;this.bufferList.forEach((function(e){t.viewer.remove(e),e.dispose()})),this.bufferList.length=0,this.viewer.requestRender()},df.prototype.dispose=function(){this.disposed=!0,this.queue.kill(),this.tasks.dispose(),this.clear()};var ff=function(t){function e(e,i,r){Array.isArray(e)||(e=[e]),t.call(this,e,i,r),this.type="buffer",this.parameters=Object.assign({},this.parameters,{colorScheme:null,colorScale:null,colorValue:null,colorDomain:null,colorMode:null}),this.buffer=e,this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){t.prototype.init.call(this,e),this.build()},e.prototype.create=function(){this.bufferList.push.apply(this.bufferList,this.buffer)},e.prototype.attach=function(t){var e=this;this.bufferList.forEach((function(t){e.viewer.add(t),t.setParameters(e.getBufferParams())})),this.setVisibility(this.visible),t()},e}(df),mf=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isSurface:{}};return i.isSurface.get=function(){return!0},Object.defineProperties(e.prototype,i),e}(wd);function gf(t){t.visible=!0}function vf(t){t.visible=!1}var yf=function(t){this.size=t.size,this.side=t.side,this.wireframe=t.wireframe,this.visible=t.visible,this.geometry=t.geometry,this.picking=t.picking,this.background=t.background,this.disablePicking=t.disablePicking,this.group=new Ci,this.wireframeGroup=new Ci,this.pickingGroup=new Ci,this.matrix=t.matrix,this.frontMeshes=[],this.backMeshes=[];var e=t,i=new t.constructor;e.makeMaterial(),i.makeMaterial(),i.picking=t.picking,i.geometry=t.geometry,i.wireframeGeometry=t.wireframeGeometry,i.setParameters(t.getParameters()),i.updateShader(),e.setParameters({side:"front"}),i.setParameters({side:"back",opacity:i.opacity}),this.buffer=t,this.frontBuffer=e,this.backBuffer=i},bf={matrix:{},pickable:{}};bf.matrix.set=function(t){xd.prototype.setMatrix.call(this,t)},bf.matrix.get=function(){return this.group.matrix.clone()},bf.pickable.get=function(){return!!this.picking&&!this.disablePicking},yf.prototype.getMesh=function(t){var e,i;return t?(i=this.backBuffer.getPickingMesh(),e=this.frontBuffer.getPickingMesh()):(i=this.backBuffer.getMesh(),e=this.frontBuffer.getMesh()),this.frontMeshes.push(e),this.backMeshes.push(i),this.setParameters({side:this.side}),(new Ci).add(i,e)},yf.prototype.getWireframeMesh=function(){return this.buffer.getWireframeMesh()},yf.prototype.getPickingMesh=function(){return this.getMesh(!0)},yf.prototype.setAttributes=function(t){this.buffer.setAttributes(t)},yf.prototype.setParameters=function(t){"front"===(t=Object.assign({},t)).side?(this.frontMeshes.forEach(gf),this.backMeshes.forEach(vf)):"back"===t.side?(this.frontMeshes.forEach(vf),this.backMeshes.forEach(gf)):"double"===t.side&&(this.frontMeshes.forEach(gf),this.backMeshes.forEach(gf)),void 0!==t.matrix&&(this.matrix=t.matrix),delete t.matrix,void 0!==t.side&&(this.side=t.side),delete t.side,this.frontBuffer.setParameters(t),void 0!==t.wireframe&&(this.wireframe=t.wireframe,this.setVisibility(this.visible)),delete t.wireframe,this.backBuffer.setParameters(t)},yf.prototype.dispose=function(){this.frontBuffer.dispose(),this.backBuffer.dispose()},Object.defineProperties(yf.prototype,bf),yf.prototype.setVisibility=xd.prototype.setVisibility,wc.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}"),wc.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}");var xf=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isLine:{},vertexShader:{},fragmentShader:{}};return i.isLine.get=function(){return!0},i.vertexShader.get=function(){return"Line.vert"},i.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,i),e}(xd),_f=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="surface",this.parameters=Object.assign({isolevelType:{type:"select",options:{value:"value",sigma:"sigma"}},isolevel:{type:"number",precision:2,max:1e3,min:-1e3},negateIsolevel:{type:"boolean"},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},colorVolume:{type:"hidden"},contour:{type:"boolean",rebuild:!0},useWorker:{type:"boolean",rebuild:!0},wrap:{type:"boolean",rebuild:!0}},this.parameters),e instanceof lp?(this.surface=void 0,this.volume=e):(this.surface=e,this.volume=void 0),this.boxCenter=new O,this.__boxCenter=new O,this.box=new jt,this.__box=new jt,this._position=new O,this.setBox=function(){this._position.copy(i.translationGroup.position).negate(),this._position.equals(this.boxCenter)||this.setParameters({boxCenter:this._position})},this.viewer.signals.ticked.add(this.setBox,this),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"uniform"),i.colorValue=Eo(i.colorValue,14540253),this.isolevelType=Eo(i.isolevelType,"sigma"),this.isolevel=Eo(i.isolevel,2),this.negateIsolevel=Eo(i.negateIsolevel,!1),this.smooth=Eo(i.smooth,0),this.background=Eo(i.background,!1),this.opaqueBack=Eo(i.opaqueBack,!0),this.boxSize=Eo(i.boxSize,0),this.colorVolume=Eo(i.colorVolume,void 0),this.contour=Eo(i.contour,!1),this.useWorker=Eo(i.useWorker,!0),this.wrap=Eo(i.wrap,!1),t.prototype.init.call(this,i),this.build()},e.prototype.attach=function(t){var e=this;this.bufferList.forEach((function(t){e.viewer.add(t)})),this.setVisibility(this.visible),t()},e.prototype.prepare=function(t){var e,i=this;if(this.volume)if(e="sigma"===this.isolevelType?this.volume.getValueForSigma(this.isolevel):this.isolevel,this.negateIsolevel&&(e*=-1),!this.surface||this.__isolevel!==e||this.__smooth!==this.smooth||this.__contour!==this.contour||this.__wrap!==this.wrap||this.__boxSize!==this.boxSize||this.boxSize>0&&!this.__boxCenter.equals(this.boxCenter)){this.__isolevel=e,this.__smooth=this.smooth,this.__contour=this.contour,this.__wrap=this.wrap,this.__boxSize=this.boxSize,this.__boxCenter.copy(this.boxCenter),this.__box.copy(this.box);var r=function(e){i.surface=e,t()};this.useWorker?this.volume.getSurfaceWorker(e,this.smooth,this.boxCenter,this.boxSize,this.contour,this.wrap,r):r(this.volume.getSurface(e,this.smooth,this.boxCenter,this.boxSize,this.contour,this.wrap))}else t();else t()},e.prototype.create=function(){var t,e={position:this.surface.getPosition(),color:this.surface.getColor(this.getColorParams()),index:this.surface.getIndex()};if(this.contour)t=new xf(e,this.getBufferParams({wireframe:!1}));else{e.normal=this.surface.getNormal(),e.picking=this.surface.getPicking();var i=new mf(e,this.getBufferParams({background:this.background,opaqueBack:this.opaqueBack,dullInterior:!1}));t=new yf(i)}this.bufferList.push(t)},e.prototype.update=function(t){if(0!==this.bufferList.length){var e={};(t=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)}))}},e.prototype.setParameters=function(e,i,r){return e&&void 0!==e.isolevelType&&this.volume&&("value"===this.isolevelType&&"sigma"===e.isolevelType?this.isolevel=this.volume.getSigmaForValue(this.isolevel):"sigma"===this.isolevelType&&"value"===e.isolevelType&&(this.isolevel=this.volume.getValueForSigma(this.isolevel)),this.isolevelType=e.isolevelType),e&&e.boxCenter&&(this.boxCenter.copy(e.boxCenter),delete e.boxCenter),e&&e.wireframe&&(e.contour||void 0===e.contour&&this.contour)&&(e.wireframe=!1),t.prototype.setParameters.call(this,e,i,r),this.volume&&this.volume.getBox(this.boxCenter,this.boxSize,this.box),e&&void 0!==e.colorVolume&&(i.color=!0),this.surface&&(void 0!==e.isolevel||void 0!==e.negateIsolevel||void 0!==e.smooth||void 0!==e.wrap||void 0!==e.boxSize||this.boxSize>0&&!this.__box.equals(this.box))&&this.build({position:!0,color:!0,index:!0,normal:!this.contour}),this},e.prototype.getColorParams=function(){var e=t.prototype.getColorParams.call(this);return e.volume=this.colorVolume,e},e.prototype.dispose=function(){this.viewer.signals.ticked.remove(this.setBox,this),t.prototype.dispose.call(this)},e}(df);wc.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#if defined( PICKING )\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#endif\n#include common\nvoid main(){\n#if defined( PICKING )\nvPickingColor = unpackColor( primitiveId );\n#else\n#include color_vertex\n#endif\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}"),wc.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#if defined( PICKING )\nuniform float objectId;\nvarying vec3 vPickingColor;\n#else\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#endif\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\n#if defined( PICKING )\n#ifdef USE_MAP\nif( texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) ).a < 0.5 )\ndiscard;\n#endif\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\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#endif\n}");var wf=function(t){function e(e,i){var r=e||{},n=i||{};r.primitiveId||(r.primitiveId=su(r.position.length/3)),t.call(this,r,n),this.pointSize=Eo(n.pointSize,1),this.sizeAttenuation=Eo(n.sizeAttenuation,!0),this.sortParticles=Eo(n.sortParticles,!1),this.alphaTest=Eo(n.alphaTest,.5),this.useTexture=Eo(n.useTexture,!1),this.forceTransparent=Eo(n.forceTransparent,!1),this.edgeBleach=Eo(n.edgeBleach,0),this.addUniforms({size:{value:this.pointSize},canvasHeight:{value:1},pixelRatio:{value:1},map:{value:null}})}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={parameters:{},isPoint:{},vertexShader:{},fragmentShader:{}};return i.parameters.get=function(){return Object.assign.call(this,{pointSize:{uniform:"size"},sizeAttenuation:{updateShader:!0},sortParticles:{},alphaTest:{updateShader:!0},useTexture:{updateShader:!0},forceTransparent:{},edgeBleach:{uniform:!0}},t.prototype.parameters)},e.prototype.makeMaterial=function(){t.prototype.makeMaterial.call(this),this.makeTexture();var e=this.material,i=this.wireframeMaterial,r=this.pickingMaterial;e.uniforms.map.value=this.tex,e.needsUpdate=!0,i.uniforms.map.value=this.tex,i.needsUpdate=!0,r.uniforms.map.value=this.tex,r.needsUpdate=!0},e.prototype.makeTexture=function(){this.tex&&this.tex.dispose(),this.tex=function(t){for(var e,i,r=t||{},n=Eo(r.width,256),o=Eo(r.height,256),a=[n/2,o/2],s=Math.min(n/2,o/2),c=Eo(r.delta,1/(s+1))*s,u=0,h=0,l=new Uint8Array(n*o*4),p=0,d=l.length;p<d;p+=4){var f=1-Rs(s-c,s,(e=void 0,i=void 0,e=a[0]-u,i=a[1]-h,Math.sqrt(e*e+i*i)));l[p]=255*f,l[p+1]=255*f,l[p+2]=255*f,l[p+3]=255*f,++u===n&&(u=0,h++)}var m=new D(l,n,o);return m.needsUpdate=!0,m}({delta:this.edgeBleach})},e.prototype.getDefines=function(e){var i=t.prototype.getDefines.call(this,e);return this.sizeAttenuation&&(i.USE_SIZEATTENUATION=1),this.useTexture&&(i.USE_MAP=1),this.alphaTest>0&&this.alphaTest<=1&&(i.ALPHATEST=this.alphaTest.toPrecision(2)),i},e.prototype.setUniforms=function(e){e&&void 0!==e.edgeBleach&&(this.makeTexture(),e.map=this.tex),t.prototype.setUniforms.call(this,e)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.tex&&this.tex.dispose()},i.isPoint.get=function(){return!0},i.vertexShader.get=function(){return"Point.vert"},i.fragmentShader.get=function(){return"Point.frag"},Object.defineProperties(e.prototype,i),e}(xd),Sf=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="dot",this.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}},this.parameters,{colorScheme:{type:"select",update:"color",options:{"":"",value:"value",uniform:"uniform",random:"random"}}}),e instanceof lp?(this.surface=void 0,this.volume=new dp(e)):(this.surface=e,this.volume=void 0),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"uniform"),i.colorValue=Eo(i.colorValue,14540253),this.thresholdType=Eo(i.thresholdType,"sigma"),this.thresholdMin=Eo(i.thresholdMin,2),this.thresholdMax=Eo(i.thresholdMax,1/0),this.thresholdOut=Eo(i.thresholdOut,!1),this.dotType=Eo(i.dotType,"point"),this.radius=Eo(i.radius,.1),this.scale=Eo(i.scale,1),this.pointSize=Eo(i.pointSize,1),this.sizeAttenuation=Eo(i.sizeAttenuation,!0),this.sortParticles=Eo(i.sortParticles,!1),this.useTexture=Eo(i.useTexture,!1),this.alphaTest=Eo(i.alphaTest,.5),this.forceTransparent=Eo(i.forceTransparent,!1),this.edgeBleach=Eo(i.edgeBleach,0),t.prototype.init.call(this,i),this.build()},e.prototype.attach=function(t){var e=this;this.bufferList.forEach((function(t){e.viewer.add(t)})),this.setVisibility(this.visible),t()},e.prototype.create=function(){var t={};if(this.volume){var e,i,r=this.volume;"sigma"===this.thresholdType?(e=r.getValueForSigma(this.thresholdMin),i=r.getValueForSigma(this.thresholdMax)):(e=this.thresholdMin,i=this.thresholdMax),r.setFilter(e,i,this.thresholdOut),t.position=r.getDataPosition(),t.color=r.getDataColor(this.getColorParams()),"sphere"===this.dotType&&(t.radius=r.getDataSize(this.radius,this.scale),t.picking=r.getDataPicking())}else{var n=this.surface;t.position=n.getPosition(),t.color=n.getColor(this.getColorParams()),"sphere"===this.dotType&&(t.radius=n.getSize(this.radius,this.scale),t.picking=n.getPicking())}"sphere"===this.dotType?this.dotBuffer=new Od(t,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!1})):this.dotBuffer=new wf(t,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)},e.prototype.update=function(t){if(0!==this.bufferList.length){var e={};(t=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)}},e.prototype.setParameters=function(e,i,r){return i=i||{},e&&void 0!==e.thresholdType&&this.volume instanceof lp&&("value"===this.thresholdType&&"sigma"===e.thresholdType?(this.thresholdMin=this.volume.getSigmaForValue(this.thresholdMin),this.thresholdMax=this.volume.getSigmaForValue(this.thresholdMax)):"sigma"===this.thresholdType&&"value"===e.thresholdType&&(this.thresholdMin=this.volume.getValueForSigma(this.thresholdMin),this.thresholdMax=this.volume.getValueForSigma(this.thresholdMax)),this.thresholdType=e.thresholdType),e&&void 0!==e.radiusType&&("radius"===e.radiusType?this.radius=.1:this.radius=e.radiusType,i.radius=!0,"sphere"!==this.dotType||dc&&!this.disableImpostor||(r=!0)),e&&void 0!==e.radius&&(i.radius=!0,"sphere"!==this.dotType||dc&&!this.disableImpostor||(r=!0)),e&&void 0!==e.scale&&(i.scale=!0,"sphere"!==this.dotType||dc&&!this.disableImpostor||(r=!0)),t.prototype.setParameters.call(this,e,i,r),this},e}(df);wc.add("shader/Image.vert","uniform float clipRadius;\nuniform vec3 clipCenter;\nvarying vec2 vUv;\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\nvoid main() {\n#include begin_vertex\n#include project_vertex\nvUv = uv;\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}"),wc.add("shader/Image.frag","uniform sampler2D map;\nuniform float opacity;\nuniform vec2 mapSize;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec2 vUv;\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\n#if defined( PICKING )\nuniform sampler2D pickingMap;\nuniform float objectId;\n#else\n#include fog_pars_fragment\n#endif\n#if defined( CUBIC_INTERPOLATION )\n#if defined( CATMULROM_FILTER ) || defined( MITCHELL_FILTER )\n#if defined( CATMULROM_FILTER )\nconst float B = 0.0;\nconst float C = 0.5;\n#elif defined( MITCHELL_FILTER )\nconst float B = 0.333;\nconst float C = 0.333;\n#endif\nfloat filter( float x ){\nfloat f = x;\nif( f < 0.0 ){\nf = -f;\n}\nif( f < 1.0 ){\nreturn ( ( 12.0 - 9.0 * B - 6.0 * C ) * ( f * f * f ) +\n( -18.0 + 12.0 * B + 6.0 *C ) * ( f * f ) +\n( 6.0 - 2.0 * B ) ) / 6.0;\n}else if( f >= 1.0 && f < 2.0 ){\nreturn ( ( -B - 6.0 * C ) * ( f * f * f )\n+ ( 6.0 * B + 30.0 * C ) * ( f *f ) +\n( - ( 12.0 * B ) - 48.0 * C ) * f +\n8.0 * B + 24.0 * C ) / 6.0;\n}else{\nreturn 0.0;\n}\n}\n#elif defined( BSPLINE_FILTER )\nfloat filter( float x ){\nfloat f = x;\nif( f < 0.0 ){\nf = -f;\n}\nif( f >= 0.0 && f <= 1.0 ){\nreturn ( 2.0 / 3.0 ) + ( 0.5 ) * ( f * f * f ) - ( f * f );\n}else if( f > 1.0 && f <= 2.0 ){\nreturn 1.0 / 6.0 * pow( ( 2.0 - f ), 3.0 );\n}\nreturn 1.0;\n}\n#else\nfloat filter( float x ){\nreturn 1.0;\n}\n#endif\nvec4 biCubic( sampler2D tex, vec2 texCoord ){\nvec2 texelSize = 1.0 / mapSize;\ntexCoord -= texelSize / 2.0;\nvec4 nSum = vec4( 0.0 );\nfloat nDenom = 0.0;\nvec2 cell = fract( texCoord * mapSize );\nfor( float m = -1.0; m <= 2.0; ++m ){\nfor( float n = -1.0; n <= 2.0; ++n ){\nvec4 vecData = texture2D(\ntex, texCoord + texelSize * vec2( m, n )\n);\nfloat c = filter( m - cell.x ) * filter( -n + cell.y );\nnSum += vecData * c;\nnDenom += c;\n}\n}\nreturn nSum / nDenom;\n}\n#endif\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\n#if defined( CUBIC_INTERPOLATION )\ngl_FragColor = biCubic( map, vUv );\n#else\ngl_FragColor = texture2D( map, vUv );\n#endif\n#if defined( PICKING )\nif( gl_FragColor.a < 0.7 )\ndiscard;\ngl_FragColor = vec4( texture2D( pickingMap, vUv ).xyz, objectId );\n#else\nif( gl_FragColor.a < 0.01 )\ndiscard;\ngl_FragColor.a *= opacity;\n#include fog_fragment\n#endif\n}");var Af=new Uint16Array([0,1,2,1,3,2]),Mf=new Float32Array([0,1,0,0,1,1,1,0]),Pf=function(t){function e(e,i){var r=e||{},n=i||{};t.call(this,{position:r.position,index:Af,picking:r.picking},n),this.forceTransparent=!0,this.filter=Eo(n.filter,"nearest");var o=new D(r.imageData,r.width,r.height);o.flipY=!0,this.tex=o;for(var a=r.imageData.length,s=new Uint8Array(a),c=0;c<a;c+=4){var u=c/4;s[c]=u>>16&255,s[c+1]=u>>8&255,s[c+2]=255&u}var h=new D(s,r.width,r.height);h.flipY=!0,h.minFilter=1003,h.magFilter=1003,this.pickingTex=h,this.addUniforms({map:{value:o},pickingMap:{value:h},mapSize:{value:new _(r.width,r.height)}}),this.geometry.addAttribute("uv",new me(Mf,2))}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={parameters:{},vertexShader:{},fragmentShader:{}};return i.parameters.get=function(){return Object.assign.call(this,{filter:{updateShader:!0,uniform:!0}},t.prototype.parameters)},e.prototype.getDefines=function(e){var i=t.prototype.getDefines.call(this,e);return this.filter.startsWith("cubic")&&(i.CUBIC_INTERPOLATION=1,this.filter.endsWith("bspline")?i.BSPLINE_FILTER=1:this.filter.endsWith("catmulrom")?i.CATMULROM_FILTER=1:this.filter.endsWith("mitchell")&&(i.MITCHELL_FILTER=1)),i},e.prototype.updateTexture=function(){var t=this.tex;this.filter.startsWith("cubic")?(t.minFilter=1003,t.magFilter=1003):"linear"===this.filter?(t.minFilter=1006,t.magFilter=1006):(t.minFilter=1003,t.magFilter=1003),t.needsUpdate=!0,this.pickingTex.needsUpdate=!0},e.prototype.makeMaterial=function(){t.prototype.makeMaterial.call(this),this.updateTexture();var e=this.material;e.uniforms.map.value=this.tex,e.blending=1,e.needsUpdate=!0;var i=this.wireframeMaterial;i.uniforms.map.value=this.tex,i.blending=1,i.needsUpdate=!0;var r=this.pickingMaterial;r.uniforms.map.value=this.tex,r.uniforms.pickingMap.value=this.pickingTex,r.blending=1,r.needsUpdate=!0},e.prototype.setUniforms=function(e){e&&void 0!==e.filter&&(this.updateTexture(),e.map=this.tex),t.prototype.setUniforms.call(this,e)},i.vertexShader.get=function(){return"Image.vert"},i.fragmentShader.get=function(){return"Image.frag"},Object.defineProperties(e.prototype,i),e}(xd),Tf=function(t,e){var i=e||{};this.dimension=Eo(i.dimension,"x"),this.positionType=Eo(i.positionType,"percent"),this.position=Eo(i.position,30),this.thresholdType=Eo(i.thresholdType,"sigma"),this.thresholdMin=Eo(i.thresholdMin,-1/0),this.thresholdMax=Eo(i.thresholdMax,1/0),this.normalize=Eo(i.normalize,!1),this.volume=t};Tf.prototype.getPositionFromCoordinate=function(t){var e,i=this.dimension,r=this.volume,n=r.matrix,o=(new O).setFromMatrixPosition(n)[i],a=(new O).setFromMatrixScale(n)[i];return e="x"===i?r.nx:"y"===i?r.ny:r.nz,Math.round(((t-o)/(e/100)+1)/a)},Tf.prototype.getData=function(t){t=t||{};var e,i=this.volume,r=i.data,n=i.matrix;function o(t){return Math.round(t/100*(e-1))}function a(t,e,r,n){return 3*(r*i.ny*i.nx+e*i.nx+t)+n}e="coordinate"===this.positionType?this.getPositionFromCoordinate(this.position):this.position;var s,c,u,h,l,p=new Float32Array(12),d=new O,f=0,m=0,g=0,v=i.nx,y=i.ny,b=i.nz;function x(t,e,i,r){d.set(t,e,i).applyMatrix4(n).toArray(p,r)}"x"===this.dimension?(u=o(i.nx),h=i.ny-1,l=i.nz-1,s=i.nz,c=i.ny,v=(f=u)+1,x(u,0,0,0),x(u,h,0,3),x(u,0,l,6),x(u,h,l,9)):"y"===this.dimension?(u=i.nx-1,h=o(i.ny),l=i.nz-1,s=i.nz,c=i.nx,y=(m=h)+1,x(0,h,0,0),x(u,h,0,3),x(0,h,l,6),x(u,h,l,9)):"z"===this.dimension&&(u=i.nx-1,h=i.ny-1,l=o(i.nz),s=i.nx,c=i.ny,b=(g=l)+1,x(0,0,l,0),x(0,h,l,3),x(u,0,l,6),x(u,h,l,9));var _,w,S=0,A=0,M=new Uint8Array(s*c*4),P=new Float32Array(s*c);"sigma"===this.thresholdType?(_=i.getValueForSigma(this.thresholdMin),w=i.getValueForSigma(this.thresholdMax)):(_=this.thresholdMin,w=this.thresholdMax);var T=Object.assign({},t.colorParams,{volume:i});this.normalize&&(T.domain=[0,1]);var E,C,I,R=yc.getScheme(T),L=new Float32Array(3),N=R.getScale();if(this.normalize){E=1/0,C=-1/0;for(var D=m;D<y;++D)for(var k=f;k<v;++k)for(var F=g;F<b;++F){var B=r[a(k,D,F,0)/3];B<E&&(E=B),B>C&&(C=B)}I=C-E}for(var z=m;z<y;++z)for(var U=f;U<v;++U)for(var j=g;j<b;++j){var G=a(U,z,j,0)/3,V=r[G];this.normalize&&(V=(V-E)/I),R.colorToArray(N(V),L),M[S]=Math.round(255*L[0]),M[S+1]=Math.round(255*L[1]),M[S+2]=Math.round(255*L[2]),M[S+3]=V>_&&V<w?255:0,P[A]=G,++A,S+=4}var $=new nl(P,i);return{position:p,imageData:M,width:s,height:c,picking:$}};var Ef=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="slice",this.parameters=Object.assign({filter:{type:"select",buffer:!0,options:{nearest:"nearest",linear:"linear","cubic-bspline":"cubic-bspline","cubic-catmulrom":"cubic-catmulrom","cubic-mitchell":"cubic-mitchell"}},positionType:{type:"select",rebuild:!0,options:{percent:"percent",coordinate:"coordinate"}},position:{type:"range",step:.1,max:100,min:1,rebuild:!0},dimension:{type:"select",rebuild:!0,options:{x:"x",y:"y",z:"z"}},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},normalize:{type:"boolean",rebuild:!0}},this.parameters,{flatShaded:null,side:null,wireframe:null,linewidth:null,colorScheme:null,roughness:null,metalness:null,diffuse:null}),this.volume=e,this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=this.volume,r=e||{};r.colorDomain=Eo(r.colorDomain,[i.min,i.max]),r.colorScheme=Eo(r.colorScheme,"value"),r.colorScale=Eo(r.colorScale,"Spectral"),this.colorScheme="value",this.dimension=Eo(r.dimension,"x"),this.filter=Eo(r.filter,"cubic-bspline"),this.positionType=Eo(r.positionType,"percent"),this.position=Eo(r.position,30),this.thresholdType=Eo(r.thresholdType,"sigma"),this.thresholdMin=Eo(r.thresholdMin,-1/0),this.thresholdMax=Eo(r.thresholdMax,1/0),this.normalize=Eo(r.normalize,!1),t.prototype.init.call(this,r),this.build()},e.prototype.attach=function(t){var e=this;this.bufferList.forEach((function(t){e.viewer.add(t)})),this.setVisibility(this.visible),t()},e.prototype.create=function(){var t=new Tf(this.volume,{positionType:this.positionType,position:this.position,dimension:this.dimension,thresholdType:this.thresholdType,thresholdMin:this.thresholdMin,thresholdMax:this.thresholdMax,normalize:this.normalize}),e=new Pf(t.getData({colorParams:this.getColorParams()}),this.getBufferParams({filter:this.filter}));this.bufferList.push(e)},e}(df),Cf=function(t){function e(e,i,r){var n=r||{};if(t.call(this,e,i,n),this.type="structure",this.parameters=Object.assign({radiusType:{type:"select",options:Il.types},radius:{type:"number",precision:3,max:10,min:.001},scale:{type:"number",precision:3,max:10,min:.001},assembly:null,defaultAssembly:{type:"hidden"}},this.parameters),this.selection=new nc(n.sele),this.dataList=[],this.structure=e,this.structureView=this.structure.getView(this.selection),e.biomolDict){var o={default:"default","":e.unitcell?"AU":"FULL"};Object.keys(e.biomolDict).forEach((function(t){o[t]=t})),this.parameters.assembly={type:"select",options:o,rebuild:!0}}else this.parameters.assembly=null}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={defaultScale:{}};return i.defaultScale.get=function(){return{vdw:1,covalent:1,bfactor:.01,sstruc:1}},e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"element"),this.radius=Eo(i.radius,"vdw"),this.scale=Eo(i.scale,1),this.assembly=Eo(i.assembly,"default"),this.defaultAssembly=Eo(i.defaultAssembly,""),"auto"===i.quality&&(i.quality=this.getQuality()),t.prototype.init.call(this,i),this.selection.signals.stringChanged.add((function(){this.build()}),this),this.build()},e.prototype.getAssembly=function(){var t="default"===this.assembly?this.defaultAssembly:this.assembly;return this.structure.biomolDict[t]},e.prototype.getQuality=function(){var t,e=this.structureView,i=this.getAssembly();return t=i?i.getAtomCount(e):e.atomCount,lc&&(t*=4),e.atomStore.count/e.residueStore.count<2&&(t*=10),t<15e3?"high":t<8e4?"medium":"low"},e.prototype.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 r=this.createData(i,e);r&&(r.sview=i,r.instanceList=t.getInstanceList(),this.dataList.push(r))}}),this);else{var e=this.createData(this.structureView,0);e&&(e.sview=this.structureView,this.dataList.push(e))}}},e.prototype.createData=function(){console.error("createData not implemented")},e.prototype.update=function(t){!this.lazy||this.visible?this.dataList.forEach((function(e){e.bufferList.length>0&&this.updateData(t,e)}),this):Object.assign(this.lazyProps.what,t)},e.prototype.updateData=function(){this.build()},e.prototype.getColorParams=function(){var e=t.prototype.getColorParams.call(this);return e.structure=this.structure,e},e.prototype.getAtomParams=function(t,e){return Object.assign({what:t,colorParams:this.getColorParams(),radiusParams:{radius:this.radius,scale:this.scale}},e)},e.prototype.getBondParams=function(t,e){return Object.assign({what:t,colorParams:this.getColorParams(),radiusParams:{radius:this.radius,scale:this.scale}},e)},e.prototype.setSelection=function(t,e){return this.selection.setString(t,e),this},e.prototype.setParameters=function(e,i,r){return i=i||{},e&&void 0!==e.radiusType&&("size"===e.radiusType?this.radius=1:this.radius=e.radiusType,delete e.radiusType,i.radius=!0,dc&&!this.disableImpostor||(r=!0)),e&&void 0!==e.radius&&(i.radius=!0,dc&&!this.disableImpostor||(r=!0)),e&&void 0!==e.scale&&(i.radius=!0,dc&&!this.disableImpostor||(r=!0)),e&&void 0!==e.defaultAssembly&&(r=!0),t.prototype.setParameters.call(this,e,i,r),this},e.prototype.getParameters=function(){return Object.assign(t.prototype.getParameters.call(this),{sele:this.selection?this.selection.string:void 0,defaultAssembly:this.defaultAssembly})},e.prototype.attach=function(t){var e=this.viewer,i=this.bufferList;this.dataList.forEach((function(t){t.bufferList.forEach((function(r){i.push(r),e.add(r,t.instanceList)}))})),this.setVisibility(this.visible),t()},e.prototype.clear=function(){this.dataList.length=0,t.prototype.clear.call(this)},e.prototype.dispose=function(){this.structureView.dispose(),delete this.structure,delete this.structureView,t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,i),e}(df),If=function(t){function e(e,i){var r=4*(e.position1.length/3);t.call(this,{position:new Float32Array(3*r),color:new Float32Array(3*r)},i),this.setAttributes(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isLine:{},vertexShader:{},fragmentShader:{}};return e.prototype.setAttributes=function(t){var e,i,r,n,o,a,s=this.geometry.attributes;t.position1&&t.position2&&(e=t.position1,i=t.position2,o=s.position.array,s.position.needsUpdate=!0),t.color&&t.color2&&(r=t.color,n=t.color2,a=s.color.array,s.color.needsUpdate=!0);for(var c,u,h,l,p,d,f,m,g,v,y,b=this.size,x=0;x<b;x++)u=3*x,c=4*x*3,e&&i&&(d=e[u],f=e[u+1],m=e[u+2],h=(d+(g=i[u]))/2,l=(f+(v=i[u+1]))/2,p=(m+(y=i[u+2]))/2,o[c]=d,o[c+1]=f,o[c+2]=m,o[c+3]=h,o[c+4]=l,o[c+5]=p,o[c+6]=h,o[c+7]=l,o[c+8]=p,o[c+9]=g,o[c+10]=v,o[c+11]=y),r&&n&&(a[c]=a[c+3]=r[u],a[c+1]=a[c+4]=r[u+1],a[c+2]=a[c+5]=r[u+2],a[c+6]=a[c+9]=n[u],a[c+7]=a[c+10]=n[u+1],a[c+8]=a[c+11]=n[u+2])},i.isLine.get=function(){return!0},i.vertexShader.get=function(){return"Line.vert"},i.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,i),e}(xd),Rf=function(t){function e(e,i,r){t.call(this,e.structure,i,r),this.type="trajectory",this.parameters=Object.assign({drawLine:{type:"boolean",rebuild:!0},drawCylinder:{type:"boolean",rebuild:!0},drawPoint:{type:"boolean",rebuild:!0},drawSphere:{type:"boolean",rebuild:!0},linewidth:{type:"integer",max:20,min:1,rebuild:!0},pointSize:{type:"integer",max:20,min:1,rebuild:!0},sizeAttenuation:{type:"boolean",rebuild:!0},sort:{type:"boolean",rebuild:!0}},this.parameters),this.manualAttach=!0,this.trajectory=e,this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"uniform"),i.colorValue=Eo(i.colorValue,14540253),this.drawLine=Eo(i.drawLine,!0),this.drawCylinder=Eo(i.drawCylinder,!1),this.drawPoint=Eo(i.drawPoint,!1),this.drawSphere=Eo(i.drawSphere,!1),this.pointSize=Eo(i.pointSize,1),this.sizeAttenuation=Eo(i.sizeAttenuation,!1),this.sort=Eo(i.sort,!0),t.prototype.init.call(this,i)},e.prototype.attach=function(t){var e=this;this.bufferList.forEach((function(t){e.viewer.add(t)})),this.setVisibility(this.visible),t()},e.prototype.prepare=function(t){t()},e.prototype.create=function(){if(0!==this.atomSet.atomCount){var t=this,e=this.atomSet.atoms[0].index;this.trajectory.getPath(e,(function(e){var i=e.length/3,r=new St(t.colorValue);if(t.drawSphere){var n=new Od({position:e,color:au(i,r.r,r.g,r.b),radius:ou(i,.2)},t.getBufferParams({sphereDetail:t.sphereDetail,dullInterior:!0,disableImpostor:t.disableImpostor}));t.bufferList.push(n)}if(t.drawCylinder){var o=new qd({position1:e.subarray(0,-3),position2:e.subarray(3),color:au(i-1,r.r,r.g,r.b),color2:au(i-1,r.r,r.g,r.b),radius:ou(i,.05)},t.getBufferParams({openEnded:!1,radialSegments:t.radialSegments,disableImpostor:t.disableImpostor,dullInterior:!0}));t.bufferList.push(o)}if(t.drawPoint){var a=new wf({position:e,color:au(i,r.r,r.g,r.b)},t.getBufferParams({pointSize:t.pointSize,sizeAttenuation:t.sizeAttenuation,sort:t.sort}));t.bufferList.push(a)}if(t.drawLine){var s=new If({position1:e.subarray(0,-3),position2:e.subarray(3),color:au(i-1,r.r,r.g,r.b),color2:au(i-1,r.r,r.g,r.b)},t.getBufferParams());t.bufferList.push(s)}t.attach()}))}},e}(Cf);function Lf(t){mc.error("makeRepresentation: representation type "+t+" unknown")}var Of=0,Nf=new N,Df=new O,kf=function(t,e){Object.defineProperty(this,"id",{value:Of++});var i=e||{};this.name=i.name,this.uuid=Ps(),this.visible=void 0===i.visible||i.visible,this.signals={representationAdded:new Fs,representationRemoved:new Fs,visibilityChanged:new Fs,matrixChanged:new Fs,statusChanged:new Fs,nameChanged:new Fs,disposed:new Fs},this.stage=t,this.viewer=t.viewer,this.reprList=[],this.annotationList=[],this.matrix=new N,this.position=new O,this.quaternion=new L,this.scale=new O(1,1,1),this.transform=new N,this.controls=new bh(this)},Ff={type:{}};Ff.type.get=function(){return"component"},kf.prototype.setPosition=function(t){return Array.isArray(t)?this.position.fromArray(t):this.position.copy(t),this.updateMatrix(),this},kf.prototype.setRotation=function(t){if(Array.isArray(t))if(3===t.length){var e=(new qt).fromArray(t);this.quaternion.setFromEuler(e)}else this.quaternion.fromArray(t);else t instanceof qt?this.quaternion.setFromEuler(t):this.quaternion.copy(t);return this.updateMatrix(),this},kf.prototype.setScale=function(t){return this.scale.set(t,t,t),this.updateMatrix(),this},kf.prototype.setTransform=function(t){return this.transform.copy(t),this.updateMatrix(),this},kf.prototype.updateMatrix=function(){var t=this,e=this.getCenterUntransformed(Df);this.matrix.makeTranslation(-e.x,-e.y,-e.z),Nf.makeRotationFromQuaternion(this.quaternion),this.matrix.premultiply(Nf),Nf.makeScale(this.scale.x,this.scale.y,this.scale.z),this.matrix.premultiply(Nf);var i=this.position;Nf.makeTranslation(i.x+e.x,i.y+e.y,i.z+e.z),this.matrix.premultiply(Nf),this.matrix.premultiply(this.transform),this.reprList.forEach((function(e){e.setParameters({matrix:t.matrix})})),this.stage.viewer.updateBoundingBox(),this.signals.matrixChanged.dispatch(this.matrix)},kf.prototype.addAnnotation=function(t,e,i){var r=new mh(this,t,e,i);return this.annotationList.push(r),r},kf.prototype.removeAnnotation=function(t){var e=this.annotationList.indexOf(t);-1!==e&&(this.annotationList.splice(e,1),t.dispose())},kf.prototype.removeAllAnnotations=function(){this.annotationList.forEach((function(t){t.dispose()})),this.annotationList.length=0},kf.prototype.addRepresentation=function(t,e,i){var r=i||{},n=this.stage.getParameters();r.matrix=this.matrix.clone(),r.quality=r.quality||n.quality,r.disableImpostor=Eo(r.disableImpostor,!n.impostor),r.useWorker=Eo(r.useWorker,n.workerDefault),r.visible=Eo(r.visible,!0);var o=Object.assign({},r,{visible:this.visible&&r.visible}),a=function(t,e,i,r){var n;if(gc&&mc.time("makeRepresentation "+t),e instanceof ld){if(!(n=xc.get(t)))return void Lf(t)}else if(e instanceof cp)if("surface"===t)n=_f;else{if("dot"!==t)return void Lf(t);n=Sf}else if(e instanceof lp)if("surface"===t)n=_f;else if("dot"===t)n=Sf;else{if("slice"!==t)return void Lf(t);n=Ef}else if(e instanceof gd)n=Rf;else if(e instanceof lf)n=ff,e=e.getBufferList();else{if("buffer"!==t)return void mc.error("makeRepresentation: object "+e+" unknown");n=ff}var o=new n(e,i,r);return gc&&mc.timeEnd("makeRepresentation "+t),o}(t,e,this.viewer,o),s=this.__getRepresentationComponent(a,r);return this.reprList.push(s),this.signals.representationAdded.dispatch(s),s},kf.prototype.addBufferRepresentation=function(t,e){return kf.prototype.addRepresentation.call(this,"buffer",t,e)},kf.prototype.hasRepresentation=function(t){return-1!==this.reprList.indexOf(t)},kf.prototype.removeRepresentation=function(t){var e=this.reprList.indexOf(t);-1!==e&&(this.reprList.splice(e,1),t.dispose(),this.signals.representationRemoved.dispatch(t))},kf.prototype.updateRepresentations=function(t){this.reprList.forEach((function(e){e.update(t)})),this.stage.viewer.requestRender()},kf.prototype.removeAllRepresentations=function(){this.reprList.slice(0).forEach((function(t){t.dispose()}))},kf.prototype.dispose=function(){this.removeAllAnnotations(),this.removeAllRepresentations(),delete this.annotationList,delete this.reprList,this.signals.disposed.dispatch()},kf.prototype.setVisibility=function(t){return this.visible=t,this.eachRepresentation((function(t){t.updateVisibility()})),this.annotationList.forEach((function(t){t.updateVisibility()})),this.signals.visibilityChanged.dispatch(t),this},kf.prototype.setStatus=function(t){return this.status=t,this.signals.statusChanged.dispatch(t),this},kf.prototype.setName=function(t){return this.name=t,this.signals.nameChanged.dispatch(t),this},kf.prototype.getBox=function(){return(t=this).getBoxUntransformed.apply(t,arguments).clone().applyMatrix4(this.matrix);var t},kf.prototype.getCenter=function(){return(t=this).getCenterUntransformed.apply(t,arguments).clone().applyMatrix4(this.matrix);var t},kf.prototype.getZoom=function(){return this.stage.getZoomForBox((t=this).getBox.apply(t,arguments));var t},kf.prototype.getBoxUntransformed=function(){},kf.prototype.getCenterUntransformed=function(){return this.getBoxUntransformed().getCenter()},kf.prototype.autoView=function(t){this.stage.animationControls.zoomMove(this.getCenter(),this.getZoom(),Eo(t,0))},kf.prototype.eachRepresentation=function(t){this.reprList.forEach(t)},Object.defineProperties(kf.prototype,Ff),kf.prototype.__getRepresentationComponent=function(t,e){return new Bf(this.stage,t,e,this)};var Bf=function(t){function e(e,i,r,n){var o=r||{};o.name=Eo(o.name,i.type),t.call(this,e,o),this.signals=Object.assign(this.signals,{parametersChanged:new Fs}),this.parent=n,this.setRepresentation(i)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"representation"},e.prototype.getType=function(){return this.repr.type},e.prototype.setRepresentation=function(t){this.disposeRepresentation(),this.repr=t,this.stage.tasks.listen(this.repr.tasks),this.updateVisibility()},e.prototype.addRepresentation=function(){},e.prototype.removeRepresentation=function(){},e.prototype.hasRepresentation=function(){},e.prototype.disposeRepresentation=function(){this.repr&&(this.stage.tasks.unlisten(this.repr.tasks),this.repr.dispose())},e.prototype.dispose=function(){this.parent&&this.parent.hasRepresentation(this)?this.parent.removeRepresentation(this):(this.disposeRepresentation(),this.signals.disposed.dispatch())},e.prototype.setVisibility=function(t){return this.visible=t,this.updateVisibility(),this.signals.visibilityChanged.dispatch(this.visible),this},e.prototype.getVisibility=function(){return this.parent?this.parent.visible&&this.visible:this.visible},e.prototype.toggleVisibility=function(){return this.setVisibility(!this.visible)},e.prototype.updateVisibility=function(){this.repr.setVisibility(this.getVisibility())},e.prototype.update=function(t){return this.repr.update(t),this},e.prototype.build=function(t){return this.repr.build(t),this},e.prototype.setSelection=function(t){return this.repr.setSelection(t),this},e.prototype.setParameters=function(t){return this.repr.setParameters(t),this.signals.parametersChanged.dispatch(this.repr.getParameters()),this},e.prototype.getParameters=function(){return this.repr.getParameters()},e.prototype.setColor=function(t){return this.repr.setColor(t),this},e.prototype.getCenter=function(){},e.prototype.getZoom=function(){},e.prototype.getBox=function(){},Object.defineProperties(e.prototype,i),e}(kf),zf=function(t){this.list=t||[];for(var e=this.list.length,i=0;i<e;++i){this.list[i].signals.disposed.add(this._remove,this)}};zf.prototype._remove=function(t){var e=this.list.indexOf(t);-1!==e&&this.list.splice(e,1)},zf.prototype._invoke=function(t,e){for(var i=this.list.length,r=0;r<i;++r){var n=this.list[r],o=n[t];"function"==typeof o&&o.apply(n,e)}return this},zf.prototype.setVisibility=function(t){return this._invoke("setVisibility",[t])},zf.prototype.setSelection=function(t){return this._invoke("setSelection",[t])},zf.prototype.dispose=function(){return this._invoke("dispose")};var Uf=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.addRepresentation=function(t,e){return this._invoke("addRepresentation",[t,e])},e.prototype.autoView=function(t){return this._invoke("autoView",[t])},e}(zf),jf=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setParameters=function(t){return this._invoke("setParameters",[t])},e.prototype.setColor=function(t){return this._invoke("setColor",[t])},e}(zf);function Gf(t,e){return t instanceof RegExp?null!==e.name.match(t):e.name===t}var Vf=new O,$f=function(t,e){if(this.signals={parametersChanged:new Fs,fullscreenChanged:new Fs,componentAdded:new Fs,componentRemoved:new Fs,clicked:new Fs,hovered:new Fs},this.tasks=new $c,this.compList=[],this.defaultFileParams={},this.viewer=new wu(t),this.viewer.renderer){this.tooltip=document.createElement("div"),Object.assign(this.tooltip.style,{display:"none",position:"fixed",zIndex:2+(parseInt(this.viewer.container.style.zIndex)||0),pointerEvents:"none",backgroundColor:"rgba( 0, 0, 0, 0.6 )",color:"lightgrey",padding:"8px",fontFamily:"sans-serif"}),document.body.appendChild(this.tooltip),this.mouseObserver=new Au(this.viewer.renderer.domElement),this.viewerControls=new Wu(this),this.trackballControls=new Ou(this),this.pickingControls=new Fu(this),this.animationControls=new oh(this),this.mouseControls=new hh(this),this.pickingBehavior=new lh(this),this.mouseBehavior=new ph(this),this.animationBehavior=new dh(this),this.keyBehavior=new fh(this),this.spinAnimation=this.animationControls.spin([0,1,0],.005),this.spinAnimation.pause(!0),this.rockAnimation=this.animationControls.rock([0,1,0],.005),this.rockAnimation.pause(!0);var i=Object.assign({impostor:!0,quality:"medium",workerDefault:!0,sampleLevel:0,backgroundColor:"black",rotateSpeed:2,zoomSpeed:1.2,panSpeed:1,clipNear:0,clipFar:100,clipDist:10,fogNear:50,fogFar:100,cameraFov:40,cameraType:"perspective",lightColor:14540253,lightIntensity:1,ambientColor:14540253,ambientIntensity:.2,hoverTimeout:0,tooltip:!0,mousePreset:"default"},e);this.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"},workerDefault:{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:-1},tooltip:{type:"boolean"},mousePreset:{type:"select",options:{default:"default",pymol:"pymol",coot:"coot"}}},this.setParameters(i),this.viewer.animate()}};$f.prototype.setParameters=function(t){var e=Object.assign({},t),i=this.parameters,r=this.viewer,n=this.trackballControls;for(var o in e)void 0!==e[o]&&i[o]&&(i[o].int&&(e[o]=parseInt(e[o])),i[o].float&&(e[o]=parseFloat(e[o])),i[o].value=e[o]);return void 0!==e.quality&&this.setQuality(e.quality),void 0!==e.impostor&&this.setImpostor(e.impostor),void 0!==e.rotateSpeed&&(n.rotateSpeed=e.rotateSpeed),void 0!==e.zoomSpeed&&(n.zoomSpeed=e.zoomSpeed),void 0!==e.panSpeed&&(n.panSpeed=e.panSpeed),void 0!==e.mousePreset&&this.mouseControls.preset(e.mousePreset),this.mouseObserver.setParameters({hoverTimeout:e.hoverTimeout}),r.setClip(e.clipNear,e.clipFar,e.clipDist),r.setFog(void 0,e.fogNear,e.fogFar),r.setCamera(e.cameraType,e.cameraFov),r.setSampling(e.sampleLevel),r.setBackground(e.backgroundColor),r.setLight(e.lightColor,e.lightIntensity,e.ambientColor,e.ambientIntensity),this.signals.parametersChanged.dispatch(this.getParameters()),this},$f.prototype.getParameters=function(){var t={};for(var e in this.parameters)t[e]=this.parameters[e].value;return t},$f.prototype.defaultFileRepresentation=function(t){if("structure"===t.type){var e,i,r;t.setSelection("/0");var n=t.structure;if(n.biomolDict.BU1){var o=n.biomolDict.BU1;e=o.getAtomCount(n),i=o.getResidueCount(n),r=o.getInstanceCount(),t.setDefaultAssembly("BU1")}else e=n.getModelProxy(0).atomCount,i=n.getModelProxy(0).residueCount,r=1;var a=e;lc&&(a*=4);var s=n.atomStore.count/n.residueStore.count<2;s&&(a*=10);var c="chainname",u="RdYlBu",h=!1;if(1===n.getChainnameCount("polymer and /0")&&(c="residueindex",u="spectral",h=!0),gc&&console.log(a,e,r,s),i/r<4)t.addRepresentation("ball+stick",{colorScheme:"element",scale:2,aspectRatio:1.5,bondScale:.3,bondSpacing:.75,quality:"auto"});else if(r>5&&a>15e3||a>7e5){var l=Math.min(1.5,Math.max(.1,2e3/(a/r)));s&&(l=Math.min(l,.15)),t.addRepresentation("surface",{sele:"polymer",surfaceType:"sas",probeRadius:1.4,scaleFactor:l,colorScheme:c,colorScale:u,colorReverse:h,useWorker:!1})}else a>25e4?t.addRepresentation("backbone",{lineOnly:!0,colorScheme:c,colorScale:u,colorReverse:h}):a>1e5?t.addRepresentation("backbone",{quality:"low",disableImpostor:!0,colorScheme:c,colorScale:u,colorReverse:h,scale:2}):a>8e4?t.addRepresentation("backbone",{colorScheme:c,colorScale:u,colorReverse:h,scale:2}):(t.addRepresentation("cartoon",{colorScheme:c,colorScale:u,colorReverse:h,scale:.7,aspectRatio:5,quality:"auto"}),a<5e4&&t.addRepresentation("base",{colorScheme:c,colorScale:u,colorReverse:h,quality:"auto"}),t.addRepresentation("ball+stick",{sele:"ligand",colorScheme:"element",scale:2,aspectRatio:1.5,bondScale:.3,bondSpacing:.75,quality:"auto"}));t.structure.frames.length&&t.addTrajectory()}else"surface"!==t.type&&"volume"!==t.type||t.addRepresentation("surface");this.tasks.onZeroOnce(this.autoView,this)},$f.prototype.loadFile=function(t,e){var i=Object.assign({},this.defaultFileParams,e),r=new kf(this,i);r.name=Lo(t).name,this.addComponent(r);var n=this.tasks;n.increment();var o=function(t){return this.removeComponent(r),"script"===(r=this.addComponentFromObject(t,i)).type?r.run():i.defaultRepresentation&&this.defaultFileRepresentation(r),n.decrement(),r}.bind(this);return("dcd"===Eo(i.ext,Lo(t).ext)?Promise.reject(new Error("loadFile: ext 'dcd' must be loaded into a structure component")):Bc(t,i)).then(o,(function(t){throw r.setStatus(t),n.decrement(),t}))},$f.prototype.addComponent=function(t){t?(this.compList.push(t),this.signals.componentAdded.dispatch(t)):mc.warn("Stage.addComponent: no component given")},$f.prototype.addComponentFromObject=function(t,e){var i=Ac.get(t.type);if(i){var r=new i(this,t,e);return this.addComponent(r),r}mc.warn("no component for object type",t.type)},$f.prototype.removeComponent=function(t){var e=this.compList.indexOf(t);-1!==e&&(this.compList.splice(e,1),t.dispose(),this.signals.componentRemoved.dispatch(t))},$f.prototype.removeAllComponents=function(t){this.compList.slice().forEach((function(e){t&&e.type!==t||this.removeComponent(e)}),this)},$f.prototype.handleResize=function(){this.viewer.handleResize()},$f.prototype.setSize=function(t,e){var i=this.viewer.container;i!==document.body&&(void 0!==t&&(i.style.width=t),void 0!==e&&(i.style.height=e),this.handleResize())},$f.prototype.toggleFullscreen=function(t){if(document.fullscreenEnabled||document.mozFullScreenEnabled||document.webkitFullscreenEnabled||document.msFullscreenEnabled){var e=this;t=t||this.viewer.container,this.lastFullscreenElement=t,i()?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=window.screen.width+"px",t.style.height=window.screen.height+"px",t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen(),document.addEventListener("fullscreenchange",r),document.addEventListener("mozfullscreenchange",r),document.addEventListener("webkitfullscreenchange",r),document.addEventListener("MSFullscreenChange",r),this.handleResize(),this.signals.fullscreenChanged.dispatch(!0),setTimeout((function(){e.handleResize()}),100))}else mc.log("fullscreen mode (currently) not possible");function i(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement}function r(){if(!i()&&e.lastFullscreenElement){var t=e.lastFullscreenElement;t.style.width=t.dataset.normalWidth,t.style.height=t.dataset.normalHeight,document.removeEventListener("fullscreenchange",r),document.removeEventListener("mozfullscreenchange",r),document.removeEventListener("webkitfullscreenchange",r),document.removeEventListener("MSFullscreenChange",r),e.handleResize(),e.signals.fullscreenChanged.dispatch(!1)}}},$f.prototype.setSpin=function(t){t?(this.spinAnimation.resume(!0),this.rockAnimation.pause(!0)):this.spinAnimation.pause(!0)},$f.prototype.setRock=function(t){t?(this.rockAnimation.resume(!0),this.spinAnimation.pause(!0)):this.rockAnimation.pause(!0)},$f.prototype.toggleSpin=function(){this.setSpin(this.spinAnimation.paused)},$f.prototype.toggleRock=function(){this.setRock(this.rockAnimation.paused)},$f.prototype.setFocus=function(t){var e=Ts(t/2,0,49.9),i=100-e,r=(i-e)/2;this.setParameters({clipNear:e,clipFar:i,fogNear:Es(i-r),fogFar:Es(i+r)})},$f.prototype.getZoomForBox=function(t){var e=t.getSize(Vf),i=Math.max(e.x,e.y,e.z),r=Math.min(e.x,e.y,e.z),n=i+Math.sqrt(r),o=Qo(this.viewer.perspectiveCamera.fov),a=this.viewer.width,s=this.viewer.height,c=s<a?1:a/s;return n=Math.abs(.5*n/c/Math.sin(o/2)),-(n+=this.parameters.clipDist.value)},$f.prototype.getBox=function(){return this.viewer.boundingBox},$f.prototype.getZoom=function(){return this.getZoomForBox(this.getBox())},$f.prototype.getCenter=function(t){return this.getBox().getCenter(t)},$f.prototype.autoView=function(t){this.animationControls.zoomMove(this.getCenter(),this.getZoom(),Eo(t,0))},$f.prototype.makeImage=function(t){var e=this.viewer,i=this.tasks;return new Promise((function(r,n){i.onZeroOnce((function(){i.increment(),e.makeImage(t).then((function(t){i.decrement(),r(t)})).catch((function(t){i.decrement(),n(t)}))}))}))},$f.prototype.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 r=i.getParameters();r.disableImpostor=!t,i.build(r)}}))},$f.prototype.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(r){if("script"!==r.type){var n=r.getParameters();if(!e.includes(r.getType())){if(!i.includes(r.getType()))return;if(!n.disableImpostor)return void(r.repr.quality=t)}n.quality=t,r.build(n)}}))},$f.prototype.eachComponent=function(t,e){this.compList.slice().forEach((function(i,r){e&&i.type!==e||t(i,r)}))},$f.prototype.eachRepresentation=function(t,e){this.eachComponent((function(e){e.reprList.slice().forEach((function(i){t(i,e)}))}),e)},$f.prototype.getComponentsByName=function(t,e){var i=[];return this.eachComponent((function(e){(void 0===t||Gf(t,e))&&i.push(e)}),e),new Uf(i)},$f.prototype.getComponentsByObject=function(t){var e=[];return this.eachComponent((function(i){i[i.type]===t&&e.push(i)})),new Uf(e)},$f.prototype.getRepresentationsByName=function(t,e){var i,r;"object"!=typeof t||t instanceof RegExp?(i=void 0,r=t):(i=t.comp,r=t.repr);var n=[];return this.eachRepresentation((function(t,e){(void 0===i||Gf(i,e))&&(void 0===r||Gf(r,t))&&n.push(t)}),e),new jf(n)},$f.prototype.getAnythingByName=function(t){var e=this.getComponentsByName(t).list,i=this.getRepresentationsByName(t).list;return new zf(e.concat(i))},$f.prototype.dispose=function(){this.tasks.dispose()};var Hf=[[4,0,-2,-1,-2,0,-2,-1,-1,-1,-1,-2,-1,-1,-1,1,0,0,-3,-2],[0,9,-3,-4,-2,-3,-3,-1,-3,-1,-1,-3,-3,-3,-3,-1,-1,-1,-2,-2],[-2,-3,6,2,-3,-1,-1,-3,-1,-4,-3,1,-1,0,-2,0,-1,-3,-4,-3],[-1,-4,2,5,-3,-2,0,-3,1,-3,-2,0,-1,2,0,0,-1,-2,-3,-2],[-2,-2,-3,-3,6,-3,-1,0,-3,0,0,-3,-4,-3,-3,-2,-2,-1,1,3],[0,-3,-1,-2,-3,6,-2,-4,-2,-4,-3,0,-2,-2,-2,0,-2,-3,-2,-3],[-2,-3,-1,0,-1,-2,8,-3,-1,-3,-2,1,-2,0,0,-1,-2,-3,-2,2],[-1,-1,-3,-3,0,-4,-3,4,-3,2,1,-3,-3,-3,-3,-2,-1,3,-3,-1],[-1,-3,-1,1,-3,-2,-1,-3,5,-2,-1,0,-1,1,2,0,-1,-2,-3,-2],[-1,-1,-4,-3,0,-4,-3,2,-2,4,2,-3,-3,-2,-2,-2,-1,1,-2,-1],[-1,-1,-3,-2,0,-3,-2,1,-1,2,5,-2,-2,0,-1,-1,-1,1,-1,-1],[-2,-3,1,0,-3,0,1,-3,0,-3,-2,6,-2,0,0,1,0,-3,-4,-2],[-1,-3,-1,-1,-4,-2,-2,-3,-1,-3,-2,-2,7,-1,-2,-1,-1,-2,-4,-3],[-1,-3,0,2,-3,-2,0,-3,1,-2,0,0,-1,5,1,0,-1,-2,-2,-1],[-1,-3,-2,0,-3,-2,0,-3,2,-2,-1,0,-2,1,5,-1,-1,-3,-3,-2],[1,-1,0,0,-2,0,-1,-2,0,-2,-1,1,-1,0,-1,4,1,-2,-3,-2],[0,-1,-1,-1,-2,-2,-2,-1,-1,-1,-1,0,-1,-1,-1,1,5,0,-2,-2],[0,-1,-3,-2,-1,-3,-3,3,-2,1,1,-3,-2,-2,-3,-2,0,4,-3,-1],[-3,-2,-4,-3,1,-2,-2,-3,-3,-2,-1,-4,-4,-2,-3,-3,-2,-3,11,2],[-2,-2,-3,-2,3,-3,2,-1,-2,-1,-1,-2,-3,-1,-2,-2,-2,-1,2,7]];function Wf(t,e){var i,r=0,n={};return e.forEach((function(e){i=0;var o={};e.forEach((function(e){o[t[i++]]=e})),n[t[r++]]=o})),n}var Xf={blosum62:Wf("ARNDCQEGHILKMFPSTWYVBZ?",[[4,-1,-2,-2,0,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-3,-2,0,-2,-1,0],[-1,5,0,-2,-3,1,0,-2,0,-3,-2,2,-1,-3,-2,-1,-1,-3,-2,-3,-1,0,-1],[-2,0,6,1,-3,0,0,0,1,-3,-3,0,-2,-3,-2,1,0,-4,-2,-3,3,0,-1],[-2,-2,1,6,-3,0,2,-1,-1,-3,-4,-1,-3,-3,-1,0,-1,-4,-3,-3,4,1,-1],[0,-3,-3,-3,9,-3,-4,-3,-3,-1,-1,-3,-1,-2,-3,-1,-1,-2,-2,-1,-3,-3,-2],[-1,1,0,0,-3,5,2,-2,0,-3,-2,1,0,-3,-1,0,-1,-2,-1,-2,0,3,-1],[-1,0,0,2,-4,2,5,-2,0,-3,-3,1,-2,-3,-1,0,-1,-3,-2,-2,1,4,-1],[0,-2,0,-1,-3,-2,-2,6,-2,-4,-4,-2,-3,-3,-2,0,-2,-2,-3,-3,-1,-2,-1],[-2,0,1,-1,-3,0,0,-2,8,-3,-3,-1,-2,-1,-2,-1,-2,-2,2,-3,0,0,-1],[-1,-3,-3,-3,-1,-3,-3,-4,-3,4,2,-3,1,0,-3,-2,-1,-3,-1,3,-3,-3,-1],[-1,-2,-3,-4,-1,-2,-3,-4,-3,2,4,-2,2,0,-3,-2,-1,-2,-1,1,-4,-3,-1],[-1,2,0,-1,-3,1,1,-2,-1,-3,-2,5,-1,-3,-1,0,-1,-3,-2,-2,0,1,-1],[-1,-1,-2,-3,-1,0,-2,-3,-2,1,2,-1,5,0,-2,-1,-1,-1,-1,1,-3,-1,-1],[-2,-3,-3,-3,-2,-3,-3,-3,-1,0,0,-3,0,6,-4,-2,-2,1,3,-1,-3,-3,-1],[-1,-2,-2,-1,-3,-1,-1,-2,-2,-3,-3,-1,-2,-4,7,-1,-1,-4,-3,-2,-2,-1,-2],[1,-1,1,0,-1,0,0,0,-1,-2,-2,0,-1,-2,-1,4,1,-3,-2,-2,0,0,0],[0,-1,0,-1,-1,-1,-1,-2,-2,-1,-1,-1,-1,-2,-1,1,5,-2,-2,0,-1,-1,0],[-3,-3,-4,-4,-2,-2,-3,-2,-2,-3,-2,-3,-1,1,-4,-3,-2,11,2,-3,-4,-3,-2],[-2,-2,-2,-3,-2,-1,-2,-3,2,-1,-1,-2,-1,3,-3,-2,-2,2,7,-1,-3,-2,-1],[0,-3,-3,-3,-1,-2,-2,-3,-3,3,1,-2,1,-1,-2,-2,0,-3,-1,4,-3,-2,-1],[-2,-1,3,4,-3,0,1,-1,0,-3,-4,0,-3,-3,-2,0,-1,-4,-3,-3,4,1,-1],[-1,0,0,1,-3,3,4,-2,0,-3,-3,1,-1,-3,-1,0,-1,-3,-2,-2,1,4,-1],[0,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,0,0,-2,-1,-1,-1,-1,-1]]),blosum62x:Wf("ACDEFGHIKLMNPQRSTVWY",Hf)},qf=function(t,e,i,r,n){this.seq1=t,this.seq2=e,this.gapPenalty=i||-10,this.gapExtensionPenalty=r||-1,this.substMatrix=n||"blosum62",this.substMatrix&&(this.substMatrix=Xf[this.substMatrix])};qf.prototype.initMatrices=function(){var t,e;for(this.n=this.seq1.length,this.m=this.seq2.length,this.score=void 0,this.ali="",this.S=[],this.V=[],this.H=[],t=0;t<=this.n;++t)for(this.S[t]=[],this.V[t]=[],this.H[t]=[],e=0;e<=this.m;++e)this.S[t][e]=0,this.V[t][e]=0,this.H[t][e]=0;for(t=0;t<=this.n;++t)this.S[t][0]=this.gap(0),this.H[t][0]=-1/0;for(e=0;e<=this.m;++e)this.S[0][e]=this.gap(0),this.V[0][e]=-1/0;this.S[0][0]=0},qf.prototype.gap=function(t){return this.gapPenalty+t*this.gapExtensionPenalty},qf.prototype.makeScoreFn=function(){var t,e,i=this.seq1,r=this.seq2,n=this.substMatrix;return n?function(o,a){t=i[o],e=r[a];try{return n[t][e]}catch(t){return-4}}:(mc.warn("Alignment: no subst matrix"),function(n,o){return t=i[n],e=r[o],t===e?5:-3})},qf.prototype.calc=function(){gc&&mc.time("Alignment.calc"),this.initMatrices();var t,e,i,r,n,o,a,s=this.gap(0),c=this.makeScoreFn(),u=this.gapExtensionPenalty,h=this.V,l=this.H,p=this.S,d=this.n,f=this.m;for(o=1;o<=d;++o)for(e=p[o-1],t=h[o-1],i=h[o],r=l[o],n=p[o],a=1;a<=f;++a)i[a]=Math.max(e[a]+s,t[a]+u),r[a]=Math.max(n[a-1]+s,r[a-1]+u),n[a]=Math.max(e[a-1]+c(o-1,a-1),i[a],r[a]);gc&&mc.timeEnd("Alignment.calc"),gc&&mc.log(this.S,this.V,this.H)},qf.prototype.trace=function(){gc&&mc.time("Alignment.trace"),this.ali1="",this.ali2="";var t,e=this.makeScoreFn(),i=this.n,r=this.m;for(this.S[i][r]>=this.V[i][r]?(t="S",this.score=this.S[i][r]):this.V[i][r]>=this.H[i][r]?(t="V",this.score=this.V[i][r]):(t="H",this.score=this.H[i][r]),gc&&mc.log("Alignment: SCORE",this.score),gc&&mc.log("Alignment: S, V, H",this.S[i][r],this.V[i][r],this.H[i][r]);i>0&&r>0;)"S"===t?this.S[i][r]===this.S[i-1][r-1]+e(i-1,r-1)?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2=this.seq2[r-1]+this.ali2,--i,--r,t="S"):this.S[i][r]===this.V[i][r]?t="V":this.S[i][r]===this.H[i][r]?t="H":(--i,--r):"V"===t?this.V[i][r]===this.V[i-1][r]+this.gapExtensionPenalty?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i,t="V"):this.V[i][r]===this.S[i-1][r]+this.gap(0)?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i,t="S"):--i:"H"===t?this.H[i][r]===this.H[i][r-1]+this.gapExtensionPenalty?(this.ali1="-"+this.ali1,this.ali2=this.seq2[r-1]+this.ali2,--r,t="H"):this.H[i][r]===this.S[i][r-1]+this.gap(0)?(this.ali1="-"+this.ali1,this.ali2=this.seq2[r-1]+this.ali2,--r,t="S"):--r:mc.error("Alignment: no matrix");for(;i>0;)this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i;for(;r>0;)this.ali1="-"+this.ali1,this.ali2=this.seq2[r-1]+this.ali2,--r;gc&&mc.timeEnd("Alignment.trace"),gc&&mc.log([this.ali1,this.ali2])};var Yf=function(t){function e(e){var i=this;t.call(this,e),e.scale||(this.scale="rainbow",this.reverse=Eo(e.reverse,!0)),this.scalePerModel={},this.structure.eachModel((function(t){i.domain=[t.atomOffset,t.atomEnd],i.scalePerModel[t.index]=i.getScale()}))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){return this.scalePerModel[t.modelIndex](t.index)},e}(Ns);yc.add("atomindex",Yf);var Zf=function(t){function e(e){if(t.call(this,e),e.scale||(this.scale="OrRd"),!e.domain){var i,r=1/0,n=-1/0;e.sele&&(i=new nc(e.sele)),this.structure.eachAtom((function(t){var e=t.bfactor;r=Math.min(r,e),n=Math.max(n,e)}),i),this.domain=[r,n]}this.bfactorScale=this.getScale()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){return this.bfactorScale(t.bfactor)},e}(Ns);yc.add("bfactor",Zf);var Kf=function(t){function e(e){t.call(this,e),e.scale||(this.scale="Spectral");var i={},r={};this.structure.eachModel(function(t){var e=0,n={};t.eachChain((function(t){void 0===n[t.chainid]&&(n[t.chainid]=e,e+=1)})),this.domain=[0,e-1],i[t.index]=n,r[t.index]=this.getScale()}.bind(this)),this.atomColor=function(t){var e=i[t.modelIndex];return r[t.modelIndex](e[t.chainid])}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("chainid",Kf);var Qf=function(t){function e(e){if(t.call(this,e),e.scale||(this.scale="Spectral"),e.domain){var i=this.getScale();this.atomColor=function(t){return i(t.chainIndex)}}else{var r={};this.structure.eachModel(function(t){this.domain=[t.chainOffset,t.chainEnd],r[t.index]=this.getScale()}.bind(this)),this.atomColor=function(t){return r[t.modelIndex](t.chainIndex)}}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("chainindex",Qf);var Jf=function(t){function e(e){t.call(this,e),e.scale||(this.scale="Spectral");var i={},r={};this.structure.eachModel(function(t){var e=0,n={};t.eachChain((function(t){void 0===n[t.chainname]&&(n[t.chainname]=e,e+=1)})),this.domain=[0,e-1],i[t.index]=n,r[t.index]=this.getScale()}.bind(this)),this.atomColor=function(t){var e=i[t.modelIndex];return r[t.modelIndex](e[t.chainname])}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("chainname",Jf);var tm=function(t){function e(e){t.call(this,e),e.scale||(this.scale="RdYlBu"),this.rsrzScale=this.getScale({domain:[2,0]}),this.rsccScale=this.getScale({domain:[.678,1]});var i=e.structure.validation||{};this.rsrzDict=i.rsrzDict||{},this.rsccDict=i.rsccDict||{}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.resno;t.inscode&&(e+="^"+t.inscode),t.chainname&&(e+=":"+t.chainname),e+="/"+t.modelIndex;var i=this.rsrzDict[e];if(void 0!==i)return this.rsrzScale(i);var r=this.rsccDict[e];return void 0!==r?this.rsccScale(r):9474192},e}(Ns);yc.add("densityfit",tm);var em={ARG:{CD:.1,CZ:.5,NE:-.1},ASN:{CG:.55,OD1:-.55},ASP:{CB:-.16,CG:.36,OD1:-.6,OD2:-.6},CYS:{CB:.19,SG:-.19},GLN:{CD:.55,OE1:-.55},GLU:{CD:.36,CG:-.16,OE1:-.6,OE2:-.6},HIS:{CB:.1,CD2:.2,CE1:.45,CG:.15,ND1:.05,NE2:.05},LYS:{CE:.25,NZ:.75},MET:{CE:.06,CG:.06,SD:-.12},PTR:{C:.55,CA:.1,CZ:.25,N:-.35,O:-.55,O1P:-.85,O2P:-.85,O3P:-.85,OG1:-1.1,P:1.4},SEP:{C:.55,CA:.1,CB:.25,N:-.35,O:-.55,O1P:-.85,O2P:-.85,O3P:-.85,OG1:-1.1,P:1.4},SER:{CB:.25,OG:-.25},THR:{CB:.25,OG1:-.25},TPO:{C:.55,CA:.1,CB:.25,N:-.35,O:-.55,OG1:-1.1,O1P:-.85,O2P:-.85,O3P:-.85,P:1.4},TRP:{CD1:.06,CD2:.1,CE2:-.04,CE3:-.03,CG:-.03,NE1:-.06},TYR:{CZ:.25,OH:-.25},backbone:{C:.55,O:-.55,N:-.35,CA:.1}};var im=function(t){function e(e){t.call(this,e),e.scale||(this.scale="rwb"),e.domain||(this.domain=[-.5,0,.5]);var i=this.getScale();var r=this.structure,n=new Float32Array(r.atomCount),o=[],a=[];r.eachAtom((function(t){var e;if(n[t.index]=((e=t).isProtein()&&(em[e.resname]&&em[e.resname][e.atomname]||em.backbone[e.atomname])||0)*t.occupancy,"N"===t.atomname){var i=function(t,e){e=e||new O;var i=!1,r=!1,n=!1;return e.set(2*t.x,2*t.y,2*t.z),t.eachBondedAtom((function(t){if(!i)return"H"===t.atomname?(e.set(t),void(i=!0)):void(r||"CA"!==t.atomname?n||"C"!==t.atomname||(n=!0,e.sub(t)):(e.sub(t),r=!0))})),i?e:r&&n?(e.normalize(),e.multiplyScalar(1.04),e.add(t),e):void 0}(t);void 0!==i&&(o.push(i),a.push(.25*t.occupancy))}}));var s=this.structure.getBoundingBox();s.expandByScalar(1.04);var c=function(t){for(var e=t.length,i=new Float32Array(e),r=new Float32Array(e),n=new Float32Array(e),o=0;o<t.length;o++){var a=t[o];i[o]=a.x,r[o]=a.y,n[o]=a.z}return{x:i,y:r,z:n,count:e}}(o),u=new Kl(c,s),h=new Kl(this.structure.atomStore,s),l=this.atomProxy,p=new O;this.positionColor=function(t){for(var e=0,r=h.within(t.x,t.y,t.z,12),o=0;o<r.length;o++){var s=r[o],d=n[s];if(0!==d){l.index=s,p.x=t.x-l.x,p.y=t.y-l.y,p.z=t.z-l.z;var f=p.lengthSq();f<144&&(e+=d/f)}}for(var m=u.within(t.x,t.y,t.z,12),g=0;g<m.length;g++){var v=m[g];p.x=t.x-c.x[v],p.y=t.y-c.y[v],p.z=t.z-c.z[v];var y=p.lengthSq();y<144&&(e+=a[v]/y)}return i(e)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("electrostatic",im);var rm={H:16777215,HE:14286847,LI:13402367,BE:12779264,B:16758197,C:9474192,N:3166456,O:16715021,F:9494608,NE:11789301,NA:11230450,MG:9109248,AL:12560038,SI:1578e4,P:16744448,S:16777008,CL:2093087,AR:8442339,K:9388244,CA:4062976,SC:15132390,TI:12567239,V:10921643,CR:9083335,MN:10255047,FE:14706227,CO:15765664,NI:5296208,CU:13140019,ZN:8224944,GA:12750735,GE:6721423,AS:12419299,SE:16752896,BR:10889513,KR:6076625,RB:7351984,SR:65280,Y:9764863,ZR:9756896,NB:7586505,MO:5551541,TC:3907230,RU:2396047,RH:687500,PD:27013,AG:12632256,CD:16767375,IN:10909043,SN:6717568,SB:10380213,TE:13924864,I:9699476,XE:9699476,CS:5707663,BA:51456,LA:7394559,CE:16777159,PR:14286791,ND:13107143,PM:10747847,SM:9437127,EU:6422471,GD:4587463,TB:3211207,DY:2097095,HO:65436,ER:58997,TM:54354,YB:48952,LU:43812,HF:5096191,TA:5089023,W:2200790,RE:2522539,OS:2516630,IR:1528967,PT:13684960,AU:16765219,HG:12105936,TL:10900557,PB:5724513,BI:10375093,PO:11230208,AT:7688005,RN:4358806,FR:4325478,RA:32e3,AC:7384058,TH:47871,PA:41471,U:36863,NP:33023,PU:27647,AM:5528818,CM:7888099,BK:9064419,CF:10565332,ES:11739092,FM:11739066,MD:11734438,NO:12389767,LR:13041766,RF:13369433,DB:13697103,SG:14221381,BH:14680120,HS:15073326,MT:15400998,DS:16777215,RG:16777215,CN:16777215,UUT:16777215,FL:16777215,UUP:16777215,LV:16777215,UUH:16777215,D:16777152,T:16777120},nm=function(t){function e(e){var i=e||{};i.value=Eo(i.value,rm.C),t.call(this,i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.element;return"C"===e?this.value:rm[e]||16777215},e}(Ns);yc.add("element",nm);var om=function(t){function e(e){t.call(this,e),e.scale||(this.scale="Spectral"),e.domain||(this.domain=[0,this.structure.entityList.length-1]);var i=this.getScale();this.atomColor=function(t){return i(t.entityIndex)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("entityindex",om);var am=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.entity;switch(e?e.entityType:void 0){case 1:return 8374655;case 2:return 16629894;case 3:return 12496596;case 4:return 3697840;default:return 16777113}},e}(Ns);yc.add("entitytype",am);var sm=function(t){function e(e){t.call(this,e);var i=e.structure.validation||{};this.geoAtomDict=i.geoAtomDict||{},this.geoDict=i.geoDict||{}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e,i=t.resno;t.inscode&&(i+="^"+t.inscode),t.chainname&&(i+=":"+t.chainname),i+="/"+t.modelIndex;var r,n=this.geoAtomDict[i];if(void 0!==n){var o=n[t.atomname]||0;r=o,e=16843009*((r=(858993459&(r-=r>>1&1431655765))+(r>>2&858993459))+(r>>4)&252645135)>>24}else e=this.geoDict[i]||0;return 0===e?2188972:1===e?16703627:2===e?16018755:e>=3?10813478:9474192},e}(Ns);yc.add("geoquality",sm);var cm=function(t){function e(e){var i;t.call(this,e),e.scale||(this.scale="RdYlGn");var r={};for(i in vl)r[i]=vl[i][0];if(!e.domain){var n,o=1/0,a=-1/0;for(i in r)n=r[i],o=Math.min(o,n),a=Math.max(a,n);this.domain=[o,0,a]}var s=this.getScale();this.atomColor=function(t){return s(r[t.resname]||yl)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("hydrophobicity",cm);var um=function(t){function e(e){t.call(this,e),e.scale||(this.scale="rainbow"),e.domain||(this.domain=[0,this.structure.modelStore.count]);var i=this.getScale();this.atomColor=function(t){return i(t.modelIndex)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("modelindex",um);var hm=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){switch(t.residueType.moleculeType){case 1:return 3697840;case 2:return 15729279;case 3:return 12496596;case 4:return 16629894;case 5:return 12540695;case 6:return 8374655;default:return 16777113}},e}(Ns);yc.add("moleculetype",hm);var lm=function(t){function e(e){t.call(this,e),e.scale||(this.scale="PuBu"),e.domain||(this.domain=[0,1]);var i=this.getScale();this.atomColor=function(t){return i(t.occupancy)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);function pm(){return 16777215*Math.random()}yc.add("occupancy",lm);var dm=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(){return pm()},e.prototype.volumeColor=function(){return pm()},e.prototype.positionColor=function(){return pm()},e}(Ns);yc.add("random",dm);var fm=function(t){function e(e){var i=this;if(t.call(this,e),e.scale||(this.scale="rainbow",this.reverse=Eo(e.reverse,!0)),e.domain){var r=this.getScale();this.atomColor=function(t){return r(t.residueIndex)}}else{var n={};this.structure.eachChain((function(t){i.domain=[t.residueOffset,t.residueEnd],n[t.index]=i.getScale()})),this.atomColor=function(t){return n[t.chainIndex](t.residueIndex)}}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("residueindex",fm);var mm={ALA:9240460,ARG:124,ASN:16743536,ASP:10485826,CYS:16777072,GLN:16731212,GLU:6684672,GLY:16777215,HIS:7368959,ILE:19456,LEU:4546117,LYS:4671416,MET:12099650,PHE:5459026,PRO:5395026,SER:16740418,THR:12078080,TRP:5195264,TYR:9203788,VAL:16747775,ASX:16711935,GLX:16711935,ASH:16711935,GLH:16711935,A:10526975,G:16740464,I:8454143,C:16747595,T:10551200,U:16744576,DA:10526975,DG:16740464,DI:8454143,DC:16747595,DT:10551200,DU:16744576},gm=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){return mm[t.resname]||16711935},e}(Ns);yc.add("resname",gm);var vm=16711808,ym=10485888,bm=6291584,xm=16762880,_m=6324479,wm=16777215,Sm=11403518,Am=16580962,Mm=10921722,Pm=function(t){function e(e){t.call(this,e),this.rp=this.structure.getResidueProxy()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.sstruc,i=this.rp;return"h"===e?vm:"g"===e?ym:"i"===e?bm:"e"===e||"b"===e?xm:"t"===e?_m:(i.index=t.residueIndex,i.isDna()?Sm:i.isRna()?Am:i.isSaccharide()?Mm:i.isProtein()||"s"===e||"l"===e?wm:8421504)},e}(Ns);yc.add("sstruc",Pm);var Tm=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(){return this.value},e.prototype.bondColor=function(){return this.value},e.prototype.valueColor=function(){return this.value},e.prototype.volumeColor=function(){return this.value},e}(Ns);yc.add("uniform",Tm);var Em=function(t){function e(e){t.call(this,e),this.valueScale=this.getScale()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.volumeColor=function(t){return this.valueScale(this.volume.data[t])},e}(Ns);yc.add("value",Em);var Cm=function(t){function e(e){t.call(this,e);var i=this.volume;if(i&&i.inverseMatrix){var r=this.getScale(),n=i.inverseMatrix,o=i.data,a=i.nx,s=i.ny,c=a*s,u=new O;this.positionColor=function(t){u.copy(t),u.applyMatrix4(n);var e=Math.floor(u.x),i=Math.floor(u.y),h=Math.floor(u.z),l=(h*s+i)*a+e,p=l+1,d=l+a,f=l+c,m=d+1,g=f+1,v=d+c,y=v+1,b=o[l],x=o[p],_=o[d],w=o[f],S=o[m],A=o[g],M=o[v],P=o[y],T=u.x-e,E=u.y-i,C=u.z-h,I=Cs(b,x,T),R=Cs(w,A,T),L=Cs(_,S,T),O=Cs(M,P,T),N=Cs(I,L,E),D=Cs(R,O,E),k=Cs(N,D,C);return r(k)}}else{var h=this.value;this.positionColor=function(){return h}}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.positionColor=function(){},e}(Ns);yc.add("volume",Cm);var Im=function(t){function e(e,i,r){var n=this,o=r||{};o.name=Eo(o.name,i.name),t.call(this,e,o),this.script=i,this.status="loaded",this.script.signals.nameChanged.add((function(t){n.setName(t)}))}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"script"},e.prototype.addRepresentation=function(){},e.prototype.removeRepresentation=function(){},e.prototype.run=function(){var t=this;this.setStatus("running"),this.script.call(this.stage).then((function(){t.setStatus("finished")})),this.setStatus("called")},e.prototype.dispose=function(){this.signals.disposed.dispatch()},e.prototype.setVisibility=function(){},e.prototype.getCenter=function(){},e.prototype.getZoom=function(){},e.prototype.getBox=function(){},Object.defineProperties(e.prototype,i),e}(kf);Ac.add("script",Im);var Rm=function(t){function e(e,i,r){var n=r||{};n.name=Eo(n.name,i.name),t.call(this,e,n),this.shape=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"shape"},e.prototype.addRepresentation=function(e,i){return t.prototype.addRepresentation.call(this,e,this.shape,i)},e.prototype.getBoxUntransformed=function(){return this.shape.boundingBox},e.prototype.getCenterUntransformed=function(){return this.shape.center},e.prototype.dispose=function(){this.shape.dispose(),t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,i),e}(kf);Ac.add("shape",Rm);var Lm=function(t){function e(e,i,r,n){var o=this,a=r||{};a.name=Eo(a.name,i.name),t.call(this,e,a),this.signals=Object.assign(this.signals,{frameChanged:new Fs,playerChanged:new Fs,gotNumframes:new Fs,parametersChanged:new Fs}),this.trajectory=i,this.parent=n,this.status="loaded",this.defaultStep=Eo(a.defaultStep,void 0),this.defaultTimeout=Eo(a.defaultTimeout,50),this.defaultInterpolateType=Eo(a.defaultInterpolateType,""),this.defaultInterpolateStep=Eo(a.defaultInterpolateStep,5),this.defaultMode=Eo(a.defaultMode,"loop"),this.defaultDirection=Eo(a.defaultDirection,"forward"),i.signals.frameChanged.add((function(t){o.signals.frameChanged.dispatch(t)})),i.signals.playerChanged.add((function(t){o.signals.playerChanged.dispatch(t)})),i.signals.gotNumframes.add((function(t){o.signals.gotNumframes.dispatch(t)})),void 0!==a.initialFrame&&this.setFrame(a.initialFrame)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"trajectory"},e.prototype.addRepresentation=function(e,i){return t.prototype.addRepresentation.call(this,e,this.trajectory,i)},e.prototype.setFrame=function(t){this.trajectory.setFrame(t)},e.prototype.setParameters=function(t){this.trajectory.setParameters(t),this.signals.parametersChanged.dispatch(t)},e.prototype.dispose=function(){this.trajectory.dispose(),t.prototype.dispose.call(this)},e.prototype.getCenter=function(){},Object.defineProperties(e.prototype,i),e}(kf),Om=function(t){function e(e,i,r){t.call(this,"",i,r),this.name=e.name,this.path=e.path,this.frames=e.coordinates,this.boxes=e.boxes,this.getNumframes()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"frames"},e.prototype.makeAtomIndices=function(){"StructureView"===this.structure.type?this.atomIndices=this.structure.getAtomIndices():this.atomIndices=null},e.prototype._loadFrame=function(t,e){var i,r=this.frames[t];if(this.atomIndices){var n=this.atomIndices,o=n.length;i=new Float32Array(3*o);for(var a=0;a<o;++a){var s=3*a,c=3*n[a];i[s+0]=r[c+0],i[s+1]=r[c+1],i[s+2]=r[c+2]}}else i=new Float32Array(r);var u=this.boxes[t],h=this.frames.length;this.process(t,u,i,h),"function"==typeof e&&e()},e.prototype.getNumframes=function(){this.frames&&this.setNumframes(this.frames.length)},e.prototype.getPath=function(t,e){var i,r,n,o=this.numframes,a=3*t,s=new Float32Array(3*o);for(i=0;i<o;++i)r=3*i,n=this.frames[i],s[r+0]=n[a+0],s[r+1]=n[a+1],s[r+2]=n[a+2];e(s)},Object.defineProperties(e.prototype,i),e}(gd),Nm=function(t){function e(e,i,r){t.call(this,"",i,r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"structure"},e.prototype.makeAtomIndices=function(){this.structure.atomSet.getSize()<this.structure.atomStore.count?this.atomIndices=this.structure.getAtomIndices():this.atomIndices=null},e.prototype._loadFrame=function(t,e){var i,r=this.structure,n=r.frames[t];if(this.atomIndices){var o=this.atomIndices,a=o.length;i=new Float32Array(3*a);for(var s=0;s<a;++s){var c=3*s,u=3*o[s];i[c+0]=n[u+0],i[c+1]=n[u+1],i[c+2]=n[u+2]}}else i=new Float32Array(n);var h=r.boxes[t],l=r.frames.length;this.process(t,h,i,l),"function"==typeof e&&e()},e.prototype.getNumframes=function(){this.setNumframes(this.structure.frames.length)},e.prototype.getPath=function(t,e){var i,r,n,o=this.numframes,a=3*t,s=new Float32Array(3*o);for(i=0;i<o;++i)r=3*i,n=this.structure.frames[i],s[r+0]=n[a+0],s[r+1]=n[a+1],s[r+2]=n[a+2];e(s)},Object.defineProperties(e.prototype,i),e}(gd),Dm=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"remote"},e.prototype.makeAtomIndices=function(){var t=[];if("StructureView"===this.structure.type){var e,i,r=this.structure.getAtomIndices(),n=r[0],o=r[0],a=r.length;for(e=1;e<a;++e)o+1<(i=r[e])&&(t.push([n,o+1]),n=i),o=i;t.push([n,o+1])}else t.push([0,this.atomCount]);this.atomIndices=t},e.prototype._loadFrame=function(t,e){var i=new window.XMLHttpRequest,r=bc.trajectory,n=r.getFrameUrl(this.trajPath,t),o=r.getFrameParams(this.trajPath,this.atomIndices);i.open("POST",n,!0),i.responseType="arraybuffer",i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.addEventListener("load",function(){var r=i.response;if(r){var o=new Int32Array(r,0,1)[0],a=new Float32Array(r,8,9),s=new Float32Array(r,44);this.process(t,a,s,o),"function"==typeof e&&e()}else mc.error("empty arrayBuffer for '"+n+"'")}.bind(this),!1),i.send(o)},e.prototype.getNumframes=function(){var t=new window.XMLHttpRequest,e=bc.trajectory.getNumframesUrl(this.trajPath);t.open("GET",e,!0),t.addEventListener("load",function(){this.setNumframes(parseInt(t.response))}.bind(this),!1),t.send(null)},e.prototype.getPath=function(t,e){if(this.pathCache[t])e(this.pathCache[t]);else{mc.time("loadPath");var i=new window.XMLHttpRequest,r=bc.trajectory.getPathUrl(this.trajPath,t);i.open("POST",r,!0),i.responseType="arraybuffer",i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.addEventListener("load",function(){mc.timeEnd("loadPath");var n=i.response;if(n){var o=new Float32Array(n);this.pathCache[t]=o,e(o)}else mc.error("empty arrayBuffer for '"+r+"'")}.bind(this),!1),i.send("")}},Object.defineProperties(e.prototype,i),e}(gd);ld.prototype.getView=function(t){return new km(this,t)};var km=function(t){function e(e,i){t.call(this),this.structure=e,this.selection=i,this.center=new O,this.boundingBox=new jt,this._bp=this.getBondProxy(),this._ap=this.getAtomProxy(),this._rp=this.getResidueProxy(),this._cp=this.getChainProxy(),this.selection&&this.selection.signals.stringChanged.add(this.refresh,this),this.structure.signals.refreshed.add(this.refresh,this),this.refresh()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},name:{},path:{},title:{},id:{},atomSetDict:{},biomolDict:{},entityList:{},unitcell:{},frames:{},boxes:{},validation:{},bondStore:{},backboneBondStore:{},rungBondStore:{},atomStore:{},residueStore:{},chainStore:{},modelStore:{},atomMap:{},residueMap:{},bondHash:{},spatialHash:{}};return e.prototype.init=function(){},i.type.get=function(){return"StructureView"},i.name.get=function(){return this.structure.name},i.path.get=function(){return this.structure.path},i.title.get=function(){return this.structure.title},i.id.get=function(){return this.structure.id},i.atomSetDict.get=function(){return this.structure.atomSetDict},i.biomolDict.get=function(){return this.structure.biomolDict},i.entityList.get=function(){return this.structure.entityList},i.unitcell.get=function(){return this.structure.unitcell},i.frames.get=function(){return this.structure.frames},i.boxes.get=function(){return this.structure.boxes},i.validation.get=function(){return this.structure.validation},i.bondStore.get=function(){return this.structure.bondStore},i.backboneBondStore.get=function(){return this.structure.backboneBondStore},i.rungBondStore.get=function(){return this.structure.rungBondStore},i.atomStore.get=function(){return this.structure.atomStore},i.residueStore.get=function(){return this.structure.residueStore},i.chainStore.get=function(){return this.structure.chainStore},i.modelStore.get=function(){return this.structure.modelStore},i.atomMap.get=function(){return this.structure.atomMap},i.residueMap.get=function(){return this.structure.residueMap},i.bondHash.get=function(){return this.structure.bondHash},i.spatialHash.get=function(){return this.structure.spatialHash},e.prototype.refresh=function(){for(var t in gc&&mc.time("StructureView.refresh"),this.atomSetCache={},this.atomSet=this.getAtomSet(this.selection,!0),this.structure.atomSet&&(this.atomSet=this.atomSet.intersection(this.structure.atomSet)),this.bondSet=this.getBondSet(),this.atomSetDict){var e=this.atomSetDict[t];this.atomSetCache["__"+t]=e.makeIntersection(this.atomSet)}this.atomCount=this.atomSet.getSize(),this.bondCount=this.bondSet.getSize(),this.boundingBox=this.getBoundingBox(),this.center=this.boundingBox.getCenter(),gc&&mc.timeEnd("StructureView.refresh"),this.signals.refreshed.dispatch()},e.prototype.setSelection=function(t){this.selection=t,this.refresh()},e.prototype.getSelection=function(t){var e=[];t&&t.string&&e.push(t.string);var i=this.structure.getSelection();i&&i.string&&e.push(i.string),this.selection&&this.selection.string&&e.push(this.selection.string);var r="";return e.length>0&&(r="( "+e.join(" ) AND ( ")+" )"),new nc(r)},e.prototype.getStructure=function(){return this.structure.getStructure()},e.prototype.eachBond=function(t,e){this.structure.eachBond(t,this.getSelection(e))},e.prototype.eachAtom=function(t,e){var i=this.getAtomProxy(),r=this.getAtomSet(e),n=this.atomStore.count;if(r.getSize()<n)r.forEach((function(e){i.index=e,t(i)}));else for(var o=0;o<n;++o)i.index=o,t(i)},e.prototype.eachResidue=function(t,e){this.structure.eachResidue(t,this.getSelection(e))},e.prototype.eachResidueN=function(){console.error("StructureView.eachResidueN() not implemented")},e.prototype.eachChain=function(t,e){this.structure.eachChain(t,this.getSelection(e))},e.prototype.eachModel=function(t,e){this.structure.eachModel(t,this.getSelection(e))},e.prototype.getAtomSet=function(t,e){var i=this.structure.getAtomSet(t);return!e&&this.atomSet&&(i=i.makeIntersection(this.atomSet)),i},e.prototype.getAtomIndices=function(t){return this.structure.getAtomIndices(this.getSelection(t))},e.prototype.refreshPosition=function(){return this.structure.refreshPosition()},e.prototype.dispose=function(){this.selection&&this.selection.signals.stringChanged.remove(this.refresh,this),this.structure.signals.refreshed.remove(this.refresh,this),delete this.structure,delete this.atomSet,delete this.bondSet,delete this.atomCount,delete this.bondCount},Object.defineProperties(e.prototype,i),e}(ld),Fm=function(t){function e(e,i,r){var n=r||{};n.name=Eo(n.name,i.name),t.call(this,e,n),this.signals=Object.assign(this.signals,{trajectoryAdded:new Fs,trajectoryRemoved:new Fs,defaultAssemblyChanged:new Fs}),this.structure=i,this.trajList=[],this.initSelection(n.sele),this.setDefaultAssembly(n.assembly||"")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"structure"},e.prototype.initSelection=function(t){var e=this;this.selection=new nc(t),this.structureView=new km(this.structure,this.selection),this.selection.signals.stringChanged.add((function(){e.structureView.setSelection(e.selection),e.rebuildRepresentations(),e.rebuildTrajectories()}))},e.prototype.setSelection=function(t){return this.selection.setString(t),this},e.prototype.setDefaultAssembly=function(t){var e=this;this.defaultAssembly=t,this.reprList.forEach((function(t){t.setParameters({defaultAssembly:e.defaultAssembly})})),this.signals.defaultAssemblyChanged.dispatch(t)},e.prototype.rebuildRepresentations=function(){this.reprList.forEach((function(t){t.build()}))},e.prototype.rebuildTrajectories=function(){var t=this;this.trajList.slice().forEach((function(e){e.trajectory.setStructure(t.structureView)}))},e.prototype.addRepresentation=function(e,i){var r=i||{};return r.defaultAssembly=this.defaultAssembly,t.prototype.addRepresentation.call(this,e,this.structureView,r)},e.prototype.addTrajectory=function(t,e){var i=this,r=function(t,e,i){return t&&"Frames"===t.type?new Om(t,e,i):!t&&e.frames?new Nm(t,e,i):new Dm(t,e,i)}(t,this.structureView,e);r.signals.frameChanged.add((function(){i.updateRepresentations({position:!0})}));var n=new Lm(this.stage,r,e,this);return this.trajList.push(n),this.signals.trajectoryAdded.dispatch(n),n},e.prototype.removeTrajectory=function(t){var e=this.trajList.indexOf(t);-1!==e&&this.trajList.splice(e,1),t.dispose(),this.signals.trajectoryRemoved.dispatch(t)},e.prototype.dispose=function(){this.trajList.slice().forEach((function(t){t.dispose()})),this.trajList.length=0,this.structure.dispose(),t.prototype.dispose.call(this)},e.prototype.autoView=function(t,e){Number.isInteger(t)&&(e=t,t=void 0),this.stage.animationControls.zoomMove(this.getCenter(t),this.getZoom(t),Eo(e,0))},e.prototype.getBoxUntransformed=function(t){return t?this.structureView.getBoundingBox(new nc(t)):this.structureView.boundingBox},e.prototype.getCenterUntransformed=function(t){return t&&"string"==typeof t?this.structure.atomCenter(new nc(t)):this.structure.center},e.prototype.superpose=function(t,e,i,r){return function(t,e,i,r,n){var o,a,s,c,u;if(i=Eo(i,!1),r=Eo(r,""),n=Eo(n,""),i){var h=t,l=e;r&&n&&(h=t.getView(new nc(r)),l=e.getView(new nc(n)));var p,d,f,m,g,v=h.getSequence(),y=l.getSequence(),b=new qf(v.join(""),y.join(""));b.calc(),b.trace(),o=0,a=0,s=b.ali1.length;var x=[],_=[];for(p=0;p<s;++p)m=b.ali1[p],g=b.ali2[p],d=0,f=0,"-"===m?_[a]=!1:(_[a]=!0,d=1),"-"===g?x[o]=!1:(x[o]=!0,f=1),o+=d,a+=f;var w=[],S=[],A=h.getAtomProxy(),M=l.getAtomProxy();o=0,h.eachResidue((function(t){void 0!==t.traceAtomIndex&&t.traceAtomIndex===t.getAtomIndexByName("CA")&&(x[o]&&(A.index=t.getAtomIndexByName("CA"),w.push(A.x,A.y,A.z)),o+=1)})),o=0,l.eachResidue((function(t){void 0!==t.traceAtomIndex&&t.traceAtomIndex===t.getAtomIndexByName("CA")&&(_[o]&&(M.index=t.getAtomIndexByName("CA"),S.push(M.x,M.y,M.z)),o+=1)})),c=new Float32Array(w),u=new Float32Array(S)}else{c=t.getView(new nc(r+" and .CA")),u=e.getView(new nc(n+" and .CA"))}new fd(c,u).transform(t),t.refreshPosition()}(this.structureView,t.structureView,e,i,r),this.updateRepresentations({position:!0}),this},e.prototype.setVisibility=function(e){return t.prototype.setVisibility.call(this,e),this.trajList.forEach((function(t){t.setVisibility(e)})),this},Object.defineProperties(e.prototype,i),e}(kf);Ac.add("structure",Fm),Ac.add("structureview",Fm);var Bm=function(t){function e(e,i,r){var n=r||{};n.name=Eo(n.name,i.name),t.call(this,e,n),this.surface=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"surface"},e.prototype.addRepresentation=function(e,i){return t.prototype.addRepresentation.call(this,e,this.surface,i)},e.prototype.getBoxUntransformed=function(){return this.surface.boundingBox},e.prototype.getCenterUntransformed=function(){return this.surface.center},e.prototype.dispose=function(){this.surface.dispose(),t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,i),e}(kf);Ac.add("surface",Bm);var zm=function(t){function e(e,i,r){var n=r||{};n.name=Eo(n.name,i.name),t.call(this,e,n),this.volume=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"volume"},e.prototype.addRepresentation=function(e,i){return t.prototype.addRepresentation.call(this,e,this.volume,i)},e.prototype.getBoxUntransformed=function(){return this.volume.boundingBox},e.prototype.getCenterUntransformed=function(){return this.volume.center},e.prototype.dispose=function(){this.volume.dispose(),t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,i),e}(kf);Ac.add("volume",zm);var Um=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="axes",this.parameters=Object.assign({radius:{type:"number",precision:3,max:10,min:.001},sphereDetail:!0,radialSegments:!0,disableImpostor:!0,showAxes:{type:"boolean",rebuild:!0},showBox:{type:"boolean",rebuild:!0}},this.parameters,{assembly:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.radius=Eo(i.radius,.5),i.colorValue=Eo(i.colorValue,"lightgreen"),this.showAxes=Eo(i.showAxes,!0),this.showBox=Eo(i.showBox,!1),t.prototype.init.call(this,i)},e.prototype.getPrincipalAxes=function(){var t,e=this.getAssembly();return e&&(t=e.partList[0].getSelection()),this.structureView.getPrincipalAxes(t)},e.prototype.getAxesData=function(t){var e=this.getPrincipalAxes(t),i=new St(this.colorValue),r=0,n=0;this.showAxes&&(r+=6,n+=3),this.showBox&&(r+=8,n+=12);var o=new Float32Array(3*r),a=au(r,i.r,i.g,i.b),s=ou(r,this.radius),c=new Float32Array(3*n),u=new Float32Array(3*n),h=au(n,i.r,i.g,i.b),l=ou(n,this.radius),p=0;if(this.showAxes){var d=function(t,e){t.toArray(o,2*p),e.toArray(o,2*p+3),t.toArray(c,p),e.toArray(u,p),p+=3};d(e.begA,e.endA),d(e.begB,e.endB),d(e.begC,e.endC)}if(this.showBox){var f=new O,m=e.getProjectedScaleForAtoms(t),g=m.d1a,v=m.d2a,y=m.d3a,b=m.d1b,x=m.d2b,_=m.d3b;console.log(g,v,y,b,x,_);var w=2*p,S=function(t,i,r){f.copy(e.center).addScaledVector(e.normVecA,t).addScaledVector(e.normVecB,i).addScaledVector(e.normVecC,r),f.toArray(o,w),w+=3};S(g,v,y),S(g,v,_),S(g,x,_),S(g,x,y),S(b,x,_),S(b,x,y),S(b,v,y),S(b,v,_);var A=p,M=function(t,e){f.fromArray(o,2*p+3*t).toArray(c,A),f.fromArray(o,2*p+3*e).toArray(u,A),A+=3};M(0,1),M(0,3),M(0,6),M(1,2),M(1,7),M(2,3),M(2,4),M(3,5),M(4,5),M(4,7),M(5,6),M(6,7)}var P=new Hh(e);return{vertex:{position:o,color:a,radius:s,picking:P},edge:{position1:c,position2:u,color:h,color2:h,radius:l,picking:P}}},e.prototype.create=function(){var t=this.getAxesData(this.structureView);this.sphereBuffer=new Od(t.vertex,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0})),this.cylinderBuffer=new qd(t.edge,this.getBufferParams({openEnded:!0,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bufferList:[this.sphereBuffer,this.cylinderBuffer]})},e.prototype.updateData=function(t,e){var i=this.getAxesData(e.sview),r={},n={};t&&!t.position||(r.position=i.vertex.position,n.position1=i.edge.position1,n.position2=i.edge.position2),t&&!t.color||(r.color=i.vertex.color,n.color=i.edge.color,n.color2=i.edge.color),t&&!t.radius||(r.radius=i.vertex.radius,n.radius=i.edge.radius),this.sphereBuffer.setAttributes(r),this.cylinderBuffer.setAttributes(n)},e}(Cf);xc.add("axes",Um);var jm=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="ball+stick",this.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}},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.radius=Eo(i.radius,.15),this.aspectRatio=Eo(i.aspectRatio,2),this.lineOnly=Eo(i.lineOnly,!1),this.cylinderOnly=Eo(i.cylinderOnly,!1),this.multipleBond=Eo(i.multipleBond,"off"),this.bondSpacing=Eo(i.bondSpacing,1),this.bondScale=Eo(i.bondScale,.4),t.prototype.init.call(this,i)},e.prototype.getAtomParams=function(e,i){return i=Object.assign({radiusParams:{radius:this.radius,scale:this.scale*this.aspectRatio}},i),t.prototype.getAtomParams.call(this,e,i)},e.prototype.getAtomData=function(t,e,i){return t.getAtomData(this.getAtomParams(e,i))},e.prototype.getBondParams=function(e,i){return i=Object.assign({multipleBond:this.multipleBond,bondSpacing:this.bondSpacing,bondScale:this.bondScale},i),t.prototype.getBondParams.call(this,e,i)},e.prototype.getBondData=function(t,e,i){return t.getBondData(this.getBondParams(e,i))},e.prototype.createData=function(t){var e=this.getBondData(t),i=[];if(this.lineOnly)this.lineBuffer=new If(e,this.getBufferParams()),i.push(this.lineBuffer);else{var r=new qd(e,this.getBufferParams({openEnded:this.openEnded,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}));if(i.push(r),!this.cylinderOnly){var n=new Od(this.getAtomData(t),this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0}));i.push(n)}}return{bufferList:i}},e.prototype.updateData=function(t,e){"off"!==this.multipleBond&&t&&t.radius&&(t.position=!0);var i=this.getBondData(e.sview,t);if(this.lineOnly){var r={};t&&!t.position||(r.position1=i.position1,r.position2=i.position2),t&&!t.color||(r.color=i.color,r.color2=i.color2),e.bufferList[0].setAttributes(r)}else{var n={};if(t&&!t.position||(n.position1=i.position1,n.position2=i.position2),t&&!t.color||(n.color=i.color,n.color2=i.color2),t&&!t.radius||(n.radius=i.radius),e.bufferList[0].setAttributes(n),!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)}}},e.prototype.setParameters=function(e){var i=!1,r={};return e&&(e.aspectRatio||e.bondSpacing||e.bondScale)&&(r.radius=!0,dc&&!this.disableImpostor||(i=!0)),t.prototype.setParameters.call(this,e,r,i),this},e}(Cf);xc.add("ball+stick",jm);var Gm=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="backbone",this.parameters=Object.assign({},this.parameters,{multipleBond:null,bondSpacing:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.aspectRatio=Eo(i.aspectRatio,1),i.radius=Eo(i.radius,.25),t.prototype.init.call(this,i)},e.prototype.getAtomData=function(t,e,i){return t.getBackboneAtomData(this.getAtomParams(e,i))},e.prototype.getBondData=function(t,e,i){return t.getBackboneBondData(this.getBondParams(e,i))},e}(jm);xc.add("backbone",Gm);var Vm=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="base",this.parameters=Object.assign({},this.parameters,{multipleBond:null,bondSpacing:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.aspectRatio=Eo(i.aspectRatio,1),i.radius=Eo(i.radius,.3),t.prototype.init.call(this,i)},e.prototype.getAtomData=function(t,e,i){return t.getRungAtomData(this.getAtomParams(e,i))},e.prototype.getBondData=function(t,e,i){var r=this.getBondParams(e,i);return r.colorParams.rung=!0,t.getRungBondData(r)},e}(jm);function $m(t,e){var i=1/t,r=new O,n=new O;function o(t,i,r,n,o,a,s){a[s+0]=Is(t.x,i.x,r.x,n.x,o,e),a[s+1]=Is(t.y,i.y,r.y,n.y,o,e),a[s+2]=Is(t.z,i.z,r.z,n.z,o,e)}function a(t,i,r,n,o,a){a.x=Is(t.x,i.x,r.x,n.x,o,e),a.y=Is(t.y,i.y,r.y,n.y,o,e),a.z=Is(t.z,i.z,r.z,n.z,o,e)}function s(e,r,n,a,s,c){for(var u=0;u<t;++u){o(e,r,n,a,i*u,s,c+3*u)}}function c(e,o,s,c,u,h){for(var l=0;l<t;++l){var p=i*l,d=p-1e-4,f=p+1e-4,m=h+3*l;d<0&&(d=0),f>1&&(f=1),a(e,o,s,c,d,r),a(e,o,s,c,f,n),n.sub(r).normalize(),n.toArray(u,m)}}function u(e,i,r,n,o){for(var a=i.next(),s=i.next(),c=i.next(),u=i.size,h=u-1,l=n||0,p=0;p<h;++p)e(a,a=s,s=c,c=i.next(),r,l),l+=3*t;o&&(e(i.get(u-2),a=i.get(u-1),s=i.get(0),c=i.get(1),r,l),l+=3*t)}this.getPosition=function(e,i,r,n){e.reset(),u(s,e,i,r,n);var o=e.size-1,a=o*t*3;n&&(a+=3*t);var c=e.get(n?0:o);i[a]=c.x,i[a+1]=c.y,i[a+2]=c.z},this.getTangent=function(e,i,r,n){e.reset(),u(c,e,i,r,n);var o=(e.size-1)*t*3;n&&(o+=3*t),uu(i,i,o-3,o,3)};var h=new O,l=new O,p=new O,d=new O,f=Math.ceil(t/2);function m(e,o,s,c,u,m,g,v,y,b,x,_,w){for(var S=0;S<t;++S){var A=_+3*S;w&&(A+=3*f);var M=i*S;a(e,o,s,c,M,r),a(u,m,g,v,M,n),h.subVectors(n,r).normalize(),l.fromArray(y,A),d.crossVectors(h,l).normalize(),d.toArray(x,A),p.crossVectors(l,d).normalize(),p.toArray(b,A)}}function g(e,i,r,n,o){for(var a=0;a<t;++a){var s=o+3*a;e.copy(p),l.fromArray(i,s),d.crossVectors(e,l).normalize(),d.toArray(n,s),p.crossVectors(l,d).normalize(),p.toArray(r,s)}}function v(e,i,r,n,o){var a;for(a=0;a<f;++a)r(e,n,o+3*a);for(a=f;a<t;++a)r(i,n,o+3*a)}function y(e,i,r,n,o){var a;for(a=0;a<f;++a)n[o+a]=r(e);for(a=f;a<t;++a)n[o+a]=r(i)}function b(e,i,r,n,o){for(var a=r(e),s=r(i),c=0;c<t;++c){var u=c/t;n[o+c]=(1-u)*a+u*s}}this.getNormal=function(e,i,r,n,o,a){p.set(0,0,1);for(var s=e-1,c=o||0,u=0;u<s;++u)g(h,i,r,n,c),c+=3*t;a&&(g(h,i,r,n,c),c+=3*t),d.toArray(n,c),p.toArray(r,c)},this.getNormalDir=function(e,i,r,n,o,a,s,c){e.reset(),i.reset();var u=new O,h=new O,l=new O,g=new O,v=new O,y=(new O).copy(e.next()),b=(new O).copy(e.next()),x=(new O).copy(e.next()),_=new O,w=(new O).copy(i.next()),S=(new O).copy(i.next()),A=(new O).copy(i.next());p.set(0,0,1);for(var M=e.size,P=M-1,T=a||0,E=0;E<P;++E)v.copy(y),y.copy(b),b.copy(x),x.copy(e.next()),_.copy(w),w.copy(S),S.copy(A),A.copy(i.next()),0===E?(u.subVectors(_,v),h.subVectors(w,y),u.dot(h)<0&&(h.multiplyScalar(-1),w.addVectors(y,h)),l.subVectors(S,b),h.dot(l)<0&&(l.multiplyScalar(-1),S.addVectors(b,l))):l.copy(g),g.subVectors(A,x),l.dot(g)<0&&(g.multiplyScalar(-1),A.addVectors(x,g)),m(v,y,b,x,_,w,S,A,r,n,o,T,c),T+=3*t;if(s&&(v.copy(e.get(M-2)),y.copy(e.get(M-1)),b.copy(e.get(0)),x.copy(e.get(1)),_.copy(i.get(M-2)),w.copy(i.get(M-1)),S.copy(i.get(0)),A.copy(i.get(1)),l.copy(g),g.subVectors(A,x),l.dot(g)<0&&(g.multiplyScalar(-1),A.addVectors(x,g)),m(v,y,b,x,_,w,S,A,r,n,o,T,c),T+=3*t),c){d.fromArray(o,3*f),p.fromArray(n,3*f);for(var C=0;C<f;++C)d.toArray(o,3*C),p.toArray(n,3*C)}else d.toArray(o,T),p.toArray(n,T)},this.getColor=function(e,i,r,n,o){e.reset(),e.next();for(var a=e.next(),s=e.size,c=s-1,u=n||0,h=0;h<c;++h)v(a,a=e.next(),i,r,u),u+=3*t;o&&(v(e.get(s-1),a=e.get(0),i,r,u),u+=3*t),r[u]=r[u-3],r[u+1]=r[u-2],r[u+2]=r[u-1]},this.getPicking=function(e,i,r,n,o){e.reset(),e.next();for(var a=e.next(),s=e.size,c=s-1,u=n||0,h=0;h<c;++h)y(a,a=e.next(),i,r,u),u+=t;o&&(y(e.get(s-1),a=e.get(0),i,r,u),u+=t),r[u]=r[u-1]},this.getSize=function(e,i,r,n,o){e.reset(),e.next();for(var a=e.next(),s=e.size,c=s-1,u=n||0,h=0;h<c;++h)b(a,a=e.next(),i,r,u),u+=t;o&&(b(e.get(s-1),a=e.get(0),i,r,u),u+=t),r[u]=r[u-1]}}function Hm(t,e){this.polymer=t,this.size=t.residueCount;var i=e||{};this.directional=i.directional||!1,this.positionIterator=i.positionIterator||!1,this.subdiv=i.subdiv||1,this.smoothSheet=i.smoothSheet||!1,isNaN(i.tension)?this.tension=this.polymer.isNucleic()?.5:.9:this.tension=i.tension||.5,this.interpolator=new $m(this.subdiv,this.tension)}xc.add("base",Vm),Hm.prototype={constructor:Hm,getAtomIterator:function(t,e){var i=this.polymer,r=i.structure,n=i.residueCount,o=0,a=-1,s=[r.getAtomProxy(),r.getAtomProxy(),r.getAtomProxy(),r.getAtomProxy()],c=[new O,new O,new O,new O];var u=r.getAtomProxy(),h=r.getAtomProxy();return{size:n,next:function(){var t=this.get(a);return a+=1,t},get:function(r){var a=s[o%4];if(a.index=i.getAtomIndexByType(r,t),e&&r>0&&r<n&&"e"===a.sstruc){var l=c[o%4];return u.index=i.getAtomIndexByType(r+1,t),h.index=i.getAtomIndexByType(r-1,t),l.addVectors(u,h).add(a).add(a).multiplyScalar(.25),o+=1,l}return o+=1,a},reset:function(){o=0,a=-1}}},getSubdividedColor:function(t){var e=this.subdiv,i=this.polymer,r=(i.residueCount-1)*e*3+3;i.isCyclic&&(r+=3*e);var n=new Float32Array(r),o=this.getAtomIterator("trace"),a=t||{};a.structure=i.structure;var s=yc.getScheme(a);return this.interpolator.getColor(o,(function(t,e,i){s.atomColorToArray(t,e,i)}),n,0,i.isCyclic),{color:n}},getSubdividedPicking:function(){var t=this.subdiv,e=this.polymer,i=(e.residueCount-1)*t+1;e.isCyclic&&(i+=t);var r=e.structure,n=this.getAtomIterator("trace"),o=new Float32Array(i);return this.interpolator.getPicking(n,(function(t){return t.index}),o,0,e.isCyclic),{picking:new $h(o,r)}},getSubdividedPosition:function(){return{position:this.getPosition()}},getSubdividedOrientation:function(){var t=this.getTangent(),e=this.getNormals(t);return{tangent:t,normal:e.normal,binormal:e.binormal}},getSubdividedSize:function(t,e){var i=this.subdiv,r=this.polymer,n=(r.residueCount-1)*i+1;r.isCyclic&&(n+=i);var o=new Float32Array(n),a=this.getAtomIterator("trace"),s=new Il(t,e);return this.interpolator.getSize(a,(function(t){return s.atomRadius(t)}),o,0,r.isCyclic),{size:o}},getPosition:function(){var t=this.subdiv,e=this.polymer,i=(e.residueCount-1)*t*3+3;e.isCyclic&&(i+=3*t);var r=new Float32Array(i),n=this.positionIterator||this.getAtomIterator("trace",this.smoothSheet);return this.interpolator.getPosition(n,r,0,e.isCyclic),r},getTangent:function(){var t=this.subdiv,e=this.polymer,i=(this.size-1)*t*3+3;e.isCyclic&&(i+=3*t);var r=new Float32Array(i),n=this.positionIterator||this.getAtomIterator("trace",this.smoothSheet);return this.interpolator.getTangent(n,r,0,e.isCyclic),r},getNormals:function(t){var e=this.subdiv,i=this.polymer,r=i.isProtein(),n=this.size,o=(n-1)*e*3+3;i.isCyclic&&(o+=3*e);var a=new Float32Array(o),s=new Float32Array(o);if(this.directional&&!this.polymer.isCg()){var c=this.getAtomIterator("direction1"),u=this.getAtomIterator("direction2");this.interpolator.getNormalDir(c,u,t,a,s,0,i.isCyclic,r)}else this.interpolator.getNormal(n,t,a,s,0,i.isCyclic,r);return{normal:a,binormal:s}}};var Wm=new O,Xm=new O,qm=function(t){function e(e,i){var r=e||{},n=i||{},o=Eo(n.radialSegments,4),a=Eo(n.capped,!1),s=a?o:0,c=a?o-2:0,u=r.position.length/3,h=u*o*3+2*s*3,l=2*(u-1)*o*3+2*c*3,p=new Float32Array(h),d=new Float32Array(h),f=new Float32Array(h),m=zo(l,h/3);t.call(this,{position:p,color:d,index:m,normal:f,picking:r.picking},n),this.aspectRatio=Eo(n.aspectRatio,1),this.radialSegments=o,this.capped=a,this.capVertices=s,this.capTriangles=c,this.size2=u,r.primitiveId=su(u),this.setAttributes(r),this.meshIndex=m,this.makeIndex()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setAttributes=function(t){var e,i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,P,T,E,C,I,R,L,O,N,D=this.aspectRatio,k=this.size2,F=k-1,B=this.radialSegments,z=this.geometry.attributes;t.position&&(e=t.position,i=t.normal,r=t.binormal,n=t.tangent,a=t.size,c=z.position.array,h=z.normal.array,z.position.needsUpdate=!0,z.normal.needsUpdate=!0),t.color&&(o=t.color,u=z.color.array,z.color.needsUpdate=!0),t.primitiveId&&(s=t.primitiveId,l=z.primitiveId.array,z.primitiveId.needsUpdate=!0);var U=[],j=[],G=[],V=[],$=[],H=[];if(e)for(d=0;d<B;++d)y=d/B*2*Math.PI,U[d]=D*Math.cos(y),j[d]=Math.sin(y),G[d]=D*Math.cos(y-.01),V[d]=Math.sin(y-.01),$[d]=D*Math.cos(y+.01),H[d]=Math.sin(y+.01);for(p=0;p<k;++p)for(m=(f=3*p)*B,e&&(Wm.set(n[f],n[f+1],n[f+2]),P=i[f],T=i[f+1],E=i[f+2],C=r[f],I=r[f+1],R=r[f+2],L=e[f],O=e[f+1],N=e[f+2],M=a[p]),d=0;d<B;++d)g=m+3*d,e&&(b=-M*U[d],x=M*j[d],_=-M*G[d],w=M*V[d],S=-M*$[d],A=M*H[d],c[g]=L+b*P+x*C,c[g+1]=O+b*T+x*I,c[g+2]=N+b*E+x*R,Xm.set(S*P+A*C-(_*P+w*C),S*T+A*I-(_*T+w*I),S*E+A*R-(_*E+w*R)).cross(Wm),h[g]=Xm.x,h[g+1]=Xm.y,h[g+2]=Xm.z),o&&(u[g]=o[f],u[g+1]=o[f+1],u[g+2]=o[f+2]),s&&(l[p*B+d]=s[p]);for(f=0,m=3*k*B,d=0;d<B;++d)g=f+3*d,v=m+3*d,e&&(c[v]=c[g],c[v+1]=c[g+1],c[v+2]=c[g+2],h[v]=n[f],h[v+1]=n[f+1],h[v+2]=n[f+2]),o&&(u[v]=u[g],u[v+1]=u[g+1],u[v+2]=u[g+2]),s&&(l[k*B+d]=l[0+d]);for(f=3*(k-1)*B,m=3*(k+1)*B,d=0;d<B;++d)g=f+3*d,v=m+3*d,e&&(c[v]=c[g],c[v+1]=c[g+1],c[v+2]=c[g+2],h[v]=n[3*F],h[v+1]=n[3*F+1],h[v+2]=n[3*F+2]),o&&(u[v]=u[g],u[v+1]=u[g+1],u[v+2]=u[g+2]),s&&(l[(k+1)*B+d]=l[(k-1)*B+d])},e.prototype.makeIndex=function(){var t,e,i,r,n,o,a=this.meshIndex,s=this.size2,c=s-1,u=this.capTriangles,h=this.radialSegments,l=this.radialSegments+1;for(t=0;t<c;++t)for(e=t*h*3*2,i=t*h,r=(t+1)*h,o=0;o<h;++o)a[n=e+3*o*2]=i+o,a[n+1]=i+(o+1)%h,a[n+2]=r+o,a[n+3]=r+o,a[n+4]=i+(o+1)%h,a[n+5]=r+(o+1)%h;var p=[0];for(o=1;o<l/2;++o)p.push(o),h-o!==o&&p.push(h-o);for(n=c*h*3*2,e=s*h,o=0;o<p.length-2;++o)o%2==0?(a[n+3*o+0]=e+p[o+0],a[n+3*o+1]=e+p[o+1],a[n+3*o+2]=e+p[o+2]):(a[n+3*o+0]=e+p[o+2],a[n+3*o+1]=e+p[o+1],a[n+3*o+2]=e+p[o+0]);for(n=c*h*3*2+3*u,e=s*h+h,o=0;o<p.length-2;++o)o%2==0?(a[n+3*o+0]=e+p[o+0],a[n+3*o+1]=e+p[o+1],a[n+3*o+2]=e+p[o+2]):(a[n+3*o+0]=e+p[o+2],a[n+3*o+1]=e+p[o+1],a[n+3*o+2]=e+p[o+0])},e}(wd),Ym=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="cartoon",this.parameters=Object.assign({aspectRatio:{type:"number",precision:1,max:10,min:1},subdiv:{type:"integer",max:50,min:1,rebuild:!0},radialSegments:{type:"integer",max:50,min:1,rebuild:!0},tension:{type:"number",precision:1,max:1,min:.1},capped:{type:"boolean",rebuild:!0},smoothSheet:{type:"boolean",rebuild:!0}},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"chainname"),i.colorScale=Eo(i.colorScale,"RdYlBu"),i.radius=Eo(i.radius,"sstruc"),i.scale=Eo(i.scale,.7),this.aspectRatio=Eo(i.aspectRatio,5),this.tension=Eo(i.tension,NaN),this.capped=Eo(i.capped,!0),this.smoothSheet=Eo(i.smoothSheet,!1),"low"===i.quality?(this.subdiv=3,this.radialSegments=6):"medium"===i.quality?this.subdiv=6:"high"===i.quality?this.subdiv=12:this.subdiv=Eo(i.subdiv,6),t.prototype.init.call(this,i)},e.prototype.getSplineParams=function(t){return Object.assign({subdiv:this.subdiv,tension:this.tension,directional:1!==this.aspectRatio,smoothSheet:this.smoothSheet},t)},e.prototype.getSpline=function(t){return new Hm(t,this.getSplineParams())},e.prototype.getScale=function(t){return t.isCg()?this.scale*this.aspectRatio:this.scale},e.prototype.getAspectRatio=function(t){return t.isCg()?1:this.aspectRatio},e.prototype.createData=function(t){var e=this,i=[],r=[];return this.structure.eachPolymer((function(t){if(!(t.residueCount<4)){r.push(t);var n=e.getSpline(t),o=n.getSubdividedPosition(),a=n.getSubdividedOrientation(),s=n.getSubdividedColor(e.getColorParams()),c=n.getSubdividedPicking(),u=n.getSubdividedSize(e.radius,e.getScale(t));i.push(new qm(Object.assign({},o,a,s,c,u),e.getBufferParams({radialSegments:e.radialSegments,aspectRatio:e.getAspectRatio(t),capped:e.capped,dullInterior:!0})))}}),t.getSelection()),{bufferList:i,polymerList:r}},e.prototype.updateData=function(t,e){gc&&mc.time(this.type+" repr update"),t=t||{};for(var i=0,r=e.polymerList.length;i<r;++i){var n={},o=e.polymerList[i],a=this.getSpline(o);if(e.bufferList[i].aspectRatio=this.getAspectRatio(o),t.position||t.radius){var s=a.getSubdividedPosition(),c=a.getSubdividedOrientation(),u=a.getSubdividedSize(this.radius,this.getScale(o));n.position=s.position,n.normal=c.normal,n.binormal=c.binormal,n.tangent=c.tangent,n.size=u.size}if(t.color){var h=a.getSubdividedColor(this.getColorParams());n.color=h.color}if(t.picking){var l=a.getSubdividedPicking();n.picking=l.picking}e.bufferList[i].setAttributes(n)}gc&&mc.timeEnd(this.type+" repr update")},e.prototype.setParameters=function(e){var i={};return e&&e.aspectRatio&&(i.radius=!0),e&&e.tension&&(i.position=!0),t.prototype.setParameters.call(this,e,i,!1),this},e}(Cf);xc.add("cartoon",Ym);var Zm=function(t,e){this.sview1=t,this.sview2=e,this.kdtree2=new Tp(e)};function Km(t,e,i){e=e||3.5,i=i||40;for(var r=new nc("( 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 )"),n=new nc("( 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(r),a=t.getView(n),s=new Zm(o,a).within(e),c=s.bondStore,u=t.getAtomProxy(),h=t.getAtomProxy(),l=t.getAtomProxy(),p=t.getAtomProxy(),d=t.getResidueProxy(),f=t.getResidueProxy(),m=new O,g=new O,v=function(t,e,r,n){var o,a;t.atomname===r?(o=t,a=e):(o=e,a=t),d.index=o.residueIndex;var s=d.getAtomIndexByName(n);return m.subVectors(s,o),g.subVectors(s,a),Jo(m.angleTo(g))<i},y=0,b=c.count;y<b;++y)if(u.index=c.atomIndex1[y],h.index=c.atomIndex2[y],"O"===u.atomname&&"N"===h.atomname||"N"===u.atomname&&"O"===h.atomname)s.bondSet.clear(y);else if("N"===u.atomname||"N"===h.atomname){var x,_;if("N"===u.atomname?(x=u,_=h):(x=h,_=u),d.index=x.residueIndex,l.index=d.getAtomIndexByName("CA"),void 0===l.index)continue;var w=d.getPreviousConnectedResidue(f);if(void 0===w)continue;if(p.index=w.getAtomIndexByName("C"),void 0===p.index)continue;m.subVectors(x,p),g.subVectors(x,l),m.add(g).multiplyScalar(.5),g.subVectors(_,x),Jo(m.angleTo(g))>i&&s.bondSet.clear(y)}else("OH"===u.atomname&&"TYR"===u.resname||"OH"===h.atomname&&"TYR"===h.resname)&&(v(u,h,"OH","CZ")||s.bondSet.clear(y));return{atomSet:s.atomSet,bondSet:s.bondSet,bondStore:s.bondStore}}function Qm(t,e,i){e=e||3.5,i=i||40;for(var r=new nc("( PROTEIN and .N )"),n=new nc("( PROTEIN and .O )"),o=t.getView(r),a=t.getView(n),s=new Zm(o,a).within(e),c=s.bondStore,u=t.getAtomProxy(),h=t.getAtomProxy(),l=t.getAtomProxy(),p=t.getAtomProxy(),d=t.getResidueProxy(),f=t.getResidueProxy(),m=new O,g=new O,v=0,y=c.count;v<y;++v){var b,x;if(u.index=c.atomIndex1[v],h.index=c.atomIndex2[v],"N"===u.atomname?(b=u,x=h):(b=h,x=u),d.index=b.residueIndex,l.index=d.getAtomIndexByName("CA"),void 0!==l.index){var _=d.getPreviousConnectedResidue(f);void 0!==_&&(p.index=_.getAtomIndexByName("C"),void 0!==p.index&&(m.subVectors(b,p),g.subVectors(b,l),m.add(g).multiplyScalar(.5),g.subVectors(x,b),Jo(m.angleTo(g))>i&&s.bondSet.clear(v)))}}return{atomSet:s.atomSet,bondSet:s.bondSet,bondStore:s.bondStore}}Zm.prototype.within=function(t,e){mc.time("Contact within");var i=this.kdtree2,r=this.sview1.getAtomProxy(),n=this.sview1.getAtomSet(!1),o=new yp;this.sview1.eachAtom((function(a){for(var s=!1,c=i.nearest(a,1/0,t),u=0,h=c.length;u<h;++u){var l=c[u];r.index=l.index,a.residueIndex!==r.residueIndex&&(!e||l.distance>e)&&(s=!0,n.set(r.index),o.addBond(a,r,1))}s&&n.set(a.index)}));var a=new al(o.count,!0);return mc.timeEnd("Contact within"),{atomSet:n,bondSet:a,bondStore:o}};var Jm=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="contact",this.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},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.radius=Eo(i.radius,.25),this.contactType=Eo(i.contactType,"polarBackbone"),this.maxDistance=Eo(i.maxDistance,3.5),this.maxAngle=Eo(i.maxAngle,40),t.prototype.init.call(this,i)},e.prototype.getContactData=function(t){return{polar:Km,polarBackbone:Qm}[this.contactType](t,this.maxDistance,this.maxAngle)},e.prototype.getBondData=function(t,e,i){var r=t.getBondData(this.getBondParams(e,i));return r.picking&&(r.picking=new Xh(r.picking.array,r.picking.structure,i.bondStore)),r},e.prototype.createData=function(t){var e=this.getContactData(t);return{bufferList:[new qd(this.getBondData(t,void 0,{bondSet:e.bondSet,bondStore:e.bondStore}),this.getBufferParams({openEnded:!1,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}))],bondSet:e.bondSet,bondStore:e.bondStore}},e.prototype.updateData=function(t,e){if(!t||t.position){var i=this.getContactData(e.sview);e.bondSet=i.bondSet,e.bondStore=i.bondStore}var r={bondSet:e.bondSet,bondStore:e.bondStore},n=this.getBondData(e.sview,t,r),o={};t&&!t.position||(o.position=nu(n.position1,n.position2),o.position1=n.position1,o.position2=n.position2),t&&!t.color||(o.color=n.color,o.color2=n.color2),t&&!t.radius||(o.radius=n.radius),e.bufferList[0].setAttributes(o)},e}(Cf);xc.add("contact",Jm);var tg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="distance",this.parameters=Object.assign({labelSize:{type:"number",precision:3,max:10,min:.001},labelColor:{type:"color"},labelVisible:{type:"boolean"},labelZOffset:{type:"number",precision:1,max:20,min:-20,buffer:"zOffset"},labelUnit:{type:"select",rebuild:!0,options:{"":"",angstrom:"angstrom",nm:"nm"}},atomPair:{type:"hidden",rebuild:!0},radialSegments:!0,disableImpostor:!0},this.parameters,{flatShaded:null,assembly:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.radius=Eo(i.radius,.15),this.fontFamily=Eo(i.fontFamily,"sans-serif"),this.fontStyle=Eo(i.fontStyle,"normal"),this.fontWeight=Eo(i.fontWeight,"bold"),this.sdf=Eo(i.sdf,"Firefox"!==hc),this.labelSize=Eo(i.labelSize,2),this.labelColor=Eo(i.labelColor,16777215),this.labelVisible=Eo(i.labelVisible,!0),this.labelZOffset=Eo(i.labelZOffset,.5),this.labelUnit=Eo(i.labelUnit,""),this.atomPair=Eo(i.atomPair,[]),t.prototype.init.call(this,i)},e.prototype.getDistanceData=function(t,e){var i=e.length,r=new Array(i),n=new Float32Array(3*i),o=new nc,a=new nc,s=new yp,c=t.getAtomProxy(),u=t.getAtomProxy(),h=0;e.forEach((function(e,i){var l=e[0],p=e[1];if(Number.isInteger(l)&&Number.isInteger(p))c.index=l,u.index=p;else{o.setString(l),a.setString(p);var d=t.getAtomIndices(o),f=t.getAtomIndices(a);if(!d.length||!f.length)return void(h+=1);c.index=d[0],u.index=f[0]}s.addBond(c,u,1),i-=h;var m=c.distanceTo(u);switch(this.labelUnit){case"angstrom":r[i]=m.toFixed(2)+" "+String.fromCharCode(8491);break;case"nm":r[i]=(m/10).toFixed(2)+" nm";break;default:r[i]=m.toFixed(2)}var g=3*i;n[g+0]=(c.x+u.x)/2,n[g+1]=(c.y+u.y)/2,n[g+2]=(c.z+u.z)/2}),this),h>0&&(i-=h,n=n.subarray(0,3*i));var l=new al(s.count,!0);return{text:r,position:n,bondSet:l,bondStore:s}},e.prototype.getBondData=function(t,e,i){var r=t.getBondData(this.getBondParams(e,i));return r.picking&&(r.picking=new Zh(r.picking.array,r.picking.structure,i.bondStore)),r},e.prototype.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 St(this.labelColor);this.textBuffer=new sf({position:e.position,size:ou(t,this.labelSize),color:au(t,i.r,i.g,i.b),text: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 r={bondSet:e.bondSet,bondStore:e.bondStore},n=this.getBondData(this.structureView,void 0,r);this.cylinderBuffer=new qd(n,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]})}}},e.prototype.update=function(e){e.position?this.build():t.prototype.update.call(this,e)},e.prototype.updateData=function(t,e){var i={bondSet:e.bondSet,bondStore:e.bondStore},r=this.getBondData(e.sview,t,i),n={},o={},a=this.atomPair.length;if(t.labelSize&&(o.size=ou(a,this.labelSize)),t.labelColor){var s=new St(this.labelColor);o.color=au(a,s.r,s.g,s.b)}t.color&&(n.color=r.color,n.color2=r.color2),(t.radius||t.scale)&&(n.radius=r.radius),this.textBuffer.setAttributes(o),this.cylinderBuffer.setAttributes(n)},e.prototype.setVisibility=function(e,i){return t.prototype.setVisibility.call(this,e,!0),this.textBuffer&&this.textBuffer.setVisibility(this.labelVisible&&this.visible),i||this.viewer.requestRender(),this},e.prototype.setParameters=function(e){var i={};return e&&e.labelSize&&(i.labelSize=!0),e&&(e.labelColor||0===e.labelColor)&&(i.labelColor=!0),t.prototype.setParameters.call(this,e,i,!1),e&&void 0!==e.labelVisible&&this.setVisibility(this.visible),this},e}(Cf);xc.add("distance",tg);var eg=function(t){function e(e,i){var r=i||{},n=2*(e.position.length/3),o=new St(Eo(r.color,"grey")),a=new Float32Array(3*n),s=au(n,o.r,o.g,o.b);t.call(this,{position:a,color:s},r),this.scale=Eo(r.scale,1),this.setAttributes(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isLine:{},vertexShader:{},fragmentShader:{}};return e.prototype.setAttributes=function(t){var e,i,r,n=this.geometry.attributes;t.position&&t.vector&&(e=t.position,i=t.vector,r=n.position.array,n.position.needsUpdate=!0);var o,a,s=this.size/2,c=this.scale;if(t.position&&t.vector)for(var u=0;u<s;u++)a=3*u,r[(o=2*u*3)+0]=e[a+0],r[o+1]=e[a+1],r[o+2]=e[a+2],r[o+3]=e[a+0]+i[a+0]*c,r[o+4]=e[a+1]+i[a+1]*c,r[o+5]=e[a+2]+i[a+2]*c},i.isLine.get=function(){return!0},i.vertexShader.get=function(){return"Line.vert"},i.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,i),e}(xd),ig=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="helixorient",this.parameters=Object.assign({sphereDetail:!0,disableImpostor:!0},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"sstruc"),i.radius=Eo(i.radius,.15),i.scale=Eo(i.scale,1),t.prototype.init.call(this,i)},e.prototype.createData=function(t){var e=this,i=[],r=[];return this.structure.eachPolymer((function(t){if(!(t.residueCount<4)){r.push(t);var n=new Sp(t),o=n.getPosition(),a=n.getColor(e.getColorParams()),s=n.getSize(e.radius,e.scale),c=n.getPicking();i.push(new Od({position:o.center,color:a.color,radius:s.size,picking:c.picking},e.getBufferParams({sphereDetail:e.sphereDetail,disableImpostor:e.disableImpostor,dullInterior:!0})),new eg({position:o.center,vector:o.axis},e.getBufferParams({color:"skyblue",scale:1})),new eg({position:o.center,vector:o.resdir},e.getBufferParams({color:"lightgreen",scale:1})))}}),t.getSelection()),{bufferList:i,polymerList:r}},e.prototype.updateData=function(t,e){gc&&mc.time(this.type+" repr update"),t=t||{};for(var i=0,r=e.polymerList.length;i<r;++i){var n=3*i,o={},a=new Sp(e.polymerList[i]);if(t.position){var s=a.getPosition();o.position=s.center,e.bufferList[n+1].setAttributes({position:s.center,vector:s.axis}),e.bufferList[n+2].setAttributes({position:s.center,vector:s.resdir})}e.bufferList[n].setAttributes(o)}gc&&mc.timeEnd(this.type+" repr update")},e}(Cf);xc.add("helixorient",ig);var rg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="licorice",this.parameters=Object.assign({},this.parameters,{aspectRatio:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.aspectRatio=1,t.prototype.init.call(this,i)},e}(jm);xc.add("licorice",rg),wc.add("shader/HyperballStickImpostor.vert","\nattribute vec3 mapping;\nattribute float radius;\nattribute float radius2;\nattribute vec3 position1;\nattribute vec3 position2;\nvarying mat4 matrix_near;\nvarying vec4 prime1;\nvarying vec4 prime2;\nvarying float vRadius;\nvarying float vRadius2;\n#ifdef PICKING\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\nattribute vec3 color2;\nvarying vec3 vColor1;\nvarying vec3 vColor2;\n#endif\nuniform float shrink;\nuniform mat4 modelViewProjectionMatrix;\nuniform mat4 modelViewProjectionMatrixInverse;\nvoid main(){\nvRadius = radius;\nvRadius2 = radius2;\nvec4 spaceposition;\nvec3 position_atom1;\nvec3 position_atom2;\nvec4 vertex_position;\n#ifdef PICKING\nvPickingColor = unpackColor( primitiveId );\n#else\nvColor1 = color;\nvColor2 = color2;\n#endif\nfloat radius1 = radius;\nposition_atom1 = position1;\nposition_atom2 = position2;\nfloat distance = distance( position_atom1, position_atom2 );\nspaceposition.z = mapping.z * distance;\nif (radius1 > 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}"),wc.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;\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\ngl_FragColor = vec4( vPickingColor, objectId );\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}");var ng=new Float32Array([-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,-1,1,-1,1,1,-1,1,1,1,-1,1,1]),og=new Uint16Array([0,1,2,0,2,3,1,5,6,1,6,2,4,6,5,4,7,6,0,7,4,0,3,7,0,5,1,0,4,5,3,2,6,3,6,7]),ag=function(t){function e(e,i){t.call(this,e,i);var r=e||{},n=Eo((i||{}).shrink,.14);this.addUniforms({modelViewProjectionMatrix:{value:new N},modelViewProjectionMatrixInverse:{value:new N},modelViewMatrixInverseTranspose:{value:new N},shrink:{value:n}}),this.addAttributes({position1:{type:"v3",value:null},position2:{type:"v3",value:null},color2:{type:"c",value:null},radius:{type:"f",value:null},radius2:{type:"f",value:null}}),this.setAttributes(r),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={parameters:{},isImpostor:{},vertexShader:{},fragmentShader:{}};return i.parameters.get=function(){return Object.assign.call(this,{shrink:{uniform:!0}},t.prototype.parameters)},i.isImpostor.get=function(){return!0},i.vertexShader.get=function(){return"HyperballStickImpostor.vert"},i.fragmentShader.get=function(){return"HyperballStickImpostor.frag"},Object.defineProperties(e.prototype,i),e}(function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return i.mapping.get=function(){return ng},i.mappingIndices.get=function(){return og},i.mappingIndicesSize.get=function(){return 36},i.mappingType.get=function(){return"v3"},i.mappingSize.get=function(){return 8},i.mappingItemSize.get=function(){return 3},Object.defineProperties(e.prototype,i),e}(Ed)),sg=function(t,e){return!dc||e&&e.disableImpostor?(t.radius=function(t,e){for(var i=t.length,r=new Float32Array(i),n=0;n<i;n++)r[n]=Math.min(t[n],e[n]);return r}(t.radius1,t.radius2),new $d(t,e)):new ag(t,e)},cg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="hyperball",this.parameters=Object.assign({shrink:{type:"number",precision:3,max:1,min:.001,buffer:!0}},this.parameters,{multipleBond:null,bondSpacing:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.scale=Eo(i.scale,.2),i.radius=Eo(i.radius,"vdw"),this.shrink=Eo(i.shrink,.12),t.prototype.init.call(this,i)},e.prototype.getBondParams=function(e,i){return e&&!e.radius||(i=Object.assign({radius2:!0},i)),t.prototype.getBondParams.call(this,e,i)},e.prototype.createData=function(t){var e=new Od(t.getAtomData(this.getAtomParams()),this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0}));return this.__center=new Float32Array(3*t.bondCount),{bufferList:[e,new sg(t.getBondData(this.getBondParams()),this.getBufferParams({shrink:this.shrink,radialSegments:this.radialSegments,dullInterior:!0}))]}},e.prototype.updateData=function(t,e){var i=e.sview.getAtomData(this.getAtomParams()),r=e.sview.getBondData(this.getBondParams()),n={},o={};if(!t||t.position){n.position=i.position;var a=r.position1,s=r.position2;o.position=nu(a,s,this.__center),o.position1=a,o.position2=s}t&&!t.color||(n.color=i.color,o.color=r.color,o.color2=r.color2),t&&!t.radius||(n.radius=i.radius,o.radius=r.radius,o.radius2=r.radius2),e.bufferList[0].setAttributes(n),e.bufferList[1].setAttributes(o)},e}(rg);function ug(t,e){this.type=t,this.text=e||{}}xc.add("hyperball",cg),ug.prototype={constructor:ug,atomLabel:function(t){var e;switch(this.type){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 i=t.resname.toUpperCase();e=(bl[i]||i)+t.resno;break;case"text":e=this.text[t.index];break;default:e=t.qualifiedName()}return void 0===e?"":e}},ug.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"};var hg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="label",this.parameters=Object.assign({labelType:{type:"select",options:ug.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}},this.parameters,{side:null,flatShaded:null,wireframe:null,linewidth:null,roughness:null,metalness:null,diffuse:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};this.labelType=Eo(i.labelType,"res"),this.labelText=Eo(i.labelText,{}),this.fontFamily=Eo(i.fontFamily,"sans-serif"),this.fontStyle=Eo(i.fontStyle,"normal"),this.fontWeight=Eo(i.fontWeight,"bold"),this.sdf=Eo(i.sdf,"Chrome"===hc),this.xOffset=Eo(i.xOffset,0),this.yOffset=Eo(i.yOffset,0),this.zOffset=Eo(i.zOffset,.5),this.attachment=Eo(i.attachment,"bottom-left"),this.showBorder=Eo(i.showBorder,!1),this.borderColor=Eo(i.borderColor,"lightgrey"),this.borderWidth=Eo(i.borderWidth,.15),this.showBackground=Eo(i.showBackground,!1),this.backgroundColor=Eo(i.backgroundColor,"lightgrey"),this.backgroundMargin=Eo(i.backgroundMargin,.5),this.backgroundOpacity=Eo(i.backgroundOpacity,1),t.prototype.init.call(this,i)},e.prototype.createData=function(t){var e=t.getAtomData(this.getAtomParams({position:!0,color:!0,radius:!0})),i=[],r=new ug(this.labelType,this.labelText);return t.eachAtom((function(t){i.push(r.atomLabel(t))})),{bufferList:[new sf({position:e.position,size:e.radius,color:e.color,text:i},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}))]}},e.prototype.updateData=function(t,e){var i=e.sview.getAtomData(this.getAtomParams(t)),r={};t&&!t.position||(r.position=i.position),t&&!t.radius||(r.size=i.radius),t&&!t.color||(r.color=i.color),e.bufferList[0].setAttributes(r)},e}(Cf);xc.add("label",hg);var lg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="line",this.parameters=Object.assign({multipleBond:{type:"select",rebuild:!0,options:{off:"off",symmetric:"symmetric",offset:"offset"}},bondSpacing:{type:"number",precision:2,max:2,min:.5}},this.parameters,{flatShaded:null,side:null,wireframe:null,roughness:null,metalness:null,diffuse:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};this.multipleBond=Eo(i.multipleBond,"off"),this.bondSpacing=Eo(i.bondSpacing,1),t.prototype.init.call(this,i)},e.prototype.getBondParams=function(e,i){return i=Object.assign({multipleBond:this.multipleBond,bondSpacing:this.bondSpacing,radiusParams:{radius:.1,scale:1}},i),t.prototype.getBondParams.call(this,e,i)},e.prototype.createData=function(t){var e=t.getBondData(this.getBondParams({position:!0,color:!0}));return{bufferList:[new If(e,this.getBufferParams())]}},e.prototype.updateData=function(t,e){var i=e.sview.getBondData(this.getBondParams(t)),r={};t&&!t.position||(r.position1=i.position1,r.position2=i.position2),t&&!t.color||(r.color=i.color,r.color2=i.color2),e.bufferList[0].setAttributes(r)},e.prototype.setParameters=function(e){var i={};return e&&e.bondSpacing&&(i.position=!0),t.prototype.setParameters.call(this,e,i,!1),this},e}(Cf);function pg(t,e,i,r,n){var o,a=new(r=r||Int32Array)(t*e*i*(n=n||1));function s(t,r,o){return((t*e+r)*i+o)*n}this.data=a,this.index=s,this.set=function(t,e,i){var r=arguments,c=s(t,e,i);for(o=0;o<n;++o)a[c+o]=r[3+o]},this.toArray=function(t,e,i,r,c){var u=s(t,e,i);for(void 0===r&&(r=[]),void 0===c&&(c=0),o=0;o<n;++o)r[c+o]=a[u+o]},this.fromArray=function(t,e,i,r,c){var u=s(t,e,i);for(void 0===c&&(c=0),o=0;o<n;++o)a[u+o]=r[c+o]},this.copy=function(t){this.data.set(t.data)},this.clone=function(){return new pg(t,e,i,r,n).copy(this)}}function dg(t,e,i){var r=ap(e),n=Sh(t);0===t.length&&(n[0].set([0,0,0]),n[1].set([0,0,0]));var o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x=n[0],_=n[1];function w(t,e,i,n,w){o=e||1.4,a=i||2,g=w||!0;var S=0;for(var M in r)S=Math.max(S,M);var P=sp(x,_,S,a,t?o:0);c=P.dim[0],u=P.dim[1],h=P.dim[2],l=P.matrix,p=P.tran,a=P.scaleFactor,d={},f={},A(t),m=o*a,s=n||o/a,v=new Uint8Array(c*u*h),t&&(y=new Float64Array(c*u*h)),g&&(b=new Int32Array(c*u*h))}var S=[new Int32Array([1,0,0]),new Int32Array([-1,0,0]),new Int32Array([0,1,0]),new Int32Array([0,-1,0]),new Int32Array([0,0,1]),new Int32Array([0,0,-1]),new Int32Array([1,1,0]),new Int32Array([1,-1,0]),new Int32Array([-1,1,0]),new Int32Array([-1,-1,0]),new Int32Array([1,0,1]),new Int32Array([1,0,-1]),new Int32Array([-1,0,1]),new Int32Array([-1,0,-1]),new Int32Array([0,1,1]),new Int32Array([0,1,-1]),new Int32Array([0,-1,1]),new Int32Array([0,-1,-1]),new Int32Array([1,1,1]),new Int32Array([1,1,-1]),new Int32Array([1,-1,1]),new Int32Array([-1,1,1]),new Int32Array([1,-1,-1]),new Int32Array([-1,-1,1]),new Int32Array([-1,1,-1]),new Int32Array([-1,-1,-1])];function A(t){var e,i,n,s,c,u,h,l,p,m;for(var g in r)if(e=r[g],!d[g]){for(u=(h=t?(e+o)*a+.5:e*a+.5)*h,l=Math.floor(h)+1,p=new Int32Array(l*l),m=0,i=0;i<l;++i)for(n=0;n<l;++n)(s=i*i+n*n)>u?p[m]=-1:(c=Math.sqrt(u-s),p[m]=Math.floor(c)),++m;f[g]=l,d[g]=p}}function M(i){var r,n,o,s,l,m,y,x,_,w,S,A,M,P,T,E,C,I,R=3*i,L=i;r=Math.floor(.5+a*(t[R]+p[0])),n=Math.floor(.5+a*(t[R+1]+p[1])),o=Math.floor(.5+a*(t[R+2]+p[2]));var O,N=e[L],D=d[N],k=0,F=u*h,B=f[N];for(w=0;w<B;++w)for(S=0;S<B;++S){if(-1!==(O=D[k]))for(E=-1;E<2;++E)for(C=-1;C<2;++C)for(I=-1;I<2;++I)if(0!==E&&0!==C&&0!==I)for(y=E*w,_=I*S,A=0;A<=O;++A)if(P=n+(x=A*C),T=o+_,!((M=r+y)<0||P<0||T<0||M>=c||P>=u||T>=h)){var z=M*F+P*h+T;if(g)if(1&v[z]){if(1&v[z]){var U=b[z];U!==R&&y*y+x*x+_*_<(s=r+y-Math.floor(.5+a*(t[U]+p[0])))*s+(l=n+x-Math.floor(.5+a*(t[U+1]+p[1])))*l+(m=o+_-Math.floor(.5+a*(t[U+2]+p[2])))*m&&(b[z]=i)}}else v[z]|=1,b[z]=i;else v[z]|=1}k++}}function P(e){var i,r;for(console.time("EDTSurface fillvoxels"),i=0,r=v.length;i<r;++i)v[i]=0,e&&(y[i]=-1),g&&(b[i]=-1);for(i=0,r=t.length/3;i<r;++i)M(i);for(i=0,r=v.length;i<r;++i)1&v[i]&&(v[i]|=2);console.timeEnd("EDTSurface fillvoxels")}function T(i){var r,n,o,s,l,m,y,x,_,w,S,A,M,P,T,E,C,I,R,L=3*i,O=i,N=0;r=Math.floor(.5+a*(t[L]+p[0])),n=Math.floor(.5+a*(t[L+1]+p[1])),o=Math.floor(.5+a*(t[L+2]+p[2]));var D=e[O],k=u*h;for(M=0,R=f[D];M<R;++M)for(P=0;P<R;++P){if(-1!==d[D][N])for(E=-1;E<2;++E)for(C=-1;C<2;++C)for(I=-1;I<2;++I)if(0!==E&&0!==C&&0!==I)for(y=E*M,_=I*P,T=0;T<=d[D][N];++T)if(S=n+(x=T*C),A=o+_,!((w=r+y)<0||S<0||A<0||w>=c||S>=u||A>=h)){var F=w*k+S*h+A;if(2&v[F]){if(g){var B=b[F];y*y+x*x+_*_<(s=Math.floor(.5+a*(t[B]+p[0])))*s+(l=Math.floor(.5+a*(t[B+1]+p[1])))*l+(m=Math.floor(.5+a*(t[B+2]+p[2])))*m&&(b[F]=i)}}else v[F]|=2,g&&(b[F]=i)}N++}}function E(){var t,e,i,r;console.time("EDTSurface fastdistancemap");var n,o=new pg(c,u,h,Uint16Array,3),a=u*h,l=m*m,p=0;for(t=0;t<c;++t)for(e=0;e<u;++e)for(i=0;i<h;++i)v[n=t*a+e*h+i]&=-3,1&v[n]&&4&v[n]&&(o.set(t,e,i,t,e,i),y[n]=0,v[n]|=2,p+=1);var d=new Int32Array(3*p),f=0,x=new Int32Array(3*p),_=0;for(t=0;t<c;++t)for(e=0;e<u;++e)for(i=0;i<h;++i)4&v[n=t*a+e*h+i]&&(d[f]=t,d[f+1]=e,d[f+2]=i,f+=3,v[n]&=-5);do{for(_=C(d,o,f,x),f=0,t=0,r=_;t<r;t+=3)n=a*x[t]+h*x[t+1]+x[t+2],v[n]&=-5,y[n]<=1.0404*l&&(d[f]=x[t],d[f+1]=x[t+1],d[f+2]=x[t+2],f+=3)}while(f>0);var w,S=s*s,A=new Uint16Array(3);for(t=0;t<c;++t)for(e=0;e<u;++e)for(i=0;i<h;++i)v[n=t*a+e*h+i]&=-5,1&v[n]&&(2&v[n]&&!(2&v[n]&&y[n]>=S)||(v[n]|=4,g&&2&v[n]&&(o.toArray(t,e,i,A),w=A[0]*a+A[1]*h+A[2],b[n]=b[w])));console.timeEnd("EDTSurface fastdistancemap")}function C(t,e,i,r){var n,o,a,s,l,p,d,f,m,g,b,x,_=new Uint16Array(3),w=0;if(0===i)return w;var A=-1,M=-1,P=-1,T=u*h;for(d=0,m=i;d<m;d+=3)for(n=t[d],o=t[d+1],a=t[d+2],e.toArray(n,o,a,_),f=0;f<6;++f)A=n+(x=S[f])[0],M=o+x[1],P=a+x[2],A<c&&A>-1&&M<u&&M>-1&&P<h&&P>-1&&(1&v[b=A*T+h*M+P]&&!(2&v[b])?(e.fromArray(A,M,P,_),g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p,y[b]=g,v[b]|=2,v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3):1&v[b]&&2&v[b]&&(g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p)<y[b]&&(e.fromArray(A,M,P,_),y[b]=g,4&v[b]||(v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3)));for(d=0,m=i;d<m;d+=3)for(n=t[d],o=t[d+1],a=t[d+2],e.toArray(n,o,a,_),f=6;f<18;f++)A=n+(x=S[f])[0],M=o+x[1],P=a+x[2],A<c&&A>-1&&M<u&&M>-1&&P<h&&P>-1&&(1&v[b=A*T+h*M+P]&&!(2&v[b])?(e.fromArray(A,M,P,_),g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p,y[b]=g,v[b]|=2,v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3):1&v[b]&&2&v[b]&&(g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p)<y[b]&&(e.fromArray(A,M,P,_),y[b]=g,4&v[b]||(v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3)));for(d=0,m=i;d<m;d+=3)for(n=t[d],o=t[d+1],a=t[d+2],e.toArray(n,o,a,_),f=18;f<26;f++)A=n+(x=S[f])[0],M=o+x[1],P=a+x[2],A<c&&A>-1&&M<u&&M>-1&&P<h&&P>-1&&(1&v[b=A*T+h*M+P]&&!(2&v[b])?(e.fromArray(A,M,P,_),g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p,y[b]=g,v[b]|=2,v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3):1&v[b]&&2&v[b]&&(g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p)<y[b]&&(e.fromArray(A,M,P,_),y[b]=g,4&v[b]||(v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3)));return w}this.getVolume=function(e,r,n,o,a){console.time("EDTSurface.getVolume");var s="vws"!==e;w(s,r,n,o,a),P(s),function(){var t,e,i,r=u*h;for(t=0;t<c;++t)for(e=0;e<h;++e)for(i=0;i<u;++i){var n=t*r+i*h+e;if(1&v[n])for(var o=0;o<26;){var a=t+S[o][0],s=e+S[o][2],l=i+S[o][1];if(a>-1&&a<c&&l>-1&&l<u&&s>-1&&s<h&&!(1&v[a*r+l*h+s])){v[n]|=4;break}o++}}}(),"ms"!==e&&"ses"!==e||E(),"ses"===e&&(A(!1),function(){var e,i;for(e=0,i=v.length;e<i;++e)v[e]&=-3;for(e=0,i=t.length/3;e<i;++e)T(e)}()),function(t){var e,i=v.length;if("vws"===t)for(e=0;e<i;++e)v[e]&=-5,v[e]=2&v[e]?1:0;else if("ms"===t)for(e=0;e<i;++e)v[e]&=-3,4&v[e]&&(v[e]|=2),v[e]&=-5,v[e]=2&v[e]?1:0;else if("ses"===t)for(e=0;e<i;++e)4&v[e]&&2&v[e]?v[e]&=-5:4&v[e]&&!(2&v[e])&&(v[e]|=2),v[e]=2&v[e]?1:0;else if("sas"===t)for(e=0;e<i;++e)v[e]&=-5,v[e]=2&v[e]?1:0}(e);for(var l=0,p=b.length;l<p;++l)b[l]=i[b[l]];return console.timeEnd("EDTSurface.getVolume"),{data:v,nx:h,ny:u,nz:c,atomindex:b}},this.getSurface=function(t,e,i,r,n,o,a){var s=this.getVolume(t,e,i,r,n);return new hp(s.data,s.nx,s.ny,s.nz,s.atomindex).getSurface(1,o,void 0,l,a)}}function fg(t,e,i,r,n,o,a){var s=t.length,c=n[0],u=n[1],h=n[2],l=o[0],p=o[1],d=o[2];function f(t,e){return Math.floor((t-e)/a)}for(var m=f(l,c)+1,g=f(p,u)+1,v=f(d,h)+1,y=m*g*v,b=g*v,x=function(t,e,i){return(f(t,c)*g+f(e,u))*v+f(i,h)},_=[],w=0;w<s;w++){var S=x(t[w],e[w],i[w]);void 0===_[S]?_[S]=[w]:_[S].push(w)}var A=new Uint32Array(y),M=new Uint16Array(y),P=new Uint32Array(s),T=0,E=0;for(w=0;w<y;w++){var C=A[w]=T,I=_[w];if(void 0!==I)for(var R=0;R<I.length;R++)P[T]=I[R],T++;var L=T-C;M[w]=L,L>E&&(E=L)}this.neighbourListLength=27*E+1,this.withinRadii=function(n,o,a,s,l){for(var p=0,d=f(n,c),y=f(o,u),x=f(a,h),_=Math.max(0,d-1),w=Math.max(0,y-1),S=Math.max(0,x-1),T=Math.min(m,d+1),E=Math.min(g,y+1),C=Math.min(v,x+1),I=_;I<=T;++I)for(var R=I*b,L=w;L<=E;++L)for(var O=L*v,N=S;N<=C;++N)for(var D=R+O+N,k=A[D],F=k+M[D],B=k;B<F;B++){var z=P[B],U=t[z]-n,j=e[z]-o,G=i[z]-a,V=r[z]+s;U*U+j*j+G*G<=V*V&&(l[p++]=P[B])}l[p]=-1}}function mg(t,e,i){for(var r=e.length,n=new Float32Array(r),o=new Float32Array(r),a=new Float32Array(r),s=0;s<r;s++){var c=3*s;n[s]=t[c],o[s]=t[c+1],a[s]=t[c+2]}var u=Sh(t);0===t.length&&(u[0].set([0,0,0]),u[1].set([0,0,0]));var h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,P,T,E,C=u[0],I=u[1],R=-1,L=new Float32Array([0,0,0]),O=new Float32Array([0,0,0]),N=new Float32Array([0,0,0]);function D(t,i,s,c){d=Eo(t,1.4),f=Eo(i,2),m=Eo(s,!0),g=Eo(c,30),h=new Float32Array(r),l=new Float32Array(r);for(var u=0;u<h.length;++u){var L=e[u]+d;h[u]=L,l[u]=L*L}p=0;for(var O=0;O<h.length;++O)h[O]>p&&(p=h[O]);var N;N=sp(C,I,p,f,0),f=N.scaleFactor,v=N.dim,y=N.matrix,E=Math.min(5,2+Math.floor(d*f)),b=ou(v[0]*v[1]*v[2],-1001),x=new Int32Array(b.length),_=new Float32Array(v[0]),w=new Float32Array(v[1]),S=new Float32Array(v[2]),k(_,C[0],1/f),k(w,C[1],1/f),k(S,C[2],1/f),function(){var t=0,e=2*Math.PI/g;M=new Float32Array(g),A=new Float32Array(g);for(var i=0;i<g;i++)M[i]=Math.cos(t),A[i]=Math.sin(t),t+=e}(),P=new fg(n,o,a,h,C,I,2.01*p),T=new Int32Array(P.neighbourListLength),R=-1}function k(t,e,i){for(var r=0;r<t.length;r++)t[r]=e+i*r}function F(t,e,i,r,n){var o;if(-1!==R){if((o=R)!==r&&o!==n&&B(o,t,e,i))return o;R=-1}var a=0;for(o=T[a];o>=0;){if(o!==r&&o!==n&&B(o,t,e,i))return R=o,o;o=T[++a]}return R=-1,-1}function B(e,i,r,n){var o=3*e,a=l[e],s=t[o]-i,c=t[o+1]-r,u=t[o+2]-n;return s*s+c*c+u*u<a}function z(){for(var t=0;t<r;t++){var e=n[t],i=o[t],s=a[t],c=h[t],u=l[t];P.withinRadii(e,i,s,c,T);for(var p=Math.ceil(c*f),d=Math.floor(f*(e-C[0])),g=Math.floor(f*(i-C[1])),y=Math.floor(f*(s-C[2])),A=Math.max(0,d-p),M=Math.max(0,g-p),E=Math.max(0,y-p),I=Math.min(v[0],d+p+2),R=Math.min(v[1],g+p+2),L=Math.min(v[2],y+p+2),O=A;O<I;O++)for(var N=_[O]-e,D=v[1]*v[2]*O,k=M;k<R;k++)for(var B=w[k]-i,z=N*N+B*B,U=D+v[2]*k,j=E;j<L;j++){var G=S[j]-s,V=z+G*G;if(V<u){var $=j+U;b[$]<0&&(b[$]=-b[$]);var H=Math.sqrt(V),W=c/H,X=N*W,q=B*W,Y=G*W;if(-1===F(X+=e,q+=i,Y+=s,t,-1)){var Z=c-H;Z<b[$]&&(b[$]=Z,m&&(x[$]=t))}}}}}function U(t,e){var i=h[t],r=h[e],s=L[0]=n[e]-n[t],c=L[1]=o[e]-o[t],u=L[2]=a[e]-a[t],l=s*s+c*c+u*u,p=Math.sqrt(l),d=i*((i*i+p*p-r*r)/(2*i*p));Nh(L,L),function(t,e){t[0]=t[1]=t[2]=1,0!==e[0]?t[0]=(e[1]+e[2])/-e[0]:0!==e[1]?t[1]=(e[0]+e[2])/-e[1]:0!==e[2]&&(t[2]=(e[0]+e[1])/-e[2])}(O,L),Nh(O,O),Eh(N,L,O),Nh(N,N);var y=Math.sqrt(i*i-d*d);Oh(O,O,y),Oh(N,N,y),Oh(L,L,d),L[0]+=n[t],L[1]+=o[t],L[2]+=a[t],R=-1;for(var P=E,T=0;T<g;T++){var I=M[T],D=A[T],k=L[0]+I*O[0]+D*N[0],B=L[1]+I*O[1]+D*N[1],z=L[2]+I*O[2]+D*N[2];if(-1===F(k,B,z,t,e))for(var U=Math.floor(f*(k-C[0])),j=Math.floor(f*(B-C[1])),G=Math.floor(f*(z-C[2])),V=Math.max(0,U-P),$=Math.max(0,j-P),H=Math.max(0,G-P),W=Math.min(v[0],U+P+2),X=Math.min(v[1],j+P+2),q=Math.min(v[2],G+P+2),Y=V;Y<W;Y++){s=k-_[Y];for(var Z=v[1]*v[2]*Y,K=$;K<X;K++)for(var Q=s*s+(c=B-w[K])*c,J=Z+v[2]*K,tt=H;tt<q;tt++){l=Q+(u=z-S[tt])*u;var et=tt+J,it=b[et];it>0&&l<it*it&&(b[et]=Math.sqrt(l),m&&(x[et]=t))}}}}function j(t,e,s){console.time("AVSurface.getVolume"),console.time("AVSurface.init"),D(t,e,s),console.timeEnd("AVSurface.init"),console.time("AVSurface.projectPoints"),z(),console.timeEnd("AVSurface.projectPoints"),console.time("AVSurface.projectTorii"),function(){for(var t=0;t<r;t++){P.withinRadii(n[t],o[t],a[t],h[t],T);for(var e=0,i=T[e];i>=0;)t<i&&U(t,i),i=T[++e]}}(),console.timeEnd("AVSurface.projectTorii"),function(){for(var t=0;t<b.length;t++)b[t]<0&&(b[t]=0)}(),function(){for(var t=0;t<x.length;t++)x[t]=i[x[t]]}(),console.timeEnd("AVSurface.getVolume")}this.getSurface=function(t,e,i,r,n,o,a){return j(e,i,n),new hp(b,v[2],v[1],v[0],x).getSurface(e,!1,void 0,y,a)}}xc.add("line",lg),dg.__deps=[sp,ap,hp,Sh,pg],mg.__deps=[sp,hp,ou,Sh,Oh,Eh,Nh,fg,Eo],vc.add("molsurf",(function(t,e){var i=t.data.args,r=t.data.params;if(i&&r){var n=new("av"===r.type?mg:dg)(i.coordList,i.radiusList,i.indexList).getSurface(r.type,r.probeRadius,r.scaleFactor,r.cutoff,!0,r.smooth,r.contour),o=[n.position.buffer,n.index.buffer];n.normal&&o.push(n.normal.buffer),n.atomindex&&o.push(n.atomindex.buffer),e({sd:n,p:r},o)}}),[dg,mg]);var gg=function(t){this.structure=t};gg.prototype._getAtomData=function(){return this.structure.getAtomData({what:{position:!0,radius:!0,index:!0},radiusParams:{radius:"vdw",scale:1}})},gg.prototype._makeSurface=function(t,e){var i=new cp(e.name,"",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},gg.prototype.getSurface=function(t){var e=t||{},i=this._getAtomData(),r=i.position,n=i.radius,o=i.index,a=new("av"===e.type?mg:dg)(r,n,o).getSurface(e.type,e.probeRadius,e.scaleFactor,e.cutoff,!0,e.smooth,e.contour);return this._makeSurface(a,e)},gg.prototype.getSurfaceWorker=function(t,e){var i=this,r=Object.assign({},t);if(window.Worker){void 0===this.worker&&(this.worker=new Ql("molsurf"));var n=this._getAtomData(),o=n.position,a=n.radius,s=n.index,c={args:{coordList:o,radiusList:a,indexList:s},params:r},u=[o.buffer,a.buffer,s.buffer];this.worker.post(c,u,(function(t){e(i._makeSurface(t.data.sd,r))}),(function(t){console.warn("MolecularSurface.getSurfaceWorker error - trying without worker",t),i.worker.terminate(),i.worker=void 0;var n=i.getSurface(r);e(n)}))}else{var h=this.getSurface(r);e(h)}},gg.prototype.dispose=function(){this.worker&&this.worker.terminate()};var vg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="surface",this.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},contour:{type:"boolean",rebuild:!0},background:{type:"boolean",rebuild:!0},opaqueBack:{type:"boolean",buffer:!0},filterSele:{type:"text",rebuild:!0},colorVolume:{type:"hidden"},useWorker:{type:"boolean",rebuild:!0}},this.parameters,{radiusType:null,radius:null,scale:null}),this.__infoList=[],this.structure.signals.refreshed.add((function(){this.__forceNewMolsurf=!0}),this),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"uniform"),i.colorValue=Eo(i.colorValue,14540253),i.disablePicking=Eo(i.disablePicking,!0),this.surfaceType=Eo(i.surfaceType,"ms"),this.probeRadius=Eo(i.probeRadius,1.4),this.smooth=Eo(i.smooth,2),this.scaleFactor=Eo(i.scaleFactor,2),this.cutoff=Eo(i.cutoff,0),this.contour=Eo(i.contour,!1),this.background=Eo(i.background,!1),this.opaqueBack=Eo(i.opaqueBack,!0),this.filterSele=Eo(i.filterSele,""),this.colorVolume=Eo(i.colorVolume,void 0),this.useWorker=Eo(i.useWorker,!0),t.prototype.init.call(this,e)},e.prototype.prepareData=function(t,e,i){var r=this.__infoList[e];if(r||(r={},this.__infoList[e]=r),r.molsurf&&r.sele===t.selection.string)i(e);else{if(this.filterSele){var n=t.structure.getView(new nc(this.filterSele)),o=n.boundingBox.getSize(),a=Math.max(o.x,o.y,o.z),s=t.getAtomSetWithinPoint(n.center,a/2+6);t=t.getView(new nc(t.getAtomSetWithinSelection(s,3).toSeleString()))}r.sele=t.selection.string,r.molsurf=new gg(t);var c=this.getSurfaceParams(),u=function(t){r.surface=t,i(e)};this.useWorker?r.molsurf.getSurfaceWorker(c,u):u(r.molsurf.getSurface(c))}},e.prototype.prepare=function(t){var e=this;if((this.__forceNewMolsurf||this.__sele!==this.selection.string||this.__surfaceParams!==JSON.stringify(this.getSurfaceParams()))&&(this.__infoList.forEach((function(t){t.molsurf.dispose()})),this.__infoList.length=0),0!==this.structureView.atomCount){var i=function(){this.__sele=this.selection.string,this.__surfaceParams=JSON.stringify(this.getSurfaceParams()),this.__forceNewMolsurf=!1,t()}.bind(this),r="default"===this.assembly?this.defaultAssembly:this.assembly,n=this.structure.biomolDict[r];n?n.partList.forEach((function(t,r){var o=t.getView(e.structureView);e.prepareData(o,r,(function(t){t===n.partList.length-1&&i()}))})):this.prepareData(this.structureView,0,i)}else t()},e.prototype.createData=function(t,e){var i=this.__infoList[e],r=i.surface,n={position:r.getPosition(),color:r.getColor(this.getColorParams()),index:r.getFilteredIndex(this.filterSele,t)},o=[];if(r.contour){var a=new xf(n,this.getBufferParams({wireframe:!1}));o.push(a)}else{n.normal=r.getNormal(),n.picking=r.getPicking(t.getStructure());var s=new mf(n,this.getBufferParams({background:this.background,opaqueBack:this.opaqueBack,dullInterior:!1})),c=new yf(s);o.push(c)}return{bufferList:o,info:i}},e.prototype.updateData=function(t,e){var i={};if(t.position)return 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)),e.bufferList[0].setAttributes(i)},e.prototype.setParameters=function(e,i,r){return i=i||{},e&&e.filterSele&&(i.index=!0),e&&void 0!==e.colorVolume&&(i.color=!0),e&&e.wireframe&&(e.contour||void 0===e.contour&&this.contour)&&(e.wireframe=!1),t.prototype.setParameters.call(this,e,i,r),this},e.prototype.getSurfaceParams=function(t){return Object.assign({type:this.surfaceType,probeRadius:this.probeRadius,scaleFactor:this.scaleFactor,smooth:this.smooth&&!this.contour,cutoff:this.cutoff,contour:this.contour,useWorker:this.useWorker},t)},e.prototype.getColorParams=function(){var e=t.prototype.getColorParams.call(this);return e.volume=this.colorVolume,e},e.prototype.clear=function(){t.prototype.clear.call(this)},e.prototype.dispose=function(){this.__infoList.forEach((function(t){t.molsurf.dispose()})),this.__infoList.length=0,t.prototype.dispose.call(this)},e}(Cf);xc.add("surface",vg);var yg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="point",this.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}},this.parameters,{flatShaded:null,wireframe:null,linewidth:null,roughness:null,metalness:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};this.pointSize=Eo(i.pointSize,1),this.sizeAttenuation=Eo(i.sizeAttenuation,!0),this.sortParticles=Eo(i.sortParticles,!1),this.useTexture=Eo(i.useTexture,!1),this.alphaTest=Eo(i.alphaTest,.5),this.forceTransparent=Eo(i.forceTransparent,!1),this.edgeBleach=Eo(i.edgeBleach,0),t.prototype.init.call(this,i)},e.prototype.createData=function(t){var e=t.getAtomData(this.getAtomParams({position:!0,color:!0,picking:!0}));return{bufferList:[new wf(e,this.getBufferParams({pointSize:this.pointSize,sizeAttenuation:this.sizeAttenuation,sortParticles:this.sortParticles,useTexture:this.useTexture,alphaTest:this.alphaTest,forceTransparent:this.forceTransparent,edgeBleach:this.edgeBleach}))]}},e.prototype.updateData=function(t,e){var i=e.sview.getAtomData(this.getAtomParams(t)),r={};t&&!t.position||(r.position=i.position),t&&!t.color||(r.color=i.color),e.bufferList[0].setAttributes(r)},e}(Cf);xc.add("point",yg),wc.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\n#include unpack_color\nattribute float primitiveId;\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 = unpackColor( primitiveId );\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}");var bg=new Uint16Array([0,1,2,1,3,2]),xg=function(t){function e(e,i){var r=e||{},n=r.position.length/3-1,o=4*n,a=3*o,s=new Float32Array(a),c=new Float32Array(a),u=new Float32Array(a),h=zo(a,a/3);t.call(this,{position:s,color:c,index:h,normal:u,picking:r.picking},i),this.addAttributes({dir:{type:"v3",value:new Float32Array(a)}}),this.addAttributes({size:{type:"f",value:new Float32Array(o)}}),r.primitiveId=su(n),this.setAttributes(r),this.meshIndex=h,this.makeIndex()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={vertexShader:{}};return e.prototype.setAttributes=function(t){var e,i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x=this.size/4,_=this.geometry.attributes;t.position&&(e=t.position,s=_.position.array,_.position.needsUpdate=!0),t.normal&&(i=t.normal,c=_.normal.array,_.normal.needsUpdate=!0),t.size&&(r=t.size,u=_.size.array,_.size.needsUpdate=!0),t.dir&&(n=t.dir,h=_.dir.array,_.dir.needsUpdate=!0),t.color&&(o=t.color,l=_.color.array,_.color.needsUpdate=!0),t.primitiveId&&(a=t.primitiveId,p=_.primitiveId.array,_.primitiveId.needsUpdate=!0);var w=r?r[0]:null;for(d=0;d<x;++d){for(y=3*d,m=3*d*4,v=4*d,e&&(s[m]=s[m+3]=e[y],s[m+1]=s[m+4]=e[y+1],s[m+2]=s[m+5]=e[y+2],s[m+6]=s[m+9]=e[y+3],s[m+7]=s[m+10]=e[y+4],s[m+8]=s[m+11]=e[y+5]),i&&(c[m]=c[m+3]=-i[y],c[m+1]=c[m+4]=-i[y+1],c[m+2]=c[m+5]=-i[y+2],c[m+6]=c[m+9]=-i[y+3],c[m+7]=c[m+10]=-i[y+4],c[m+8]=c[m+11]=-i[y+5]),f=0;f<4;++f)g=m+3*f,o&&(l[g]=o[y],l[g+1]=o[y+1],l[g+2]=o[y+2]),a&&(p[v+f]=a[d]);r&&(b=r[d],w!==r[d]?(u[v]=w,u[v+1]=w,u[v+2]=b,u[v+3]=b):(u[v]=b,u[v+1]=b,u[v+2]=b,u[v+3]=b),w=b),n&&(h[m]=n[y],h[m+1]=n[y+1],h[m+2]=n[y+2],h[m+3]=-n[y],h[m+4]=-n[y+1],h[m+5]=-n[y+2],h[m+6]=n[y+3],h[m+7]=n[y+4],h[m+8]=n[y+5],h[m+9]=-n[y+3],h[m+10]=-n[y+4],h[m+11]=-n[y+5])}},e.prototype.makeIndex=function(){var t,e,i,r,n=this.meshIndex,o=n.length/4/3;for(e=0;e<o;++e)for(i=6*e,r=4*e,n.set(bg,i),t=0;t<6;++t)n[i+t]+=r},i.vertexShader.get=function(){return"Ribbon.vert"},Object.defineProperties(e.prototype,i),e}(wd),_g=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="ribbon",this.parameters=Object.assign({subdiv:{type:"integer",max:50,min:1,rebuild:!0},tension:{type:"number",precision:1,max:1,min:.1},smoothSheet:{type:"boolean",rebuild:!0}},this.parameters,{side:null,wireframe:null,linewidth:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"chainname"),i.colorScale=Eo(i.colorScale,"RdYlBu"),i.radius=Eo(i.radius,"sstruc"),i.scale=Eo(i.scale,4),"low"===i.quality?this.subdiv=3:"medium"===i.quality?this.subdiv=6:"high"===i.quality?this.subdiv=12:this.subdiv=Eo(i.subdiv,6),this.tension=Eo(i.tension,NaN),this.smoothSheet=Eo(i.smoothSheet,!1),t.prototype.init.call(this,i)},e.prototype.getSplineParams=function(t){return Object.assign({subdiv:this.subdiv,tension:this.tension,directional:!0,smoothSheet:this.smoothSheet},t)},e.prototype.createData=function(t){var e=this,i=[],r=[];return this.structure.eachPolymer((function(t){if(!(t.residueCount<4)){r.push(t);var n=new Hm(t,e.getSplineParams()),o=n.getSubdividedPosition(),a=n.getSubdividedOrientation(),s=n.getSubdividedColor(e.getColorParams()),c=n.getSubdividedPicking(),u=n.getSubdividedSize(e.radius,e.scale);i.push(new xg({position:o.position,normal:a.binormal,dir:a.normal,color:s.color,size:u.size,picking:c.picking},e.getBufferParams()))}}),t.getSelection()),{bufferList:i,polymerList:r}},e.prototype.updateData=function(t,e){t=t||{};var i=0,r=e.polymerList.length;for(i=0;i<r;++i){var n={},o=new Hm(e.polymerList[i],this.getSplineParams());if(t.position){var a=o.getSubdividedPosition(),s=o.getSubdividedOrientation();n.position=a.position,n.normal=s.binormal,n.dir=s.normal}if(t.radius||t.scale){var c=o.getSubdividedSize(this.radius,this.scale);n.size=c.size}if(t.color){var u=o.getSubdividedColor(this.getColorParams());n.color=u.color}e.bufferList[i].setAttributes(n)}},e.prototype.setParameters=function(e){var i={};return e&&e.tension&&(i.position=!0),t.prototype.setParameters.call(this,e,i,!1),this},e}(Cf);xc.add("ribbon",_g);var wg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="rocket",this.parameters=Object.assign({localAngle:{type:"integer",max:180,min:0,rebuild:!0},centerDist:{type:"number",precision:1,max:10,min:0,rebuild:!0},ssBorder:{type:"boolean",rebuild:!0},radialSegments:!0,openEnded:!0,disableImpostor:!0},this.parameters),this.helixbundleList=[],this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"sstruc"),i.radius=Eo(i.radius,1.5),i.scale=Eo(i.scale,1),i.openEnded=Eo(i.openEnded,!1),this.localAngle=Eo(i.localAngle,30),this.centerDist=Eo(i.centerDist,2.5),this.ssBorder=Eo(i.ssBorder,!1),t.prototype.init.call(this,i)},e.prototype.createData=function(t){var e=this,i=0,r=[],n=[];this.structure.eachPolymer((function(t){if(!(t.residueCount<4||t.isNucleic())){var o=new Ap(t),a=o.getAxis(e.localAngle,e.centerDist,e.ssBorder,e.getColorParams(),e.radius,e.scale);i+=a.size.length,r.push(a),n.push(o)}}),t.getSelection());var o={begin:new Float32Array(3*i),end:new Float32Array(3*i),size:new Float32Array(i),color:new Float32Array(3*i),picking:new Float32Array(i)},a=0;return r.forEach((function(t){o.begin.set(t.begin,3*a),o.end.set(t.end,3*a),o.size.set(t.size,a),o.color.set(t.color,3*a),o.picking.set(t.picking.array,a),a+=t.size.length})),i&&(o.picking=new $h(o.picking,t.getStructure())),{bufferList:[new qd({position1:o.begin,position2:o.end,color:o.color,color2:o.color,radius:o.size,picking:o.picking},this.getBufferParams({openEnded:this.openEnded,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}))],axisList:r,helixbundleList:n,axisData:o}},e.prototype.updateData=function(t,e){var i=this;if((t=t||{}).position)this.build();else{var r={};if(t.color||t.radius){var n=0;e.helixbundleList.forEach((function(r){var o=r.getAxis(i.localAngle,i.centerDist,i.ssBorder,i.getColorParams(),i.radius,i.scale);t.color&&e.axisData.color.set(o.color,3*n),(t.radius||t.scale)&&e.axisData.size.set(o.size,n),n+=o.size.length})),t.color&&(r.color=e.axisData.color,r.color2=e.axisData.color),(t.radius||t.scale)&&(r.radius=e.axisData.size)}e.bufferList[0].setAttributes(r)}},e}(Cf);xc.add("rocket",wg);var Sg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="rope",this.parameters=Object.assign({smooth:{type:"integer",max:15,min:0,rebuild:!0}},this.parameters,{aspectRatio:null,smoothSheet:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.aspectRatio=1,i.tension=Eo(i.tension,.5),i.scale=Eo(i.scale,5),i.smoothSheet=!1,this.smooth=Eo(i.smooth,2),t.prototype.init.call(this,i)},e.prototype.getSpline=function(t){var e=new Sp(t);return new Hm(t,this.getSplineParams({directional:!1,positionIterator:e.getCenterIterator(this.smooth)}))},e}(Ym);xc.add("rope",Sg);var Ag=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="spacefill",this.parameters=Object.assign({sphereDetail:!0,disableImpostor:!0},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};t.prototype.init.call(this,i)},e.prototype.createData=function(t){return{bufferList:[new Od(t.getAtomData(this.getAtomParams()),this.getBufferParams({sphereDetail:this.sphereDetail,dullInterior:!0,disableImpostor:this.disableImpostor}))]}},e.prototype.updateData=function(t,e){var i=e.sview.getAtomData(this.getAtomParams(t)),r={};t&&!t.position||(r.position=i.position),t&&!t.color||(r.color=i.color),t&&!t.radius||(r.radius=i.radius),e.bufferList[0].setAttributes(r)},e}(Cf);xc.add("spacefill",Ag);var Mg=function(t){function e(e,i){var r=i||{},n=(e||{}).position.length/3-1,o=new Float32Array(3*n*2),a=new Float32Array(3*n*2);t.call(this,{position:o,color:a},r),this.setAttributes(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isLine:{},vertexShader:{},fragmentShader:{}};return e.prototype.setAttributes=function(t){var e,i,r,n,o=this.geometry.attributes;if(t.position&&(e=t.position,r=o.position.array,o.position.needsUpdate=!0),t.color&&(i=t.color,n=o.color.array,o.color.needsUpdate=!0),e||i)for(var a,s,c=this.size-1,u=0;u<c;++u)a=3*u,s=3*u*2,e&&(r[s]=e[a],r[s+1]=e[a+1],r[s+2]=e[a+2],r[s+3]=e[a+3],r[s+4]=e[a+4],r[s+5]=e[a+5]),i&&(n[s]=i[a],n[s+1]=i[a+1],n[s+2]=i[a+2],n[s+3]=i[a+3],n[s+4]=i[a+4],n[s+5]=i[a+5]);else mc.warn("TraceBuffer.prototype.setAttributes no data")},i.isLine.get=function(){return!0},i.vertexShader.get=function(){return"Line.vert"},i.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,i),e}(xd),Pg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="trace",this.parameters=Object.assign({subdiv:{type:"integer",max:50,min:1,rebuild:!0},tension:{type:"number",precision:1,max:1,min:.1},smoothSheet:{type:"boolean",rebuild:!0}},this.parameters,{flatShaded:null,side:null,wireframe:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"chainname"),i.colorScale=Eo(i.colorScale,"RdYlBu"),"low"===i.quality?this.subdiv=3:"medium"===i.quality?this.subdiv=6:"high"===i.quality?this.subdiv=12:this.subdiv=Eo(i.subdiv,6),this.tension=Eo(i.tension,NaN),this.smoothSheet=Eo(i.smoothSheet,!1),t.prototype.init.call(this,i)},e.prototype.getSplineParams=function(t){return Object.assign({subdiv:this.subdiv,tension:this.tension,directional:!1,smoothSheet:this.smoothSheet},t)},e.prototype.createData=function(t){var e=this,i=[],r=[];return this.structure.eachPolymer((function(t){if(!(t.residueCount<4)){r.push(t);var n=new Hm(t,e.getSplineParams()),o=n.getSubdividedPosition(),a=n.getSubdividedColor(e.getColorParams());i.push(new Mg(Object.assign({},o,a),e.getBufferParams()))}}),t.getSelection()),{bufferList:i,polymerList:r}},e.prototype.updateData=function(t,e){t=t||{};var i=0,r=e.polymerList.length;for(i=0;i<r;++i){var n={},o=new Hm(e.polymerList[i],this.getSplineParams());if(t.position){var a=o.getSubdividedPosition();n.position=a.position}if(t.color){var s=o.getSubdividedColor(this.getColorParams());n.color=s.color}e.bufferList[i].setAttributes(n)}},e.prototype.setParameters=function(e){var i={};return e&&e.tension&&(i.position=!0),t.prototype.setParameters.call(this,e,i,!1),this},e}(Cf);xc.add("trace",Pg);var Tg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="tube",this.parameters=Object.assign({},this.parameters,{aspectRatio:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.aspectRatio=1,i.scale=Eo(i.scale,2),"low"===i.quality&&(this.radialSegments=5),t.prototype.init.call(this,i)},e.prototype.getSplineParams=function(){return t.prototype.getSplineParams.call(this,{directional:!1})},e}(Ym);xc.add("tube",Tg);var Eg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="unitcell",this.parameters=Object.assign({radius:{type:"number",precision:3,max:10,min:.001},sphereDetail:!0,radialSegments:!0,disableImpostor:!0},this.parameters,{assembly:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{},r=.5;this.structure.unitcell&&(r=Math.cbrt(this.structure.unitcell.volume)/200),i.radius=Eo(i.radius,r),i.colorValue=Eo(i.colorValue,"orange"),t.prototype.init.call(this,i)},e.prototype.getUnitcellData=function(t){return t.unitcell.getData(t)},e.prototype.create=function(){var t=this.structureView.getStructure();if(t.unitcell){var e=this.getUnitcellData(t);this.sphereBuffer=new Od(e.vertex,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0})),this.cylinderBuffer=new qd(e.edge,this.getBufferParams({openEnded:!0,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bufferList:[this.sphereBuffer,this.cylinderBuffer]})}},e.prototype.updateData=function(t,e){var i=e.sview.getStructure(),r=this.getUnitcellData(i),n={},o={};t&&!t.position||(n.position=r.vertexPosition,o.position1=r.edgePosition1,o.position2=r.edgePosition2),t&&!t.color||(n.color=r.vertexColor,o.color=r.edgeColor,o.color2=r.edgeColor),t&&!t.radius||(n.radius=r.vertexRadius,o.radius=r.edgeRadius),this.sphereBuffer.setAttributes(n),this.cylinderBuffer.setAttributes(o)},e}(Cf);xc.add("unitcell",Eg);var Cg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="validation",this.parameters=Object.assign({},this.parameters,{radiusType:null,radius:null,scale:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorValue=Eo(i.colorValue,"#f0027f"),t.prototype.init.call(this,i)},e.prototype.createData=function(t){if(t.validation){var e=t.validation.getClashData({structure:t,color:this.colorValue});return{bufferList:[new qd(e,this.getBufferParams({openEnded:!1}))]}}},e}(Cf);xc.add("validation",Cg);var Ig=function(t,e){var i=e||{};this.streamer=t,this.name=Eo(i.name,""),this.path=Eo(i.path,"")},Rg={type:{},__objName:{}};function Lg(t){var e,i,r=null,n=null,o=null,a=null,s=null,c=null,u=t.atomStore,h=t.residueStore,l=t.chainStore,p=t.modelStore,d=t.residueMap,f=-1,m=-1,g=-1,v=-1;function y(t){for(var r=h.atomCount[t],n=h.atomOffset[t],o=new Array(r),a=0;a<r;++a)o[a]=u.atomTypeId[n+a];h.residueTypeId[t]=d.add(e,o,i)}this.addAtom=function(t,d,b,x,_,w,S,A){var M=!1,P=!1,T=!1;r!==t?(M=!0,P=!0,T=!0,v+=1,g+=1,m+=1):n!==b?(P=!0,T=!0,g+=1,m+=1):a===_&&o===x&&s===A||(T=!0,m+=1),f+=1,M&&(p.growIfFull(),p.chainOffset[v]=g,p.chainCount[v]=0,p.count+=1,l.modelIndex[g]=v),P&&(l.growIfFull(),l.setChainname(g,d),l.setChainid(g,b),l.residueOffset[g]=m,l.residueCount[g]=0,l.count+=1,l.modelIndex[g]=v,p.chainCount[v]+=1,h.chainIndex[m]=g),T&&(e=o,i=c,m>0&&y(m-1),h.growIfFull(),h.resno[m]=_,void 0!==S&&(h.sstruc[m]=S.charCodeAt(0)),void 0!==A&&(h.inscode[m]=A.charCodeAt(0)),h.atomOffset[m]=f,h.atomCount[m]=0,h.count+=1,h.chainIndex[m]=g,l.residueCount[g]+=1),u.count+=1,u.residueIndex[f]=m,h.atomCount[m]+=1,r=t,n=b,o=x,a=_,s=A,c=w},this.finalize=function(){e=o,i=c,m>-1&&y(m)}}Rg.type.get=function(){return""},Rg.__objName.get=function(){return""},Ig.prototype.parse=function(){var t=this;return this.streamer.read().then((function(){return t._beforeParse(),t._parse(),t._afterParse(),t[t.__objName]}))},Ig.prototype._parse=function(){},Ig.prototype._beforeParse=function(){},Ig.prototype._afterParse=function(){gc&&mc.log(this[this.__objName])},Object.defineProperties(Ig.prototype,Rg);var Og=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.firstModelOnly=Eo(r.firstModelOnly,!1),this.asTrajectory=Eo(r.asTrajectory,!1),this.cAlphaOnly=Eo(r.cAlphaOnly,!1),this.structure=new ld(this.name,this.path),this.structureBuilder=new Lg(this.structure)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"structure"},i.__objName.get=function(){return"structure"},Object.defineProperties(e.prototype,i),e}(Ig);var Ng=function(t,e,i,r,n){this.structure=t,this.index=e,this.description=i||"",this.entityType=function(t){switch(t=t.toLowerCase()){case"polymer":return 1;case"non-polymer":return 2;case"macrolide":return 3;case"water":return 4;default:return 0}}(r||""),this.chainIndexList=n||[],n.forEach((function(i){t.chainStore.entityIndex[i]=e}))},Dg={type:{}};Dg.type.get=function(){return"Entity"},Ng.prototype.getEntityType=function(){return this.entityType},Ng.prototype.isPolymer=function(){return 1===this.entityType},Ng.prototype.isNonPolymer=function(){return 2===this.entityType},Ng.prototype.isMacrolide=function(){return 3===this.entityType},Ng.prototype.isWater=function(){return 4===this.entityType},Ng.prototype.eachChain=function(t){var e=this.structure.getChainProxy();this.chainIndexList.forEach((function(i){e.index=i,t(e)}))},Object.defineProperties(Ng.prototype,Dg);var kg=function(t){var e=t||{};this.a=e.a||1,this.b=e.b||1,this.c=e.c||1,this.alpha=e.alpha||90,this.beta=e.beta||90,this.gamma=e.gamma||90,this.spacegroup=e.spacegroup||"P 1",this.cartToFrac=e.cartToFrac||e.scale,this.fracToCart=new N;var i=Qo(this.alpha),r=Qo(this.beta),n=Qo(this.gamma),o=Math.cos(i),a=Math.cos(r),s=Math.cos(n),c=Math.sin(r),u=Math.sin(n);if(this.volume=this.a*this.b*this.c*Math.sqrt(1-o*o-a*a-s*s+2*o*a*s),void 0===this.cartToFrac){var h=this.a*this.b*u/this.volume,l=(a*s-o)/(c*u);this.fracToCart.set(this.a,0,0,0,this.b*s,this.b*u,0,0,this.c*a,-this.c*c*l,1/h,0,0,0,0,1).transpose(),this.cartToFrac=(new N).getInverse(this.fracToCart)}else this.fracToCart.getInverse(this.cartToFrac)};kg.prototype.getPosition=function(t){var e=new Float32Array(24),i=t.unitcell,r=t.center.clone().applyMatrix4(i.cartToFrac).floor().multiplyScalar(2).addScalar(1),n=new O,o=0;function a(t,a,s){n.set(t,a,s).multiply(r).applyMatrix4(i.fracToCart).toArray(e,o),o+=3}return a(0,0,0),a(1,0,0),a(0,1,0),a(0,0,1),a(1,1,0),a(1,0,1),a(0,1,1),a(1,1,1),e},kg.prototype.getCenter=function(t){return function(t,e){var i=t.length;e=e||new O;for(var r=0;r<i;r+=3)e.x+=t[r],e.y+=t[r+1],e.z+=t[r+2];return e.divideScalar(i/3),e}(this.getPosition(t))},kg.prototype.getData=function(t,e){var i=e||{},r=Eo(i.colorValue,"orange"),n=Eo(i.radius,Math.cbrt(this.volume)/200),o=new St(r),a=new O,s=this.getPosition(t),c=au(8,o.r,o.g,o.b),u=ou(8,n),h=new Float32Array(36),l=new Float32Array(36),p=au(12,o.r,o.g,o.b),d=ou(12,n),f=0;function m(t,e){a.fromArray(s,3*t).toArray(h,f),a.fromArray(s,3*e).toArray(l,f),f+=3}m(0,1),m(0,2),m(0,3),m(1,4),m(1,5),m(2,6),m(3,5),m(4,7),m(5,7),m(2,4),m(7,6),m(3,6);var g=new il(this,t);return{vertex:{position:s,color:c,radius:u,picking:g},edge:{position1:h,position2:l,color:p,color2:p,radius:d,picking:g}}};var Fg={1:"h",2:"h",3:"i",4:"h",5:"g",6:"h",7:"h",8:"h",9:"h",10:"h","":"h"},Bg=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.hex=Eo(r.hex,!1)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"pdb"},e.prototype._parse=function(){gc&&mc.time("PdbParser._parse "+this.name);var t=!1,e=this.streamer.peekLines(1)[0],i=e.substr(62,4),r=e.substr(72,4);i===r&&r.trim()&&(t=!0);var n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,P,T,E,C,I,R,L,O,D,k,F="pqr"===this.type,B=/\s+/,z=this.structure,U=this.structureBuilder,j=this.hex,G=10,V=10,$=this.firstModelOnly,H=this.asTrajectory,W=this.cAlphaOnly,X=z.frames,q=z.boxes,Y=!1,Z=z.biomolDict,K={},Q={},J={},tt=[],et=["MOL_ID","MOLECULE","CHAIN","FRAGMENT","SYNONYM","EC","ENGINEERED","MUTATION","OTHER_DETAILS"],it={},rt={},nt={helices:[],sheets:[]},ot=nt.helices,at=nt.sheets,st=z.atomMap,ct=z.atomStore;ct.resize(Math.round(this.streamer.data.length/80));var ut=z.getAtomProxy(),ht=z.getAtomProxy(),lt=0,pt=0,dt=!0;this.streamer.eachChunkOfLines((function(e){!function(e,i,r){for(var nt=e;nt<i;++nt)if(u=r[nt],"ATOM  "===(h=u.substr(0,6))||"HETATM"===h){if(dt&&(H?(Y?(n=new Float32Array(3*ct.count),X.push(n)):n=[],o=0):$||(K={}),I=(C=1).toString(),R=!0,dt=!1),$&&pt>0)continue;var ft=void 0,mt=void 0,gt=void 0,vt=void 0,yt=void 0;if(F){if(yt=10===(vt=u.split(B)).length?1:0,v=vt[2],W&&"CA"!==v)continue;ft=parseFloat(vt[6-yt]),mt=parseFloat(vt[7-yt]),gt=parseFloat(vt[8-yt])}else{if(v=u.substr(12,4).trim(),W&&"CA"!==v)continue;ft=parseFloat(u.substr(30,8)),mt=parseFloat(u.substr(38,8)),gt=parseFloat(u.substr(46,8))}if(H){var bt=3*o;if(n[bt+0]=ft,n[bt+1]=mt,n[bt+2]=gt,o+=1,Y)continue}var xt=void 0;F?(l=parseInt(vt[1]),xt="",y="H"===u[0]?1:0,p=yt?"":vt[4],d=parseInt(vt[5-yt]),g="",f=vt[3],b=parseFloat(vt[9-yt]),x="",m=0):(l=parseInt(u.substr(6,5),G),j&&99999===l&&(G=16),y="H"===u[0]?1:0,p=u[21].trim(),d=parseInt(u.substr(22,4),V)||1,j&&9999===d&&(V=16),g=u[26].trim(),f=u.substr(17,4).trim()||"MOL",b=parseFloat(u.substr(60,6)),x=u[16].trim(),m=parseFloat(u.substr(54,6)),t||(xt=u.substr(76,2).trim(),p||(p=u.substr(72,4).trim()))),ct.growIfFull(),ct.atomTypeId[lt]=st.add(v,xt),ct.x[lt]=ft,ct.y[lt]=mt,ct.z[lt]=gt,ct.serial[lt]=l,ct.bfactor[lt]=isNaN(b)?0:b,ct.altloc[lt]=x.charCodeAt(0),ct.occupancy[lt]=isNaN(m)?0:m,y?L===p&&D===f&&(Al.includes(f)||O===d&&k===g)||(I=(C+=1).toString(),O=d,D=f,k=g):R||L===p||(I=(C+=1).toString()),U.addAtom(pt,p,I,f,d,y,void 0,g),K[l]=lt,lt+=1,R=!1,L=p}else if("CONECT"===h){var _t=K[parseInt(u.substr(6,5))],wt=[11,16,21,26],St={};if(void 0===_t)continue;for(var At=0;At<4;++At){var Mt=parseInt(u.substr(wt[At],5));if(!Number.isNaN(Mt)&&void 0!==(Mt=K[Mt]))if(_t<Mt?(ut.index=_t,ht.index=Mt):(ut.index=Mt,ht.index=_t),void 0!==St[Mt])z.bondStore.bondOrder[St[Mt]]+=1;else{var Pt=ut.index+"|"+ht.index;void 0===J[Pt]&&(J[Pt]=!0,St[Mt]=z.bondStore.count,z.bondStore.addBond(ut,ht,1))}}}else if("HELIX "===h){_=u[19].trim(),w=parseInt(u.substr(21,4)),S=u[25].trim(),A=u[31].trim(),M=parseInt(u.substr(33,4)),P=u[37].trim();var Tt=parseInt(u.substr(39,1));Tt=(Fg[Tt]||Fg[""]).charCodeAt(0),ot.push([_,w,S,A,M,P,Tt])}else if("SHEET "===h)_=u[21].trim(),w=parseInt(u.substr(22,4)),S=u[26].trim(),A=u[32].trim(),M=parseInt(u.substr(33,4)),P=u[37].trim(),at.push([_,w,S,A,M,P]);else if("HETNAM"===h)rt[u.substr(11,3)]=u.substr(15).trim();else if("COMPND"===h){var Et=u.substr(10,70).trim(),Ct=Et.indexOf(":"),It=Et.substring(0,Ct),Rt=void 0;et.includes(It)?(E=It,Rt=Et.substring(Ct+2)):Rt=Et,Rt=Rt.replace(/;$/,""),"MOL_ID"===E?(T={chainList:[],name:""},tt.push(T)):"MOLECULE"===E?(T.name&&(T.name+=" "),T.name+=Rt):"CHAIN"===E&&Array.prototype.push.apply(T.chainList,Rt.split(/\s*,\s*/))}else if(u.startsWith("TER")){var Lt=z.getChainProxy(z.chainStore.count-1);it[Lt.chainname]=Lt.index,I=(C+=1).toString(),R=!0}else if("REMARK"===h&&"350"===u.substr(7,3)){if("BIOMOLECULE:"===u.substr(11,12)){var Ot=u.substr(23).trim();/^(0|[1-9][0-9]*)$/.test(Ot)&&(Ot="BU"+Ot),a=new Rp(Ot),Z[Ot]=a}else if("BIOMT"===u.substr(13,5)){var Nt=u.split(/\s+/),Dt=parseInt(u[18])-1;0===Dt&&(c=new N,s.matrixList.push(c));var kt=c.elements;kt[0+Dt]=parseFloat(Nt[4]),kt[4+Dt]=parseFloat(Nt[5]),kt[8+Dt]=parseFloat(Nt[6]),kt[12+Dt]=parseFloat(Nt[7])}else if("APPLY THE FOLLOWING TO CHAINS:"===u.substr(11,30)||"                   AND CHAINS:"===u.substr(11,30)){"APPLY"===u.substr(11,5)&&(s=a.addPart());for(var Ft=u.substr(41,30).split(","),Bt=0,zt=Ft.length;Bt<zt;++Bt){var Ut=Ft[Bt].trim();Ut&&s.chainList.push(Ut)}}}else if("HEADER"===h)z.id=u.substr(62,4);else if("TITLE "===h)z.title+=(z.title?" ":"")+u.substr(10,70).trim();else if("MODEL "===h)dt=!0;else if("ENDMDL"===h||u.startsWith("END")){if(dt)continue;H&&!Y&&(X.push(new Float32Array(n)),Y=!0),pt+=1,dt=!0}else if("MTRIX"===u.substr(0,5)){if("1"===u[59])continue;var jt=u.split(/\s+/),Gt=jt[1].trim();if("1"===u[5]&&"1"===Gt){a=new Rp("NCS"),Z.NCS=a,s=a.addPart()}var Vt=parseInt(u[5])-1;0===Vt&&(c=new N,s.matrixList.push(c));var $t=c.elements;$t[0+Vt]=parseFloat(jt[2]),$t[4+Vt]=parseFloat(jt[3]),$t[8+Vt]=parseFloat(jt[4]),$t[12+Vt]=parseFloat(jt[5])}else if("ORIGX"===u.substr(0,5)){Q.origx||(Q.origx=new N);var Ht=u.split(/\s+/),Wt=parseInt(u[5])-1,Xt=Q.origx.elements;Xt[0+Wt]=parseFloat(Ht[1]),Xt[4+Wt]=parseFloat(Ht[2]),Xt[8+Wt]=parseFloat(Ht[3]),Xt[12+Wt]=parseFloat(Ht[4])}else if("SCALE"===u.substr(0,5)){Q.scale||(Q.scale=new N);var qt=u.split(/\s+/),Yt=parseInt(u[5])-1,Zt=Q.scale.elements;Zt[0+Yt]=parseFloat(qt[1]),Zt[4+Yt]=parseFloat(qt[2]),Zt[8+Yt]=parseFloat(qt[3]),Zt[12+Yt]=parseFloat(qt[4])}else if("CRYST1"===h){var Kt=parseFloat(u.substr(6,9)),Qt=parseFloat(u.substr(15,9)),Jt=parseFloat(u.substr(24,9)),te=parseFloat(u.substr(33,7)),ee=parseFloat(u.substr(40,7)),ie=parseFloat(u.substr(47,7)),re=u.substr(55,11).trim(),ne=new Float32Array(9);ne[0]=Kt,ne[4]=Qt,ne[8]=Jt,q.push(ne),0===pt&&(Q.a=Kt,Q.b=Qt,Q.c=Jt,Q.alpha=te,Q.beta=ee,Q.gamma=ie,Q.spacegroup=re)}}(0,e.length,e)}));var ft=tt.length;if(tt.length){z.eachChain((function(t){t.entityIndex=ft})),tt.forEach((function(t,e){var i=t.chainList.map((function(t){return it[t]}));z.entityList.push(new Ng(z,e,t.name,"polymer",i))}));var mt=tt.length,gt=z.getResidueProxy(),vt={};z.eachChain((function(t){t.entityIndex===ft&&(gt.index=t.residueOffset,vt[gt.resname]||(vt[gt.resname]=[]),vt[gt.resname].push(t.index))})),Object.keys(vt).forEach((function(t){var e=vt[t],i="non-polymer",r=rt[t]||t;Al.includes(t)&&(r="water",i="water"),z.entityList.push(new Ng(z,mt,r,i,e)),mt+=1}))}void 0!==Q.a?z.unitcell=new kg(Q):z.unitcell=void 0,(ot.length||at.length)&&Dp(z,nt),U.finalize(),z.finalizeAtoms(),t||Up(z),jp(z),z.finalizeBonds(),ot.length||at.length||zp(z),$p(z),gc&&mc.timeEnd("PdbParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("pdb",Bg),_c.add("pdb1",Bg),_c.add("ent",Bg);var zg=/\s+/,Ug=/'((?:(?!'\s).)*)'|"((?:(?!"\s).)*)"|(\S+)/g,jg=/"/g,Gg=/^['"]+|['"]+$/g;function Vg(t){return!t||t[0]!==t[t.length-1]||"'"!==t[0]&&'"'!==t[0]?t:t.substring(1,t.length-1)}function $g(t,e){Array.isArray(t[e])||Object.keys(t).forEach((function(e){t[e]=[t[e]]}))}function Hg(t){return"?"!==t}function Wg(t,e){return Hg(t)?t:e}function Xg(t){switch(t.toLowerCase()){case"?":case"sing":return 1;case"doub":return 2;case"trip":return 3;case"quad":return 4}return 0}var qg=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"cif"},e.prototype._parse=function(){mc.time("CifParser._parse "+this.name);var t,e,i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_=this.structure,w=this.structureBuilder,S=this.firstModelOnly,A=this.asTrajectory,M=this.cAlphaOnly,P=_.frames,T={},E={},C={},I=!1,R=null,L=!1,D=!1,k=!1,F=[],B=null,z=null,U=null,j=null,G=[],V=_.atomMap,$=_.atomStore;$.resize(this.streamer.data.length/100);var H,W=0,X=0;if(this.streamer.eachChunkOfLines((function(O){!function(O,N,q){for(var Y=O;Y<N;++Y)if(i=q[Y],((r=i.trim())||I||D)&&"#"!==r[0])if("data_"===r.substring(0,5))T.data=r.substring(5).trim();else if(";"===r[0])I?(D?(B===F.length&&(B=0),F[B].push(R),B+=1):!1===U?T[z]=R:T[z][U]=R,I=!1,R=null):(I=!0,R=r.substring(1));else if("loop_"===r)D=!0,k=!0,F.length=0,G.length=0,B=0;else if("_"===r[0]){var Z,K,Q;if(D&&!k&&(D=!1),D)K=(Z=r.split("."))[0].substring(1),Q=Z[1],1===Z.length?(Q=!1,T[K]||(T[K]=[]),F.push(T[K])):(T[K]||(T[K]={}),T[K][Q]?gc&&mc.warn(K,Q,"already exists"):(T[K][Q]=[],F.push(T[K][Q]),G.push(Q))),z=K,U=Q,j=!0;else{var J=r.match(Ug),tt=J[0],et=J[1];K=(Z=tt.split("."))[0].substring(1),Q=Z[1],1===Z.length?(Q=!1,T[K]=et):(T[K]||(T[K]={}),T[K][Q]?gc&&mc.warn(K,Q,"already exists"):T[K][Q]=et),et||(L=!0),z=K,U=Q}}else if(I)R+=i;else if(D){if(!r)continue;if("atom_site"===z){var it=r.split(zg);j&&(n=G.indexOf("auth_asym_id"),o=G.indexOf("auth_seq_id"),a=G.indexOf("label_atom_id"),s=G.indexOf("label_comp_id"),c=G.indexOf("label_asym_id"),u=G.indexOf("label_entity_id"),h=G.indexOf("label_alt_id"),g=G.indexOf("Cartn_x"),v=G.indexOf("Cartn_y"),y=G.indexOf("Cartn_z"),p=G.indexOf("id"),d=G.indexOf("type_symbol"),l=G.indexOf("group_PDB"),b=G.indexOf("B_iso_or_equiv"),f=G.indexOf("pdbx_PDB_model_num"),m=G.indexOf("pdbx_PDB_ins_code"),x=G.indexOf("occupancy"),j=!1,H=parseInt(it[f]),A&&(t=[],e=0));var rt=parseInt(it[f]);if(H!==rt&&(A&&(0===X&&P.push(new Float32Array(t)),t=new Float32Array(3*$.count),P.push(t),e=0),X+=1),H=rt,S&&X>0)continue;var nt=it[a].replace(jg,"");if(M&&"CA"!==nt)continue;var ot=parseFloat(it[g]),at=parseFloat(it[v]),st=parseFloat(it[y]);if(A){var ct=3*e;if(t[ct+0]=ot,t[ct+1]=at,t[ct+2]=st,e+=1,X>0)continue}var ut=it[s],ht=parseInt(it[o]),lt=it[m];lt="?"===lt?"":lt;var pt=it[n],dt=it[c],ft="H"===it[l][0]?1:0,mt=it[d],gt=parseFloat(it[b]),vt=parseFloat(it[x]),yt=it[h];if(yt="."===yt?"":yt,$.growIfFull(),$.atomTypeId[W]=V.add(nt,mt),$.x[W]=ot,$.y[W]=at,$.z[W]=st,$.serial[W]=parseInt(it[p]),$.bfactor[W]=isNaN(gt)?0:gt,$.occupancy[W]=isNaN(vt)?0:vt,$.altloc[W]=yt.charCodeAt(0),w.addAtom(X,pt,dt,ut,ht,ft,void 0,lt),gc){var bt=E[dt];void 0!==bt&&bt!==pt&&gc&&mc.warn(bt,pt)}E[dt]=pt;var xt=it[u];C[xt]||(C[xt]=new Set),C[xt].add(_.chainStore.count-1),W+=1}else{var _t=r.match(Ug),wt=_t.length;B===F.length&&(B=0);for(var St=0;St<wt;++St)F[B+St].push(_t[St]);B+=wt}k=!1}else if("'"===r[0]&&"'"===r[r.length-1]){var At=r.substring(1,r.length-1);!1===U?T[z]=At:T[z][U]=At}else L?!1===U?T[z]=r:T[z][U]=r:gc&&mc.log("CifParser._parse: unknown state",r);else I=!1,D=!1,L=!1,F.length=0,B=null,z=null,U=null,j=null,G.length=0}(0,O.length,O)})),T.chem_comp&&T.chem_comp_atom)!function(t,e,i){var r,n,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(Gg,"")),s.id&&(e.id=s.id.trim().replace(Gg,"")));var h={};if(c){var l,p,d,f;for(n=c.comp_id.length,r=0;r<n;++r)o.growIfFull(),l=c.atom_id[r].replace(jg,""),p=c.type_symbol[r],h[l]=r,o.atomTypeId[r]=a.add(l,p),o.x[r]=c.model_Cartn_x[r],o.y[r]=c.model_Cartn_y[r],o.z[r]=c.model_Cartn_z[r],o.serial[r]=r,d=c.pdbx_component_comp_id[r],f=c.pdbx_residue_numbering?c.pdbx_residue_numbering[r]:1,i.addAtom(0,"","",d,f,1);for(r=0;r<n;++r){var m=r+n;o.growIfFull(),l=c.atom_id[r].replace(jg,""),p=c.type_symbol[r],o.atomTypeId[m]=a.add(l,p),o.x[m]=c.pdbx_model_Cartn_x_ideal[r],o.y[m]=c.pdbx_model_Cartn_y_ideal[r],o.z[m]=c.pdbx_model_Cartn_z_ideal[r],o.serial[m]=m,d=c.pdbx_component_comp_id[r],f=c.pdbx_residue_numbering?c.pdbx_residue_numbering[r]:1,i.addAtom(1,"","",d,f,1)}}if(c&&u){var g,v,y;n=u.comp_id.length;var b=c.comp_id.length,x=e.getAtomProxy(),_=e.getAtomProxy();for(r=0;r<n;++r)g=u.atom_id_1[r].replace(jg,""),v=u.atom_id_2[r].replace(jg,""),y=Xg(u.value_order[r]),x.index=h[g],_.index=h[v],e.bondStore.growIfFull(),e.bondStore.addBond(x,_,y),x.index+=b,_.index+=b,e.bondStore.growIfFull(),e.bondStore.addBond(x,_,y)}}(T,_,w),w.finalize(),_.finalizeAtoms(),_.finalizeBonds(),qp(_);else if(T.atom_site_type_symbol&&T.atom_site_label&&T.atom_site_fract_x)!function(t,e,i){var r=e.atomStore,n=e.atomMap;t.data&&(e.id=t.data,e.name=t.data),e.unitcell=new kg({a:parseFloat(t.cell_length_a),b:parseFloat(t.cell_length_b),c:parseFloat(t.cell_length_c),alpha:parseFloat(t.cell_angle_alpha),beta:parseFloat(t.cell_angle_beta),gamma:parseFloat(t.cell_angle_gamma),spacegroup:Vg(t.symmetry_space_group_name_H)});for(var o=new O,a=new O,s=t.atom_site_type_symbol.length,c=0;c<s;++c){r.growIfFull();var u=t.atom_site_label[c],h=t.atom_site_type_symbol[c];r.atomTypeId[c]=n.add(u,h),o.set(t.atom_site_fract_x[c],t.atom_site_fract_y[c],t.atom_site_fract_z[c]),o.applyMatrix4(e.unitcell.fracToCart),a.add(o),r.x[c]=o.x,r.y[c]=o.y,r.z[c]=o.z,t.atom_site_occupancy&&(r.occupancy[c]=parseFloat(t.atom_site_occupancy[c])),r.serial[c]=c,i.addAtom(0,"","","HET",1,1)}a.divideScalar(s),e.center=a,$p(e);var l=new O,p=new O,d=e.biomolDict.SUPERCELL.partList[0].matrixList,f=s;function m(t){return n.get(r.atomTypeId[t]).covalent}for(var g=new N,v=function(t){var e=m(t);o.set(r.x[t],r.y[t],r.z[t]),d.forEach((function(n){if(!g.equals(n)){l.copy(o),l.applyMatrix4(n);for(var a=0;a<s;++a){p.set(r.x[a],r.y[a],r.z[a]);var c=l.distanceToSquared(p),u=m(a)+e,h=u+.3,d=u-.5;if(c<h*h&&c>d*d)return r.growIfFull(),r.atomTypeId[f]=r.atomTypeId[t],r.x[f]=l.x,r.y[f]=l.y,r.z[f]=l.z,r.occupancy[f]=r.occupancy[t],r.serial[f]=f,r.altloc[f]="A".charCodeAt(0),i.addAtom(0,"","","HET",1,1),void(f+=1)}}}))},y=0;y<s;++y)v(y)}(T,_,w),w.finalize(),_.finalizeAtoms(),jp(_),_.finalizeBonds();else{var q=function(t,e,i){var r,n,o,a,s=[],c=[],u=t.struct_conf;if(u)for($g(u,"id"),r=0,n=u.beg_auth_seq_id.length;r<n;++r){var h=parseInt(u.pdbx_PDB_helix_class[r]);Number.isNaN(h)||(o=u.pdbx_beg_PDB_ins_code[r],a=u.pdbx_end_PDB_ins_code[r],s.push([i[u.beg_label_asym_id[r]],parseInt(u.beg_auth_seq_id[r]),Wg(o,""),i[u.end_label_asym_id[r]],parseInt(u.end_auth_seq_id[r]),Wg(a,""),(Fg[h]||Fg[""]).charCodeAt(0)]))}var l=t.struct_sheet_range;if(l)for($g(l,"id"),r=0,n=l.beg_auth_seq_id.length;r<n;++r)o=l.pdbx_beg_PDB_ins_code[r],a=l.pdbx_end_PDB_ins_code[r],c.push([i[l.beg_label_asym_id[r]],parseInt(l.beg_auth_seq_id[r]),Wg(o,""),i[l.end_label_asym_id[r]],parseInt(l.end_auth_seq_id[r]),Wg(a,"")]);return!(!u&&!l)&&{helices:s,sheets:c}}(T,0,E);if(function(t,e,i){var r={},n=e.biomolDict;if(t.pdbx_struct_oper_list){var o=t.pdbx_struct_oper_list;$g(o,"id"),o.id.forEach((function(t,e){var i=new N,n=i.elements;n[0]=parseFloat(o["matrix[1][1]"][e]),n[1]=parseFloat(o["matrix[1][2]"][e]),n[2]=parseFloat(o["matrix[1][3]"][e]),n[4]=parseFloat(o["matrix[2][1]"][e]),n[5]=parseFloat(o["matrix[2][2]"][e]),n[6]=parseFloat(o["matrix[2][3]"][e]),n[8]=parseFloat(o["matrix[3][1]"][e]),n[9]=parseFloat(o["matrix[3][2]"][e]),n[10]=parseFloat(o["matrix[3][3]"][e]),n[3]=parseFloat(o["vector[1]"][e]),n[7]=parseFloat(o["vector[2]"][e]),n[11]=parseFloat(o["vector[3]"][e]),i.transpose(),r[t]=i}))}if(t.pdbx_struct_assembly_gen){var a=t.pdbx_struct_assembly_gen;$g(a,"assembly_id");var s=function(t){var e={};return t.replace(/[()']/g,"").split(",").forEach((function(t){if(t.includes("-"))for(var i=t.split("-"),n=parseInt(i[0]),o=parseInt(i[1]);n<=o;++n)e[n]=r[n];else e[t]=r[t]})),e};a.assembly_id.forEach((function(t,e){var r={},o=a.oper_expression[e].replace(/['"]\(|['"]/g,"");if(o.includes(")(")||o.indexOf("(")>0){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 N;i.multiplyMatrices(c[t],u[e]),r[t+"x"+e]=i}))}))}else r=s(o);var h=[];for(var l in r)h.push(r[l]);var p=t;/^(0|[1-9][0-9]*)$/.test(p)&&(p="BU"+p);for(var d=a.asym_id_list[e].split(","),f=0,m=d.length;f<m;++f)d[f]=i[d[f]];void 0===n[p]&&(n[p]=new Rp(p)),n[p].addPart(h,d)}))}if(t.struct_ncs_oper){var c=t.struct_ncs_oper;$g(c,"id");n.NCS=new Rp("NCS");var u=n.NCS.addPart();c.id.forEach((function(t,e){if("given"!==c.code[e]){var i=new N,r=i.elements;r[0]=parseFloat(c["matrix[1][1]"][e]),r[1]=parseFloat(c["matrix[1][2]"][e]),r[2]=parseFloat(c["matrix[1][3]"][e]),r[4]=parseFloat(c["matrix[2][1]"][e]),r[5]=parseFloat(c["matrix[2][2]"][e]),r[6]=parseFloat(c["matrix[2][3]"][e]),r[8]=parseFloat(c["matrix[3][1]"][e]),r[9]=parseFloat(c["matrix[3][2]"][e]),r[10]=parseFloat(c["matrix[3][3]"][e]),r[3]=parseFloat(c["vector[1]"][e]),r[7]=parseFloat(c["vector[2]"][e]),r[11]=parseFloat(c["vector[3]"][e]),i.transpose(),u.matrixList.push(i)}})),0===u.matrixList.length&&delete n.NCS}var h={};if(t.cell){var l=t.cell,p=parseFloat(l.length_a),d=parseFloat(l.length_b),f=parseFloat(l.length_c),m=new Float32Array(9);m[0]=p,m[4]=d,m[8]=f,e.boxes.push(m),h.a=p,h.b=d,h.c=f,h.alpha=parseFloat(l.angle_alpha),h.beta=parseFloat(l.angle_beta),h.gamma=parseFloat(l.angle_gamma)}t.symmetry&&(h.spacegroup=Vg(t.symmetry["space_group_name_H-M"]));var g=new N;if(t.database_PDB_matrix){var v=t.database_PDB_matrix,y=g.elements;y[0]=parseFloat(v["origx[1][1]"]),y[1]=parseFloat(v["origx[1][2]"]),y[2]=parseFloat(v["origx[1][3]"]),y[4]=parseFloat(v["origx[2][1]"]),y[5]=parseFloat(v["origx[2][2]"]),y[6]=parseFloat(v["origx[2][3]"]),y[8]=parseFloat(v["origx[3][1]"]),y[9]=parseFloat(v["origx[3][2]"]),y[10]=parseFloat(v["origx[3][3]"]),y[3]=parseFloat(v["origx_vector[1]"]),y[7]=parseFloat(v["origx_vector[2]"]),y[11]=parseFloat(v["origx_vector[3]"]),g.transpose(),h.origx=g}var b=new N;if(t.atom_sites){var x=t.atom_sites,_=b.elements;_[0]=parseFloat(x["fract_transf_matrix[1][1]"]),_[1]=parseFloat(x["fract_transf_matrix[1][2]"]),_[2]=parseFloat(x["fract_transf_matrix[1][3]"]),_[4]=parseFloat(x["fract_transf_matrix[2][1]"]),_[5]=parseFloat(x["fract_transf_matrix[2][2]"]),_[6]=parseFloat(x["fract_transf_matrix[2][3]"]),_[8]=parseFloat(x["fract_transf_matrix[3][1]"]),_[9]=parseFloat(x["fract_transf_matrix[3][2]"]),_[10]=parseFloat(x["fract_transf_matrix[3][3]"]),_[3]=parseFloat(x["fract_transf_vector[1]"]),_[7]=parseFloat(x["fract_transf_vector[2]"]),_[11]=parseFloat(x["fract_transf_vector[3]"]),b.transpose(),h.scale=b}void 0!==h.a?e.unitcell=new kg(h):e.unitcell=void 0}(T,_,E),function(t,e,i){var r=t.struct_conn;if(r){$g(r,"id");for(var n=/"/g,o=e.getAtomProxy(),a=e.getAtomProxy(),s={},c=0,u=r.id.length;c<u;++c){var h=r.conn_type_id[c];if("hydrog"!==h&&"mismat"!==h&&"saltbr"!==h&&("1_555"===r.ptnr1_symmetry[c]&&"1_555"===r.ptnr2_symmetry[c])){var l=r.pdbx_ptnr1_PDB_ins_code[c],p=r.pdbx_ptnr1_label_alt_id[c],d=r.ptnr1_auth_seq_id[c]+(Hg(l)?"^"+l:"")+":"+i[r.ptnr1_label_asym_id[c]]+"."+r.ptnr1_label_atom_id[c].replace(n,"")+(Hg(p)?"%"+p:""),f=s[d];if(!f){var m=new nc(d);if(m.selection.error){gc&&mc.warn("invalid selection for connection",d);continue}f=e.getAtomIndices(m),s[d]=f}var g=r.pdbx_ptnr2_PDB_ins_code[c],v=r.pdbx_ptnr2_label_alt_id[c],y=r.ptnr2_auth_seq_id[c]+(Hg(g)?"^"+g:"")+":"+i[r.ptnr2_label_asym_id[c]]+"."+r.ptnr2_label_atom_id[c].replace(n,"")+(Hg(v)?"%"+v:""),b=s[y];if(!b){var x=new nc(y);if(x.selection.error){gc&&mc.warn("invalid selection for connection",y);continue}b=e.getAtomIndices(x),s[y]=b}var _=f.length,w=b.length;if(_>w){var S=_;_=w,w=S;var A=f;f=b,b=A}if(0!==_&&0!==w)for(var M=0;M<w;++M)o.index=f[M%_],a.index=b[M],o&&a?e.bondStore.addBond(o,a,Xg(r.pdbx_value_order[c])):mc.log("atoms for connection not found");else gc&&mc.warn("no atoms found for",d,y)}}}}(T,_,E),function(t,e,i){if(t.entity){$g(t.entity,"id");for(var r=t.entity,n=r.id.length,o=0;o<n;++o){var a=r.pdbx_description[o],s=r.type[o],c=Array.from(i[r.id[o]]);e.entityList[o]=new Ng(e,o,a,s,c)}}}(T,_,C),T.struct&&T.struct.title&&(_.title=T.struct.title.trim().replace(Gg,"")),T.entry&&T.entry.id&&(_.id=T.entry.id.trim().replace(Gg,"")),T.database_PDB_rev){if(T.database_PDB_rev.date){$g(T.database_PDB_rev,"date");var Y=T.database_PDB_rev.date.filter(Hg);Y.length&&(_.header.releaseDate=Y[Y.length-1])}if(T.database_PDB_rev.date_original){$g(T.database_PDB_rev,"date_original");var Z=T.database_PDB_rev.date_original.filter(Hg);Z.length&&(_.header.depositionDate=Z[Z.length-1])}}T.reflns&&T.reflns.d_resolution_high?Hg(T.reflns.d_resolution_high)&&(_.header.resolution=parseFloat(T.reflns.d_resolution_high)):T.refine&&T.refine.ls_d_res_high&&Hg(T.refine.ls_d_res_high)&&(_.header.resolution=parseFloat(T.refine.ls_d_res_high)),T.refine&&T.refine.ls_R_factor_R_free&&Hg(T.refine.ls_R_factor_R_free)&&(_.header.rFree=parseFloat(T.refine.ls_R_factor_R_free)),T.refine&&T.refine.ls_R_factor_R_work&&Hg(T.refine.ls_R_factor_R_work)&&(_.header.rWork=parseFloat(T.refine.ls_R_factor_R_work)),T.exptl&&T.exptl.method&&($g(T.exptl,"method"),_.header.experimentalMethods=T.exptl.method.map((function(t){return t.replace(Gg,"")}))),w.finalize(),_.finalizeAtoms(),jp(_),_.finalizeBonds(),q?Dp(_,q):zp(_),$p(_),_.extraData.cif=T}gc&&mc.timeEnd("CifParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("cif",qg),_c.add("mcif",qg),_c.add("mmcif",qg);var Yg=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"gro"},e.prototype._parse=function(){gc&&mc.time("GroParser._parse "+this.name);var t,e,i=this.structure,r=this.structureBuilder,n=this.firstModelOnly,o=this.asTrajectory,a=this.cAlphaOnly,s=i.frames,c=i.boxes,u=this.streamer.peekLines(3);i.title=u[0].trim();var h,l,p,d,f=5+(u[2].length-u[2].lastIndexOf(".")-1),m=20+f,g=20+2*f,v=parseInt(u[1]),y=v+3,b=i.atomMap,x=i.atomStore;x.resize(v);var _=0,w=0,S=0;this.streamer.eachChunkOfLines((function(i){!function(i,u,A){for(var M=i;M<u;++M){var P=++S-1,T=A[M];if(T)if(P%y==0)o&&(t=new Float32Array(3*v),s.push(t),e=0);else if(P%y==1);else if(P%y==y-1){var E=T.trim().split(/\s+/),C=new Float32Array(9);if(C[0]=10*parseFloat(E[0]),C[4]=10*parseFloat(E[1]),C[8]=10*parseFloat(E[2]),c.push(C),n)return!0;w+=1}else{if(h=T.substr(10,5).trim(),a&&"CA"!==h)continue;var I=10*parseFloat(T.substr(20,f)),R=10*parseFloat(T.substr(m,f)),L=10*parseFloat(T.substr(g,f));if(o){var O=3*e;if(t[O+0]=I,t[O+1]=R,t[O+2]=L,e+=1,P>y)continue}l=T.substr(5,5).trim(),p=parseInt(T.substr(0,5)),d=parseInt(T.substr(15,5)),x.growIfFull(),x.atomTypeId[_]=b.add(h),x.x[_]=I,x.y[_]=R,x.z[_]=L,x.serial[_]=d,r.addAtom(w,"","",l,p,0,"l"),_+=1}}}(0,i.length,i)})),r.finalize(),i.finalizeAtoms(),Up(i),jp(i),i.finalizeBonds(),zp(i),gc&&mc.timeEnd("GroParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("gro",Yg);var Zg=["mmtfVersion","mmtfProducer","unitCell","spaceGroup","structureId","title","depositionDate","releaseDate","experimentalMethods","resolution","rFree","rWork","bioAssemblyList","ncsOperatorList","entityList","groupList","numBonds","numAtoms","numGroups","numChains","numModels","groupsPerChain","chainsPerModel"].concat(["xCoordList","yCoordList","zCoordList","groupIdList","groupTypeList","chainIdList","bFactorList","atomIdList","altLocList","occupancyList","secStructList","insCodeList","sequenceIndexList","chainNameList","bondAtomList","bondOrderList"]);function Kg(t,e,i){return e?new t(e.buffer,e.byteOffset,e.byteLength/(i||1)):void 0}function Qg(t){return Kg(DataView,t)}function Jg(t){return Kg(Int8Array,t)}function tv(t){return Kg(Int32Array,t,4)}function ev(t,e){var i=t.length/2;e||(e=new Int16Array(i));for(var r=0,n=0;r<i;++r,n+=2)e[r]=t[n]<<8^t[n+1]<<0;return e}function iv(t,e){var i=t.length/4;e||(e=new Int32Array(i));for(var r=0,n=0;r<i;++r,n+=4)e[r]=t[n]<<24^t[n+1]<<16^t[n+2]<<8^t[n+3]<<0;return e}function rv(t,e,i){var r=t.length,n=1/e;i||(i=new Float32Array(r));for(var o=0;o<r;++o)i[o]=t[o]*n;return i}function nv(t,e){var i,r;if(!e){var n=0;for(i=0,r=t.length;i<r;i+=2)n+=t[i+1];e=new t.constructor(n)}var o=0;for(i=0,r=t.length;i<r;i+=2)for(var a=t[i],s=t[i+1],c=0;c<s;++c)e[o]=a,++o;return e}function ov(t,e){var i=t.length;e||(e=new t.constructor(i)),i&&(e[0]=t[0]);for(var r=1;r<i;++r)e[r]=t[r]+e[r-1];return e}function av(t,e){var i,r,n=t instanceof Int8Array?127:32767,o=-n-1,a=t.length;if(!e){var s=0;for(i=0;i<a;++i)t[i]<n&&t[i]>o&&++s;e=new Int32Array(s)}for(i=0,r=0;i<a;){for(var c=0;t[i]===n||t[i]===o;)c+=t[i],++i;c+=t[i],++i,e[r]=c,++r}return e}function sv(t,e,i){return rv(av(t,tv(i)),e,i)}function cv(t,e,i){var r=av(t,tv(i));return function(t,e,i){return rv(ov(t,tv(i)),e,i)}(r,e,Kg(Float32Array,r,4))}function uv(t,e,i,r){switch(t){case 1:return function(t,e){var i=t.length;e||(e=new Float32Array(i/4));for(var r=Qg(e),n=Qg(t),o=0,a=0,s=i/4;o<s;++o,a+=4)r.setFloat32(a,n.getFloat32(a),!0);return e}(e);case 2:return Jg(e);case 3:return ev(e);case 4:return iv(e);case 5:return Kg(Uint8Array,e);case 6:return nv(iv(e),new Uint8Array(i));case 7:return nv(iv(e));case 8:return ov(nv(iv(e)),n);case 9:return function(t,e,i){return rv(nv(t,tv(i)),e,i)}(iv(e),iv(r)[0]);case 10:return cv(ev(e),iv(r)[0]);case 11:return rv(ev(e),iv(r)[0]);case 12:return sv(ev(e),iv(r)[0]);case 13:return sv(Jg(e),iv(r)[0]);case 14:return av(ev(e));case 15:return av(Jg(e))}var n}function hv(t,e){var i=(e=e||{}).ignoreFields,r={};return Zg.forEach((function(e){var n=!!i&&-1!==i.indexOf(e),o=t[e];n||void 0===o||(o instanceof Uint8Array?r[e]=uv.apply(null,function(t){var e=Qg(t),i=e.getInt32(0),r=e.getInt32(4),n=t.subarray(8,12);return[i,t=t.subarray(12),r,n]}(o)):r[e]=o)})),r}var lv={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)},pv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"mmtf"},e.prototype._parse=function(){var t,e,i,r,n;gc&&mc.time("MmtfParser._parse "+this.name);var o,a,s,c,u,h,l=this.structure,p=hv(function(t){var e=0,i=new DataView(t.buffer);function r(t){for(var e={},i=0;i<t;i++){e[s()]=s()}return e}function n(i){var r=t.subarray(e,e+i);return e+=i,r}function o(i){var r=t.subarray(e,e+i);e+=i;if(i>65535){for(var n=[],o=0;o<r.length;o+=65535)n.push(String.fromCharCode.apply(null,r.subarray(o,o+65535)));return n.join("")}return String.fromCharCode.apply(null,r)}function a(t){for(var e=new Array(t),i=0;i<t;i++)e[i]=s();return e}function s(){var s,c,u=t[e];if(0==(128&u))return e++,u;if(128==(240&u))return e++,r(c=15&u);if(144==(240&u))return e++,a(c=15&u);if(160==(224&u))return e++,o(c=31&u);if(224==(224&u))return s=i.getInt8(e),e++,s;switch(u){case 192:return e++,null;case 194:return e++,!1;case 195:return e++,!0;case 196:return c=i.getUint8(e+1),e+=2,n(c);case 197:return c=i.getUint16(e+1),e+=3,n(c);case 198:return c=i.getUint32(e+1),e+=5,n(c);case 202:return s=i.getFloat32(e+1),e+=5,s;case 203:return s=i.getFloat64(e+1),e+=9,s;case 204:return s=t[e+1],e+=2,s;case 205:return s=i.getUint16(e+1),e+=3,s;case 206:return s=i.getUint32(e+1),e+=5,s;case 208:return s=i.getInt8(e+1),e+=2,s;case 209:return s=i.getInt16(e+1),e+=3,s;case 210:return s=i.getInt32(e+1),e+=5,s;case 217:return c=i.getUint8(e+1),e+=2,o(c);case 218:return c=i.getUint16(e+1),e+=3,o(c);case 219:return c=i.getUint32(e+1),e+=5,o(c);case 220:return c=i.getUint16(e+1),e+=3,a(c);case 221:return c=i.getUint32(e+1),e+=5,a(c);case 222:return c=i.getUint16(e+1),e+=3,r(c);case 223:return c=i.getUint32(e+1),e+=5,r(c)}throw new Error("Unknown type 0x"+u.toString(16))}return s()}(this.streamer.data));if(["depositionDate","releaseDate","resolution","rFree","rWork","experimentalMethods"].forEach((function(t){void 0!==p[t]&&(l.header[t]=p[t])})),l.id=p.structureId,l.title=p.title,this.firstModelOnly||this.asTrajectory){for(u=1,s=0,t=0,e=c=p.chainsPerModel[0];t<e;++t)s+=p.groupsPerChain[t];for(a=0,t=0,e=s;t<e;++t)a+=(n=p.groupList[p.groupTypeList[t]]).atomNameList.length;o=p.numBonds,h=[c]}else o=p.numBonds,a=p.numAtoms,s=p.numGroups,c=p.numChains,u=p.numModels,h=p.chainsPerModel;if(o+=s,this.asTrajectory)for(t=0,e=p.numModels;t<e;++t){var d=new Float32Array(3*a),f=a*t;for(i=0;i<a;++i){var m=3*i,g=i+f;d[m]=p.xCoordList[g],d[m+1]=p.yCoordList[g],d[m+2]=p.zCoordList[g]}l.frames.push(d)}var v=new Uint32Array(o),y=new Uint32Array(o),b=new Uint8Array(o),x=new Uint32Array(a),_=new Uint32Array(s),w=new Uint32Array(s),S=new Uint16Array(s),A=new Uint16Array(c),M=new Uint32Array(c),P=new Uint32Array(c),T=new Uint32Array(u),E=new Uint32Array(u),C=0;for(t=0,e=u;t<e;++t){var I=h[t];for(T[t]=C,E[t]=I,i=0;i<I;++i)A[i+C]=t;C+=I}var R=p.groupsPerChain,L=0;for(t=0,e=c;t<e;++t){var O=R[t];for(M[t]=L,P[t]=O,i=0;i<O;++i)_[i+L]=t;L+=O}var D=0,k=0;for(t=0,e=s;t<e;++t){var F=(n=p.groupList[p.groupTypeList[t]]).atomNameList.length,B=n.bondAtomList,z=n.bondOrderList;for(i=0,r=z.length;i<r;++i)v[k]=D+B[2*i],y[k]=D+B[2*i+1],b[k]=z[i],k+=1;for(w[t]=D,S[t]=F,i=0;i<F;++i)x[D]=t,D+=1}var U=p.bondAtomList;if(U)for(p.bondOrderList&&b.set(p.bondOrderList,k),t=0,e=U.length;t<e;t+=2){var j=U[t],G=U[t+1];j<a&&G<a&&(v[k]=j,y[k]=G,k+=1)}l.bondStore.length=b.length,l.bondStore.count=k,l.bondStore.atomIndex1=v,l.bondStore.atomIndex2=y,l.bondStore.bondOrder=b,l.atomStore.length=a,l.atomStore.count=a,l.atomStore.residueIndex=x,l.atomStore.atomTypeId=new Uint16Array(a),l.atomStore.x=p.xCoordList.subarray(0,a),l.atomStore.y=p.yCoordList.subarray(0,a),l.atomStore.z=p.zCoordList.subarray(0,a),l.atomStore.serial=p.atomIdList.subarray(0,a),l.atomStore.bfactor=p.bFactorList.subarray(0,a),l.atomStore.altloc=p.altLocList.subarray(0,a),l.atomStore.occupancy=p.occupancyList.subarray(0,a),l.residueStore.length=s,l.residueStore.count=s,l.residueStore.chainIndex=_,l.residueStore.residueTypeId=p.groupTypeList,l.residueStore.atomOffset=w,l.residueStore.atomCount=S,l.residueStore.resno=p.groupIdList.subarray(0,s),l.residueStore.sstruc=p.secStructList.subarray(0,s),l.residueStore.inscode=p.insCodeList.subarray(0,s),l.chainStore.length=c,l.chainStore.count=c,l.chainStore.entityIndex=new Uint16Array(c),l.chainStore.modelIndex=A,l.chainStore.residueOffset=M,l.chainStore.residueCount=P,l.chainStore.chainname=p.chainNameList.subarray(0,4*c),l.chainStore.chainid=p.chainIdList.subarray(0,4*c),l.modelStore.length=u,l.modelStore.count=u,l.modelStore.chainOffset=T,l.modelStore.chainCount=E;var V={};for(t=0,e=p.groupList.length;t<e;++t){var $=p.groupList[t],H=[];for(i=0,r=$.atomNameList.length;i<r;++i){var W=$.elementList[i].toUpperCase(),X=$.atomNameList[i];H.push(l.atomMap.add(X,W))}var q=$.chemCompType.toUpperCase(),Y=ll.includes(q),Z=$.bondOrderList.length,K=new Array(Z),Q=new Array(Z);for(i=0;i<Z;++i)K[i]=$.bondAtomList[2*i],Q[i]=$.bondAtomList[2*i+1];var J={atomIndices1:K,atomIndices2:Q,bondOrders:$.bondOrderList};V[t]=l.residueMap.add($.groupName,H,Y,q,J)}for(t=0,e=s;t<e;++t)l.residueStore.residueTypeId[t]=V[l.residueStore.residueTypeId[t]];for(t=0,e=l.atomStore.count;t<e;++t){var tt=l.atomStore.residueIndex[t],et=l.residueMap.list[l.residueStore.residueTypeId[tt]],it=l.residueStore.atomOffset[tt];l.atomStore.atomTypeId[t]=et.atomTypeIdList[t-it]}if(p.secStructList){var rt=p.secStructList.length;for(t=0,e=l.residueStore.count;t<e;++t){var nt=lv[l.residueStore.sstruc[t%rt]];void 0!==nt&&(l.residueStore.sstruc[t]=nt)}}if(p.entityList&&p.entityList.forEach((function(t,e){l.entityList[e]=new Ng(l,e,t.description,t.type,t.chainIndexList)})),p.bioAssemblyList&&p.bioAssemblyList.forEach((function(t,e){var i=e+1,r=new Rp(i);l.biomolDict["BU"+i]=r;var n={};t.transformList.forEach((function(t){var e=(new N).fromArray(t.matrix).transpose(),i=t.chainIndexList.map((function(t){for(var e="",i=0;i<4;++i){var r=p.chainNameList[4*t+i];if(!r)break;e+=String.fromCharCode(r)}return e})),o=n[i];o?o.matrixList.push(e):n[i]=r.addPart([e],i)}))})),p.ncsOperatorList){var ot=new Rp("NCS"),at=ot.addPart();p.ncsOperatorList.forEach((function(t){var e=(new N).fromArray(t).transpose();at.matrixList.push(e)})),at.matrixList.length>0&&(l.biomolDict.NCS=ot)}var st=p.unitCell;st&&Array.isArray(st)&&st[0]?l.unitcell=new kg({a:st[0],b:st[1],c:st[2],alpha:st[3],beta:st[4],gamma:st[5],spacegroup:p.spaceGroup}):l.unitcell=void 0,Vp(l,!0),Gp(l,!0),l.finalizeAtoms(),l.finalizeBonds(),$p(l),gc&&mc.timeEnd("MmtfParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("mmtf",pv);var dv=/\s+/,fv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"mol2"},e.prototype._parse=function(){gc&&mc.time("Mol2Parser._parse "+this.name);var t,e,i=this.structure,r=this.structureBuilder,n=this.firstModelOnly,o=this.asTrajectory,a=i.frames,s=!1,c=i.atomMap,u=i.atomStore;u.resize(Math.round(this.streamer.data.length/60));var h=0,l=0,p=0,d=-1,f=0,m=0,g=i.getAtomProxy(),v=i.getAtomProxy(),y={1:1,2:2,3:3,am:1,ar:1,du:1,un:1,nc:0};this.streamer.eachChunkOfLines((function(b){!function(b,x,_){for(var w,S=b;S<x;++S){var A=_[S].trim();if(""!==A&&"#"!==A[0])if("@"===A[0])"@<TRIPOS>MOLECULE"===A?(m=1,l=0,++d):"@<TRIPOS>ATOM"===A?(m=2,p=u.count,o&&(e=0,t=new Float32Array(3*f),a.push(t),d>0&&(s=!0))):m="@<TRIPOS>BOND"===A?3:0;else if(1===m)0===l?(i.title=A,i.id=A):1===l&&(w=A.split(dv),f=parseInt(w[0])),++l;else if(2===m){if(w=A.split(dv),n&&d>0)continue;var M=parseFloat(w[2]),P=parseFloat(w[3]),T=parseFloat(w[4]);if(o){var E=3*e;if(t[E+0]=M,t[E+1]=P,t[E+2]=T,e+=1,s)continue}var C=w[0],I=w[1],R=w[5].split(".")[0],L=w[6]?parseInt(w[6]):1,O=w[7]?w[7]:"",N=w[8]?parseFloat(w[8]):0;u.growIfFull(),u.atomTypeId[h]=c.add(I,R),u.x[h]=M,u.y[h]=P,u.z[h]=T,u.serial[h]=C,u.bfactor[h]=N,r.addAtom(d,"","",O,L,1),h+=1}else if(3===m){if(n&&d>0)continue;if(o&&d>0)continue;w=A.split(dv),g.index=parseInt(w[1])-1+p,v.index=parseInt(w[2])-1+p;var D=y[w[3]];i.bondStore.addBond(g,v,D)}}}(0,b.length,b)})),r.finalize(),i.finalizeAtoms(),Up(i),Gp(i,!0),Vp(i,!0),i.finalizeBonds(),qp(i),zp(i),gc&&mc.timeEnd("Mol2Parser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("mol2",fv);var mv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"pqr"},Object.defineProperties(e.prototype,i),e}(Bg);_c.add("pqr",mv);var gv=/\s+/,vv=/(^\*|REMARK)*/,yv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"psf"},e.prototype._parse=function(){gc&&mc.time("PsfParser._parse "+this.name);var t,e,i,r,n=this.structure,o=this.structureBuilder,a=n.atomMap,s=n.atomStore,c=[],u=0,h=0;this.streamer.eachChunkOfLines((function(n){!function(n,l,p){for(var d=n;d<l;++d){var f=p[d].trim();if(f)if(2===t){var m=f.split(gv),g=parseInt(m[0]),v=parseInt(m[2]),y=m[3],b=m[4];s.growIfFull(),s.atomTypeId[u]=a.add(b),s.serial[u]=g,o.addAtom(0,"","",y,v,1),u+=1}else if(3===t)for(var x=f.split(gv),_=0,w=x.length;_<w;_+=2)e[h]=parseInt(x[_])-1,i[h]=parseInt(x[_+1])-1,r[h]=1,h+=1;else if(1===t)c.push(f.replace(vv,"").trim());else if(4===t);else if(5===t);else if(6===t);else if(f.includes("!NATOM")){t=2;var S=parseInt(f.split(gv)[0]);s.resize(S)}else if(f.includes("!NBOND")){t=3;var A=parseInt(f.split(gv)[0]);e=new Uint32Array(A),i=new Uint32Array(A),r=new Uint8Array(A)}else f.includes("!NTITLE")?t=1:f.includes("!NTHETA")?t=4:f.includes("!NPHI")?t=5:f.includes("!NIMPHI")&&(t=6);else t=void 0}}(0,n.length,n)})),n.title=c.join(" "),n.bondStore.length=r.length,n.bondStore.count=h,n.bondStore.atomIndex1=e,n.bondStore.atomIndex2=i,n.bondStore.bondOrder=r,o.finalize(),n.finalizeAtoms(),Up(n),n.finalizeBonds(),qp(n),gc&&mc.timeEnd("PsfParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("psf",yv);var bv=/> <(.+)>/,xv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"sdf"},e.prototype._parse=function(){gc&&mc.time("SdfParser._parse "+this.name);var t=this.structure,e=this.structureBuilder,i=this.firstModelOnly,r=this.asTrajectory,n=this.streamer.peekLines(2);t.id=n[0].trim(),t.title=n[1].trim();var o,a,s=t.frames,c=!1,u=t.atomMap,h=t.atomStore;h.resize(Math.round(this.streamer.data.length/50));var l,p,d,f,m,g,v,y=t.getAtomProxy(),b=t.getAtomProxy(),x=0,_=0,w=0,S=0,A=[],M=!1,P={};t.extraData.sdf=A,this.streamer.eachChunkOfLines((function(n){!function(n,T,E){for(var C=n;C<T;++C){var I=E[C];if("$$$$"===I.substr(0,4))_=-1,++w,S=h.count,A.push(P),P={},M=!1;else if(3===_)p=parseInt(I.substr(0,3)),d=parseInt(I.substr(3,3)),v=(g=m=(f=4)+p)+d,r&&(a=0,o=new Float32Array(3*p),s.push(o),w>0&&(c=!0));else if(_>=f&&_<m){if(i&&w>0)continue;var R=parseFloat(I.substr(0,10)),L=parseFloat(I.substr(10,10)),O=parseFloat(I.substr(20,10));if(r){var N=3*a;if(o[N+0]=R,o[N+1]=L,o[N+2]=O,a+=1,c)continue}var D=I.substr(31,3).trim(),k=D+(x+1);h.growIfFull(),h.atomTypeId[x]=u.add(k,D),h.x[x]=R,h.y[x]=L,h.z[x]=O,h.serial[x]=x,e.addAtom(w,"","","HET",1,1),x+=1}else if(_>=g&&_<v){if(i&&w>0)continue;if(r&&w>0)continue;y.index=parseInt(I.substr(0,3))-1+S,b.index=parseInt(I.substr(3,3))-1+S;var F=parseInt(I.substr(6,3));t.bondStore.addBond(y,b,F)}else(l=I.match(bv))?(M=l[1],P[M]=[]):!1!==M&&I&&P[M].push(I);++_}}(0,n.length,n)})),e.finalize(),t.finalizeAtoms(),t.finalizeBonds(),qp(t),gc&&mc.timeEnd("SdfParser._parse "+this.name)},e.prototype._postProcess=function(){qp(this.structure)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("sdf",xv),_c.add("sd",xv);var _v=function(t,e){this.name=t,this.path=e,this.coordinates=[],this.boxes=[]},wv={type:{}};wv.type.get=function(){return"Frames"},Object.defineProperties(_v.prototype,wv);var Sv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"dcd"},e.prototype._parse=function(){gc&&mc.time("DcdParser._parse "+this.name);var t=this.streamer.data;t instanceof Uint8Array&&(t=t.buffer);var e,i,r=new DataView(t),n=this.frames,o=n.coordinates,a=n.boxes,s={},c=0,u=new Int32Array(t,0,23),h=u[0]!==r.getInt32(0);if(84!==u[0])for(i=t.byteLength,e=0;e<i;e+=4)r.setFloat32(e,r.getFloat32(e),!0);84!==u[0]&&mc.error("dcd bad format, header block start"),"CORD"!==String.fromCharCode(r.getUint8(4),r.getUint8(5),r.getUint8(6),r.getUint8(7))&&mc.error("dcd bad format, format string");var l=!1,p=!1,d=!1;0!==u[22]&&(l=!0,0!==u[12]&&(p=!0),1===u[13]&&(d=!0)),s.NSET=u[2],s.ISTART=u[3],s.NSAVC=u[4],s.NAMNF=u[10],s.DELTA=l?r.getFloat32(44,h):r.getFloat64(44,h),84!==u[22]&&mc.error("dcd bad format, header block end"),c=c+84+8;var f=r.getInt32(c,h),m=c+1;if((f-4)%80!=0&&mc.error("dcd bad format, title block start"),s.TITLE=Fo(new Uint8Array(t,m,f)),r.getInt32(m+f+4-1,h)!==f&&mc.error("dcd bad format, title block end"),c=c+f+8,4!==r.getInt32(c,h)&&mc.error("dcd bad format, natom block start"),s.NATOM=r.getInt32(c+4,h),4!==r.getInt32(c+8,h)&&mc.error("dcd bad format, natom block end"),c=c+4+8,s.NAMNF>0)mc.error("dcd format with fixed atoms unsupported, aborting");else{var g=s.NATOM,v=4*g;for(e=0,i=s.NSET;e<i;++e){if(p){c+=4;var y=new Float32Array(9);y[0]=r.getFloat64(c,h),y[4]=r.getFloat64(c+16,h),y[8]=r.getFloat64(c+40,h),a.push(y),c+=48,c+=4}for(var b=new Float32Array(3*g),x=0;x<3;++x){r.getInt32(c,h)!==v&&mc.error("dcd bad format, coord block start",e,x),c+=4;for(var _=new Float32Array(t,c,g),w=0;w<g;++w)b[3*w+x]=_[w];c+=v,r.getInt32(c,h)!==v&&mc.error("dcd bad format, coord block end",e,x),c+=4}if(o.push(b),d)c+=4+r.getInt32(c,h)+4}gc&&mc.timeEnd("DcdParser._parse "+this.name)}},Object.defineProperties(e.prototype,i),e}(function(t){function e(e,i){t.call(this,e,i),this.frames=new _v(this.name,this.path)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"trajectory"},i.__objName.get=function(){return"frames"},Object.defineProperties(e.prototype,i),e}(Ig));_c.add("dcd",Sv);var Av=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.volume=new lp(this.name,this.path),this.voxelSize=Eo(r.voxelSize,1)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"volume"},i.__objName.get=function(){return"volume"},e.prototype._afterParse=function(){this.volume.setMatrix(this.getMatrix())},e.prototype.getMatrix=function(){return new N},Object.defineProperties(e.prototype,i),e}(Ig),Mv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"cube"},e.prototype._parse=function(){gc&&mc.time("CubeParser._parse "+this.name);var t=this.volume,e=this.streamer.peekLines(6),i={},r=/\s+/,n=.529177210859*this.voxelSize;function o(t,i){var n=e[t].trim().split(r)[i];return parseFloat(n)}i.atomCount=Math.abs(o(2,0)),i.originX=.529177210859*o(2,1),i.originY=.529177210859*o(2,2),i.originZ=.529177210859*o(2,3),i.NVX=o(3,0),i.NVY=o(4,0),i.NVZ=o(5,0),i.basisX=new O(o(3,1),o(3,2),o(3,3)).multiplyScalar(n),i.basisY=new O(o(4,1),o(4,2),o(4,3)).multiplyScalar(n),i.basisZ=new O(o(5,1),o(5,2),o(5,3)).multiplyScalar(n);var a=new Float32Array(i.NVX*i.NVY*i.NVZ),s=0,c=0,u=o(2,0)>0?0:1;this.streamer.eachChunkOfLines((function(t){!function(t,e,n){for(var o=t;o<e;++o){var h=n[o].trim();if(""!==h&&c>=i.atomCount+6+u)for(var l=0,p=(h=h.split(r)).length;l<p;++l)1!==h.length&&(a[s]=parseFloat(h[l]),++s);++c}}(0,t.length,t)})),t.header=i,t.setData(a,i.NVZ,i.NVY,i.NVX),gc&&mc.timeEnd("CubeParser._parse "+this.name)},e.prototype.getMatrix=function(){var t=this.volume.header,e=new N;return e.multiply((new N).makeTranslation(t.originX,t.originY,t.originZ)),e.multiply((new N).makeBasis(t.basisZ,t.basisY,t.basisX)),e},Object.defineProperties(e.prototype,i),e}(Av);_c.add("cub",Mv),_c.add("cube",Mv);var Pv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"dsn6"},e.prototype._parse=function(){gc&&mc.time("Dsn6Parser._parse "+this.name);var t=this.streamer.data;t instanceof Uint8Array&&(t=t.buffer);var e,i,r=this.volume,n={},o=new Int16Array(t),a=new Uint8Array(t),s=String.fromCharCode.apply(null,a.subarray(0,512));if(s.startsWith(":-)"))n.xStart=parseInt(s.substr(10,5)),n.yStart=parseInt(s.substr(15,5)),n.zStart=parseInt(s.substr(20,5)),n.xExtent=parseInt(s.substr(32,5)),n.yExtent=parseInt(s.substr(38,5)),n.zExtent=parseInt(s.substr(42,5)),n.xRate=parseInt(s.substr(52,5)),n.yRate=parseInt(s.substr(58,5)),n.zRate=parseInt(s.substr(62,5)),n.xlen=parseFloat(s.substr(73,10))*this.voxelSize,n.ylen=parseFloat(s.substr(83,10))*this.voxelSize,n.zlen=parseFloat(s.substr(93,10))*this.voxelSize,n.alpha=parseFloat(s.substr(103,10)),n.beta=parseFloat(s.substr(113,10)),n.gamma=parseFloat(s.substr(123,10)),e=parseFloat(s.substr(138,12))/100,i=parseInt(s.substr(155,8));else{if(100!==o[18])for(var c=0,u=o.length;c<u;++c){var h=o[c];o[c]=(255&h)<<8|h>>8&255}n.xStart=o[0],n.yStart=o[1],n.zStart=o[2],n.xExtent=o[3],n.yExtent=o[4],n.zExtent=o[5],n.xRate=o[6],n.yRate=o[7],n.zRate=o[8];var l=1/o[17],p=l*this.voxelSize;n.xlen=o[9]*p,n.ylen=o[10]*p,n.zlen=o[11]*p,n.alpha=o[12]*l,n.beta=o[13]*l,n.gamma=o[14]*l,e=o[15]/100,i=o[16]}r.header=n,mc.log(n,e,i);for(var d=new Float32Array(n.xExtent*n.yExtent*n.zExtent),f=512,m=Math.ceil(n.xExtent/8),g=Math.ceil(n.yExtent/8),v=Math.ceil(n.zExtent/8),y=0;y<v;++y)for(var b=0;b<g;++b)for(var x=0;x<m;++x)for(var _=0;_<8;++_)for(var w=8*y+_,S=0;S<8;++S)for(var A=8*b+S,M=0;M<8;++M){var P=8*x+M;if(!(P<n.xExtent&&A<n.yExtent&&w<n.zExtent)){f+=8-M;break}d[(P*n.yExtent+A)*n.zExtent+w]=(a[f]-i)/e,++f}r.setData(d,n.zExtent,n.yExtent,n.xExtent),gc&&mc.timeEnd("Dsn6Parser._parse "+this.name)},e.prototype.getMatrix=function(){var t=this.volume.header,e=[t.xlen,0,0],i=[t.ylen*Math.cos(Math.PI/180*t.gamma),t.ylen*Math.sin(Math.PI/180*t.gamma),0],r=[t.zlen*Math.cos(Math.PI/180*t.beta),t.zlen*(Math.cos(Math.PI/180*t.alpha)-Math.cos(Math.PI/180*t.gamma)*Math.cos(Math.PI/180*t.beta))/Math.sin(Math.PI/180*t.gamma),0];r[2]=Math.sqrt(t.zlen*t.zlen*Math.sin(Math.PI/180*t.beta)*Math.sin(Math.PI/180*t.beta)-r[1]*r[1]);var n=[0,e,i,r],o=[0,t.xRate,t.yRate,t.zRate],a=[0,1,2,3],s=new N;return s.set(n[a[1]][0]/o[a[1]],n[a[2]][0]/o[a[2]],n[a[3]][0]/o[a[3]],0,n[a[1]][1]/o[a[1]],n[a[2]][1]/o[a[2]],n[a[3]][1]/o[a[3]],0,n[a[1]][2]/o[a[1]],n[a[2]][2]/o[a[2]],n[a[3]][2]/o[a[3]],0,0,0,0,1),s.multiply((new N).makeRotationY(Qo(90))),s.multiply((new N).makeTranslation(-t.zStart,t.yStart,t.xStart)),s.multiply((new N).makeScale(-1,1,1)),s},Object.defineProperties(e.prototype,i),e}(Av);_c.add("dsn6",Pv),_c.add("brix",Pv);var Tv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"dx"},e.prototype._parse=function(){gc&&mc.time("DxParser._parse "+this.name);var t=this.volume,e=this.streamer.peekLines(30),i=this.parseHeaderLines(e),r=this.volume.header,n=i.dataLineStart,o=/\s+/,a=r.nx*r.ny*r.nz,s=new Float32Array(a),c=0,u=0;this.streamer.eachChunkOfLines((function(t){!function(t,e,i){for(var r=t;r<e;++r){if(c<a&&u>n){var h=i[r].trim();if(""!==h)for(var l=h.split(o),p=0,d=l.length;p<d;++p)s[c]=parseFloat(l[p]),++c}++u}}(0,t.length,t)})),t.setData(s,r.nz,r.ny,r.nx),gc&&mc.timeEnd("DxParser._parse "+this.name)},e.prototype.parseHeaderLines=function(t){for(var e={},i=/\s+/,r=t.length,n=0,o=0,a=0,s=0;s<r;++s){var c,u=t[s];if(u.startsWith("object 1"))c=u.split(i),e.nx=parseInt(c[5]),e.ny=parseInt(c[6]),e.nz=parseInt(c[7]);else if(u.startsWith("origin"))c=u.split(i),e.xmin=parseFloat(c[1]),e.ymin=parseFloat(c[2]),e.zmin=parseFloat(c[3]);else if(u.startsWith("delta"))c=u.split(i),0===a?e.hx=parseFloat(c[1])*this.voxelSize:1===a?e.hy=parseFloat(c[2])*this.voxelSize:2===a&&(e.hz=parseFloat(c[3])*this.voxelSize),a+=1;else if(u.startsWith("object 3")){n=s,o+=u.length+1;break}o+=u.length+1}return this.volume.header=e,{dataLineStart:n,headerByteCount:o}},e.prototype.getMatrix=function(){var t=this.volume.header,e=new N;return e.multiply((new N).makeRotationY(Qo(90))),e.multiply((new N).makeTranslation(-t.zmin,t.ymin,t.xmin)),e.multiply((new N).makeScale(-t.hz,t.hy,t.hx)),e},Object.defineProperties(e.prototype,i),e}(Av);_c.add("dx",Tv);var Ev=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"dxbin"},e.prototype._parse=function(){gc&&mc.time("DxbinParser._parse "+this.name);var t=this.streamer.data;t instanceof Uint8Array&&(t=t.buffer);for(var e=function(t,e,i){e=void 0!==e?e:10485760,i=void 0!==i?i:"\n";for(var r="",n=[],o=0;o<t.length;o+=e){var a=Fo(t.subarray(o,o+e)),s=a.lastIndexOf(i);if(-1===s)r+=a;else{var c=r+a.substr(0,s);n=n.concat(c.split(i)),r=s===a.length-i.length?"":a.substr(s+i.length)}}return""!==r&&n.push(r),n}(new Uint8Array(t,0,1e3)),i=this.parseHeaderLines(e),r=this.volume.header,n=i.headerByteCount,o=r.nx*r.ny*r.nz,a=new DataView(t),s=new Float32Array(o),c=0;c<o;++c)s[c]=a.getFloat64(8*c+n,!0);this.volume.setData(s,r.nz,r.ny,r.nx),gc&&mc.timeEnd("DxbinParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Tv);_c.add("dxbin",Ev);var Cv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"mrc"},e.prototype._parse=function(){gc&&mc.time("MrcParser._parse "+this.name);var t=this.streamer.data;t instanceof Uint8Array&&(t=t.buffer);var e,i=this.volume,r={},n=new Int32Array(t,0,56),o=new Float32Array(t,0,56),a=new DataView(t);if(r.MAP=String.fromCharCode(a.getUint8(208),a.getUint8(209),a.getUint8(210),a.getUint8(211)),r.MACHST=[a.getUint8(212),a.getUint8(213)],17===r.MACHST[0]&&17===r.MACHST[1])for(var s=t.byteLength,c=0;c<s;c+=4)a.setFloat32(c,a.getFloat32(c),!0);if(r.NX=n[0],r.NY=n[1],r.NZ=n[2],r.MODE=n[3],r.NXSTART=n[4],r.NYSTART=n[5],r.NZSTART=n[6],r.MX=n[7],r.MY=n[8],r.MZ=n[9],r.xlen=o[10]*this.voxelSize,r.ylen=o[11]*this.voxelSize,r.zlen=o[12]*this.voxelSize,r.alpha=o[13],r.beta=o[14],r.gamma=o[15],r.MAPC=n[16],r.MAPR=n[17],r.MAPS=n[18],r.DMIN=o[19],r.DMAX=o[20],r.DMEAN=o[21],r.ISPG=n[22],r.NSYMBT=n[23],r.LSKFLG=n[24],r.originX=o[49],r.originY=o[50],r.originZ=o[51],r.ARMS=o[54],i.header=r,2===r.MODE)e=new Float32Array(t,1024+r.NSYMBT,r.NX*r.NY*r.NZ);else if(0===r.MODE){if(e=new Float32Array(new Int8Array(t,1024+r.NSYMBT,r.NX*r.NY*r.NZ)),-128===n[39]&&127===n[40])for(var u=(r.DMAX-r.DMIN)/255,h=.5*(r.DMIN+r.DMAX+u),l=0,p=e.length;l<p;++l)e[l]=u*e[l]+h}else mc.error("MrcParser unknown mode",r.MODE);i.setData(e,r.NX,r.NY,r.NZ),gc&&mc.timeEnd("MrcParser._parse "+this.name)},e.prototype.getMatrix=function(){var t=this.volume.header,e=[t.xlen,0,0],i=[t.ylen*Math.cos(Math.PI/180*t.gamma),t.ylen*Math.sin(Math.PI/180*t.gamma),0],r=[t.zlen*Math.cos(Math.PI/180*t.beta),t.zlen*(Math.cos(Math.PI/180*t.alpha)-Math.cos(Math.PI/180*t.gamma)*Math.cos(Math.PI/180*t.beta))/Math.sin(Math.PI/180*t.gamma),0];r[2]=Math.sqrt(t.zlen*t.zlen*Math.sin(Math.PI/180*t.beta)*Math.sin(Math.PI/180*t.beta)-r[1]*r[1]);var n=[0,e,i,r],o=[0,t.MX,t.MY,t.MZ],a=[0,t.MAPC,t.MAPR,t.MAPS],s=new N;return s.set(n[a[1]][0]/o[a[1]],n[a[2]][0]/o[a[2]],n[a[3]][0]/o[a[3]],0,n[a[1]][1]/o[a[1]],n[a[2]][1]/o[a[2]],n[a[3]][1]/o[a[3]],0,n[a[1]][2]/o[a[1]],n[a[2]][2]/o[a[2]],n[a[3]][2]/o[a[3]],0,0,0,0,1),s.setPosition(new O(t.originX,t.originY,t.originZ)),s.multiply((new N).makeTranslation(t.NXSTART,t.NYSTART,t.NZSTART)),s},Object.defineProperties(e.prototype,i),e}(Av);_c.add("mrc",Cv),_c.add("ccp4",Cv),_c.add("map",Cv);var Iv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"xplor"},e.prototype._parse=function(){gc&&mc.time("XplorParser._parse "+this.name);var t,e=this.volume,i=this.streamer.peekLines(8),r={},n=/\s+/;function o(t){return t.trim().split(n).map(parseFloat)}var a=(t=i[2].startsWith("REMARKS")?parseInt(i[1].substring(0,8))+2:5)+3,s=o(i[t]);r.NA=s[0],r.AMIN=s[1],r.AMAX=s[2],r.NB=s[3],r.BMIN=s[4],r.BMAX=s[5],r.NC=s[6],r.CMIN=s[7],r.CMAX=s[8];var c=o(i[t+1]);r.a=c[0]*this.voxelSize,r.b=c[1]*this.voxelSize,r.c=c[2]*this.voxelSize,r.alpha=c[3],r.beta=c[4],r.gamma=c[5];var u=r.AMAX-r.AMIN+1,h=r.BMAX-r.BMIN+1,l=r.CMAX-r.CMIN+1,p=u*h*l,d=new Float32Array(p),f=0,m=0,g=1+u*h/6;this.streamer.eachChunkOfLines((function(t){!function(t,e,i){for(var r=t;r<e;++r){var n=i[r];if(m>=a&&(m-a)%g!=0&&f<p)for(var o=0;o<6;++o)d[f]=parseFloat(n.substr(12*o,12)),++f;++m}}(0,t.length,t)})),e.header=r,e.setData(d,u,h,l),gc&&mc.timeEnd("XplorParser._parse "+this.name)},e.prototype.getMatrix=function(){var t=this.volume.header,e=[t.a,0,0],i=[t.b*Math.cos(Math.PI/180*t.gamma),t.b*Math.sin(Math.PI/180*t.gamma),0],r=[t.c*Math.cos(Math.PI/180*t.beta),t.c*(Math.cos(Math.PI/180*t.alpha)-Math.cos(Math.PI/180*t.gamma)*Math.cos(Math.PI/180*t.beta))/Math.sin(Math.PI/180*t.gamma),0];r[2]=Math.sqrt(t.c*t.c*Math.sin(Math.PI/180*t.beta)*Math.sin(Math.PI/180*t.beta)-r[1]*r[1]);var n=[0,e,i,r],o=[0,t.NA,t.NB,t.NC],a=[0,1,2,3],s=new N;return s.set(n[a[1]][0]/o[a[1]],n[a[2]][0]/o[a[2]],n[a[3]][0]/o[a[3]],0,n[a[1]][1]/o[a[1]],n[a[2]][1]/o[a[2]],n[a[3]][1]/o[a[3]],0,n[a[1]][2]/o[a[1]],n[a[2]][2]/o[a[2]],n[a[3]][2]/o[a[3]],0,0,0,0,1),s.multiply((new N).makeTranslation(t.AMIN,t.BMIN,t.CMIN)),s},Object.defineProperties(e.prototype,i),e}(Av);_c.add("xplor",Iv),_c.add("cns",Iv);var Rv=function(t){function e(e,i){t.call(this,e,i),this.loader=this.getLoader(),this.surface=new cp(this.name,this.path)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"surface"},i.__objName.get=function(){return"surface"},e.prototype._parse=function(){var t=this.loader.parse(this.streamer.asText());this.surface.fromGeometry(t)},Object.defineProperties(e.prototype,i),e}(Ig);function Lv(){this.regexp={vertex_pattern:/^v\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)/,normal_pattern:/^vn\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)/,uv_pattern:/^vt\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)/,face_vertex:/^f\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)(?:\s+(-?\d+))?/,face_vertex_uv:/^f\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+))?/,face_vertex_uv_normal:/^f\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+)\/(-?\d+))?/,face_vertex_normal:/^f\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)(?:\s+(-?\d+)\/\/(-?\d+))?/,object_pattern:/^[og]\s*(.+)?/,smoothing_pattern:/^s\s+(\d+|on|off)/,material_library_pattern:/^mtllib /,material_use_pattern:/^usemtl /}}Lv.prototype={constructor:Lv,setPath:function(t){this.path=t},_createParserState:function(){var t={objects:[],object:{},vertices:[],normals:[],startObject:function(t,e){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=t,void(this.object.fromDeclaration=!1!==e);this.object={name:t||"",geometry:{vertices:[],normals:[]},fromDeclaration:!1!==e},this.objects.push(this.object)},parseVertexIndex:function(t,e){var i=parseInt(t,10);return 3*(i>=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 r=this.vertices,n=this.object.geometry.vertices;n.push(r[t+0]),n.push(r[t+1]),n.push(r[t+2]),n.push(r[e+0]),n.push(r[e+1]),n.push(r[e+2]),n.push(r[i+0]),n.push(r[i+1]),n.push(r[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 r=this.normals,n=this.object.geometry.normals;n.push(r[t+0]),n.push(r[t+1]),n.push(r[t+2]),n.push(r[e+0]),n.push(r[e+1]),n.push(r[e+2]),n.push(r[i+0]),n.push(r[i+1]),n.push(r[i+2])},addFace:function(t,e,i,r,n,o,a,s){var c,u=this.vertices.length,h=this.parseVertexIndex(t,u),l=this.parseVertexIndex(e,u),p=this.parseVertexIndex(i,u);if(void 0===r?this.addVertex(h,l,p):(c=this.parseVertexIndex(r,u),this.addVertex(h,l,c),this.addVertex(l,p,c)),void 0!==n){var d=this.normals.length;h=this.parseNormalIndex(n,d),l=n===o?h:this.parseNormalIndex(o,d),p=n===a?h:this.parseNormalIndex(a,d),void 0===r?this.addNormal(h,l,p):(c=this.parseNormalIndex(s,d),this.addNormal(h,l,c),this.addNormal(l,p,c))}},addLineGeometry:function(t){this.object.geometry.type="Line";for(var e=this.vertices.length,i=0,r=t.length;i<r;i++)this.addVertexLine(this.parseVertexIndex(t[i],e))}};return t.startObject("",!1),t},parse:function(t){var e,i,r=this._createParserState();-1!==t.indexOf("\r\n")&&(t=t.replace(/\r\n/g,"\n")),-1!==t.indexOf("\\\n")&&(t=t.replace(/\\\n/g,""));var n=t.split("\n"),o="",a="",s="",c=[],u="function"==typeof"".trimLeft;for(e=0,i=n.length;e<i;e++)if(o=n[e],0!==(o=u?o.trimLeft():o.trim()).length&&"#"!==(a=o.charAt(0)))if("v"===a){if(" "===(s=o.charAt(1))&&null!==(c=this.regexp.vertex_pattern.exec(o)))r.vertices.push(parseFloat(c[1]),parseFloat(c[2]),parseFloat(c[3]));else if("n"===s&&null!==(c=this.regexp.normal_pattern.exec(o)))r.normals.push(parseFloat(c[1]),parseFloat(c[2]),parseFloat(c[3]));else if("t"!==s||null===(c=this.regexp.uv_pattern.exec(o)))throw new Error("Unexpected vertex/normal/uv line: '"+o+"'")}else if("f"===a)if(null!==(c=this.regexp.face_vertex_uv_normal.exec(o)))r.addFace(c[1],c[4],c[7],c[10],c[3],c[6],c[9],c[12]);else if(null!==(c=this.regexp.face_vertex_uv.exec(o)));else if(null!==(c=this.regexp.face_vertex_normal.exec(o)))r.addFace(c[1],c[3],c[5],c[7],c[2],c[4],c[6],c[8]);else{if(null===(c=this.regexp.face_vertex.exec(o)))throw new Error("Unexpected face line: '"+o+"'");r.addFace(c[1],c[2],c[3],c[4])}else if("l"===a){var h=o.substring(1).trim().split(" "),l=[],p=[];if(-1===o.indexOf("/"))l=h;else for(var d=0,f=h.length;d<f;d++){var m=h[d].split("/");""!==m[0]&&l.push(m[0]),""!==m[1]&&p.push(m[1])}r.addLineGeometry(l,p)}else if(null!==(c=this.regexp.object_pattern.exec(o))){var g=c[0].substr(1).trim();r.startObject(g)}else if(this.regexp.material_use_pattern.test(o));else if(this.regexp.material_library_pattern.test(o));else if(null===(c=this.regexp.smoothing_pattern.exec(o))){if("\0"===o)continue;throw new Error("Unexpected line: '"+o+"'")}var v=[];for(e=0,i=r.objects.length;e<i;e++){var y=r.objects[e].geometry;if(0!==y.vertices.length){var b=new _e;b.addAttribute("position",new me(new Float32Array(y.vertices),3)),y.normals.length>0?b.addAttribute("normal",new me(new Float32Array(y.normals),3)):b.computeVertexNormals(),v.push(b)}}return v}};var Ov=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"obj"},e.prototype.getLoader=function(){return new Lv},Object.defineProperties(e.prototype,i),e}(Rv);function Nv(){this.propertyNameMapping={}}_c.add("obj",Ov),Nv.prototype={constructor:Nv,setPropertyNameMapping:function(t){this.propertyNameMapping=t},bin2str:function(t){for(var e=new Uint8Array(t),i="",r=0;r<t.byteLength;r++)i+=String.fromCharCode(e[r]);return i},isASCII:function(t){return"ascii"===this.parseHeader(this.bin2str(t)).format},parse:function(t){return t instanceof ArrayBuffer?this.isASCII(t)?this.parseASCII(this.bin2str(t)):this.parseBinary(t):this.parseASCII(t)},parseHeader:function(t){var e="",i=0,r=/ply([\s\S]*)end_header\s/.exec(t);null!==r&&(e=r[1],i=r[0].length);var n,o,a,s,c,u,h={comments:[],elements:[],headerLength:i},l=e.split("\n");for(var p=0;p<l.length;p++){var d=l[p];if(""!==(d=d.trim()))switch(o=(a=d.split(/\s+/)).shift(),d=a.join(" "),o){case"format":h.format=a[0],h.version=a[1];break;case"comment":h.comments.push(d);break;case"element":void 0!==n&&h.elements.push(n),(n={}).name=a[0],n.count=parseInt(a[1]),n.properties=[];break;case"property":n.properties.push((s=a,c=this.propertyNameMapping,u=void 0,"list"===(u={type:s[0]}).type?(u.name=s[3],u.countType=s[1],u.itemType=s[2]):u.name=s[1],u.name in c&&(u.name=c[u.name]),u));break;default:console.log("unhandled",o,a)}}return void 0!==n&&h.elements.push(n),h},parseASCIINumber:function(t,e){switch(e){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(t);case"float":case"double":case"float32":case"float64":return parseFloat(t)}},parseASCIIElement:function(t,e){for(var i=e.split(/\s+/),r={},n=0;n<t.length;n++)if("list"===t[n].type){for(var o=[],a=this.parseASCIINumber(i.shift(),t[n].countType),s=0;s<a;s++)o.push(this.parseASCIINumber(i.shift(),t[n].itemType));r[t[n].name]=o}else r[t[n].name]=this.parseASCIINumber(i.shift(),t[n].type);return r},parseASCII:function(t){var e,i=new fe,r=this.parseHeader(t),n="";null!==(e=/end_header\s([\s\S]*)$/.exec(t))&&(n=e[1]);var o=n.split("\n"),a=0,s=0;i.useColor=!1;for(var c=0;c<o.length;c++){var u=o[c];if(""!==(u=u.trim())){s>=r.elements[a].count&&(a++,s=0);var h=this.parseASCIIElement(r.elements[a].properties,u);this.handleElement(i,r.elements[a].name,h),s++}}return this.postProcess(i)},postProcess:function(t){if(t.useColor){for(var e=0;e<t.faces.length;e++)t.faces[e].vertexColors=[t.colors[t.faces[e].a],t.colors[t.faces[e].b],t.colors[t.faces[e].c]];t.elementsNeedUpdate=!0}return t.computeBoundingSphere(),t},handleElement:function(t,e,i){if("vertex"===e){if(t.vertices.push(new O(i.x,i.y,i.z)),"red"in i&&"green"in i&&"blue"in i){t.useColor=!0;var r=new St;r.setRGB(i.red/255,i.green/255,i.blue/255),t.colors.push(r)}}else if("face"===e){var n=i.vertex_indices;3===n.length?t.faces.push(new re(n[0],n[1],n[2])):4===n.length&&t.faces.push(new re(n[0],n[1],n[3]),new re(n[1],n[2],n[3]))}},binaryRead:function(t,e,i,r){switch(i){case"int8":case"char":return[t.getInt8(e),1];case"uint8":case"uchar":return[t.getUint8(e),1];case"int16":case"short":return[t.getInt16(e,r),2];case"uint16":case"ushort":return[t.getUint16(e,r),2];case"int32":case"int":return[t.getInt32(e,r),4];case"uint32":case"uint":return[t.getUint32(e,r),4];case"float32":case"float":return[t.getFloat32(e,r),4];case"float64":case"double":return[t.getFloat64(e,r),8]}},binaryReadElement:function(t,e,i,r){for(var n,o={},a=0,s=0;s<i.length;s++)if("list"===i[s].type){var c=[],u=(n=this.binaryRead(t,e+a,i[s].countType,r))[0];a+=n[1];for(var h=0;h<u;h++)n=this.binaryRead(t,e+a,i[s].itemType,r),c.push(n[0]),a+=n[1];o[i[s].name]=c}else n=this.binaryRead(t,e+a,i[s].type,r),o[i[s].name]=n[0],a+=n[1];return[o,a]},parseBinary:function(t){for(var e,i=new fe,r=this.parseHeader(this.bin2str(t)),n="binary_little_endian"===r.format,o=new DataView(t,r.headerLength),a=0,s=0;s<r.elements.length;s++)for(var c=0;c<r.elements[s].count;c++){a+=(e=this.binaryReadElement(o,a,r.elements[s].properties,n))[1];var u=e[0];this.handleElement(i,r.elements[s].name,u)}return this.postProcess(i)}};var Dv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"ply"},e.prototype.getLoader=function(){return new Nv},Object.defineProperties(e.prototype,i),e}(Rv);_c.add("ply",Dv);var kv=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.delimiter=Eo(r.delimiter,","),this.comment=Eo(r.comment,"#"),this.columnNames=Eo(r.columnNames,!1),this.table={name:this.name,path:this.path,columnNames:[],data:[]}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"csv"},i.__objName.get=function(){return"table"},e.prototype._parse=function(){var t=this,e=this.table.data,i=new RegExp("\\s*"+this.delimiter+"\\s*"),r=0;this.streamer.eachChunkOfLines((function(n){for(var o=n.length,a=0;a<o;++a){var s=n[a].trim();if(!s.startsWith(t.comment)){var c=s.split(i);0===r?t.table.columnNames=c:s&&e.push(c),++r}}}))},Object.defineProperties(e.prototype,i),e}(Ig);_c.add("csv",kv);var Fv=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.string=Eo(r.string,!1),this.json={name:this.name,path:this.path,data:{}}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"json"},i.__objName.get=function(){return"json"},e.prototype._parse=function(){this.streamer.isBinary()||this.string?this.json.data=JSON.parse(this.streamer.asText()):this.json.data=this.streamer.data},Object.defineProperties(e.prototype,i),e}(Ig);_c.add("json",Fv);var Bv=function(t){function e(e,i){t.call(this,e,i),this.text={name:this.name,path:this.path,data:""}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"text"},i.__objName.get=function(){return"text"},e.prototype._parse=function(){this.text.data=this.streamer.asText()},Object.defineProperties(e.prototype,i),e}(Ig);_c.add("txt",Bv),_c.add("text",Bv);var zv=/^['"]|['"]$/g,Uv=/^<([\w-:.]+)\s*/,jv=/^([^<]*)/,Gv=/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/;function Vv(t){return t=t.trim().replace(/<!--[\s\S]*?-->/g,""),{declaration:e(),root:i()};function e(){if(n(/^<\?xml\s*/)){for(var t={attributes:{}};!o()&&!a("?>");){var e=r();if(!e)return t;t.attributes[e.name]=e.value}return n(/\?>\s*/),t}}function i(){var t=n(Uv);if(t){for(var e,s={name:t[1],attributes:{},children:[]};!(o()||a(">")||a("?>")||a("/>"));){var c=r();if(!c)return s;s.attributes[c.name]=c.value}if(n(/^\s*\/>\s*/))return s;for(n(/\??>\s*/),s.content=function(){var t=n(jv);if(t)return t[1];return""}();e=i();)s.children.push(e);return n(/^<\/[\w-:.]+>\s*/),s}}function r(){var t,e=n(Gv);if(e)return{name:e[1],value:(t=e[2],t.replace(zv,""))}}function n(e){var i=t.match(e);if(i)return t=t.slice(i[0].length),i}function o(){return 0===t.length}function a(e){return 0===t.indexOf(e)}}var $v=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.useDomParser=Eo(r.useDomParser,!1),this.xml={name:this.name,path:this.path,data:{}}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"xml"},i.__objName.get=function(){return"xml"},e.prototype.__xmlParser=function(t){return Vv(t)},e.prototype.__domParser=function(t){return(new window.DOMParser).parseFromString(t,"text/xml")},e.prototype._parse=function(){gc&&mc.time("XmlParser._parse "+this.name),this.useDomParser?this.streamer.data instanceof window.Document?this.xml.data=this.streamer.data:this.xml.data=this.__domParser(this.streamer.asText()):this.xml.data=this.__xmlParser(this.streamer.asText()),gc&&mc.timeEnd("XmlParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Ig);function Hv(t,e,i){var r=t.icode.value,n=t.chain.value,o=t.altcode.value,a=t.resnum.value;return r.trim()&&(a+="^"+r),n.trim()&&(a+=":"+n),e&&(a+="."+e),i&&o.trim()&&(a+="%"+o),a+="/"+(parseInt(t.model.value)-1)}function Wv(t,e,i){void 0===t[e]?t[e]=i:t[e]|=i}function Xv(t,e){return void 0!==t&&t.value===e}function qv(t,e,i){for(var r=0,n=e.getElementsByTagName("clash"),o=0,a=n.length;o<a;++o)if(t[n[o].attributes.cid.value]){r+=1;break}return e.getElementsByTagName("angle-outlier").length>0&&(r+=1),e.getElementsByTagName("bond-outlier").length>0&&(r+=1),e.getElementsByTagName("plane-outlier").length>0&&(r+=1),Xv(i.rota,"OUTLIER")&&(r+=1),Xv(i.rama,"OUTLIER")&&(r+=1),Xv(i.RNApucker,"outlier")&&(r+=1),r}_c.add("xml",$v);var Yv=function(t,e){this.name=t,this.path=e,this.rsrzDict={},this.rsccDict={},this.clashDict={},this.clashArray=[],this.geoDict={},this.geoAtomDict={},this.atomDict={},this.clashSele="NONE"},Zv={type:{}};Zv.type.get=function(){return"validation"},Yv.prototype.fromXml=function(t){gc&&mc.time("Validation.fromXml");var e=this.rsrzDict,i=this.rsccDict,r=this.clashDict,n=this.clashArray,o=this.geoDict,a=this.geoAtomDict,s=this.atomDict,c=t.getElementsByTagName("ModelledSubgroup"),u={},h=[];gc&&mc.time("Validation.fromXml#clashDict");for(var l=0,p=c.length;l<p;++l){var d=c[l],f=d.attributes,m=Hv(f);void 0!==f.rsrz&&(e[m]=parseFloat(f.rsrz.value)),void 0!==f.rscc&&(i[m]=parseFloat(f.rscc.value)),f.sele=m;for(var g=d.getElementsByTagName("clash"),v=0,y=g.length;v<y;++v){var b=g[v].attributes,x=b.atom.value;if("H"!==Xp(x)){var _=b.cid.value,w=Hv(f,x,!0);if(s[w]=!0,void 0===u[_])u[_]={sele1:w,res1:m};else{var S=u[_];S.res1!==m&&(S.sele2=w,S.res2=m,h.push(S.res1,m),r[_]=S,n.push(S))}}}}gc&&mc.timeEnd("Validation.fromXml#clashDict");for(var A=0,M=c.length;A<M;++A){var P=c[A],T=P.attributes,E=T.sele;if("."!==T.seq.value){var C=qv(r,P,T);C>0&&(o[E]=C)}else{var I=P.getElementsByTagName("clash"),R=P.getElementsByTagName("mog-bond-outlier"),L=P.getElementsByTagName("mog-angle-outlier");if(R.length>0||L.length>0||I.length>0){var O={};a[E]=O;for(var N=0,D=I.length;N<D;++N){var k=I[N].attributes;r[k.cid.value]&&Wv(O,k.atom.value,1)}for(var F=0,B=R.length;F<B;++F){R[F].attributes.atoms.value.split(",").forEach((function(t){Wv(O,t,2)}))}for(var z=0,U=L.length;z<U;++z){L[z].attributes.atoms.value.split(",").forEach((function(t){Wv(O,t,4)}))}}}}this.clashSele=h.length?h.join(" OR "):"NONE",gc&&mc.timeEnd("Validation.fromXml")},Yv.prototype.getClashData=function(t){gc&&mc.time("Validation.getClashData");var e=t||{},i=e.structure,r=i.atomSet,n=new St(Eo(e.color,"#f0027f")),o=i.getAtomProxy(),a=i.getAtomProxy(),s=new O,c=new O,u=new O,h=this.clashArray,l=h.length,p=new Float32Array(3*l),d=new Float32Array(3*l),f=au(l,n.r,n.g,n.b),m=new Float32Array(l),g=new Float32Array(l);gc&&mc.time("Validation.getClashData#atomDict");var v=this.atomDict;i.eachAtom((function(t){var e=function(t){var e=t.inscode,i=t.chainname,r=t.atomname,n=t.altloc,o=t.resno;return e&&(o+="^"+e),i&&(o+=":"+i),r&&(o+="."+r),n&&(o+="%"+n),o+="/"+t.modelIndex}(t);!0===v[e]&&(v[e]=t.index)})),gc&&mc.timeEnd("Validation.getClashData#atomDict");var y=0;return h.forEach((function(t,e){if(o.index=v[t.sele1],a.index=v[t.sele2],void 0!==o.index&&void 0!==a.index&&r.isSet(o.index,a.index)){s.subVectors(a,o).setLength(o.vdw),c.copy(o).add(s),s.subVectors(o,a).setLength(a.vdw),u.copy(a).add(s);var i=o.distanceTo(a)/2,n=Math.sqrt(o.vdw*o.vdw-i*i),h=Math.sqrt(a.vdw*a.vdw-i*i);c.toArray(p,3*y),u.toArray(d,3*y),m[y]=(n+h)/2,g[y]=e,++y}})),gc&&mc.timeEnd("Validation.getClashData"),{position1:p.subarray(0,3*y),position2:d.subarray(0,3*y),color:f.subarray(0,3*y),color2:f.subarray(0,3*y),radius:m.subarray(0,y),picking:new Yh(g.subarray(0,y),this,i)}},Object.defineProperties(Yv.prototype,Zv);var Kv=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.useDomParser=!0,this.validation=new Yv(this.name,this.path)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={__objName:{}};return i.__objName.get=function(){return"validation"},e.prototype._parse=function(){t.prototype._parse.call(this),gc&&mc.time("ValidationParser._parse "+this.name),this.validation.fromXml(this.xml.data),gc&&mc.timeEnd("ValidationParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}($v);function Qv(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)}function Jv(t,e,i,r,n){if(e.subarray&&t.subarray)t.set(e.subarray(i,i+r),n);else for(var o=0;o<r;o++)t[n+o]=e[i+o]}function ty(t,e,i,r){for(var n=65535&t|0,o=t>>>16&65535|0,a=0;0!==i;){i-=a=i>2e3?2e3:i;do{o=o+(n=n+e[r++]|0)|0}while(--a);n%=65521,o%=65521}return n|o<<16|0}_c.add("validation",Kv);var ey=function(){for(var t,e=[],i=0;i<256;i++){t=i;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}();function iy(t,e,i,r){var n=ey,o=r+i;t^=-1;for(var a=r;a<o;a++)t=t>>>8^n[255&(t^e[a])];return-1^t}function ry(t,e){var i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,P;i=t.state,r=t.next_in,M=t.input,n=r+(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,p=i.window,d=i.hold,f=i.bits,m=i.lencode,g=i.distcode,v=(1<<i.lenbits)-1,y=(1<<i.distbits)-1;t:do{f<15&&(d+=M[r++]<<f,f+=8,d+=M[r++]<<f,f+=8),b=m[d&v];e:for(;;){if(d>>>=x=b>>>24,f-=x,0===(x=b>>>16&255))P[o++]=65535&b;else{if(!(16&x)){if(0==(64&x)){b=m[(65535&b)+(d&(1<<x)-1)];continue e}if(32&x){i.mode=12;break t}t.msg="invalid literal/length code",i.mode=30;break t}_=65535&b,(x&=15)&&(f<x&&(d+=M[r++]<<f,f+=8),_+=d&(1<<x)-1,d>>>=x,f-=x),f<15&&(d+=M[r++]<<f,f+=8,d+=M[r++]<<f,f+=8),b=g[d&y];i:for(;;){if(d>>>=x=b>>>24,f-=x,!(16&(x=b>>>16&255))){if(0==(64&x)){b=g[(65535&b)+(d&(1<<x)-1)];continue i}t.msg="invalid distance code",i.mode=30;break t}if(w=65535&b,f<(x&=15)&&(d+=M[r++]<<f,(f+=8)<x&&(d+=M[r++]<<f,f+=8)),(w+=d&(1<<x)-1)>c){t.msg="invalid distance too far back",i.mode=30;break t}if(d>>>=x,f-=x,w>(x=o-a)){if((x=w-x)>h&&i.sane){t.msg="invalid distance too far back",i.mode=30;break t}if(S=0,A=p,0===l){if(S+=u-x,x<_){_-=x;do{P[o++]=p[S++]}while(--x);S=o-w,A=P}}else if(l<x){if(S+=u+l-x,(x-=l)<_){_-=x;do{P[o++]=p[S++]}while(--x);if(S=0,l<_){_-=x=l;do{P[o++]=p[S++]}while(--x);S=o-w,A=P}}}else if(S+=l-x,x<_){_-=x;do{P[o++]=p[S++]}while(--x);S=o-w,A=P}for(;_>2;)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(r<n&&o<s);r-=_=f>>3,d&=(1<<(f-=_<<3))-1,t.next_in=r,t.next_out=o,t.avail_in=r<n?n-r+5:5-(r-n),t.avail_out=o<s?s-o+257:257-(o-s),i.hold=d,i.bits=f}var 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],oy=[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],ay=[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],sy=[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];function cy(t,e,i,r,n,o,a,s){var c,u,h,l,p,d,f,m,g,v=s.bits,y=0,b=0,x=0,_=0,w=0,S=0,A=0,M=0,P=0,T=0,E=null,C=0,I=new Uint16Array(16),R=new Uint16Array(16),L=null,O=0;for(y=0;y<=15;y++)I[y]=0;for(b=0;b<r;b++)I[e[i+b]]++;for(w=v,_=15;_>=1&&0===I[_];_--);if(w>_&&(w=_),0===_)return n[o++]=20971520,n[o++]=20971520,s.bits=1,0;for(x=1;x<_&&0===I[x];x++);for(w<x&&(w=x),M=1,y=1;y<=15;y++)if(M<<=1,(M-=I[y])<0)return-1;if(M>0&&(0===t||1!==_))return-1;for(R[1]=0,y=1;y<15;y++)R[y+1]=R[y]+I[y];for(b=0;b<r;b++)0!==e[i+b]&&(a[R[e[i+b]]++]=b);if(0===t?(E=L=a,d=19):1===t?(E=ny,C-=257,L=oy,O-=257,d=256):(E=ay,L=sy,d=-1),T=0,b=0,y=x,p=o,S=w,A=0,h=-1,l=(P=1<<w)-1,1===t&&P>852||2===t&&P>592)return 1;for(;;){f=y-A,a[b]<d?(m=0,g=a[b]):a[b]>d?(m=L[O+a[b]],g=E[C+a[b]]):(m=96,g=0),c=1<<y-A,x=u=1<<S;do{n[p+(T>>A)+(u-=c)]=f<<24|m<<16|g|0}while(0!==u);for(c=1<<y-1;T&c;)c>>=1;if(0!==c?(T&=c-1,T+=c):T=0,b++,0==--I[y]){if(y===_)break;y=e[i+a[b]]}if(y>w&&(T&l)!==h){for(0===A&&(A=w),p+=x,M=1<<(S=y-A);S+A<_&&!((M-=I[S+A])<=0);)S++,M<<=1;if(P+=1<<S,1===t&&P>852||2===t&&P>592)return 1;n[h=T&l]=w<<24|S<<16|p-o|0}}return 0!==T&&(n[p+T]=y-A<<24|64<<16|0),s.bits=w,0}function uy(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function hy(){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 ly(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,function(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=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,0):-2}(t)):-2}function py(t,e){var i,r;return t?(r=new hy,t.state=r,r.window=null,0!==(i=function(t,e){var i,r;return t&&t.state?(r=t.state,e<0?(i=0,e=-e):(i=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?-2:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=i,r.wbits=e,ly(t))):-2}(t,e))&&(t.state=null),i):-2}var dy,fy,my=!0;function gy(t){if(my){var e;for(dy=new Int32Array(512),fy=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(cy(1,t.lens,0,288,dy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;cy(2,t.lens,0,32,fy,0,t.work,{bits:5}),my=!1}t.lencode=dy,t.lenbits=9,t.distcode=fy,t.distbits=5}function vy(t,e,i,r){var n,o=t.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),r>=o.wsize?(Jv(o.window,e,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((n=o.wsize-o.wnext)>r&&(n=r),Jv(o.window,e,i-r,n,o.wnext),(r-=n)?(Jv(o.window,e,i-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=n))),0}function yy(t,e){var i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,P=0,T=new Uint8Array(4),E=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return-2;12===(i=t.state).mode&&(i.mode=13),a=t.next_out,n=t.output,c=t.avail_out,o=t.next_in,r=t.input,s=t.avail_in,u=i.hold,h=i.bits,l=s,p=c,S=0;t:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;h<16;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(2&i.wrap&&35615===u){i.check=0,T[0]=255&u,T[1]=u>>>8&255,i.check=iy(i.check,T,2,0),u=0,h=0,i.mode=2;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=30;break}if(8!=(15&u)){t.msg="unknown compression method",i.mode=30;break}if(h-=4,w=8+(15&(u>>>=4)),0===i.wbits)i.wbits=w;else if(w>i.wbits){t.msg="invalid window size",i.mode=30;break}i.dmax=1<<w,t.adler=i.check=1,i.mode=512&u?10:12,u=0,h=0;break;case 2:for(;h<16;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(i.flags=u,8!=(255&i.flags)){t.msg="unknown compression method",i.mode=30;break}if(57344&i.flags){t.msg="unknown header flags set",i.mode=30;break}i.head&&(i.head.text=u>>8&1),512&i.flags&&(T[0]=255&u,T[1]=u>>>8&255,i.check=iy(i.check,T,2,0)),u=0,h=0,i.mode=3;case 3:for(;h<32;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.head&&(i.head.time=u),512&i.flags&&(T[0]=255&u,T[1]=u>>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,i.check=iy(i.check,T,4,0)),u=0,h=0,i.mode=4;case 4:for(;h<16;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.head&&(i.head.xflags=255&u,i.head.os=u>>8),512&i.flags&&(T[0]=255&u,T[1]=u>>>8&255,i.check=iy(i.check,T,2,0)),u=0,h=0,i.mode=5;case 5:if(1024&i.flags){for(;h<16;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.length=u,i.head&&(i.head.extra_len=u),512&i.flags&&(T[0]=255&u,T[1]=u>>>8&255,i.check=iy(i.check,T,2,0)),u=0,h=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&((d=i.length)>s&&(d=s),d&&(i.head&&(w=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),Jv(i.head.extra,r,o,d,w)),512&i.flags&&(i.check=iy(i.check,r,d,o)),s-=d,o+=d,i.length-=d),i.length))break t;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===s)break t;d=0;do{w=r[o+d++],i.head&&w&&i.length<65536&&(i.head.name+=String.fromCharCode(w))}while(w&&d<s);if(512&i.flags&&(i.check=iy(i.check,r,d,o)),s-=d,o+=d,w)break t}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===s)break t;d=0;do{w=r[o+d++],i.head&&w&&i.length<65536&&(i.head.comment+=String.fromCharCode(w))}while(w&&d<s);if(512&i.flags&&(i.check=iy(i.check,r,d,o)),s-=d,o+=d,w)break t}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;h<16;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(u!==(65535&i.check)){t.msg="header crc mismatch",i.mode=30;break}u=0,h=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=12;break;case 10:for(;h<32;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}t.adler=i.check=uy(u),u=0,h=0,i.mode=11;case 11:if(0===i.havedict)return t.next_out=a,t.avail_out=c,t.next_in=o,t.avail_in=s,i.hold=u,i.bits=h,2;t.adler=i.check=1,i.mode=12;case 12:if(5===e||6===e)break t;case 13:if(i.last){u>>>=7&h,h-=7&h,i.mode=27;break}for(;h<3;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}switch(i.last=1&u,h-=1,3&(u>>>=1)){case 0:i.mode=14;break;case 1:if(gy(i),i.mode=20,6===e){u>>>=2,h-=2;break t}break;case 2:i.mode=17;break;case 3:t.msg="invalid block type",i.mode=30}u>>>=2,h-=2;break;case 14:for(u>>>=7&h,h-=7&h;h<32;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if((65535&u)!=(u>>>16^65535)){t.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&u,u=0,h=0,i.mode=15,6===e)break t;case 15:i.mode=16;case 16:if(d=i.length){if(d>s&&(d=s),d>c&&(d=c),0===d)break t;Jv(n,r,o,d,a),s-=d,o+=d,c-=d,a+=d,i.length-=d;break}i.mode=12;break;case 17:for(;h<14;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(i.nlen=257+(31&u),u>>>=5,h-=5,i.ndist=1+(31&u),u>>>=5,h-=5,i.ncode=4+(15&u),u>>>=4,h-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=30;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;h<3;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.lens[E[i.have++]]=7&u,u>>>=3,h-=3}for(;i.have<19;)i.lens[E[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,A={bits:i.lenbits},S=cy(0,i.lens,0,19,i.lencode,0,i.work,A),i.lenbits=A.bits,S){t.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;v=(P=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,y=65535&P,!((g=P>>>24)<=h);){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(y<16)u>>>=g,h-=g,i.lens[i.have++]=y;else{if(16===y){for(M=g+2;h<M;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(u>>>=g,h-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=30;break}w=i.lens[i.have-1],d=3+(3&u),u>>>=2,h-=2}else if(17===y){for(M=g+3;h<M;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}h-=g,w=0,d=3+(7&(u>>>=g)),u>>>=3,h-=3}else{for(M=g+7;h<M;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}h-=g,w=0,d=11+(127&(u>>>=g)),u>>>=7,h-=7}if(i.have+d>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=30;break}for(;d--;)i.lens[i.have++]=w}}if(30===i.mode)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,A={bits:i.lenbits},S=cy(1,i.lens,0,i.nlen,i.lencode,0,i.work,A),i.lenbits=A.bits,S){t.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,A={bits:i.distbits},S=cy(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,A),i.distbits=A.bits,S){t.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===e)break t;case 20:i.mode=21;case 21: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,ry(t,p),a=t.next_out,n=t.output,c=t.avail_out,o=t.next_in,r=t.input,s=t.avail_in,u=i.hold,h=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;v=(P=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,y=65535&P,!((g=P>>>24)<=h);){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(v&&0==(240&v)){for(b=g,x=v,_=y;v=(P=i.lencode[_+((u&(1<<b+x)-1)>>b)])>>>16&255,y=65535&P,!(b+(g=P>>>24)<=h);){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}u>>>=b,h-=b,i.back+=b}if(u>>>=g,h-=g,i.back+=g,i.length=y,0===v){i.mode=26;break}if(32&v){i.back=-1,i.mode=12;break}if(64&v){t.msg="invalid literal/length code",i.mode=30;break}i.extra=15&v,i.mode=22;case 22:if(i.extra){for(M=i.extra;h<M;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.length+=u&(1<<i.extra)-1,u>>>=i.extra,h-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;v=(P=i.distcode[u&(1<<i.distbits)-1])>>>16&255,y=65535&P,!((g=P>>>24)<=h);){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(0==(240&v)){for(b=g,x=v,_=y;v=(P=i.distcode[_+((u&(1<<b+x)-1)>>b)])>>>16&255,y=65535&P,!(b+(g=P>>>24)<=h);){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}u>>>=b,h-=b,i.back+=b}if(u>>>=g,h-=g,i.back+=g,64&v){t.msg="invalid distance code",i.mode=30;break}i.offset=y,i.extra=15&v,i.mode=24;case 24:if(i.extra){for(M=i.extra;h<M;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.offset+=u&(1<<i.extra)-1,u>>>=i.extra,h-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===c)break t;if(d=p-c,i.offset>d){if((d=i.offset-d)>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=30;break}d>i.wnext?(d-=i.wnext,f=i.wsize-d):f=i.wnext-d,d>i.length&&(d=i.length),m=i.window}else m=n,f=a-i.offset,d=i.length;d>c&&(d=c),c-=d,i.length-=d;do{n[a++]=m[f++]}while(--d);0===i.length&&(i.mode=21);break;case 26:if(0===c)break t;n[a++]=i.length,c--,i.mode=21;break;case 27:if(i.wrap){for(;h<32;){if(0===s)break t;s--,u|=r[o++]<<h,h+=8}if(p-=c,t.total_out+=p,i.total+=p,p&&(t.adler=i.check=i.flags?iy(i.check,n,p,a-p):ty(i.check,n,p,a-p)),p=c,(i.flags?u:uy(u))!==i.check){t.msg="incorrect data check",i.mode=30;break}u=0,h=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;h<32;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(u!==(4294967295&i.total)){t.msg="incorrect length check",i.mode=30;break}u=0,h=0}i.mode=29;case 29:S=1;break t;case 30:S=-3;break t;case 31:return-4;case 32:default:return-2}return t.next_out=a,t.avail_out=c,t.next_in=o,t.avail_in=s,i.hold=u,i.bits=h,(i.wsize||p!==t.avail_out&&i.mode<30&&(i.mode<27||4!==e))&&vy(t,t.output,t.next_out,p-t.avail_out)?(i.mode=31,-4):(l-=t.avail_in,p-=t.avail_out,t.total_in+=l,t.total_out+=p,i.total+=p,i.wrap&&p&&(t.adler=i.check=i.flags?iy(i.check,n,p,t.next_out-p):ty(i.check,n,p,t.next_out-p)),t.data_type=i.bits+(i.last?64:0)+(12===i.mode?128:0)+(20===i.mode||15===i.mode?256:0),(0===l&&0===p||4===e)&&0===S&&(S=-5),S)}function by(t,e){var i,r=e.length;return t&&t.state?0!==(i=t.state).wrap&&11!==i.mode?-2:11===i.mode&&ty(1,e,r,0)!==i.check?-3:vy(t,e,r,r)?(i.mode=31,-4):(i.havedict=1,0):-2}var xy=!0,_y=!0;try{String.fromCharCode.apply(null,[0])}catch(t){xy=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){_y=!1}for(var wy=new Uint8Array(256),Sy=0;Sy<256;Sy++)wy[Sy]=Sy>=252?6:Sy>=248?5:Sy>=240?4:Sy>=224?3:Sy>=192?2:1;function Ay(t){var e,i,r,n,o,a=t.length,s=0;for(n=0;n<a;n++)55296==(64512&(i=t.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=t.charCodeAt(n+1)))&&(i=65536+(i-55296<<10)+(r-56320),n++),s+=i<128?1:i<2048?2:i<65536?3:4;for(e=new Uint8Array(s),o=0,n=0;o<s;n++)55296==(64512&(i=t.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=t.charCodeAt(n+1)))&&(i=65536+(i-55296<<10)+(r-56320),n++),i<128?e[o++]=i:i<2048?(e[o++]=192|i>>>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 My(t,e){var i,r,n,o,a=e||t.length,s=new Array(2*a);for(r=0,i=0;i<a;)if((n=t[i++])<128)s[r++]=n;else if((o=wy[n])>4)s[r++]=65533,i+=o-1;else{for(n&=2===o?31:3===o?15:7;o>1&&i<a;)n=n<<6|63&t[i++],o--;o>1?s[r++]=65533:n<65536?s[r++]=n:(n-=65536,s[r++]=55296|n>>10&1023,s[r++]=56320|1023&n)}return function(t,e){if(e<65537&&(t.subarray&&_y||!t.subarray&&xy))return String.fromCharCode.apply(null,Qv(t,e));for(var i="",r=0;r<e;r++)i+=String.fromCharCode(t[r]);return i}(s,r)}function Py(t,e){var i;for((e=e||t.length)>t.length&&(e=t.length),i=e-1;i>=0&&128==(192&t[i]);)i--;return i<0?e:0===i?e:i+wy[t[i]]>e?i:e}wy[254]=wy[254]=1;var Ty={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"};function Ey(){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 Cy(){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}var Iy=Object.prototype.toString;function Ry(t){if(!(this instanceof Ry))return new Ry(t);this.options=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}}return t}({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 Ey,this.strm.avail_out=0;var i,r,n,o=py(this.strm,e.windowBits);if(0!==o)throw new Error(Ty[o]);this.header=new Cy,i=this.strm,r=this.header,i&&i.state&&(0==(2&(n=i.state).wrap)||(n.head=r,r.done=!1))}Ry.prototype.push=function(t,e){var i,r,n,o,a,s,c=this.strm,u=this.options.chunkSize,h=this.options.dictionary,l=!1;if(this.ended)return!1;r=e===~~e?e:!0===e?4:0,"string"==typeof t?c.input=function(t){for(var e=new Uint8Array(t.length),i=0,r=e.length;i<r;i++)e[i]=t.charCodeAt(i);return e}(t):"[object ArrayBuffer]"===Iy.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),2===(i=yy(c,0))&&h&&(s="string"==typeof h?Ay(h):"[object ArrayBuffer]"===Iy.call(h)?new Uint8Array(h):h,i=by(this.strm,s)),-5===i&&!0===l&&(i=0,l=!1),1!==i&&0!==i)return this.onEnd(i),this.ended=!0,!1;c.next_out&&(0!==c.avail_out&&1!==i&&(0!==c.avail_in||4!==r&&2!==r)||("string"===this.options.to?(n=Py(c.output,c.next_out),o=c.next_out-n,a=My(c.output,n),c.next_out=o,c.avail_out=u-o,o&&Jv(c.output,c.output,n,o,0),this.onData(a)):this.onData(Qv(c.output,c.next_out)))),0===c.avail_in&&0===c.avail_out&&(l=!0)}while((c.avail_in>0||0===c.avail_out)&&1!==i);return 1===i&&(r=4),4===r?(i=function(t){if(!t||!t.state)return-2;var e=t.state;return e.window&&(e.window=null),t.state=null,0}(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==r||(this.onEnd(0),c.avail_out=0,!0)},Ry.prototype.onData=function(t){this.chunks.push(t)},Ry.prototype.onEnd=function(t){0===t&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=function(t){var e,i,r,n,o,a;for(r=0,e=0,i=t.length;e<i;e++)r+=t[e].length;for(a=new Uint8Array(r),n=0,e=0,i=t.length;e<i;e++)o=t[e],a.set(o,n),n+=o.length;return a}(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},Sc.add("gz",(function(t){var e;t instanceof ArrayBuffer&&(t=new Uint8Array(t));try{e=function(t,e){var i=new Ry(e);if(i.push(t,!0),i.err)throw i.msg;return i.result}(t)}catch(i){e=t}return e}));var Ly="//mmtf.rcsb.org/v1.0/full/";bc.add("rcsb",new function(){this.getUrl=function(t){var e,i=Lo(t),r=i.name.substr(0,4);return!["pdb","cif"].includes(i.ext)||!1!==i.compressed&&"gz"!==i.compressed?"mmtf"===i.ext?e=i.base.endsWith(".bb")?"//mmtf.rcsb.org/v1.0/reduced/"+r:Ly+r:i.ext?(mc.warn("unsupported ext",i.ext),e=Ly+r):e=Ly+r:e="//files.rcsb.org/download/"+i.path,Co()+e},this.getExt=function(t){var e=Lo(t);if("mmtf"===e.ext||!e.ext)return"mmtf"}});var Oy="//pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/";function Ny(){this.getUrl=function(t){return t}}bc.add("pubchem",new function(){this.getUrl=function(t){var e,i=Lo(t),r=i.name;return i.ext&&"sdf"!==i.ext?(mc.warn("unsupported ext",i.ext),e=Oy+r+"/SDF?record_type=3d"):e=Oy+r+"/SDF?record_type=3d",Co()+e},this.getExt=function(t){var e=Lo(t);if(!e.ext||"sdf"===e.ext)return"sdf"}}),bc.add("ftp",new Ny),bc.add("http",new Ny),bc.add("https",new Ny);"undefined"==typeof window||window.Promise||(window.Promise=p)}).call(this,i(155).setImmediate)},155:function(t,e,i){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(n.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new o(n.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},i(156),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,i(48))},156:function(t,e,i){(function(t,e){!function(t,i){"use strict";if(!t.setImmediate){var r,n,o,a,s,c=1,u={},h=!1,l=t.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(t);p=p&&p.setTimeout?p:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick((function(){f(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,i=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=i,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){f(t.data)},r=function(t){o.port2.postMessage(t)}):l&&"onreadystatechange"in l.createElement("script")?(n=l.documentElement,r=function(t){var e=l.createElement("script");e.onreadystatechange=function(){f(t),e.onreadystatechange=null,n.removeChild(e),e=null},n.appendChild(e)}):r=function(t){setTimeout(f,0,t)}:(a="setImmediate$"+Math.random()+"$",s=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(a)&&f(+e.data.slice(a.length))},t.addEventListener?t.addEventListener("message",s,!1):t.attachEvent("onmessage",s),r=function(e){t.postMessage(a+e,"*")}),p.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),i=0;i<e.length;i++)e[i]=arguments[i+1];var n={callback:t,args:e};return u[c]=n,r(c),c++},p.clearImmediate=d}function d(t){delete u[t]}function f(t){if(h)setTimeout(f,0,t);else{var e=u[t];if(e){h=!0;try{!function(t){var e=t.callback,i=t.args;switch(i.length){case 0:e();break;case 1:e(i[0]);break;case 2:e(i[0],i[1]);break;case 3:e(i[0],i[1],i[2]);break;default:e.apply(void 0,i)}}(e)}finally{d(t),h=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,i(48),i(56))},157:function(t,e,i){"use strict";var r=i(158);t.exports=function(t){var e=typeof t;if("string"===e){var i=t;if(0===(t=+t)&&r(i))return!1}else if("number"!==e)return!1;return t-t<1}},158:function(t,e,i){"use strict";t.exports=function(t){for(var e,i=t.length,r=0;r<i;r++)if(((e=t.charCodeAt(r))<9||e>13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(e<8192||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}},42:function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return y}));var r=i(1),n=i.n(r),o=i(16),a=i(154),s=i(47),c=i(157),u=i.n(c);function h(t){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e<t.length;e++)i[e]=t[e];return i}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function p(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function d(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function f(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function m(t,e){return!e||"object"!==h(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function g(t){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function v(t,e){return(v=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var y=function(t){function e(t){var i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(i=m(this,g(e).call(this,t))).state={stage:null,orientationMatrix:null,structuresList:[]},i}var i,r,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&v(t,e)}(e,t),i=e,(r=[{key:"componentDidMount",value:function(){var t=this.props,e=t.id,i=t.stageParameters,r=t.width,n=t.height,o=function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?p(Object(i),!0).forEach((function(e){d(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):p(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({},i),s=new a.b(e,o),c=s.viewerControls.getOrientation(),h=u()(r)?r+"px":r,l=u()(n)?n+"px":n;s.setSize(h,l),this.setState({stage:s,orientationMatrix:c})}},{key:"shouldComponentUpdate",value:function(t,e){var i=this.props,r=i.stageParameters,n=i.data,o=i.downloadImage,a=i.molStyles;if(null!==n&&null!==t.data){if(void 0!==e.data)return!0;var c=t.data[0].selectedValue,u=n[0].selectedValue;if(c!==u)return!0;var h=n[0].resetView;if(c===u&&!0===h)return!0;if(!0===n[0].uploaded)return!0}return!Object(s.a)(t.molStyles,a)||!Object(s.a)(t.stageParameters,r)||t.downloadImage!==o}},{key:"componentDidUpdate",value:function(){var t=this.props,e=t.data,i=t.stageParameters,r=t.downloadImage,n=t.sideByside,o=this.state,a=o.stage,s=o.structuresList;a.setParameters(i),(void 0===r||!1===r&&"placeholder"!==e[0].selectedValue)&&(a.eachComponent((function(t){t.removeAllRepresentations()})),this.processDataFromBackend(e,s,n)),!0===r&&this.generateImage(),this.props.setProps({downloadImage:!1})}},{key:"highlightAtoms",value:function(t,e,i,r,n){""!==r&&(t.sele=e+" and @"+r,i.addRepresentation("ball+stick",t)),""!==n&&(t.sele=e+".CA and ("+n.replace(/,/g," or ")+")",i.addRepresentation("ball+stick",t))}},{key:"addMolStyle",value:function(t,e,i,r){var n=this.props.molStyles,o=l(n.representations),a=i.atoms,s=i.residues,c={sele:e,showBox:o.includes("axes+box")};":"!==e&&(c.color=r),o.forEach((function(e){var i=e;"axes+box"===i&&(i="axes"),t.addRepresentation(i,c)})),""===a&&""===s||(c.radius=n.chosenAtomsRadius,c.color=n.chosenAtomsColor,this.highlightAtoms(c,e,t,a,s))}},{key:"showStructure",value:function(t,e,i,r,n,o,s){var c=this.state,u=c.stage,h=c.orientationMatrix,l=t,p=":";if(u.viewerControls.orient(h),"ALL"===e)this.addMolStyle(t,p,r,n);else{if(p+=e,"ALL"!==i&&(p+="/0 and "+i),!0===s){var d=new a.a(p),f=t.structure.getView(d),m=(l=u.addComponentFromObject(f)).getCenter(),g=f.getPrincipalAxes();l.setRotation(g.getRotationQuaternion()),l.setPosition([0-m.x-o,0-m.y,0-m.z])}this.addMolStyle(l,p,r,n)}u.autoView()}},{key:"processDataFromBackend",value:function(t,e){for(var i=this.props.molStyles,r=this.state.stage,n=0;n<t.length;n++){var o=t[n].filename,a=n*i.molSpacingXaxis,s=i.sideByside;e.includes(o)?this.showStructure(r.getComponentsByName(o).list[0],t[n].chain,t[n].aaRange,t[n].chosen,t[n].color,a,s):this.loadData(t[n],a,s)}}},{key:"loadData",value:function(t,e,i){var r=this,n=this.state.stage,o=new Blob([t.config.input],{type:t.config.type});n.loadFile(o,{ext:t.ext,defaultRepresentation:!1}).then((function(n){n.name=t.filename,r.showStructure(n,t.chain,t.aaRange,t.chosen,t.color,e,i),r.setState((function(e){return{structuresList:e.structuresList.concat([t.filename])}}))}))}},{key:"generateImage",value:function(){var t=this.props.imageParameters;this.state.stage.makeImage({factor:1,antialias:t.antialias,trim:t.trim,transparent:t.transparent}).then((function(e){Object(a.c)(e,t.defaultFilename+".png")}))}},{key:"render",value:function(){var t=this.props.id;return n.a.createElement("div",{id:t})}}])&&f(i.prototype,r),o&&f(i,o),e}(r.Component);y.defaultProps=o.b,y.propTypes=o.c}}]);
\ No newline at end of file
+function Pp(t,e){for(var i=t.length/3,r=0,n=new Uint32Array(i),o=0;o<i;++o)n[o]=o;var a=new Int32Array(4*i),s=0,c=0;var u=function e(i,o,u,h){i>r&&(r=i);var l=h-u;if(0===l)return-1;var p=4*s;if(s+=1,1===l)return a[p]=u,a[p+1]=-1,a[p+2]=-1,a[p+3]=o,p;var d,f,m,g,v,y=u+Math.floor(l/2);c=i%3;for(var b=u,x=h-1;x>b;){for(g=t[3*n[m=b+x>>1]+c],f=n[m],n[m]=n[x],n[x]=f,v=b,d=b;d<x;++d)t[3*n[d]+c]<g&&(f=n[v],n[v]=n[d],n[d]=f,++v);if(f=n[x],n[x]=n[v],n[v]=f,y===(m=v))break;y<m?x=m-1:b=m+1}return a[p]=y,a[p+1]=e(i+1,p,u,y),a[p+2]=e(i+1,p,y+1,h),a[p+3]=o,p}(0,-1,0,i);this.rootIndex=u,this.maxDepth=r,this.nearest=function(i,r,o){var s=new Mp((function(t){return-t[1]}));!function c(u){var h,l,p=function t(e){var i=a[e+3];return-1===i?0:t(i)+1}(u)%3,d=3*n[a[u]],f=[t[d+0],t[d+1],t[d+2]],m=e(i,f);function g(t,e){s.push([t,e]),s.size()>r&&s.pop()}var v=a[u+1],y=a[u+2];if(-1!==y||-1!==v){c(h=-1===y?v:-1===v?y:i[p]<=t[d+p]?v:y),(s.size()<r||m<s.peek()[1])&&m<=o&&g(u,m);for(var b=[],x=0;x<3;x+=1)b[x]=x===p?i[x]:t[d+x];var _=e(b,f);(s.size()<r||Math.abs(_)<s.peek()[1])&&Math.abs(_)<=o&&-1!==(l=h===v?y:v)&&c(l)}else(s.size()<r||m<s.peek()[1])&&m<=o&&g(u,m)}(u);for(var c=[],h=0,l=Math.min(s.size(),r);h<l;h+=1)c.push(s.content[h]);return c},this.indices=n,this.nodes=a,this.verify=function e(i,r){var o=1;if(void 0===i&&(i=u,r=0),-1===i)throw new Error("node is null");var s=r%3,c=a[i+1],h=a[i+2];if(-1!==c){if(t[3*n[a[c]]+s]>t[3*n[a[i]]+s])throw new Error("left child is > parent!");o+=e(c,r+1)}if(-1!==h){if(t[3*n[a[h]]+s]<t[3*n[a[i]]+s])throw new Error("right child is < parent!");o+=e(h,r+1)}return o}}function Tp(t,e){var i;gc&&mc.time("Kdtree build"),i=e?function(t,e){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return i*i+r*r+n*n}:function(t,e){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return Math.sqrt(i*i+r*r+n*n)};var r=new Float32Array(3*t.atomCount),n=new Uint32Array(t.atomCount),o=0;t.eachAtom((function(t){r[o+0]=t.x,r[o+1]=t.y,r[o+2]=t.z,n[o/3]=t.index,o+=3})),this.atomIndices=n,this.points=r,this.kdtree=new Pp(r,i),gc&&mc.timeEnd("Kdtree build")}Sp.prototype={constructor:Sp,getCenterIterator:function(t){var e=this.getPosition().center,i=e.length/3,r=0,n=-1,o=[new O,new O,new O,new O];return{size:i,next:function(){var t=this.get(n);return n+=1,t},get:function(n){n=Math.min(i-1,Math.max(0,n));var a=o[r%4],s=3*n;if(a.fromArray(e,s),t){var c,u,h,l=Math.min(t,n,i-n-1);for(u=1;u<=l;++u)c=3*u,h=(l+1-u)/(l+1),a.x+=h*e[s-c+0]+h*e[s+c+0],a.y+=h*e[s-c+1]+h*e[s+c+1],a.z+=h*e[s-c+2]+h*e[s+c+2];a.x/=l+1,a.y/=l+1,a.z/=l+1}return r+=1,a},reset:function(){r=0,n=-1}}},getColor:function(t){var e=this.polymer,i=e.structure,r=e.residueCount,n=e.residueIndexStart,o=new Float32Array(3*r),a=t||{};a.structure=i;for(var s=yc.getScheme(a),c=i.getResidueProxy(),u=i.getAtomProxy(),h=0;h<r;++h)c.index=n+h,u.index=c.traceAtomIndex,s.atomColorToArray(u,o,3*h);return{color:o}},getPicking:function(){for(var t=this.polymer,e=t.structure,i=t.residueCount,r=t.residueIndexStart,n=new Float32Array(i),o=e.getResidueProxy(),a=0;a<i;++a)o.index=r+a,n[a]=o.traceAtomIndex;return{picking:new $h(n,e)}},getSize:function(t,e){for(var i=this.polymer,r=i.structure,n=i.residueCount,o=i.residueIndexStart,a=new Float32Array(n),s=new Il(t,e),c=r.getResidueProxy(),u=r.getAtomProxy(),h=0;h<n;++h)c.index=o+h,u.index=c.traceAtomIndex,a[h]=s.atomRadius(u);return{size:a}},getPosition:function(){var t,e,i,r,n,o=this.polymer,a=o.structure,s=o.residueCount,c=s-3,u=new Float32Array(3*s),h=new Float32Array(3*s),l=new Float32Array(s),p=new Float32Array(s),d=new Float32Array(s),f=new Float32Array(s),m=new Float32Array(3*s),g=new O,v=new O,y=new O,b=new O,x=new O,_=new O,w=new O,S=new O,A=new O,M=new O,P=new O,T=new O(0,0,0),E="trace",C=a.getAtomProxy(),I=a.getAtomProxy(o.getAtomIndexByType(0,E)),R=a.getAtomProxy(o.getAtomIndexByType(1,E)),L=a.getAtomProxy(o.getAtomIndexByType(2,E));for(i=0;i<c;++i)C.index=I.index,I.index=R.index,R.index=L.index,L.index=o.getAtomIndexByType(i+3,E),e=3*i,g.subVectors(I,C),v.subVectors(R,I),y.subVectors(L,R),b.subVectors(g,v),x.subVectors(v,y),A.crossVectors(b,x).normalize(),A.toArray(h,e),i>0&&(l[i]=A.angleTo(M)),t=Math.cos(b.angleTo(x)),f[i]=180/Math.PI*Math.acos(t),r=b.length(),n=x.length(),p[i]=Math.sqrt(n*r)/Math.max(2,2*(1-t)),d[i]=Math.abs(v.dot(A)),_.copy(b).multiplyScalar(p[i]/r),w.copy(x).multiplyScalar(p[i]/n),_.subVectors(I,_),w.subVectors(R,w),_.toArray(u,e+3),w.toArray(u,e+6),P.subVectors(C,T),P.toArray(m,e),M.copy(A),T.copy(_);for(_.fromArray(u,3),w.fromArray(u,6),A.subVectors(_,w).normalize(),C.index=o.getAtomIndexByType(0,E),T.copy(C),S.copy(C),wh(S,A,_),S.toArray(u,0),P.subVectors(T,_),P.toArray(m,0),_.fromArray(u,3*s-6),w.fromArray(u,3*s-9),A.subVectors(_,w).normalize(),C.index=o.getAtomIndexByType(s-1,E),T.copy(C),S.copy(C),wh(S,A,_),S.toArray(u,3*s-3),i=s-3;i<s;++i)_.fromArray(u,3*i),C.index=o.getAtomIndexByType(i,E),T.copy(C),P.subVectors(T,_),P.toArray(m,3*i);var N=new Float32Array(s),D=new Float32Array(s),k=new Float32Array(s),F=new Float32Array(s);for(N[1]=p[0],D[1]=f[0],k[1]=p[0],i=2;i<s-2;++i)N[i]=.5*(p[i-2]+p[i-1]),D[i]=.5*(f[i-2]+f[i-1]),k[i]=.5*(d[i-2]+d[i-1]),_.fromArray(h,3*(i-2)),w.fromArray(h,3*(i-1)),F[i]=180/Math.PI*Math.acos(Math.cos(_.angleTo(w)));N[s-2]=p[s-4],D[s-2]=f[s-4],k[s-2]=d[s-4];var B=new Float32Array(3*s);for(uu(h,B,0,0,3),uu(h,B,0,3,3),i=2;i<s-2;++i)_.fromArray(h,3*(i-2)),w.fromArray(h,3*(i-1)),A.addVectors(w,_).multiplyScalar(.5).normalize(),A.toArray(B,3*i);return uu(h,B,3*s-12,3*s-6,3),uu(h,B,3*s-12,3*s-3,3),{center:u,axis:B,bending:F,radius:N,rise:k,twist:D,resdir:m}}},Ap.prototype={constructor:Ap,getAxis:function(t,e,i,r,n,o){t=t||30,e=e||2.5,i=void 0!==i&&i;var a=this.polymer,s=a.structure,c=a.residueCount,u=a.residueIndexStart,h=this.position,l=r||{};l.structure=s;for(var p,d,f=yc.getScheme(l),m=new Il(n,o),g=0,v=0,y=[],b=[],x=[],_=[],w=[],S=[],A=[],M=[],P=[],T=[],E=[],C=new O,I=new O,R=s.getResidueProxy(),L=s.getResidueProxy(),N=s.getAtomProxy(),D=new O,k=new O,F=!1,B=0;B<c;++B)if(R.index=u+B,D.fromArray(h.center,3*B),B===c-1?F=!0:(L.index=u+B+1,k.fromArray(h.center,3*B+3),i&&R.sstruc!==L.sstruc?F=!0:D.distanceTo(k)>e?F=!0:h.bending[B]>t&&(F=!0)),F){if(B-g<4){g=B,F=!1;continue}N.index=R.traceAtomIndex,T=h.axis.subarray(3*g+3,3*B),E=h.center.subarray(3*g,3*B+3),p=_h(T).normalize(),d=_h(E),C.fromArray(E),wh(C,p,d),I.fromArray(E,E.length-3),wh(I,p,d),p.subVectors(I,C),p.toArray(y,v),d.toArray(b,v),C.toArray(x,v),I.toArray(_,v),f.atomColorToArray(N,w,v),S.push(N.index),A.push(m.atomRadius(N)),M.push(u+g),P.push(u+B+1-g),v+=3,g=B,F=!1}var z=new Float32Array(S);return{axis:new Float32Array(y),center:new Float32Array(b),begin:new Float32Array(x),end:new Float32Array(_),color:new Float32Array(w),picking:new $h(z,s),size:new Float32Array(A),residueOffset:M,residueCount:P}}},Mp.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;i<e;i++)if(this.content[i]===t){var r=this.content.pop();return void(i!==e-1&&(this.content[i]=r,this.scoreFunction(r)<this.scoreFunction(t)?this.bubbleUp(i):this.sinkDown(i)))}throw new Error("Node not found.")},size:function(){return this.content.length},bubbleUp:function(t){for(var e=this.content[t];t>0;){var i=Math.floor((t+1)/2)-1,r=this.content[i];if(!(this.scoreFunction(e)<this.scoreFunction(r)))break;this.content[i]=e,this.content[t]=r,t=i}},sinkDown:function(t){for(var e,i=this.content.length,r=this.content[t],n=this.scoreFunction(r);;){var o=2*(t+1),a=o-1,s=null;if(a<i){var c=this.content[a];(e=this.scoreFunction(c))<n&&(s=a)}if(o<i){var u=this.content[o];this.scoreFunction(u)<(null===s?n:e)&&(s=o)}if(null===s)break;this.content[t]=this.content[s],this.content[s]=r,t=s}}},Tp.prototype={nearest:(vp=new Float32Array(3),function(t,e,i){t.toArray?t.toArray(vp):t.positionToArray&&t.positionToArray(vp);for(var r=this.kdtree.nearest(vp,e,i),n=this.kdtree.indices,o=this.kdtree.nodes,a=this.atomIndices,s=[],c=0,u=r.length;c<u;++c){var h=r[c],l=h[0],p=h[1];s.push({index:a[n[o[l]]],distance:p})}return s})};var Ep={" ":"X","!":"Y","#":"Z",$:"-X","%":"-Y","&":"-Z","'":"Y+1/2","(":"1/2+X",")":"1/2+Y","*":"1/2-X","+":"1/2+Z",",":"1/2-Y","-":"1/2-Z",".":"X+1/2","/":"Z+1/2",0:"-X+1/2",1:"-Y+1/2",2:"-Z+1/2",3:"1/4+X",4:"1/4-Y",5:"1/4+Z",6:"1/4-X",7:"1/4+Y",8:"3/4-Y",9:"3/4+Z",":":"3/4+Y",";":"3/4+X","<":"3/4-X","=":"1/4-Z",">":"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"},Cp={"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":" !#*,#.%&$'&!# ,- '&$%/$# !-*!/$%&.%()+$%+ ,-*!-)+(%&(!-*,#*+()&$)#*,- ,"};function Ip(t){var e="";return t.length>0&&(e=":"+ko(t).join(" OR :")),new nc(e)}var Rp=function(t){this.name=t||"",this.partList=[]},Lp={type:{}};Lp.type.get=function(){return"Assembly"},Rp.prototype.addPart=function(t,e){var i=new Op(t,e);return this.partList.push(i),i},Rp.prototype._getCount=function(t,e){var i=0;return this.partList.forEach((function(r){i+=r[e](t)})),i},Rp.prototype.getAtomCount=function(t){return this._getCount(t,"getAtomCount")},Rp.prototype.getResidueCount=function(t){return this._getCount(t,"getResidueCount")},Rp.prototype.getInstanceCount=function(){var t=0;return this.partList.forEach((function(e){t+=e.matrixList.length})),t},Rp.prototype.isIdentity=function(t){if(1!==this.partList.length)return!1;var e=this.partList[0];if(1!==e.matrixList.length)return!1;if(!(new N).equals(e.matrixList[0]))return!1;var i=[];return t.eachChain((function(t){i.push(t.chainname)})),i=ko(i),e.chainList.length===i.length},Rp.prototype.getBoundingBox=function(t){var e=new jt;return this.partList.forEach((function(i){var r=i.getBoundingBox(t);e.expandByPoint(r.min),e.expandByPoint(r.max)})),e},Rp.prototype.getCenter=function(t){return this.getBoundingBox(t).getCenter()},Rp.prototype.getSelection=function(){var t=[];return this.partList.forEach((function(e){t=t.concat(e.chainList)})),Ip(t)},Object.defineProperties(Rp.prototype,Lp);var Op=function(t,e){this.matrixList=t||[],this.chainList=e||[]},Np={type:{}};function Dp(t,e){if(e){gc&&mc.time("assignSecondaryStructure");var i=[];t.eachModel((function(t){t.eachChain((function(t){i.push(t.chainname)}))}));var r=i.slice().sort(),n=[];r.forEach((function(t){n.push(i.indexOf(t))}));var o=e.helices;(o=o.filter((function(t){return No(r,t[0])>=0}))).sort((function(t,e){var i=t[0],o=e[0],a=t[1],s=e[1];if(i===o)return a===s?0:a<s?-1:1;var c=No(r,i),u=No(r,o);return n[c]<n[u]?-1:1}));var a=t.residueStore;t.eachModel((function(t){var e=0,i=o.length;if(0!==i){var r=o[e],n=!1,s=!1;t.eachChain((function(t){var c=!1;if(t.chainname===r[0])for(var u=t.residueCount,h=t.residueOffset,l=h+u,p=h;p<l;++p)if(a.resno[p]===r[1]&&a.getInscode(p)===r[2]&&(n=!0),n&&(a.sstruc[p]=r[6],a.resno[p]===r[4]&&a.getInscode(p)===r[5]&&(n=!1,(e+=1)<i?(p=h-1,r=o[e],c=t.chainname!==r[0]):s=!0)),c||s)return}))}}));var s=e.sheets;(s=s.filter((function(t){return No(r,t[0])>=0}))).sort((function(t,e){var i=t[0],o=e[0];if(i===o)return 0;var a=No(r,i),s=No(r,o);return n[a]<n[s]?-1:1}));var c="e".charCodeAt(0);t.eachModel((function(t){var e=0,i=s.length;if(0!==i){var r=s[e],n=!1,o=!1;t.eachChain((function(t){var u=!1;if(t.chainname===r[0])for(var h=t.residueCount,l=t.residueOffset,p=l+h,d=l;d<p;++d)if(a.resno[d]===r[1]&&a.getInscode(d)===r[2]&&(n=!0),n&&(a.sstruc[d]=c,a.resno[d]===r[4]&&a.getInscode(d)===r[5]&&(n=!1,(e+=1)<i?(d=l-1,r=s[e],u=t.chainname!==r[0]):o=!0)),u||o)return}))}})),gc&&mc.timeEnd("assignSecondaryStructure")}}Np.type.get=function(){return"AssemblyPart"},Op.prototype._getCount=function(t,e){var i=0,r=this.chainList;return t.eachChain((function(t){(0===r.length||r.includes(t.chainname))&&(i+=t[e])})),this.matrixList.length*i},Op.prototype.getAtomCount=function(t){return this._getCount(t,"atomCount")},Op.prototype.getResidueCount=function(t){return this._getCount(t,"residueCount")},Op.prototype.getBoundingBox=function(t){var e=new jt,i=new jt,r=this.getSelection(),n=t.getBoundingBox(r);return this.matrixList.forEach((function(t){i.copy(n).applyMatrix4(t),e.expandByPoint(i.min),e.expandByPoint(i.max)})),e},Op.prototype.getSelection=function(){return Ip(this.chainList)},Op.prototype.getView=function(t){var e=this.getSelection();return e?t.getView(e):t},Op.prototype.getInstanceList=function(){for(var t=[],e=0,i=this.matrixList.length;e<i;++e)t.push({id:e+1,name:e,matrix:this.matrixList[e]});return t},Object.defineProperties(Op.prototype,Np);var kp,Fp,Bp,zp=(kp=function(t,e,i,r){for(var n=t.structure,o=t.residueIndexStart,a=n.getResidueProxy(),s=n.getResidueProxy(),c=n.getAtomProxy(),u=n.getAtomProxy(),h=Math.max(0,e-2);h<=e;++h)for(var l=2;l<5;++l)if(!(h+l>=t.residueCount)){a.index=o+h,s.index=o+h+l,c.index=a.traceAtomIndex,u.index=s.traceAtomIndex;var p=c.distanceTo(u);if(Math.abs(p-i[l-2])>r)return!1}return!0},Fp=function(t,e){return kp(t,e,[5.45,5.18,6.37],2.1)},Bp=function(t,e){return kp(t,e,[6.1,10.4,13],1.42)},function(t){gc&&mc.time("calculateSecondaryStructure"),t.eachPolymer((function(t){if(!(t.residueCount<4)){if(t.isCg())!function(t){for(var e=t.residueStore,i=t.residueIndexStart,r=new Ap(t).position,n=new O,o=new O,a=0,s=t.residueCount;a<s;++a){n.fromArray(r.center,3*a),o.fromArray(r.center,3*a+3);var c=n.distanceTo(o);c<2&&c>1&&r.bending[a]<20&&(e.sstruc[i+a]="h".charCodeAt(0),e.sstruc[i+a+1]="h".charCodeAt(0))}}(t);else{if(!t.isProtein())return;!function(t){for(var e=t.residueStore,i=t.residueIndexStart,r=0,n=t.residueCount;r<n;++r){var o="c";Fp(t,r)?o="h":Bp(t,r)&&(o="s"),e.sstruc[i+r]=o.charCodeAt(0)}}(t)}var e,i=0;t.eachResidue((function(t){t.sstruc===e?i+=1:(1===i&&(t.index-=1,t.sstruc="c"),i=1,e=t.sstruc)}))}})),gc&&mc.timeEnd("calculateSecondaryStructure")});function Up(t){gc&&mc.time("calculateChainnames");var e=!0;if(t.eachChain((function(t){t.chainname&&(e=!1)})),e){var i="ABCDEFGHIJKLMNOPQRSTUVWXYZ",r=i.length,n=t.modelStore,o=t.chainStore,a=t.residueStore,s=function(t){for(var e=t,n=0,o=i[e%r];e>=r;)e=Math.floor(e/r),o+=i[e%r],n+=1;return n>=5&&mc.warn("chainname overflow"),o},c=t.getAtomProxy(),u=t.getAtomProxy(),h=0,l=0,p=0,d=0,f=[];1===a.count?f.push({mIndex:0,chainname:"A",rStart:0,rCount:1}):t.eachResidueN(2,(function(t,e){var i=!1,r=t.backboneType,n=e.backboneType;d=t.index,t.modelIndex!==e.modelIndex?i=!0:t.moleculeType!==e.moleculeType?i=!0:0!==r&&r===n&&(c.index=t.backboneEndAtomIndex,u.index=e.backboneStartAtomIndex,c.connectedTo(u)||(i=!0)),i||e.index!==a.count-1||(i=!0,d=e.index),i&&(f.push({mIndex:l,chainname:s(h),rStart:p,rCount:d-p+1}),h+=1,t.modelIndex!==e.modelIndex&&(h=0,l+=1),e.index===a.count-1&&d!==e.index&&f.push({mIndex:l,chainname:s(h),rStart:a.count-1,rCount:1}),p=e.index,d=e.index)})),o.count=0,f.forEach((function(t){!function(t,e,i,r){for(var s=o.count,c=0;c<r;++c)a.chainIndex[i+c]=s;o.growIfFull(),o.modelIndex[s]=t,o.setChainname(s,e),o.setChainid(s,e),o.residueOffset[s]=i,o.residueCount[s]=r,o.count+=1,n.chainCount[t]+=1}(t.mIndex,t.chainname,t.rStart,t.rCount)}));var m=0;t.eachModel((function(t){n.chainOffset[t.index]=m,n.chainCount[t.index]-=1,m+=n.chainCount[t.index]}))}gc&&mc.timeEnd("calculateChainnames")}function jp(t){gc&&mc.time("calculateBonds"),Gp(t),Vp(t),gc&&mc.timeEnd("calculateBonds")}function Gp(t,e){gc&&mc.time("calculateBondsWithin");var i=t.bondStore,r=t.rungBondStore,n=t.getAtomSet(!1),o=t.getAtomProxy(),a=t.getAtomProxy(),s=t.getBondProxy(),c=e?null:function(t){gc&&mc.time("calculateAtomBondMap");var e=[];return t.eachBond((function(t){var i=t.atomIndex1,r=t.atomIndex2;void 0===e[i]&&(e[i]=[]),e[i][r]=t.index})),gc&&mc.timeEnd("calculateAtomBondMap"),e}(t);t.eachResidue((function(t){if(!e){var u=t.atomCount,h=t.atomOffset;if(u>500)return void mc.warn("more than 500 atoms, skip residue for auto-bonding",t.qualifiedName());for(var l=t.getBonds(),p=l.atomIndices1,d=l.atomIndices2,f=l.bondOrders,m=p.length,g=0;g<m;++g){var v=p[g]+h,y=d[g]+h,b=c[v];if(void 0!==b&&void 0!==(b=b[y]))s.index=b,f[t.residueType.getBondIndex(v,y)]=s.bondOrder;else o.index=v,a.index=y,i.addBond(o,a,f[g])}}var x=t.residueType.traceAtomIndex,_=t.residueType.rungEndAtomIndex;-1!==x&&-1!==_&&(o.index=t.traceAtomIndex,a.index=t.rungEndAtomIndex,r.addBond(o,a),n.set(o.index),n.set(a.index))})),t.atomSetDict.rung=n,gc&&mc.timeEnd("calculateBondsWithin")}function Vp(t,e){gc&&mc.time("calculateBondsBetween");var i=t.bondStore,r=t.backboneBondStore,n=t.getAtomSet(!1),o=t.getAtomProxy(),a=t.getAtomProxy();function s(t,s){var c=t.backboneType,u=s.backboneType;0!==c&&c===u&&(o.index=t.backboneEndAtomIndex,a.index=s.backboneStartAtomIndex,o.connectedTo(a)&&(e||i.addBond(o,a,1),o.index=t.traceAtomIndex,a.index=s.traceAtomIndex,r.addBond(o,a),n.set(o.index),n.set(a.index)))}0===r.count&&r.resize(t.residueStore.count),t.eachResidueN(2,s);var c=t.getResidueProxy(),u=t.getResidueProxy();t.eachChain((function(t){0!==t.residueCount&&(c.index=t.residueOffset,u.index=t.residueOffset+t.residueCount-1,s(u,c))})),t.atomSetDict.backbone=n,gc&&mc.timeEnd("calculateBondsBetween")}function $p(t){if(t.unitcell){gc&&mc.time("buildUnitcellAssembly");var e=t.unitcell,i=t.center.clone().applyMatrix4(e.cartToFrac),r=function(t){var e=Cp[t],i={};if(void 0===e)return console.warn("getSymmetryOperations: spacegroup '"+t+"' not found in symop library"),i;for(var r=[],n=0,o=e.length;n<o;n+=3){for(var a=[],s=0;s<3;++s)a.push(Ep[e[n+s]]);r.push(a)}var c=/^[1-9]$/;return r.forEach((function(t){var e=0,r=(new N).set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1),n=r.elements;i[t]=r,t.forEach((function(t){for(var i=!1,r=!1,o=0,a=t.length;o<a;++o){var s=t[o];if("-"===s)i=!0;else if("+"===s)i=!1;else if("/"===s)r=!0;else if("X"===s)n[0+e]=i?-1:1;else if("Y"===s)n[4+e]=i?-1:1;else if("Z"===s)n[8+e]=i?-1:1;else if(c.test(s)){var u=parseInt(s);r?n[12+e]/=u:n[12+e]=u}else mc.warn('getSymmetryOperations: unknown token "'+s+'"')}e+=1}))})),i}(e.spacegroup),n=new O,o=new O,a=new O;i.x>1&&(n.x-=1),i.x<0&&(n.x+=1),i.y>1&&(n.y-=1),i.y<0&&(n.y+=1),i.z>1&&(n.z-=1),i.z<0&&(n.z+=1);var s,c=new Rp("UNITCELL"),u=m();if(t.biomolDict.NCS){s=[new N].concat(t.biomolDict.NCS.partList[0].matrixList);var h=[];u.forEach((function(t){s.forEach((function(e){h.push(t.clone().multiply(e))}))})),c.addPart(h)}else c.addPart(u);var l=new O,p=new Rp("SUPERCELL"),d=Array.prototype.concat.call(m(l.set(1,0,0)),m(l.set(0,1,0)),m(l.set(0,0,1)),m(l.set(-1,0,0)),m(l.set(0,-1,0)),m(l.set(0,0,-1)),m(l.set(1,1,0)),m(l.set(1,0,1)),m(l.set(0,1,1)),m(l.set(-1,-1,0)),m(l.set(-1,0,-1)),m(l.set(0,-1,-1)),m(l.set(1,-1,-1)),m(l.set(1,1,-1)),m(l.set(1,-1,1)),m(l.set(-1,1,1)),m(l.set(-1,-1,1)),m(l.set(-1,1,-1)),m(l.set(0,1,-1)),m(l.set(0,-1,1)),m(l.set(1,0,-1)),m(l.set(-1,0,1)),m(l.set(1,-1,0)),m(l.set(-1,1,0)),m(),m(l.set(1,1,1)),m(l.set(-1,-1,-1)));if(t.biomolDict.NCS){var f=[];d.forEach((function(t){s.forEach((function(e){f.push(t.clone().multiply(e))}))})),p.addPart(f)}else p.addPart(d);t.biomolDict.UNITCELL=c,t.biomolDict.SUPERCELL=p,gc&&mc.timeEnd("buildUnitcellAssembly")}function m(t){var s=[];return Object.keys(r).forEach((function(c){var u=r[c].clone();o.copy(i).applyMatrix4(u),a.setFromMatrixPosition(u),a.sub(n),o.x>1&&(a.x-=1),o.x<0&&(a.x+=1),o.y>1&&(a.y-=1),o.y<0&&(a.y+=1),o.z>1&&(a.z-=1),o.z<0&&(a.z+=1),t&&a.add(t),u.setPosition(a),u.multiplyMatrices(e.fracToCart,u),u.multiply(e.cartToFrac),s.push(u)})),s}}var Hp=["H","C","O","N","S","P"],Wp=["NA","CL","FE"];function Xp(t){var e=t.trim().toUpperCase();parseInt(e.charAt(0))&&(e=e.substr(1)),parseInt(e.charAt(0))&&(e=e.substr(1));var i=e.length;if(0===i)return"";if(1===i)return e;if(2===i){if(-1!==Wp.indexOf(e))return e;if(-1!==Hp.indexOf(e[0]))return e[0]}return i>=3&&-1!==Hp.indexOf(e[0])?e[0]:""}function qp(t){var e=t.bondHash,i=e.countArray,r=e.offsetArray,n=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=r[e],p=0,d=i[e];p<d;++p){o.index=n[l+p];var f=o.atomIndex1,m=o.atomIndex2;if(f>m){var g=m;m=f,f=g}var v=f+"|"+m;void 0===h[v]&&(h[v]=!0,s.push(f-a),c.push(m-a),u.push(o.bondOrder))}})),e.bonds={atomIndices1:s,atomIndices2:c,bondOrders:u}}}))}var Yp=function(t,e,i){this.structure=t,i=i||Xp(e),this.atomname=e,this.element=i,this.vdw=ml[i],this.covalent=gl[i]};var Zp=function(t){this.structure=t,this.dict={},this.list=[]};Zp.prototype.add=function(t,e){var i=function(t,e){return t+"|"+e}(t=t.toUpperCase(),e=e?e.toUpperCase():Xp(t)),r=this.dict[i];if(void 0===r){var n=new Yp(this.structure,t,e);r=this.list.length,this.dict[i]=r,this.list.push(n)}return r},Zp.prototype.get=function(t){return this.list[t]};var Kp=function(t,e,i,r,n,o){this.structure=t,this.resname=e,this.atomTypeIdList=i,this.hetero=r?1:0,this.chemCompType=n,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=Cl[this.backboneType],s=Cl[this.backboneStartType],c=Cl[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 p=this.getAtomIndexByName(s.backboneStart);this.backboneStartAtomIndex=void 0!==p?p:-1;var d,f=this.getAtomIndexByName(c.backboneEnd);this.backboneEndAtomIndex=void 0!==f?f:-1,d=Sl.includes(e)?this.getAtomIndexByName("N1"):this.getAtomIndexByName("N3"),this.rungEndAtomIndex=void 0!==d?d:-1,this.bondReferenceAtomIndices=[]};Kp.prototype.getBackboneIndexList=function(){var t,e=[];switch(this.moleculeType){case 3:t=Tl;break;case 4:case 5:t=El;break;default:return e}for(var i=this.structure.atomMap,r=this.atomTypeIdList,n=0,o=this.atomCount;n<o;++n){var a=i.get(r[n]);t.includes(a.atomname)&&e.push(n)}return e},Kp.prototype.getMoleculeType=function(){return this.isProtein()?3:this.isRna()?4:this.isDna()?5:this.isWater()?1:this.isIon()?2:this.isSaccharide()?6:0},Kp.prototype.getBackboneType=function(t){return this.hasProteinBackbone(t)?1:this.hasRnaBackbone(t)?2:this.hasDnaBackbone(t)?3:this.hasCgProteinBackbone(t)?4:this.hasCgRnaBackbone(t)?5:this.hasCgDnaBackbone(t)?6:0},Kp.prototype.isProtein=function(){return this.chemCompType?sl.includes(this.chemCompType):this.hasAtomWithName("CA","C","N")||xl.includes(this.resname)},Kp.prototype.isCg=function(){var t=this.backboneType;return 4===t||5===t||6===t},Kp.prototype.isNucleic=function(){return this.isRna()||this.isDna()},Kp.prototype.isRna=function(){return this.chemCompType?cl.includes(this.chemCompType):this.hasAtomWithName(["P","O3'","O3*"],["C4'","C4*"],["O2'","O2*","F2'","F2*"])||_l.includes(this.resname)&&this.hasAtomWithName(["O2'","O2*","F2'","F2*"])},Kp.prototype.isDna=function(){return this.chemCompType?ul.includes(this.chemCompType):this.hasAtomWithName(["P","O3'","O3*"],["C3'","C3*"])&&!this.hasAtomWithName(["O2'","O2*","F2'","F2*"])||wl.includes(this.resname)},Kp.prototype.isHetero=function(){return 1===this.hetero},Kp.prototype.isIon=function(){return Ml.includes(this.resname)},Kp.prototype.isWater=function(){return Al.includes(this.resname)},Kp.prototype.isSaccharide=function(){return this.chemCompType?hl.includes(this.chemCompType):Pl.includes(this.resname)},Kp.prototype.hasBackboneAtoms=function(t,e){var i=Cl[e];return-1===t?this.hasAtomWithName(i.trace,i.backboneEnd,i.direction1,i.direction2):0===t?this.hasAtomWithName(i.trace,i.direction1,i.direction2):1===t?this.hasAtomWithName(i.trace,i.backboneStart,i.direction1,i.direction2):this.hasAtomWithName(i.trace,i.backboneStart,i.backboneEnd,i.direction1,i.direction2)},Kp.prototype.hasProteinBackbone=function(t){return this.isProtein()&&this.hasBackboneAtoms(t,1)},Kp.prototype.hasRnaBackbone=function(t){return this.isRna()&&this.hasBackboneAtoms(t,2)},Kp.prototype.hasDnaBackbone=function(t){return this.isDna()&&this.hasBackboneAtoms(t,3)},Kp.prototype.hasCgProteinBackbone=function(t){return this.isProtein()&&this.hasBackboneAtoms(t,4)},Kp.prototype.hasCgRnaBackbone=function(t){return this.isRna()&&this.hasBackboneAtoms(t,5)},Kp.prototype.hasCgDnaBackbone=function(t){return this.isDna()&&this.hasBackboneAtoms(t,6)},Kp.prototype.hasBackbone=function(t){return this.hasProteinBackbone(t)||this.hasRnaBackbone(t)||this.hasDnaBackbone(t)||this.hasCgProteinBackbone(t)||this.hasCgRnaBackbone(t)||this.hasCgDnaBackbone(t)},Kp.prototype.getAtomIndexByName=function(t){var e=this.atomCount,i=this.structure.atomMap,r=this.atomTypeIdList;if(Array.isArray(t))for(var n=0;n<e;++n){var o=r[n];if(t.includes(i.get(o).atomname))return n}else for(var a=0;a<e;++a){var s=r[a];if(t===i.get(s).atomname)return a}},Kp.prototype.hasAtomWithName=function(){for(var t=arguments,e=this,i=arguments.length,r=0;r<i;++r)if(void 0!==t[r]&&void 0===e.getAtomIndexByName(t[r]))return!1;return!0},Kp.prototype.getBonds=function(t){return void 0===this.bonds&&(this.bonds=function(t){var e=t.structure,i=e.getAtomProxy(),r=e.getAtomProxy(),n=t.atomCount,o=t.atomOffset,a=o+n-1;if(!(n>500)){var s,c,u=[],h=[],l=[];if(n>50){var p=new Tp(t,!0),d=t.isCg()?1.2:2.3;for(s=o;s<a;++s){i.index=s;var f=i.covalent+d+.3,m=p.nearest(i,1/0,f*f),g=m.length;for(c=0;c<g;++c)r.index=m[c].index,i.index<r.index&&i.connectedTo(r)&&(u.push(i.index-o),h.push(r.index-o),l.push(1))}}else for(s=o;s<a;++s)for(i.index=s,c=s+1;c<=a;++c)r.index=c,i.connectedTo(r)&&(u.push(s-o),h.push(c-o),l.push(1));return{atomIndices1:u,atomIndices2:h,bondOrders:l}}gc&&mc.warn("more than 500 atoms, skip residue for auto-bonding",t.qualifiedName())}(t)),this.bonds},Kp.prototype.getRings=function(){return void 0===this.rings&&this.calculateRings(),this.rings},Kp.prototype.getBondGraph=function(){return void 0===this.bondGraph&&this.calculateBondGraph(),this.bondGraph},Kp.prototype.calculateBondGraph=function(){for(var t=this.bondGraph={},e=this.getBonds(),i=e.atomIndices1.length,r=e.atomIndices1,n=e.atomIndices2,o=0;o<i;++o){var a=r[o],s=n[o];(t[a]=t[a]||[]).push(s),(t[s]=t[s]||[]).push(a)}},Kp.prototype.calculateRings=function(){var t=this.getBondGraph(),e=new Int8Array(this.atomCount),i=new Int8Array(this.atomCount),r=[],n=[];function o(a,s,c){if(e[a])throw new Error("DFS revisited atom");e[a]=1,n.push(a);for(var u=s.length,h=0;h<u;++h){var l=s[h];if(0===e[l])t[l]&&t[l].length>=2?o(l,t[l],a):e[l]=2;else if(1===e[l]&&c&&c!==l){var p=[l];i[l]=1,r.push(p);for(var d=n.length-1;d>=0;--d){var f=n[d];if(f===l)break;p.push(f),i[f]=1}}}e[a]=2,n.pop()}for(var a=0;a<this.atomCount;++a)if(!e[a]){var s=t[a];!s||s.length<2?e[a]=2:(n.length=0,o(a,s))}this.rings={flags:i,rings:r}},Kp.prototype.assignBondReferenceAtomIndices=function(){var t=this.getBondGraph(),e=this.getRings(),i=e.flags,r=e.rings,n=this.bonds.atomIndices1,o=this.bonds.atomIndices2,a=this.bonds.bondOrders,s=this.bondReferenceAtomIndices,c=this.bonds.atomIndices1.length;s.length=0;for(var u=0;u<c;++u)if(!(a[u]<=1)){var h=n[u],l=o[u];if(i[h]&&i[l]){for(var p=0;p<r.length&&void 0===s[u];++p)for(var d=r[p],f=null,m=!1,g=0;g<d.length;++g){var v=d[g];if(v===h||v===l?m=!0:f=v,m&&null!==f){s[u]=f;break}}if(void 0!==s[u])continue}if(t[h].length>1)for(var y=0;y<t[h].length;++y){var b=t[h][y];if(b!==l){s[u]=b;break}}else if(t[l].length>1)for(var x=0;x<t[l].length;++x){var _=t[l][x];if(_!==h){s[u]=_;break}}else;}},Kp.prototype.getBondIndex=function(t,e){for(var i=this.bonds,r=i.atomIndices1,n=i.atomIndices2,o=r.indexOf(t),a=n.indexOf(e),s=a;-1!==o;){for(;-1!==a;){if(o===a)return o;a=n.indexOf(e,a+1)}o=r.indexOf(t,o+1),a=s}},Kp.prototype.getBondReferenceAtomIndex=function(t,e){var i=this.getBondIndex(t,e);if(void 0!==i)return 0===this.bondReferenceAtomIndices.length&&this.assignBondReferenceAtomIndices(),this.bondReferenceAtomIndices[i]};var Qp=function(t){this.structure=t,this.dict={},this.list=[]};Qp.prototype.add=function(t,e,i,r,n){var o=function(t,e,i,r){return t+"|"+e.join(",")+"|"+(i?1:0)+"|"+(r||"")}(t=t.toUpperCase(),e,i,r),a=this.dict[o];if(void 0===a){var s=new Kp(this.structure,t,e,i,r,n);a=this.list.length,this.dict[o]=a,this.list.push(s)}return a},Qp.prototype.get=function(t){return this.list[t]};var Jp=function(t,e){this.structure=t,this.bondStore=t.bondStore,this.index=e,this._v12=new O,this._v13=new O,this._ap1=this.structure.getAtomProxy(),this._ap2=this.structure.getAtomProxy(),this._ap3=this.structure.getAtomProxy()},td={atom1:{},atom2:{},atomIndex1:{},atomIndex2:{},bondOrder:{}};td.atom1.get=function(){return this.structure.getAtomProxy(this.atomIndex1)},td.atom2.get=function(){return this.structure.getAtomProxy(this.atomIndex2)},td.atomIndex1.get=function(){return this.bondStore.atomIndex1[this.index]},td.atomIndex1.set=function(t){this.bondStore.atomIndex1[this.index]=t},td.atomIndex2.get=function(){return this.bondStore.atomIndex2[this.index]},td.atomIndex2.set=function(t){this.bondStore.atomIndex2[this.index]=t},td.bondOrder.get=function(){return this.bondStore.bondOrder[this.index]},td.bondOrder.set=function(t){this.bondStore.bondOrder[this.index]=t},Jp.prototype.getReferenceAtomIndex=function(){var t=this._ap1,e=this._ap2;if(t.index=this.atomIndex1,e.index=this.atomIndex2,t.residueIndex===e.residueIndex){var i=t.index-t.residueAtomOffset,r=e.index-e.residueAtomOffset,n=t.residueType.getBondReferenceAtomIndex(i,r);if(void 0!==n)return n+t.residueAtomOffset;console.warn("No reference atom found",t.index,e.index)}},Jp.prototype.calculateShiftDir=function(t){t||(t=new O);var e=this._ap1,i=this._ap2,r=this._ap3,n=this._v12,o=this._v13;e.index=this.atomIndex1,i.index=this.atomIndex2;var a=this.getReferenceAtomIndex();n.subVectors(e,i).normalize(),void 0!==a?(r.index=a,o.subVectors(e,r)):o.copy(e),o.normalize();var s=n.dot(o);return 1-Math.abs(s)<1e-5&&(o.set(1,0,0),s=n.dot(o),1-Math.abs(s)<1e-5&&(o.set(0,1,0),s=n.dot(o))),t.copy(o.sub(n.multiplyScalar(s))).normalize()},Jp.prototype.qualifiedName=function(){return this.atomIndex1+"="+this.atomIndex2},Jp.prototype.clone=function(){return new this.constructor(this.structure,this.index)},Jp.prototype.toObject=function(){return{atomIndex1:this.atomIndex1,atomIndex2:this.atomIndex2,bondOrder:this.bondOrder}},Object.defineProperties(Jp.prototype,td);var ed=function(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},id={bondHash:{},entity:{},entityIndex:{},modelIndex:{},chainIndex:{},residue:{},residueIndex:{},sstruc:{},inscode:{},resno:{},chainname:{},chainid:{},residueType:{},atomType:{},residueAtomOffset:{},resname:{},hetero:{},atomname:{},element:{},vdw:{},covalent:{},x:{},y:{},z:{},serial:{},bfactor:{},occupancy:{},altloc:{}};id.bondHash.get=function(){return this.structure.bondHash},id.entity.get=function(){return this.structure.entityList[this.entityIndex]},id.entityIndex.get=function(){return this.chainStore.entityIndex[this.chainIndex]},id.modelIndex.get=function(){return this.chainStore.modelIndex[this.chainIndex]},id.chainIndex.get=function(){return this.residueStore.chainIndex[this.residueIndex]},id.residue.get=function(){return console.warn("residue - might be expensive"),this.structure.getResidueProxy(this.residueIndex)},id.residueIndex.get=function(){return this.atomStore.residueIndex[this.index]},id.residueIndex.set=function(t){this.atomStore.residueIndex[this.index]=t},id.sstruc.get=function(){return this.residueStore.getSstruc(this.residueIndex)},id.inscode.get=function(){return this.residueStore.getInscode(this.residueIndex)},id.resno.get=function(){return this.residueStore.resno[this.residueIndex]},id.chainname.get=function(){return this.chainStore.getChainname(this.chainIndex)},id.chainid.get=function(){return this.chainStore.getChainid(this.chainIndex)},id.residueType.get=function(){return this.residueMap.get(this.residueStore.residueTypeId[this.residueIndex])},id.atomType.get=function(){return this.atomMap.get(this.atomStore.atomTypeId[this.index])},id.residueAtomOffset.get=function(){return this.residueStore.atomOffset[this.residueIndex]},id.resname.get=function(){return this.residueType.resname},id.hetero.get=function(){return this.residueType.hetero},id.atomname.get=function(){return this.atomType.atomname},id.element.get=function(){return this.atomType.element},id.vdw.get=function(){return this.atomType.vdw},id.covalent.get=function(){return this.atomType.covalent},id.x.get=function(){return this.atomStore.x[this.index]},id.x.set=function(t){this.atomStore.x[this.index]=t},id.y.get=function(){return this.atomStore.y[this.index]},id.y.set=function(t){this.atomStore.y[this.index]=t},id.z.get=function(){return this.atomStore.z[this.index]},id.z.set=function(t){this.atomStore.z[this.index]=t},id.serial.get=function(){return this.atomStore.serial[this.index]},id.serial.set=function(t){this.atomStore.serial[this.index]=t},id.bfactor.get=function(){return this.atomStore.bfactor[this.index]},id.bfactor.set=function(t){this.atomStore.bfactor[this.index]=t},id.occupancy.get=function(){return this.atomStore.occupancy[this.index]},id.occupancy.set=function(t){this.atomStore.occupancy[this.index]=t},id.altloc.get=function(){return this.atomStore.getAltloc(this.index)},id.altloc.set=function(t){this.atomStore.setAltloc(this.index,t)},ed.prototype.eachBond=function(t,e){e=e||this.structure._bp;for(var i=this.index,r=this.bondHash,n=r.indexArray,o=r.countArray[i],a=r.offsetArray[i],s=0;s<o;++s)e.index=n[a+s],t(e)},ed.prototype.eachBondedAtom=function(t,e){e=e||this.structure._ap;var i=this.index;this.eachBond((function(r){i!==r.atomIndex1?e.index=r.atomIndex1:e.index=r.atomIndex2,t(e)}))},ed.prototype.isBackbone=function(){var t=this.residueType.backboneIndexList;if(t.length>0){var e=this.residueStore.atomOffset[this.residueIndex];return t.includes(this.index-e)}return!1},ed.prototype.isPolymer=function(){if(this.structure.entityList.length>0)return this.entity.isPolymer();var t=this.residueType.moleculeType;return 3===t||4===t||5===t},ed.prototype.isSidechain=function(){return this.isPolymer()&&!this.isBackbone()},ed.prototype.isCg=function(){var t=this.residueType.backboneType;return 4===t||5===t||6===t},ed.prototype.isHetero=function(){return 1===this.residueType.hetero},ed.prototype.isProtein=function(){return 3===this.residueType.moleculeType},ed.prototype.isNucleic=function(){var t=this.residueType.moleculeType;return 4===t||5===t},ed.prototype.isRna=function(){return 4===this.residueType.moleculeType},ed.prototype.isDna=function(){return 5===this.residueType.moleculeType},ed.prototype.isWater=function(){return 1===this.residueType.moleculeType},ed.prototype.isIon=function(){return 2===this.residueType.moleculeType},ed.prototype.isSaccharide=function(){return 6===this.residueType.moleculeType},ed.prototype.isHelix=function(){return pl.includes(this.sstruc)},ed.prototype.isSheet=function(){return dl.includes(this.sstruc)},ed.prototype.isTurn=function(){return fl.includes(this.sstruc)&&this.isProtein()},ed.prototype.isBonded=function(){return 0!==this.bondHash.countArray[this.index]},ed.prototype.isRing=function(){return 1===this.residueType.getRings().flags[this.index-this.residueAtomOffset]},ed.prototype.distanceTo=function(t){var e=this.atomStore,i=t.atomStore,r=this.index,n=t.index,o=e.x[r]-i.x[n],a=e.y[r]-i.y[n],s=e.z[r]-i.z[n],c=o*o+a*a+s*s;return Math.sqrt(c)},ed.prototype.connectedTo=function(t){var e=this.atomStore,i=t.atomStore,r=this.index,n=t.index;if(e.altloc&&i.altloc){var o=e.altloc[r],a=i.altloc[n];if(0!==o&&0!==a&&32!==o&&32!==a&&o!==a)return!1}var s=e.x[r]-i.x[n],c=e.y[r]-i.y[n],u=e.z[r]-i.z[n],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,p=l+.3,d=l-.5;return h<p*p&&h>d*d},ed.prototype.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},ed.prototype.positionToArray=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.index,r=this.atomStore;return t[e+0]=r.x[i],t[e+1]=r.y[i],t[e+2]=r.z[i],t},ed.prototype.positionToVector3=function(t){return void 0===t&&(t=new O),t.x=this.x,t.y=this.y,t.z=this.z,t},ed.prototype.positionFromVector3=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},ed.prototype.getResidueBonds=function(t){var e,i,r,n,o=this.residueAtomOffset,a=this.index-this.residueAtomOffset,s=this.residueType.getBonds(),c=s.atomIndices1,u=s.atomIndices2;for(t||(n=[]),e=c.indexOf(a);-1!==e;){if(r=u[e]+o,t)return r;n.push(r),e=c.indexOf(a,e+1)}for(i=u.indexOf(a);-1!==i;){if(r=c[i]+o,t)return r;n.push(r),i=u.indexOf(a,i+1)}return n},ed.prototype.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},ed.prototype.clone=function(){return new this.constructor(this.structure,this.index)},ed.prototype.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}},Object.defineProperties(ed.prototype,id);var rd=function(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},nd={entity:{},entityIndex:{},chain:{},chainIndex:{},atomOffset:{},atomCount:{},atomEnd:{},modelIndex:{},chainname:{},chainid:{},resno:{},sstruc:{},inscode:{},residueType:{},resname:{},hetero:{},moleculeType:{},backboneType:{},backboneStartType:{},backboneEndType:{},traceAtomIndex:{},direction1AtomIndex:{},direction2AtomIndex:{},backboneStartAtomIndex:{},backboneEndAtomIndex:{},rungEndAtomIndex:{}};nd.entity.get=function(){return this.structure.entityList[this.entityIndex]},nd.entityIndex.get=function(){return this.chainStore.entityIndex[this.chainIndex]},nd.chain.get=function(){return this.structure.getChainProxy(this.chainIndex)},nd.chainIndex.get=function(){return this.residueStore.chainIndex[this.index]},nd.chainIndex.set=function(t){this.residueStore.chainIndex[this.index]=t},nd.atomOffset.get=function(){return this.residueStore.atomOffset[this.index]},nd.atomOffset.set=function(t){this.residueStore.atomOffset[this.index]=t},nd.atomCount.get=function(){return this.residueStore.atomCount[this.index]},nd.atomCount.set=function(t){this.residueStore.atomCount[this.index]=t},nd.atomEnd.get=function(){return this.atomOffset+this.atomCount-1},nd.modelIndex.get=function(){return this.chainStore.modelIndex[this.chainIndex]},nd.chainname.get=function(){return this.chainStore.getChainname(this.chainIndex)},nd.chainid.get=function(){return this.chainStore.getChainid(this.chainIndex)},nd.resno.get=function(){return this.residueStore.resno[this.index]},nd.resno.set=function(t){this.residueStore.resno[this.index]=t},nd.sstruc.get=function(){return this.residueStore.getSstruc(this.index)},nd.sstruc.set=function(t){this.residueStore.setSstruc(this.index,t)},nd.inscode.get=function(){return this.residueStore.getInscode(this.index)},nd.inscode.set=function(t){this.residueStore.getInscode(this.index,t)},nd.residueType.get=function(){return this.residueMap.get(this.residueStore.residueTypeId[this.index])},nd.resname.get=function(){return this.residueType.resname},nd.hetero.get=function(){return this.residueType.hetero},nd.moleculeType.get=function(){return this.residueType.moleculeType},nd.backboneType.get=function(){return this.residueType.backboneType},nd.backboneStartType.get=function(){return this.residueType.backboneStartType},nd.backboneEndType.get=function(){return this.residueType.backboneEndType},nd.traceAtomIndex.get=function(){return this.residueType.traceAtomIndex+this.atomOffset},nd.direction1AtomIndex.get=function(){return this.residueType.direction1AtomIndex+this.atomOffset},nd.direction2AtomIndex.get=function(){return this.residueType.direction2AtomIndex+this.atomOffset},nd.backboneStartAtomIndex.get=function(){return this.residueType.backboneStartAtomIndex+this.atomOffset},nd.backboneEndAtomIndex.get=function(){return this.residueType.backboneEndAtomIndex+this.atomOffset},nd.rungEndAtomIndex.get=function(){return this.residueType.rungEndAtomIndex+this.atomOffset},rd.prototype.eachAtom=function(t,e){var i,r=this.atomCount,n=this.atomOffset,o=this.structure._ap,a=n+r;if(e&&e.atomOnlyTest){var s=e.atomOnlyTest;for(i=n;i<a;++i)o.index=i,s(o)&&t(o)}else for(i=n;i<a;++i)o.index=i,t(o)},rd.prototype.isProtein=function(){return 3===this.residueType.moleculeType},rd.prototype.isNucleic=function(){var t=this.residueType.moleculeType;return 4===t||5===t},rd.prototype.isRna=function(){return 4===this.residueType.moleculeType},rd.prototype.isDna=function(){return 5===this.residueType.moleculeType},rd.prototype.isCg=function(){var t=this.residueType.backboneType;return 4===t||5===t||6===t},rd.prototype.isPolymer=function(){if(this.structure.entityList.length>0)return this.entity.isPolymer();var t=this.residueType.moleculeType;return 3===t||4===t||5===t},rd.prototype.isHetero=function(){return 1===this.residueType.hetero},rd.prototype.isWater=function(){return 1===this.residueType.moleculeType},rd.prototype.isIon=function(){return 2===this.residueType.moleculeType},rd.prototype.isSaccharide=function(){return 6===this.residueType.moleculeType},rd.prototype.isHelix=function(){return pl.includes(this.sstruc)},rd.prototype.isSheet=function(){return dl.includes(this.sstruc)},rd.prototype.isTurn=function(){return fl.includes(this.sstruc)&&this.isProtein()},rd.prototype.getAtomType=function(t){return this.atomMap.get(this.atomStore.atomTypeId[t])},rd.prototype.getResname1=function(){return bl[this.resname.toUpperCase()]||"X"},rd.prototype.getBackboneType=function(t){switch(t){case-1:return this.residueType.backboneStartType;case 1:return this.residueType.backboneEndType;default:return this.residueType.backboneType}},rd.prototype.getAtomIndexByName=function(t){var e=this.residueType.getAtomIndexByName(t);return void 0!==e&&(e+=this.atomOffset),e},rd.prototype.getAtomByName=function(t){return this.residueType.getAtomByName(t)},rd.prototype.hasAtomWithName=function(t){return this.residueType.hasAtomWithName(t)},rd.prototype.getAtomnameList=function(){console.warn("getAtomnameList - might be expensive");for(var t=this.atomCount,e=this.atomOffset,i=new Array(t),r=0;r<t;++r)i[r]=this.getAtomType(e+r).atomname;return i},rd.prototype.connectedTo=function(t){var e=this.structure.getAtomProxy(this.backboneEndAtomIndex),i=this.structure.getAtomProxy(t.backboneStartAtomIndex);return!(!e||!i)&&e.connectedTo(i)},rd.prototype.getNextConnectedResidue=function(){var t=this.chainStore.residueOffset[this.chainIndex],e=this.chainStore.residueCount[this.chainIndex],i=this.index+1;if(i<t+e){var r=this.structure.getResidueProxy(i);if(this.connectedTo(r))return r}else if(i===t+e){var n=this.structure.getResidueProxy(t);if(this.connectedTo(n))return n}},rd.prototype.getPreviousConnectedResidue=function(){var t=this.chainStore.residueOffset[this.chainIndex],e=this.index-1;if(e>=t){var i=this.structure.getResidueProxy(e);if(i.connectedTo(this))return i}else if(e===t-1){var r=this.chainStore.residueCount[this.chainIndex],n=this.structure.getResidueProxy(t+r-1);if(n.connectedTo(this))return n}},rd.prototype.getBonds=function(){return this.residueType.getBonds(this)},rd.prototype.getRings=function(){return this.residueType.getRings()},rd.prototype.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},rd.prototype.clone=function(){return new this.constructor(this.structure,this.index)},rd.prototype.toObject=function(){return{index:this.index,chainIndex:this.chainIndex,atomOffset:this.atomOffset,atomCount:this.atomCount,resno:this.resno,resname:this.resname,sstruc:this.sstruc}},Object.defineProperties(rd.prototype,nd);var od=function(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 r=this.structure.getResidueProxy(this.residueIndexStart),n=this.structure.getResidueProxy(this.residueIndexEnd);this.isPrevConnected=void 0!==r.getPreviousConnectedResidue();var o=n.getNextConnectedResidue();this.isNextConnected=void 0!==o,this.isNextNextConnected=this.isNextConnected&&void 0!==o.getNextConnectedResidue(),this.isCyclic=n.connectedTo(r),this.__residueProxy=this.structure.getResidueProxy()},ad={chainIndex:{},modelIndex:{},chainname:{}};ad.chainIndex.get=function(){return this.residueStore.chainIndex[this.residueIndexStart]},ad.modelIndex.get=function(){return this.chainStore.modelIndex[this.chainIndex]},ad.chainname.get=function(){return this.chainStore.getChainname(this.chainIndex)},od.prototype.isProtein=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isProtein()},od.prototype.isCg=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isCg()},od.prototype.isNucleic=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isNucleic()},od.prototype.getMoleculeType=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.moleculeType},od.prototype.getBackboneType=function(t){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.getBackboneType(t)},od.prototype.getAtomIndexByType=function(t,e){this.isCyclic?-1===t?t=this.residueCount-1:t===this.residueCount&&(t=0):(-1!==t||this.isPrevConnected||(t+=1),t!==this.residueCount||this.isNextNextConnected||(t-=1));var i,r=this.__residueProxy;switch(r.index=this.residueIndexStart+t,e){case"trace":i=r.traceAtomIndex;break;case"direction1":i=r.direction1AtomIndex;break;case"direction2":i=r.direction2AtomIndex;break;default:var n=r.getAtomByName(e);i=n?n.index:void 0}return i},od.prototype.eachAtom=function(t,e){this.eachResidue((function(i){i.eachAtom(t,e)}),e)},od.prototype.eachAtomN=function(t,e,i){var r,n=this.residueCount,o=new Array(t);for(r=0;r<t;++r)o[r]=this.structure.getAtomProxy(this.getAtomIndexByType(r,i));e.apply(this,o);for(var a=t;a<n;++a){for(r=1;r<t;++r)o[r-1].index=o[r].index;o[t-1].index=this.getAtomIndexByType(a,i),e.apply(this,o)}},od.prototype.eachAtomN2=function(t,e,i){var r=this.atomOffset,n=this.atomCount,o=r+n;if(!(n<t)){for(var a=new Array(t),s=0;s<t;++s)a[s]=this.structure.getAtomProxy();var c=this.structure.atomSetCache["__"+i];void 0===c&&(mc.warn("no precomputed atomSet for: "+i),c=this.structure.getAtomSet(!1),this.eachResidue((function(t){var e=t.getAtomByName(i);c.set(e.index)})));var u=0;c.forEach((function(i){if(i>=r&&i<o){for(var n=1;n<t;++n)a[n-1].index=a[n].index;a[t-1].index=i,(u+=1)>=t&&e.apply(this,a)}}))}},od.prototype.eachResidue=function(t){for(var e=this.structure.getResidueProxy(),i=this.residueCount,r=this.residueIndexStart,n=0;n<i;++n)e.index=r+n,t(e)},od.prototype.qualifiedName=function(){var t=this.structure.getResidueProxy(this.residueIndexStart),e=this.structure.getResidueProxy(this.residueIndexEnd);return t.qualifiedName()+" - "+e.qualifiedName()},Object.defineProperties(od.prototype,ad);var sd=function(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.index=e},cd={entity:{},model:{},entityIndex:{},modelIndex:{},residueOffset:{},residueCount:{},residueEnd:{},atomOffset:{},atomEnd:{},atomCount:{},chainname:{},chainid:{}};cd.entity.get=function(){return this.structure.entityList[this.entityIndex]},cd.model.get=function(){return this.structure.getModelProxy(this.modelIndex)},cd.entityIndex.get=function(){return this.chainStore.entityIndex[this.index]},cd.entityIndex.set=function(t){this.chainStore.entityIndex[this.index]=t},cd.modelIndex.get=function(){return this.chainStore.modelIndex[this.index]},cd.modelIndex.set=function(t){this.chainStore.modelIndex[this.index]=t},cd.residueOffset.get=function(){return this.chainStore.residueOffset[this.index]},cd.residueOffset.set=function(t){this.chainStore.residueOffset[this.index]=t},cd.residueCount.get=function(){return this.chainStore.residueCount[this.index]},cd.residueCount.set=function(t){this.chainStore.residueCount[this.index]=t},cd.residueEnd.get=function(){return this.residueOffset+this.residueCount-1},cd.atomOffset.get=function(){return this.residueStore.atomOffset[this.residueOffset]},cd.atomEnd.get=function(){return this.residueStore.atomOffset[this.residueEnd]+this.residueStore.atomCount[this.residueEnd]-1},cd.atomCount.get=function(){return 0===this.residueCount?0:this.atomEnd-this.atomOffset+1},cd.chainname.get=function(){return this.chainStore.getChainname(this.index)},cd.chainname.set=function(t){this.chainStore.setChainname(this.index,t)},cd.chainid.get=function(){return this.chainStore.getChainid(this.index)},cd.chainid.set=function(t){this.chainStore.setChainid(this.index,t)},sd.prototype.eachAtom=function(t,e){this.eachResidue((function(i){i.eachAtom(t,e)}),e)},sd.prototype.eachResidue=function(t,e){var i,r=this.residueCount,n=this.residueOffset,o=this.structure._rp,a=n+r;if(e&&e.test){var s=e.residueOnlyTest;if(s)for(i=n;i<a;++i)o.index=i,s(o)&&t(o,e);else for(i=n;i<a;++i)o.index=i,t(o,e)}else for(i=n;i<a;++i)o.index=i,t(o)},sd.prototype.eachResidueN=function(t,e){var i,r=this.residueCount,n=this.residueOffset,o=n+r;if(!(r<t)){var a=new Array(t);for(i=0;i<t;++i)a[i]=this.structure.getResidueProxy(n+i);e.apply(this,a);for(var s=n+t;s<o;++s){for(i=0;i<t;++i)a[i].index+=1;e.apply(this,a)}}},sd.prototype.eachPolymer=function(t,e){for(var i,r,n=e?e.residueOnlyTest:void 0,o=this.model.structure,a=this.residueCount,s=this.residueOffset,c=s+a,u=this.structure.getResidueProxy(),h=this.structure.getResidueProxy(s),l=this.structure.getAtomProxy(),p=this.structure.getAtomProxy(),d=!0,f=s+1;f<c;++f){u.index=h.index,h.index=f,d&&(i=u.index,d=!1),r=h.index;var m=d?u.backboneEndType:u.backboneType,g=h.backboneType;0!==m&&m===g?(l.index=u.backboneEndAtomIndex,p.index=h.backboneStartAtomIndex,l&&p&&l.connectedTo(p)&&(!n||n(u)&&n(h))||(u.index-i>1&&t(new od(o,i,u.index)),i=r)):(0!==m&&u.index-i>1&&t(new od(o,i,u.index)),i=r)}r-i>1&&this.structure.getResidueProxy(i).backboneStartType&&t(new od(o,i,r))},sd.prototype.qualifiedName=function(){return":"+this.chainname+"/"+this.modelIndex},sd.prototype.clone=function(){return new this.constructor(this.structure,this.index)},sd.prototype.toObject=function(){return{index:this.index,residueOffset:this.residueOffset,residueCount:this.residueCount,chainname:this.chainname}},Object.defineProperties(sd.prototype,cd);var ud=function(t,e){this.structure=t,this.modelStore=t.modelStore,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.index=e},hd={chainOffset:{},chainCount:{},residueOffset:{},atomOffset:{},chainEnd:{},residueEnd:{},atomEnd:{},residueCount:{},atomCount:{}};hd.chainOffset.get=function(){return this.modelStore.chainOffset[this.index]},hd.chainOffset.set=function(t){this.modelStore.chainOffset[this.index]=t},hd.chainCount.get=function(){return this.modelStore.chainCount[this.index]},hd.chainCount.set=function(t){this.modelStore.chainCount[this.index]=t},hd.residueOffset.get=function(){return this.chainStore.residueOffset[this.chainOffset]},hd.atomOffset.get=function(){return this.residueStore.atomOffset[this.residueOffset]},hd.chainEnd.get=function(){return this.chainOffset+this.chainCount-1},hd.residueEnd.get=function(){return this.chainStore.residueOffset[this.chainEnd]+this.chainStore.residueCount[this.chainEnd]-1},hd.atomEnd.get=function(){return this.residueStore.atomOffset[this.residueEnd]+this.residueStore.atomCount[this.residueEnd]-1},hd.residueCount.get=function(){return 0===this.chainCount?0:this.residueEnd-this.residueOffset+1},hd.atomCount.get=function(){return 0===this.residueCount?0:this.atomEnd-this.atomOffset+1},ud.prototype.eachAtom=function(t,e){this.eachChain((function(i){i.eachAtom(t,e)}),e)},ud.prototype.eachResidue=function(t,e){this.eachChain((function(i){i.eachResidue(t,e)}),e)},ud.prototype.eachPolymer=function(t,e){if(e&&e.chainOnlyTest){var i=e.chainOnlyTest;this.eachChain((function(r){i(r)&&r.eachPolymer(t,e)}))}else this.eachChain((function(i){i.eachPolymer(t,e)}))},ud.prototype.eachChain=function(t,e){var i,r=this.chainCount,n=this.chainOffset,o=this.structure._cp,a=n+r;if(e&&e.test){var s=e.chainOnlyTest;if(s)for(i=n;i<a;++i)o.index=i,s(o)&&t(o,e);else for(i=n;i<a;++i)o.index=i,t(o,e)}else for(i=n;i<a;++i)o.index=i,t(o)},ud.prototype.qualifiedName=function(){return"/"+this.index},ud.prototype.clone=function(){return new this.constructor(this.structure,this.index)},ud.prototype.toObject=function(){return{index:this.index,chainOffset:this.chainOffset,chainCount:this.chainCount}},Object.defineProperties(ud.prototype,hd);var ld=function(t,e){this.signals={refreshed:new Fs},this.init(t,e)},pd={type:{}};function dd(t,e){var i=[],r=!1;if(e){for(var n=0,o=e.length;n<o;++n)i.push(e[n]);a()}function a(){var e=i.shift();void 0!==e?(r=!0,setTimeout((function(){!function(e){t(e,a)}(e)}))):r=!1}this.push=function(t){i.push(t),r||a()},this.kill=function(){i.length=0},this.length=function(){return i.length}}ld.prototype.init=function(t,e){this.name=t,this.path=e,this.title="",this.id="",this.header={},this.extraData={},this.atomSetCache=void 0,this.atomSetDict={},this.biomolDict={},this.entityList=[],this.unitcell=void 0,this.frames=[],this.boxes=[],this.validation=void 0,this.bondStore=new yp(0),this.backboneBondStore=new yp(0),this.rungBondStore=new yp(0),this.atomStore=new bp(0),this.residueStore=new xp(0),this.chainStore=new _p(0),this.modelStore=new wp(0),this.atomMap=new Zp(this),this.residueMap=new Qp(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()},pd.type.get=function(){return"Structure"},ld.prototype.finalizeAtoms=function(){this.atomSet=this.getAtomSet(),this.atomCount=this.atomStore.count,this.boundingBox=this.getBoundingBox(),this.center=this.boundingBox.getCenter(),this.spatialHash=new Kl(this.atomStore,this.boundingBox)},ld.prototype.finalizeBonds=function(){for(var t in this.bondSet=this.getBondSet(),this.bondCount=this.bondStore.count,this.bondHash=new mp(this.bondStore,this.atomStore.count),this.atomSetCache={},this.atomSetDict.rung||(this.atomSetDict.rung=this.getAtomSet(!1)),this.atomSetDict)this.atomSetCache["__"+t]=this.atomSetDict[t].clone()},ld.prototype.getBondProxy=function(t){return new Jp(this,t)},ld.prototype.getAtomProxy=function(t){return new ed(this,t)},ld.prototype.getResidueProxy=function(t){return new rd(this,t)},ld.prototype.getChainProxy=function(t){return new sd(this,t)},ld.prototype.getModelProxy=function(t){return new ud(this,t)},ld.prototype.getBondSet=function(){var t=this.bondStore.count,e=new al(t),i=this.atomSet;if(i)for(var r=this.getBondProxy(),n=0;n<t;++n)r.index=n,i.isSet(r.atomIndex1,r.atomIndex2)&&e.set(r.index);else e.setAll();return e},ld.prototype.getBackboneBondSet=function(){var t=this.backboneBondStore.count,e=new al(t),i=this.atomSetCache.__backbone;if(i){var r=this.getBondProxy();r.bondStore=this.backboneBondStore;for(var n=0;n<t;++n)r.index=n,i.isSet(r.atomIndex1,r.atomIndex2)&&e.set(r.index)}else e.set_all(!0);return e},ld.prototype.getRungBondSet=function(){var t=this.rungBondStore.count,e=new al(t),i=this.atomSetCache.__rung;if(i){var r=this.getBondProxy();r.bondStore=this.rungBondStore;for(var n=0;n<t;++n)r.index=n,i.isSet(r.atomIndex1,r.atomIndex2)&&e.set(r.index)}else e.set_all(!0);return e},ld.prototype.getAtomSet=function(t){var e,i=this.atomStore.count;if(t instanceof al)e=t;else if(t&&t.test){var r=t.string;r in this.atomSetCache?e=this.atomSetCache[r]:(e=new al(i),this.eachAtom((function(t){e.set(t.index)}),t),this.atomSetCache[r]=e)}else e=!1===t?new al(i):new al(i,!0);return e},ld.prototype.getAtomSetWithinSelection=function(t,e){var i=this.spatialHash,r=this.getAtomSet(!1),n=this.getAtomProxy();return this.getAtomSet(t).forEach((function(t){n.index=t,i.within(n.x,n.y,n.z,e).forEach((function(t){r.set(t)}))})),r},ld.prototype.getAtomSetWithinPoint=function(t,e){var i=t,r=this.getAtomSet(!1);return this.spatialHash.within(i.x,i.y,i.z,e).forEach((function(t){r.set(t)})),r},ld.prototype.getAtomSetWithinVolume=function(t,e,i,r,n){for(var o=new dp(t,i,r,n),a=o.getDataPosition(),s=a.length,c=o.matrix.getMaxScaleOnAxis(),u=this.getAtomSet(!1),h=0;h<s;h+=3)this.spatialHash.within(a[h],a[h+1],a[h+2],c).forEach((function(t){u.set(t)}));return u},ld.prototype.getAtomSetWithinGroup=function(t){var e=this.atomStore.residueIndex,i=this.getAtomSet(!1),r=this.getResidueProxy();return this.getAtomSet(t).forEach((function(t){r.index=e[t];for(var n=r.atomOffset;n<=r.atomEnd;++n)i.set(n)})),i},ld.prototype.getSelection=function(){return!1},ld.prototype.getStructure=function(){return this},ld.prototype.eachEntity=function(t,e){this.entityList.forEach((function(i){void 0!==e&&i.getEntityType()!==e||t(i)}))},ld.prototype.eachBond=function(t,e){var i,r=this.getBondProxy();if(e&&e.test&&(i=this.getBondSet(e),this.bondSet&&i.intersection(this.bondSet)),i)i.forEach((function(e){r.index=e,t(r)}));else for(var n=this.bondStore.count,o=0;o<n;++o)r.index=o,t(r)},ld.prototype.eachAtom=function(t,e){if(e&&e.test)this.eachModel((function(i){i.eachAtom(t,e)}),e);else for(var i=this.atomStore.count,r=this.getAtomProxy(),n=0;n<i;++n)r.index=n,t(r)},ld.prototype.eachResidue=function(t,e){var i;if(e&&e.test){var r=this.modelStore.count,n=this.getModelProxy(),o=e.modelOnlyTest;if(o)for(i=0;i<r;++i)n.index=i,o(n)&&n.eachResidue(t,e);else for(i=0;i<r;++i)n.index=i,n.eachResidue(t,e)}else{var a=this.residueStore.count,s=this.getResidueProxy();for(i=0;i<a;++i)s.index=i,t(s)}},ld.prototype.eachResidueN=function(t,e){var i,r,n=this.residueStore.count;if(!(n<t)){var o=new Array(t);for(i=0;i<t;++i)o[i]=this.getResidueProxy(i);for(e.apply(this,o),r=t;r<n;++r){for(i=0;i<t;++i)o[i].index+=1;e.apply(this,o)}}},ld.prototype.eachPolymer=function(t,e){if(e&&e.modelOnlyTest){var i=e.modelOnlyTest;this.eachModel((function(r){i(r)&&r.eachPolymer(t,e)}))}else this.eachModel((function(i){i.eachPolymer(t,e)}))},ld.prototype.eachChain=function(t,e){if(e&&e.test)this.eachModel((function(i){i.eachChain(t,e)}));else for(var i=this.chainStore.count,r=this.getChainProxy(),n=0;n<i;++n)r.index=n,t(r)},ld.prototype.eachModel=function(t,e){var i,r=this.modelStore.count,n=this.getModelProxy();if(e&&e.test){var o=e.modelOnlyTest;if(o)for(i=0;i<r;++i)n.index=i,o(n)&&t(n,e);else for(i=0;i<r;++i)n.index=i,t(n,e)}else for(i=0;i<r;++i)n.index=i,t(n)},ld.prototype.getAtomData=function(t){var e=Object.assign({},t);e.colorParams&&(e.colorParams.structure=this.getStructure());var i,r,n,o,a,s,c,u=e.what,h=Eo(e.atomSet,this.atomSet),l={},p=this.getAtomProxy(),d=h.getSize();return u&&!u.position||(n=new Float32Array(3*d),l.position=n),u&&!u.color||(o=new Float32Array(3*d),l.color=o,r=yc.getScheme(e.colorParams)),u&&!u.picking||(a=new Float32Array(d),l.picking=new $h(a,this.getStructure())),u&&!u.radius||(s=new Float32Array(d),l.radius=s,i=new Il(e.radiusParams.radius,e.radiusParams.scale)),u&&!u.index||(c=new Float32Array(d),l.index=c),h.forEach((function(t,e){var u=3*e;p.index=t,n&&p.positionToArray(n,u),o&&r.atomColorToArray(p,o,u),a&&(a[e]=t),s&&(s[e]=i.atomRadius(p)),c&&(c[e]=t)})),l},ld.prototype.getBondData=function(t){var e=Object.assign({},t);e.colorParams&&(e.colorParams.structure=this.getStructure());var i,r,n,o,a,s,c,u,h,l=e.what,p=Eo(e.bondSet,this.bondSet),d=Eo(e.multipleBond,"off"),f="off"!==d,m="offset"===d,g=Eo(e.bondScale,.4),v=Eo(e.bondSpacing,1),y={},b=this.getBondProxy();e.bondStore&&(b.bondStore=e.bondStore);var x,_=this.getAtomProxy(),w=this.getAtomProxy();if(f){var S=b.bondStore.bondOrder;x=0,p.forEach((function(t){x+=S[t]}))}else x=p.getSize();l&&!l.position||(n=new Float32Array(3*x),o=new Float32Array(3*x),y.position1=n,y.position2=o),l&&!l.color||(a=new Float32Array(3*x),s=new Float32Array(3*x),y.color=a,y.color2=s,r=yc.getScheme(e.colorParams)),l&&!l.picking||(c=new Float32Array(x),y.picking=new Wh(c,this.getStructure(),e.bondStore)),(!l||l.radius||f&&l.position)&&(i=new Il(e.radiusParams.radius,e.radiusParams.scale)),l&&!l.radius||(u=new Float32Array(x),y.radius=u,e.radius2&&(h=new Float32Array(x),y.radius2=h));var A,M,P,T,E,C,I,R=0,L=new O,N=new O,D=new O;return p.forEach((function(t){if(M=3*R,b.index=t,_.index=b.atomIndex1,w.index=b.atomIndex2,T=b.bondOrder,n&&(f&&T>1?(E=i.atomRadius(_),C=E*g/(.5*T),b.calculateShiftDir(D),m?(I=2*v*E,D.multiplyScalar(I),D.negate(),N.subVectors(w,_).multiplyScalar(Math.max(.1,I/1.88)),_.positionToArray(n,M),w.positionToArray(o,M),T>=2&&(L.addVectors(_,D).add(N).toArray(n,M+3),L.addVectors(w,D).sub(N).toArray(o,M+3),T>=3&&(L.subVectors(_,D).add(N).toArray(n,M+6),L.subVectors(w,D).sub(N).toArray(o,M+6)))):(I=(v-g)*E,D.multiplyScalar(I),2===T?(L.addVectors(_,D).toArray(n,M),L.subVectors(_,D).toArray(n,M+3),L.addVectors(w,D).toArray(o,M),L.subVectors(w,D).toArray(o,M+3)):3===T?(_.positionToArray(n,M),L.addVectors(_,D).toArray(n,M+3),L.subVectors(_,D).toArray(n,M+6),w.positionToArray(o,M),L.addVectors(w,D).toArray(o,M+3),L.subVectors(w,D).toArray(o,M+6)):(_.positionToArray(n,M),w.positionToArray(o,M)))):(_.positionToArray(n,M),w.positionToArray(o,M))),a&&(r.bondColorToArray(b,1,a,M),r.bondColorToArray(b,0,s,M),f&&T>1))for(A=1;A<T;++A)hu(a,M,P=3*A+M,3),hu(s,M,P,3);if(c&&(c[R]=t,f&&T>1))for(A=1;A<T;++A)c[R+A]=t;if(u&&(u[R]=i.atomRadius(_),f&&T>1))for(C=u[R]*g/(m?1:.5*T),A=m?1:0;A<T;++A)u[R+A]=C;if(h&&(h[R]=i.atomRadius(w),f&&T>1))for(C=h[R]*g/(m?1:.5*T),A=m?1:0;A<T;++A)h[R+A]=C;R+=f?T:1})),y},ld.prototype.getBackboneAtomData=function(t){return t=Object.assign({atomSet:this.atomSetCache.__backbone},t),this.getAtomData(t)},ld.prototype.getBackboneBondData=function(t){return t=Object.assign({bondSet:this.getBackboneBondSet(),bondStore:this.backboneBondStore},t),this.getBondData(t)},ld.prototype.getRungAtomData=function(t){return t=Object.assign({atomSet:this.atomSetCache.__rung},t),this.getAtomData(t)},ld.prototype.getRungBondData=function(t){return t=Object.assign({bondSet:this.getRungBondSet(),bondStore:this.rungBondStore},t),this.getBondData(t)},ld.prototype.getBoundingBox=function(t,e){gc&&mc.time("getBoundingBox"),e=e||new jt;var i=1/0,r=1/0,n=1/0,o=-1/0,a=-1/0,s=-1/0;return this.eachAtom((function(t){var e=t.x,c=t.y,u=t.z;e<i&&(i=e),c<r&&(r=c),u<n&&(n=u),e>o&&(o=e),c>a&&(a=c),u>s&&(s=u)}),t),e.min.set(i,r,n),e.max.set(o,a,s),gc&&mc.timeEnd("getBoundingBox"),e},ld.prototype.getPrincipalAxes=function(t){gc&&mc.time("getPrincipalAxes");var e=0,i=new Rl(3,this.atomCount),r=i.data;return this.eachAtom((function(t){r[e+0]=t.x,r[e+1]=t.y,r[e+2]=t.z,e+=3}),t),gc&&mc.timeEnd("getPrincipalAxes"),new Zl(i)},ld.prototype.atomCenter=function(t){return t?this.getBoundingBox(t).getCenter():this.center.clone()},ld.prototype.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},ld.prototype.getAtomIndices=function(t){var e;if(t&&t.string)e=[],this.eachAtom((function(t){e.push(t.index)}),t);else{e=this.getAtomData({what:{index:!0}}).index}return e},ld.prototype.getChainnameCount=function(t){var e=new Set;return this.eachChain((function(t){t.residueCount&&e.add(t.chainname)}),t),e.size},ld.prototype.updatePosition=function(t){var e=0;this.eachAtom((function(i){i.positionFromArray(t,e),e+=3}))},ld.prototype.refreshPosition=function(){this.getBoundingBox(void 0,this.boundingBox),this.boundingBox.getCenter(this.center),this.spatialHash=new Kl(this.atomStore,this.boundingBox)},ld.prototype.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},Object.defineProperties(ld.prototype,pd);var fd=function(t,e){var i;"function"==typeof t.eachAtom?i=t.atomCount:t instanceof Float32Array&&(i=t.length/3);var r=new Rl(3,i),n=new Rl(3,i);this.coords1t=new Rl(i,3),this.coords2t=new Rl(i,3),this.A=new Rl(3,3),this.W=new Rl(1,3),this.U=new Rl(3,3),this.V=new Rl(3,3),this.VH=new Rl(3,3),this.R=new Rl(3,3),this.tmp=new Rl(3,3),this.c=new Rl(3,3),this.c.data.set([1,0,0,0,1,0,0,0,-1]),this.prepCoords(t,r),this.prepCoords(e,n),this._superpose(r,n)};fd.prototype._superpose=function(t,e){var i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S;this.mean1=Dl(t),this.mean2=Dl(e),kl(t,this.mean1),kl(e,this.mean2),Ll(this.coords1t,t),Ll(this.coords2t,e),Ol(this.A,this.coords2t,this.coords1t),zl(this.A,this.W,this.U,this.V),i=this.V,r=this.VH,n=i.data,o=r.data,a=n[4],s=n[8],c=n[5],u=n[7],h=n[0],l=h*a,p=h*c,d=n[3],f=n[1],m=d*f,g=n[2],v=d*g,y=n[6],_=1/(l*s-p*u-m*s+v*u+(b=y*f)*c-(x=y*g)*a),o[0]=(a*s-c*u)*_,o[1]=-(f*s-g*u)*_,o[2]=-(-f*c+g*a)*_,o[3]=-(d*s-c*y)*_,o[4]=(h*s-x)*_,o[5]=-(p-v)*_,o[6]=-(-d*u+a*y)*_,o[7]=-(h*u-b)*_,o[8]=(l-m)*_,Nl(this.R,this.U,this.VH),w=this.R,(S=w.data)[0]*S[4]*S[8]-S[0]*S[5]*S[7]-S[3]*S[1]*S[8]+S[3]*S[2]*S[7]+S[6]*S[1]*S[5]-S[6]*S[2]*S[4]<0&&(gc&&mc.log("R not a right handed system"),Nl(this.tmp,this.c,this.VH),Nl(this.R,this.U,this.tmp))},fd.prototype.prepCoords=function(t,e){var i=0,r=e.data;"function"==typeof t.eachAtom?t.eachAtom((function(t){r[i+0]=t.x,r[i+1]=t.y,r[i+2]=t.z,i+=3})):t instanceof Float32Array?r.set(t):mc.warn("prepCoords: input type unknown")},fd.prototype.transform=function(t){var e;"function"==typeof t.eachAtom?e=t.atomCount:t instanceof Float32Array&&(e=t.length/3);var i=new Rl(3,e),r=new Rl(e,3);this.prepCoords(t,i),kl(i,this.mean1),Ol(r,this.R,i),Ll(i,r),function(t,e){var i,r,n=0,o=t.rows,a=t.cols,s=t.data;for(i=0;i<o;++i)for(r=0;r<a;++r,++n)s[n]+=e[r]}(i,this.mean2);var n=0,o=i.data;"function"==typeof t.eachAtom?t.eachAtom((function(t){t.x=o[n+0],t.y=o[n+1],t.z=o[n+2],n+=3})):t instanceof Float32Array?t.set(o.subarray(0,3*e)):mc.warn("transform: input type unknown")};var md=function(t,e){this.signals={startedRunning:new Fs,haltedRunning:new Fs};var i=Object.assign({},e);t.signals.playerChanged.add((function(t){t!==this&&this.pause()}),this);var r=Eo(t.numframes,1);this.traj=t,this.start=Eo(i.start,0),this.end=Math.min(Eo(i.end,r-1),r-1),this.step=Eo(i.step,Math.ceil((r+1)/100)),this.timeout=Eo(i.timeout,50),this.interpolateType=Eo(i.interpolateType,""),this.interpolateStep=Eo(i.interpolateStep,5),this.mode=Eo(i.mode,"loop"),this.direction=Eo(i.direction,"forward"),this._stopFlag=!1,this._running=!1,t.signals.gotNumframes.add((function(t){this.end=Math.min(Eo(i.end,t-1),t-1)}),this)};md.prototype._animate=function(){var t,e,i,r;(this._running=!0,this.traj.inProgress||this._stopFlag||(((t="forward"===this.direction?this.traj.currentFrame+this.step:this.traj.currentFrame-this.step)>=this.end||t<this.start)&&("once"===this.mode?(this.pause(),t="forward"===this.direction?this.end:this.start):t="forward"===this.direction?this.start:this.end),this.interpolateType||this.traj.setFrame(t)),this._stopFlag)?this._running=!1:!this.traj.inProgress&&this.interpolateType?("forward"===this.direction?(e=Math.max(this.start,t-this.step),i=Math.max(this.start,t-2*this.step),r=Math.max(this.start,t-3*this.step)):(e=Math.min(this.end,t+this.step),i=Math.min(this.end,t+2*this.step),r=Math.min(this.end,t+3*this.step)),this._interpolate(t,e,i,r,1/this.interpolateStep,0)):setTimeout(this._animate.bind(this),this.timeout)},md.prototype._interpolate=function(t,e,i,r,n,o){if((o+=n)<=1){var a=Math.round(this.timeout*n);this.traj.setFrameInterpolated(t,e,i,r,o,this.interpolateType,function(){setTimeout(function(){this._interpolate(t,e,i,r,n,o)}.bind(this),a)}.bind(this))}else setTimeout(this._animate.bind(this),0)},md.prototype.toggle=function(){this._running?this.pause():this.play()},md.prototype.play=function(){if(!this._running){this.traj.player!==this&&this.traj.setPlayer(this);var t=this.traj.currentFrame,e=Math.ceil(t/this.step)*this.step;"forward"===this.direction&&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()}},md.prototype.pause=function(){this._running&&(this._stopFlag=!0,this.signals.haltedRunning.dispatch())},md.prototype.stop=function(){this.traj.setFrame(this.start),this.pause()};var gd=function(t,e,i){this.signals={gotNumframes:new Fs,frameChanged:new Fs,selectionChanged:new Fs,playerChanged:new Fs};var r=i||{};r.centerPbc=Eo(r.centerPbc,!0),r.removePbc=Eo(r.removePbc,!0),r.superpose=Eo(r.superpose,!0),this.setParameters(r),this.name=t.replace(/^.*[\\/]/,""),this.selection=new nc(Eo(r.sele,"backbone and not hydrogen")),this.selection.signals.stringChanged.add((function(){this.makeIndices(),this.resetCache()}),this),this.setStructure(e),this.setPlayer(new md(this)),this.trajPath=t,this.numframes=void 0,this.getNumframes()};function vd(t){return"front"===t?0:"back"===t?1:2}gd.prototype.setStructure=function(t){this.structure=t,this.atomCount=t.atomCount,this.makeAtomIndices(),this.saveInitialStructure(),this.backboneIndices=this.getIndices(new nc("backbone and not hydrogen")),this.makeIndices(),this.frameCache=[],this.boxCache=[],this.pathCache=[],this.frameCacheSize=0,this.currentFrame=-1},gd.prototype.saveInitialStructure=function(){var t=0,e=new Float32Array(3*this.atomCount);this.structure.eachAtom((function(i){e[t+0]=i.x,e[t+1]=i.y,e[t+2]=i.z,t+=3})),this.initialStructure=e},gd.prototype.setSelection=function(t){return this.selection.setString(t),this},gd.prototype.getIndices=function(t){var e;if(t&&t.test){var i=0,r=t.test;e=[],this.structure.eachAtom((function(t){r(t)&&e.push(i),i+=1}))}else e=this.structure.getAtomIndices(this.selection);return e},gd.prototype.makeIndices=function(){var t,e;this.indices=this.getIndices(this.selection);var i=3*this.indices.length;this.coords1=new Float32Array(i),this.coords2=new Float32Array(i);var r=this.initialStructure,n=this.coords2;for(t=0;t<i;t+=3)e=3*this.indices[t/3],n[t+0]=r[e+0],n[t+1]=r[e+1],n[t+2]=r[e+2]},gd.prototype.makeAtomIndices=function(){mc.error("Trajectory.makeAtomIndices not implemented")},gd.prototype.getNumframes=function(){mc.error("Trajectory.loadFrame not implemented")},gd.prototype.resetCache=function(){return this.frameCache=[],this.boxCache=[],this.pathCache=[],this.frameCacheSize=0,this.setFrame(this.currentFrame),this},gd.prototype.setParameters=function(t){var e=t,i=!1;void 0!==e.centerPbc&&e.centerPbc!==this.centerPbc&&(this.centerPbc=e.centerPbc,i=!0),void 0!==e.removePbc&&e.removePbc!==this.removePbc&&(this.removePbc=e.removePbc,i=!0),void 0!==e.superpose&&e.superpose!==this.superpose&&(this.superpose=e.superpose,i=!0),i&&this.resetCache()},gd.prototype.setFrame=function(t,e){return void 0===t?this:(this.inProgress=!0,-1===(t=parseInt(t))||this.frameCache[t]?this.updateStructure(t,e):this.loadFrame(t,function(){this.updateStructure(t,e)}.bind(this)),this)},gd.prototype.interpolate=function(t,e,i,r,n,o,a){var s,c=this.frameCache,u=c[t],h=c[e],l=c[i],p=c[r],d=u.length,f=new Float32Array(d);if("spline"===o)for(s=0;s<d;s+=3)f[s+0]=Is(p[s+0],l[s+0],h[s+0],u[s+0],n,1),f[s+1]=Is(p[s+1],l[s+1],h[s+1],u[s+1],n,1),f[s+2]=Is(p[s+2],l[s+2],h[s+2],u[s+2],n,1);else for(s=0;s<d;s+=3)f[s+0]=Cs(h[s+0],u[s+0],n),f[s+1]=Cs(h[s+1],u[s+1],n),f[s+2]=Cs(h[s+2],u[s+2],n);this.structure.updatePosition(f),this.currentFrame=t,this.signals.frameChanged.dispatch(t),"function"==typeof a&&a()},gd.prototype.setFrameInterpolated=function(t,e,i,r,n,o,a){if(void 0===t)return this;var s=this.frameCache,c=[];return s[r]||c.push(r),s[i]||c.push(i),s[e]||c.push(e),s[t]||c.push(t),c.length?this.loadFrame(c,function(){this.interpolate(t,e,i,r,n,o,a)}.bind(this)):this.interpolate(t,e,i,r,n,o,a),this},gd.prototype.loadFrame=function(t,e){if(Array.isArray(t)){var i,r=function(t,r){this._loadFrame(t,r),0===i.length()&&"function"==typeof e&&e()}.bind(this);i=new dd(r,t)}else this._loadFrame(t,e)},gd.prototype._loadFrame=function(t,e){mc.error("Trajectory._loadFrame not implemented",t,e)},gd.prototype.updateStructure=function(t,e){this._disposed||(-1===t?this.structure.updatePosition(this.initialStructure):this.structure.updatePosition(this.frameCache[t]),this.structure.trajectory={name:this.trajPath,frame:t},"function"==typeof e&&e(),this.currentFrame=t,this.inProgress=!1,this.signals.frameChanged.dispatch(t))},gd.prototype.getCircularMean=function(t,e,i){return[ru(e,i[0],3,0,t),ru(e,i[1],3,1,t),ru(e,i[2],3,2,t)]},gd.prototype.doSuperpose=function(t){var e,i,r=3*this.indices.length,n=this.coords1,o=this.coords2;for(e=0;e<r;e+=3)i=3*this.indices[e/3],n[e+0]=t[i+0],n[e+1]=t[i+1],n[e+2]=t[i+2];new fd(n,o).transform(t)},gd.prototype.process=function(t,e,i,r){if(this.setNumframes(r),e){if(this.backboneIndices.length>0&&this.centerPbc){var n=[e[0],e[4],e[8]];!function(t,e,i){if(0!==i[0]&&0!==i[8]&&0!==i[4]){var r,n=t.length,o=i[0],a=i[1],s=i[2],c=-e[0]+o+o/2,u=-e[1]+a+a/2,h=-e[2]+s+s/2;for(r=0;r<n;r+=3)t[r+0]=(t[r+0]+c)%o,t[r+1]=(t[r+1]+u)%a,t[r+2]=(t[r+2]+h)%s}}(i,this.getCircularMean(this.backboneIndices,i,n),n)}this.removePbc&&function(t,e){if(0!==e[0]&&0!==e[8]&&0!==e[4]){var i,r,n,o,a=t.length;for(i=3;i<a;i+=3)for(r=0;r<3;++r)if(o=t[i+r]-t[i-3+r],Math.abs(o)>.9*e[3*r+r])if(o>0)for(n=0;n<3;++n)t[i+n]-=e[3*r+n];else for(n=0;n<3;++n)t[i+n]+=e[3*r+n]}}(i,e)}this.indices.length>0&&this.superpose&&this.doSuperpose(i),this.frameCache[t]=i,this.boxCache[t]=e,this.frameCacheSize+=1},gd.prototype.setNumframes=function(t){t!==this.numframes&&(this.numframes=t,this.signals.gotNumframes.dispatch(t))},gd.prototype.dispose=function(){this.frameCache=[],this._disposed=!0,this.player&&this.player.stop()},gd.prototype.setPlayer=function(t){this.player=t,this.signals.playerChanged.dispatch(t)},gd.prototype.getPath=function(t,e){mc.error("Trajectory.getPath not implemented",t,e)},wc.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 )\n#include unpack_color\nattribute float primitiveId;\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 = unpackColor( primitiveId );\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}"),wc.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 )\nif( opacity < 0.7 )\ndiscard;\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}");var yd={f:1,v2:2,v3:3,c:3};function bd(t,e){t.matrix.copy(e),t.matrix.decompose(t.position,t.quaternion,t.scale),t.matrixWorldNeedsUpdate=!0}var xd=function(t,e){var i=t||{},r=e||{};this.opaqueBack=Eo(r.opaqueBack,!1),this.dullInterior=Eo(r.dullInterior,!1),this.side=Eo(r.side,"double"),this.opacity=Eo(r.opacity,1),this.depthWrite=Eo(r.depthWrite,!0),this.clipNear=Eo(r.clipNear,0),this.clipRadius=Eo(r.clipRadius,0),this.clipCenter=Eo(r.clipCenter,new O),this.flatShaded=Eo(r.flatShaded,!1),this.background=Eo(r.background,!1),this.linewidth=Eo(r.linewidth,1),this.wireframe=Eo(r.wireframe,!1),this.wireframeLinewidth=Eo(r.wireframeLinewidth,1),this.roughness=Eo(r.roughness,.4),this.metalness=Eo(r.metalness,0),this.diffuse=Eo(r.diffuse,16777215),this.forceTransparent=Eo(r.forceTransparent,!1),this.disablePicking=Eo(r.disablePicking,!1),this.geometry=new _e,this.indexVersion=0,this.wireframeIndexVersion=-1,this.uniforms=Mt.merge([At.common,{fogColor:{value:null},fogNear:{value:0},fogFar:{value:0},opacity:{value:this.opacity},nearClip:{value:0},clipRadius:{value:this.clipRadius},clipCenter:{value:this.clipCenter}},{emissive:{value:new St(0)},roughness:{value:this.roughness},metalness:{value:this.metalness}},At.ambient,At.lights]),this.uniforms.diffuse.value.set(this.diffuse),this.pickingUniforms={nearClip:{value:0},objectId:{value:0},opacity:{value:this.opacity}},this.group=new Ci,this.wireframeGroup=new Ci,this.pickingGroup=new Ci,this.matrix=Eo(r.matrix,new N);var n=i.position||i.position1;this._positionDataSize=n?n.length/3:0,this.addAttributes({position:{type:"v3",value:i.position},color:{type:"c",value:i.color},primitiveId:{type:"f",value:i.primitiveId}}),i.index&&this.initIndex(i.index),this.picking=i.picking,this.makeWireframeGeometry()},_d={parameters:{},matrix:{},transparent:{},size:{},attributeSize:{},pickable:{},dynamic:{},vertexShader:{},fragmentShader:{}};_d.parameters.get=function(){return{opaqueBack:{updateShader:!0},dullInterior:{updateShader:!0},side:{updateShader:!0,property:!0},opacity:{uniform:!0},depthWrite:{property:!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},matrix:{}}},_d.matrix.set=function(t){this.setMatrix(t)},_d.matrix.get=function(){return this.group.matrix.clone()},_d.transparent.get=function(){return this.opacity<1||this.forceTransparent},_d.size.get=function(){return this._positionDataSize},_d.attributeSize.get=function(){return this.size},_d.pickable.get=function(){return!!this.picking&&!this.disablePicking},_d.dynamic.get=function(){return!0},_d.vertexShader.get=function(){},_d.fragmentShader.get=function(){},xd.prototype.setMatrix=function(t){bd(this.group,t),bd(this.wireframeGroup,t),bd(this.pickingGroup,t)},xd.prototype.initIndex=function(t){this.geometry.setIndex(new me(t,1)),this.geometry.getIndex().setDynamic(this.dynamic)},xd.prototype.makeMaterial=function(){var t=vd(this.side),e=new zt({uniforms:this.uniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:this.transparent,depthWrite:this.depthWrite,lights:!0,fog:!0,side:t,linewidth:this.linewidth});e.vertexColors=2,e.extensions.derivatives=this.flatShaded,e.extensions.fragDepth=this.isImpostor,e.clipNear=this.clipNear;var i=new zt({uniforms:this.uniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:this.transparent,depthWrite:this.depthWrite,lights:!1,fog:!0,side:t,linewidth:this.linewidth});i.vertexColors=2,i.clipNear=this.clipNear;var r=new zt({uniforms:this.pickingUniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:!1,depthWrite:this.depthWrite,lights:!1,fog:!1,side:t,linewidth:this.linewidth,blending:0});r.vertexColors=2,r.extensions.fragDepth=this.isImpostor,r.clipNear=this.clipNear,this.material=e,this.wireframeMaterial=i,this.pickingMaterial=r,this.updateShader()},xd.prototype.makeWireframeGeometry=function(){this.makeWireframeIndex();var t=this.geometry,e=this.wireframeIndex,i=new _e;i.attributes=t.attributes,e&&(i.setIndex(new me(e,1).setDynamic(this.dynamic)),i.setDrawRange(0,this.wireframeIndexCount)),this.wireframeGeometry=i},xd.prototype.makeWireframeIndex=function(){var t=[];function e(e,i){if(e>i){var r=e;e=i,i=r}var n=t[e];return void 0===n?(t[e]=[i],!0):!n.includes(i)&&(n.push(i),!0)}var i=this.geometry,r=i.index;if(this.wireframe)if(r){var n,o=r.array,a=o.length;if(i.drawRange.count!==1/0&&(a=i.drawRange.count),this.wireframeIndex&&this.wireframeIndex.length>2*a)n=this.wireframeIndex;else n=zo(2*a,i.attributes.position.count);var s=0;t.length=0;for(var c=0;c<a;c+=3){var u=o[c+0],h=o[c+1],l=o[c+2];e(u,h)&&(n[s+0]=u,n[s+1]=h,s+=2),e(h,l)&&(n[s+0]=h,n[s+1]=l,s+=2),e(l,u)&&(n[s+0]=l,n[s+1]=u,s+=2)}this.wireframeIndex=n,this.wireframeIndexCount=s,this.wireframeIndexVersion=this.indexVersion}else{var p,d=i.attributes.position.count;p=this.wireframeIndex&&this.wireframeIndex.length>2*d?this.wireframeIndex:zo(2*d,d);for(var f=0,m=0;f<d;f+=3)p[m+0]=f,p[m+1]=f+1,p[m+2]=f+1,p[m+3]=f+2,p[m+4]=f+2,p[m+5]=f,m+=6;this.wireframeIndex=p,this.wireframeIndexCount=2*d,this.wireframeIndexVersion=this.indexVersion}else this.wireframeIndex=new Uint16Array(0),this.wireframeIndexCount=0},xd.prototype.updateWireframeIndex=function(){if(this.wireframeGeometry.setDrawRange(0,1/0),this.wireframeIndexVersion<this.indexVersion&&this.makeWireframeIndex(),this.wireframeIndex.length>this.wireframeGeometry.index.array.length)this.wireframeGeometry.setIndex(new me(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)},xd.prototype.getRenderOrder=function(){var t=0;return this.isText?t=1:this.transparent&&(t=this.isSurface?3:2),t},xd.prototype._getMesh=function(t){this.material||this.makeMaterial();var e,i=this.geometry,r=this[t];return this.isLine?e=new Mi(i,r):this.isPoint?(e=new Ei(i,r),this.sortParticles&&(e.sortParticles=!0)):e=new Ie(i,r),e.frustumCulled=!1,e.renderOrder=this.getRenderOrder(),e},xd.prototype.getMesh=function(){return this._getMesh("material")},xd.prototype.getWireframeMesh=function(){var t;return this.material||this.makeMaterial(),this.wireframeGeometry||this.makeWireframeGeometry(),(t=new Mi(this.wireframeGeometry,this.wireframeMaterial)).frustumCulled=!1,t.renderOrder=this.getRenderOrder(),t},xd.prototype.getPickingMesh=function(){return this._getMesh("pickingMaterial")},xd.prototype.getShader=function(t,e){return qc(t,this.getDefines(e))},xd.prototype.getVertexShader=function(t){return this.getShader(this.vertexShader,t)},xd.prototype.getFragmentShader=function(t){return this.getShader(this.fragmentShader,t)},xd.prototype.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},xd.prototype.getParameters=function(){var t={};for(var e in this.parameters)t[e]=this[e];return t},xd.prototype.addUniforms=function(t){this.uniforms=Mt.merge([this.uniforms,t]),this.pickingUniforms=Mt.merge([this.pickingUniforms,t])},xd.prototype.addAttributes=function(t){for(var e in t){var i=void 0,r=t[e],n=this.attributeSize*yd[r.type];r.value?(n!==r.value.length&&mc.error("attribute value has wrong length",e),i=r.value):i=Bo("float32",n),this.geometry.addAttribute(e,new me(i,yd[r.type]).setDynamic(this.dynamic))}},xd.prototype.updateRenderOrder=function(){var t=this.getRenderOrder();function e(e){e.renderOrder=t}this.group.children.forEach(e),this.pickingGroup&&this.pickingGroup.children.forEach(e)},xd.prototype.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},xd.prototype.setParameters=function(t){if(t){var e=t,i=this.parameters,r={},n={},o=!1,a=!1;for(var s in e){var c=e[s];void 0!==c&&(void 0!==i[s]&&(this[s]=c,i[s].property&&(!0!==i[s].property?r[i[s].property]=c:r[s]=c),i[s].uniform&&(!0!==i[s].uniform?n[i[s].uniform]=c:n[s]=c),i[s].updateShader&&(o=!0),i[s].updateVisibility&&(a=!0),this.dynamic&&"wireframe"===s&&!0===c&&this.updateWireframeIndex(),"flatShaded"===s&&(this.material.extensions.derivatives=this.flatShaded),"forceTransparent"===s&&(r.transparent=this.transparent)))}this.setProperties(r),this.setUniforms(n),o&&this.updateShader(),a&&this.setVisibility(this.visible)}},xd.prototype.setAttributes=function(t){var e=this.geometry,i=e.attributes;for(var r in t)if("picking"!==r){var n=t[r],o=n.length;if("index"===r){var a=e.getIndex();e.setDrawRange(0,1/0),o>a.array.length?e.setIndex(new me(n,1).setDynamic(this.dynamic)):(a.set(n),a.needsUpdate=o>0,a.updateRange.count=o,e.setDrawRange(0,o)),this.indexVersion++,this.wireframe&&this.updateWireframeIndex()}else{var s=i[r];o>s.array.length?e.addAttribute(r,new me(n,s.itemSize).setDynamic(this.dynamic)):(i[r].set(n),i[r].needsUpdate=o>0,i[r].updateRange.count=o)}}},xd.prototype.setUniforms=function(t){if(t){var e=this.material.uniforms,i=this.wireframeMaterial.uniforms,r=this.pickingMaterial.uniforms;for(var n in t)"opacity"===n&&this.setProperties({transparent:this.transparent}),void 0!==e[n]&&(e[n].value.isVector3?e[n].value.copy(t[n]):e[n].value.set?e[n].value.set(t[n]):e[n].value=t[n]),void 0!==i[n]&&(i[n].value.isVector3?i[n].value.copy(t[n]):i[n].value.set?i[n].value.set(t[n]):i[n].value=t[n]),void 0!==r[n]&&(r[n].value.isVector3?r[n].value.copy(t[n]):r[n].value.set?r[n].value.set(t[n]):r[n].value=t[n])}},xd.prototype.setProperties=function(t){if(t){var e=this.material,i=this.wireframeMaterial,r=this.pickingMaterial;for(var n in t){var o=t[n];"transparent"===n?this.updateRenderOrder():"side"===n&&(o=vd(o)),void 0!==e[n]&&(e[n]=o),void 0!==i[n]&&(i[n]=o),void 0!==r[n]&&(r[n]=o)}e.needsUpdate=!0,i.needsUpdate=!0,r.needsUpdate=!0}},xd.prototype.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))},xd.prototype.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()},Object.defineProperties(xd.prototype,_d);var wd=function(t){function e(e,i){var r=e||{};!r.primitiveId&&r.position&&(r.primitiveId=su(r.position.length/3)),t.call(this,r,i),this.addAttributes({normal:{type:"v3",value:r.normal}}),void 0===r.normal&&this.geometry.computeVertexNormals()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={vertexShader:{},fragmentShader:{}};return i.vertexShader.get=function(){return"Mesh.vert"},i.fragmentShader.get=function(){return"Mesh.frag"},Object.defineProperties(e.prototype,i),e}(xd),Sd=new N,Ad=new Vt,Md=function(t){function e(e,i,r){var n,o=e||{},a=i||{},s=r.attributes.position.array,c=r.attributes.normal.array,u=r.index?r.index.array:void 0,h=o.position.length/3,l=s.length/3,p=h*l,d=new Float32Array(3*p),f=new Float32Array(3*p),m=new Float32Array(3*p);u&&(n=zo(h*u.length,p)),t.call(this,{position:d,color:m,index:n,normal:f,primitiveId:o.primitiveId||cu(h,l),picking:o.picking},a),this.setAttributes(o),this.geoPosition=s,this.geoNormal=c,this.geoIndex=u,this.positionCount=h,this.geoPositionCount=l,this.transformedGeoPosition=new Float32Array(3*l),this.transformedGeoNormal=new Float32Array(3*l),this.meshPosition=d,this.meshColor=m,this.meshIndex=n,this.meshNormal=f,this.meshIndex=n,this.makeIndex()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={updateNormals:{}};return e.prototype.applyPositionTransform=function(){},e.prototype.setAttributes=function(t,e){var i,r,n,o,a,s,c,u,h,l=this.geometry.attributes,p=this.updateNormals;t.position&&(i=t.position,n=this.geoPosition,c=this.meshPosition,a=this.transformedGeoPosition,l.position.needsUpdate=!0,(p||e)&&(o=this.geoNormal,h=this.meshNormal,s=this.transformedGeoNormal,l.normal.needsUpdate=!0)),t.color&&(r=t.color,u=this.meshColor,l.color.needsUpdate=!0);for(var d=this.positionCount,f=this.geoPositionCount,m=0;m<d;++m){var g=void 0,v=void 0,y=m*f*3,b=3*m;if(i&&(a.set(n),Sd.makeTranslation(i[b],i[b+1],i[b+2]),this.applyPositionTransform(Sd,m,b),Ah(Sd.elements,a),c.set(a,y),p?(s.set(o),Ad.getNormalMatrix(Sd),Mh(Ad.elements,s),h.set(s,y)):e&&h.set(o,y)),r)for(g=0;g<f;++g)u[v=y+3*g]=r[b],u[v+1]=r[b+1],u[v+2]=r[b+2]}},e.prototype.makeIndex=function(){var t=this.geoIndex,e=this.meshIndex;if(t)for(var i=this.positionCount,r=this.geoPositionCount,n=3*(t.length/3),o=0;o<i;++o){var a=o*n,s=a+n;e.set(t,a);for(var c=a;c<s;++c)e[c]+=o*r}},i.updateNormals.get=function(){return!1},Object.defineProperties(e.prototype,i),e}(wd),Pd=new O,Td=function(t){function e(e,i){var r=i||{},n=new Gi(1,Eo(r.sphereDetail,1));t.call(this,e,r,n),this.setAttributes(e,!0)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.applyPositionTransform=function(t,e){var i=this._radius[e];Pd.set(i,i,i),t.scale(Pd)},e.prototype.setAttributes=function(e,i){e.radius&&(this._radius=e.radius),t.prototype.setAttributes.call(this,e,i)},e}(Md);wc.add("shader/SphereImpostor.vert","uniform mat4 projectionMatrixInverse;\nuniform float nearClip;\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\nattribute vec2 mapping;\nattribute float radius;\n#ifdef PICKING\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#endif\n#include matrix_scale\nconst mat4 D = mat4(\n1.0, 0.0, 0.0, 0.0,\n0.0, 1.0, 0.0, 0.0,\n0.0, 0.0, 1.0, 0.0,\n0.0, 0.0, 0.0, -1.0\n);\nmat4 transpose( in mat4 inMatrix ) {\nvec4 i0 = inMatrix[0];\nvec4 i1 = inMatrix[1];\nvec4 i2 = inMatrix[2];\nvec4 i3 = inMatrix[3];\nmat4 outMatrix = mat4(\nvec4(i0.x, i1.x, i2.x, i3.x),\nvec4(i0.y, i1.y, i2.y, i3.y),\nvec4(i0.z, i1.z, i2.z, i3.z),\nvec4(i0.w, i1.w, i2.w, i3.w)\n);\nreturn outMatrix;\n}\nvoid ComputePointSizeAndPositionInClipCoordSphere(){\nvec2 xbc;\nvec2 ybc;\nmat4 T = mat4(\nradius, 0.0, 0.0, 0.0,\n0.0, radius, 0.0, 0.0,\n0.0, 0.0, radius, 0.0,\nposition.x, position.y, position.z, 1.0\n);\nmat4 R = transpose( projectionMatrix * modelViewMatrix * T );\nfloat A = dot( R[ 3 ], D * R[ 3 ] );\nfloat B = -2.0 * dot( R[ 0 ], D * R[ 3 ] );\nfloat C = dot( R[ 0 ], D * R[ 0 ] );\nxbc[ 0 ] = ( -B - sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nxbc[ 1 ] = ( -B + sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nfloat sx = abs( xbc[ 0 ] - xbc[ 1 ] ) * 0.5;\nA = dot( R[ 3 ], D * R[ 3 ] );\nB = -2.0 * dot( R[ 1 ], D * R[ 3 ] );\nC = dot( R[ 1 ], D * R[ 1 ] );\nybc[ 0 ] = ( -B - sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nybc[ 1 ] = ( -B + sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nfloat sy = abs( ybc[ 0 ] - ybc[ 1 ] ) * 0.5;\ngl_Position.xy = vec2( 0.5 * ( xbc.x + xbc.y ), 0.5 * ( ybc.x + ybc.y ) );\ngl_Position.xy -= mapping * vec2( sx, sy );\ngl_Position.xy *= gl_Position.w;\n}\nvoid main(void){\n#ifdef PICKING\nvPickingColor = unpackColor( primitiveId );\n#else\n#include color_vertex\n#endif\nvRadius = radius * matrixScale( modelViewMatrix );\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nmvPosition.z -= vRadius;\ngl_Position = projectionMatrix * vec4( mvPosition.xyz, 1.0 );\nComputePointSizeAndPositionInClipCoordSphere();\nvRadiusSq = vRadius * vRadius;\nvec4 vPoint4 = projectionMatrixInverse * gl_Position;\nvPoint = vPoint4.xyz / vPoint4.w;\nvPointViewPosition = -mvPosition.xyz / mvPosition.w;\n}"),wc.add("shader/SphereImpostor.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 mat4 projectionMatrix;\nuniform float ortho;\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n#ifdef PICKING\nuniform float objectId;\nvarying vec3 vPickingColor;\n#else\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\nbool flag2 = false;\nbool interior = false;\nvec3 cameraPos;\nvec3 cameraNormal;\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}\nfloat calcClip( vec3 cameraPos ){\nreturn dot( vec4( cameraPos, 1.0 ), vec4( 0.0, 0.0, 1.0, nearClip - 0.5 ) );\n}\nbool Impostor( out vec3 cameraPos, out vec3 cameraNormal ){\nvec3 cameraSpherePos = -vPointViewPosition;\ncameraSpherePos.z += vRadius;\nvec3 rayOrigin = mix( vec3( 0.0, 0.0, 0.0 ), vPoint, ortho );\nvec3 rayDirection = mix( normalize( vPoint ), vec3( 0.0, 0.0, 1.0 ), ortho );\nvec3 cameraSphereDir = mix( cameraSpherePos, rayOrigin - cameraSpherePos, ortho );\nfloat B = dot( rayDirection, cameraSphereDir );\nfloat det = B * B + vRadiusSq - dot( cameraSphereDir, cameraSphereDir );\nif( det < 0.0 ){\ndiscard;\nreturn false;\n}else{\nfloat sqrtDet = sqrt( det );\nfloat posT = mix( B + sqrtDet, B + sqrtDet, ortho );\nfloat negT = mix( B - sqrtDet, sqrtDet - B, ortho );\ncameraPos = rayDirection * negT + rayOrigin;\n#ifdef NEAR_CLIP\nif( calcDepth( cameraPos ) <= 0.0 ){\ncameraPos = rayDirection * posT + rayOrigin;\ninterior = true;\nreturn false;\n}else if( calcClip( cameraPos ) > 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}");var Ed=function(t){function e(e,i){t.call(this,e,i),this.index=zo(this.indexSize,this.attributeSize),this.makeIndex(),this.initIndex(this.index,1),this.addAttributes({mapping:{type:this.mappingType,value:null}}),this.setAttributes({primitiveId:su(this.size)})}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={attributeSize:{},indexSize:{},mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return i.attributeSize.get=function(){return this.size*this.mappingSize},i.indexSize.get=function(){return this.size*this.mappingIndicesSize},i.mapping.get=function(){},i.mappingIndices.get=function(){},i.mappingIndicesSize.get=function(){},i.mappingType.get=function(){},i.mappingSize.get=function(){},i.mappingItemSize.get=function(){},e.prototype.addAttributes=function(e){var i={};for(var r in e){var n=e[r];i[r]={type:n.type,value:null}}t.prototype.addAttributes.call(this,i)},e.prototype.getAttributeIndex=function(t){return 3*t*this.mappingSize},e.prototype.setAttributes=function(t){t&&!t.position&&t.position1&&t.position2&&(t.position=nu(t.position1,t.position2));var e,i,r,n,o,a,s,c=this.size,u=this.mappingSize,h=this.geometry.attributes;for(var l in t)if("index"!==l&&"picking"!==l){i=t[l],r=(e=h[l]).itemSize,n=e.array;for(var p=0;p<c;++p){a=(o=p*r)*u;for(var d=0;d<u;++d){s=a+r*d;for(var f=0;f<r;++f)n[s+f]=i[o+f]}}e.needsUpdate=!0}},e.prototype.makeMapping=function(){for(var t=this.size,e=this.mapping,i=this.mappingSize,r=this.mappingItemSize,n=this.geometry.attributes.mapping.array,o=0;o<t;o++)n.set(e,o*r*i)},e.prototype.makeIndex=function(){for(var t,e,i=this.size,r=this.mappingSize,n=this.mappingIndices,o=this.mappingIndicesSize,a=this.index,s=0;s<i;s++){t=s*o,e=s*r,a.set(n,t);for(var c=0;c<o;++c)a[t+c]+=e}},Object.defineProperties(e.prototype,i),e}(xd),Cd=new Float32Array([-1,1,-1,-1,1,1,1,-1]),Id=new Uint16Array([0,1,2,1,3,2]),Rd=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return i.mapping.get=function(){return Cd},i.mappingIndices.get=function(){return Id},i.mappingIndicesSize.get=function(){return 6},i.mappingType.get=function(){return"v2"},i.mappingSize.get=function(){return 4},i.mappingItemSize.get=function(){return 2},Object.defineProperties(e.prototype,i),e}(Ed),Ld=function(t){function e(e,i){t.call(this,e,i),this.addUniforms({projectionMatrixInverse:{value:new N},ortho:{value:0}}),this.addAttributes({radius:{type:"f",value:null}}),this.setAttributes(e),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isImpostor:{},vertexShader:{},fragmentShader:{}};return i.isImpostor.get=function(){return!0},i.vertexShader.get=function(){return"SphereImpostor.vert"},i.fragmentShader.get=function(){return"SphereImpostor.frag"},Object.defineProperties(e.prototype,i),e}(Rd),Od=function(t,e){return!dc||e&&e.disableImpostor?new Td(t,e):new Ld(t,e)},Nd=new O,Dd=new O,kd=new O,Fd=new O(0,0,0),Bd=function(t){function e(e,i){var r=i||{},n=new Gi(1,Eo(r.sphereDetail,2));t.call(this,e,r,n),this.setAttributes(e,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,i){Dd.fromArray(this._majorAxis,i),kd.fromArray(this._minorAxis,i),t.lookAt(Fd,Dd,kd),Nd.set(this._radius[e],kd.length(),Dd.length()),t.scale(Nd)},e.prototype.setAttributes=function(e,i){e.radius&&(this._radius=e.radius),e.majorAxis&&(this._majorAxis=e.majorAxis),e.minorAxis&&(this._minorAxis=e.minorAxis),t.prototype.setAttributes.call(this,e,i)},i.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,i),e}(Md),zd=function(t,e){return new Bd(t,e)},Ud=new O,jd=new O,Gd=new O,Vd=new O(0,1,0),$d=function(t){function e(e,i){var r=e||{},n=i||{},o=Eo(n.radialSegments,10),a=Eo(n.openEnded,!0),s=(new N).makeRotationX(Math.PI/2),c=new pr(1,1,1,o,1,a);c.applyMatrix(s);var u=r.position1.length,h=r.radius.length,l=c.attributes.position.array.length/3,p=u/3,d=new Float32Array(2*p*l);cu(p,l,0,d),cu(p,l,p*l,d);var f=new Float32Array(2*u),m=new Float32Array(2*u);t.call(this,{position:f,color:m,primitiveId:d,picking:r.picking},n,c),this.__center=new Float32Array(u),this._position=f,this._color=m,this._from=new Float32Array(2*u),this._to=new Float32Array(2*u),this._radius=new Float32Array(2*h),this.setAttributes(r,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,i){jd.fromArray(this._from,i),Gd.fromArray(this._to,i),t.lookAt(jd,Gd,Vd);var r=this._radius[e];Ud.set(r,r,jd.distanceTo(Gd)),t.scale(Ud)},e.prototype.setAttributes=function(e,i){var r={};e.position1&&e.position2&&(nu(e.position1,e.position2,this.__center),nu(e.position1,this.__center,this._position),nu(this.__center,e.position2,this._position,e.position1.length),this._from.set(e.position1),this._from.set(this.__center,e.position1.length),this._to.set(this.__center),this._to.set(e.position2,this.__center.length),r.position=this._position),e.color&&e.color2&&(this._color.set(e.color),this._color.set(e.color2,e.color.length),r.color=this._color),e.radius&&(this._radius.set(e.radius),this._radius.set(e.radius,e.radius.length),r.radius=this._radius),t.prototype.setAttributes.call(this,r,i)},i.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,i),e}(Md);wc.add("shader/CylinderImpostor.vert","\nattribute vec3 mapping;\nattribute vec3 position1;\nattribute vec3 position2;\nattribute float radius;\nvarying vec3 axis;\nvarying vec4 base_radius;\nvarying vec4 end_b;\nvarying vec3 U;\nvarying vec3 V;\nvarying vec4 w;\n#ifdef PICKING\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\nattribute vec3 color2;\nvarying vec3 vColor1;\nvarying vec3 vColor2;\n#endif\nuniform mat4 modelViewMatrixInverse;\nuniform float ortho;\n#include matrix_scale\nvoid main(){\n#ifdef PICKING\nvPickingColor = unpackColor( primitiveId );\n#else\nvColor1 = color;\nvColor2 = color2;\n#endif\nbase_radius.w = radius * matrixScale( modelViewMatrix );\nvec3 center = position;\nvec3 dir = normalize( position2 - position1 );\nfloat ext = length( position2 - position1 ) / 2.0;\nvec3 cam_dir;\nif( ortho == 0.0 ){\ncam_dir = ( modelViewMatrixInverse * vec4( 0, 0, 0, 1 ) ).xyz - center;\n}else{\ncam_dir = ( modelViewMatrixInverse * vec4( 0, 0, 1, 0 ) ).xyz;\n}\ncam_dir = normalize( cam_dir );\nvec3 ldir;\nfloat b = dot( cam_dir, dir );\nend_b.w = b;\nif( b < 0.0 )\nldir = -ext * dir;\nelse\nldir = ext * dir;\nvec3 left = normalize( cross( cam_dir, ldir ) );\nleft = radius * left;\nvec3 up = radius * normalize( cross( left, ldir ) );\naxis = normalize( normalMatrix * ldir );\nU = normalize( normalMatrix * up );\nV = normalize( normalMatrix * left );\nvec4 base4 = modelViewMatrix * vec4( center - ldir, 1.0 );\nbase_radius.xyz = base4.xyz / base4.w;\nvec4 top_position = modelViewMatrix * vec4( center + ldir, 1.0 );\nvec4 end4 = top_position;\nend_b.xyz = end4.xyz / end4.w;\nw = modelViewMatrix * vec4(\ncenter + mapping.x*ldir + mapping.y*left + mapping.z*up, 1.0\n);\ngl_Position = projectionMatrix * w;\ngl_Position.z = 0.99;\n}"),wc.add("shader/CylinderImpostor.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 mat4 projectionMatrix;\nuniform float ortho;\nvarying vec3 axis;\nvarying vec4 base_radius;\nvarying vec4 end_b;\nvarying vec3 U;\nvarying vec3 V;\nvarying vec4 w;\n#ifdef PICKING\nuniform float objectId;\nvarying vec3 vPickingColor;\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 distSq3( vec3 v3a, vec3 v3b ){\nreturn (\n( v3a.x - v3b.x ) * ( v3a.x - v3b.x ) +\n( v3a.y - v3b.y ) * ( v3a.y - v3b.y ) +\n( v3a.z - v3b.z ) * ( v3a.z - v3b.z )\n);\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}\nfloat calcClip( vec3 cameraPos ){\nreturn dot( vec4( cameraPos, 1.0 ), vec4( 0.0, 0.0, 1.0, nearClip - 0.5 ) );\n}\nvoid main(){\nvec3 point = w.xyz / w.w;\nvec3 base = base_radius.xyz;\nfloat vRadius = base_radius.w;\nvec3 end = end_b.xyz;\nfloat b = end_b.w;\nvec3 end_cyl = end;\nvec3 surface_point = point;\nvec3 ray_target = surface_point;\nvec3 ray_origin = vec3(0.0);\nvec3 ray_direction = mix(normalize(ray_origin - ray_target), vec3(0.0, 0.0, 1.0), ortho);\nmat3 basis = mat3( U, V, axis );\nvec3 diff = ray_target - 0.5 * (base + end_cyl);\nvec3 P = diff * basis;\nfloat dz = dot( axis, ray_direction );\nfloat radius2 = vRadius*vRadius;\nvec3 D = vec3(dot(U, ray_direction),\ndot(V, ray_direction),\ndz);\nfloat a0 = P.x*P.x + P.y*P.y - radius2;\nfloat a1 = P.x*D.x + P.y*D.y;\nfloat a2 = D.x*D.x + D.y*D.y;\nfloat d = a1*a1 - a0*a2;\nif (d < 0.0)\ndiscard;\nfloat dist = (-a1 + sqrt(d)) / a2;\nvec3 new_point = ray_target + dist * ray_direction;\nvec3 tmp_point = new_point - base;\nvec3 _normal = normalize( tmp_point - axis * dot(tmp_point, axis) );\nray_origin = mix( ray_origin, surface_point, ortho );\nfloat front_cap_test = dot( tmp_point, axis );\nfloat end_cap_test = dot((new_point - end_cyl), axis);\n#ifndef CAP\nvec3 new_point2 = ray_target + ( (-a1 - sqrt(d)) / a2 ) * ray_direction;\nvec3 tmp_point2 = new_point2 - base;\n#endif\nif (front_cap_test < 0.0)\n{\nfloat dNV = dot(-axis, ray_direction);\nif (dNV < 0.0)\ndiscard;\nfloat near = dot(-axis, (base)) / dNV;\nvec3 front_point = ray_direction * near + ray_origin;\nif (dot(front_point - base, front_point-base) > 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\ngl_FragColor = vec4( vPickingColor, objectId );\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}");var Hd=new Float32Array([-1,1,-1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,1]),Wd=new Uint16Array([0,1,2,1,4,2,2,4,3,4,5,3]),Xd=function(t){function e(e,i){t.call(this,e,i);var r=i||{};this.openEnded=Eo(r.openEnded,!1),this.addUniforms({modelViewMatrixInverse:{value:new N},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(e),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={parameters:{},isImpostor:{},vertexShader:{},fragmentShader:{}};return i.parameters.get=function(){return Object.assign.call(this,{openEnded:{updateShader:!0}},t.prototype.parameters)},e.prototype.getDefines=function(e){var i=t.prototype.getDefines.call(this,e);return this.openEnded||(i.CAP=1),i},i.isImpostor.get=function(){return!0},i.vertexShader.get=function(){return"CylinderImpostor.vert"},i.fragmentShader.get=function(){return"CylinderImpostor.frag"},Object.defineProperties(e.prototype,i),e}(function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return i.mapping.get=function(){return Hd},i.mappingIndices.get=function(){return Wd},i.mappingIndicesSize.get=function(){return 12},i.mappingType.get=function(){return"v3"},i.mappingSize.get=function(){return 6},i.mappingItemSize.get=function(){return 3},Object.defineProperties(e.prototype,i),e}(Ed)),qd=function(t,e){return!dc||e&&e.disableImpostor?new $d(t,e):new Xd(t,e)},Yd=new O,Zd=new O,Kd=new O,Qd=new O(0,1,0),Jd=function(t){function e(e,i){var r=i||{},n=Eo(r.radialSegments,60),o=Eo(r.openEnded,!1),a=(new N).makeRotationX(-Math.PI/2),s=new fr(1,1,n,1,o);s.applyMatrix(a);var c=e.position1.length,u=e.radius.length,h=new Float32Array(c);t.call(this,{position:h,color:e.color,picking:e.picking},r,s),this._position=h,this._from=new Float32Array(c),this._to=new Float32Array(c),this._radius=new Float32Array(u),this.setAttributes(e,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,i){Zd.fromArray(this._from,i),Kd.fromArray(this._to,i),t.lookAt(Zd,Kd,Qd);var r=this._radius[e];Yd.set(r,r,Zd.distanceTo(Kd)),t.scale(Yd)},e.prototype.setAttributes=function(e,i){var r={};e.position1&&e.position2&&(nu(e.position1,e.position2,this._position),this._from.set(e.position1),this._to.set(e.position2),r.position=this._position),e.color&&(r.color=e.color),e.radius&&this._radius.set(e.radius),t.prototype.setAttributes.call(this,r,i)},i.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,i),e}(Md),tf=function(t,e){return new Jd(t,e)},ef=function(t){this.geometryList=t,this.boundingBox=null};ef.prototype.computeBoundingBox=function(){var t=this;this.boundingBox?this.boundingBox.empty():this.boundingBox=new jt,this.geometryList.forEach((function(e){e.boundingBox||e.computeBoundingBox(),t.boundingBox.union(e.boundingBox)}))};var rf=function(t,e){var i=t||{},r=e||{};this.aspectRatio=Eo(r.aspectRatio,1.5),this.wireframe=Eo(r.wireframe,!1),this.splitPosition=new Float32Array(i.position1.length),this.cylinderRadius=new Float32Array(i.radius.length);var n=this.makeAttributes(i),o={radialSegments:Eo(r.radialSegments,50),openEnded:Eo(r.openEnded,!1),disableImpostor:Eo(r.disableImpostor,!1)};this.cylinderBuffer=new qd(n.cylinder,o),this.coneBuffer=new tf(n.cone,o),this.geometry=new ef([this.cylinderBuffer.geometry,this.coneBuffer.geometry]),this.group=new Ci,this.wireframeGroup=new Ci,this.pickingGroup=new Ci,this.matrix=Eo(r.matrix,new N),this.picking=i.picking},nf={matrix:{},pickable:{}};nf.matrix.set=function(t){xd.prototype.setMatrix.call(this,t)},nf.matrix.get=function(){return this.group.matrix.clone()},nf.pickable.get=function(){return!!this.picking},rf.prototype.makeAttributes=function(t){var e,i,r=this.splitPosition,n=this.cylinderRadius,o=this.aspectRatio,a={},s={};if(t.radius){for(e=0,i=n.length;e<i;++e)n[e]=t.radius[e]/o;a.radius=n,s.radius=t.radius}if(t.position1&&t.position2){var c=new O,u=new O,h=new O,l=new O;for(e=0,i=r.length;e<i;e+=3){c.fromArray(t.position1,e),u.fromArray(t.position2,e),h.subVectors(c,u);var p=h.length(),d=n[e/3]*o*2,f=Math.min(p,d);h.setLength(f),l.copy(u).add(h),l.toArray(r,e)}a.position1=t.position1,a.position2=r,s.position1=r,s.position2=t.position2}return t.color&&(a.color=t.color,a.color2=t.color,s.color=t.color),{cylinder:a,cone:s}},rf.prototype.getMesh=function(t){return(new Ci).add(this.cylinderBuffer.getMesh(t),this.coneBuffer.getMesh(t))},rf.prototype.getWireframeMesh=function(){return(new Ci).add(this.cylinderBuffer.getWireframeMesh(),this.coneBuffer.getWireframeMesh())},rf.prototype.getPickingMesh=function(){return(new Ci).add(this.cylinderBuffer.getPickingMesh(),this.coneBuffer.getPickingMesh())},rf.prototype.setAttributes=function(t){var e=this.makeAttributes(t);this.cylinderBuffer.setAttributes(e.cylinder),this.coneBuffer.setAttributes(e.cone)},rf.prototype.setParameters=function(t){(t=Object.assign({},t))&&void 0!==t.matrix&&(this.matrix=t.matrix),delete t.matrix,t&&void 0!==t.wireframe&&(this.wireframe=t.wireframe,this.setVisibility(this.visible)),this.cylinderBuffer.setParameters(t),this.coneBuffer.setParameters(t)},rf.prototype.setVisibility=function(){xd.prototype.setVisibility.apply(this,arguments)},rf.prototype.dispose=function(){this.cylinderBuffer.dispose(),this.coneBuffer.dispose()},Object.defineProperties(rf.prototype,nf),wc.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;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvarying vec3 vViewPosition;\n#endif\nvarying vec2 texCoord;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#endif\nattribute vec2 mapping;\nattribute vec2 inputTexCoord;\nattribute float inputSize;\n#include matrix_scale\n#include common\nvoid main(void){\n#if defined( PICKING )\nvPickingColor = unpackColor( primitiveId );\n#else\n#include color_vertex\n#endif\ntexCoord = inputTexCoord;\nfloat scale = matrixScale( modelViewMatrix );\nfloat _zOffset = zOffset * scale;\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 * scale;\ncameraCornerPos.x += xOffset * scale;\ncameraCornerPos.y += yOffset * scale;\nif( !ortho ){\ncameraCornerPos.xyz += normalize( -cameraCornerPos.xyz ) * _zOffset;\n}\ngl_Position = projectionMatrix * cameraCornerPos;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvViewPosition = -cameraCornerPos.xyz;\n#endif\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n#include radiusclip_vertex\n}"),wc.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#if defined( PICKING )\nuniform float objectId;\nvarying vec3 vPickingColor;\nconst vec3 vColor = vec3( 0.0 );\n#else\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#endif\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#if defined( PICKING )\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}");var of={};var af=function(t){var e=Object.assign({},t);if(this.font=Eo(e.font,["sans-serif"]),this.size=Eo(e.size,36),this.style=Eo(e.style,"normal"),this.variant=Eo(e.variant,"normal"),this.weight=Eo(e.weight,"normal"),this.outline=Eo(e.outline,0),this.width=Eo(e.width,2048),this.height=Eo(e.height,2048),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 Ri(this.canvas2),this.texture.flipY=!1,this.texture.needsUpdate=!0};af.prototype.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 r=i.getContext("2d");r.font=this.style+" "+this.variant+" "+this.weight+" "+this.size+"px "+this.font,r.fillStyle="#FF0000",r.textAlign="left",r.textBaseline="bottom",r.lineJoin="round";for(var n=[],o=3*this.outline,a=0;a<o;++a){var s=("00"+Math.max(0,8*-a+128-8*!a).toString(16)).slice(-2);n.push("#"+s+s+s)}var c=new Uint8Array(e*t*2);this.canvas=i,this.context=r,this.lineHeight=t,this.maxWidth=e,this.colors=n,this.scratch=c,this.data=new Uint8Array(this.width*this.height*4),this.canvas2=document.createElement("canvas"),this.canvas2.width=this.width,this.canvas2.height=this.height,this.context2=this.canvas2.getContext("2d")},af.prototype.map=function(t){return void 0===this.mapped[t]&&(this.draw(t),this.currentX+this.scratchW>this.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]},af.prototype.get=function(t){return this.mapped[t]||this.placeholder},af.prototype.draw=function(t){var e,i,r,n,o,a=this.lineHeight,s=this.outline,c=this.context,u=this.scratch,h=this.maxWidth,l=this.colors,p=s,d=a-this.outline,f=c.measureText(t),m=Math.min(h,Math.ceil(f.width+2*p+1));if(c.clearRect(0,0,m,a),0===this.outline)for(c.fillText(t,p,d),r=3,e=0,i=(o=(n=c.getImageData(0,0,m,a)).data).length/4;e<i;++e)u[e]=o[r],r+=4;else{for(c.globalCompositeOperation="source-over",e=s+1;e>0;--e)r=e>1?2*e-2:e,c.strokeStyle=l[r-1],c.lineWidth=r,c.strokeText(t,p,d);c.globalCompositeOperation="multiply",c.fillStyle="#FF00FF",c.fillText(t,p,d),o=(n=c.getImageData(0,0,m,a)).data,r=0;var g=this.gamma;for(e=0,i=o.length/4;e<i;++e){var v=o[r],y=v?o[r+1]/v:1;.5===g&&(y=Math.sqrt(y));var b=256-v,x=b+(v-b)*(y=Math.min(1,Math.max(0,y)));u[e]=Math.max(0,Math.min(255,x+2)),o[r+3]=u[e],r+=4}}c.putImageData(n,0,0),this.scratchW=m,this.scratchH=a},af.prototype.populate=function(){this.placeholder=this.map(String.fromCharCode(65533));for(var t=0;t<127;++t)this.map(String.fromCharCode(t));for(var e=128;e<255;++e)this.map(String.fromCharCode(e));for(var i=880;i<1023;++i)this.map(String.fromCharCode(i));for(var r=1024;r<1279;++r)this.map(String.fromCharCode(r));this.map(String.fromCharCode(8491))};var sf=function(t){function e(e,i){var r=e||{},n=i||{};n.forceTransparent=!0;for(var o=r.position.length/3,a=0,s=0;s<o;++s)a+=r.text[s].length;var c=a;n.showBackground&&(c+=o),t.call(this,{position:new Float32Array(3*c),color:new Float32Array(3*c),picking:new Qh},n),this.fontFamily=Eo(n.fontFamily,"sans-serif"),this.fontStyle=Eo(n.fontStyle,"normal"),this.fontWeight=Eo(n.fontWeight,"bold"),this.fontSize=Eo(n.fontSize,48),this.sdf=Eo(n.sdf,"Chrome"===hc),this.xOffset=Eo(n.xOffset,0),this.yOffset=Eo(n.yOffset,0),this.zOffset=Eo(n.zOffset,.5),this.attachment=Eo(n.attachment,"bottom-left"),this.showBorder=Eo(n.showBorder,!1),this.borderColor=Eo(n.borderColor,"lightgrey"),this.borderWidth=Eo(n.borderWidth,.15),this.showBackground=Eo(n.showBackground,!1),this.backgroundColor=Eo(n.backgroundColor,"lightgrey"),this.backgroundMargin=Eo(n.backgroundMargin,.5),this.backgroundOpacity=Eo(n.backgroundOpacity,1),this.text=r.text,this.positionCount=o,this.addUniforms({fontTexture:{value:null},xOffset:{value:this.xOffset},yOffset:{value:this.yOffset},zOffset:{value:this.zOffset},ortho:{value:!1},showBorder:{value:this.showBorder},borderColor:{value:new St(this.borderColor)},borderWidth:{value:this.borderWidth},backgroundColor:{value:new St(this.backgroundColor)},backgroundOpacity:{value:this.backgroundOpacity}}),this.addAttributes({inputTexCoord:{type:"v2",value:null},inputSize:{type:"f",value:null}}),this.setAttributes(e),this.makeTexture(),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={parameters:{},wireframe:{},isText:{},vertexShader:{},fragmentShader:{}};return i.parameters.get=function(){return Object.assign.call(this,{fontFamily:{uniform:!0},fontStyle:{uniform:!0},fontWeight:{uniform:!0},fontSize:{uniform:!0},sdf:{updateShader:!0,uniform:!0},xOffset:{uniform:!0},yOffset:{uniform:!0},zOffset:{uniform:!0},showBorder:{uniform:!0},borderColor:{uniform:!0},borderWidth:{uniform:!0},backgroundColor:{uniform:!0},backgroundOpacity:{uniform:!0}},t.prototype.parameters,{flatShaded:void 0})},e.prototype.makeMaterial=function(){t.prototype.makeMaterial.call(this);var e=this.texture,i=this.material;i.extensions.derivatives=!0,i.lights=!1,i.uniforms.fontTexture.value=e,i.needsUpdate=!0;var r=this.wireframeMaterial;r.extensions.derivatives=!0,r.lights=!1,r.uniforms.fontTexture.value=e,r.needsUpdate=!0;var n=this.pickingMaterial;n.extensions.derivatives=!0,n.lights=!1,n.uniforms.fontTexture.value=e,n.needsUpdate=!0},e.prototype.setAttributes=function(t){var e,i,r,n,o,a,s=this.text,c=this.geometry.attributes;t.position&&(e=t.position,n=c.position.array,c.position.needsUpdate=!0),t.size&&(i=t.size,o=c.inputSize.array,c.inputSize.needsUpdate=!0),t.color&&(r=t.color,a=c.color.array,c.color.needsUpdate=!0);for(var u,h,l,p,d=this.positionCount,f=0,m=0;m<d;++m)for(h=3*m,p=s[m].length,this.showBackground&&(p+=1),l=0;l<p;++l,++f)for(var g=0;g<4;g++)u=4*f*3+3*g,e&&(n[u]=e[h],n[u+1]=e[h+1],n[u+2]=e[h+2]),i&&(o[4*f+g]=i[m]),r&&(a[u]=r[h],a[u+1]=r[h+1],a[u+2]=r[h+2])},e.prototype.makeTexture=function(){var t,e;this.textAtlas=(t={font:[this.fontFamily],style:this.fontStyle,weight:this.fontWeight,size:this.fontSize,outline:this.sdf?5:0},e=JSON.stringify(t),void 0===of[e]&&(of[e]=new af(t)),of[e]),this.texture=this.textAtlas.texture},e.prototype.makeMapping=function(){for(var t,e,i,r,n,o,a,s,c=this.textAtlas,u=this.text,h=this.attachment,l=c.lineHeight*this.backgroundMargin*.1-10,p=this.geometry.attributes.inputTexCoord.array,d=this.geometry.attributes.mapping.array,f=this.positionCount,m=0,g=0;g<f;++g){for(r=0,o=(i=u[g]).length,n=0;n<o;++n)r+=(t=c.get(i[n])).w-2*c.outline;for(s=h.startsWith("top")?c.lineHeight/1.25:h.startsWith("middle")?c.lineHeight/2.5:0,a=h.endsWith("right")?r:h.endsWith("center")?r/2:0,a+=c.outline,s+=c.outline,this.showBackground&&(d[(e=2*m*4)+0]=-c.lineHeight/6-a-l,d[e+1]=c.lineHeight-s+l,d[e+2]=-c.lineHeight/6-a-l,d[e+3]=0-s-l,d[e+4]=r+c.lineHeight/6-a+2*c.outline+l,d[e+5]=c.lineHeight-s+l,d[e+6]=r+c.lineHeight/6-a+2*c.outline+l,d[e+7]=0-s-l,p[e+0]=10,p[e+2]=10,p[e+4]=10,p[e+6]=10,m+=1),r=0,n=0;n<o;++n,++m){t=c.get(i[n]),d[(e=2*m*4)+0]=r-a,d[e+1]=t.h-s,d[e+2]=r-a,d[e+3]=0-s,d[e+4]=r+t.w-a,d[e+5]=t.h-s,d[e+6]=r+t.w-a,d[e+7]=0-s;var v=c.width,y=c.height,b=[t.x/v,t.y/y,t.x/v,(t.y+t.h)/y,(t.x+t.w)/v,t.y/y,(t.x+t.w)/v,(t.y+t.h)/y];p.set(b,e),r+=t.w-2*c.outline}}this.geometry.attributes.inputTexCoord.needsUpdate=!0,this.geometry.attributes.mapping.needsUpdate=!0},e.prototype.getDefines=function(e){var i=t.prototype.getDefines.call(this,e);return this.sdf&&(i.SDF=1),i},e.prototype.setUniforms=function(e){!e||void 0===e.fontFamily&&void 0===e.fontStyle&&void 0===e.fontWeight&&void 0===e.fontSize&&void 0===e.sdf||(this.makeTexture(),this.makeMapping(),this.texture.needsUpdate=!0,e.fontTexture=this.texture),t.prototype.setUniforms.call(this,e)},i.wireframe.set=function(t){},i.wireframe.get=function(){return!1},i.isText.get=function(){return!0},i.vertexShader.get=function(){return"SDFFont.vert"},i.fragmentShader.get=function(){return"SDFFont.frag"},Object.defineProperties(e.prototype,i),e}(Rd);function cf(t,e){void 0!==t.toArray?t=t.toArray():void 0!==t.x?t=[t.x,t.y,t.z]:void 0!==t.r&&(t=[t.r,t.g,t.b]),e.push.apply(e,t)}var uf=new O,hf=new jt,lf=function(t,e){this.name=Eo(t,"shape");var i=e||{};this.aspectRatio=Eo(i.aspectRatio,1.5),this.sphereDetail=Eo(i.sphereDetail,2),this.radialSegments=Eo(i.radialSegments,50),this.disableImpostor=Eo(i.disableImpostor,!1),this.openEnded=Eo(i.openEnded,!1),this.labelParams=Eo(i.labelParams,{}),this.boundingBox=new jt,this.bufferList=[],this.meshCount=0,this.spherePosition=[],this.sphereColor=[],this.sphereRadius=[],this.sphereName=[],this.ellipsoidPosition=[],this.ellipsoidColor=[],this.ellipsoidRadius=[],this.ellipsoidMajorAxis=[],this.ellipsoidMinorAxis=[],this.ellipsoidName=[],this.cylinderPosition1=[],this.cylinderPosition2=[],this.cylinderColor=[],this.cylinderRadius=[],this.cylinderName=[],this.conePosition1=[],this.conePosition2=[],this.coneColor=[],this.coneRadius=[],this.coneName=[],this.arrowPosition1=[],this.arrowPosition2=[],this.arrowColor=[],this.arrowRadius=[],this.arrowName=[],this.labelPosition=[],this.labelColor=[],this.labelSize=[],this.labelText=[]},pf={center:{},type:{}};lf.prototype.addBuffer=function(t){this.bufferList.push(t);var e=t.geometry;return e.boundingBox||e.computeBoundingBox(),this.boundingBox.union(e.boundingBox),this},lf.prototype.addMesh=function(t,e,i,r,n){t=$o(t),e=$o(e),Array.isArray(i)&&(i=zo(i,t.length)),r&&(r=$o(r));var o={position:t,color:e,index:i,normal:r},a=new Jh(this,Object.assign({serial:this.meshCount,name:n},o)),s=new wd(Object.assign({picking:a},o));return this.bufferList.push(s),hf.setFromArray(t),this.boundingBox.union(hf),this.meshCount+=1,this},lf.prototype.addSphere=function(t,e,i,r){return cf(t,this.spherePosition),cf(e,this.sphereColor),this.sphereRadius.push(i),this.sphereName.push(r),this.boundingBox.expandByPoint(uf.fromArray(t)),this},lf.prototype.addEllipsoid=function(t,e,i,r,n,o){return cf(t,this.ellipsoidPosition),cf(e,this.ellipsoidColor),this.ellipsoidRadius.push(i),cf(r,this.ellipsoidMajorAxis),cf(n,this.ellipsoidMinorAxis),this.ellipsoidName.push(o),this.boundingBox.expandByPoint(uf.fromArray(t)),this},lf.prototype.addCylinder=function(t,e,i,r,n){return cf(t,this.cylinderPosition1),cf(e,this.cylinderPosition2),cf(i,this.cylinderColor),this.cylinderRadius.push(r),this.cylinderName.push(n),this.boundingBox.expandByPoint(uf.fromArray(t)),this.boundingBox.expandByPoint(uf.fromArray(e)),this},lf.prototype.addCone=function(t,e,i,r,n){return cf(t,this.conePosition1),cf(e,this.conePosition2),cf(i,this.coneColor),this.coneRadius.push(r),this.coneName.push(n),this.boundingBox.expandByPoint(uf.fromArray(t)),this.boundingBox.expandByPoint(uf.fromArray(e)),this},lf.prototype.addArrow=function(t,e,i,r,n){return cf(t,this.arrowPosition1),cf(e,this.arrowPosition2),cf(i,this.arrowColor),this.arrowRadius.push(r),this.arrowName.push(n),this.boundingBox.expandByPoint(uf.fromArray(t)),this.boundingBox.expandByPoint(uf.fromArray(e)),this},lf.prototype.addLabel=function(t,e,i,r){return cf(t,this.labelPosition),cf(e,this.labelColor),this.labelSize.push(i),this.labelText.push(r),this.boundingBox.expandByPoint(uf.fromArray(t)),this},lf.prototype.getBufferList=function(){var t=[];if(this.spherePosition.length){var e=new Od({position:new Float32Array(this.spherePosition),color:new Float32Array(this.sphereColor),radius:new Float32Array(this.sphereRadius),picking:new tl(this)},{sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor});t.push(e)}if(this.ellipsoidPosition.length){var i=new zd({position:new Float32Array(this.ellipsoidPosition),color:new Float32Array(this.ellipsoidColor),radius:new Float32Array(this.ellipsoidRadius),majorAxis:new Float32Array(this.ellipsoidMajorAxis),minorAxis:new Float32Array(this.ellipsoidMinorAxis),picking:new Kh(this)},{sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor});t.push(i)}if(this.cylinderPosition1.length){var r=new qd({position1:new Float32Array(this.cylinderPosition1),position2:new Float32Array(this.cylinderPosition2),color:new Float32Array(this.cylinderColor),color2:new Float32Array(this.cylinderColor),radius:new Float32Array(this.cylinderRadius),picking:new Gh(this)},{radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,openEnded:this.openEnded});t.push(r)}if(this.conePosition1.length){var n=new tf({position1:new Float32Array(this.conePosition1),position2:new Float32Array(this.conePosition2),color:new Float32Array(this.coneColor),radius:new Float32Array(this.coneRadius),picking:new qh(this)},{radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,openEnded:this.openEnded});t.push(n)}if(this.arrowPosition1.length){var o=new rf({position1:new Float32Array(this.arrowPosition1),position2:new Float32Array(this.arrowPosition2),color:new Float32Array(this.arrowColor),radius:new Float32Array(this.arrowRadius),picking:new Vh(this)},{aspectRatio:this.aspectRatio,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,openEnded:this.openEnded});t.push(o)}if(this.labelPosition.length){var a=new sf({position:new Float32Array(this.labelPosition),color:new Float32Array(this.labelColor),size:new Float32Array(this.labelSize),text:this.labelText},this.labelParams);t.push(a)}return this.bufferList.concat(t)},lf.prototype.dispose=function(){this.bufferList.forEach((function(t){t.dispose()})),this.bufferList.length=0,this.spherePosition.length=0,this.sphereColor.length=0,this.sphereRadius.length=0,this.sphereName.length=0,this.ellipsoidPosition.length=0,this.ellipsoidColor.length=0,this.ellipsoidRadius.length=0,this.ellipsoidMajorAxis.length=0,this.ellipsoidMinorAxis.length=0,this.ellipsoidName.length=0,this.cylinderPosition1.length=0,this.cylinderPosition2.length=0,this.cylinderColor.length=0,this.cylinderRadius.length=0,this.cylinderName.length=0,this.conePosition1.length=0,this.conePosition2.length=0,this.coneColor.length=0,this.coneRadius.length=0,this.coneName.length=0,this.arrowPosition1.length=0,this.arrowPosition2.length=0,this.arrowColor.length=0,this.arrowRadius.length=0,this.arrowName.length=0,this.labelPosition.length=0,this.labelColor.length=0,this.labelSize.length=0,this.labelText.length=0},pf.center.get=function(){return this._center||(this._center=this.boundingBox.getCenter()),this._center},pf.type.get=function(){return"Shape"},Object.defineProperties(lf.prototype,pf);var df=function(t,e,i){this.type="",this.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},depthWrite:{type:"boolean",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:{}},colorScale:{type:"select",update:"color",options:yc.getScales()},colorReverse:{type:"boolean",update:"color"},colorValue:{type:"color",update:"color"},colorDomain:{type:"hidden",update:"color"},colorMode:{type:"select",update:"color",options:yc.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},matrix:{type:"hidden",buffer:!0},disablePicking:{type:"boolean",rebuild:!0}},this.viewer=e,this.tasks=new $c,this.queue=new dd(this.make.bind(this)),this.bufferList=[],this.parameters.colorScheme&&(this.parameters.colorScheme.options=yc.getSchemes())};df.prototype.init=function(t){var e=t||{};this.clipNear=Eo(e.clipNear,0),this.clipRadius=Eo(e.clipRadius,0),this.clipCenter=Eo(e.clipCenter,new O),this.flatShaded=Eo(e.flatShaded,!1),this.side=Eo(e.side,"double"),this.opacity=Eo(e.opacity,1),this.depthWrite=Eo(e.depthWrite,!0),this.wireframe=Eo(e.wireframe,!1),this.linewidth=Eo(e.linewidth,2),this.setColor(e.color,e),this.colorScheme=Eo(e.colorScheme,"uniform"),this.colorScale=Eo(e.colorScale,""),this.colorReverse=Eo(e.colorReverse,!1),this.colorValue=Eo(e.colorValue,9474192),this.colorDomain=Eo(e.colorDomain,void 0),this.colorMode=Eo(e.colorMode,"hcl"),this.visible=Eo(e.visible,!0),this.quality=Eo(e.quality,void 0),this.roughness=Eo(e.roughness,.4),this.metalness=Eo(e.metalness,0),this.diffuse=Eo(e.diffuse,16777215),this.lazy=Eo(e.lazy,!1),this.lazyProps={build:!1,bufferParams:{},what:{}},this.matrix=Eo(e.matrix,new N),this.disablePicking=Eo(e.disablePicking,!1);var i=this.parameters;!0===i.sphereDetail&&(i.sphereDetail={type:"integer",max:3,min:0,rebuild:"impostor"}),!0===i.radialSegments&&(i.radialSegments={type:"integer",max:25,min:5,rebuild:"impostor"}),!0===i.openEnded&&(i.openEnded={type:"boolean",rebuild:"impostor",buffer:!0}),!0===i.disableImpostor&&(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=Eo(e.sphereDetail,1)),i.radialSegments&&(this.radialSegments=Eo(e.radialSegments,10))),i.openEnded&&(this.openEnded=Eo(e.openEnded,!0)),i.disableImpostor&&(this.disableImpostor=Eo(e.disableImpostor,!1))},df.prototype.getColorParams=function(t){return Object.assign({scheme:this.colorScheme,scale:this.colorScale,reverse:this.colorReverse,value:this.colorValue,domain:this.colorDomain,mode:this.colorMode},t)},df.prototype.getBufferParams=function(t){return Object.assign({clipNear:this.clipNear,clipRadius:this.clipRadius,clipCenter:this.clipCenter,flatShaded:this.flatShaded,opacity:this.opacity,depthWrite:this.depthWrite,side:this.side,wireframe:this.wireframe,linewidth:this.linewidth,roughness:this.roughness,metalness:this.metalness,diffuse:this.diffuse,matrix:this.matrix,disablePicking:this.disablePicking},t)},df.prototype.setColor=function(t,e){return Object.keys(yc.getSchemes()).includes(t)?e?e.colorScheme=t:this.setParameters({colorScheme:t}):void 0!==t&&(t=new St(t).getHex(),e?(e.colorScheme="uniform",e.colorValue=t):this.setParameters({colorScheme:"uniform",colorValue:t})),this},df.prototype.create=function(){},df.prototype.update=function(){this.build()},df.prototype.build=function(t){if(!this.lazy||this.visible){if(!this.prepare)return this.tasks.increment(),void this.make();this.queue.length()>0?(this.tasks.change(1-this.queue.length()),this.queue.kill()):this.tasks.increment(),this.queue.push(t||!1)}else this.lazyProps.build=!0},df.prototype.make=function(t,e){gc&&mc.time("Representation.make "+this.type);var i=function(){t?(this.update(t),this.viewer.requestRender(),this.tasks.decrement(),e&&e()):(this.clear(),this.create(),this.manualAttach||this.disposed||(gc&&mc.time("Representation.attach "+this.type),this.attach(function(){gc&&mc.timeEnd("Representation.attach "+this.type),this.tasks.decrement(),e&&e()}.bind(this)))),gc&&mc.timeEnd("Representation.make "+this.type)}.bind(this);this.prepare?this.prepare(i):i()},df.prototype.attach=function(t){this.setVisibility(this.visible),t()},df.prototype.setVisibility=function(t,e){if(this.visible=t,this.visible){var i=this.lazyProps,r=i.bufferParams,n=i.what;if(i.build)return i.build=!1,void this.build();(Object.keys(r).length||Object.keys(n).length)&&(i.bufferParams={},i.what={},this.updateParameters(r,n))}return this.bufferList.forEach((function(e){e.setVisibility(t)})),e||this.viewer.requestRender(),this},df.prototype.setParameters=function(t,e,i){var r=t||{},n=this.parameters;e=e||{},i=i||!1;var o={};for(var a in r)void 0!==r[a]&&void 0!==n[a]&&(n[a].int&&(r[a]=parseInt(r[a])),n[a].float&&(r[a]=parseFloat(r[a])),(r[a]!==this[a]||r[a].equals&&!r[a].equals(this[a]))&&(this[a].set?this[a].set(r[a]):this[a]=r[a],n[a].buffer&&(!0===n[a].buffer?o[a]=r[a]:o[n[a].buffer]=r[a]),n[a].update&&(e[n[a].update]=!0),!n[a].rebuild||"impostor"===n[a].rebuild&&dc&&!this.disableImpostor||(i=!0)));return i?this.build():this.updateParameters(o,e),this},df.prototype.updateParameters=function(t,e){if(this.lazy&&!this.visible)return 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),this.viewer.requestRender()},df.prototype.getParameters=function(){var t=this,e={lazy:this.lazy,visible:this.visible,quality:this.quality};return Object.keys(this.parameters).forEach((function(i){null!==t.parameters[i]&&(e[i]=t[i])})),e},df.prototype.clear=function(){var t=this;this.bufferList.forEach((function(e){t.viewer.remove(e),e.dispose()})),this.bufferList.length=0,this.viewer.requestRender()},df.prototype.dispose=function(){this.disposed=!0,this.queue.kill(),this.tasks.dispose(),this.clear()};var ff=function(t){function e(e,i,r){Array.isArray(e)||(e=[e]),t.call(this,e,i,r),this.type="buffer",this.parameters=Object.assign({},this.parameters,{colorScheme:null,colorScale:null,colorValue:null,colorDomain:null,colorMode:null}),this.buffer=e,this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){t.prototype.init.call(this,e),this.build()},e.prototype.create=function(){this.bufferList.push.apply(this.bufferList,this.buffer)},e.prototype.attach=function(t){var e=this;this.bufferList.forEach((function(t){e.viewer.add(t),t.setParameters(e.getBufferParams())})),this.setVisibility(this.visible),t()},e}(df),mf=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isSurface:{}};return i.isSurface.get=function(){return!0},Object.defineProperties(e.prototype,i),e}(wd);function gf(t){t.visible=!0}function vf(t){t.visible=!1}var yf=function(t){this.size=t.size,this.side=t.side,this.wireframe=t.wireframe,this.visible=t.visible,this.geometry=t.geometry,this.picking=t.picking,this.background=t.background,this.disablePicking=t.disablePicking,this.group=new Ci,this.wireframeGroup=new Ci,this.pickingGroup=new Ci,this.matrix=t.matrix,this.frontMeshes=[],this.backMeshes=[];var e=t,i=new t.constructor;e.makeMaterial(),i.makeMaterial(),i.picking=t.picking,i.geometry=t.geometry,i.wireframeGeometry=t.wireframeGeometry,i.setParameters(t.getParameters()),i.updateShader(),e.setParameters({side:"front"}),i.setParameters({side:"back",opacity:i.opacity}),this.buffer=t,this.frontBuffer=e,this.backBuffer=i},bf={matrix:{},pickable:{}};bf.matrix.set=function(t){xd.prototype.setMatrix.call(this,t)},bf.matrix.get=function(){return this.group.matrix.clone()},bf.pickable.get=function(){return!!this.picking&&!this.disablePicking},yf.prototype.getMesh=function(t){var e,i;return t?(i=this.backBuffer.getPickingMesh(),e=this.frontBuffer.getPickingMesh()):(i=this.backBuffer.getMesh(),e=this.frontBuffer.getMesh()),this.frontMeshes.push(e),this.backMeshes.push(i),this.setParameters({side:this.side}),(new Ci).add(i,e)},yf.prototype.getWireframeMesh=function(){return this.buffer.getWireframeMesh()},yf.prototype.getPickingMesh=function(){return this.getMesh(!0)},yf.prototype.setAttributes=function(t){this.buffer.setAttributes(t)},yf.prototype.setParameters=function(t){"front"===(t=Object.assign({},t)).side?(this.frontMeshes.forEach(gf),this.backMeshes.forEach(vf)):"back"===t.side?(this.frontMeshes.forEach(vf),this.backMeshes.forEach(gf)):"double"===t.side&&(this.frontMeshes.forEach(gf),this.backMeshes.forEach(gf)),void 0!==t.matrix&&(this.matrix=t.matrix),delete t.matrix,void 0!==t.side&&(this.side=t.side),delete t.side,this.frontBuffer.setParameters(t),void 0!==t.wireframe&&(this.wireframe=t.wireframe,this.setVisibility(this.visible)),delete t.wireframe,this.backBuffer.setParameters(t)},yf.prototype.dispose=function(){this.frontBuffer.dispose(),this.backBuffer.dispose()},Object.defineProperties(yf.prototype,bf),yf.prototype.setVisibility=xd.prototype.setVisibility,wc.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}"),wc.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}");var xf=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isLine:{},vertexShader:{},fragmentShader:{}};return i.isLine.get=function(){return!0},i.vertexShader.get=function(){return"Line.vert"},i.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,i),e}(xd),_f=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="surface",this.parameters=Object.assign({isolevelType:{type:"select",options:{value:"value",sigma:"sigma"}},isolevel:{type:"number",precision:2,max:1e3,min:-1e3},negateIsolevel:{type:"boolean"},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},colorVolume:{type:"hidden"},contour:{type:"boolean",rebuild:!0},useWorker:{type:"boolean",rebuild:!0},wrap:{type:"boolean",rebuild:!0}},this.parameters),e instanceof lp?(this.surface=void 0,this.volume=e):(this.surface=e,this.volume=void 0),this.boxCenter=new O,this.__boxCenter=new O,this.box=new jt,this.__box=new jt,this._position=new O,this.setBox=function(){this._position.copy(i.translationGroup.position).negate(),this._position.equals(this.boxCenter)||this.setParameters({boxCenter:this._position})},this.viewer.signals.ticked.add(this.setBox,this),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"uniform"),i.colorValue=Eo(i.colorValue,14540253),this.isolevelType=Eo(i.isolevelType,"sigma"),this.isolevel=Eo(i.isolevel,2),this.negateIsolevel=Eo(i.negateIsolevel,!1),this.smooth=Eo(i.smooth,0),this.background=Eo(i.background,!1),this.opaqueBack=Eo(i.opaqueBack,!0),this.boxSize=Eo(i.boxSize,0),this.colorVolume=Eo(i.colorVolume,void 0),this.contour=Eo(i.contour,!1),this.useWorker=Eo(i.useWorker,!0),this.wrap=Eo(i.wrap,!1),t.prototype.init.call(this,i),this.build()},e.prototype.attach=function(t){var e=this;this.bufferList.forEach((function(t){e.viewer.add(t)})),this.setVisibility(this.visible),t()},e.prototype.prepare=function(t){var e,i=this;if(this.volume)if(e="sigma"===this.isolevelType?this.volume.getValueForSigma(this.isolevel):this.isolevel,this.negateIsolevel&&(e*=-1),!this.surface||this.__isolevel!==e||this.__smooth!==this.smooth||this.__contour!==this.contour||this.__wrap!==this.wrap||this.__boxSize!==this.boxSize||this.boxSize>0&&!this.__boxCenter.equals(this.boxCenter)){this.__isolevel=e,this.__smooth=this.smooth,this.__contour=this.contour,this.__wrap=this.wrap,this.__boxSize=this.boxSize,this.__boxCenter.copy(this.boxCenter),this.__box.copy(this.box);var r=function(e){i.surface=e,t()};this.useWorker?this.volume.getSurfaceWorker(e,this.smooth,this.boxCenter,this.boxSize,this.contour,this.wrap,r):r(this.volume.getSurface(e,this.smooth,this.boxCenter,this.boxSize,this.contour,this.wrap))}else t();else t()},e.prototype.create=function(){var t,e={position:this.surface.getPosition(),color:this.surface.getColor(this.getColorParams()),index:this.surface.getIndex()};if(this.contour)t=new xf(e,this.getBufferParams({wireframe:!1}));else{e.normal=this.surface.getNormal(),e.picking=this.surface.getPicking();var i=new mf(e,this.getBufferParams({background:this.background,opaqueBack:this.opaqueBack,dullInterior:!1}));t=new yf(i)}this.bufferList.push(t)},e.prototype.update=function(t){if(0!==this.bufferList.length){var e={};(t=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)}))}},e.prototype.setParameters=function(e,i,r){return e&&void 0!==e.isolevelType&&this.volume&&("value"===this.isolevelType&&"sigma"===e.isolevelType?this.isolevel=this.volume.getSigmaForValue(this.isolevel):"sigma"===this.isolevelType&&"value"===e.isolevelType&&(this.isolevel=this.volume.getValueForSigma(this.isolevel)),this.isolevelType=e.isolevelType),e&&e.boxCenter&&(this.boxCenter.copy(e.boxCenter),delete e.boxCenter),e&&e.wireframe&&(e.contour||void 0===e.contour&&this.contour)&&(e.wireframe=!1),t.prototype.setParameters.call(this,e,i,r),this.volume&&this.volume.getBox(this.boxCenter,this.boxSize,this.box),e&&void 0!==e.colorVolume&&(i.color=!0),this.surface&&(void 0!==e.isolevel||void 0!==e.negateIsolevel||void 0!==e.smooth||void 0!==e.wrap||void 0!==e.boxSize||this.boxSize>0&&!this.__box.equals(this.box))&&this.build({position:!0,color:!0,index:!0,normal:!this.contour}),this},e.prototype.getColorParams=function(){var e=t.prototype.getColorParams.call(this);return e.volume=this.colorVolume,e},e.prototype.dispose=function(){this.viewer.signals.ticked.remove(this.setBox,this),t.prototype.dispose.call(this)},e}(df);wc.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#if defined( PICKING )\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#endif\n#include common\nvoid main(){\n#if defined( PICKING )\nvPickingColor = unpackColor( primitiveId );\n#else\n#include color_vertex\n#endif\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}"),wc.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#if defined( PICKING )\nuniform float objectId;\nvarying vec3 vPickingColor;\n#else\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#endif\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\n#if defined( PICKING )\n#ifdef USE_MAP\nif( texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) ).a < 0.5 )\ndiscard;\n#endif\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\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#endif\n}");var wf=function(t){function e(e,i){var r=e||{},n=i||{};r.primitiveId||(r.primitiveId=su(r.position.length/3)),t.call(this,r,n),this.pointSize=Eo(n.pointSize,1),this.sizeAttenuation=Eo(n.sizeAttenuation,!0),this.sortParticles=Eo(n.sortParticles,!1),this.alphaTest=Eo(n.alphaTest,.5),this.useTexture=Eo(n.useTexture,!1),this.forceTransparent=Eo(n.forceTransparent,!1),this.edgeBleach=Eo(n.edgeBleach,0),this.addUniforms({size:{value:this.pointSize},canvasHeight:{value:1},pixelRatio:{value:1},map:{value:null}})}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={parameters:{},isPoint:{},vertexShader:{},fragmentShader:{}};return i.parameters.get=function(){return Object.assign.call(this,{pointSize:{uniform:"size"},sizeAttenuation:{updateShader:!0},sortParticles:{},alphaTest:{updateShader:!0},useTexture:{updateShader:!0},forceTransparent:{},edgeBleach:{uniform:!0}},t.prototype.parameters)},e.prototype.makeMaterial=function(){t.prototype.makeMaterial.call(this),this.makeTexture();var e=this.material,i=this.wireframeMaterial,r=this.pickingMaterial;e.uniforms.map.value=this.tex,e.needsUpdate=!0,i.uniforms.map.value=this.tex,i.needsUpdate=!0,r.uniforms.map.value=this.tex,r.needsUpdate=!0},e.prototype.makeTexture=function(){this.tex&&this.tex.dispose(),this.tex=function(t){for(var e,i,r=t||{},n=Eo(r.width,256),o=Eo(r.height,256),a=[n/2,o/2],s=Math.min(n/2,o/2),c=Eo(r.delta,1/(s+1))*s,u=0,h=0,l=new Uint8Array(n*o*4),p=0,d=l.length;p<d;p+=4){var f=1-Rs(s-c,s,(e=void 0,i=void 0,e=a[0]-u,i=a[1]-h,Math.sqrt(e*e+i*i)));l[p]=255*f,l[p+1]=255*f,l[p+2]=255*f,l[p+3]=255*f,++u===n&&(u=0,h++)}var m=new D(l,n,o);return m.needsUpdate=!0,m}({delta:this.edgeBleach})},e.prototype.getDefines=function(e){var i=t.prototype.getDefines.call(this,e);return this.sizeAttenuation&&(i.USE_SIZEATTENUATION=1),this.useTexture&&(i.USE_MAP=1),this.alphaTest>0&&this.alphaTest<=1&&(i.ALPHATEST=this.alphaTest.toPrecision(2)),i},e.prototype.setUniforms=function(e){e&&void 0!==e.edgeBleach&&(this.makeTexture(),e.map=this.tex),t.prototype.setUniforms.call(this,e)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.tex&&this.tex.dispose()},i.isPoint.get=function(){return!0},i.vertexShader.get=function(){return"Point.vert"},i.fragmentShader.get=function(){return"Point.frag"},Object.defineProperties(e.prototype,i),e}(xd),Sf=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="dot",this.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}},this.parameters,{colorScheme:{type:"select",update:"color",options:{"":"",value:"value",uniform:"uniform",random:"random"}}}),e instanceof lp?(this.surface=void 0,this.volume=new dp(e)):(this.surface=e,this.volume=void 0),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"uniform"),i.colorValue=Eo(i.colorValue,14540253),this.thresholdType=Eo(i.thresholdType,"sigma"),this.thresholdMin=Eo(i.thresholdMin,2),this.thresholdMax=Eo(i.thresholdMax,1/0),this.thresholdOut=Eo(i.thresholdOut,!1),this.dotType=Eo(i.dotType,"point"),this.radius=Eo(i.radius,.1),this.scale=Eo(i.scale,1),this.pointSize=Eo(i.pointSize,1),this.sizeAttenuation=Eo(i.sizeAttenuation,!0),this.sortParticles=Eo(i.sortParticles,!1),this.useTexture=Eo(i.useTexture,!1),this.alphaTest=Eo(i.alphaTest,.5),this.forceTransparent=Eo(i.forceTransparent,!1),this.edgeBleach=Eo(i.edgeBleach,0),t.prototype.init.call(this,i),this.build()},e.prototype.attach=function(t){var e=this;this.bufferList.forEach((function(t){e.viewer.add(t)})),this.setVisibility(this.visible),t()},e.prototype.create=function(){var t={};if(this.volume){var e,i,r=this.volume;"sigma"===this.thresholdType?(e=r.getValueForSigma(this.thresholdMin),i=r.getValueForSigma(this.thresholdMax)):(e=this.thresholdMin,i=this.thresholdMax),r.setFilter(e,i,this.thresholdOut),t.position=r.getDataPosition(),t.color=r.getDataColor(this.getColorParams()),"sphere"===this.dotType&&(t.radius=r.getDataSize(this.radius,this.scale),t.picking=r.getDataPicking())}else{var n=this.surface;t.position=n.getPosition(),t.color=n.getColor(this.getColorParams()),"sphere"===this.dotType&&(t.radius=n.getSize(this.radius,this.scale),t.picking=n.getPicking())}"sphere"===this.dotType?this.dotBuffer=new Od(t,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!1})):this.dotBuffer=new wf(t,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)},e.prototype.update=function(t){if(0!==this.bufferList.length){var e={};(t=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)}},e.prototype.setParameters=function(e,i,r){return i=i||{},e&&void 0!==e.thresholdType&&this.volume instanceof lp&&("value"===this.thresholdType&&"sigma"===e.thresholdType?(this.thresholdMin=this.volume.getSigmaForValue(this.thresholdMin),this.thresholdMax=this.volume.getSigmaForValue(this.thresholdMax)):"sigma"===this.thresholdType&&"value"===e.thresholdType&&(this.thresholdMin=this.volume.getValueForSigma(this.thresholdMin),this.thresholdMax=this.volume.getValueForSigma(this.thresholdMax)),this.thresholdType=e.thresholdType),e&&void 0!==e.radiusType&&("radius"===e.radiusType?this.radius=.1:this.radius=e.radiusType,i.radius=!0,"sphere"!==this.dotType||dc&&!this.disableImpostor||(r=!0)),e&&void 0!==e.radius&&(i.radius=!0,"sphere"!==this.dotType||dc&&!this.disableImpostor||(r=!0)),e&&void 0!==e.scale&&(i.scale=!0,"sphere"!==this.dotType||dc&&!this.disableImpostor||(r=!0)),t.prototype.setParameters.call(this,e,i,r),this},e}(df);wc.add("shader/Image.vert","uniform float clipRadius;\nuniform vec3 clipCenter;\nvarying vec2 vUv;\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\nvoid main() {\n#include begin_vertex\n#include project_vertex\nvUv = uv;\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}"),wc.add("shader/Image.frag","uniform sampler2D map;\nuniform float opacity;\nuniform vec2 mapSize;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec2 vUv;\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\n#if defined( PICKING )\nuniform sampler2D pickingMap;\nuniform float objectId;\n#else\n#include fog_pars_fragment\n#endif\n#if defined( CUBIC_INTERPOLATION )\n#if defined( CATMULROM_FILTER ) || defined( MITCHELL_FILTER )\n#if defined( CATMULROM_FILTER )\nconst float B = 0.0;\nconst float C = 0.5;\n#elif defined( MITCHELL_FILTER )\nconst float B = 0.333;\nconst float C = 0.333;\n#endif\nfloat filter( float x ){\nfloat f = x;\nif( f < 0.0 ){\nf = -f;\n}\nif( f < 1.0 ){\nreturn ( ( 12.0 - 9.0 * B - 6.0 * C ) * ( f * f * f ) +\n( -18.0 + 12.0 * B + 6.0 *C ) * ( f * f ) +\n( 6.0 - 2.0 * B ) ) / 6.0;\n}else if( f >= 1.0 && f < 2.0 ){\nreturn ( ( -B - 6.0 * C ) * ( f * f * f )\n+ ( 6.0 * B + 30.0 * C ) * ( f *f ) +\n( - ( 12.0 * B ) - 48.0 * C ) * f +\n8.0 * B + 24.0 * C ) / 6.0;\n}else{\nreturn 0.0;\n}\n}\n#elif defined( BSPLINE_FILTER )\nfloat filter( float x ){\nfloat f = x;\nif( f < 0.0 ){\nf = -f;\n}\nif( f >= 0.0 && f <= 1.0 ){\nreturn ( 2.0 / 3.0 ) + ( 0.5 ) * ( f * f * f ) - ( f * f );\n}else if( f > 1.0 && f <= 2.0 ){\nreturn 1.0 / 6.0 * pow( ( 2.0 - f ), 3.0 );\n}\nreturn 1.0;\n}\n#else\nfloat filter( float x ){\nreturn 1.0;\n}\n#endif\nvec4 biCubic( sampler2D tex, vec2 texCoord ){\nvec2 texelSize = 1.0 / mapSize;\ntexCoord -= texelSize / 2.0;\nvec4 nSum = vec4( 0.0 );\nfloat nDenom = 0.0;\nvec2 cell = fract( texCoord * mapSize );\nfor( float m = -1.0; m <= 2.0; ++m ){\nfor( float n = -1.0; n <= 2.0; ++n ){\nvec4 vecData = texture2D(\ntex, texCoord + texelSize * vec2( m, n )\n);\nfloat c = filter( m - cell.x ) * filter( -n + cell.y );\nnSum += vecData * c;\nnDenom += c;\n}\n}\nreturn nSum / nDenom;\n}\n#endif\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\n#if defined( CUBIC_INTERPOLATION )\ngl_FragColor = biCubic( map, vUv );\n#else\ngl_FragColor = texture2D( map, vUv );\n#endif\n#if defined( PICKING )\nif( gl_FragColor.a < 0.7 )\ndiscard;\ngl_FragColor = vec4( texture2D( pickingMap, vUv ).xyz, objectId );\n#else\nif( gl_FragColor.a < 0.01 )\ndiscard;\ngl_FragColor.a *= opacity;\n#include fog_fragment\n#endif\n}");var Af=new Uint16Array([0,1,2,1,3,2]),Mf=new Float32Array([0,1,0,0,1,1,1,0]),Pf=function(t){function e(e,i){var r=e||{},n=i||{};t.call(this,{position:r.position,index:Af,picking:r.picking},n),this.forceTransparent=!0,this.filter=Eo(n.filter,"nearest");var o=new D(r.imageData,r.width,r.height);o.flipY=!0,this.tex=o;for(var a=r.imageData.length,s=new Uint8Array(a),c=0;c<a;c+=4){var u=c/4;s[c]=u>>16&255,s[c+1]=u>>8&255,s[c+2]=255&u}var h=new D(s,r.width,r.height);h.flipY=!0,h.minFilter=1003,h.magFilter=1003,this.pickingTex=h,this.addUniforms({map:{value:o},pickingMap:{value:h},mapSize:{value:new _(r.width,r.height)}}),this.geometry.addAttribute("uv",new me(Mf,2))}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={parameters:{},vertexShader:{},fragmentShader:{}};return i.parameters.get=function(){return Object.assign.call(this,{filter:{updateShader:!0,uniform:!0}},t.prototype.parameters)},e.prototype.getDefines=function(e){var i=t.prototype.getDefines.call(this,e);return this.filter.startsWith("cubic")&&(i.CUBIC_INTERPOLATION=1,this.filter.endsWith("bspline")?i.BSPLINE_FILTER=1:this.filter.endsWith("catmulrom")?i.CATMULROM_FILTER=1:this.filter.endsWith("mitchell")&&(i.MITCHELL_FILTER=1)),i},e.prototype.updateTexture=function(){var t=this.tex;this.filter.startsWith("cubic")?(t.minFilter=1003,t.magFilter=1003):"linear"===this.filter?(t.minFilter=1006,t.magFilter=1006):(t.minFilter=1003,t.magFilter=1003),t.needsUpdate=!0,this.pickingTex.needsUpdate=!0},e.prototype.makeMaterial=function(){t.prototype.makeMaterial.call(this),this.updateTexture();var e=this.material;e.uniforms.map.value=this.tex,e.blending=1,e.needsUpdate=!0;var i=this.wireframeMaterial;i.uniforms.map.value=this.tex,i.blending=1,i.needsUpdate=!0;var r=this.pickingMaterial;r.uniforms.map.value=this.tex,r.uniforms.pickingMap.value=this.pickingTex,r.blending=1,r.needsUpdate=!0},e.prototype.setUniforms=function(e){e&&void 0!==e.filter&&(this.updateTexture(),e.map=this.tex),t.prototype.setUniforms.call(this,e)},i.vertexShader.get=function(){return"Image.vert"},i.fragmentShader.get=function(){return"Image.frag"},Object.defineProperties(e.prototype,i),e}(xd),Tf=function(t,e){var i=e||{};this.dimension=Eo(i.dimension,"x"),this.positionType=Eo(i.positionType,"percent"),this.position=Eo(i.position,30),this.thresholdType=Eo(i.thresholdType,"sigma"),this.thresholdMin=Eo(i.thresholdMin,-1/0),this.thresholdMax=Eo(i.thresholdMax,1/0),this.normalize=Eo(i.normalize,!1),this.volume=t};Tf.prototype.getPositionFromCoordinate=function(t){var e,i=this.dimension,r=this.volume,n=r.matrix,o=(new O).setFromMatrixPosition(n)[i],a=(new O).setFromMatrixScale(n)[i];return e="x"===i?r.nx:"y"===i?r.ny:r.nz,Math.round(((t-o)/(e/100)+1)/a)},Tf.prototype.getData=function(t){t=t||{};var e,i=this.volume,r=i.data,n=i.matrix;function o(t){return Math.round(t/100*(e-1))}function a(t,e,r,n){return 3*(r*i.ny*i.nx+e*i.nx+t)+n}e="coordinate"===this.positionType?this.getPositionFromCoordinate(this.position):this.position;var s,c,u,h,l,p=new Float32Array(12),d=new O,f=0,m=0,g=0,v=i.nx,y=i.ny,b=i.nz;function x(t,e,i,r){d.set(t,e,i).applyMatrix4(n).toArray(p,r)}"x"===this.dimension?(u=o(i.nx),h=i.ny-1,l=i.nz-1,s=i.nz,c=i.ny,v=(f=u)+1,x(u,0,0,0),x(u,h,0,3),x(u,0,l,6),x(u,h,l,9)):"y"===this.dimension?(u=i.nx-1,h=o(i.ny),l=i.nz-1,s=i.nz,c=i.nx,y=(m=h)+1,x(0,h,0,0),x(u,h,0,3),x(0,h,l,6),x(u,h,l,9)):"z"===this.dimension&&(u=i.nx-1,h=i.ny-1,l=o(i.nz),s=i.nx,c=i.ny,b=(g=l)+1,x(0,0,l,0),x(0,h,l,3),x(u,0,l,6),x(u,h,l,9));var _,w,S=0,A=0,M=new Uint8Array(s*c*4),P=new Float32Array(s*c);"sigma"===this.thresholdType?(_=i.getValueForSigma(this.thresholdMin),w=i.getValueForSigma(this.thresholdMax)):(_=this.thresholdMin,w=this.thresholdMax);var T=Object.assign({},t.colorParams,{volume:i});this.normalize&&(T.domain=[0,1]);var E,C,I,R=yc.getScheme(T),L=new Float32Array(3),N=R.getScale();if(this.normalize){E=1/0,C=-1/0;for(var D=m;D<y;++D)for(var k=f;k<v;++k)for(var F=g;F<b;++F){var B=r[a(k,D,F,0)/3];B<E&&(E=B),B>C&&(C=B)}I=C-E}for(var z=m;z<y;++z)for(var U=f;U<v;++U)for(var j=g;j<b;++j){var G=a(U,z,j,0)/3,V=r[G];this.normalize&&(V=(V-E)/I),R.colorToArray(N(V),L),M[S]=Math.round(255*L[0]),M[S+1]=Math.round(255*L[1]),M[S+2]=Math.round(255*L[2]),M[S+3]=V>_&&V<w?255:0,P[A]=G,++A,S+=4}var $=new nl(P,i);return{position:p,imageData:M,width:s,height:c,picking:$}};var Ef=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="slice",this.parameters=Object.assign({filter:{type:"select",buffer:!0,options:{nearest:"nearest",linear:"linear","cubic-bspline":"cubic-bspline","cubic-catmulrom":"cubic-catmulrom","cubic-mitchell":"cubic-mitchell"}},positionType:{type:"select",rebuild:!0,options:{percent:"percent",coordinate:"coordinate"}},position:{type:"range",step:.1,max:100,min:1,rebuild:!0},dimension:{type:"select",rebuild:!0,options:{x:"x",y:"y",z:"z"}},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},normalize:{type:"boolean",rebuild:!0}},this.parameters,{flatShaded:null,side:null,wireframe:null,linewidth:null,colorScheme:null,roughness:null,metalness:null,diffuse:null}),this.volume=e,this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=this.volume,r=e||{};r.colorDomain=Eo(r.colorDomain,[i.min,i.max]),r.colorScheme=Eo(r.colorScheme,"value"),r.colorScale=Eo(r.colorScale,"Spectral"),this.colorScheme="value",this.dimension=Eo(r.dimension,"x"),this.filter=Eo(r.filter,"cubic-bspline"),this.positionType=Eo(r.positionType,"percent"),this.position=Eo(r.position,30),this.thresholdType=Eo(r.thresholdType,"sigma"),this.thresholdMin=Eo(r.thresholdMin,-1/0),this.thresholdMax=Eo(r.thresholdMax,1/0),this.normalize=Eo(r.normalize,!1),t.prototype.init.call(this,r),this.build()},e.prototype.attach=function(t){var e=this;this.bufferList.forEach((function(t){e.viewer.add(t)})),this.setVisibility(this.visible),t()},e.prototype.create=function(){var t=new Tf(this.volume,{positionType:this.positionType,position:this.position,dimension:this.dimension,thresholdType:this.thresholdType,thresholdMin:this.thresholdMin,thresholdMax:this.thresholdMax,normalize:this.normalize}),e=new Pf(t.getData({colorParams:this.getColorParams()}),this.getBufferParams({filter:this.filter}));this.bufferList.push(e)},e}(df),Cf=function(t){function e(e,i,r){var n=r||{};if(t.call(this,e,i,n),this.type="structure",this.parameters=Object.assign({radiusType:{type:"select",options:Il.types},radius:{type:"number",precision:3,max:10,min:.001},scale:{type:"number",precision:3,max:10,min:.001},assembly:null,defaultAssembly:{type:"hidden"}},this.parameters),this.selection=new nc(n.sele),this.dataList=[],this.structure=e,this.structureView=this.structure.getView(this.selection),e.biomolDict){var o={default:"default","":e.unitcell?"AU":"FULL"};Object.keys(e.biomolDict).forEach((function(t){o[t]=t})),this.parameters.assembly={type:"select",options:o,rebuild:!0}}else this.parameters.assembly=null}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={defaultScale:{}};return i.defaultScale.get=function(){return{vdw:1,covalent:1,bfactor:.01,sstruc:1}},e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"element"),this.radius=Eo(i.radius,"vdw"),this.scale=Eo(i.scale,1),this.assembly=Eo(i.assembly,"default"),this.defaultAssembly=Eo(i.defaultAssembly,""),"auto"===i.quality&&(i.quality=this.getQuality()),t.prototype.init.call(this,i),this.selection.signals.stringChanged.add((function(){this.build()}),this),this.build()},e.prototype.getAssembly=function(){var t="default"===this.assembly?this.defaultAssembly:this.assembly;return this.structure.biomolDict[t]},e.prototype.getQuality=function(){var t,e=this.structureView,i=this.getAssembly();return t=i?i.getAtomCount(e):e.atomCount,lc&&(t*=4),e.atomStore.count/e.residueStore.count<2&&(t*=10),t<15e3?"high":t<8e4?"medium":"low"},e.prototype.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 r=this.createData(i,e);r&&(r.sview=i,r.instanceList=t.getInstanceList(),this.dataList.push(r))}}),this);else{var e=this.createData(this.structureView,0);e&&(e.sview=this.structureView,this.dataList.push(e))}}},e.prototype.createData=function(){console.error("createData not implemented")},e.prototype.update=function(t){!this.lazy||this.visible?this.dataList.forEach((function(e){e.bufferList.length>0&&this.updateData(t,e)}),this):Object.assign(this.lazyProps.what,t)},e.prototype.updateData=function(){this.build()},e.prototype.getColorParams=function(){var e=t.prototype.getColorParams.call(this);return e.structure=this.structure,e},e.prototype.getAtomParams=function(t,e){return Object.assign({what:t,colorParams:this.getColorParams(),radiusParams:{radius:this.radius,scale:this.scale}},e)},e.prototype.getBondParams=function(t,e){return Object.assign({what:t,colorParams:this.getColorParams(),radiusParams:{radius:this.radius,scale:this.scale}},e)},e.prototype.setSelection=function(t,e){return this.selection.setString(t,e),this},e.prototype.setParameters=function(e,i,r){return i=i||{},e&&void 0!==e.radiusType&&("size"===e.radiusType?this.radius=1:this.radius=e.radiusType,delete e.radiusType,i.radius=!0,dc&&!this.disableImpostor||(r=!0)),e&&void 0!==e.radius&&(i.radius=!0,dc&&!this.disableImpostor||(r=!0)),e&&void 0!==e.scale&&(i.radius=!0,dc&&!this.disableImpostor||(r=!0)),e&&void 0!==e.defaultAssembly&&(r=!0),t.prototype.setParameters.call(this,e,i,r),this},e.prototype.getParameters=function(){return Object.assign(t.prototype.getParameters.call(this),{sele:this.selection?this.selection.string:void 0,defaultAssembly:this.defaultAssembly})},e.prototype.attach=function(t){var e=this.viewer,i=this.bufferList;this.dataList.forEach((function(t){t.bufferList.forEach((function(r){i.push(r),e.add(r,t.instanceList)}))})),this.setVisibility(this.visible),t()},e.prototype.clear=function(){this.dataList.length=0,t.prototype.clear.call(this)},e.prototype.dispose=function(){this.structureView.dispose(),delete this.structure,delete this.structureView,t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,i),e}(df),If=function(t){function e(e,i){var r=4*(e.position1.length/3);t.call(this,{position:new Float32Array(3*r),color:new Float32Array(3*r)},i),this.setAttributes(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isLine:{},vertexShader:{},fragmentShader:{}};return e.prototype.setAttributes=function(t){var e,i,r,n,o,a,s=this.geometry.attributes;t.position1&&t.position2&&(e=t.position1,i=t.position2,o=s.position.array,s.position.needsUpdate=!0),t.color&&t.color2&&(r=t.color,n=t.color2,a=s.color.array,s.color.needsUpdate=!0);for(var c,u,h,l,p,d,f,m,g,v,y,b=this.size,x=0;x<b;x++)u=3*x,c=4*x*3,e&&i&&(d=e[u],f=e[u+1],m=e[u+2],h=(d+(g=i[u]))/2,l=(f+(v=i[u+1]))/2,p=(m+(y=i[u+2]))/2,o[c]=d,o[c+1]=f,o[c+2]=m,o[c+3]=h,o[c+4]=l,o[c+5]=p,o[c+6]=h,o[c+7]=l,o[c+8]=p,o[c+9]=g,o[c+10]=v,o[c+11]=y),r&&n&&(a[c]=a[c+3]=r[u],a[c+1]=a[c+4]=r[u+1],a[c+2]=a[c+5]=r[u+2],a[c+6]=a[c+9]=n[u],a[c+7]=a[c+10]=n[u+1],a[c+8]=a[c+11]=n[u+2])},i.isLine.get=function(){return!0},i.vertexShader.get=function(){return"Line.vert"},i.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,i),e}(xd),Rf=function(t){function e(e,i,r){t.call(this,e.structure,i,r),this.type="trajectory",this.parameters=Object.assign({drawLine:{type:"boolean",rebuild:!0},drawCylinder:{type:"boolean",rebuild:!0},drawPoint:{type:"boolean",rebuild:!0},drawSphere:{type:"boolean",rebuild:!0},linewidth:{type:"integer",max:20,min:1,rebuild:!0},pointSize:{type:"integer",max:20,min:1,rebuild:!0},sizeAttenuation:{type:"boolean",rebuild:!0},sort:{type:"boolean",rebuild:!0}},this.parameters),this.manualAttach=!0,this.trajectory=e,this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"uniform"),i.colorValue=Eo(i.colorValue,14540253),this.drawLine=Eo(i.drawLine,!0),this.drawCylinder=Eo(i.drawCylinder,!1),this.drawPoint=Eo(i.drawPoint,!1),this.drawSphere=Eo(i.drawSphere,!1),this.pointSize=Eo(i.pointSize,1),this.sizeAttenuation=Eo(i.sizeAttenuation,!1),this.sort=Eo(i.sort,!0),t.prototype.init.call(this,i)},e.prototype.attach=function(t){var e=this;this.bufferList.forEach((function(t){e.viewer.add(t)})),this.setVisibility(this.visible),t()},e.prototype.prepare=function(t){t()},e.prototype.create=function(){if(0!==this.atomSet.atomCount){var t=this,e=this.atomSet.atoms[0].index;this.trajectory.getPath(e,(function(e){var i=e.length/3,r=new St(t.colorValue);if(t.drawSphere){var n=new Od({position:e,color:au(i,r.r,r.g,r.b),radius:ou(i,.2)},t.getBufferParams({sphereDetail:t.sphereDetail,dullInterior:!0,disableImpostor:t.disableImpostor}));t.bufferList.push(n)}if(t.drawCylinder){var o=new qd({position1:e.subarray(0,-3),position2:e.subarray(3),color:au(i-1,r.r,r.g,r.b),color2:au(i-1,r.r,r.g,r.b),radius:ou(i,.05)},t.getBufferParams({openEnded:!1,radialSegments:t.radialSegments,disableImpostor:t.disableImpostor,dullInterior:!0}));t.bufferList.push(o)}if(t.drawPoint){var a=new wf({position:e,color:au(i,r.r,r.g,r.b)},t.getBufferParams({pointSize:t.pointSize,sizeAttenuation:t.sizeAttenuation,sort:t.sort}));t.bufferList.push(a)}if(t.drawLine){var s=new If({position1:e.subarray(0,-3),position2:e.subarray(3),color:au(i-1,r.r,r.g,r.b),color2:au(i-1,r.r,r.g,r.b)},t.getBufferParams());t.bufferList.push(s)}t.attach()}))}},e}(Cf);function Lf(t){mc.error("makeRepresentation: representation type "+t+" unknown")}var Of=0,Nf=new N,Df=new O,kf=function(t,e){Object.defineProperty(this,"id",{value:Of++});var i=e||{};this.name=i.name,this.uuid=Ps(),this.visible=void 0===i.visible||i.visible,this.signals={representationAdded:new Fs,representationRemoved:new Fs,visibilityChanged:new Fs,matrixChanged:new Fs,statusChanged:new Fs,nameChanged:new Fs,disposed:new Fs},this.stage=t,this.viewer=t.viewer,this.reprList=[],this.annotationList=[],this.matrix=new N,this.position=new O,this.quaternion=new L,this.scale=new O(1,1,1),this.transform=new N,this.controls=new bh(this)},Ff={type:{}};Ff.type.get=function(){return"component"},kf.prototype.setPosition=function(t){return Array.isArray(t)?this.position.fromArray(t):this.position.copy(t),this.updateMatrix(),this},kf.prototype.setRotation=function(t){if(Array.isArray(t))if(3===t.length){var e=(new qt).fromArray(t);this.quaternion.setFromEuler(e)}else this.quaternion.fromArray(t);else t instanceof qt?this.quaternion.setFromEuler(t):this.quaternion.copy(t);return this.updateMatrix(),this},kf.prototype.setScale=function(t){return this.scale.set(t,t,t),this.updateMatrix(),this},kf.prototype.setTransform=function(t){return this.transform.copy(t),this.updateMatrix(),this},kf.prototype.updateMatrix=function(){var t=this,e=this.getCenterUntransformed(Df);this.matrix.makeTranslation(-e.x,-e.y,-e.z),Nf.makeRotationFromQuaternion(this.quaternion),this.matrix.premultiply(Nf),Nf.makeScale(this.scale.x,this.scale.y,this.scale.z),this.matrix.premultiply(Nf);var i=this.position;Nf.makeTranslation(i.x+e.x,i.y+e.y,i.z+e.z),this.matrix.premultiply(Nf),this.matrix.premultiply(this.transform),this.reprList.forEach((function(e){e.setParameters({matrix:t.matrix})})),this.stage.viewer.updateBoundingBox(),this.signals.matrixChanged.dispatch(this.matrix)},kf.prototype.addAnnotation=function(t,e,i){var r=new mh(this,t,e,i);return this.annotationList.push(r),r},kf.prototype.removeAnnotation=function(t){var e=this.annotationList.indexOf(t);-1!==e&&(this.annotationList.splice(e,1),t.dispose())},kf.prototype.removeAllAnnotations=function(){this.annotationList.forEach((function(t){t.dispose()})),this.annotationList.length=0},kf.prototype.addRepresentation=function(t,e,i){var r=i||{},n=this.stage.getParameters();r.matrix=this.matrix.clone(),r.quality=r.quality||n.quality,r.disableImpostor=Eo(r.disableImpostor,!n.impostor),r.useWorker=Eo(r.useWorker,n.workerDefault),r.visible=Eo(r.visible,!0);var o=Object.assign({},r,{visible:this.visible&&r.visible}),a=function(t,e,i,r){var n;if(gc&&mc.time("makeRepresentation "+t),e instanceof ld){if(!(n=xc.get(t)))return void Lf(t)}else if(e instanceof cp)if("surface"===t)n=_f;else{if("dot"!==t)return void Lf(t);n=Sf}else if(e instanceof lp)if("surface"===t)n=_f;else if("dot"===t)n=Sf;else{if("slice"!==t)return void Lf(t);n=Ef}else if(e instanceof gd)n=Rf;else if(e instanceof lf)n=ff,e=e.getBufferList();else{if("buffer"!==t)return void mc.error("makeRepresentation: object "+e+" unknown");n=ff}var o=new n(e,i,r);return gc&&mc.timeEnd("makeRepresentation "+t),o}(t,e,this.viewer,o),s=this.__getRepresentationComponent(a,r);return this.reprList.push(s),this.signals.representationAdded.dispatch(s),s},kf.prototype.addBufferRepresentation=function(t,e){return kf.prototype.addRepresentation.call(this,"buffer",t,e)},kf.prototype.hasRepresentation=function(t){return-1!==this.reprList.indexOf(t)},kf.prototype.removeRepresentation=function(t){var e=this.reprList.indexOf(t);-1!==e&&(this.reprList.splice(e,1),t.dispose(),this.signals.representationRemoved.dispatch(t))},kf.prototype.updateRepresentations=function(t){this.reprList.forEach((function(e){e.update(t)})),this.stage.viewer.requestRender()},kf.prototype.removeAllRepresentations=function(){this.reprList.slice(0).forEach((function(t){t.dispose()}))},kf.prototype.dispose=function(){this.removeAllAnnotations(),this.removeAllRepresentations(),delete this.annotationList,delete this.reprList,this.signals.disposed.dispatch()},kf.prototype.setVisibility=function(t){return this.visible=t,this.eachRepresentation((function(t){t.updateVisibility()})),this.annotationList.forEach((function(t){t.updateVisibility()})),this.signals.visibilityChanged.dispatch(t),this},kf.prototype.setStatus=function(t){return this.status=t,this.signals.statusChanged.dispatch(t),this},kf.prototype.setName=function(t){return this.name=t,this.signals.nameChanged.dispatch(t),this},kf.prototype.getBox=function(){return(t=this).getBoxUntransformed.apply(t,arguments).clone().applyMatrix4(this.matrix);var t},kf.prototype.getCenter=function(){return(t=this).getCenterUntransformed.apply(t,arguments).clone().applyMatrix4(this.matrix);var t},kf.prototype.getZoom=function(){return this.stage.getZoomForBox((t=this).getBox.apply(t,arguments));var t},kf.prototype.getBoxUntransformed=function(){},kf.prototype.getCenterUntransformed=function(){return this.getBoxUntransformed().getCenter()},kf.prototype.autoView=function(t){this.stage.animationControls.zoomMove(this.getCenter(),this.getZoom(),Eo(t,0))},kf.prototype.eachRepresentation=function(t){this.reprList.forEach(t)},Object.defineProperties(kf.prototype,Ff),kf.prototype.__getRepresentationComponent=function(t,e){return new Bf(this.stage,t,e,this)};var Bf=function(t){function e(e,i,r,n){var o=r||{};o.name=Eo(o.name,i.type),t.call(this,e,o),this.signals=Object.assign(this.signals,{parametersChanged:new Fs}),this.parent=n,this.setRepresentation(i)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"representation"},e.prototype.getType=function(){return this.repr.type},e.prototype.setRepresentation=function(t){this.disposeRepresentation(),this.repr=t,this.stage.tasks.listen(this.repr.tasks),this.updateVisibility()},e.prototype.addRepresentation=function(){},e.prototype.removeRepresentation=function(){},e.prototype.hasRepresentation=function(){},e.prototype.disposeRepresentation=function(){this.repr&&(this.stage.tasks.unlisten(this.repr.tasks),this.repr.dispose())},e.prototype.dispose=function(){this.parent&&this.parent.hasRepresentation(this)?this.parent.removeRepresentation(this):(this.disposeRepresentation(),this.signals.disposed.dispatch())},e.prototype.setVisibility=function(t){return this.visible=t,this.updateVisibility(),this.signals.visibilityChanged.dispatch(this.visible),this},e.prototype.getVisibility=function(){return this.parent?this.parent.visible&&this.visible:this.visible},e.prototype.toggleVisibility=function(){return this.setVisibility(!this.visible)},e.prototype.updateVisibility=function(){this.repr.setVisibility(this.getVisibility())},e.prototype.update=function(t){return this.repr.update(t),this},e.prototype.build=function(t){return this.repr.build(t),this},e.prototype.setSelection=function(t){return this.repr.setSelection(t),this},e.prototype.setParameters=function(t){return this.repr.setParameters(t),this.signals.parametersChanged.dispatch(this.repr.getParameters()),this},e.prototype.getParameters=function(){return this.repr.getParameters()},e.prototype.setColor=function(t){return this.repr.setColor(t),this},e.prototype.getCenter=function(){},e.prototype.getZoom=function(){},e.prototype.getBox=function(){},Object.defineProperties(e.prototype,i),e}(kf),zf=function(t){this.list=t||[];for(var e=this.list.length,i=0;i<e;++i){this.list[i].signals.disposed.add(this._remove,this)}};zf.prototype._remove=function(t){var e=this.list.indexOf(t);-1!==e&&this.list.splice(e,1)},zf.prototype._invoke=function(t,e){for(var i=this.list.length,r=0;r<i;++r){var n=this.list[r],o=n[t];"function"==typeof o&&o.apply(n,e)}return this},zf.prototype.setVisibility=function(t){return this._invoke("setVisibility",[t])},zf.prototype.setSelection=function(t){return this._invoke("setSelection",[t])},zf.prototype.dispose=function(){return this._invoke("dispose")};var Uf=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.addRepresentation=function(t,e){return this._invoke("addRepresentation",[t,e])},e.prototype.autoView=function(t){return this._invoke("autoView",[t])},e}(zf),jf=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setParameters=function(t){return this._invoke("setParameters",[t])},e.prototype.setColor=function(t){return this._invoke("setColor",[t])},e}(zf);function Gf(t,e){return t instanceof RegExp?null!==e.name.match(t):e.name===t}var Vf=new O,$f=function(t,e){if(this.signals={parametersChanged:new Fs,fullscreenChanged:new Fs,componentAdded:new Fs,componentRemoved:new Fs,clicked:new Fs,hovered:new Fs},this.tasks=new $c,this.compList=[],this.defaultFileParams={},this.viewer=new wu(t),this.viewer.renderer){this.tooltip=document.createElement("div"),Object.assign(this.tooltip.style,{display:"none",position:"fixed",zIndex:2+(parseInt(this.viewer.container.style.zIndex)||0),pointerEvents:"none",backgroundColor:"rgba( 0, 0, 0, 0.6 )",color:"lightgrey",padding:"8px",fontFamily:"sans-serif"}),document.body.appendChild(this.tooltip),this.mouseObserver=new Au(this.viewer.renderer.domElement),this.viewerControls=new Wu(this),this.trackballControls=new Ou(this),this.pickingControls=new Fu(this),this.animationControls=new oh(this),this.mouseControls=new hh(this),this.pickingBehavior=new lh(this),this.mouseBehavior=new ph(this),this.animationBehavior=new dh(this),this.keyBehavior=new fh(this),this.spinAnimation=this.animationControls.spin([0,1,0],.005),this.spinAnimation.pause(!0),this.rockAnimation=this.animationControls.rock([0,1,0],.005),this.rockAnimation.pause(!0);var i=Object.assign({impostor:!0,quality:"medium",workerDefault:!0,sampleLevel:0,backgroundColor:"black",rotateSpeed:2,zoomSpeed:1.2,panSpeed:1,clipNear:0,clipFar:100,clipDist:10,fogNear:50,fogFar:100,cameraFov:40,cameraType:"perspective",lightColor:14540253,lightIntensity:1,ambientColor:14540253,ambientIntensity:.2,hoverTimeout:0,tooltip:!0,mousePreset:"default"},e);this.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"},workerDefault:{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:-1},tooltip:{type:"boolean"},mousePreset:{type:"select",options:{default:"default",pymol:"pymol",coot:"coot"}}},this.setParameters(i),this.viewer.animate()}};$f.prototype.setParameters=function(t){var e=Object.assign({},t),i=this.parameters,r=this.viewer,n=this.trackballControls;for(var o in e)void 0!==e[o]&&i[o]&&(i[o].int&&(e[o]=parseInt(e[o])),i[o].float&&(e[o]=parseFloat(e[o])),i[o].value=e[o]);return void 0!==e.quality&&this.setQuality(e.quality),void 0!==e.impostor&&this.setImpostor(e.impostor),void 0!==e.rotateSpeed&&(n.rotateSpeed=e.rotateSpeed),void 0!==e.zoomSpeed&&(n.zoomSpeed=e.zoomSpeed),void 0!==e.panSpeed&&(n.panSpeed=e.panSpeed),void 0!==e.mousePreset&&this.mouseControls.preset(e.mousePreset),this.mouseObserver.setParameters({hoverTimeout:e.hoverTimeout}),r.setClip(e.clipNear,e.clipFar,e.clipDist),r.setFog(void 0,e.fogNear,e.fogFar),r.setCamera(e.cameraType,e.cameraFov),r.setSampling(e.sampleLevel),r.setBackground(e.backgroundColor),r.setLight(e.lightColor,e.lightIntensity,e.ambientColor,e.ambientIntensity),this.signals.parametersChanged.dispatch(this.getParameters()),this},$f.prototype.getParameters=function(){var t={};for(var e in this.parameters)t[e]=this.parameters[e].value;return t},$f.prototype.defaultFileRepresentation=function(t){if("structure"===t.type){var e,i,r;t.setSelection("/0");var n=t.structure;if(n.biomolDict.BU1){var o=n.biomolDict.BU1;e=o.getAtomCount(n),i=o.getResidueCount(n),r=o.getInstanceCount(),t.setDefaultAssembly("BU1")}else e=n.getModelProxy(0).atomCount,i=n.getModelProxy(0).residueCount,r=1;var a=e;lc&&(a*=4);var s=n.atomStore.count/n.residueStore.count<2;s&&(a*=10);var c="chainname",u="RdYlBu",h=!1;if(1===n.getChainnameCount("polymer and /0")&&(c="residueindex",u="spectral",h=!0),gc&&console.log(a,e,r,s),i/r<4)t.addRepresentation("ball+stick",{colorScheme:"element",scale:2,aspectRatio:1.5,bondScale:.3,bondSpacing:.75,quality:"auto"});else if(r>5&&a>15e3||a>7e5){var l=Math.min(1.5,Math.max(.1,2e3/(a/r)));s&&(l=Math.min(l,.15)),t.addRepresentation("surface",{sele:"polymer",surfaceType:"sas",probeRadius:1.4,scaleFactor:l,colorScheme:c,colorScale:u,colorReverse:h,useWorker:!1})}else a>25e4?t.addRepresentation("backbone",{lineOnly:!0,colorScheme:c,colorScale:u,colorReverse:h}):a>1e5?t.addRepresentation("backbone",{quality:"low",disableImpostor:!0,colorScheme:c,colorScale:u,colorReverse:h,scale:2}):a>8e4?t.addRepresentation("backbone",{colorScheme:c,colorScale:u,colorReverse:h,scale:2}):(t.addRepresentation("cartoon",{colorScheme:c,colorScale:u,colorReverse:h,scale:.7,aspectRatio:5,quality:"auto"}),a<5e4&&t.addRepresentation("base",{colorScheme:c,colorScale:u,colorReverse:h,quality:"auto"}),t.addRepresentation("ball+stick",{sele:"ligand",colorScheme:"element",scale:2,aspectRatio:1.5,bondScale:.3,bondSpacing:.75,quality:"auto"}));t.structure.frames.length&&t.addTrajectory()}else"surface"!==t.type&&"volume"!==t.type||t.addRepresentation("surface");this.tasks.onZeroOnce(this.autoView,this)},$f.prototype.loadFile=function(t,e){var i=Object.assign({},this.defaultFileParams,e),r=new kf(this,i);r.name=Lo(t).name,this.addComponent(r);var n=this.tasks;n.increment();var o=function(t){return this.removeComponent(r),"script"===(r=this.addComponentFromObject(t,i)).type?r.run():i.defaultRepresentation&&this.defaultFileRepresentation(r),n.decrement(),r}.bind(this);return("dcd"===Eo(i.ext,Lo(t).ext)?Promise.reject(new Error("loadFile: ext 'dcd' must be loaded into a structure component")):Bc(t,i)).then(o,(function(t){throw r.setStatus(t),n.decrement(),t}))},$f.prototype.addComponent=function(t){t?(this.compList.push(t),this.signals.componentAdded.dispatch(t)):mc.warn("Stage.addComponent: no component given")},$f.prototype.addComponentFromObject=function(t,e){var i=Ac.get(t.type);if(i){var r=new i(this,t,e);return this.addComponent(r),r}mc.warn("no component for object type",t.type)},$f.prototype.removeComponent=function(t){var e=this.compList.indexOf(t);-1!==e&&(this.compList.splice(e,1),t.dispose(),this.signals.componentRemoved.dispatch(t))},$f.prototype.removeAllComponents=function(t){this.compList.slice().forEach((function(e){t&&e.type!==t||this.removeComponent(e)}),this)},$f.prototype.handleResize=function(){this.viewer.handleResize()},$f.prototype.setSize=function(t,e){var i=this.viewer.container;i!==document.body&&(void 0!==t&&(i.style.width=t),void 0!==e&&(i.style.height=e),this.handleResize())},$f.prototype.toggleFullscreen=function(t){if(document.fullscreenEnabled||document.mozFullScreenEnabled||document.webkitFullscreenEnabled||document.msFullscreenEnabled){var e=this;t=t||this.viewer.container,this.lastFullscreenElement=t,i()?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=window.screen.width+"px",t.style.height=window.screen.height+"px",t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen(),document.addEventListener("fullscreenchange",r),document.addEventListener("mozfullscreenchange",r),document.addEventListener("webkitfullscreenchange",r),document.addEventListener("MSFullscreenChange",r),this.handleResize(),this.signals.fullscreenChanged.dispatch(!0),setTimeout((function(){e.handleResize()}),100))}else mc.log("fullscreen mode (currently) not possible");function i(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement}function r(){if(!i()&&e.lastFullscreenElement){var t=e.lastFullscreenElement;t.style.width=t.dataset.normalWidth,t.style.height=t.dataset.normalHeight,document.removeEventListener("fullscreenchange",r),document.removeEventListener("mozfullscreenchange",r),document.removeEventListener("webkitfullscreenchange",r),document.removeEventListener("MSFullscreenChange",r),e.handleResize(),e.signals.fullscreenChanged.dispatch(!1)}}},$f.prototype.setSpin=function(t){t?(this.spinAnimation.resume(!0),this.rockAnimation.pause(!0)):this.spinAnimation.pause(!0)},$f.prototype.setRock=function(t){t?(this.rockAnimation.resume(!0),this.spinAnimation.pause(!0)):this.rockAnimation.pause(!0)},$f.prototype.toggleSpin=function(){this.setSpin(this.spinAnimation.paused)},$f.prototype.toggleRock=function(){this.setRock(this.rockAnimation.paused)},$f.prototype.setFocus=function(t){var e=Ts(t/2,0,49.9),i=100-e,r=(i-e)/2;this.setParameters({clipNear:e,clipFar:i,fogNear:Es(i-r),fogFar:Es(i+r)})},$f.prototype.getZoomForBox=function(t){var e=t.getSize(Vf),i=Math.max(e.x,e.y,e.z),r=Math.min(e.x,e.y,e.z),n=i+Math.sqrt(r),o=Qo(this.viewer.perspectiveCamera.fov),a=this.viewer.width,s=this.viewer.height,c=s<a?1:a/s;return n=Math.abs(.5*n/c/Math.sin(o/2)),-(n+=this.parameters.clipDist.value)},$f.prototype.getBox=function(){return this.viewer.boundingBox},$f.prototype.getZoom=function(){return this.getZoomForBox(this.getBox())},$f.prototype.getCenter=function(t){return this.getBox().getCenter(t)},$f.prototype.autoView=function(t){this.animationControls.zoomMove(this.getCenter(),this.getZoom(),Eo(t,0))},$f.prototype.makeImage=function(t){var e=this.viewer,i=this.tasks;return new Promise((function(r,n){i.onZeroOnce((function(){i.increment(),e.makeImage(t).then((function(t){i.decrement(),r(t)})).catch((function(t){i.decrement(),n(t)}))}))}))},$f.prototype.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 r=i.getParameters();r.disableImpostor=!t,i.build(r)}}))},$f.prototype.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(r){if("script"!==r.type){var n=r.getParameters();if(!e.includes(r.getType())){if(!i.includes(r.getType()))return;if(!n.disableImpostor)return void(r.repr.quality=t)}n.quality=t,r.build(n)}}))},$f.prototype.eachComponent=function(t,e){this.compList.slice().forEach((function(i,r){e&&i.type!==e||t(i,r)}))},$f.prototype.eachRepresentation=function(t,e){this.eachComponent((function(e){e.reprList.slice().forEach((function(i){t(i,e)}))}),e)},$f.prototype.getComponentsByName=function(t,e){var i=[];return this.eachComponent((function(e){(void 0===t||Gf(t,e))&&i.push(e)}),e),new Uf(i)},$f.prototype.getComponentsByObject=function(t){var e=[];return this.eachComponent((function(i){i[i.type]===t&&e.push(i)})),new Uf(e)},$f.prototype.getRepresentationsByName=function(t,e){var i,r;"object"!=typeof t||t instanceof RegExp?(i=void 0,r=t):(i=t.comp,r=t.repr);var n=[];return this.eachRepresentation((function(t,e){(void 0===i||Gf(i,e))&&(void 0===r||Gf(r,t))&&n.push(t)}),e),new jf(n)},$f.prototype.getAnythingByName=function(t){var e=this.getComponentsByName(t).list,i=this.getRepresentationsByName(t).list;return new zf(e.concat(i))},$f.prototype.dispose=function(){this.tasks.dispose()};var Hf=[[4,0,-2,-1,-2,0,-2,-1,-1,-1,-1,-2,-1,-1,-1,1,0,0,-3,-2],[0,9,-3,-4,-2,-3,-3,-1,-3,-1,-1,-3,-3,-3,-3,-1,-1,-1,-2,-2],[-2,-3,6,2,-3,-1,-1,-3,-1,-4,-3,1,-1,0,-2,0,-1,-3,-4,-3],[-1,-4,2,5,-3,-2,0,-3,1,-3,-2,0,-1,2,0,0,-1,-2,-3,-2],[-2,-2,-3,-3,6,-3,-1,0,-3,0,0,-3,-4,-3,-3,-2,-2,-1,1,3],[0,-3,-1,-2,-3,6,-2,-4,-2,-4,-3,0,-2,-2,-2,0,-2,-3,-2,-3],[-2,-3,-1,0,-1,-2,8,-3,-1,-3,-2,1,-2,0,0,-1,-2,-3,-2,2],[-1,-1,-3,-3,0,-4,-3,4,-3,2,1,-3,-3,-3,-3,-2,-1,3,-3,-1],[-1,-3,-1,1,-3,-2,-1,-3,5,-2,-1,0,-1,1,2,0,-1,-2,-3,-2],[-1,-1,-4,-3,0,-4,-3,2,-2,4,2,-3,-3,-2,-2,-2,-1,1,-2,-1],[-1,-1,-3,-2,0,-3,-2,1,-1,2,5,-2,-2,0,-1,-1,-1,1,-1,-1],[-2,-3,1,0,-3,0,1,-3,0,-3,-2,6,-2,0,0,1,0,-3,-4,-2],[-1,-3,-1,-1,-4,-2,-2,-3,-1,-3,-2,-2,7,-1,-2,-1,-1,-2,-4,-3],[-1,-3,0,2,-3,-2,0,-3,1,-2,0,0,-1,5,1,0,-1,-2,-2,-1],[-1,-3,-2,0,-3,-2,0,-3,2,-2,-1,0,-2,1,5,-1,-1,-3,-3,-2],[1,-1,0,0,-2,0,-1,-2,0,-2,-1,1,-1,0,-1,4,1,-2,-3,-2],[0,-1,-1,-1,-2,-2,-2,-1,-1,-1,-1,0,-1,-1,-1,1,5,0,-2,-2],[0,-1,-3,-2,-1,-3,-3,3,-2,1,1,-3,-2,-2,-3,-2,0,4,-3,-1],[-3,-2,-4,-3,1,-2,-2,-3,-3,-2,-1,-4,-4,-2,-3,-3,-2,-3,11,2],[-2,-2,-3,-2,3,-3,2,-1,-2,-1,-1,-2,-3,-1,-2,-2,-2,-1,2,7]];function Wf(t,e){var i,r=0,n={};return e.forEach((function(e){i=0;var o={};e.forEach((function(e){o[t[i++]]=e})),n[t[r++]]=o})),n}var Xf={blosum62:Wf("ARNDCQEGHILKMFPSTWYVBZ?",[[4,-1,-2,-2,0,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-3,-2,0,-2,-1,0],[-1,5,0,-2,-3,1,0,-2,0,-3,-2,2,-1,-3,-2,-1,-1,-3,-2,-3,-1,0,-1],[-2,0,6,1,-3,0,0,0,1,-3,-3,0,-2,-3,-2,1,0,-4,-2,-3,3,0,-1],[-2,-2,1,6,-3,0,2,-1,-1,-3,-4,-1,-3,-3,-1,0,-1,-4,-3,-3,4,1,-1],[0,-3,-3,-3,9,-3,-4,-3,-3,-1,-1,-3,-1,-2,-3,-1,-1,-2,-2,-1,-3,-3,-2],[-1,1,0,0,-3,5,2,-2,0,-3,-2,1,0,-3,-1,0,-1,-2,-1,-2,0,3,-1],[-1,0,0,2,-4,2,5,-2,0,-3,-3,1,-2,-3,-1,0,-1,-3,-2,-2,1,4,-1],[0,-2,0,-1,-3,-2,-2,6,-2,-4,-4,-2,-3,-3,-2,0,-2,-2,-3,-3,-1,-2,-1],[-2,0,1,-1,-3,0,0,-2,8,-3,-3,-1,-2,-1,-2,-1,-2,-2,2,-3,0,0,-1],[-1,-3,-3,-3,-1,-3,-3,-4,-3,4,2,-3,1,0,-3,-2,-1,-3,-1,3,-3,-3,-1],[-1,-2,-3,-4,-1,-2,-3,-4,-3,2,4,-2,2,0,-3,-2,-1,-2,-1,1,-4,-3,-1],[-1,2,0,-1,-3,1,1,-2,-1,-3,-2,5,-1,-3,-1,0,-1,-3,-2,-2,0,1,-1],[-1,-1,-2,-3,-1,0,-2,-3,-2,1,2,-1,5,0,-2,-1,-1,-1,-1,1,-3,-1,-1],[-2,-3,-3,-3,-2,-3,-3,-3,-1,0,0,-3,0,6,-4,-2,-2,1,3,-1,-3,-3,-1],[-1,-2,-2,-1,-3,-1,-1,-2,-2,-3,-3,-1,-2,-4,7,-1,-1,-4,-3,-2,-2,-1,-2],[1,-1,1,0,-1,0,0,0,-1,-2,-2,0,-1,-2,-1,4,1,-3,-2,-2,0,0,0],[0,-1,0,-1,-1,-1,-1,-2,-2,-1,-1,-1,-1,-2,-1,1,5,-2,-2,0,-1,-1,0],[-3,-3,-4,-4,-2,-2,-3,-2,-2,-3,-2,-3,-1,1,-4,-3,-2,11,2,-3,-4,-3,-2],[-2,-2,-2,-3,-2,-1,-2,-3,2,-1,-1,-2,-1,3,-3,-2,-2,2,7,-1,-3,-2,-1],[0,-3,-3,-3,-1,-2,-2,-3,-3,3,1,-2,1,-1,-2,-2,0,-3,-1,4,-3,-2,-1],[-2,-1,3,4,-3,0,1,-1,0,-3,-4,0,-3,-3,-2,0,-1,-4,-3,-3,4,1,-1],[-1,0,0,1,-3,3,4,-2,0,-3,-3,1,-1,-3,-1,0,-1,-3,-2,-2,1,4,-1],[0,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,0,0,-2,-1,-1,-1,-1,-1]]),blosum62x:Wf("ACDEFGHIKLMNPQRSTVWY",Hf)},qf=function(t,e,i,r,n){this.seq1=t,this.seq2=e,this.gapPenalty=i||-10,this.gapExtensionPenalty=r||-1,this.substMatrix=n||"blosum62",this.substMatrix&&(this.substMatrix=Xf[this.substMatrix])};qf.prototype.initMatrices=function(){var t,e;for(this.n=this.seq1.length,this.m=this.seq2.length,this.score=void 0,this.ali="",this.S=[],this.V=[],this.H=[],t=0;t<=this.n;++t)for(this.S[t]=[],this.V[t]=[],this.H[t]=[],e=0;e<=this.m;++e)this.S[t][e]=0,this.V[t][e]=0,this.H[t][e]=0;for(t=0;t<=this.n;++t)this.S[t][0]=this.gap(0),this.H[t][0]=-1/0;for(e=0;e<=this.m;++e)this.S[0][e]=this.gap(0),this.V[0][e]=-1/0;this.S[0][0]=0},qf.prototype.gap=function(t){return this.gapPenalty+t*this.gapExtensionPenalty},qf.prototype.makeScoreFn=function(){var t,e,i=this.seq1,r=this.seq2,n=this.substMatrix;return n?function(o,a){t=i[o],e=r[a];try{return n[t][e]}catch(t){return-4}}:(mc.warn("Alignment: no subst matrix"),function(n,o){return t=i[n],e=r[o],t===e?5:-3})},qf.prototype.calc=function(){gc&&mc.time("Alignment.calc"),this.initMatrices();var t,e,i,r,n,o,a,s=this.gap(0),c=this.makeScoreFn(),u=this.gapExtensionPenalty,h=this.V,l=this.H,p=this.S,d=this.n,f=this.m;for(o=1;o<=d;++o)for(e=p[o-1],t=h[o-1],i=h[o],r=l[o],n=p[o],a=1;a<=f;++a)i[a]=Math.max(e[a]+s,t[a]+u),r[a]=Math.max(n[a-1]+s,r[a-1]+u),n[a]=Math.max(e[a-1]+c(o-1,a-1),i[a],r[a]);gc&&mc.timeEnd("Alignment.calc"),gc&&mc.log(this.S,this.V,this.H)},qf.prototype.trace=function(){gc&&mc.time("Alignment.trace"),this.ali1="",this.ali2="";var t,e=this.makeScoreFn(),i=this.n,r=this.m;for(this.S[i][r]>=this.V[i][r]?(t="S",this.score=this.S[i][r]):this.V[i][r]>=this.H[i][r]?(t="V",this.score=this.V[i][r]):(t="H",this.score=this.H[i][r]),gc&&mc.log("Alignment: SCORE",this.score),gc&&mc.log("Alignment: S, V, H",this.S[i][r],this.V[i][r],this.H[i][r]);i>0&&r>0;)"S"===t?this.S[i][r]===this.S[i-1][r-1]+e(i-1,r-1)?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2=this.seq2[r-1]+this.ali2,--i,--r,t="S"):this.S[i][r]===this.V[i][r]?t="V":this.S[i][r]===this.H[i][r]?t="H":(--i,--r):"V"===t?this.V[i][r]===this.V[i-1][r]+this.gapExtensionPenalty?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i,t="V"):this.V[i][r]===this.S[i-1][r]+this.gap(0)?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i,t="S"):--i:"H"===t?this.H[i][r]===this.H[i][r-1]+this.gapExtensionPenalty?(this.ali1="-"+this.ali1,this.ali2=this.seq2[r-1]+this.ali2,--r,t="H"):this.H[i][r]===this.S[i][r-1]+this.gap(0)?(this.ali1="-"+this.ali1,this.ali2=this.seq2[r-1]+this.ali2,--r,t="S"):--r:mc.error("Alignment: no matrix");for(;i>0;)this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i;for(;r>0;)this.ali1="-"+this.ali1,this.ali2=this.seq2[r-1]+this.ali2,--r;gc&&mc.timeEnd("Alignment.trace"),gc&&mc.log([this.ali1,this.ali2])};var Yf=function(t){function e(e){var i=this;t.call(this,e),e.scale||(this.scale="rainbow",this.reverse=Eo(e.reverse,!0)),this.scalePerModel={},this.structure.eachModel((function(t){i.domain=[t.atomOffset,t.atomEnd],i.scalePerModel[t.index]=i.getScale()}))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){return this.scalePerModel[t.modelIndex](t.index)},e}(Ns);yc.add("atomindex",Yf);var Zf=function(t){function e(e){if(t.call(this,e),e.scale||(this.scale="OrRd"),!e.domain){var i,r=1/0,n=-1/0;e.sele&&(i=new nc(e.sele)),this.structure.eachAtom((function(t){var e=t.bfactor;r=Math.min(r,e),n=Math.max(n,e)}),i),this.domain=[r,n]}this.bfactorScale=this.getScale()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){return this.bfactorScale(t.bfactor)},e}(Ns);yc.add("bfactor",Zf);var Kf=function(t){function e(e){t.call(this,e),e.scale||(this.scale="Spectral");var i={},r={};this.structure.eachModel(function(t){var e=0,n={};t.eachChain((function(t){void 0===n[t.chainid]&&(n[t.chainid]=e,e+=1)})),this.domain=[0,e-1],i[t.index]=n,r[t.index]=this.getScale()}.bind(this)),this.atomColor=function(t){var e=i[t.modelIndex];return r[t.modelIndex](e[t.chainid])}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("chainid",Kf);var Qf=function(t){function e(e){if(t.call(this,e),e.scale||(this.scale="Spectral"),e.domain){var i=this.getScale();this.atomColor=function(t){return i(t.chainIndex)}}else{var r={};this.structure.eachModel(function(t){this.domain=[t.chainOffset,t.chainEnd],r[t.index]=this.getScale()}.bind(this)),this.atomColor=function(t){return r[t.modelIndex](t.chainIndex)}}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("chainindex",Qf);var Jf=function(t){function e(e){t.call(this,e),e.scale||(this.scale="Spectral");var i={},r={};this.structure.eachModel(function(t){var e=0,n={};t.eachChain((function(t){void 0===n[t.chainname]&&(n[t.chainname]=e,e+=1)})),this.domain=[0,e-1],i[t.index]=n,r[t.index]=this.getScale()}.bind(this)),this.atomColor=function(t){var e=i[t.modelIndex];return r[t.modelIndex](e[t.chainname])}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("chainname",Jf);var tm=function(t){function e(e){t.call(this,e),e.scale||(this.scale="RdYlBu"),this.rsrzScale=this.getScale({domain:[2,0]}),this.rsccScale=this.getScale({domain:[.678,1]});var i=e.structure.validation||{};this.rsrzDict=i.rsrzDict||{},this.rsccDict=i.rsccDict||{}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.resno;t.inscode&&(e+="^"+t.inscode),t.chainname&&(e+=":"+t.chainname),e+="/"+t.modelIndex;var i=this.rsrzDict[e];if(void 0!==i)return this.rsrzScale(i);var r=this.rsccDict[e];return void 0!==r?this.rsccScale(r):9474192},e}(Ns);yc.add("densityfit",tm);var em={ARG:{CD:.1,CZ:.5,NE:-.1},ASN:{CG:.55,OD1:-.55},ASP:{CB:-.16,CG:.36,OD1:-.6,OD2:-.6},CYS:{CB:.19,SG:-.19},GLN:{CD:.55,OE1:-.55},GLU:{CD:.36,CG:-.16,OE1:-.6,OE2:-.6},HIS:{CB:.1,CD2:.2,CE1:.45,CG:.15,ND1:.05,NE2:.05},LYS:{CE:.25,NZ:.75},MET:{CE:.06,CG:.06,SD:-.12},PTR:{C:.55,CA:.1,CZ:.25,N:-.35,O:-.55,O1P:-.85,O2P:-.85,O3P:-.85,OG1:-1.1,P:1.4},SEP:{C:.55,CA:.1,CB:.25,N:-.35,O:-.55,O1P:-.85,O2P:-.85,O3P:-.85,OG1:-1.1,P:1.4},SER:{CB:.25,OG:-.25},THR:{CB:.25,OG1:-.25},TPO:{C:.55,CA:.1,CB:.25,N:-.35,O:-.55,OG1:-1.1,O1P:-.85,O2P:-.85,O3P:-.85,P:1.4},TRP:{CD1:.06,CD2:.1,CE2:-.04,CE3:-.03,CG:-.03,NE1:-.06},TYR:{CZ:.25,OH:-.25},backbone:{C:.55,O:-.55,N:-.35,CA:.1}};var im=function(t){function e(e){t.call(this,e),e.scale||(this.scale="rwb"),e.domain||(this.domain=[-.5,0,.5]);var i=this.getScale();var r=this.structure,n=new Float32Array(r.atomCount),o=[],a=[];r.eachAtom((function(t){var e;if(n[t.index]=((e=t).isProtein()&&(em[e.resname]&&em[e.resname][e.atomname]||em.backbone[e.atomname])||0)*t.occupancy,"N"===t.atomname){var i=function(t,e){e=e||new O;var i=!1,r=!1,n=!1;return e.set(2*t.x,2*t.y,2*t.z),t.eachBondedAtom((function(t){if(!i)return"H"===t.atomname?(e.set(t),void(i=!0)):void(r||"CA"!==t.atomname?n||"C"!==t.atomname||(n=!0,e.sub(t)):(e.sub(t),r=!0))})),i?e:r&&n?(e.normalize(),e.multiplyScalar(1.04),e.add(t),e):void 0}(t);void 0!==i&&(o.push(i),a.push(.25*t.occupancy))}}));var s=this.structure.getBoundingBox();s.expandByScalar(1.04);var c=function(t){for(var e=t.length,i=new Float32Array(e),r=new Float32Array(e),n=new Float32Array(e),o=0;o<t.length;o++){var a=t[o];i[o]=a.x,r[o]=a.y,n[o]=a.z}return{x:i,y:r,z:n,count:e}}(o),u=new Kl(c,s),h=new Kl(this.structure.atomStore,s),l=this.atomProxy,p=new O;this.positionColor=function(t){for(var e=0,r=h.within(t.x,t.y,t.z,12),o=0;o<r.length;o++){var s=r[o],d=n[s];if(0!==d){l.index=s,p.x=t.x-l.x,p.y=t.y-l.y,p.z=t.z-l.z;var f=p.lengthSq();f<144&&(e+=d/f)}}for(var m=u.within(t.x,t.y,t.z,12),g=0;g<m.length;g++){var v=m[g];p.x=t.x-c.x[v],p.y=t.y-c.y[v],p.z=t.z-c.z[v];var y=p.lengthSq();y<144&&(e+=a[v]/y)}return i(e)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("electrostatic",im);var rm={H:16777215,HE:14286847,LI:13402367,BE:12779264,B:16758197,C:9474192,N:3166456,O:16715021,F:9494608,NE:11789301,NA:11230450,MG:9109248,AL:12560038,SI:1578e4,P:16744448,S:16777008,CL:2093087,AR:8442339,K:9388244,CA:4062976,SC:15132390,TI:12567239,V:10921643,CR:9083335,MN:10255047,FE:14706227,CO:15765664,NI:5296208,CU:13140019,ZN:8224944,GA:12750735,GE:6721423,AS:12419299,SE:16752896,BR:10889513,KR:6076625,RB:7351984,SR:65280,Y:9764863,ZR:9756896,NB:7586505,MO:5551541,TC:3907230,RU:2396047,RH:687500,PD:27013,AG:12632256,CD:16767375,IN:10909043,SN:6717568,SB:10380213,TE:13924864,I:9699476,XE:9699476,CS:5707663,BA:51456,LA:7394559,CE:16777159,PR:14286791,ND:13107143,PM:10747847,SM:9437127,EU:6422471,GD:4587463,TB:3211207,DY:2097095,HO:65436,ER:58997,TM:54354,YB:48952,LU:43812,HF:5096191,TA:5089023,W:2200790,RE:2522539,OS:2516630,IR:1528967,PT:13684960,AU:16765219,HG:12105936,TL:10900557,PB:5724513,BI:10375093,PO:11230208,AT:7688005,RN:4358806,FR:4325478,RA:32e3,AC:7384058,TH:47871,PA:41471,U:36863,NP:33023,PU:27647,AM:5528818,CM:7888099,BK:9064419,CF:10565332,ES:11739092,FM:11739066,MD:11734438,NO:12389767,LR:13041766,RF:13369433,DB:13697103,SG:14221381,BH:14680120,HS:15073326,MT:15400998,DS:16777215,RG:16777215,CN:16777215,UUT:16777215,FL:16777215,UUP:16777215,LV:16777215,UUH:16777215,D:16777152,T:16777120},nm=function(t){function e(e){var i=e||{};i.value=Eo(i.value,rm.C),t.call(this,i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.element;return"C"===e?this.value:rm[e]||16777215},e}(Ns);yc.add("element",nm);var om=function(t){function e(e){t.call(this,e),e.scale||(this.scale="Spectral"),e.domain||(this.domain=[0,this.structure.entityList.length-1]);var i=this.getScale();this.atomColor=function(t){return i(t.entityIndex)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("entityindex",om);var am=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.entity;switch(e?e.entityType:void 0){case 1:return 8374655;case 2:return 16629894;case 3:return 12496596;case 4:return 3697840;default:return 16777113}},e}(Ns);yc.add("entitytype",am);var sm=function(t){function e(e){t.call(this,e);var i=e.structure.validation||{};this.geoAtomDict=i.geoAtomDict||{},this.geoDict=i.geoDict||{}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e,i=t.resno;t.inscode&&(i+="^"+t.inscode),t.chainname&&(i+=":"+t.chainname),i+="/"+t.modelIndex;var r,n=this.geoAtomDict[i];if(void 0!==n){var o=n[t.atomname]||0;r=o,e=16843009*((r=(858993459&(r-=r>>1&1431655765))+(r>>2&858993459))+(r>>4)&252645135)>>24}else e=this.geoDict[i]||0;return 0===e?2188972:1===e?16703627:2===e?16018755:e>=3?10813478:9474192},e}(Ns);yc.add("geoquality",sm);var cm=function(t){function e(e){var i;t.call(this,e),e.scale||(this.scale="RdYlGn");var r={};for(i in vl)r[i]=vl[i][0];if(!e.domain){var n,o=1/0,a=-1/0;for(i in r)n=r[i],o=Math.min(o,n),a=Math.max(a,n);this.domain=[o,0,a]}var s=this.getScale();this.atomColor=function(t){return s(r[t.resname]||yl)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("hydrophobicity",cm);var um=function(t){function e(e){t.call(this,e),e.scale||(this.scale="rainbow"),e.domain||(this.domain=[0,this.structure.modelStore.count]);var i=this.getScale();this.atomColor=function(t){return i(t.modelIndex)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("modelindex",um);var hm=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){switch(t.residueType.moleculeType){case 1:return 3697840;case 2:return 15729279;case 3:return 12496596;case 4:return 16629894;case 5:return 12540695;case 6:return 8374655;default:return 16777113}},e}(Ns);yc.add("moleculetype",hm);var lm=function(t){function e(e){t.call(this,e),e.scale||(this.scale="PuBu"),e.domain||(this.domain=[0,1]);var i=this.getScale();this.atomColor=function(t){return i(t.occupancy)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);function pm(){return 16777215*Math.random()}yc.add("occupancy",lm);var dm=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(){return pm()},e.prototype.volumeColor=function(){return pm()},e.prototype.positionColor=function(){return pm()},e}(Ns);yc.add("random",dm);var fm=function(t){function e(e){var i=this;if(t.call(this,e),e.scale||(this.scale="rainbow",this.reverse=Eo(e.reverse,!0)),e.domain){var r=this.getScale();this.atomColor=function(t){return r(t.residueIndex)}}else{var n={};this.structure.eachChain((function(t){i.domain=[t.residueOffset,t.residueEnd],n[t.index]=i.getScale()})),this.atomColor=function(t){return n[t.chainIndex](t.residueIndex)}}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("residueindex",fm);var mm={ALA:9240460,ARG:124,ASN:16743536,ASP:10485826,CYS:16777072,GLN:16731212,GLU:6684672,GLY:16777215,HIS:7368959,ILE:19456,LEU:4546117,LYS:4671416,MET:12099650,PHE:5459026,PRO:5395026,SER:16740418,THR:12078080,TRP:5195264,TYR:9203788,VAL:16747775,ASX:16711935,GLX:16711935,ASH:16711935,GLH:16711935,A:10526975,G:16740464,I:8454143,C:16747595,T:10551200,U:16744576,DA:10526975,DG:16740464,DI:8454143,DC:16747595,DT:10551200,DU:16744576},gm=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){return mm[t.resname]||16711935},e}(Ns);yc.add("resname",gm);var vm=16711808,ym=10485888,bm=6291584,xm=16762880,_m=6324479,wm=16777215,Sm=11403518,Am=16580962,Mm=10921722,Pm=function(t){function e(e){t.call(this,e),this.rp=this.structure.getResidueProxy()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.sstruc,i=this.rp;return"h"===e?vm:"g"===e?ym:"i"===e?bm:"e"===e||"b"===e?xm:"t"===e?_m:(i.index=t.residueIndex,i.isDna()?Sm:i.isRna()?Am:i.isSaccharide()?Mm:i.isProtein()||"s"===e||"l"===e?wm:8421504)},e}(Ns);yc.add("sstruc",Pm);var Tm=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(){return this.value},e.prototype.bondColor=function(){return this.value},e.prototype.valueColor=function(){return this.value},e.prototype.volumeColor=function(){return this.value},e}(Ns);yc.add("uniform",Tm);var Em=function(t){function e(e){t.call(this,e),this.valueScale=this.getScale()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.volumeColor=function(t){return this.valueScale(this.volume.data[t])},e}(Ns);yc.add("value",Em);var Cm=function(t){function e(e){t.call(this,e);var i=this.volume;if(i&&i.inverseMatrix){var r=this.getScale(),n=i.inverseMatrix,o=i.data,a=i.nx,s=i.ny,c=a*s,u=new O;this.positionColor=function(t){u.copy(t),u.applyMatrix4(n);var e=Math.floor(u.x),i=Math.floor(u.y),h=Math.floor(u.z),l=(h*s+i)*a+e,p=l+1,d=l+a,f=l+c,m=d+1,g=f+1,v=d+c,y=v+1,b=o[l],x=o[p],_=o[d],w=o[f],S=o[m],A=o[g],M=o[v],P=o[y],T=u.x-e,E=u.y-i,C=u.z-h,I=Cs(b,x,T),R=Cs(w,A,T),L=Cs(_,S,T),O=Cs(M,P,T),N=Cs(I,L,E),D=Cs(R,O,E),k=Cs(N,D,C);return r(k)}}else{var h=this.value;this.positionColor=function(){return h}}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.positionColor=function(){},e}(Ns);yc.add("volume",Cm);var Im=function(t){function e(e,i,r){var n=this,o=r||{};o.name=Eo(o.name,i.name),t.call(this,e,o),this.script=i,this.status="loaded",this.script.signals.nameChanged.add((function(t){n.setName(t)}))}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"script"},e.prototype.addRepresentation=function(){},e.prototype.removeRepresentation=function(){},e.prototype.run=function(){var t=this;this.setStatus("running"),this.script.call(this.stage).then((function(){t.setStatus("finished")})),this.setStatus("called")},e.prototype.dispose=function(){this.signals.disposed.dispatch()},e.prototype.setVisibility=function(){},e.prototype.getCenter=function(){},e.prototype.getZoom=function(){},e.prototype.getBox=function(){},Object.defineProperties(e.prototype,i),e}(kf);Ac.add("script",Im);var Rm=function(t){function e(e,i,r){var n=r||{};n.name=Eo(n.name,i.name),t.call(this,e,n),this.shape=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"shape"},e.prototype.addRepresentation=function(e,i){return t.prototype.addRepresentation.call(this,e,this.shape,i)},e.prototype.getBoxUntransformed=function(){return this.shape.boundingBox},e.prototype.getCenterUntransformed=function(){return this.shape.center},e.prototype.dispose=function(){this.shape.dispose(),t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,i),e}(kf);Ac.add("shape",Rm);var Lm=function(t){function e(e,i,r,n){var o=this,a=r||{};a.name=Eo(a.name,i.name),t.call(this,e,a),this.signals=Object.assign(this.signals,{frameChanged:new Fs,playerChanged:new Fs,gotNumframes:new Fs,parametersChanged:new Fs}),this.trajectory=i,this.parent=n,this.status="loaded",this.defaultStep=Eo(a.defaultStep,void 0),this.defaultTimeout=Eo(a.defaultTimeout,50),this.defaultInterpolateType=Eo(a.defaultInterpolateType,""),this.defaultInterpolateStep=Eo(a.defaultInterpolateStep,5),this.defaultMode=Eo(a.defaultMode,"loop"),this.defaultDirection=Eo(a.defaultDirection,"forward"),i.signals.frameChanged.add((function(t){o.signals.frameChanged.dispatch(t)})),i.signals.playerChanged.add((function(t){o.signals.playerChanged.dispatch(t)})),i.signals.gotNumframes.add((function(t){o.signals.gotNumframes.dispatch(t)})),void 0!==a.initialFrame&&this.setFrame(a.initialFrame)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"trajectory"},e.prototype.addRepresentation=function(e,i){return t.prototype.addRepresentation.call(this,e,this.trajectory,i)},e.prototype.setFrame=function(t){this.trajectory.setFrame(t)},e.prototype.setParameters=function(t){this.trajectory.setParameters(t),this.signals.parametersChanged.dispatch(t)},e.prototype.dispose=function(){this.trajectory.dispose(),t.prototype.dispose.call(this)},e.prototype.getCenter=function(){},Object.defineProperties(e.prototype,i),e}(kf),Om=function(t){function e(e,i,r){t.call(this,"",i,r),this.name=e.name,this.path=e.path,this.frames=e.coordinates,this.boxes=e.boxes,this.getNumframes()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"frames"},e.prototype.makeAtomIndices=function(){"StructureView"===this.structure.type?this.atomIndices=this.structure.getAtomIndices():this.atomIndices=null},e.prototype._loadFrame=function(t,e){var i,r=this.frames[t];if(this.atomIndices){var n=this.atomIndices,o=n.length;i=new Float32Array(3*o);for(var a=0;a<o;++a){var s=3*a,c=3*n[a];i[s+0]=r[c+0],i[s+1]=r[c+1],i[s+2]=r[c+2]}}else i=new Float32Array(r);var u=this.boxes[t],h=this.frames.length;this.process(t,u,i,h),"function"==typeof e&&e()},e.prototype.getNumframes=function(){this.frames&&this.setNumframes(this.frames.length)},e.prototype.getPath=function(t,e){var i,r,n,o=this.numframes,a=3*t,s=new Float32Array(3*o);for(i=0;i<o;++i)r=3*i,n=this.frames[i],s[r+0]=n[a+0],s[r+1]=n[a+1],s[r+2]=n[a+2];e(s)},Object.defineProperties(e.prototype,i),e}(gd),Nm=function(t){function e(e,i,r){t.call(this,"",i,r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"structure"},e.prototype.makeAtomIndices=function(){this.structure.atomSet.getSize()<this.structure.atomStore.count?this.atomIndices=this.structure.getAtomIndices():this.atomIndices=null},e.prototype._loadFrame=function(t,e){var i,r=this.structure,n=r.frames[t];if(this.atomIndices){var o=this.atomIndices,a=o.length;i=new Float32Array(3*a);for(var s=0;s<a;++s){var c=3*s,u=3*o[s];i[c+0]=n[u+0],i[c+1]=n[u+1],i[c+2]=n[u+2]}}else i=new Float32Array(n);var h=r.boxes[t],l=r.frames.length;this.process(t,h,i,l),"function"==typeof e&&e()},e.prototype.getNumframes=function(){this.setNumframes(this.structure.frames.length)},e.prototype.getPath=function(t,e){var i,r,n,o=this.numframes,a=3*t,s=new Float32Array(3*o);for(i=0;i<o;++i)r=3*i,n=this.structure.frames[i],s[r+0]=n[a+0],s[r+1]=n[a+1],s[r+2]=n[a+2];e(s)},Object.defineProperties(e.prototype,i),e}(gd),Dm=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"remote"},e.prototype.makeAtomIndices=function(){var t=[];if("StructureView"===this.structure.type){var e,i,r=this.structure.getAtomIndices(),n=r[0],o=r[0],a=r.length;for(e=1;e<a;++e)o+1<(i=r[e])&&(t.push([n,o+1]),n=i),o=i;t.push([n,o+1])}else t.push([0,this.atomCount]);this.atomIndices=t},e.prototype._loadFrame=function(t,e){var i=new window.XMLHttpRequest,r=bc.trajectory,n=r.getFrameUrl(this.trajPath,t),o=r.getFrameParams(this.trajPath,this.atomIndices);i.open("POST",n,!0),i.responseType="arraybuffer",i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.addEventListener("load",function(){var r=i.response;if(r){var o=new Int32Array(r,0,1)[0],a=new Float32Array(r,8,9),s=new Float32Array(r,44);this.process(t,a,s,o),"function"==typeof e&&e()}else mc.error("empty arrayBuffer for '"+n+"'")}.bind(this),!1),i.send(o)},e.prototype.getNumframes=function(){var t=new window.XMLHttpRequest,e=bc.trajectory.getNumframesUrl(this.trajPath);t.open("GET",e,!0),t.addEventListener("load",function(){this.setNumframes(parseInt(t.response))}.bind(this),!1),t.send(null)},e.prototype.getPath=function(t,e){if(this.pathCache[t])e(this.pathCache[t]);else{mc.time("loadPath");var i=new window.XMLHttpRequest,r=bc.trajectory.getPathUrl(this.trajPath,t);i.open("POST",r,!0),i.responseType="arraybuffer",i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.addEventListener("load",function(){mc.timeEnd("loadPath");var n=i.response;if(n){var o=new Float32Array(n);this.pathCache[t]=o,e(o)}else mc.error("empty arrayBuffer for '"+r+"'")}.bind(this),!1),i.send("")}},Object.defineProperties(e.prototype,i),e}(gd);ld.prototype.getView=function(t){return new km(this,t)};var km=function(t){function e(e,i){t.call(this),this.structure=e,this.selection=i,this.center=new O,this.boundingBox=new jt,this._bp=this.getBondProxy(),this._ap=this.getAtomProxy(),this._rp=this.getResidueProxy(),this._cp=this.getChainProxy(),this.selection&&this.selection.signals.stringChanged.add(this.refresh,this),this.structure.signals.refreshed.add(this.refresh,this),this.refresh()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},name:{},path:{},title:{},id:{},atomSetDict:{},biomolDict:{},entityList:{},unitcell:{},frames:{},boxes:{},validation:{},bondStore:{},backboneBondStore:{},rungBondStore:{},atomStore:{},residueStore:{},chainStore:{},modelStore:{},atomMap:{},residueMap:{},bondHash:{},spatialHash:{}};return e.prototype.init=function(){},i.type.get=function(){return"StructureView"},i.name.get=function(){return this.structure.name},i.path.get=function(){return this.structure.path},i.title.get=function(){return this.structure.title},i.id.get=function(){return this.structure.id},i.atomSetDict.get=function(){return this.structure.atomSetDict},i.biomolDict.get=function(){return this.structure.biomolDict},i.entityList.get=function(){return this.structure.entityList},i.unitcell.get=function(){return this.structure.unitcell},i.frames.get=function(){return this.structure.frames},i.boxes.get=function(){return this.structure.boxes},i.validation.get=function(){return this.structure.validation},i.bondStore.get=function(){return this.structure.bondStore},i.backboneBondStore.get=function(){return this.structure.backboneBondStore},i.rungBondStore.get=function(){return this.structure.rungBondStore},i.atomStore.get=function(){return this.structure.atomStore},i.residueStore.get=function(){return this.structure.residueStore},i.chainStore.get=function(){return this.structure.chainStore},i.modelStore.get=function(){return this.structure.modelStore},i.atomMap.get=function(){return this.structure.atomMap},i.residueMap.get=function(){return this.structure.residueMap},i.bondHash.get=function(){return this.structure.bondHash},i.spatialHash.get=function(){return this.structure.spatialHash},e.prototype.refresh=function(){for(var t in gc&&mc.time("StructureView.refresh"),this.atomSetCache={},this.atomSet=this.getAtomSet(this.selection,!0),this.structure.atomSet&&(this.atomSet=this.atomSet.intersection(this.structure.atomSet)),this.bondSet=this.getBondSet(),this.atomSetDict){var e=this.atomSetDict[t];this.atomSetCache["__"+t]=e.makeIntersection(this.atomSet)}this.atomCount=this.atomSet.getSize(),this.bondCount=this.bondSet.getSize(),this.boundingBox=this.getBoundingBox(),this.center=this.boundingBox.getCenter(),gc&&mc.timeEnd("StructureView.refresh"),this.signals.refreshed.dispatch()},e.prototype.setSelection=function(t){this.selection=t,this.refresh()},e.prototype.getSelection=function(t){var e=[];t&&t.string&&e.push(t.string);var i=this.structure.getSelection();i&&i.string&&e.push(i.string),this.selection&&this.selection.string&&e.push(this.selection.string);var r="";return e.length>0&&(r="( "+e.join(" ) AND ( ")+" )"),new nc(r)},e.prototype.getStructure=function(){return this.structure.getStructure()},e.prototype.eachBond=function(t,e){this.structure.eachBond(t,this.getSelection(e))},e.prototype.eachAtom=function(t,e){var i=this.getAtomProxy(),r=this.getAtomSet(e),n=this.atomStore.count;if(r.getSize()<n)r.forEach((function(e){i.index=e,t(i)}));else for(var o=0;o<n;++o)i.index=o,t(i)},e.prototype.eachResidue=function(t,e){this.structure.eachResidue(t,this.getSelection(e))},e.prototype.eachResidueN=function(){console.error("StructureView.eachResidueN() not implemented")},e.prototype.eachChain=function(t,e){this.structure.eachChain(t,this.getSelection(e))},e.prototype.eachModel=function(t,e){this.structure.eachModel(t,this.getSelection(e))},e.prototype.getAtomSet=function(t,e){var i=this.structure.getAtomSet(t);return!e&&this.atomSet&&(i=i.makeIntersection(this.atomSet)),i},e.prototype.getAtomIndices=function(t){return this.structure.getAtomIndices(this.getSelection(t))},e.prototype.refreshPosition=function(){return this.structure.refreshPosition()},e.prototype.dispose=function(){this.selection&&this.selection.signals.stringChanged.remove(this.refresh,this),this.structure.signals.refreshed.remove(this.refresh,this),delete this.structure,delete this.atomSet,delete this.bondSet,delete this.atomCount,delete this.bondCount},Object.defineProperties(e.prototype,i),e}(ld),Fm=function(t){function e(e,i,r){var n=r||{};n.name=Eo(n.name,i.name),t.call(this,e,n),this.signals=Object.assign(this.signals,{trajectoryAdded:new Fs,trajectoryRemoved:new Fs,defaultAssemblyChanged:new Fs}),this.structure=i,this.trajList=[],this.initSelection(n.sele),this.setDefaultAssembly(n.assembly||"")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"structure"},e.prototype.initSelection=function(t){var e=this;this.selection=new nc(t),this.structureView=new km(this.structure,this.selection),this.selection.signals.stringChanged.add((function(){e.structureView.setSelection(e.selection),e.rebuildRepresentations(),e.rebuildTrajectories()}))},e.prototype.setSelection=function(t){return this.selection.setString(t),this},e.prototype.setDefaultAssembly=function(t){var e=this;this.defaultAssembly=t,this.reprList.forEach((function(t){t.setParameters({defaultAssembly:e.defaultAssembly})})),this.signals.defaultAssemblyChanged.dispatch(t)},e.prototype.rebuildRepresentations=function(){this.reprList.forEach((function(t){t.build()}))},e.prototype.rebuildTrajectories=function(){var t=this;this.trajList.slice().forEach((function(e){e.trajectory.setStructure(t.structureView)}))},e.prototype.addRepresentation=function(e,i){var r=i||{};return r.defaultAssembly=this.defaultAssembly,t.prototype.addRepresentation.call(this,e,this.structureView,r)},e.prototype.addTrajectory=function(t,e){var i=this,r=function(t,e,i){return t&&"Frames"===t.type?new Om(t,e,i):!t&&e.frames?new Nm(t,e,i):new Dm(t,e,i)}(t,this.structureView,e);r.signals.frameChanged.add((function(){i.updateRepresentations({position:!0})}));var n=new Lm(this.stage,r,e,this);return this.trajList.push(n),this.signals.trajectoryAdded.dispatch(n),n},e.prototype.removeTrajectory=function(t){var e=this.trajList.indexOf(t);-1!==e&&this.trajList.splice(e,1),t.dispose(),this.signals.trajectoryRemoved.dispatch(t)},e.prototype.dispose=function(){this.trajList.slice().forEach((function(t){t.dispose()})),this.trajList.length=0,this.structure.dispose(),t.prototype.dispose.call(this)},e.prototype.autoView=function(t,e){Number.isInteger(t)&&(e=t,t=void 0),this.stage.animationControls.zoomMove(this.getCenter(t),this.getZoom(t),Eo(e,0))},e.prototype.getBoxUntransformed=function(t){return t?this.structureView.getBoundingBox(new nc(t)):this.structureView.boundingBox},e.prototype.getCenterUntransformed=function(t){return t&&"string"==typeof t?this.structure.atomCenter(new nc(t)):this.structure.center},e.prototype.superpose=function(t,e,i,r){return function(t,e,i,r,n){var o,a,s,c,u;if(i=Eo(i,!1),r=Eo(r,""),n=Eo(n,""),i){var h=t,l=e;r&&n&&(h=t.getView(new nc(r)),l=e.getView(new nc(n)));var p,d,f,m,g,v=h.getSequence(),y=l.getSequence(),b=new qf(v.join(""),y.join(""));b.calc(),b.trace(),o=0,a=0,s=b.ali1.length;var x=[],_=[];for(p=0;p<s;++p)m=b.ali1[p],g=b.ali2[p],d=0,f=0,"-"===m?_[a]=!1:(_[a]=!0,d=1),"-"===g?x[o]=!1:(x[o]=!0,f=1),o+=d,a+=f;var w=[],S=[],A=h.getAtomProxy(),M=l.getAtomProxy();o=0,h.eachResidue((function(t){void 0!==t.traceAtomIndex&&t.traceAtomIndex===t.getAtomIndexByName("CA")&&(x[o]&&(A.index=t.getAtomIndexByName("CA"),w.push(A.x,A.y,A.z)),o+=1)})),o=0,l.eachResidue((function(t){void 0!==t.traceAtomIndex&&t.traceAtomIndex===t.getAtomIndexByName("CA")&&(_[o]&&(M.index=t.getAtomIndexByName("CA"),S.push(M.x,M.y,M.z)),o+=1)})),c=new Float32Array(w),u=new Float32Array(S)}else{c=t.getView(new nc(r+" and .CA")),u=e.getView(new nc(n+" and .CA"))}new fd(c,u).transform(t),t.refreshPosition()}(this.structureView,t.structureView,e,i,r),this.updateRepresentations({position:!0}),this},e.prototype.setVisibility=function(e){return t.prototype.setVisibility.call(this,e),this.trajList.forEach((function(t){t.setVisibility(e)})),this},Object.defineProperties(e.prototype,i),e}(kf);Ac.add("structure",Fm),Ac.add("structureview",Fm);var Bm=function(t){function e(e,i,r){var n=r||{};n.name=Eo(n.name,i.name),t.call(this,e,n),this.surface=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"surface"},e.prototype.addRepresentation=function(e,i){return t.prototype.addRepresentation.call(this,e,this.surface,i)},e.prototype.getBoxUntransformed=function(){return this.surface.boundingBox},e.prototype.getCenterUntransformed=function(){return this.surface.center},e.prototype.dispose=function(){this.surface.dispose(),t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,i),e}(kf);Ac.add("surface",Bm);var zm=function(t){function e(e,i,r){var n=r||{};n.name=Eo(n.name,i.name),t.call(this,e,n),this.volume=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"volume"},e.prototype.addRepresentation=function(e,i){return t.prototype.addRepresentation.call(this,e,this.volume,i)},e.prototype.getBoxUntransformed=function(){return this.volume.boundingBox},e.prototype.getCenterUntransformed=function(){return this.volume.center},e.prototype.dispose=function(){this.volume.dispose(),t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,i),e}(kf);Ac.add("volume",zm);var Um=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="axes",this.parameters=Object.assign({radius:{type:"number",precision:3,max:10,min:.001},sphereDetail:!0,radialSegments:!0,disableImpostor:!0,showAxes:{type:"boolean",rebuild:!0},showBox:{type:"boolean",rebuild:!0}},this.parameters,{assembly:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.radius=Eo(i.radius,.5),i.colorValue=Eo(i.colorValue,"lightgreen"),this.showAxes=Eo(i.showAxes,!0),this.showBox=Eo(i.showBox,!1),t.prototype.init.call(this,i)},e.prototype.getPrincipalAxes=function(){var t,e=this.getAssembly();return e&&(t=e.partList[0].getSelection()),this.structureView.getPrincipalAxes(t)},e.prototype.getAxesData=function(t){var e=this.getPrincipalAxes(t),i=new St(this.colorValue),r=0,n=0;this.showAxes&&(r+=6,n+=3),this.showBox&&(r+=8,n+=12);var o=new Float32Array(3*r),a=au(r,i.r,i.g,i.b),s=ou(r,this.radius),c=new Float32Array(3*n),u=new Float32Array(3*n),h=au(n,i.r,i.g,i.b),l=ou(n,this.radius),p=0;if(this.showAxes){var d=function(t,e){t.toArray(o,2*p),e.toArray(o,2*p+3),t.toArray(c,p),e.toArray(u,p),p+=3};d(e.begA,e.endA),d(e.begB,e.endB),d(e.begC,e.endC)}if(this.showBox){var f=new O,m=e.getProjectedScaleForAtoms(t),g=m.d1a,v=m.d2a,y=m.d3a,b=m.d1b,x=m.d2b,_=m.d3b;console.log(g,v,y,b,x,_);var w=2*p,S=function(t,i,r){f.copy(e.center).addScaledVector(e.normVecA,t).addScaledVector(e.normVecB,i).addScaledVector(e.normVecC,r),f.toArray(o,w),w+=3};S(g,v,y),S(g,v,_),S(g,x,_),S(g,x,y),S(b,x,_),S(b,x,y),S(b,v,y),S(b,v,_);var A=p,M=function(t,e){f.fromArray(o,2*p+3*t).toArray(c,A),f.fromArray(o,2*p+3*e).toArray(u,A),A+=3};M(0,1),M(0,3),M(0,6),M(1,2),M(1,7),M(2,3),M(2,4),M(3,5),M(4,5),M(4,7),M(5,6),M(6,7)}var P=new Hh(e);return{vertex:{position:o,color:a,radius:s,picking:P},edge:{position1:c,position2:u,color:h,color2:h,radius:l,picking:P}}},e.prototype.create=function(){var t=this.getAxesData(this.structureView);this.sphereBuffer=new Od(t.vertex,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0})),this.cylinderBuffer=new qd(t.edge,this.getBufferParams({openEnded:!0,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bufferList:[this.sphereBuffer,this.cylinderBuffer]})},e.prototype.updateData=function(t,e){var i=this.getAxesData(e.sview),r={},n={};t&&!t.position||(r.position=i.vertex.position,n.position1=i.edge.position1,n.position2=i.edge.position2),t&&!t.color||(r.color=i.vertex.color,n.color=i.edge.color,n.color2=i.edge.color),t&&!t.radius||(r.radius=i.vertex.radius,n.radius=i.edge.radius),this.sphereBuffer.setAttributes(r),this.cylinderBuffer.setAttributes(n)},e}(Cf);xc.add("axes",Um);var jm=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="ball+stick",this.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}},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.radius=Eo(i.radius,.15),this.aspectRatio=Eo(i.aspectRatio,2),this.lineOnly=Eo(i.lineOnly,!1),this.cylinderOnly=Eo(i.cylinderOnly,!1),this.multipleBond=Eo(i.multipleBond,"off"),this.bondSpacing=Eo(i.bondSpacing,1),this.bondScale=Eo(i.bondScale,.4),t.prototype.init.call(this,i)},e.prototype.getAtomParams=function(e,i){return i=Object.assign({radiusParams:{radius:this.radius,scale:this.scale*this.aspectRatio}},i),t.prototype.getAtomParams.call(this,e,i)},e.prototype.getAtomData=function(t,e,i){return t.getAtomData(this.getAtomParams(e,i))},e.prototype.getBondParams=function(e,i){return i=Object.assign({multipleBond:this.multipleBond,bondSpacing:this.bondSpacing,bondScale:this.bondScale},i),t.prototype.getBondParams.call(this,e,i)},e.prototype.getBondData=function(t,e,i){return t.getBondData(this.getBondParams(e,i))},e.prototype.createData=function(t){var e=this.getBondData(t),i=[];if(this.lineOnly)this.lineBuffer=new If(e,this.getBufferParams()),i.push(this.lineBuffer);else{var r=new qd(e,this.getBufferParams({openEnded:this.openEnded,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}));if(i.push(r),!this.cylinderOnly){var n=new Od(this.getAtomData(t),this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0}));i.push(n)}}return{bufferList:i}},e.prototype.updateData=function(t,e){"off"!==this.multipleBond&&t&&t.radius&&(t.position=!0);var i=this.getBondData(e.sview,t);if(this.lineOnly){var r={};t&&!t.position||(r.position1=i.position1,r.position2=i.position2),t&&!t.color||(r.color=i.color,r.color2=i.color2),e.bufferList[0].setAttributes(r)}else{var n={};if(t&&!t.position||(n.position1=i.position1,n.position2=i.position2),t&&!t.color||(n.color=i.color,n.color2=i.color2),t&&!t.radius||(n.radius=i.radius),e.bufferList[0].setAttributes(n),!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)}}},e.prototype.setParameters=function(e){var i=!1,r={};return e&&(e.aspectRatio||e.bondSpacing||e.bondScale)&&(r.radius=!0,dc&&!this.disableImpostor||(i=!0)),t.prototype.setParameters.call(this,e,r,i),this},e}(Cf);xc.add("ball+stick",jm);var Gm=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="backbone",this.parameters=Object.assign({},this.parameters,{multipleBond:null,bondSpacing:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.aspectRatio=Eo(i.aspectRatio,1),i.radius=Eo(i.radius,.25),t.prototype.init.call(this,i)},e.prototype.getAtomData=function(t,e,i){return t.getBackboneAtomData(this.getAtomParams(e,i))},e.prototype.getBondData=function(t,e,i){return t.getBackboneBondData(this.getBondParams(e,i))},e}(jm);xc.add("backbone",Gm);var Vm=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="base",this.parameters=Object.assign({},this.parameters,{multipleBond:null,bondSpacing:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.aspectRatio=Eo(i.aspectRatio,1),i.radius=Eo(i.radius,.3),t.prototype.init.call(this,i)},e.prototype.getAtomData=function(t,e,i){return t.getRungAtomData(this.getAtomParams(e,i))},e.prototype.getBondData=function(t,e,i){var r=this.getBondParams(e,i);return r.colorParams.rung=!0,t.getRungBondData(r)},e}(jm);function $m(t,e){var i=1/t,r=new O,n=new O;function o(t,i,r,n,o,a,s){a[s+0]=Is(t.x,i.x,r.x,n.x,o,e),a[s+1]=Is(t.y,i.y,r.y,n.y,o,e),a[s+2]=Is(t.z,i.z,r.z,n.z,o,e)}function a(t,i,r,n,o,a){a.x=Is(t.x,i.x,r.x,n.x,o,e),a.y=Is(t.y,i.y,r.y,n.y,o,e),a.z=Is(t.z,i.z,r.z,n.z,o,e)}function s(e,r,n,a,s,c){for(var u=0;u<t;++u){o(e,r,n,a,i*u,s,c+3*u)}}function c(e,o,s,c,u,h){for(var l=0;l<t;++l){var p=i*l,d=p-1e-4,f=p+1e-4,m=h+3*l;d<0&&(d=0),f>1&&(f=1),a(e,o,s,c,d,r),a(e,o,s,c,f,n),n.sub(r).normalize(),n.toArray(u,m)}}function u(e,i,r,n,o){for(var a=i.next(),s=i.next(),c=i.next(),u=i.size,h=u-1,l=n||0,p=0;p<h;++p)e(a,a=s,s=c,c=i.next(),r,l),l+=3*t;o&&(e(i.get(u-2),a=i.get(u-1),s=i.get(0),c=i.get(1),r,l),l+=3*t)}this.getPosition=function(e,i,r,n){e.reset(),u(s,e,i,r,n);var o=e.size-1,a=o*t*3;n&&(a+=3*t);var c=e.get(n?0:o);i[a]=c.x,i[a+1]=c.y,i[a+2]=c.z},this.getTangent=function(e,i,r,n){e.reset(),u(c,e,i,r,n);var o=(e.size-1)*t*3;n&&(o+=3*t),uu(i,i,o-3,o,3)};var h=new O,l=new O,p=new O,d=new O,f=Math.ceil(t/2);function m(e,o,s,c,u,m,g,v,y,b,x,_,w){for(var S=0;S<t;++S){var A=_+3*S;w&&(A+=3*f);var M=i*S;a(e,o,s,c,M,r),a(u,m,g,v,M,n),h.subVectors(n,r).normalize(),l.fromArray(y,A),d.crossVectors(h,l).normalize(),d.toArray(x,A),p.crossVectors(l,d).normalize(),p.toArray(b,A)}}function g(e,i,r,n,o){for(var a=0;a<t;++a){var s=o+3*a;e.copy(p),l.fromArray(i,s),d.crossVectors(e,l).normalize(),d.toArray(n,s),p.crossVectors(l,d).normalize(),p.toArray(r,s)}}function v(e,i,r,n,o){var a;for(a=0;a<f;++a)r(e,n,o+3*a);for(a=f;a<t;++a)r(i,n,o+3*a)}function y(e,i,r,n,o){var a;for(a=0;a<f;++a)n[o+a]=r(e);for(a=f;a<t;++a)n[o+a]=r(i)}function b(e,i,r,n,o){for(var a=r(e),s=r(i),c=0;c<t;++c){var u=c/t;n[o+c]=(1-u)*a+u*s}}this.getNormal=function(e,i,r,n,o,a){p.set(0,0,1);for(var s=e-1,c=o||0,u=0;u<s;++u)g(h,i,r,n,c),c+=3*t;a&&(g(h,i,r,n,c),c+=3*t),d.toArray(n,c),p.toArray(r,c)},this.getNormalDir=function(e,i,r,n,o,a,s,c){e.reset(),i.reset();var u=new O,h=new O,l=new O,g=new O,v=new O,y=(new O).copy(e.next()),b=(new O).copy(e.next()),x=(new O).copy(e.next()),_=new O,w=(new O).copy(i.next()),S=(new O).copy(i.next()),A=(new O).copy(i.next());p.set(0,0,1);for(var M=e.size,P=M-1,T=a||0,E=0;E<P;++E)v.copy(y),y.copy(b),b.copy(x),x.copy(e.next()),_.copy(w),w.copy(S),S.copy(A),A.copy(i.next()),0===E?(u.subVectors(_,v),h.subVectors(w,y),u.dot(h)<0&&(h.multiplyScalar(-1),w.addVectors(y,h)),l.subVectors(S,b),h.dot(l)<0&&(l.multiplyScalar(-1),S.addVectors(b,l))):l.copy(g),g.subVectors(A,x),l.dot(g)<0&&(g.multiplyScalar(-1),A.addVectors(x,g)),m(v,y,b,x,_,w,S,A,r,n,o,T,c),T+=3*t;if(s&&(v.copy(e.get(M-2)),y.copy(e.get(M-1)),b.copy(e.get(0)),x.copy(e.get(1)),_.copy(i.get(M-2)),w.copy(i.get(M-1)),S.copy(i.get(0)),A.copy(i.get(1)),l.copy(g),g.subVectors(A,x),l.dot(g)<0&&(g.multiplyScalar(-1),A.addVectors(x,g)),m(v,y,b,x,_,w,S,A,r,n,o,T,c),T+=3*t),c){d.fromArray(o,3*f),p.fromArray(n,3*f);for(var C=0;C<f;++C)d.toArray(o,3*C),p.toArray(n,3*C)}else d.toArray(o,T),p.toArray(n,T)},this.getColor=function(e,i,r,n,o){e.reset(),e.next();for(var a=e.next(),s=e.size,c=s-1,u=n||0,h=0;h<c;++h)v(a,a=e.next(),i,r,u),u+=3*t;o&&(v(e.get(s-1),a=e.get(0),i,r,u),u+=3*t),r[u]=r[u-3],r[u+1]=r[u-2],r[u+2]=r[u-1]},this.getPicking=function(e,i,r,n,o){e.reset(),e.next();for(var a=e.next(),s=e.size,c=s-1,u=n||0,h=0;h<c;++h)y(a,a=e.next(),i,r,u),u+=t;o&&(y(e.get(s-1),a=e.get(0),i,r,u),u+=t),r[u]=r[u-1]},this.getSize=function(e,i,r,n,o){e.reset(),e.next();for(var a=e.next(),s=e.size,c=s-1,u=n||0,h=0;h<c;++h)b(a,a=e.next(),i,r,u),u+=t;o&&(b(e.get(s-1),a=e.get(0),i,r,u),u+=t),r[u]=r[u-1]}}function Hm(t,e){this.polymer=t,this.size=t.residueCount;var i=e||{};this.directional=i.directional||!1,this.positionIterator=i.positionIterator||!1,this.subdiv=i.subdiv||1,this.smoothSheet=i.smoothSheet||!1,isNaN(i.tension)?this.tension=this.polymer.isNucleic()?.5:.9:this.tension=i.tension||.5,this.interpolator=new $m(this.subdiv,this.tension)}xc.add("base",Vm),Hm.prototype={constructor:Hm,getAtomIterator:function(t,e){var i=this.polymer,r=i.structure,n=i.residueCount,o=0,a=-1,s=[r.getAtomProxy(),r.getAtomProxy(),r.getAtomProxy(),r.getAtomProxy()],c=[new O,new O,new O,new O];var u=r.getAtomProxy(),h=r.getAtomProxy();return{size:n,next:function(){var t=this.get(a);return a+=1,t},get:function(r){var a=s[o%4];if(a.index=i.getAtomIndexByType(r,t),e&&r>0&&r<n&&"e"===a.sstruc){var l=c[o%4];return u.index=i.getAtomIndexByType(r+1,t),h.index=i.getAtomIndexByType(r-1,t),l.addVectors(u,h).add(a).add(a).multiplyScalar(.25),o+=1,l}return o+=1,a},reset:function(){o=0,a=-1}}},getSubdividedColor:function(t){var e=this.subdiv,i=this.polymer,r=(i.residueCount-1)*e*3+3;i.isCyclic&&(r+=3*e);var n=new Float32Array(r),o=this.getAtomIterator("trace"),a=t||{};a.structure=i.structure;var s=yc.getScheme(a);return this.interpolator.getColor(o,(function(t,e,i){s.atomColorToArray(t,e,i)}),n,0,i.isCyclic),{color:n}},getSubdividedPicking:function(){var t=this.subdiv,e=this.polymer,i=(e.residueCount-1)*t+1;e.isCyclic&&(i+=t);var r=e.structure,n=this.getAtomIterator("trace"),o=new Float32Array(i);return this.interpolator.getPicking(n,(function(t){return t.index}),o,0,e.isCyclic),{picking:new $h(o,r)}},getSubdividedPosition:function(){return{position:this.getPosition()}},getSubdividedOrientation:function(){var t=this.getTangent(),e=this.getNormals(t);return{tangent:t,normal:e.normal,binormal:e.binormal}},getSubdividedSize:function(t,e){var i=this.subdiv,r=this.polymer,n=(r.residueCount-1)*i+1;r.isCyclic&&(n+=i);var o=new Float32Array(n),a=this.getAtomIterator("trace"),s=new Il(t,e);return this.interpolator.getSize(a,(function(t){return s.atomRadius(t)}),o,0,r.isCyclic),{size:o}},getPosition:function(){var t=this.subdiv,e=this.polymer,i=(e.residueCount-1)*t*3+3;e.isCyclic&&(i+=3*t);var r=new Float32Array(i),n=this.positionIterator||this.getAtomIterator("trace",this.smoothSheet);return this.interpolator.getPosition(n,r,0,e.isCyclic),r},getTangent:function(){var t=this.subdiv,e=this.polymer,i=(this.size-1)*t*3+3;e.isCyclic&&(i+=3*t);var r=new Float32Array(i),n=this.positionIterator||this.getAtomIterator("trace",this.smoothSheet);return this.interpolator.getTangent(n,r,0,e.isCyclic),r},getNormals:function(t){var e=this.subdiv,i=this.polymer,r=i.isProtein(),n=this.size,o=(n-1)*e*3+3;i.isCyclic&&(o+=3*e);var a=new Float32Array(o),s=new Float32Array(o);if(this.directional&&!this.polymer.isCg()){var c=this.getAtomIterator("direction1"),u=this.getAtomIterator("direction2");this.interpolator.getNormalDir(c,u,t,a,s,0,i.isCyclic,r)}else this.interpolator.getNormal(n,t,a,s,0,i.isCyclic,r);return{normal:a,binormal:s}}};var Wm=new O,Xm=new O,qm=function(t){function e(e,i){var r=e||{},n=i||{},o=Eo(n.radialSegments,4),a=Eo(n.capped,!1),s=a?o:0,c=a?o-2:0,u=r.position.length/3,h=u*o*3+2*s*3,l=2*(u-1)*o*3+2*c*3,p=new Float32Array(h),d=new Float32Array(h),f=new Float32Array(h),m=zo(l,h/3);t.call(this,{position:p,color:d,index:m,normal:f,picking:r.picking},n),this.aspectRatio=Eo(n.aspectRatio,1),this.radialSegments=o,this.capped=a,this.capVertices=s,this.capTriangles=c,this.size2=u,r.primitiveId=su(u),this.setAttributes(r),this.meshIndex=m,this.makeIndex()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setAttributes=function(t){var e,i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,P,T,E,C,I,R,L,O,N,D=this.aspectRatio,k=this.size2,F=k-1,B=this.radialSegments,z=this.geometry.attributes;t.position&&(e=t.position,i=t.normal,r=t.binormal,n=t.tangent,a=t.size,c=z.position.array,h=z.normal.array,z.position.needsUpdate=!0,z.normal.needsUpdate=!0),t.color&&(o=t.color,u=z.color.array,z.color.needsUpdate=!0),t.primitiveId&&(s=t.primitiveId,l=z.primitiveId.array,z.primitiveId.needsUpdate=!0);var U=[],j=[],G=[],V=[],$=[],H=[];if(e)for(d=0;d<B;++d)y=d/B*2*Math.PI,U[d]=D*Math.cos(y),j[d]=Math.sin(y),G[d]=D*Math.cos(y-.01),V[d]=Math.sin(y-.01),$[d]=D*Math.cos(y+.01),H[d]=Math.sin(y+.01);for(p=0;p<k;++p)for(m=(f=3*p)*B,e&&(Wm.set(n[f],n[f+1],n[f+2]),P=i[f],T=i[f+1],E=i[f+2],C=r[f],I=r[f+1],R=r[f+2],L=e[f],O=e[f+1],N=e[f+2],M=a[p]),d=0;d<B;++d)g=m+3*d,e&&(b=-M*U[d],x=M*j[d],_=-M*G[d],w=M*V[d],S=-M*$[d],A=M*H[d],c[g]=L+b*P+x*C,c[g+1]=O+b*T+x*I,c[g+2]=N+b*E+x*R,Xm.set(S*P+A*C-(_*P+w*C),S*T+A*I-(_*T+w*I),S*E+A*R-(_*E+w*R)).cross(Wm),h[g]=Xm.x,h[g+1]=Xm.y,h[g+2]=Xm.z),o&&(u[g]=o[f],u[g+1]=o[f+1],u[g+2]=o[f+2]),s&&(l[p*B+d]=s[p]);for(f=0,m=3*k*B,d=0;d<B;++d)g=f+3*d,v=m+3*d,e&&(c[v]=c[g],c[v+1]=c[g+1],c[v+2]=c[g+2],h[v]=n[f],h[v+1]=n[f+1],h[v+2]=n[f+2]),o&&(u[v]=u[g],u[v+1]=u[g+1],u[v+2]=u[g+2]),s&&(l[k*B+d]=l[0+d]);for(f=3*(k-1)*B,m=3*(k+1)*B,d=0;d<B;++d)g=f+3*d,v=m+3*d,e&&(c[v]=c[g],c[v+1]=c[g+1],c[v+2]=c[g+2],h[v]=n[3*F],h[v+1]=n[3*F+1],h[v+2]=n[3*F+2]),o&&(u[v]=u[g],u[v+1]=u[g+1],u[v+2]=u[g+2]),s&&(l[(k+1)*B+d]=l[(k-1)*B+d])},e.prototype.makeIndex=function(){var t,e,i,r,n,o,a=this.meshIndex,s=this.size2,c=s-1,u=this.capTriangles,h=this.radialSegments,l=this.radialSegments+1;for(t=0;t<c;++t)for(e=t*h*3*2,i=t*h,r=(t+1)*h,o=0;o<h;++o)a[n=e+3*o*2]=i+o,a[n+1]=i+(o+1)%h,a[n+2]=r+o,a[n+3]=r+o,a[n+4]=i+(o+1)%h,a[n+5]=r+(o+1)%h;var p=[0];for(o=1;o<l/2;++o)p.push(o),h-o!==o&&p.push(h-o);for(n=c*h*3*2,e=s*h,o=0;o<p.length-2;++o)o%2==0?(a[n+3*o+0]=e+p[o+0],a[n+3*o+1]=e+p[o+1],a[n+3*o+2]=e+p[o+2]):(a[n+3*o+0]=e+p[o+2],a[n+3*o+1]=e+p[o+1],a[n+3*o+2]=e+p[o+0]);for(n=c*h*3*2+3*u,e=s*h+h,o=0;o<p.length-2;++o)o%2==0?(a[n+3*o+0]=e+p[o+0],a[n+3*o+1]=e+p[o+1],a[n+3*o+2]=e+p[o+2]):(a[n+3*o+0]=e+p[o+2],a[n+3*o+1]=e+p[o+1],a[n+3*o+2]=e+p[o+0])},e}(wd),Ym=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="cartoon",this.parameters=Object.assign({aspectRatio:{type:"number",precision:1,max:10,min:1},subdiv:{type:"integer",max:50,min:1,rebuild:!0},radialSegments:{type:"integer",max:50,min:1,rebuild:!0},tension:{type:"number",precision:1,max:1,min:.1},capped:{type:"boolean",rebuild:!0},smoothSheet:{type:"boolean",rebuild:!0}},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"chainname"),i.colorScale=Eo(i.colorScale,"RdYlBu"),i.radius=Eo(i.radius,"sstruc"),i.scale=Eo(i.scale,.7),this.aspectRatio=Eo(i.aspectRatio,5),this.tension=Eo(i.tension,NaN),this.capped=Eo(i.capped,!0),this.smoothSheet=Eo(i.smoothSheet,!1),"low"===i.quality?(this.subdiv=3,this.radialSegments=6):"medium"===i.quality?this.subdiv=6:"high"===i.quality?this.subdiv=12:this.subdiv=Eo(i.subdiv,6),t.prototype.init.call(this,i)},e.prototype.getSplineParams=function(t){return Object.assign({subdiv:this.subdiv,tension:this.tension,directional:1!==this.aspectRatio,smoothSheet:this.smoothSheet},t)},e.prototype.getSpline=function(t){return new Hm(t,this.getSplineParams())},e.prototype.getScale=function(t){return t.isCg()?this.scale*this.aspectRatio:this.scale},e.prototype.getAspectRatio=function(t){return t.isCg()?1:this.aspectRatio},e.prototype.createData=function(t){var e=this,i=[],r=[];return this.structure.eachPolymer((function(t){if(!(t.residueCount<4)){r.push(t);var n=e.getSpline(t),o=n.getSubdividedPosition(),a=n.getSubdividedOrientation(),s=n.getSubdividedColor(e.getColorParams()),c=n.getSubdividedPicking(),u=n.getSubdividedSize(e.radius,e.getScale(t));i.push(new qm(Object.assign({},o,a,s,c,u),e.getBufferParams({radialSegments:e.radialSegments,aspectRatio:e.getAspectRatio(t),capped:e.capped,dullInterior:!0})))}}),t.getSelection()),{bufferList:i,polymerList:r}},e.prototype.updateData=function(t,e){gc&&mc.time(this.type+" repr update"),t=t||{};for(var i=0,r=e.polymerList.length;i<r;++i){var n={},o=e.polymerList[i],a=this.getSpline(o);if(e.bufferList[i].aspectRatio=this.getAspectRatio(o),t.position||t.radius){var s=a.getSubdividedPosition(),c=a.getSubdividedOrientation(),u=a.getSubdividedSize(this.radius,this.getScale(o));n.position=s.position,n.normal=c.normal,n.binormal=c.binormal,n.tangent=c.tangent,n.size=u.size}if(t.color){var h=a.getSubdividedColor(this.getColorParams());n.color=h.color}if(t.picking){var l=a.getSubdividedPicking();n.picking=l.picking}e.bufferList[i].setAttributes(n)}gc&&mc.timeEnd(this.type+" repr update")},e.prototype.setParameters=function(e){var i={};return e&&e.aspectRatio&&(i.radius=!0),e&&e.tension&&(i.position=!0),t.prototype.setParameters.call(this,e,i,!1),this},e}(Cf);xc.add("cartoon",Ym);var Zm=function(t,e){this.sview1=t,this.sview2=e,this.kdtree2=new Tp(e)};function Km(t,e,i){e=e||3.5,i=i||40;for(var r=new nc("( 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 )"),n=new nc("( 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(r),a=t.getView(n),s=new Zm(o,a).within(e),c=s.bondStore,u=t.getAtomProxy(),h=t.getAtomProxy(),l=t.getAtomProxy(),p=t.getAtomProxy(),d=t.getResidueProxy(),f=t.getResidueProxy(),m=new O,g=new O,v=function(t,e,r,n){var o,a;t.atomname===r?(o=t,a=e):(o=e,a=t),d.index=o.residueIndex;var s=d.getAtomIndexByName(n);return m.subVectors(s,o),g.subVectors(s,a),Jo(m.angleTo(g))<i},y=0,b=c.count;y<b;++y)if(u.index=c.atomIndex1[y],h.index=c.atomIndex2[y],"O"===u.atomname&&"N"===h.atomname||"N"===u.atomname&&"O"===h.atomname)s.bondSet.clear(y);else if("N"===u.atomname||"N"===h.atomname){var x,_;if("N"===u.atomname?(x=u,_=h):(x=h,_=u),d.index=x.residueIndex,l.index=d.getAtomIndexByName("CA"),void 0===l.index)continue;var w=d.getPreviousConnectedResidue(f);if(void 0===w)continue;if(p.index=w.getAtomIndexByName("C"),void 0===p.index)continue;m.subVectors(x,p),g.subVectors(x,l),m.add(g).multiplyScalar(.5),g.subVectors(_,x),Jo(m.angleTo(g))>i&&s.bondSet.clear(y)}else("OH"===u.atomname&&"TYR"===u.resname||"OH"===h.atomname&&"TYR"===h.resname)&&(v(u,h,"OH","CZ")||s.bondSet.clear(y));return{atomSet:s.atomSet,bondSet:s.bondSet,bondStore:s.bondStore}}function Qm(t,e,i){e=e||3.5,i=i||40;for(var r=new nc("( PROTEIN and .N )"),n=new nc("( PROTEIN and .O )"),o=t.getView(r),a=t.getView(n),s=new Zm(o,a).within(e),c=s.bondStore,u=t.getAtomProxy(),h=t.getAtomProxy(),l=t.getAtomProxy(),p=t.getAtomProxy(),d=t.getResidueProxy(),f=t.getResidueProxy(),m=new O,g=new O,v=0,y=c.count;v<y;++v){var b,x;if(u.index=c.atomIndex1[v],h.index=c.atomIndex2[v],"N"===u.atomname?(b=u,x=h):(b=h,x=u),d.index=b.residueIndex,l.index=d.getAtomIndexByName("CA"),void 0!==l.index){var _=d.getPreviousConnectedResidue(f);void 0!==_&&(p.index=_.getAtomIndexByName("C"),void 0!==p.index&&(m.subVectors(b,p),g.subVectors(b,l),m.add(g).multiplyScalar(.5),g.subVectors(x,b),Jo(m.angleTo(g))>i&&s.bondSet.clear(v)))}}return{atomSet:s.atomSet,bondSet:s.bondSet,bondStore:s.bondStore}}Zm.prototype.within=function(t,e){mc.time("Contact within");var i=this.kdtree2,r=this.sview1.getAtomProxy(),n=this.sview1.getAtomSet(!1),o=new yp;this.sview1.eachAtom((function(a){for(var s=!1,c=i.nearest(a,1/0,t),u=0,h=c.length;u<h;++u){var l=c[u];r.index=l.index,a.residueIndex!==r.residueIndex&&(!e||l.distance>e)&&(s=!0,n.set(r.index),o.addBond(a,r,1))}s&&n.set(a.index)}));var a=new al(o.count,!0);return mc.timeEnd("Contact within"),{atomSet:n,bondSet:a,bondStore:o}};var Jm=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="contact",this.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},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.radius=Eo(i.radius,.25),this.contactType=Eo(i.contactType,"polarBackbone"),this.maxDistance=Eo(i.maxDistance,3.5),this.maxAngle=Eo(i.maxAngle,40),t.prototype.init.call(this,i)},e.prototype.getContactData=function(t){return{polar:Km,polarBackbone:Qm}[this.contactType](t,this.maxDistance,this.maxAngle)},e.prototype.getBondData=function(t,e,i){var r=t.getBondData(this.getBondParams(e,i));return r.picking&&(r.picking=new Xh(r.picking.array,r.picking.structure,i.bondStore)),r},e.prototype.createData=function(t){var e=this.getContactData(t);return{bufferList:[new qd(this.getBondData(t,void 0,{bondSet:e.bondSet,bondStore:e.bondStore}),this.getBufferParams({openEnded:!1,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}))],bondSet:e.bondSet,bondStore:e.bondStore}},e.prototype.updateData=function(t,e){if(!t||t.position){var i=this.getContactData(e.sview);e.bondSet=i.bondSet,e.bondStore=i.bondStore}var r={bondSet:e.bondSet,bondStore:e.bondStore},n=this.getBondData(e.sview,t,r),o={};t&&!t.position||(o.position=nu(n.position1,n.position2),o.position1=n.position1,o.position2=n.position2),t&&!t.color||(o.color=n.color,o.color2=n.color2),t&&!t.radius||(o.radius=n.radius),e.bufferList[0].setAttributes(o)},e}(Cf);xc.add("contact",Jm);var tg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="distance",this.parameters=Object.assign({labelSize:{type:"number",precision:3,max:10,min:.001},labelColor:{type:"color"},labelVisible:{type:"boolean"},labelZOffset:{type:"number",precision:1,max:20,min:-20,buffer:"zOffset"},labelUnit:{type:"select",rebuild:!0,options:{"":"",angstrom:"angstrom",nm:"nm"}},atomPair:{type:"hidden",rebuild:!0},radialSegments:!0,disableImpostor:!0},this.parameters,{flatShaded:null,assembly:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.radius=Eo(i.radius,.15),this.fontFamily=Eo(i.fontFamily,"sans-serif"),this.fontStyle=Eo(i.fontStyle,"normal"),this.fontWeight=Eo(i.fontWeight,"bold"),this.sdf=Eo(i.sdf,"Firefox"!==hc),this.labelSize=Eo(i.labelSize,2),this.labelColor=Eo(i.labelColor,16777215),this.labelVisible=Eo(i.labelVisible,!0),this.labelZOffset=Eo(i.labelZOffset,.5),this.labelUnit=Eo(i.labelUnit,""),this.atomPair=Eo(i.atomPair,[]),t.prototype.init.call(this,i)},e.prototype.getDistanceData=function(t,e){var i=e.length,r=new Array(i),n=new Float32Array(3*i),o=new nc,a=new nc,s=new yp,c=t.getAtomProxy(),u=t.getAtomProxy(),h=0;e.forEach((function(e,i){var l=e[0],p=e[1];if(Number.isInteger(l)&&Number.isInteger(p))c.index=l,u.index=p;else{o.setString(l),a.setString(p);var d=t.getAtomIndices(o),f=t.getAtomIndices(a);if(!d.length||!f.length)return void(h+=1);c.index=d[0],u.index=f[0]}s.addBond(c,u,1),i-=h;var m=c.distanceTo(u);switch(this.labelUnit){case"angstrom":r[i]=m.toFixed(2)+" "+String.fromCharCode(8491);break;case"nm":r[i]=(m/10).toFixed(2)+" nm";break;default:r[i]=m.toFixed(2)}var g=3*i;n[g+0]=(c.x+u.x)/2,n[g+1]=(c.y+u.y)/2,n[g+2]=(c.z+u.z)/2}),this),h>0&&(i-=h,n=n.subarray(0,3*i));var l=new al(s.count,!0);return{text:r,position:n,bondSet:l,bondStore:s}},e.prototype.getBondData=function(t,e,i){var r=t.getBondData(this.getBondParams(e,i));return r.picking&&(r.picking=new Zh(r.picking.array,r.picking.structure,i.bondStore)),r},e.prototype.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 St(this.labelColor);this.textBuffer=new sf({position:e.position,size:ou(t,this.labelSize),color:au(t,i.r,i.g,i.b),text: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 r={bondSet:e.bondSet,bondStore:e.bondStore},n=this.getBondData(this.structureView,void 0,r);this.cylinderBuffer=new qd(n,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]})}}},e.prototype.update=function(e){e.position?this.build():t.prototype.update.call(this,e)},e.prototype.updateData=function(t,e){var i={bondSet:e.bondSet,bondStore:e.bondStore},r=this.getBondData(e.sview,t,i),n={},o={},a=this.atomPair.length;if(t.labelSize&&(o.size=ou(a,this.labelSize)),t.labelColor){var s=new St(this.labelColor);o.color=au(a,s.r,s.g,s.b)}t.color&&(n.color=r.color,n.color2=r.color2),(t.radius||t.scale)&&(n.radius=r.radius),this.textBuffer.setAttributes(o),this.cylinderBuffer.setAttributes(n)},e.prototype.setVisibility=function(e,i){return t.prototype.setVisibility.call(this,e,!0),this.textBuffer&&this.textBuffer.setVisibility(this.labelVisible&&this.visible),i||this.viewer.requestRender(),this},e.prototype.setParameters=function(e){var i={};return e&&e.labelSize&&(i.labelSize=!0),e&&(e.labelColor||0===e.labelColor)&&(i.labelColor=!0),t.prototype.setParameters.call(this,e,i,!1),e&&void 0!==e.labelVisible&&this.setVisibility(this.visible),this},e}(Cf);xc.add("distance",tg);var eg=function(t){function e(e,i){var r=i||{},n=2*(e.position.length/3),o=new St(Eo(r.color,"grey")),a=new Float32Array(3*n),s=au(n,o.r,o.g,o.b);t.call(this,{position:a,color:s},r),this.scale=Eo(r.scale,1),this.setAttributes(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isLine:{},vertexShader:{},fragmentShader:{}};return e.prototype.setAttributes=function(t){var e,i,r,n=this.geometry.attributes;t.position&&t.vector&&(e=t.position,i=t.vector,r=n.position.array,n.position.needsUpdate=!0);var o,a,s=this.size/2,c=this.scale;if(t.position&&t.vector)for(var u=0;u<s;u++)a=3*u,r[(o=2*u*3)+0]=e[a+0],r[o+1]=e[a+1],r[o+2]=e[a+2],r[o+3]=e[a+0]+i[a+0]*c,r[o+4]=e[a+1]+i[a+1]*c,r[o+5]=e[a+2]+i[a+2]*c},i.isLine.get=function(){return!0},i.vertexShader.get=function(){return"Line.vert"},i.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,i),e}(xd),ig=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="helixorient",this.parameters=Object.assign({sphereDetail:!0,disableImpostor:!0},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"sstruc"),i.radius=Eo(i.radius,.15),i.scale=Eo(i.scale,1),t.prototype.init.call(this,i)},e.prototype.createData=function(t){var e=this,i=[],r=[];return this.structure.eachPolymer((function(t){if(!(t.residueCount<4)){r.push(t);var n=new Sp(t),o=n.getPosition(),a=n.getColor(e.getColorParams()),s=n.getSize(e.radius,e.scale),c=n.getPicking();i.push(new Od({position:o.center,color:a.color,radius:s.size,picking:c.picking},e.getBufferParams({sphereDetail:e.sphereDetail,disableImpostor:e.disableImpostor,dullInterior:!0})),new eg({position:o.center,vector:o.axis},e.getBufferParams({color:"skyblue",scale:1})),new eg({position:o.center,vector:o.resdir},e.getBufferParams({color:"lightgreen",scale:1})))}}),t.getSelection()),{bufferList:i,polymerList:r}},e.prototype.updateData=function(t,e){gc&&mc.time(this.type+" repr update"),t=t||{};for(var i=0,r=e.polymerList.length;i<r;++i){var n=3*i,o={},a=new Sp(e.polymerList[i]);if(t.position){var s=a.getPosition();o.position=s.center,e.bufferList[n+1].setAttributes({position:s.center,vector:s.axis}),e.bufferList[n+2].setAttributes({position:s.center,vector:s.resdir})}e.bufferList[n].setAttributes(o)}gc&&mc.timeEnd(this.type+" repr update")},e}(Cf);xc.add("helixorient",ig);var rg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="licorice",this.parameters=Object.assign({},this.parameters,{aspectRatio:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.aspectRatio=1,t.prototype.init.call(this,i)},e}(jm);xc.add("licorice",rg),wc.add("shader/HyperballStickImpostor.vert","\nattribute vec3 mapping;\nattribute float radius;\nattribute float radius2;\nattribute vec3 position1;\nattribute vec3 position2;\nvarying mat4 matrix_near;\nvarying vec4 prime1;\nvarying vec4 prime2;\nvarying float vRadius;\nvarying float vRadius2;\n#ifdef PICKING\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\nattribute vec3 color2;\nvarying vec3 vColor1;\nvarying vec3 vColor2;\n#endif\nuniform float shrink;\nuniform mat4 modelViewProjectionMatrix;\nuniform mat4 modelViewProjectionMatrixInverse;\nvoid main(){\nvRadius = radius;\nvRadius2 = radius2;\nvec4 spaceposition;\nvec3 position_atom1;\nvec3 position_atom2;\nvec4 vertex_position;\n#ifdef PICKING\nvPickingColor = unpackColor( primitiveId );\n#else\nvColor1 = color;\nvColor2 = color2;\n#endif\nfloat radius1 = radius;\nposition_atom1 = position1;\nposition_atom2 = position2;\nfloat distance = distance( position_atom1, position_atom2 );\nspaceposition.z = mapping.z * distance;\nif (radius1 > 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}"),wc.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;\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\ngl_FragColor = vec4( vPickingColor, objectId );\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}");var ng=new Float32Array([-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,-1,1,-1,1,1,-1,1,1,1,-1,1,1]),og=new Uint16Array([0,1,2,0,2,3,1,5,6,1,6,2,4,6,5,4,7,6,0,7,4,0,3,7,0,5,1,0,4,5,3,2,6,3,6,7]),ag=function(t){function e(e,i){t.call(this,e,i);var r=e||{},n=Eo((i||{}).shrink,.14);this.addUniforms({modelViewProjectionMatrix:{value:new N},modelViewProjectionMatrixInverse:{value:new N},modelViewMatrixInverseTranspose:{value:new N},shrink:{value:n}}),this.addAttributes({position1:{type:"v3",value:null},position2:{type:"v3",value:null},color2:{type:"c",value:null},radius:{type:"f",value:null},radius2:{type:"f",value:null}}),this.setAttributes(r),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={parameters:{},isImpostor:{},vertexShader:{},fragmentShader:{}};return i.parameters.get=function(){return Object.assign.call(this,{shrink:{uniform:!0}},t.prototype.parameters)},i.isImpostor.get=function(){return!0},i.vertexShader.get=function(){return"HyperballStickImpostor.vert"},i.fragmentShader.get=function(){return"HyperballStickImpostor.frag"},Object.defineProperties(e.prototype,i),e}(function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return i.mapping.get=function(){return ng},i.mappingIndices.get=function(){return og},i.mappingIndicesSize.get=function(){return 36},i.mappingType.get=function(){return"v3"},i.mappingSize.get=function(){return 8},i.mappingItemSize.get=function(){return 3},Object.defineProperties(e.prototype,i),e}(Ed)),sg=function(t,e){return!dc||e&&e.disableImpostor?(t.radius=function(t,e){for(var i=t.length,r=new Float32Array(i),n=0;n<i;n++)r[n]=Math.min(t[n],e[n]);return r}(t.radius1,t.radius2),new $d(t,e)):new ag(t,e)},cg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="hyperball",this.parameters=Object.assign({shrink:{type:"number",precision:3,max:1,min:.001,buffer:!0}},this.parameters,{multipleBond:null,bondSpacing:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.scale=Eo(i.scale,.2),i.radius=Eo(i.radius,"vdw"),this.shrink=Eo(i.shrink,.12),t.prototype.init.call(this,i)},e.prototype.getBondParams=function(e,i){return e&&!e.radius||(i=Object.assign({radius2:!0},i)),t.prototype.getBondParams.call(this,e,i)},e.prototype.createData=function(t){var e=new Od(t.getAtomData(this.getAtomParams()),this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0}));return this.__center=new Float32Array(3*t.bondCount),{bufferList:[e,new sg(t.getBondData(this.getBondParams()),this.getBufferParams({shrink:this.shrink,radialSegments:this.radialSegments,dullInterior:!0}))]}},e.prototype.updateData=function(t,e){var i=e.sview.getAtomData(this.getAtomParams()),r=e.sview.getBondData(this.getBondParams()),n={},o={};if(!t||t.position){n.position=i.position;var a=r.position1,s=r.position2;o.position=nu(a,s,this.__center),o.position1=a,o.position2=s}t&&!t.color||(n.color=i.color,o.color=r.color,o.color2=r.color2),t&&!t.radius||(n.radius=i.radius,o.radius=r.radius,o.radius2=r.radius2),e.bufferList[0].setAttributes(n),e.bufferList[1].setAttributes(o)},e}(rg);function ug(t,e){this.type=t,this.text=e||{}}xc.add("hyperball",cg),ug.prototype={constructor:ug,atomLabel:function(t){var e;switch(this.type){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 i=t.resname.toUpperCase();e=(bl[i]||i)+t.resno;break;case"text":e=this.text[t.index];break;default:e=t.qualifiedName()}return void 0===e?"":e}},ug.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"};var hg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="label",this.parameters=Object.assign({labelType:{type:"select",options:ug.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}},this.parameters,{side:null,flatShaded:null,wireframe:null,linewidth:null,roughness:null,metalness:null,diffuse:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};this.labelType=Eo(i.labelType,"res"),this.labelText=Eo(i.labelText,{}),this.fontFamily=Eo(i.fontFamily,"sans-serif"),this.fontStyle=Eo(i.fontStyle,"normal"),this.fontWeight=Eo(i.fontWeight,"bold"),this.sdf=Eo(i.sdf,"Chrome"===hc),this.xOffset=Eo(i.xOffset,0),this.yOffset=Eo(i.yOffset,0),this.zOffset=Eo(i.zOffset,.5),this.attachment=Eo(i.attachment,"bottom-left"),this.showBorder=Eo(i.showBorder,!1),this.borderColor=Eo(i.borderColor,"lightgrey"),this.borderWidth=Eo(i.borderWidth,.15),this.showBackground=Eo(i.showBackground,!1),this.backgroundColor=Eo(i.backgroundColor,"lightgrey"),this.backgroundMargin=Eo(i.backgroundMargin,.5),this.backgroundOpacity=Eo(i.backgroundOpacity,1),t.prototype.init.call(this,i)},e.prototype.createData=function(t){var e=t.getAtomData(this.getAtomParams({position:!0,color:!0,radius:!0})),i=[],r=new ug(this.labelType,this.labelText);return t.eachAtom((function(t){i.push(r.atomLabel(t))})),{bufferList:[new sf({position:e.position,size:e.radius,color:e.color,text:i},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}))]}},e.prototype.updateData=function(t,e){var i=e.sview.getAtomData(this.getAtomParams(t)),r={};t&&!t.position||(r.position=i.position),t&&!t.radius||(r.size=i.radius),t&&!t.color||(r.color=i.color),e.bufferList[0].setAttributes(r)},e}(Cf);xc.add("label",hg);var lg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="line",this.parameters=Object.assign({multipleBond:{type:"select",rebuild:!0,options:{off:"off",symmetric:"symmetric",offset:"offset"}},bondSpacing:{type:"number",precision:2,max:2,min:.5}},this.parameters,{flatShaded:null,side:null,wireframe:null,roughness:null,metalness:null,diffuse:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};this.multipleBond=Eo(i.multipleBond,"off"),this.bondSpacing=Eo(i.bondSpacing,1),t.prototype.init.call(this,i)},e.prototype.getBondParams=function(e,i){return i=Object.assign({multipleBond:this.multipleBond,bondSpacing:this.bondSpacing,radiusParams:{radius:.1,scale:1}},i),t.prototype.getBondParams.call(this,e,i)},e.prototype.createData=function(t){var e=t.getBondData(this.getBondParams({position:!0,color:!0}));return{bufferList:[new If(e,this.getBufferParams())]}},e.prototype.updateData=function(t,e){var i=e.sview.getBondData(this.getBondParams(t)),r={};t&&!t.position||(r.position1=i.position1,r.position2=i.position2),t&&!t.color||(r.color=i.color,r.color2=i.color2),e.bufferList[0].setAttributes(r)},e.prototype.setParameters=function(e){var i={};return e&&e.bondSpacing&&(i.position=!0),t.prototype.setParameters.call(this,e,i,!1),this},e}(Cf);function pg(t,e,i,r,n){var o,a=new(r=r||Int32Array)(t*e*i*(n=n||1));function s(t,r,o){return((t*e+r)*i+o)*n}this.data=a,this.index=s,this.set=function(t,e,i){var r=arguments,c=s(t,e,i);for(o=0;o<n;++o)a[c+o]=r[3+o]},this.toArray=function(t,e,i,r,c){var u=s(t,e,i);for(void 0===r&&(r=[]),void 0===c&&(c=0),o=0;o<n;++o)r[c+o]=a[u+o]},this.fromArray=function(t,e,i,r,c){var u=s(t,e,i);for(void 0===c&&(c=0),o=0;o<n;++o)a[u+o]=r[c+o]},this.copy=function(t){this.data.set(t.data)},this.clone=function(){return new pg(t,e,i,r,n).copy(this)}}function dg(t,e,i){var r=ap(e),n=Sh(t);0===t.length&&(n[0].set([0,0,0]),n[1].set([0,0,0]));var o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x=n[0],_=n[1];function w(t,e,i,n,w){o=e||1.4,a=i||2,g=w||!0;var S=0;for(var M in r)S=Math.max(S,M);var P=sp(x,_,S,a,t?o:0);c=P.dim[0],u=P.dim[1],h=P.dim[2],l=P.matrix,p=P.tran,a=P.scaleFactor,d={},f={},A(t),m=o*a,s=n||o/a,v=new Uint8Array(c*u*h),t&&(y=new Float64Array(c*u*h)),g&&(b=new Int32Array(c*u*h))}var S=[new Int32Array([1,0,0]),new Int32Array([-1,0,0]),new Int32Array([0,1,0]),new Int32Array([0,-1,0]),new Int32Array([0,0,1]),new Int32Array([0,0,-1]),new Int32Array([1,1,0]),new Int32Array([1,-1,0]),new Int32Array([-1,1,0]),new Int32Array([-1,-1,0]),new Int32Array([1,0,1]),new Int32Array([1,0,-1]),new Int32Array([-1,0,1]),new Int32Array([-1,0,-1]),new Int32Array([0,1,1]),new Int32Array([0,1,-1]),new Int32Array([0,-1,1]),new Int32Array([0,-1,-1]),new Int32Array([1,1,1]),new Int32Array([1,1,-1]),new Int32Array([1,-1,1]),new Int32Array([-1,1,1]),new Int32Array([1,-1,-1]),new Int32Array([-1,-1,1]),new Int32Array([-1,1,-1]),new Int32Array([-1,-1,-1])];function A(t){var e,i,n,s,c,u,h,l,p,m;for(var g in r)if(e=r[g],!d[g]){for(u=(h=t?(e+o)*a+.5:e*a+.5)*h,l=Math.floor(h)+1,p=new Int32Array(l*l),m=0,i=0;i<l;++i)for(n=0;n<l;++n)(s=i*i+n*n)>u?p[m]=-1:(c=Math.sqrt(u-s),p[m]=Math.floor(c)),++m;f[g]=l,d[g]=p}}function M(i){var r,n,o,s,l,m,y,x,_,w,S,A,M,P,T,E,C,I,R=3*i,L=i;r=Math.floor(.5+a*(t[R]+p[0])),n=Math.floor(.5+a*(t[R+1]+p[1])),o=Math.floor(.5+a*(t[R+2]+p[2]));var O,N=e[L],D=d[N],k=0,F=u*h,B=f[N];for(w=0;w<B;++w)for(S=0;S<B;++S){if(-1!==(O=D[k]))for(E=-1;E<2;++E)for(C=-1;C<2;++C)for(I=-1;I<2;++I)if(0!==E&&0!==C&&0!==I)for(y=E*w,_=I*S,A=0;A<=O;++A)if(P=n+(x=A*C),T=o+_,!((M=r+y)<0||P<0||T<0||M>=c||P>=u||T>=h)){var z=M*F+P*h+T;if(g)if(1&v[z]){if(1&v[z]){var U=b[z];U!==R&&y*y+x*x+_*_<(s=r+y-Math.floor(.5+a*(t[U]+p[0])))*s+(l=n+x-Math.floor(.5+a*(t[U+1]+p[1])))*l+(m=o+_-Math.floor(.5+a*(t[U+2]+p[2])))*m&&(b[z]=i)}}else v[z]|=1,b[z]=i;else v[z]|=1}k++}}function P(e){var i,r;for(console.time("EDTSurface fillvoxels"),i=0,r=v.length;i<r;++i)v[i]=0,e&&(y[i]=-1),g&&(b[i]=-1);for(i=0,r=t.length/3;i<r;++i)M(i);for(i=0,r=v.length;i<r;++i)1&v[i]&&(v[i]|=2);console.timeEnd("EDTSurface fillvoxels")}function T(i){var r,n,o,s,l,m,y,x,_,w,S,A,M,P,T,E,C,I,R,L=3*i,O=i,N=0;r=Math.floor(.5+a*(t[L]+p[0])),n=Math.floor(.5+a*(t[L+1]+p[1])),o=Math.floor(.5+a*(t[L+2]+p[2]));var D=e[O],k=u*h;for(M=0,R=f[D];M<R;++M)for(P=0;P<R;++P){if(-1!==d[D][N])for(E=-1;E<2;++E)for(C=-1;C<2;++C)for(I=-1;I<2;++I)if(0!==E&&0!==C&&0!==I)for(y=E*M,_=I*P,T=0;T<=d[D][N];++T)if(S=n+(x=T*C),A=o+_,!((w=r+y)<0||S<0||A<0||w>=c||S>=u||A>=h)){var F=w*k+S*h+A;if(2&v[F]){if(g){var B=b[F];y*y+x*x+_*_<(s=Math.floor(.5+a*(t[B]+p[0])))*s+(l=Math.floor(.5+a*(t[B+1]+p[1])))*l+(m=Math.floor(.5+a*(t[B+2]+p[2])))*m&&(b[F]=i)}}else v[F]|=2,g&&(b[F]=i)}N++}}function E(){var t,e,i,r;console.time("EDTSurface fastdistancemap");var n,o=new pg(c,u,h,Uint16Array,3),a=u*h,l=m*m,p=0;for(t=0;t<c;++t)for(e=0;e<u;++e)for(i=0;i<h;++i)v[n=t*a+e*h+i]&=-3,1&v[n]&&4&v[n]&&(o.set(t,e,i,t,e,i),y[n]=0,v[n]|=2,p+=1);var d=new Int32Array(3*p),f=0,x=new Int32Array(3*p),_=0;for(t=0;t<c;++t)for(e=0;e<u;++e)for(i=0;i<h;++i)4&v[n=t*a+e*h+i]&&(d[f]=t,d[f+1]=e,d[f+2]=i,f+=3,v[n]&=-5);do{for(_=C(d,o,f,x),f=0,t=0,r=_;t<r;t+=3)n=a*x[t]+h*x[t+1]+x[t+2],v[n]&=-5,y[n]<=1.0404*l&&(d[f]=x[t],d[f+1]=x[t+1],d[f+2]=x[t+2],f+=3)}while(f>0);var w,S=s*s,A=new Uint16Array(3);for(t=0;t<c;++t)for(e=0;e<u;++e)for(i=0;i<h;++i)v[n=t*a+e*h+i]&=-5,1&v[n]&&(2&v[n]&&!(2&v[n]&&y[n]>=S)||(v[n]|=4,g&&2&v[n]&&(o.toArray(t,e,i,A),w=A[0]*a+A[1]*h+A[2],b[n]=b[w])));console.timeEnd("EDTSurface fastdistancemap")}function C(t,e,i,r){var n,o,a,s,l,p,d,f,m,g,b,x,_=new Uint16Array(3),w=0;if(0===i)return w;var A=-1,M=-1,P=-1,T=u*h;for(d=0,m=i;d<m;d+=3)for(n=t[d],o=t[d+1],a=t[d+2],e.toArray(n,o,a,_),f=0;f<6;++f)A=n+(x=S[f])[0],M=o+x[1],P=a+x[2],A<c&&A>-1&&M<u&&M>-1&&P<h&&P>-1&&(1&v[b=A*T+h*M+P]&&!(2&v[b])?(e.fromArray(A,M,P,_),g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p,y[b]=g,v[b]|=2,v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3):1&v[b]&&2&v[b]&&(g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p)<y[b]&&(e.fromArray(A,M,P,_),y[b]=g,4&v[b]||(v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3)));for(d=0,m=i;d<m;d+=3)for(n=t[d],o=t[d+1],a=t[d+2],e.toArray(n,o,a,_),f=6;f<18;f++)A=n+(x=S[f])[0],M=o+x[1],P=a+x[2],A<c&&A>-1&&M<u&&M>-1&&P<h&&P>-1&&(1&v[b=A*T+h*M+P]&&!(2&v[b])?(e.fromArray(A,M,P,_),g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p,y[b]=g,v[b]|=2,v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3):1&v[b]&&2&v[b]&&(g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p)<y[b]&&(e.fromArray(A,M,P,_),y[b]=g,4&v[b]||(v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3)));for(d=0,m=i;d<m;d+=3)for(n=t[d],o=t[d+1],a=t[d+2],e.toArray(n,o,a,_),f=18;f<26;f++)A=n+(x=S[f])[0],M=o+x[1],P=a+x[2],A<c&&A>-1&&M<u&&M>-1&&P<h&&P>-1&&(1&v[b=A*T+h*M+P]&&!(2&v[b])?(e.fromArray(A,M,P,_),g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p,y[b]=g,v[b]|=2,v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3):1&v[b]&&2&v[b]&&(g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p)<y[b]&&(e.fromArray(A,M,P,_),y[b]=g,4&v[b]||(v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3)));return w}this.getVolume=function(e,r,n,o,a){console.time("EDTSurface.getVolume");var s="vws"!==e;w(s,r,n,o,a),P(s),function(){var t,e,i,r=u*h;for(t=0;t<c;++t)for(e=0;e<h;++e)for(i=0;i<u;++i){var n=t*r+i*h+e;if(1&v[n])for(var o=0;o<26;){var a=t+S[o][0],s=e+S[o][2],l=i+S[o][1];if(a>-1&&a<c&&l>-1&&l<u&&s>-1&&s<h&&!(1&v[a*r+l*h+s])){v[n]|=4;break}o++}}}(),"ms"!==e&&"ses"!==e||E(),"ses"===e&&(A(!1),function(){var e,i;for(e=0,i=v.length;e<i;++e)v[e]&=-3;for(e=0,i=t.length/3;e<i;++e)T(e)}()),function(t){var e,i=v.length;if("vws"===t)for(e=0;e<i;++e)v[e]&=-5,v[e]=2&v[e]?1:0;else if("ms"===t)for(e=0;e<i;++e)v[e]&=-3,4&v[e]&&(v[e]|=2),v[e]&=-5,v[e]=2&v[e]?1:0;else if("ses"===t)for(e=0;e<i;++e)4&v[e]&&2&v[e]?v[e]&=-5:4&v[e]&&!(2&v[e])&&(v[e]|=2),v[e]=2&v[e]?1:0;else if("sas"===t)for(e=0;e<i;++e)v[e]&=-5,v[e]=2&v[e]?1:0}(e);for(var l=0,p=b.length;l<p;++l)b[l]=i[b[l]];return console.timeEnd("EDTSurface.getVolume"),{data:v,nx:h,ny:u,nz:c,atomindex:b}},this.getSurface=function(t,e,i,r,n,o,a){var s=this.getVolume(t,e,i,r,n);return new hp(s.data,s.nx,s.ny,s.nz,s.atomindex).getSurface(1,o,void 0,l,a)}}function fg(t,e,i,r,n,o,a){var s=t.length,c=n[0],u=n[1],h=n[2],l=o[0],p=o[1],d=o[2];function f(t,e){return Math.floor((t-e)/a)}for(var m=f(l,c)+1,g=f(p,u)+1,v=f(d,h)+1,y=m*g*v,b=g*v,x=function(t,e,i){return(f(t,c)*g+f(e,u))*v+f(i,h)},_=[],w=0;w<s;w++){var S=x(t[w],e[w],i[w]);void 0===_[S]?_[S]=[w]:_[S].push(w)}var A=new Uint32Array(y),M=new Uint16Array(y),P=new Uint32Array(s),T=0,E=0;for(w=0;w<y;w++){var C=A[w]=T,I=_[w];if(void 0!==I)for(var R=0;R<I.length;R++)P[T]=I[R],T++;var L=T-C;M[w]=L,L>E&&(E=L)}this.neighbourListLength=27*E+1,this.withinRadii=function(n,o,a,s,l){for(var p=0,d=f(n,c),y=f(o,u),x=f(a,h),_=Math.max(0,d-1),w=Math.max(0,y-1),S=Math.max(0,x-1),T=Math.min(m,d+1),E=Math.min(g,y+1),C=Math.min(v,x+1),I=_;I<=T;++I)for(var R=I*b,L=w;L<=E;++L)for(var O=L*v,N=S;N<=C;++N)for(var D=R+O+N,k=A[D],F=k+M[D],B=k;B<F;B++){var z=P[B],U=t[z]-n,j=e[z]-o,G=i[z]-a,V=r[z]+s;U*U+j*j+G*G<=V*V&&(l[p++]=P[B])}l[p]=-1}}function mg(t,e,i){for(var r=e.length,n=new Float32Array(r),o=new Float32Array(r),a=new Float32Array(r),s=0;s<r;s++){var c=3*s;n[s]=t[c],o[s]=t[c+1],a[s]=t[c+2]}var u=Sh(t);0===t.length&&(u[0].set([0,0,0]),u[1].set([0,0,0]));var h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,P,T,E,C=u[0],I=u[1],R=-1,L=new Float32Array([0,0,0]),O=new Float32Array([0,0,0]),N=new Float32Array([0,0,0]);function D(t,i,s,c){d=Eo(t,1.4),f=Eo(i,2),m=Eo(s,!0),g=Eo(c,30),h=new Float32Array(r),l=new Float32Array(r);for(var u=0;u<h.length;++u){var L=e[u]+d;h[u]=L,l[u]=L*L}p=0;for(var O=0;O<h.length;++O)h[O]>p&&(p=h[O]);var N;N=sp(C,I,p,f,0),f=N.scaleFactor,v=N.dim,y=N.matrix,E=Math.min(5,2+Math.floor(d*f)),b=ou(v[0]*v[1]*v[2],-1001),x=new Int32Array(b.length),_=new Float32Array(v[0]),w=new Float32Array(v[1]),S=new Float32Array(v[2]),k(_,C[0],1/f),k(w,C[1],1/f),k(S,C[2],1/f),function(){var t=0,e=2*Math.PI/g;M=new Float32Array(g),A=new Float32Array(g);for(var i=0;i<g;i++)M[i]=Math.cos(t),A[i]=Math.sin(t),t+=e}(),P=new fg(n,o,a,h,C,I,2.01*p),T=new Int32Array(P.neighbourListLength),R=-1}function k(t,e,i){for(var r=0;r<t.length;r++)t[r]=e+i*r}function F(t,e,i,r,n){var o;if(-1!==R){if((o=R)!==r&&o!==n&&B(o,t,e,i))return o;R=-1}var a=0;for(o=T[a];o>=0;){if(o!==r&&o!==n&&B(o,t,e,i))return R=o,o;o=T[++a]}return R=-1,-1}function B(e,i,r,n){var o=3*e,a=l[e],s=t[o]-i,c=t[o+1]-r,u=t[o+2]-n;return s*s+c*c+u*u<a}function z(){for(var t=0;t<r;t++){var e=n[t],i=o[t],s=a[t],c=h[t],u=l[t];P.withinRadii(e,i,s,c,T);for(var p=Math.ceil(c*f),d=Math.floor(f*(e-C[0])),g=Math.floor(f*(i-C[1])),y=Math.floor(f*(s-C[2])),A=Math.max(0,d-p),M=Math.max(0,g-p),E=Math.max(0,y-p),I=Math.min(v[0],d+p+2),R=Math.min(v[1],g+p+2),L=Math.min(v[2],y+p+2),O=A;O<I;O++)for(var N=_[O]-e,D=v[1]*v[2]*O,k=M;k<R;k++)for(var B=w[k]-i,z=N*N+B*B,U=D+v[2]*k,j=E;j<L;j++){var G=S[j]-s,V=z+G*G;if(V<u){var $=j+U;b[$]<0&&(b[$]=-b[$]);var H=Math.sqrt(V),W=c/H,X=N*W,q=B*W,Y=G*W;if(-1===F(X+=e,q+=i,Y+=s,t,-1)){var Z=c-H;Z<b[$]&&(b[$]=Z,m&&(x[$]=t))}}}}}function U(t,e){var i=h[t],r=h[e],s=L[0]=n[e]-n[t],c=L[1]=o[e]-o[t],u=L[2]=a[e]-a[t],l=s*s+c*c+u*u,p=Math.sqrt(l),d=i*((i*i+p*p-r*r)/(2*i*p));Nh(L,L),function(t,e){t[0]=t[1]=t[2]=1,0!==e[0]?t[0]=(e[1]+e[2])/-e[0]:0!==e[1]?t[1]=(e[0]+e[2])/-e[1]:0!==e[2]&&(t[2]=(e[0]+e[1])/-e[2])}(O,L),Nh(O,O),Eh(N,L,O),Nh(N,N);var y=Math.sqrt(i*i-d*d);Oh(O,O,y),Oh(N,N,y),Oh(L,L,d),L[0]+=n[t],L[1]+=o[t],L[2]+=a[t],R=-1;for(var P=E,T=0;T<g;T++){var I=M[T],D=A[T],k=L[0]+I*O[0]+D*N[0],B=L[1]+I*O[1]+D*N[1],z=L[2]+I*O[2]+D*N[2];if(-1===F(k,B,z,t,e))for(var U=Math.floor(f*(k-C[0])),j=Math.floor(f*(B-C[1])),G=Math.floor(f*(z-C[2])),V=Math.max(0,U-P),$=Math.max(0,j-P),H=Math.max(0,G-P),W=Math.min(v[0],U+P+2),X=Math.min(v[1],j+P+2),q=Math.min(v[2],G+P+2),Y=V;Y<W;Y++){s=k-_[Y];for(var Z=v[1]*v[2]*Y,K=$;K<X;K++)for(var Q=s*s+(c=B-w[K])*c,J=Z+v[2]*K,tt=H;tt<q;tt++){l=Q+(u=z-S[tt])*u;var et=tt+J,it=b[et];it>0&&l<it*it&&(b[et]=Math.sqrt(l),m&&(x[et]=t))}}}}function j(t,e,s){console.time("AVSurface.getVolume"),console.time("AVSurface.init"),D(t,e,s),console.timeEnd("AVSurface.init"),console.time("AVSurface.projectPoints"),z(),console.timeEnd("AVSurface.projectPoints"),console.time("AVSurface.projectTorii"),function(){for(var t=0;t<r;t++){P.withinRadii(n[t],o[t],a[t],h[t],T);for(var e=0,i=T[e];i>=0;)t<i&&U(t,i),i=T[++e]}}(),console.timeEnd("AVSurface.projectTorii"),function(){for(var t=0;t<b.length;t++)b[t]<0&&(b[t]=0)}(),function(){for(var t=0;t<x.length;t++)x[t]=i[x[t]]}(),console.timeEnd("AVSurface.getVolume")}this.getSurface=function(t,e,i,r,n,o,a){return j(e,i,n),new hp(b,v[2],v[1],v[0],x).getSurface(e,!1,void 0,y,a)}}xc.add("line",lg),dg.__deps=[sp,ap,hp,Sh,pg],mg.__deps=[sp,hp,ou,Sh,Oh,Eh,Nh,fg,Eo],vc.add("molsurf",(function(t,e){var i=t.data.args,r=t.data.params;if(i&&r){var n=new("av"===r.type?mg:dg)(i.coordList,i.radiusList,i.indexList).getSurface(r.type,r.probeRadius,r.scaleFactor,r.cutoff,!0,r.smooth,r.contour),o=[n.position.buffer,n.index.buffer];n.normal&&o.push(n.normal.buffer),n.atomindex&&o.push(n.atomindex.buffer),e({sd:n,p:r},o)}}),[dg,mg]);var gg=function(t){this.structure=t};gg.prototype._getAtomData=function(){return this.structure.getAtomData({what:{position:!0,radius:!0,index:!0},radiusParams:{radius:"vdw",scale:1}})},gg.prototype._makeSurface=function(t,e){var i=new cp(e.name,"",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},gg.prototype.getSurface=function(t){var e=t||{},i=this._getAtomData(),r=i.position,n=i.radius,o=i.index,a=new("av"===e.type?mg:dg)(r,n,o).getSurface(e.type,e.probeRadius,e.scaleFactor,e.cutoff,!0,e.smooth,e.contour);return this._makeSurface(a,e)},gg.prototype.getSurfaceWorker=function(t,e){var i=this,r=Object.assign({},t);if(window.Worker){void 0===this.worker&&(this.worker=new Ql("molsurf"));var n=this._getAtomData(),o=n.position,a=n.radius,s=n.index,c={args:{coordList:o,radiusList:a,indexList:s},params:r},u=[o.buffer,a.buffer,s.buffer];this.worker.post(c,u,(function(t){e(i._makeSurface(t.data.sd,r))}),(function(t){console.warn("MolecularSurface.getSurfaceWorker error - trying without worker",t),i.worker.terminate(),i.worker=void 0;var n=i.getSurface(r);e(n)}))}else{var h=this.getSurface(r);e(h)}},gg.prototype.dispose=function(){this.worker&&this.worker.terminate()};var vg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="surface",this.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},contour:{type:"boolean",rebuild:!0},background:{type:"boolean",rebuild:!0},opaqueBack:{type:"boolean",buffer:!0},filterSele:{type:"text",rebuild:!0},colorVolume:{type:"hidden"},useWorker:{type:"boolean",rebuild:!0}},this.parameters,{radiusType:null,radius:null,scale:null}),this.__infoList=[],this.structure.signals.refreshed.add((function(){this.__forceNewMolsurf=!0}),this),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"uniform"),i.colorValue=Eo(i.colorValue,14540253),i.disablePicking=Eo(i.disablePicking,!0),this.surfaceType=Eo(i.surfaceType,"ms"),this.probeRadius=Eo(i.probeRadius,1.4),this.smooth=Eo(i.smooth,2),this.scaleFactor=Eo(i.scaleFactor,2),this.cutoff=Eo(i.cutoff,0),this.contour=Eo(i.contour,!1),this.background=Eo(i.background,!1),this.opaqueBack=Eo(i.opaqueBack,!0),this.filterSele=Eo(i.filterSele,""),this.colorVolume=Eo(i.colorVolume,void 0),this.useWorker=Eo(i.useWorker,!0),t.prototype.init.call(this,e)},e.prototype.prepareData=function(t,e,i){var r=this.__infoList[e];if(r||(r={},this.__infoList[e]=r),r.molsurf&&r.sele===t.selection.string)i(e);else{if(this.filterSele){var n=t.structure.getView(new nc(this.filterSele)),o=n.boundingBox.getSize(),a=Math.max(o.x,o.y,o.z),s=t.getAtomSetWithinPoint(n.center,a/2+6);t=t.getView(new nc(t.getAtomSetWithinSelection(s,3).toSeleString()))}r.sele=t.selection.string,r.molsurf=new gg(t);var c=this.getSurfaceParams(),u=function(t){r.surface=t,i(e)};this.useWorker?r.molsurf.getSurfaceWorker(c,u):u(r.molsurf.getSurface(c))}},e.prototype.prepare=function(t){var e=this;if((this.__forceNewMolsurf||this.__sele!==this.selection.string||this.__surfaceParams!==JSON.stringify(this.getSurfaceParams()))&&(this.__infoList.forEach((function(t){t.molsurf.dispose()})),this.__infoList.length=0),0!==this.structureView.atomCount){var i=function(){this.__sele=this.selection.string,this.__surfaceParams=JSON.stringify(this.getSurfaceParams()),this.__forceNewMolsurf=!1,t()}.bind(this),r="default"===this.assembly?this.defaultAssembly:this.assembly,n=this.structure.biomolDict[r];n?n.partList.forEach((function(t,r){var o=t.getView(e.structureView);e.prepareData(o,r,(function(t){t===n.partList.length-1&&i()}))})):this.prepareData(this.structureView,0,i)}else t()},e.prototype.createData=function(t,e){var i=this.__infoList[e],r=i.surface,n={position:r.getPosition(),color:r.getColor(this.getColorParams()),index:r.getFilteredIndex(this.filterSele,t)},o=[];if(r.contour){var a=new xf(n,this.getBufferParams({wireframe:!1}));o.push(a)}else{n.normal=r.getNormal(),n.picking=r.getPicking(t.getStructure());var s=new mf(n,this.getBufferParams({background:this.background,opaqueBack:this.opaqueBack,dullInterior:!1})),c=new yf(s);o.push(c)}return{bufferList:o,info:i}},e.prototype.updateData=function(t,e){var i={};if(t.position)return 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)),e.bufferList[0].setAttributes(i)},e.prototype.setParameters=function(e,i,r){return i=i||{},e&&e.filterSele&&(i.index=!0),e&&void 0!==e.colorVolume&&(i.color=!0),e&&e.wireframe&&(e.contour||void 0===e.contour&&this.contour)&&(e.wireframe=!1),t.prototype.setParameters.call(this,e,i,r),this},e.prototype.getSurfaceParams=function(t){return Object.assign({type:this.surfaceType,probeRadius:this.probeRadius,scaleFactor:this.scaleFactor,smooth:this.smooth&&!this.contour,cutoff:this.cutoff,contour:this.contour,useWorker:this.useWorker},t)},e.prototype.getColorParams=function(){var e=t.prototype.getColorParams.call(this);return e.volume=this.colorVolume,e},e.prototype.clear=function(){t.prototype.clear.call(this)},e.prototype.dispose=function(){this.__infoList.forEach((function(t){t.molsurf.dispose()})),this.__infoList.length=0,t.prototype.dispose.call(this)},e}(Cf);xc.add("surface",vg);var yg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="point",this.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}},this.parameters,{flatShaded:null,wireframe:null,linewidth:null,roughness:null,metalness:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};this.pointSize=Eo(i.pointSize,1),this.sizeAttenuation=Eo(i.sizeAttenuation,!0),this.sortParticles=Eo(i.sortParticles,!1),this.useTexture=Eo(i.useTexture,!1),this.alphaTest=Eo(i.alphaTest,.5),this.forceTransparent=Eo(i.forceTransparent,!1),this.edgeBleach=Eo(i.edgeBleach,0),t.prototype.init.call(this,i)},e.prototype.createData=function(t){var e=t.getAtomData(this.getAtomParams({position:!0,color:!0,picking:!0}));return{bufferList:[new wf(e,this.getBufferParams({pointSize:this.pointSize,sizeAttenuation:this.sizeAttenuation,sortParticles:this.sortParticles,useTexture:this.useTexture,alphaTest:this.alphaTest,forceTransparent:this.forceTransparent,edgeBleach:this.edgeBleach}))]}},e.prototype.updateData=function(t,e){var i=e.sview.getAtomData(this.getAtomParams(t)),r={};t&&!t.position||(r.position=i.position),t&&!t.color||(r.color=i.color),e.bufferList[0].setAttributes(r)},e}(Cf);xc.add("point",yg),wc.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\n#include unpack_color\nattribute float primitiveId;\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 = unpackColor( primitiveId );\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}");var bg=new Uint16Array([0,1,2,1,3,2]),xg=function(t){function e(e,i){var r=e||{},n=r.position.length/3-1,o=4*n,a=3*o,s=new Float32Array(a),c=new Float32Array(a),u=new Float32Array(a),h=zo(a,a/3);t.call(this,{position:s,color:c,index:h,normal:u,picking:r.picking},i),this.addAttributes({dir:{type:"v3",value:new Float32Array(a)}}),this.addAttributes({size:{type:"f",value:new Float32Array(o)}}),r.primitiveId=su(n),this.setAttributes(r),this.meshIndex=h,this.makeIndex()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={vertexShader:{}};return e.prototype.setAttributes=function(t){var e,i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x=this.size/4,_=this.geometry.attributes;t.position&&(e=t.position,s=_.position.array,_.position.needsUpdate=!0),t.normal&&(i=t.normal,c=_.normal.array,_.normal.needsUpdate=!0),t.size&&(r=t.size,u=_.size.array,_.size.needsUpdate=!0),t.dir&&(n=t.dir,h=_.dir.array,_.dir.needsUpdate=!0),t.color&&(o=t.color,l=_.color.array,_.color.needsUpdate=!0),t.primitiveId&&(a=t.primitiveId,p=_.primitiveId.array,_.primitiveId.needsUpdate=!0);var w=r?r[0]:null;for(d=0;d<x;++d){for(y=3*d,m=3*d*4,v=4*d,e&&(s[m]=s[m+3]=e[y],s[m+1]=s[m+4]=e[y+1],s[m+2]=s[m+5]=e[y+2],s[m+6]=s[m+9]=e[y+3],s[m+7]=s[m+10]=e[y+4],s[m+8]=s[m+11]=e[y+5]),i&&(c[m]=c[m+3]=-i[y],c[m+1]=c[m+4]=-i[y+1],c[m+2]=c[m+5]=-i[y+2],c[m+6]=c[m+9]=-i[y+3],c[m+7]=c[m+10]=-i[y+4],c[m+8]=c[m+11]=-i[y+5]),f=0;f<4;++f)g=m+3*f,o&&(l[g]=o[y],l[g+1]=o[y+1],l[g+2]=o[y+2]),a&&(p[v+f]=a[d]);r&&(b=r[d],w!==r[d]?(u[v]=w,u[v+1]=w,u[v+2]=b,u[v+3]=b):(u[v]=b,u[v+1]=b,u[v+2]=b,u[v+3]=b),w=b),n&&(h[m]=n[y],h[m+1]=n[y+1],h[m+2]=n[y+2],h[m+3]=-n[y],h[m+4]=-n[y+1],h[m+5]=-n[y+2],h[m+6]=n[y+3],h[m+7]=n[y+4],h[m+8]=n[y+5],h[m+9]=-n[y+3],h[m+10]=-n[y+4],h[m+11]=-n[y+5])}},e.prototype.makeIndex=function(){var t,e,i,r,n=this.meshIndex,o=n.length/4/3;for(e=0;e<o;++e)for(i=6*e,r=4*e,n.set(bg,i),t=0;t<6;++t)n[i+t]+=r},i.vertexShader.get=function(){return"Ribbon.vert"},Object.defineProperties(e.prototype,i),e}(wd),_g=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="ribbon",this.parameters=Object.assign({subdiv:{type:"integer",max:50,min:1,rebuild:!0},tension:{type:"number",precision:1,max:1,min:.1},smoothSheet:{type:"boolean",rebuild:!0}},this.parameters,{side:null,wireframe:null,linewidth:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"chainname"),i.colorScale=Eo(i.colorScale,"RdYlBu"),i.radius=Eo(i.radius,"sstruc"),i.scale=Eo(i.scale,4),"low"===i.quality?this.subdiv=3:"medium"===i.quality?this.subdiv=6:"high"===i.quality?this.subdiv=12:this.subdiv=Eo(i.subdiv,6),this.tension=Eo(i.tension,NaN),this.smoothSheet=Eo(i.smoothSheet,!1),t.prototype.init.call(this,i)},e.prototype.getSplineParams=function(t){return Object.assign({subdiv:this.subdiv,tension:this.tension,directional:!0,smoothSheet:this.smoothSheet},t)},e.prototype.createData=function(t){var e=this,i=[],r=[];return this.structure.eachPolymer((function(t){if(!(t.residueCount<4)){r.push(t);var n=new Hm(t,e.getSplineParams()),o=n.getSubdividedPosition(),a=n.getSubdividedOrientation(),s=n.getSubdividedColor(e.getColorParams()),c=n.getSubdividedPicking(),u=n.getSubdividedSize(e.radius,e.scale);i.push(new xg({position:o.position,normal:a.binormal,dir:a.normal,color:s.color,size:u.size,picking:c.picking},e.getBufferParams()))}}),t.getSelection()),{bufferList:i,polymerList:r}},e.prototype.updateData=function(t,e){t=t||{};var i=0,r=e.polymerList.length;for(i=0;i<r;++i){var n={},o=new Hm(e.polymerList[i],this.getSplineParams());if(t.position){var a=o.getSubdividedPosition(),s=o.getSubdividedOrientation();n.position=a.position,n.normal=s.binormal,n.dir=s.normal}if(t.radius||t.scale){var c=o.getSubdividedSize(this.radius,this.scale);n.size=c.size}if(t.color){var u=o.getSubdividedColor(this.getColorParams());n.color=u.color}e.bufferList[i].setAttributes(n)}},e.prototype.setParameters=function(e){var i={};return e&&e.tension&&(i.position=!0),t.prototype.setParameters.call(this,e,i,!1),this},e}(Cf);xc.add("ribbon",_g);var wg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="rocket",this.parameters=Object.assign({localAngle:{type:"integer",max:180,min:0,rebuild:!0},centerDist:{type:"number",precision:1,max:10,min:0,rebuild:!0},ssBorder:{type:"boolean",rebuild:!0},radialSegments:!0,openEnded:!0,disableImpostor:!0},this.parameters),this.helixbundleList=[],this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"sstruc"),i.radius=Eo(i.radius,1.5),i.scale=Eo(i.scale,1),i.openEnded=Eo(i.openEnded,!1),this.localAngle=Eo(i.localAngle,30),this.centerDist=Eo(i.centerDist,2.5),this.ssBorder=Eo(i.ssBorder,!1),t.prototype.init.call(this,i)},e.prototype.createData=function(t){var e=this,i=0,r=[],n=[];this.structure.eachPolymer((function(t){if(!(t.residueCount<4||t.isNucleic())){var o=new Ap(t),a=o.getAxis(e.localAngle,e.centerDist,e.ssBorder,e.getColorParams(),e.radius,e.scale);i+=a.size.length,r.push(a),n.push(o)}}),t.getSelection());var o={begin:new Float32Array(3*i),end:new Float32Array(3*i),size:new Float32Array(i),color:new Float32Array(3*i),picking:new Float32Array(i)},a=0;return r.forEach((function(t){o.begin.set(t.begin,3*a),o.end.set(t.end,3*a),o.size.set(t.size,a),o.color.set(t.color,3*a),o.picking.set(t.picking.array,a),a+=t.size.length})),i&&(o.picking=new $h(o.picking,t.getStructure())),{bufferList:[new qd({position1:o.begin,position2:o.end,color:o.color,color2:o.color,radius:o.size,picking:o.picking},this.getBufferParams({openEnded:this.openEnded,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}))],axisList:r,helixbundleList:n,axisData:o}},e.prototype.updateData=function(t,e){var i=this;if((t=t||{}).position)this.build();else{var r={};if(t.color||t.radius){var n=0;e.helixbundleList.forEach((function(r){var o=r.getAxis(i.localAngle,i.centerDist,i.ssBorder,i.getColorParams(),i.radius,i.scale);t.color&&e.axisData.color.set(o.color,3*n),(t.radius||t.scale)&&e.axisData.size.set(o.size,n),n+=o.size.length})),t.color&&(r.color=e.axisData.color,r.color2=e.axisData.color),(t.radius||t.scale)&&(r.radius=e.axisData.size)}e.bufferList[0].setAttributes(r)}},e}(Cf);xc.add("rocket",wg);var Sg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="rope",this.parameters=Object.assign({smooth:{type:"integer",max:15,min:0,rebuild:!0}},this.parameters,{aspectRatio:null,smoothSheet:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.aspectRatio=1,i.tension=Eo(i.tension,.5),i.scale=Eo(i.scale,5),i.smoothSheet=!1,this.smooth=Eo(i.smooth,2),t.prototype.init.call(this,i)},e.prototype.getSpline=function(t){var e=new Sp(t);return new Hm(t,this.getSplineParams({directional:!1,positionIterator:e.getCenterIterator(this.smooth)}))},e}(Ym);xc.add("rope",Sg);var Ag=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="spacefill",this.parameters=Object.assign({sphereDetail:!0,disableImpostor:!0},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};t.prototype.init.call(this,i)},e.prototype.createData=function(t){return{bufferList:[new Od(t.getAtomData(this.getAtomParams()),this.getBufferParams({sphereDetail:this.sphereDetail,dullInterior:!0,disableImpostor:this.disableImpostor}))]}},e.prototype.updateData=function(t,e){var i=e.sview.getAtomData(this.getAtomParams(t)),r={};t&&!t.position||(r.position=i.position),t&&!t.color||(r.color=i.color),t&&!t.radius||(r.radius=i.radius),e.bufferList[0].setAttributes(r)},e}(Cf);xc.add("spacefill",Ag);var Mg=function(t){function e(e,i){var r=i||{},n=(e||{}).position.length/3-1,o=new Float32Array(3*n*2),a=new Float32Array(3*n*2);t.call(this,{position:o,color:a},r),this.setAttributes(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isLine:{},vertexShader:{},fragmentShader:{}};return e.prototype.setAttributes=function(t){var e,i,r,n,o=this.geometry.attributes;if(t.position&&(e=t.position,r=o.position.array,o.position.needsUpdate=!0),t.color&&(i=t.color,n=o.color.array,o.color.needsUpdate=!0),e||i)for(var a,s,c=this.size-1,u=0;u<c;++u)a=3*u,s=3*u*2,e&&(r[s]=e[a],r[s+1]=e[a+1],r[s+2]=e[a+2],r[s+3]=e[a+3],r[s+4]=e[a+4],r[s+5]=e[a+5]),i&&(n[s]=i[a],n[s+1]=i[a+1],n[s+2]=i[a+2],n[s+3]=i[a+3],n[s+4]=i[a+4],n[s+5]=i[a+5]);else mc.warn("TraceBuffer.prototype.setAttributes no data")},i.isLine.get=function(){return!0},i.vertexShader.get=function(){return"Line.vert"},i.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,i),e}(xd),Pg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="trace",this.parameters=Object.assign({subdiv:{type:"integer",max:50,min:1,rebuild:!0},tension:{type:"number",precision:1,max:1,min:.1},smoothSheet:{type:"boolean",rebuild:!0}},this.parameters,{flatShaded:null,side:null,wireframe:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"chainname"),i.colorScale=Eo(i.colorScale,"RdYlBu"),"low"===i.quality?this.subdiv=3:"medium"===i.quality?this.subdiv=6:"high"===i.quality?this.subdiv=12:this.subdiv=Eo(i.subdiv,6),this.tension=Eo(i.tension,NaN),this.smoothSheet=Eo(i.smoothSheet,!1),t.prototype.init.call(this,i)},e.prototype.getSplineParams=function(t){return Object.assign({subdiv:this.subdiv,tension:this.tension,directional:!1,smoothSheet:this.smoothSheet},t)},e.prototype.createData=function(t){var e=this,i=[],r=[];return this.structure.eachPolymer((function(t){if(!(t.residueCount<4)){r.push(t);var n=new Hm(t,e.getSplineParams()),o=n.getSubdividedPosition(),a=n.getSubdividedColor(e.getColorParams());i.push(new Mg(Object.assign({},o,a),e.getBufferParams()))}}),t.getSelection()),{bufferList:i,polymerList:r}},e.prototype.updateData=function(t,e){t=t||{};var i=0,r=e.polymerList.length;for(i=0;i<r;++i){var n={},o=new Hm(e.polymerList[i],this.getSplineParams());if(t.position){var a=o.getSubdividedPosition();n.position=a.position}if(t.color){var s=o.getSubdividedColor(this.getColorParams());n.color=s.color}e.bufferList[i].setAttributes(n)}},e.prototype.setParameters=function(e){var i={};return e&&e.tension&&(i.position=!0),t.prototype.setParameters.call(this,e,i,!1),this},e}(Cf);xc.add("trace",Pg);var Tg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="tube",this.parameters=Object.assign({},this.parameters,{aspectRatio:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.aspectRatio=1,i.scale=Eo(i.scale,2),"low"===i.quality&&(this.radialSegments=5),t.prototype.init.call(this,i)},e.prototype.getSplineParams=function(){return t.prototype.getSplineParams.call(this,{directional:!1})},e}(Ym);xc.add("tube",Tg);var Eg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="unitcell",this.parameters=Object.assign({radius:{type:"number",precision:3,max:10,min:.001},sphereDetail:!0,radialSegments:!0,disableImpostor:!0},this.parameters,{assembly:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{},r=.5;this.structure.unitcell&&(r=Math.cbrt(this.structure.unitcell.volume)/200),i.radius=Eo(i.radius,r),i.colorValue=Eo(i.colorValue,"orange"),t.prototype.init.call(this,i)},e.prototype.getUnitcellData=function(t){return t.unitcell.getData(t)},e.prototype.create=function(){var t=this.structureView.getStructure();if(t.unitcell){var e=this.getUnitcellData(t);this.sphereBuffer=new Od(e.vertex,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0})),this.cylinderBuffer=new qd(e.edge,this.getBufferParams({openEnded:!0,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bufferList:[this.sphereBuffer,this.cylinderBuffer]})}},e.prototype.updateData=function(t,e){var i=e.sview.getStructure(),r=this.getUnitcellData(i),n={},o={};t&&!t.position||(n.position=r.vertexPosition,o.position1=r.edgePosition1,o.position2=r.edgePosition2),t&&!t.color||(n.color=r.vertexColor,o.color=r.edgeColor,o.color2=r.edgeColor),t&&!t.radius||(n.radius=r.vertexRadius,o.radius=r.edgeRadius),this.sphereBuffer.setAttributes(n),this.cylinderBuffer.setAttributes(o)},e}(Cf);xc.add("unitcell",Eg);var Cg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="validation",this.parameters=Object.assign({},this.parameters,{radiusType:null,radius:null,scale:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorValue=Eo(i.colorValue,"#f0027f"),t.prototype.init.call(this,i)},e.prototype.createData=function(t){if(t.validation){var e=t.validation.getClashData({structure:t,color:this.colorValue});return{bufferList:[new qd(e,this.getBufferParams({openEnded:!1}))]}}},e}(Cf);xc.add("validation",Cg);var Ig=function(t,e){var i=e||{};this.streamer=t,this.name=Eo(i.name,""),this.path=Eo(i.path,"")},Rg={type:{},__objName:{}};function Lg(t){var e,i,r=null,n=null,o=null,a=null,s=null,c=null,u=t.atomStore,h=t.residueStore,l=t.chainStore,p=t.modelStore,d=t.residueMap,f=-1,m=-1,g=-1,v=-1;function y(t){for(var r=h.atomCount[t],n=h.atomOffset[t],o=new Array(r),a=0;a<r;++a)o[a]=u.atomTypeId[n+a];h.residueTypeId[t]=d.add(e,o,i)}this.addAtom=function(t,d,b,x,_,w,S,A){var M=!1,P=!1,T=!1;r!==t?(M=!0,P=!0,T=!0,v+=1,g+=1,m+=1):n!==b?(P=!0,T=!0,g+=1,m+=1):a===_&&o===x&&s===A||(T=!0,m+=1),f+=1,M&&(p.growIfFull(),p.chainOffset[v]=g,p.chainCount[v]=0,p.count+=1,l.modelIndex[g]=v),P&&(l.growIfFull(),l.setChainname(g,d),l.setChainid(g,b),l.residueOffset[g]=m,l.residueCount[g]=0,l.count+=1,l.modelIndex[g]=v,p.chainCount[v]+=1,h.chainIndex[m]=g),T&&(e=o,i=c,m>0&&y(m-1),h.growIfFull(),h.resno[m]=_,void 0!==S&&(h.sstruc[m]=S.charCodeAt(0)),void 0!==A&&(h.inscode[m]=A.charCodeAt(0)),h.atomOffset[m]=f,h.atomCount[m]=0,h.count+=1,h.chainIndex[m]=g,l.residueCount[g]+=1),u.count+=1,u.residueIndex[f]=m,h.atomCount[m]+=1,r=t,n=b,o=x,a=_,s=A,c=w},this.finalize=function(){e=o,i=c,m>-1&&y(m)}}Rg.type.get=function(){return""},Rg.__objName.get=function(){return""},Ig.prototype.parse=function(){var t=this;return this.streamer.read().then((function(){return t._beforeParse(),t._parse(),t._afterParse(),t[t.__objName]}))},Ig.prototype._parse=function(){},Ig.prototype._beforeParse=function(){},Ig.prototype._afterParse=function(){gc&&mc.log(this[this.__objName])},Object.defineProperties(Ig.prototype,Rg);var Og=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.firstModelOnly=Eo(r.firstModelOnly,!1),this.asTrajectory=Eo(r.asTrajectory,!1),this.cAlphaOnly=Eo(r.cAlphaOnly,!1),this.structure=new ld(this.name,this.path),this.structureBuilder=new Lg(this.structure)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"structure"},i.__objName.get=function(){return"structure"},Object.defineProperties(e.prototype,i),e}(Ig);var Ng=function(t,e,i,r,n){this.structure=t,this.index=e,this.description=i||"",this.entityType=function(t){switch(t=t.toLowerCase()){case"polymer":return 1;case"non-polymer":return 2;case"macrolide":return 3;case"water":return 4;default:return 0}}(r||""),this.chainIndexList=n||[],n.forEach((function(i){t.chainStore.entityIndex[i]=e}))},Dg={type:{}};Dg.type.get=function(){return"Entity"},Ng.prototype.getEntityType=function(){return this.entityType},Ng.prototype.isPolymer=function(){return 1===this.entityType},Ng.prototype.isNonPolymer=function(){return 2===this.entityType},Ng.prototype.isMacrolide=function(){return 3===this.entityType},Ng.prototype.isWater=function(){return 4===this.entityType},Ng.prototype.eachChain=function(t){var e=this.structure.getChainProxy();this.chainIndexList.forEach((function(i){e.index=i,t(e)}))},Object.defineProperties(Ng.prototype,Dg);var kg=function(t){var e=t||{};this.a=e.a||1,this.b=e.b||1,this.c=e.c||1,this.alpha=e.alpha||90,this.beta=e.beta||90,this.gamma=e.gamma||90,this.spacegroup=e.spacegroup||"P 1",this.cartToFrac=e.cartToFrac||e.scale,this.fracToCart=new N;var i=Qo(this.alpha),r=Qo(this.beta),n=Qo(this.gamma),o=Math.cos(i),a=Math.cos(r),s=Math.cos(n),c=Math.sin(r),u=Math.sin(n);if(this.volume=this.a*this.b*this.c*Math.sqrt(1-o*o-a*a-s*s+2*o*a*s),void 0===this.cartToFrac){var h=this.a*this.b*u/this.volume,l=(a*s-o)/(c*u);this.fracToCart.set(this.a,0,0,0,this.b*s,this.b*u,0,0,this.c*a,-this.c*c*l,1/h,0,0,0,0,1).transpose(),this.cartToFrac=(new N).getInverse(this.fracToCart)}else this.fracToCart.getInverse(this.cartToFrac)};kg.prototype.getPosition=function(t){var e=new Float32Array(24),i=t.unitcell,r=t.center.clone().applyMatrix4(i.cartToFrac).floor().multiplyScalar(2).addScalar(1),n=new O,o=0;function a(t,a,s){n.set(t,a,s).multiply(r).applyMatrix4(i.fracToCart).toArray(e,o),o+=3}return a(0,0,0),a(1,0,0),a(0,1,0),a(0,0,1),a(1,1,0),a(1,0,1),a(0,1,1),a(1,1,1),e},kg.prototype.getCenter=function(t){return function(t,e){var i=t.length;e=e||new O;for(var r=0;r<i;r+=3)e.x+=t[r],e.y+=t[r+1],e.z+=t[r+2];return e.divideScalar(i/3),e}(this.getPosition(t))},kg.prototype.getData=function(t,e){var i=e||{},r=Eo(i.colorValue,"orange"),n=Eo(i.radius,Math.cbrt(this.volume)/200),o=new St(r),a=new O,s=this.getPosition(t),c=au(8,o.r,o.g,o.b),u=ou(8,n),h=new Float32Array(36),l=new Float32Array(36),p=au(12,o.r,o.g,o.b),d=ou(12,n),f=0;function m(t,e){a.fromArray(s,3*t).toArray(h,f),a.fromArray(s,3*e).toArray(l,f),f+=3}m(0,1),m(0,2),m(0,3),m(1,4),m(1,5),m(2,6),m(3,5),m(4,7),m(5,7),m(2,4),m(7,6),m(3,6);var g=new il(this,t);return{vertex:{position:s,color:c,radius:u,picking:g},edge:{position1:h,position2:l,color:p,color2:p,radius:d,picking:g}}};var Fg={1:"h",2:"h",3:"i",4:"h",5:"g",6:"h",7:"h",8:"h",9:"h",10:"h","":"h"},Bg=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.hex=Eo(r.hex,!1)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"pdb"},e.prototype._parse=function(){gc&&mc.time("PdbParser._parse "+this.name);var t=!1,e=this.streamer.peekLines(1)[0],i=e.substr(62,4),r=e.substr(72,4);i===r&&r.trim()&&(t=!0);var n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,P,T,E,C,I,R,L,O,D,k,F="pqr"===this.type,B=/\s+/,z=this.structure,U=this.structureBuilder,j=this.hex,G=10,V=10,$=this.firstModelOnly,H=this.asTrajectory,W=this.cAlphaOnly,X=z.frames,q=z.boxes,Y=!1,Z=z.biomolDict,K={},Q={},J={},tt=[],et=["MOL_ID","MOLECULE","CHAIN","FRAGMENT","SYNONYM","EC","ENGINEERED","MUTATION","OTHER_DETAILS"],it={},rt={},nt={helices:[],sheets:[]},ot=nt.helices,at=nt.sheets,st=z.atomMap,ct=z.atomStore;ct.resize(Math.round(this.streamer.data.length/80));var ut=z.getAtomProxy(),ht=z.getAtomProxy(),lt=0,pt=0,dt=!0;this.streamer.eachChunkOfLines((function(e){!function(e,i,r){for(var nt=e;nt<i;++nt)if(u=r[nt],"ATOM  "===(h=u.substr(0,6))||"HETATM"===h){if(dt&&(H?(Y?(n=new Float32Array(3*ct.count),X.push(n)):n=[],o=0):$||(K={}),I=(C=1).toString(),R=!0,dt=!1),$&&pt>0)continue;var ft=void 0,mt=void 0,gt=void 0,vt=void 0,yt=void 0;if(F){if(yt=10===(vt=u.split(B)).length?1:0,v=vt[2],W&&"CA"!==v)continue;ft=parseFloat(vt[6-yt]),mt=parseFloat(vt[7-yt]),gt=parseFloat(vt[8-yt])}else{if(v=u.substr(12,4).trim(),W&&"CA"!==v)continue;ft=parseFloat(u.substr(30,8)),mt=parseFloat(u.substr(38,8)),gt=parseFloat(u.substr(46,8))}if(H){var bt=3*o;if(n[bt+0]=ft,n[bt+1]=mt,n[bt+2]=gt,o+=1,Y)continue}var xt=void 0;F?(l=parseInt(vt[1]),xt="",y="H"===u[0]?1:0,p=yt?"":vt[4],d=parseInt(vt[5-yt]),g="",f=vt[3],b=parseFloat(vt[9-yt]),x="",m=0):(l=parseInt(u.substr(6,5),G),j&&99999===l&&(G=16),y="H"===u[0]?1:0,p=u[21].trim(),d=parseInt(u.substr(22,4),V)||1,j&&9999===d&&(V=16),g=u[26].trim(),f=u.substr(17,4).trim()||"MOL",b=parseFloat(u.substr(60,6)),x=u[16].trim(),m=parseFloat(u.substr(54,6)),t||(xt=u.substr(76,2).trim(),p||(p=u.substr(72,4).trim()))),ct.growIfFull(),ct.atomTypeId[lt]=st.add(v,xt),ct.x[lt]=ft,ct.y[lt]=mt,ct.z[lt]=gt,ct.serial[lt]=l,ct.bfactor[lt]=isNaN(b)?0:b,ct.altloc[lt]=x.charCodeAt(0),ct.occupancy[lt]=isNaN(m)?0:m,y?L===p&&D===f&&(Al.includes(f)||O===d&&k===g)||(I=(C+=1).toString(),O=d,D=f,k=g):R||L===p||(I=(C+=1).toString()),U.addAtom(pt,p,I,f,d,y,void 0,g),K[l]=lt,lt+=1,R=!1,L=p}else if("CONECT"===h){var _t=K[parseInt(u.substr(6,5))],wt=[11,16,21,26],St={};if(void 0===_t)continue;for(var At=0;At<4;++At){var Mt=parseInt(u.substr(wt[At],5));if(!Number.isNaN(Mt)&&void 0!==(Mt=K[Mt]))if(_t<Mt?(ut.index=_t,ht.index=Mt):(ut.index=Mt,ht.index=_t),void 0!==St[Mt])z.bondStore.bondOrder[St[Mt]]+=1;else{var Pt=ut.index+"|"+ht.index;void 0===J[Pt]&&(J[Pt]=!0,St[Mt]=z.bondStore.count,z.bondStore.addBond(ut,ht,1))}}}else if("HELIX "===h){_=u[19].trim(),w=parseInt(u.substr(21,4)),S=u[25].trim(),A=u[31].trim(),M=parseInt(u.substr(33,4)),P=u[37].trim();var Tt=parseInt(u.substr(39,1));Tt=(Fg[Tt]||Fg[""]).charCodeAt(0),ot.push([_,w,S,A,M,P,Tt])}else if("SHEET "===h)_=u[21].trim(),w=parseInt(u.substr(22,4)),S=u[26].trim(),A=u[32].trim(),M=parseInt(u.substr(33,4)),P=u[37].trim(),at.push([_,w,S,A,M,P]);else if("HETNAM"===h)rt[u.substr(11,3)]=u.substr(15).trim();else if("COMPND"===h){var Et=u.substr(10,70).trim(),Ct=Et.indexOf(":"),It=Et.substring(0,Ct),Rt=void 0;et.includes(It)?(E=It,Rt=Et.substring(Ct+2)):Rt=Et,Rt=Rt.replace(/;$/,""),"MOL_ID"===E?(T={chainList:[],name:""},tt.push(T)):"MOLECULE"===E?(T.name&&(T.name+=" "),T.name+=Rt):"CHAIN"===E&&Array.prototype.push.apply(T.chainList,Rt.split(/\s*,\s*/))}else if(u.startsWith("TER")){var Lt=z.getChainProxy(z.chainStore.count-1);it[Lt.chainname]=Lt.index,I=(C+=1).toString(),R=!0}else if("REMARK"===h&&"350"===u.substr(7,3)){if("BIOMOLECULE:"===u.substr(11,12)){var Ot=u.substr(23).trim();/^(0|[1-9][0-9]*)$/.test(Ot)&&(Ot="BU"+Ot),a=new Rp(Ot),Z[Ot]=a}else if("BIOMT"===u.substr(13,5)){var Nt=u.split(/\s+/),Dt=parseInt(u[18])-1;0===Dt&&(c=new N,s.matrixList.push(c));var kt=c.elements;kt[0+Dt]=parseFloat(Nt[4]),kt[4+Dt]=parseFloat(Nt[5]),kt[8+Dt]=parseFloat(Nt[6]),kt[12+Dt]=parseFloat(Nt[7])}else if("APPLY THE FOLLOWING TO CHAINS:"===u.substr(11,30)||"                   AND CHAINS:"===u.substr(11,30)){"APPLY"===u.substr(11,5)&&(s=a.addPart());for(var Ft=u.substr(41,30).split(","),Bt=0,zt=Ft.length;Bt<zt;++Bt){var Ut=Ft[Bt].trim();Ut&&s.chainList.push(Ut)}}}else if("HEADER"===h)z.id=u.substr(62,4);else if("TITLE "===h)z.title+=(z.title?" ":"")+u.substr(10,70).trim();else if("MODEL "===h)dt=!0;else if("ENDMDL"===h||u.startsWith("END")){if(dt)continue;H&&!Y&&(X.push(new Float32Array(n)),Y=!0),pt+=1,dt=!0}else if("MTRIX"===u.substr(0,5)){if("1"===u[59])continue;var jt=u.split(/\s+/),Gt=jt[1].trim();if("1"===u[5]&&"1"===Gt){a=new Rp("NCS"),Z.NCS=a,s=a.addPart()}var Vt=parseInt(u[5])-1;0===Vt&&(c=new N,s.matrixList.push(c));var $t=c.elements;$t[0+Vt]=parseFloat(jt[2]),$t[4+Vt]=parseFloat(jt[3]),$t[8+Vt]=parseFloat(jt[4]),$t[12+Vt]=parseFloat(jt[5])}else if("ORIGX"===u.substr(0,5)){Q.origx||(Q.origx=new N);var Ht=u.split(/\s+/),Wt=parseInt(u[5])-1,Xt=Q.origx.elements;Xt[0+Wt]=parseFloat(Ht[1]),Xt[4+Wt]=parseFloat(Ht[2]),Xt[8+Wt]=parseFloat(Ht[3]),Xt[12+Wt]=parseFloat(Ht[4])}else if("SCALE"===u.substr(0,5)){Q.scale||(Q.scale=new N);var qt=u.split(/\s+/),Yt=parseInt(u[5])-1,Zt=Q.scale.elements;Zt[0+Yt]=parseFloat(qt[1]),Zt[4+Yt]=parseFloat(qt[2]),Zt[8+Yt]=parseFloat(qt[3]),Zt[12+Yt]=parseFloat(qt[4])}else if("CRYST1"===h){var Kt=parseFloat(u.substr(6,9)),Qt=parseFloat(u.substr(15,9)),Jt=parseFloat(u.substr(24,9)),te=parseFloat(u.substr(33,7)),ee=parseFloat(u.substr(40,7)),ie=parseFloat(u.substr(47,7)),re=u.substr(55,11).trim(),ne=new Float32Array(9);ne[0]=Kt,ne[4]=Qt,ne[8]=Jt,q.push(ne),0===pt&&(Q.a=Kt,Q.b=Qt,Q.c=Jt,Q.alpha=te,Q.beta=ee,Q.gamma=ie,Q.spacegroup=re)}}(0,e.length,e)}));var ft=tt.length;if(tt.length){z.eachChain((function(t){t.entityIndex=ft})),tt.forEach((function(t,e){var i=t.chainList.map((function(t){return it[t]}));z.entityList.push(new Ng(z,e,t.name,"polymer",i))}));var mt=tt.length,gt=z.getResidueProxy(),vt={};z.eachChain((function(t){t.entityIndex===ft&&(gt.index=t.residueOffset,vt[gt.resname]||(vt[gt.resname]=[]),vt[gt.resname].push(t.index))})),Object.keys(vt).forEach((function(t){var e=vt[t],i="non-polymer",r=rt[t]||t;Al.includes(t)&&(r="water",i="water"),z.entityList.push(new Ng(z,mt,r,i,e)),mt+=1}))}void 0!==Q.a?z.unitcell=new kg(Q):z.unitcell=void 0,(ot.length||at.length)&&Dp(z,nt),U.finalize(),z.finalizeAtoms(),t||Up(z),jp(z),z.finalizeBonds(),ot.length||at.length||zp(z),$p(z),gc&&mc.timeEnd("PdbParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("pdb",Bg),_c.add("pdb1",Bg),_c.add("ent",Bg);var zg=/\s+/,Ug=/'((?:(?!'\s).)*)'|"((?:(?!"\s).)*)"|(\S+)/g,jg=/"/g,Gg=/^['"]+|['"]+$/g;function Vg(t){return!t||t[0]!==t[t.length-1]||"'"!==t[0]&&'"'!==t[0]?t:t.substring(1,t.length-1)}function $g(t,e){Array.isArray(t[e])||Object.keys(t).forEach((function(e){t[e]=[t[e]]}))}function Hg(t){return"?"!==t}function Wg(t,e){return Hg(t)?t:e}function Xg(t){switch(t.toLowerCase()){case"?":case"sing":return 1;case"doub":return 2;case"trip":return 3;case"quad":return 4}return 0}var qg=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"cif"},e.prototype._parse=function(){mc.time("CifParser._parse "+this.name);var t,e,i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_=this.structure,w=this.structureBuilder,S=this.firstModelOnly,A=this.asTrajectory,M=this.cAlphaOnly,P=_.frames,T={},E={},C={},I=!1,R=null,L=!1,D=!1,k=!1,F=[],B=null,z=null,U=null,j=null,G=[],V=_.atomMap,$=_.atomStore;$.resize(this.streamer.data.length/100);var H,W=0,X=0;if(this.streamer.eachChunkOfLines((function(O){!function(O,N,q){for(var Y=O;Y<N;++Y)if(i=q[Y],((r=i.trim())||I||D)&&"#"!==r[0])if("data_"===r.substring(0,5))T.data=r.substring(5).trim();else if(";"===r[0])I?(D?(B===F.length&&(B=0),F[B].push(R),B+=1):!1===U?T[z]=R:T[z][U]=R,I=!1,R=null):(I=!0,R=r.substring(1));else if("loop_"===r)D=!0,k=!0,F.length=0,G.length=0,B=0;else if("_"===r[0]){var Z,K,Q;if(D&&!k&&(D=!1),D)K=(Z=r.split("."))[0].substring(1),Q=Z[1],1===Z.length?(Q=!1,T[K]||(T[K]=[]),F.push(T[K])):(T[K]||(T[K]={}),T[K][Q]?gc&&mc.warn(K,Q,"already exists"):(T[K][Q]=[],F.push(T[K][Q]),G.push(Q))),z=K,U=Q,j=!0;else{var J=r.match(Ug),tt=J[0],et=J[1];K=(Z=tt.split("."))[0].substring(1),Q=Z[1],1===Z.length?(Q=!1,T[K]=et):(T[K]||(T[K]={}),T[K][Q]?gc&&mc.warn(K,Q,"already exists"):T[K][Q]=et),et||(L=!0),z=K,U=Q}}else if(I)R+=i;else if(D){if(!r)continue;if("atom_site"===z){var it=r.split(zg);j&&(n=G.indexOf("auth_asym_id"),o=G.indexOf("auth_seq_id"),a=G.indexOf("label_atom_id"),s=G.indexOf("label_comp_id"),c=G.indexOf("label_asym_id"),u=G.indexOf("label_entity_id"),h=G.indexOf("label_alt_id"),g=G.indexOf("Cartn_x"),v=G.indexOf("Cartn_y"),y=G.indexOf("Cartn_z"),p=G.indexOf("id"),d=G.indexOf("type_symbol"),l=G.indexOf("group_PDB"),b=G.indexOf("B_iso_or_equiv"),f=G.indexOf("pdbx_PDB_model_num"),m=G.indexOf("pdbx_PDB_ins_code"),x=G.indexOf("occupancy"),j=!1,H=parseInt(it[f]),A&&(t=[],e=0));var rt=parseInt(it[f]);if(H!==rt&&(A&&(0===X&&P.push(new Float32Array(t)),t=new Float32Array(3*$.count),P.push(t),e=0),X+=1),H=rt,S&&X>0)continue;var nt=it[a].replace(jg,"");if(M&&"CA"!==nt)continue;var ot=parseFloat(it[g]),at=parseFloat(it[v]),st=parseFloat(it[y]);if(A){var ct=3*e;if(t[ct+0]=ot,t[ct+1]=at,t[ct+2]=st,e+=1,X>0)continue}var ut=it[s],ht=parseInt(it[o]),lt=it[m];lt="?"===lt?"":lt;var pt=it[n],dt=it[c],ft="H"===it[l][0]?1:0,mt=it[d],gt=parseFloat(it[b]),vt=parseFloat(it[x]),yt=it[h];if(yt="."===yt?"":yt,$.growIfFull(),$.atomTypeId[W]=V.add(nt,mt),$.x[W]=ot,$.y[W]=at,$.z[W]=st,$.serial[W]=parseInt(it[p]),$.bfactor[W]=isNaN(gt)?0:gt,$.occupancy[W]=isNaN(vt)?0:vt,$.altloc[W]=yt.charCodeAt(0),w.addAtom(X,pt,dt,ut,ht,ft,void 0,lt),gc){var bt=E[dt];void 0!==bt&&bt!==pt&&gc&&mc.warn(bt,pt)}E[dt]=pt;var xt=it[u];C[xt]||(C[xt]=new Set),C[xt].add(_.chainStore.count-1),W+=1}else{var _t=r.match(Ug),wt=_t.length;B===F.length&&(B=0);for(var St=0;St<wt;++St)F[B+St].push(_t[St]);B+=wt}k=!1}else if("'"===r[0]&&"'"===r[r.length-1]){var At=r.substring(1,r.length-1);!1===U?T[z]=At:T[z][U]=At}else L?!1===U?T[z]=r:T[z][U]=r:gc&&mc.log("CifParser._parse: unknown state",r);else I=!1,D=!1,L=!1,F.length=0,B=null,z=null,U=null,j=null,G.length=0}(0,O.length,O)})),T.chem_comp&&T.chem_comp_atom)!function(t,e,i){var r,n,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(Gg,"")),s.id&&(e.id=s.id.trim().replace(Gg,"")));var h={};if(c){var l,p,d,f;for(n=c.comp_id.length,r=0;r<n;++r)o.growIfFull(),l=c.atom_id[r].replace(jg,""),p=c.type_symbol[r],h[l]=r,o.atomTypeId[r]=a.add(l,p),o.x[r]=c.model_Cartn_x[r],o.y[r]=c.model_Cartn_y[r],o.z[r]=c.model_Cartn_z[r],o.serial[r]=r,d=c.pdbx_component_comp_id[r],f=c.pdbx_residue_numbering?c.pdbx_residue_numbering[r]:1,i.addAtom(0,"","",d,f,1);for(r=0;r<n;++r){var m=r+n;o.growIfFull(),l=c.atom_id[r].replace(jg,""),p=c.type_symbol[r],o.atomTypeId[m]=a.add(l,p),o.x[m]=c.pdbx_model_Cartn_x_ideal[r],o.y[m]=c.pdbx_model_Cartn_y_ideal[r],o.z[m]=c.pdbx_model_Cartn_z_ideal[r],o.serial[m]=m,d=c.pdbx_component_comp_id[r],f=c.pdbx_residue_numbering?c.pdbx_residue_numbering[r]:1,i.addAtom(1,"","",d,f,1)}}if(c&&u){var g,v,y;n=u.comp_id.length;var b=c.comp_id.length,x=e.getAtomProxy(),_=e.getAtomProxy();for(r=0;r<n;++r)g=u.atom_id_1[r].replace(jg,""),v=u.atom_id_2[r].replace(jg,""),y=Xg(u.value_order[r]),x.index=h[g],_.index=h[v],e.bondStore.growIfFull(),e.bondStore.addBond(x,_,y),x.index+=b,_.index+=b,e.bondStore.growIfFull(),e.bondStore.addBond(x,_,y)}}(T,_,w),w.finalize(),_.finalizeAtoms(),_.finalizeBonds(),qp(_);else if(T.atom_site_type_symbol&&T.atom_site_label&&T.atom_site_fract_x)!function(t,e,i){var r=e.atomStore,n=e.atomMap;t.data&&(e.id=t.data,e.name=t.data),e.unitcell=new kg({a:parseFloat(t.cell_length_a),b:parseFloat(t.cell_length_b),c:parseFloat(t.cell_length_c),alpha:parseFloat(t.cell_angle_alpha),beta:parseFloat(t.cell_angle_beta),gamma:parseFloat(t.cell_angle_gamma),spacegroup:Vg(t.symmetry_space_group_name_H)});for(var o=new O,a=new O,s=t.atom_site_type_symbol.length,c=0;c<s;++c){r.growIfFull();var u=t.atom_site_label[c],h=t.atom_site_type_symbol[c];r.atomTypeId[c]=n.add(u,h),o.set(t.atom_site_fract_x[c],t.atom_site_fract_y[c],t.atom_site_fract_z[c]),o.applyMatrix4(e.unitcell.fracToCart),a.add(o),r.x[c]=o.x,r.y[c]=o.y,r.z[c]=o.z,t.atom_site_occupancy&&(r.occupancy[c]=parseFloat(t.atom_site_occupancy[c])),r.serial[c]=c,i.addAtom(0,"","","HET",1,1)}a.divideScalar(s),e.center=a,$p(e);var l=new O,p=new O,d=e.biomolDict.SUPERCELL.partList[0].matrixList,f=s;function m(t){return n.get(r.atomTypeId[t]).covalent}for(var g=new N,v=function(t){var e=m(t);o.set(r.x[t],r.y[t],r.z[t]),d.forEach((function(n){if(!g.equals(n)){l.copy(o),l.applyMatrix4(n);for(var a=0;a<s;++a){p.set(r.x[a],r.y[a],r.z[a]);var c=l.distanceToSquared(p),u=m(a)+e,h=u+.3,d=u-.5;if(c<h*h&&c>d*d)return r.growIfFull(),r.atomTypeId[f]=r.atomTypeId[t],r.x[f]=l.x,r.y[f]=l.y,r.z[f]=l.z,r.occupancy[f]=r.occupancy[t],r.serial[f]=f,r.altloc[f]="A".charCodeAt(0),i.addAtom(0,"","","HET",1,1),void(f+=1)}}}))},y=0;y<s;++y)v(y)}(T,_,w),w.finalize(),_.finalizeAtoms(),jp(_),_.finalizeBonds();else{var q=function(t,e,i){var r,n,o,a,s=[],c=[],u=t.struct_conf;if(u)for($g(u,"id"),r=0,n=u.beg_auth_seq_id.length;r<n;++r){var h=parseInt(u.pdbx_PDB_helix_class[r]);Number.isNaN(h)||(o=u.pdbx_beg_PDB_ins_code[r],a=u.pdbx_end_PDB_ins_code[r],s.push([i[u.beg_label_asym_id[r]],parseInt(u.beg_auth_seq_id[r]),Wg(o,""),i[u.end_label_asym_id[r]],parseInt(u.end_auth_seq_id[r]),Wg(a,""),(Fg[h]||Fg[""]).charCodeAt(0)]))}var l=t.struct_sheet_range;if(l)for($g(l,"id"),r=0,n=l.beg_auth_seq_id.length;r<n;++r)o=l.pdbx_beg_PDB_ins_code[r],a=l.pdbx_end_PDB_ins_code[r],c.push([i[l.beg_label_asym_id[r]],parseInt(l.beg_auth_seq_id[r]),Wg(o,""),i[l.end_label_asym_id[r]],parseInt(l.end_auth_seq_id[r]),Wg(a,"")]);return!(!u&&!l)&&{helices:s,sheets:c}}(T,0,E);if(function(t,e,i){var r={},n=e.biomolDict;if(t.pdbx_struct_oper_list){var o=t.pdbx_struct_oper_list;$g(o,"id"),o.id.forEach((function(t,e){var i=new N,n=i.elements;n[0]=parseFloat(o["matrix[1][1]"][e]),n[1]=parseFloat(o["matrix[1][2]"][e]),n[2]=parseFloat(o["matrix[1][3]"][e]),n[4]=parseFloat(o["matrix[2][1]"][e]),n[5]=parseFloat(o["matrix[2][2]"][e]),n[6]=parseFloat(o["matrix[2][3]"][e]),n[8]=parseFloat(o["matrix[3][1]"][e]),n[9]=parseFloat(o["matrix[3][2]"][e]),n[10]=parseFloat(o["matrix[3][3]"][e]),n[3]=parseFloat(o["vector[1]"][e]),n[7]=parseFloat(o["vector[2]"][e]),n[11]=parseFloat(o["vector[3]"][e]),i.transpose(),r[t]=i}))}if(t.pdbx_struct_assembly_gen){var a=t.pdbx_struct_assembly_gen;$g(a,"assembly_id");var s=function(t){var e={};return t.replace(/[()']/g,"").split(",").forEach((function(t){if(t.includes("-"))for(var i=t.split("-"),n=parseInt(i[0]),o=parseInt(i[1]);n<=o;++n)e[n]=r[n];else e[t]=r[t]})),e};a.assembly_id.forEach((function(t,e){var r={},o=a.oper_expression[e].replace(/['"]\(|['"]/g,"");if(o.includes(")(")||o.indexOf("(")>0){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 N;i.multiplyMatrices(c[t],u[e]),r[t+"x"+e]=i}))}))}else r=s(o);var h=[];for(var l in r)h.push(r[l]);var p=t;/^(0|[1-9][0-9]*)$/.test(p)&&(p="BU"+p);for(var d=a.asym_id_list[e].split(","),f=0,m=d.length;f<m;++f)d[f]=i[d[f]];void 0===n[p]&&(n[p]=new Rp(p)),n[p].addPart(h,d)}))}if(t.struct_ncs_oper){var c=t.struct_ncs_oper;$g(c,"id");n.NCS=new Rp("NCS");var u=n.NCS.addPart();c.id.forEach((function(t,e){if("given"!==c.code[e]){var i=new N,r=i.elements;r[0]=parseFloat(c["matrix[1][1]"][e]),r[1]=parseFloat(c["matrix[1][2]"][e]),r[2]=parseFloat(c["matrix[1][3]"][e]),r[4]=parseFloat(c["matrix[2][1]"][e]),r[5]=parseFloat(c["matrix[2][2]"][e]),r[6]=parseFloat(c["matrix[2][3]"][e]),r[8]=parseFloat(c["matrix[3][1]"][e]),r[9]=parseFloat(c["matrix[3][2]"][e]),r[10]=parseFloat(c["matrix[3][3]"][e]),r[3]=parseFloat(c["vector[1]"][e]),r[7]=parseFloat(c["vector[2]"][e]),r[11]=parseFloat(c["vector[3]"][e]),i.transpose(),u.matrixList.push(i)}})),0===u.matrixList.length&&delete n.NCS}var h={};if(t.cell){var l=t.cell,p=parseFloat(l.length_a),d=parseFloat(l.length_b),f=parseFloat(l.length_c),m=new Float32Array(9);m[0]=p,m[4]=d,m[8]=f,e.boxes.push(m),h.a=p,h.b=d,h.c=f,h.alpha=parseFloat(l.angle_alpha),h.beta=parseFloat(l.angle_beta),h.gamma=parseFloat(l.angle_gamma)}t.symmetry&&(h.spacegroup=Vg(t.symmetry["space_group_name_H-M"]));var g=new N;if(t.database_PDB_matrix){var v=t.database_PDB_matrix,y=g.elements;y[0]=parseFloat(v["origx[1][1]"]),y[1]=parseFloat(v["origx[1][2]"]),y[2]=parseFloat(v["origx[1][3]"]),y[4]=parseFloat(v["origx[2][1]"]),y[5]=parseFloat(v["origx[2][2]"]),y[6]=parseFloat(v["origx[2][3]"]),y[8]=parseFloat(v["origx[3][1]"]),y[9]=parseFloat(v["origx[3][2]"]),y[10]=parseFloat(v["origx[3][3]"]),y[3]=parseFloat(v["origx_vector[1]"]),y[7]=parseFloat(v["origx_vector[2]"]),y[11]=parseFloat(v["origx_vector[3]"]),g.transpose(),h.origx=g}var b=new N;if(t.atom_sites){var x=t.atom_sites,_=b.elements;_[0]=parseFloat(x["fract_transf_matrix[1][1]"]),_[1]=parseFloat(x["fract_transf_matrix[1][2]"]),_[2]=parseFloat(x["fract_transf_matrix[1][3]"]),_[4]=parseFloat(x["fract_transf_matrix[2][1]"]),_[5]=parseFloat(x["fract_transf_matrix[2][2]"]),_[6]=parseFloat(x["fract_transf_matrix[2][3]"]),_[8]=parseFloat(x["fract_transf_matrix[3][1]"]),_[9]=parseFloat(x["fract_transf_matrix[3][2]"]),_[10]=parseFloat(x["fract_transf_matrix[3][3]"]),_[3]=parseFloat(x["fract_transf_vector[1]"]),_[7]=parseFloat(x["fract_transf_vector[2]"]),_[11]=parseFloat(x["fract_transf_vector[3]"]),b.transpose(),h.scale=b}void 0!==h.a?e.unitcell=new kg(h):e.unitcell=void 0}(T,_,E),function(t,e,i){var r=t.struct_conn;if(r){$g(r,"id");for(var n=/"/g,o=e.getAtomProxy(),a=e.getAtomProxy(),s={},c=0,u=r.id.length;c<u;++c){var h=r.conn_type_id[c];if("hydrog"!==h&&"mismat"!==h&&"saltbr"!==h&&("1_555"===r.ptnr1_symmetry[c]&&"1_555"===r.ptnr2_symmetry[c])){var l=r.pdbx_ptnr1_PDB_ins_code[c],p=r.pdbx_ptnr1_label_alt_id[c],d=r.ptnr1_auth_seq_id[c]+(Hg(l)?"^"+l:"")+":"+i[r.ptnr1_label_asym_id[c]]+"."+r.ptnr1_label_atom_id[c].replace(n,"")+(Hg(p)?"%"+p:""),f=s[d];if(!f){var m=new nc(d);if(m.selection.error){gc&&mc.warn("invalid selection for connection",d);continue}f=e.getAtomIndices(m),s[d]=f}var g=r.pdbx_ptnr2_PDB_ins_code[c],v=r.pdbx_ptnr2_label_alt_id[c],y=r.ptnr2_auth_seq_id[c]+(Hg(g)?"^"+g:"")+":"+i[r.ptnr2_label_asym_id[c]]+"."+r.ptnr2_label_atom_id[c].replace(n,"")+(Hg(v)?"%"+v:""),b=s[y];if(!b){var x=new nc(y);if(x.selection.error){gc&&mc.warn("invalid selection for connection",y);continue}b=e.getAtomIndices(x),s[y]=b}var _=f.length,w=b.length;if(_>w){var S=_;_=w,w=S;var A=f;f=b,b=A}if(0!==_&&0!==w)for(var M=0;M<w;++M)o.index=f[M%_],a.index=b[M],o&&a?e.bondStore.addBond(o,a,Xg(r.pdbx_value_order[c])):mc.log("atoms for connection not found");else gc&&mc.warn("no atoms found for",d,y)}}}}(T,_,E),function(t,e,i){if(t.entity){$g(t.entity,"id");for(var r=t.entity,n=r.id.length,o=0;o<n;++o){var a=r.pdbx_description[o],s=r.type[o],c=Array.from(i[r.id[o]]);e.entityList[o]=new Ng(e,o,a,s,c)}}}(T,_,C),T.struct&&T.struct.title&&(_.title=T.struct.title.trim().replace(Gg,"")),T.entry&&T.entry.id&&(_.id=T.entry.id.trim().replace(Gg,"")),T.database_PDB_rev){if(T.database_PDB_rev.date){$g(T.database_PDB_rev,"date");var Y=T.database_PDB_rev.date.filter(Hg);Y.length&&(_.header.releaseDate=Y[Y.length-1])}if(T.database_PDB_rev.date_original){$g(T.database_PDB_rev,"date_original");var Z=T.database_PDB_rev.date_original.filter(Hg);Z.length&&(_.header.depositionDate=Z[Z.length-1])}}T.reflns&&T.reflns.d_resolution_high?Hg(T.reflns.d_resolution_high)&&(_.header.resolution=parseFloat(T.reflns.d_resolution_high)):T.refine&&T.refine.ls_d_res_high&&Hg(T.refine.ls_d_res_high)&&(_.header.resolution=parseFloat(T.refine.ls_d_res_high)),T.refine&&T.refine.ls_R_factor_R_free&&Hg(T.refine.ls_R_factor_R_free)&&(_.header.rFree=parseFloat(T.refine.ls_R_factor_R_free)),T.refine&&T.refine.ls_R_factor_R_work&&Hg(T.refine.ls_R_factor_R_work)&&(_.header.rWork=parseFloat(T.refine.ls_R_factor_R_work)),T.exptl&&T.exptl.method&&($g(T.exptl,"method"),_.header.experimentalMethods=T.exptl.method.map((function(t){return t.replace(Gg,"")}))),w.finalize(),_.finalizeAtoms(),jp(_),_.finalizeBonds(),q?Dp(_,q):zp(_),$p(_),_.extraData.cif=T}gc&&mc.timeEnd("CifParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("cif",qg),_c.add("mcif",qg),_c.add("mmcif",qg);var Yg=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"gro"},e.prototype._parse=function(){gc&&mc.time("GroParser._parse "+this.name);var t,e,i=this.structure,r=this.structureBuilder,n=this.firstModelOnly,o=this.asTrajectory,a=this.cAlphaOnly,s=i.frames,c=i.boxes,u=this.streamer.peekLines(3);i.title=u[0].trim();var h,l,p,d,f=5+(u[2].length-u[2].lastIndexOf(".")-1),m=20+f,g=20+2*f,v=parseInt(u[1]),y=v+3,b=i.atomMap,x=i.atomStore;x.resize(v);var _=0,w=0,S=0;this.streamer.eachChunkOfLines((function(i){!function(i,u,A){for(var M=i;M<u;++M){var P=++S-1,T=A[M];if(T)if(P%y==0)o&&(t=new Float32Array(3*v),s.push(t),e=0);else if(P%y==1);else if(P%y==y-1){var E=T.trim().split(/\s+/),C=new Float32Array(9);if(C[0]=10*parseFloat(E[0]),C[4]=10*parseFloat(E[1]),C[8]=10*parseFloat(E[2]),c.push(C),n)return!0;w+=1}else{if(h=T.substr(10,5).trim(),a&&"CA"!==h)continue;var I=10*parseFloat(T.substr(20,f)),R=10*parseFloat(T.substr(m,f)),L=10*parseFloat(T.substr(g,f));if(o){var O=3*e;if(t[O+0]=I,t[O+1]=R,t[O+2]=L,e+=1,P>y)continue}l=T.substr(5,5).trim(),p=parseInt(T.substr(0,5)),d=parseInt(T.substr(15,5)),x.growIfFull(),x.atomTypeId[_]=b.add(h),x.x[_]=I,x.y[_]=R,x.z[_]=L,x.serial[_]=d,r.addAtom(w,"","",l,p,0,"l"),_+=1}}}(0,i.length,i)})),r.finalize(),i.finalizeAtoms(),Up(i),jp(i),i.finalizeBonds(),zp(i),gc&&mc.timeEnd("GroParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("gro",Yg);var Zg=["mmtfVersion","mmtfProducer","unitCell","spaceGroup","structureId","title","depositionDate","releaseDate","experimentalMethods","resolution","rFree","rWork","bioAssemblyList","ncsOperatorList","entityList","groupList","numBonds","numAtoms","numGroups","numChains","numModels","groupsPerChain","chainsPerModel"].concat(["xCoordList","yCoordList","zCoordList","groupIdList","groupTypeList","chainIdList","bFactorList","atomIdList","altLocList","occupancyList","secStructList","insCodeList","sequenceIndexList","chainNameList","bondAtomList","bondOrderList"]);function Kg(t,e,i){return e?new t(e.buffer,e.byteOffset,e.byteLength/(i||1)):void 0}function Qg(t){return Kg(DataView,t)}function Jg(t){return Kg(Int8Array,t)}function tv(t){return Kg(Int32Array,t,4)}function ev(t,e){var i=t.length/2;e||(e=new Int16Array(i));for(var r=0,n=0;r<i;++r,n+=2)e[r]=t[n]<<8^t[n+1]<<0;return e}function iv(t,e){var i=t.length/4;e||(e=new Int32Array(i));for(var r=0,n=0;r<i;++r,n+=4)e[r]=t[n]<<24^t[n+1]<<16^t[n+2]<<8^t[n+3]<<0;return e}function rv(t,e,i){var r=t.length,n=1/e;i||(i=new Float32Array(r));for(var o=0;o<r;++o)i[o]=t[o]*n;return i}function nv(t,e){var i,r;if(!e){var n=0;for(i=0,r=t.length;i<r;i+=2)n+=t[i+1];e=new t.constructor(n)}var o=0;for(i=0,r=t.length;i<r;i+=2)for(var a=t[i],s=t[i+1],c=0;c<s;++c)e[o]=a,++o;return e}function ov(t,e){var i=t.length;e||(e=new t.constructor(i)),i&&(e[0]=t[0]);for(var r=1;r<i;++r)e[r]=t[r]+e[r-1];return e}function av(t,e){var i,r,n=t instanceof Int8Array?127:32767,o=-n-1,a=t.length;if(!e){var s=0;for(i=0;i<a;++i)t[i]<n&&t[i]>o&&++s;e=new Int32Array(s)}for(i=0,r=0;i<a;){for(var c=0;t[i]===n||t[i]===o;)c+=t[i],++i;c+=t[i],++i,e[r]=c,++r}return e}function sv(t,e,i){return rv(av(t,tv(i)),e,i)}function cv(t,e,i){var r=av(t,tv(i));return function(t,e,i){return rv(ov(t,tv(i)),e,i)}(r,e,Kg(Float32Array,r,4))}function uv(t,e,i,r){switch(t){case 1:return function(t,e){var i=t.length;e||(e=new Float32Array(i/4));for(var r=Qg(e),n=Qg(t),o=0,a=0,s=i/4;o<s;++o,a+=4)r.setFloat32(a,n.getFloat32(a),!0);return e}(e);case 2:return Jg(e);case 3:return ev(e);case 4:return iv(e);case 5:return Kg(Uint8Array,e);case 6:return nv(iv(e),new Uint8Array(i));case 7:return nv(iv(e));case 8:return ov(nv(iv(e)),n);case 9:return function(t,e,i){return rv(nv(t,tv(i)),e,i)}(iv(e),iv(r)[0]);case 10:return cv(ev(e),iv(r)[0]);case 11:return rv(ev(e),iv(r)[0]);case 12:return sv(ev(e),iv(r)[0]);case 13:return sv(Jg(e),iv(r)[0]);case 14:return av(ev(e));case 15:return av(Jg(e))}var n}function hv(t,e){var i=(e=e||{}).ignoreFields,r={};return Zg.forEach((function(e){var n=!!i&&-1!==i.indexOf(e),o=t[e];n||void 0===o||(o instanceof Uint8Array?r[e]=uv.apply(null,function(t){var e=Qg(t),i=e.getInt32(0),r=e.getInt32(4),n=t.subarray(8,12);return[i,t=t.subarray(12),r,n]}(o)):r[e]=o)})),r}var lv={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)},pv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"mmtf"},e.prototype._parse=function(){var t,e,i,r,n;gc&&mc.time("MmtfParser._parse "+this.name);var o,a,s,c,u,h,l=this.structure,p=hv(function(t){var e=0,i=new DataView(t.buffer);function r(t){for(var e={},i=0;i<t;i++){e[s()]=s()}return e}function n(i){var r=t.subarray(e,e+i);return e+=i,r}function o(i){var r=t.subarray(e,e+i);e+=i;if(i>65535){for(var n=[],o=0;o<r.length;o+=65535)n.push(String.fromCharCode.apply(null,r.subarray(o,o+65535)));return n.join("")}return String.fromCharCode.apply(null,r)}function a(t){for(var e=new Array(t),i=0;i<t;i++)e[i]=s();return e}function s(){var s,c,u=t[e];if(0==(128&u))return e++,u;if(128==(240&u))return e++,r(c=15&u);if(144==(240&u))return e++,a(c=15&u);if(160==(224&u))return e++,o(c=31&u);if(224==(224&u))return s=i.getInt8(e),e++,s;switch(u){case 192:return e++,null;case 194:return e++,!1;case 195:return e++,!0;case 196:return c=i.getUint8(e+1),e+=2,n(c);case 197:return c=i.getUint16(e+1),e+=3,n(c);case 198:return c=i.getUint32(e+1),e+=5,n(c);case 202:return s=i.getFloat32(e+1),e+=5,s;case 203:return s=i.getFloat64(e+1),e+=9,s;case 204:return s=t[e+1],e+=2,s;case 205:return s=i.getUint16(e+1),e+=3,s;case 206:return s=i.getUint32(e+1),e+=5,s;case 208:return s=i.getInt8(e+1),e+=2,s;case 209:return s=i.getInt16(e+1),e+=3,s;case 210:return s=i.getInt32(e+1),e+=5,s;case 217:return c=i.getUint8(e+1),e+=2,o(c);case 218:return c=i.getUint16(e+1),e+=3,o(c);case 219:return c=i.getUint32(e+1),e+=5,o(c);case 220:return c=i.getUint16(e+1),e+=3,a(c);case 221:return c=i.getUint32(e+1),e+=5,a(c);case 222:return c=i.getUint16(e+1),e+=3,r(c);case 223:return c=i.getUint32(e+1),e+=5,r(c)}throw new Error("Unknown type 0x"+u.toString(16))}return s()}(this.streamer.data));if(["depositionDate","releaseDate","resolution","rFree","rWork","experimentalMethods"].forEach((function(t){void 0!==p[t]&&(l.header[t]=p[t])})),l.id=p.structureId,l.title=p.title,this.firstModelOnly||this.asTrajectory){for(u=1,s=0,t=0,e=c=p.chainsPerModel[0];t<e;++t)s+=p.groupsPerChain[t];for(a=0,t=0,e=s;t<e;++t)a+=(n=p.groupList[p.groupTypeList[t]]).atomNameList.length;o=p.numBonds,h=[c]}else o=p.numBonds,a=p.numAtoms,s=p.numGroups,c=p.numChains,u=p.numModels,h=p.chainsPerModel;if(o+=s,this.asTrajectory)for(t=0,e=p.numModels;t<e;++t){var d=new Float32Array(3*a),f=a*t;for(i=0;i<a;++i){var m=3*i,g=i+f;d[m]=p.xCoordList[g],d[m+1]=p.yCoordList[g],d[m+2]=p.zCoordList[g]}l.frames.push(d)}var v=new Uint32Array(o),y=new Uint32Array(o),b=new Uint8Array(o),x=new Uint32Array(a),_=new Uint32Array(s),w=new Uint32Array(s),S=new Uint16Array(s),A=new Uint16Array(c),M=new Uint32Array(c),P=new Uint32Array(c),T=new Uint32Array(u),E=new Uint32Array(u),C=0;for(t=0,e=u;t<e;++t){var I=h[t];for(T[t]=C,E[t]=I,i=0;i<I;++i)A[i+C]=t;C+=I}var R=p.groupsPerChain,L=0;for(t=0,e=c;t<e;++t){var O=R[t];for(M[t]=L,P[t]=O,i=0;i<O;++i)_[i+L]=t;L+=O}var D=0,k=0;for(t=0,e=s;t<e;++t){var F=(n=p.groupList[p.groupTypeList[t]]).atomNameList.length,B=n.bondAtomList,z=n.bondOrderList;for(i=0,r=z.length;i<r;++i)v[k]=D+B[2*i],y[k]=D+B[2*i+1],b[k]=z[i],k+=1;for(w[t]=D,S[t]=F,i=0;i<F;++i)x[D]=t,D+=1}var U=p.bondAtomList;if(U)for(p.bondOrderList&&b.set(p.bondOrderList,k),t=0,e=U.length;t<e;t+=2){var j=U[t],G=U[t+1];j<a&&G<a&&(v[k]=j,y[k]=G,k+=1)}l.bondStore.length=b.length,l.bondStore.count=k,l.bondStore.atomIndex1=v,l.bondStore.atomIndex2=y,l.bondStore.bondOrder=b,l.atomStore.length=a,l.atomStore.count=a,l.atomStore.residueIndex=x,l.atomStore.atomTypeId=new Uint16Array(a),l.atomStore.x=p.xCoordList.subarray(0,a),l.atomStore.y=p.yCoordList.subarray(0,a),l.atomStore.z=p.zCoordList.subarray(0,a),l.atomStore.serial=p.atomIdList.subarray(0,a),l.atomStore.bfactor=p.bFactorList.subarray(0,a),l.atomStore.altloc=p.altLocList.subarray(0,a),l.atomStore.occupancy=p.occupancyList.subarray(0,a),l.residueStore.length=s,l.residueStore.count=s,l.residueStore.chainIndex=_,l.residueStore.residueTypeId=p.groupTypeList,l.residueStore.atomOffset=w,l.residueStore.atomCount=S,l.residueStore.resno=p.groupIdList.subarray(0,s),l.residueStore.sstruc=p.secStructList.subarray(0,s),l.residueStore.inscode=p.insCodeList.subarray(0,s),l.chainStore.length=c,l.chainStore.count=c,l.chainStore.entityIndex=new Uint16Array(c),l.chainStore.modelIndex=A,l.chainStore.residueOffset=M,l.chainStore.residueCount=P,l.chainStore.chainname=p.chainNameList.subarray(0,4*c),l.chainStore.chainid=p.chainIdList.subarray(0,4*c),l.modelStore.length=u,l.modelStore.count=u,l.modelStore.chainOffset=T,l.modelStore.chainCount=E;var V={};for(t=0,e=p.groupList.length;t<e;++t){var $=p.groupList[t],H=[];for(i=0,r=$.atomNameList.length;i<r;++i){var W=$.elementList[i].toUpperCase(),X=$.atomNameList[i];H.push(l.atomMap.add(X,W))}var q=$.chemCompType.toUpperCase(),Y=ll.includes(q),Z=$.bondOrderList.length,K=new Array(Z),Q=new Array(Z);for(i=0;i<Z;++i)K[i]=$.bondAtomList[2*i],Q[i]=$.bondAtomList[2*i+1];var J={atomIndices1:K,atomIndices2:Q,bondOrders:$.bondOrderList};V[t]=l.residueMap.add($.groupName,H,Y,q,J)}for(t=0,e=s;t<e;++t)l.residueStore.residueTypeId[t]=V[l.residueStore.residueTypeId[t]];for(t=0,e=l.atomStore.count;t<e;++t){var tt=l.atomStore.residueIndex[t],et=l.residueMap.list[l.residueStore.residueTypeId[tt]],it=l.residueStore.atomOffset[tt];l.atomStore.atomTypeId[t]=et.atomTypeIdList[t-it]}if(p.secStructList){var rt=p.secStructList.length;for(t=0,e=l.residueStore.count;t<e;++t){var nt=lv[l.residueStore.sstruc[t%rt]];void 0!==nt&&(l.residueStore.sstruc[t]=nt)}}if(p.entityList&&p.entityList.forEach((function(t,e){l.entityList[e]=new Ng(l,e,t.description,t.type,t.chainIndexList)})),p.bioAssemblyList&&p.bioAssemblyList.forEach((function(t,e){var i=e+1,r=new Rp(i);l.biomolDict["BU"+i]=r;var n={};t.transformList.forEach((function(t){var e=(new N).fromArray(t.matrix).transpose(),i=t.chainIndexList.map((function(t){for(var e="",i=0;i<4;++i){var r=p.chainNameList[4*t+i];if(!r)break;e+=String.fromCharCode(r)}return e})),o=n[i];o?o.matrixList.push(e):n[i]=r.addPart([e],i)}))})),p.ncsOperatorList){var ot=new Rp("NCS"),at=ot.addPart();p.ncsOperatorList.forEach((function(t){var e=(new N).fromArray(t).transpose();at.matrixList.push(e)})),at.matrixList.length>0&&(l.biomolDict.NCS=ot)}var st=p.unitCell;st&&Array.isArray(st)&&st[0]?l.unitcell=new kg({a:st[0],b:st[1],c:st[2],alpha:st[3],beta:st[4],gamma:st[5],spacegroup:p.spaceGroup}):l.unitcell=void 0,Vp(l,!0),Gp(l,!0),l.finalizeAtoms(),l.finalizeBonds(),$p(l),gc&&mc.timeEnd("MmtfParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("mmtf",pv);var dv=/\s+/,fv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"mol2"},e.prototype._parse=function(){gc&&mc.time("Mol2Parser._parse "+this.name);var t,e,i=this.structure,r=this.structureBuilder,n=this.firstModelOnly,o=this.asTrajectory,a=i.frames,s=!1,c=i.atomMap,u=i.atomStore;u.resize(Math.round(this.streamer.data.length/60));var h=0,l=0,p=0,d=-1,f=0,m=0,g=i.getAtomProxy(),v=i.getAtomProxy(),y={1:1,2:2,3:3,am:1,ar:1,du:1,un:1,nc:0};this.streamer.eachChunkOfLines((function(b){!function(b,x,_){for(var w,S=b;S<x;++S){var A=_[S].trim();if(""!==A&&"#"!==A[0])if("@"===A[0])"@<TRIPOS>MOLECULE"===A?(m=1,l=0,++d):"@<TRIPOS>ATOM"===A?(m=2,p=u.count,o&&(e=0,t=new Float32Array(3*f),a.push(t),d>0&&(s=!0))):m="@<TRIPOS>BOND"===A?3:0;else if(1===m)0===l?(i.title=A,i.id=A):1===l&&(w=A.split(dv),f=parseInt(w[0])),++l;else if(2===m){if(w=A.split(dv),n&&d>0)continue;var M=parseFloat(w[2]),P=parseFloat(w[3]),T=parseFloat(w[4]);if(o){var E=3*e;if(t[E+0]=M,t[E+1]=P,t[E+2]=T,e+=1,s)continue}var C=w[0],I=w[1],R=w[5].split(".")[0],L=w[6]?parseInt(w[6]):1,O=w[7]?w[7]:"",N=w[8]?parseFloat(w[8]):0;u.growIfFull(),u.atomTypeId[h]=c.add(I,R),u.x[h]=M,u.y[h]=P,u.z[h]=T,u.serial[h]=C,u.bfactor[h]=N,r.addAtom(d,"","",O,L,1),h+=1}else if(3===m){if(n&&d>0)continue;if(o&&d>0)continue;w=A.split(dv),g.index=parseInt(w[1])-1+p,v.index=parseInt(w[2])-1+p;var D=y[w[3]];i.bondStore.addBond(g,v,D)}}}(0,b.length,b)})),r.finalize(),i.finalizeAtoms(),Up(i),Gp(i,!0),Vp(i,!0),i.finalizeBonds(),qp(i),zp(i),gc&&mc.timeEnd("Mol2Parser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("mol2",fv);var mv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"pqr"},Object.defineProperties(e.prototype,i),e}(Bg);_c.add("pqr",mv);var gv=/\s+/,vv=/(^\*|REMARK)*/,yv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"psf"},e.prototype._parse=function(){gc&&mc.time("PsfParser._parse "+this.name);var t,e,i,r,n=this.structure,o=this.structureBuilder,a=n.atomMap,s=n.atomStore,c=[],u=0,h=0;this.streamer.eachChunkOfLines((function(n){!function(n,l,p){for(var d=n;d<l;++d){var f=p[d].trim();if(f)if(2===t){var m=f.split(gv),g=parseInt(m[0]),v=parseInt(m[2]),y=m[3],b=m[4];s.growIfFull(),s.atomTypeId[u]=a.add(b),s.serial[u]=g,o.addAtom(0,"","",y,v,1),u+=1}else if(3===t)for(var x=f.split(gv),_=0,w=x.length;_<w;_+=2)e[h]=parseInt(x[_])-1,i[h]=parseInt(x[_+1])-1,r[h]=1,h+=1;else if(1===t)c.push(f.replace(vv,"").trim());else if(4===t);else if(5===t);else if(6===t);else if(f.includes("!NATOM")){t=2;var S=parseInt(f.split(gv)[0]);s.resize(S)}else if(f.includes("!NBOND")){t=3;var A=parseInt(f.split(gv)[0]);e=new Uint32Array(A),i=new Uint32Array(A),r=new Uint8Array(A)}else f.includes("!NTITLE")?t=1:f.includes("!NTHETA")?t=4:f.includes("!NPHI")?t=5:f.includes("!NIMPHI")&&(t=6);else t=void 0}}(0,n.length,n)})),n.title=c.join(" "),n.bondStore.length=r.length,n.bondStore.count=h,n.bondStore.atomIndex1=e,n.bondStore.atomIndex2=i,n.bondStore.bondOrder=r,o.finalize(),n.finalizeAtoms(),Up(n),n.finalizeBonds(),qp(n),gc&&mc.timeEnd("PsfParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("psf",yv);var bv=/> <(.+)>/,xv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"sdf"},e.prototype._parse=function(){gc&&mc.time("SdfParser._parse "+this.name);var t=this.structure,e=this.structureBuilder,i=this.firstModelOnly,r=this.asTrajectory,n=this.streamer.peekLines(2);t.id=n[0].trim(),t.title=n[1].trim();var o,a,s=t.frames,c=!1,u=t.atomMap,h=t.atomStore;h.resize(Math.round(this.streamer.data.length/50));var l,p,d,f,m,g,v,y=t.getAtomProxy(),b=t.getAtomProxy(),x=0,_=0,w=0,S=0,A=[],M=!1,P={};t.extraData.sdf=A,this.streamer.eachChunkOfLines((function(n){!function(n,T,E){for(var C=n;C<T;++C){var I=E[C];if("$$$$"===I.substr(0,4))_=-1,++w,S=h.count,A.push(P),P={},M=!1;else if(3===_)p=parseInt(I.substr(0,3)),d=parseInt(I.substr(3,3)),v=(g=m=(f=4)+p)+d,r&&(a=0,o=new Float32Array(3*p),s.push(o),w>0&&(c=!0));else if(_>=f&&_<m){if(i&&w>0)continue;var R=parseFloat(I.substr(0,10)),L=parseFloat(I.substr(10,10)),O=parseFloat(I.substr(20,10));if(r){var N=3*a;if(o[N+0]=R,o[N+1]=L,o[N+2]=O,a+=1,c)continue}var D=I.substr(31,3).trim(),k=D+(x+1);h.growIfFull(),h.atomTypeId[x]=u.add(k,D),h.x[x]=R,h.y[x]=L,h.z[x]=O,h.serial[x]=x,e.addAtom(w,"","","HET",1,1),x+=1}else if(_>=g&&_<v){if(i&&w>0)continue;if(r&&w>0)continue;y.index=parseInt(I.substr(0,3))-1+S,b.index=parseInt(I.substr(3,3))-1+S;var F=parseInt(I.substr(6,3));t.bondStore.addBond(y,b,F)}else(l=I.match(bv))?(M=l[1],P[M]=[]):!1!==M&&I&&P[M].push(I);++_}}(0,n.length,n)})),e.finalize(),t.finalizeAtoms(),t.finalizeBonds(),qp(t),gc&&mc.timeEnd("SdfParser._parse "+this.name)},e.prototype._postProcess=function(){qp(this.structure)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("sdf",xv),_c.add("sd",xv);var _v=function(t,e){this.name=t,this.path=e,this.coordinates=[],this.boxes=[]},wv={type:{}};wv.type.get=function(){return"Frames"},Object.defineProperties(_v.prototype,wv);var Sv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"dcd"},e.prototype._parse=function(){gc&&mc.time("DcdParser._parse "+this.name);var t=this.streamer.data;t instanceof Uint8Array&&(t=t.buffer);var e,i,r=new DataView(t),n=this.frames,o=n.coordinates,a=n.boxes,s={},c=0,u=new Int32Array(t,0,23),h=u[0]!==r.getInt32(0);if(84!==u[0])for(i=t.byteLength,e=0;e<i;e+=4)r.setFloat32(e,r.getFloat32(e),!0);84!==u[0]&&mc.error("dcd bad format, header block start"),"CORD"!==String.fromCharCode(r.getUint8(4),r.getUint8(5),r.getUint8(6),r.getUint8(7))&&mc.error("dcd bad format, format string");var l=!1,p=!1,d=!1;0!==u[22]&&(l=!0,0!==u[12]&&(p=!0),1===u[13]&&(d=!0)),s.NSET=u[2],s.ISTART=u[3],s.NSAVC=u[4],s.NAMNF=u[10],s.DELTA=l?r.getFloat32(44,h):r.getFloat64(44,h),84!==u[22]&&mc.error("dcd bad format, header block end"),c=c+84+8;var f=r.getInt32(c,h),m=c+1;if((f-4)%80!=0&&mc.error("dcd bad format, title block start"),s.TITLE=Fo(new Uint8Array(t,m,f)),r.getInt32(m+f+4-1,h)!==f&&mc.error("dcd bad format, title block end"),c=c+f+8,4!==r.getInt32(c,h)&&mc.error("dcd bad format, natom block start"),s.NATOM=r.getInt32(c+4,h),4!==r.getInt32(c+8,h)&&mc.error("dcd bad format, natom block end"),c=c+4+8,s.NAMNF>0)mc.error("dcd format with fixed atoms unsupported, aborting");else{var g=s.NATOM,v=4*g;for(e=0,i=s.NSET;e<i;++e){if(p){c+=4;var y=new Float32Array(9);y[0]=r.getFloat64(c,h),y[4]=r.getFloat64(c+16,h),y[8]=r.getFloat64(c+40,h),a.push(y),c+=48,c+=4}for(var b=new Float32Array(3*g),x=0;x<3;++x){r.getInt32(c,h)!==v&&mc.error("dcd bad format, coord block start",e,x),c+=4;for(var _=new Float32Array(t,c,g),w=0;w<g;++w)b[3*w+x]=_[w];c+=v,r.getInt32(c,h)!==v&&mc.error("dcd bad format, coord block end",e,x),c+=4}if(o.push(b),d)c+=4+r.getInt32(c,h)+4}gc&&mc.timeEnd("DcdParser._parse "+this.name)}},Object.defineProperties(e.prototype,i),e}(function(t){function e(e,i){t.call(this,e,i),this.frames=new _v(this.name,this.path)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"trajectory"},i.__objName.get=function(){return"frames"},Object.defineProperties(e.prototype,i),e}(Ig));_c.add("dcd",Sv);var Av=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.volume=new lp(this.name,this.path),this.voxelSize=Eo(r.voxelSize,1)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"volume"},i.__objName.get=function(){return"volume"},e.prototype._afterParse=function(){this.volume.setMatrix(this.getMatrix())},e.prototype.getMatrix=function(){return new N},Object.defineProperties(e.prototype,i),e}(Ig),Mv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"cube"},e.prototype._parse=function(){gc&&mc.time("CubeParser._parse "+this.name);var t=this.volume,e=this.streamer.peekLines(6),i={},r=/\s+/,n=.529177210859*this.voxelSize;function o(t,i){var n=e[t].trim().split(r)[i];return parseFloat(n)}i.atomCount=Math.abs(o(2,0)),i.originX=.529177210859*o(2,1),i.originY=.529177210859*o(2,2),i.originZ=.529177210859*o(2,3),i.NVX=o(3,0),i.NVY=o(4,0),i.NVZ=o(5,0),i.basisX=new O(o(3,1),o(3,2),o(3,3)).multiplyScalar(n),i.basisY=new O(o(4,1),o(4,2),o(4,3)).multiplyScalar(n),i.basisZ=new O(o(5,1),o(5,2),o(5,3)).multiplyScalar(n);var a=new Float32Array(i.NVX*i.NVY*i.NVZ),s=0,c=0,u=o(2,0)>0?0:1;this.streamer.eachChunkOfLines((function(t){!function(t,e,n){for(var o=t;o<e;++o){var h=n[o].trim();if(""!==h&&c>=i.atomCount+6+u)for(var l=0,p=(h=h.split(r)).length;l<p;++l)1!==h.length&&(a[s]=parseFloat(h[l]),++s);++c}}(0,t.length,t)})),t.header=i,t.setData(a,i.NVZ,i.NVY,i.NVX),gc&&mc.timeEnd("CubeParser._parse "+this.name)},e.prototype.getMatrix=function(){var t=this.volume.header,e=new N;return e.multiply((new N).makeTranslation(t.originX,t.originY,t.originZ)),e.multiply((new N).makeBasis(t.basisZ,t.basisY,t.basisX)),e},Object.defineProperties(e.prototype,i),e}(Av);_c.add("cub",Mv),_c.add("cube",Mv);var Pv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"dsn6"},e.prototype._parse=function(){gc&&mc.time("Dsn6Parser._parse "+this.name);var t=this.streamer.data;t instanceof Uint8Array&&(t=t.buffer);var e,i,r=this.volume,n={},o=new Int16Array(t),a=new Uint8Array(t),s=String.fromCharCode.apply(null,a.subarray(0,512));if(s.startsWith(":-)"))n.xStart=parseInt(s.substr(10,5)),n.yStart=parseInt(s.substr(15,5)),n.zStart=parseInt(s.substr(20,5)),n.xExtent=parseInt(s.substr(32,5)),n.yExtent=parseInt(s.substr(38,5)),n.zExtent=parseInt(s.substr(42,5)),n.xRate=parseInt(s.substr(52,5)),n.yRate=parseInt(s.substr(58,5)),n.zRate=parseInt(s.substr(62,5)),n.xlen=parseFloat(s.substr(73,10))*this.voxelSize,n.ylen=parseFloat(s.substr(83,10))*this.voxelSize,n.zlen=parseFloat(s.substr(93,10))*this.voxelSize,n.alpha=parseFloat(s.substr(103,10)),n.beta=parseFloat(s.substr(113,10)),n.gamma=parseFloat(s.substr(123,10)),e=parseFloat(s.substr(138,12))/100,i=parseInt(s.substr(155,8));else{if(100!==o[18])for(var c=0,u=o.length;c<u;++c){var h=o[c];o[c]=(255&h)<<8|h>>8&255}n.xStart=o[0],n.yStart=o[1],n.zStart=o[2],n.xExtent=o[3],n.yExtent=o[4],n.zExtent=o[5],n.xRate=o[6],n.yRate=o[7],n.zRate=o[8];var l=1/o[17],p=l*this.voxelSize;n.xlen=o[9]*p,n.ylen=o[10]*p,n.zlen=o[11]*p,n.alpha=o[12]*l,n.beta=o[13]*l,n.gamma=o[14]*l,e=o[15]/100,i=o[16]}r.header=n,mc.log(n,e,i);for(var d=new Float32Array(n.xExtent*n.yExtent*n.zExtent),f=512,m=Math.ceil(n.xExtent/8),g=Math.ceil(n.yExtent/8),v=Math.ceil(n.zExtent/8),y=0;y<v;++y)for(var b=0;b<g;++b)for(var x=0;x<m;++x)for(var _=0;_<8;++_)for(var w=8*y+_,S=0;S<8;++S)for(var A=8*b+S,M=0;M<8;++M){var P=8*x+M;if(!(P<n.xExtent&&A<n.yExtent&&w<n.zExtent)){f+=8-M;break}d[(P*n.yExtent+A)*n.zExtent+w]=(a[f]-i)/e,++f}r.setData(d,n.zExtent,n.yExtent,n.xExtent),gc&&mc.timeEnd("Dsn6Parser._parse "+this.name)},e.prototype.getMatrix=function(){var t=this.volume.header,e=[t.xlen,0,0],i=[t.ylen*Math.cos(Math.PI/180*t.gamma),t.ylen*Math.sin(Math.PI/180*t.gamma),0],r=[t.zlen*Math.cos(Math.PI/180*t.beta),t.zlen*(Math.cos(Math.PI/180*t.alpha)-Math.cos(Math.PI/180*t.gamma)*Math.cos(Math.PI/180*t.beta))/Math.sin(Math.PI/180*t.gamma),0];r[2]=Math.sqrt(t.zlen*t.zlen*Math.sin(Math.PI/180*t.beta)*Math.sin(Math.PI/180*t.beta)-r[1]*r[1]);var n=[0,e,i,r],o=[0,t.xRate,t.yRate,t.zRate],a=[0,1,2,3],s=new N;return s.set(n[a[1]][0]/o[a[1]],n[a[2]][0]/o[a[2]],n[a[3]][0]/o[a[3]],0,n[a[1]][1]/o[a[1]],n[a[2]][1]/o[a[2]],n[a[3]][1]/o[a[3]],0,n[a[1]][2]/o[a[1]],n[a[2]][2]/o[a[2]],n[a[3]][2]/o[a[3]],0,0,0,0,1),s.multiply((new N).makeRotationY(Qo(90))),s.multiply((new N).makeTranslation(-t.zStart,t.yStart,t.xStart)),s.multiply((new N).makeScale(-1,1,1)),s},Object.defineProperties(e.prototype,i),e}(Av);_c.add("dsn6",Pv),_c.add("brix",Pv);var Tv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"dx"},e.prototype._parse=function(){gc&&mc.time("DxParser._parse "+this.name);var t=this.volume,e=this.streamer.peekLines(30),i=this.parseHeaderLines(e),r=this.volume.header,n=i.dataLineStart,o=/\s+/,a=r.nx*r.ny*r.nz,s=new Float32Array(a),c=0,u=0;this.streamer.eachChunkOfLines((function(t){!function(t,e,i){for(var r=t;r<e;++r){if(c<a&&u>n){var h=i[r].trim();if(""!==h)for(var l=h.split(o),p=0,d=l.length;p<d;++p)s[c]=parseFloat(l[p]),++c}++u}}(0,t.length,t)})),t.setData(s,r.nz,r.ny,r.nx),gc&&mc.timeEnd("DxParser._parse "+this.name)},e.prototype.parseHeaderLines=function(t){for(var e={},i=/\s+/,r=t.length,n=0,o=0,a=0,s=0;s<r;++s){var c,u=t[s];if(u.startsWith("object 1"))c=u.split(i),e.nx=parseInt(c[5]),e.ny=parseInt(c[6]),e.nz=parseInt(c[7]);else if(u.startsWith("origin"))c=u.split(i),e.xmin=parseFloat(c[1]),e.ymin=parseFloat(c[2]),e.zmin=parseFloat(c[3]);else if(u.startsWith("delta"))c=u.split(i),0===a?e.hx=parseFloat(c[1])*this.voxelSize:1===a?e.hy=parseFloat(c[2])*this.voxelSize:2===a&&(e.hz=parseFloat(c[3])*this.voxelSize),a+=1;else if(u.startsWith("object 3")){n=s,o+=u.length+1;break}o+=u.length+1}return this.volume.header=e,{dataLineStart:n,headerByteCount:o}},e.prototype.getMatrix=function(){var t=this.volume.header,e=new N;return e.multiply((new N).makeRotationY(Qo(90))),e.multiply((new N).makeTranslation(-t.zmin,t.ymin,t.xmin)),e.multiply((new N).makeScale(-t.hz,t.hy,t.hx)),e},Object.defineProperties(e.prototype,i),e}(Av);_c.add("dx",Tv);var Ev=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"dxbin"},e.prototype._parse=function(){gc&&mc.time("DxbinParser._parse "+this.name);var t=this.streamer.data;t instanceof Uint8Array&&(t=t.buffer);for(var e=function(t,e,i){e=void 0!==e?e:10485760,i=void 0!==i?i:"\n";for(var r="",n=[],o=0;o<t.length;o+=e){var a=Fo(t.subarray(o,o+e)),s=a.lastIndexOf(i);if(-1===s)r+=a;else{var c=r+a.substr(0,s);n=n.concat(c.split(i)),r=s===a.length-i.length?"":a.substr(s+i.length)}}return""!==r&&n.push(r),n}(new Uint8Array(t,0,1e3)),i=this.parseHeaderLines(e),r=this.volume.header,n=i.headerByteCount,o=r.nx*r.ny*r.nz,a=new DataView(t),s=new Float32Array(o),c=0;c<o;++c)s[c]=a.getFloat64(8*c+n,!0);this.volume.setData(s,r.nz,r.ny,r.nx),gc&&mc.timeEnd("DxbinParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Tv);_c.add("dxbin",Ev);var Cv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"mrc"},e.prototype._parse=function(){gc&&mc.time("MrcParser._parse "+this.name);var t=this.streamer.data;t instanceof Uint8Array&&(t=t.buffer);var e,i=this.volume,r={},n=new Int32Array(t,0,56),o=new Float32Array(t,0,56),a=new DataView(t);if(r.MAP=String.fromCharCode(a.getUint8(208),a.getUint8(209),a.getUint8(210),a.getUint8(211)),r.MACHST=[a.getUint8(212),a.getUint8(213)],17===r.MACHST[0]&&17===r.MACHST[1])for(var s=t.byteLength,c=0;c<s;c+=4)a.setFloat32(c,a.getFloat32(c),!0);if(r.NX=n[0],r.NY=n[1],r.NZ=n[2],r.MODE=n[3],r.NXSTART=n[4],r.NYSTART=n[5],r.NZSTART=n[6],r.MX=n[7],r.MY=n[8],r.MZ=n[9],r.xlen=o[10]*this.voxelSize,r.ylen=o[11]*this.voxelSize,r.zlen=o[12]*this.voxelSize,r.alpha=o[13],r.beta=o[14],r.gamma=o[15],r.MAPC=n[16],r.MAPR=n[17],r.MAPS=n[18],r.DMIN=o[19],r.DMAX=o[20],r.DMEAN=o[21],r.ISPG=n[22],r.NSYMBT=n[23],r.LSKFLG=n[24],r.originX=o[49],r.originY=o[50],r.originZ=o[51],r.ARMS=o[54],i.header=r,2===r.MODE)e=new Float32Array(t,1024+r.NSYMBT,r.NX*r.NY*r.NZ);else if(0===r.MODE){if(e=new Float32Array(new Int8Array(t,1024+r.NSYMBT,r.NX*r.NY*r.NZ)),-128===n[39]&&127===n[40])for(var u=(r.DMAX-r.DMIN)/255,h=.5*(r.DMIN+r.DMAX+u),l=0,p=e.length;l<p;++l)e[l]=u*e[l]+h}else mc.error("MrcParser unknown mode",r.MODE);i.setData(e,r.NX,r.NY,r.NZ),gc&&mc.timeEnd("MrcParser._parse "+this.name)},e.prototype.getMatrix=function(){var t=this.volume.header,e=[t.xlen,0,0],i=[t.ylen*Math.cos(Math.PI/180*t.gamma),t.ylen*Math.sin(Math.PI/180*t.gamma),0],r=[t.zlen*Math.cos(Math.PI/180*t.beta),t.zlen*(Math.cos(Math.PI/180*t.alpha)-Math.cos(Math.PI/180*t.gamma)*Math.cos(Math.PI/180*t.beta))/Math.sin(Math.PI/180*t.gamma),0];r[2]=Math.sqrt(t.zlen*t.zlen*Math.sin(Math.PI/180*t.beta)*Math.sin(Math.PI/180*t.beta)-r[1]*r[1]);var n=[0,e,i,r],o=[0,t.MX,t.MY,t.MZ],a=[0,t.MAPC,t.MAPR,t.MAPS],s=new N;return s.set(n[a[1]][0]/o[a[1]],n[a[2]][0]/o[a[2]],n[a[3]][0]/o[a[3]],0,n[a[1]][1]/o[a[1]],n[a[2]][1]/o[a[2]],n[a[3]][1]/o[a[3]],0,n[a[1]][2]/o[a[1]],n[a[2]][2]/o[a[2]],n[a[3]][2]/o[a[3]],0,0,0,0,1),s.setPosition(new O(t.originX,t.originY,t.originZ)),s.multiply((new N).makeTranslation(t.NXSTART,t.NYSTART,t.NZSTART)),s},Object.defineProperties(e.prototype,i),e}(Av);_c.add("mrc",Cv),_c.add("ccp4",Cv),_c.add("map",Cv);var Iv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"xplor"},e.prototype._parse=function(){gc&&mc.time("XplorParser._parse "+this.name);var t,e=this.volume,i=this.streamer.peekLines(8),r={},n=/\s+/;function o(t){return t.trim().split(n).map(parseFloat)}var a=(t=i[2].startsWith("REMARKS")?parseInt(i[1].substring(0,8))+2:5)+3,s=o(i[t]);r.NA=s[0],r.AMIN=s[1],r.AMAX=s[2],r.NB=s[3],r.BMIN=s[4],r.BMAX=s[5],r.NC=s[6],r.CMIN=s[7],r.CMAX=s[8];var c=o(i[t+1]);r.a=c[0]*this.voxelSize,r.b=c[1]*this.voxelSize,r.c=c[2]*this.voxelSize,r.alpha=c[3],r.beta=c[4],r.gamma=c[5];var u=r.AMAX-r.AMIN+1,h=r.BMAX-r.BMIN+1,l=r.CMAX-r.CMIN+1,p=u*h*l,d=new Float32Array(p),f=0,m=0,g=1+u*h/6;this.streamer.eachChunkOfLines((function(t){!function(t,e,i){for(var r=t;r<e;++r){var n=i[r];if(m>=a&&(m-a)%g!=0&&f<p)for(var o=0;o<6;++o)d[f]=parseFloat(n.substr(12*o,12)),++f;++m}}(0,t.length,t)})),e.header=r,e.setData(d,u,h,l),gc&&mc.timeEnd("XplorParser._parse "+this.name)},e.prototype.getMatrix=function(){var t=this.volume.header,e=[t.a,0,0],i=[t.b*Math.cos(Math.PI/180*t.gamma),t.b*Math.sin(Math.PI/180*t.gamma),0],r=[t.c*Math.cos(Math.PI/180*t.beta),t.c*(Math.cos(Math.PI/180*t.alpha)-Math.cos(Math.PI/180*t.gamma)*Math.cos(Math.PI/180*t.beta))/Math.sin(Math.PI/180*t.gamma),0];r[2]=Math.sqrt(t.c*t.c*Math.sin(Math.PI/180*t.beta)*Math.sin(Math.PI/180*t.beta)-r[1]*r[1]);var n=[0,e,i,r],o=[0,t.NA,t.NB,t.NC],a=[0,1,2,3],s=new N;return s.set(n[a[1]][0]/o[a[1]],n[a[2]][0]/o[a[2]],n[a[3]][0]/o[a[3]],0,n[a[1]][1]/o[a[1]],n[a[2]][1]/o[a[2]],n[a[3]][1]/o[a[3]],0,n[a[1]][2]/o[a[1]],n[a[2]][2]/o[a[2]],n[a[3]][2]/o[a[3]],0,0,0,0,1),s.multiply((new N).makeTranslation(t.AMIN,t.BMIN,t.CMIN)),s},Object.defineProperties(e.prototype,i),e}(Av);_c.add("xplor",Iv),_c.add("cns",Iv);var Rv=function(t){function e(e,i){t.call(this,e,i),this.loader=this.getLoader(),this.surface=new cp(this.name,this.path)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"surface"},i.__objName.get=function(){return"surface"},e.prototype._parse=function(){var t=this.loader.parse(this.streamer.asText());this.surface.fromGeometry(t)},Object.defineProperties(e.prototype,i),e}(Ig);function Lv(){this.regexp={vertex_pattern:/^v\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)/,normal_pattern:/^vn\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)/,uv_pattern:/^vt\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)/,face_vertex:/^f\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)(?:\s+(-?\d+))?/,face_vertex_uv:/^f\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+))?/,face_vertex_uv_normal:/^f\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+)\/(-?\d+))?/,face_vertex_normal:/^f\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)(?:\s+(-?\d+)\/\/(-?\d+))?/,object_pattern:/^[og]\s*(.+)?/,smoothing_pattern:/^s\s+(\d+|on|off)/,material_library_pattern:/^mtllib /,material_use_pattern:/^usemtl /}}Lv.prototype={constructor:Lv,setPath:function(t){this.path=t},_createParserState:function(){var t={objects:[],object:{},vertices:[],normals:[],startObject:function(t,e){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=t,void(this.object.fromDeclaration=!1!==e);this.object={name:t||"",geometry:{vertices:[],normals:[]},fromDeclaration:!1!==e},this.objects.push(this.object)},parseVertexIndex:function(t,e){var i=parseInt(t,10);return 3*(i>=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 r=this.vertices,n=this.object.geometry.vertices;n.push(r[t+0]),n.push(r[t+1]),n.push(r[t+2]),n.push(r[e+0]),n.push(r[e+1]),n.push(r[e+2]),n.push(r[i+0]),n.push(r[i+1]),n.push(r[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 r=this.normals,n=this.object.geometry.normals;n.push(r[t+0]),n.push(r[t+1]),n.push(r[t+2]),n.push(r[e+0]),n.push(r[e+1]),n.push(r[e+2]),n.push(r[i+0]),n.push(r[i+1]),n.push(r[i+2])},addFace:function(t,e,i,r,n,o,a,s){var c,u=this.vertices.length,h=this.parseVertexIndex(t,u),l=this.parseVertexIndex(e,u),p=this.parseVertexIndex(i,u);if(void 0===r?this.addVertex(h,l,p):(c=this.parseVertexIndex(r,u),this.addVertex(h,l,c),this.addVertex(l,p,c)),void 0!==n){var d=this.normals.length;h=this.parseNormalIndex(n,d),l=n===o?h:this.parseNormalIndex(o,d),p=n===a?h:this.parseNormalIndex(a,d),void 0===r?this.addNormal(h,l,p):(c=this.parseNormalIndex(s,d),this.addNormal(h,l,c),this.addNormal(l,p,c))}},addLineGeometry:function(t){this.object.geometry.type="Line";for(var e=this.vertices.length,i=0,r=t.length;i<r;i++)this.addVertexLine(this.parseVertexIndex(t[i],e))}};return t.startObject("",!1),t},parse:function(t){var e,i,r=this._createParserState();-1!==t.indexOf("\r\n")&&(t=t.replace(/\r\n/g,"\n")),-1!==t.indexOf("\\\n")&&(t=t.replace(/\\\n/g,""));var n=t.split("\n"),o="",a="",s="",c=[],u="function"==typeof"".trimLeft;for(e=0,i=n.length;e<i;e++)if(o=n[e],0!==(o=u?o.trimLeft():o.trim()).length&&"#"!==(a=o.charAt(0)))if("v"===a){if(" "===(s=o.charAt(1))&&null!==(c=this.regexp.vertex_pattern.exec(o)))r.vertices.push(parseFloat(c[1]),parseFloat(c[2]),parseFloat(c[3]));else if("n"===s&&null!==(c=this.regexp.normal_pattern.exec(o)))r.normals.push(parseFloat(c[1]),parseFloat(c[2]),parseFloat(c[3]));else if("t"!==s||null===(c=this.regexp.uv_pattern.exec(o)))throw new Error("Unexpected vertex/normal/uv line: '"+o+"'")}else if("f"===a)if(null!==(c=this.regexp.face_vertex_uv_normal.exec(o)))r.addFace(c[1],c[4],c[7],c[10],c[3],c[6],c[9],c[12]);else if(null!==(c=this.regexp.face_vertex_uv.exec(o)));else if(null!==(c=this.regexp.face_vertex_normal.exec(o)))r.addFace(c[1],c[3],c[5],c[7],c[2],c[4],c[6],c[8]);else{if(null===(c=this.regexp.face_vertex.exec(o)))throw new Error("Unexpected face line: '"+o+"'");r.addFace(c[1],c[2],c[3],c[4])}else if("l"===a){var h=o.substring(1).trim().split(" "),l=[],p=[];if(-1===o.indexOf("/"))l=h;else for(var d=0,f=h.length;d<f;d++){var m=h[d].split("/");""!==m[0]&&l.push(m[0]),""!==m[1]&&p.push(m[1])}r.addLineGeometry(l,p)}else if(null!==(c=this.regexp.object_pattern.exec(o))){var g=c[0].substr(1).trim();r.startObject(g)}else if(this.regexp.material_use_pattern.test(o));else if(this.regexp.material_library_pattern.test(o));else if(null===(c=this.regexp.smoothing_pattern.exec(o))){if("\0"===o)continue;throw new Error("Unexpected line: '"+o+"'")}var v=[];for(e=0,i=r.objects.length;e<i;e++){var y=r.objects[e].geometry;if(0!==y.vertices.length){var b=new _e;b.addAttribute("position",new me(new Float32Array(y.vertices),3)),y.normals.length>0?b.addAttribute("normal",new me(new Float32Array(y.normals),3)):b.computeVertexNormals(),v.push(b)}}return v}};var Ov=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"obj"},e.prototype.getLoader=function(){return new Lv},Object.defineProperties(e.prototype,i),e}(Rv);function Nv(){this.propertyNameMapping={}}_c.add("obj",Ov),Nv.prototype={constructor:Nv,setPropertyNameMapping:function(t){this.propertyNameMapping=t},bin2str:function(t){for(var e=new Uint8Array(t),i="",r=0;r<t.byteLength;r++)i+=String.fromCharCode(e[r]);return i},isASCII:function(t){return"ascii"===this.parseHeader(this.bin2str(t)).format},parse:function(t){return t instanceof ArrayBuffer?this.isASCII(t)?this.parseASCII(this.bin2str(t)):this.parseBinary(t):this.parseASCII(t)},parseHeader:function(t){var e="",i=0,r=/ply([\s\S]*)end_header\s/.exec(t);null!==r&&(e=r[1],i=r[0].length);var n,o,a,s,c,u,h={comments:[],elements:[],headerLength:i},l=e.split("\n");for(var p=0;p<l.length;p++){var d=l[p];if(""!==(d=d.trim()))switch(o=(a=d.split(/\s+/)).shift(),d=a.join(" "),o){case"format":h.format=a[0],h.version=a[1];break;case"comment":h.comments.push(d);break;case"element":void 0!==n&&h.elements.push(n),(n={}).name=a[0],n.count=parseInt(a[1]),n.properties=[];break;case"property":n.properties.push((s=a,c=this.propertyNameMapping,u=void 0,"list"===(u={type:s[0]}).type?(u.name=s[3],u.countType=s[1],u.itemType=s[2]):u.name=s[1],u.name in c&&(u.name=c[u.name]),u));break;default:console.log("unhandled",o,a)}}return void 0!==n&&h.elements.push(n),h},parseASCIINumber:function(t,e){switch(e){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(t);case"float":case"double":case"float32":case"float64":return parseFloat(t)}},parseASCIIElement:function(t,e){for(var i=e.split(/\s+/),r={},n=0;n<t.length;n++)if("list"===t[n].type){for(var o=[],a=this.parseASCIINumber(i.shift(),t[n].countType),s=0;s<a;s++)o.push(this.parseASCIINumber(i.shift(),t[n].itemType));r[t[n].name]=o}else r[t[n].name]=this.parseASCIINumber(i.shift(),t[n].type);return r},parseASCII:function(t){var e,i=new fe,r=this.parseHeader(t),n="";null!==(e=/end_header\s([\s\S]*)$/.exec(t))&&(n=e[1]);var o=n.split("\n"),a=0,s=0;i.useColor=!1;for(var c=0;c<o.length;c++){var u=o[c];if(""!==(u=u.trim())){s>=r.elements[a].count&&(a++,s=0);var h=this.parseASCIIElement(r.elements[a].properties,u);this.handleElement(i,r.elements[a].name,h),s++}}return this.postProcess(i)},postProcess:function(t){if(t.useColor){for(var e=0;e<t.faces.length;e++)t.faces[e].vertexColors=[t.colors[t.faces[e].a],t.colors[t.faces[e].b],t.colors[t.faces[e].c]];t.elementsNeedUpdate=!0}return t.computeBoundingSphere(),t},handleElement:function(t,e,i){if("vertex"===e){if(t.vertices.push(new O(i.x,i.y,i.z)),"red"in i&&"green"in i&&"blue"in i){t.useColor=!0;var r=new St;r.setRGB(i.red/255,i.green/255,i.blue/255),t.colors.push(r)}}else if("face"===e){var n=i.vertex_indices;3===n.length?t.faces.push(new re(n[0],n[1],n[2])):4===n.length&&t.faces.push(new re(n[0],n[1],n[3]),new re(n[1],n[2],n[3]))}},binaryRead:function(t,e,i,r){switch(i){case"int8":case"char":return[t.getInt8(e),1];case"uint8":case"uchar":return[t.getUint8(e),1];case"int16":case"short":return[t.getInt16(e,r),2];case"uint16":case"ushort":return[t.getUint16(e,r),2];case"int32":case"int":return[t.getInt32(e,r),4];case"uint32":case"uint":return[t.getUint32(e,r),4];case"float32":case"float":return[t.getFloat32(e,r),4];case"float64":case"double":return[t.getFloat64(e,r),8]}},binaryReadElement:function(t,e,i,r){for(var n,o={},a=0,s=0;s<i.length;s++)if("list"===i[s].type){var c=[],u=(n=this.binaryRead(t,e+a,i[s].countType,r))[0];a+=n[1];for(var h=0;h<u;h++)n=this.binaryRead(t,e+a,i[s].itemType,r),c.push(n[0]),a+=n[1];o[i[s].name]=c}else n=this.binaryRead(t,e+a,i[s].type,r),o[i[s].name]=n[0],a+=n[1];return[o,a]},parseBinary:function(t){for(var e,i=new fe,r=this.parseHeader(this.bin2str(t)),n="binary_little_endian"===r.format,o=new DataView(t,r.headerLength),a=0,s=0;s<r.elements.length;s++)for(var c=0;c<r.elements[s].count;c++){a+=(e=this.binaryReadElement(o,a,r.elements[s].properties,n))[1];var u=e[0];this.handleElement(i,r.elements[s].name,u)}return this.postProcess(i)}};var Dv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"ply"},e.prototype.getLoader=function(){return new Nv},Object.defineProperties(e.prototype,i),e}(Rv);_c.add("ply",Dv);var kv=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.delimiter=Eo(r.delimiter,","),this.comment=Eo(r.comment,"#"),this.columnNames=Eo(r.columnNames,!1),this.table={name:this.name,path:this.path,columnNames:[],data:[]}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"csv"},i.__objName.get=function(){return"table"},e.prototype._parse=function(){var t=this,e=this.table.data,i=new RegExp("\\s*"+this.delimiter+"\\s*"),r=0;this.streamer.eachChunkOfLines((function(n){for(var o=n.length,a=0;a<o;++a){var s=n[a].trim();if(!s.startsWith(t.comment)){var c=s.split(i);0===r?t.table.columnNames=c:s&&e.push(c),++r}}}))},Object.defineProperties(e.prototype,i),e}(Ig);_c.add("csv",kv);var Fv=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.string=Eo(r.string,!1),this.json={name:this.name,path:this.path,data:{}}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"json"},i.__objName.get=function(){return"json"},e.prototype._parse=function(){this.streamer.isBinary()||this.string?this.json.data=JSON.parse(this.streamer.asText()):this.json.data=this.streamer.data},Object.defineProperties(e.prototype,i),e}(Ig);_c.add("json",Fv);var Bv=function(t){function e(e,i){t.call(this,e,i),this.text={name:this.name,path:this.path,data:""}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"text"},i.__objName.get=function(){return"text"},e.prototype._parse=function(){this.text.data=this.streamer.asText()},Object.defineProperties(e.prototype,i),e}(Ig);_c.add("txt",Bv),_c.add("text",Bv);var zv=/^['"]|['"]$/g,Uv=/^<([\w-:.]+)\s*/,jv=/^([^<]*)/,Gv=/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/;function Vv(t){return t=t.trim().replace(/<!--[\s\S]*?-->/g,""),{declaration:e(),root:i()};function e(){if(n(/^<\?xml\s*/)){for(var t={attributes:{}};!o()&&!a("?>");){var e=r();if(!e)return t;t.attributes[e.name]=e.value}return n(/\?>\s*/),t}}function i(){var t=n(Uv);if(t){for(var e,s={name:t[1],attributes:{},children:[]};!(o()||a(">")||a("?>")||a("/>"));){var c=r();if(!c)return s;s.attributes[c.name]=c.value}if(n(/^\s*\/>\s*/))return s;for(n(/\??>\s*/),s.content=function(){var t=n(jv);if(t)return t[1];return""}();e=i();)s.children.push(e);return n(/^<\/[\w-:.]+>\s*/),s}}function r(){var t,e=n(Gv);if(e)return{name:e[1],value:(t=e[2],t.replace(zv,""))}}function n(e){var i=t.match(e);if(i)return t=t.slice(i[0].length),i}function o(){return 0===t.length}function a(e){return 0===t.indexOf(e)}}var $v=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.useDomParser=Eo(r.useDomParser,!1),this.xml={name:this.name,path:this.path,data:{}}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"xml"},i.__objName.get=function(){return"xml"},e.prototype.__xmlParser=function(t){return Vv(t)},e.prototype.__domParser=function(t){return(new window.DOMParser).parseFromString(t,"text/xml")},e.prototype._parse=function(){gc&&mc.time("XmlParser._parse "+this.name),this.useDomParser?this.streamer.data instanceof window.Document?this.xml.data=this.streamer.data:this.xml.data=this.__domParser(this.streamer.asText()):this.xml.data=this.__xmlParser(this.streamer.asText()),gc&&mc.timeEnd("XmlParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Ig);function Hv(t,e,i){var r=t.icode.value,n=t.chain.value,o=t.altcode.value,a=t.resnum.value;return r.trim()&&(a+="^"+r),n.trim()&&(a+=":"+n),e&&(a+="."+e),i&&o.trim()&&(a+="%"+o),a+="/"+(parseInt(t.model.value)-1)}function Wv(t,e,i){void 0===t[e]?t[e]=i:t[e]|=i}function Xv(t,e){return void 0!==t&&t.value===e}function qv(t,e,i){for(var r=0,n=e.getElementsByTagName("clash"),o=0,a=n.length;o<a;++o)if(t[n[o].attributes.cid.value]){r+=1;break}return e.getElementsByTagName("angle-outlier").length>0&&(r+=1),e.getElementsByTagName("bond-outlier").length>0&&(r+=1),e.getElementsByTagName("plane-outlier").length>0&&(r+=1),Xv(i.rota,"OUTLIER")&&(r+=1),Xv(i.rama,"OUTLIER")&&(r+=1),Xv(i.RNApucker,"outlier")&&(r+=1),r}_c.add("xml",$v);var Yv=function(t,e){this.name=t,this.path=e,this.rsrzDict={},this.rsccDict={},this.clashDict={},this.clashArray=[],this.geoDict={},this.geoAtomDict={},this.atomDict={},this.clashSele="NONE"},Zv={type:{}};Zv.type.get=function(){return"validation"},Yv.prototype.fromXml=function(t){gc&&mc.time("Validation.fromXml");var e=this.rsrzDict,i=this.rsccDict,r=this.clashDict,n=this.clashArray,o=this.geoDict,a=this.geoAtomDict,s=this.atomDict,c=t.getElementsByTagName("ModelledSubgroup"),u={},h=[];gc&&mc.time("Validation.fromXml#clashDict");for(var l=0,p=c.length;l<p;++l){var d=c[l],f=d.attributes,m=Hv(f);void 0!==f.rsrz&&(e[m]=parseFloat(f.rsrz.value)),void 0!==f.rscc&&(i[m]=parseFloat(f.rscc.value)),f.sele=m;for(var g=d.getElementsByTagName("clash"),v=0,y=g.length;v<y;++v){var b=g[v].attributes,x=b.atom.value;if("H"!==Xp(x)){var _=b.cid.value,w=Hv(f,x,!0);if(s[w]=!0,void 0===u[_])u[_]={sele1:w,res1:m};else{var S=u[_];S.res1!==m&&(S.sele2=w,S.res2=m,h.push(S.res1,m),r[_]=S,n.push(S))}}}}gc&&mc.timeEnd("Validation.fromXml#clashDict");for(var A=0,M=c.length;A<M;++A){var P=c[A],T=P.attributes,E=T.sele;if("."!==T.seq.value){var C=qv(r,P,T);C>0&&(o[E]=C)}else{var I=P.getElementsByTagName("clash"),R=P.getElementsByTagName("mog-bond-outlier"),L=P.getElementsByTagName("mog-angle-outlier");if(R.length>0||L.length>0||I.length>0){var O={};a[E]=O;for(var N=0,D=I.length;N<D;++N){var k=I[N].attributes;r[k.cid.value]&&Wv(O,k.atom.value,1)}for(var F=0,B=R.length;F<B;++F){R[F].attributes.atoms.value.split(",").forEach((function(t){Wv(O,t,2)}))}for(var z=0,U=L.length;z<U;++z){L[z].attributes.atoms.value.split(",").forEach((function(t){Wv(O,t,4)}))}}}}this.clashSele=h.length?h.join(" OR "):"NONE",gc&&mc.timeEnd("Validation.fromXml")},Yv.prototype.getClashData=function(t){gc&&mc.time("Validation.getClashData");var e=t||{},i=e.structure,r=i.atomSet,n=new St(Eo(e.color,"#f0027f")),o=i.getAtomProxy(),a=i.getAtomProxy(),s=new O,c=new O,u=new O,h=this.clashArray,l=h.length,p=new Float32Array(3*l),d=new Float32Array(3*l),f=au(l,n.r,n.g,n.b),m=new Float32Array(l),g=new Float32Array(l);gc&&mc.time("Validation.getClashData#atomDict");var v=this.atomDict;i.eachAtom((function(t){var e=function(t){var e=t.inscode,i=t.chainname,r=t.atomname,n=t.altloc,o=t.resno;return e&&(o+="^"+e),i&&(o+=":"+i),r&&(o+="."+r),n&&(o+="%"+n),o+="/"+t.modelIndex}(t);!0===v[e]&&(v[e]=t.index)})),gc&&mc.timeEnd("Validation.getClashData#atomDict");var y=0;return h.forEach((function(t,e){if(o.index=v[t.sele1],a.index=v[t.sele2],void 0!==o.index&&void 0!==a.index&&r.isSet(o.index,a.index)){s.subVectors(a,o).setLength(o.vdw),c.copy(o).add(s),s.subVectors(o,a).setLength(a.vdw),u.copy(a).add(s);var i=o.distanceTo(a)/2,n=Math.sqrt(o.vdw*o.vdw-i*i),h=Math.sqrt(a.vdw*a.vdw-i*i);c.toArray(p,3*y),u.toArray(d,3*y),m[y]=(n+h)/2,g[y]=e,++y}})),gc&&mc.timeEnd("Validation.getClashData"),{position1:p.subarray(0,3*y),position2:d.subarray(0,3*y),color:f.subarray(0,3*y),color2:f.subarray(0,3*y),radius:m.subarray(0,y),picking:new Yh(g.subarray(0,y),this,i)}},Object.defineProperties(Yv.prototype,Zv);var Kv=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.useDomParser=!0,this.validation=new Yv(this.name,this.path)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={__objName:{}};return i.__objName.get=function(){return"validation"},e.prototype._parse=function(){t.prototype._parse.call(this),gc&&mc.time("ValidationParser._parse "+this.name),this.validation.fromXml(this.xml.data),gc&&mc.timeEnd("ValidationParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}($v);function Qv(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)}function Jv(t,e,i,r,n){if(e.subarray&&t.subarray)t.set(e.subarray(i,i+r),n);else for(var o=0;o<r;o++)t[n+o]=e[i+o]}function ty(t,e,i,r){for(var n=65535&t|0,o=t>>>16&65535|0,a=0;0!==i;){i-=a=i>2e3?2e3:i;do{o=o+(n=n+e[r++]|0)|0}while(--a);n%=65521,o%=65521}return n|o<<16|0}_c.add("validation",Kv);var ey=function(){for(var t,e=[],i=0;i<256;i++){t=i;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}();function iy(t,e,i,r){var n=ey,o=r+i;t^=-1;for(var a=r;a<o;a++)t=t>>>8^n[255&(t^e[a])];return-1^t}function ry(t,e){var i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,P;i=t.state,r=t.next_in,M=t.input,n=r+(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,p=i.window,d=i.hold,f=i.bits,m=i.lencode,g=i.distcode,v=(1<<i.lenbits)-1,y=(1<<i.distbits)-1;t:do{f<15&&(d+=M[r++]<<f,f+=8,d+=M[r++]<<f,f+=8),b=m[d&v];e:for(;;){if(d>>>=x=b>>>24,f-=x,0===(x=b>>>16&255))P[o++]=65535&b;else{if(!(16&x)){if(0==(64&x)){b=m[(65535&b)+(d&(1<<x)-1)];continue e}if(32&x){i.mode=12;break t}t.msg="invalid literal/length code",i.mode=30;break t}_=65535&b,(x&=15)&&(f<x&&(d+=M[r++]<<f,f+=8),_+=d&(1<<x)-1,d>>>=x,f-=x),f<15&&(d+=M[r++]<<f,f+=8,d+=M[r++]<<f,f+=8),b=g[d&y];i:for(;;){if(d>>>=x=b>>>24,f-=x,!(16&(x=b>>>16&255))){if(0==(64&x)){b=g[(65535&b)+(d&(1<<x)-1)];continue i}t.msg="invalid distance code",i.mode=30;break t}if(w=65535&b,f<(x&=15)&&(d+=M[r++]<<f,(f+=8)<x&&(d+=M[r++]<<f,f+=8)),(w+=d&(1<<x)-1)>c){t.msg="invalid distance too far back",i.mode=30;break t}if(d>>>=x,f-=x,w>(x=o-a)){if((x=w-x)>h&&i.sane){t.msg="invalid distance too far back",i.mode=30;break t}if(S=0,A=p,0===l){if(S+=u-x,x<_){_-=x;do{P[o++]=p[S++]}while(--x);S=o-w,A=P}}else if(l<x){if(S+=u+l-x,(x-=l)<_){_-=x;do{P[o++]=p[S++]}while(--x);if(S=0,l<_){_-=x=l;do{P[o++]=p[S++]}while(--x);S=o-w,A=P}}}else if(S+=l-x,x<_){_-=x;do{P[o++]=p[S++]}while(--x);S=o-w,A=P}for(;_>2;)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(r<n&&o<s);r-=_=f>>3,d&=(1<<(f-=_<<3))-1,t.next_in=r,t.next_out=o,t.avail_in=r<n?n-r+5:5-(r-n),t.avail_out=o<s?s-o+257:257-(o-s),i.hold=d,i.bits=f}var 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],oy=[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],ay=[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],sy=[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];function cy(t,e,i,r,n,o,a,s){var c,u,h,l,p,d,f,m,g,v=s.bits,y=0,b=0,x=0,_=0,w=0,S=0,A=0,M=0,P=0,T=0,E=null,C=0,I=new Uint16Array(16),R=new Uint16Array(16),L=null,O=0;for(y=0;y<=15;y++)I[y]=0;for(b=0;b<r;b++)I[e[i+b]]++;for(w=v,_=15;_>=1&&0===I[_];_--);if(w>_&&(w=_),0===_)return n[o++]=20971520,n[o++]=20971520,s.bits=1,0;for(x=1;x<_&&0===I[x];x++);for(w<x&&(w=x),M=1,y=1;y<=15;y++)if(M<<=1,(M-=I[y])<0)return-1;if(M>0&&(0===t||1!==_))return-1;for(R[1]=0,y=1;y<15;y++)R[y+1]=R[y]+I[y];for(b=0;b<r;b++)0!==e[i+b]&&(a[R[e[i+b]]++]=b);if(0===t?(E=L=a,d=19):1===t?(E=ny,C-=257,L=oy,O-=257,d=256):(E=ay,L=sy,d=-1),T=0,b=0,y=x,p=o,S=w,A=0,h=-1,l=(P=1<<w)-1,1===t&&P>852||2===t&&P>592)return 1;for(;;){f=y-A,a[b]<d?(m=0,g=a[b]):a[b]>d?(m=L[O+a[b]],g=E[C+a[b]]):(m=96,g=0),c=1<<y-A,x=u=1<<S;do{n[p+(T>>A)+(u-=c)]=f<<24|m<<16|g|0}while(0!==u);for(c=1<<y-1;T&c;)c>>=1;if(0!==c?(T&=c-1,T+=c):T=0,b++,0==--I[y]){if(y===_)break;y=e[i+a[b]]}if(y>w&&(T&l)!==h){for(0===A&&(A=w),p+=x,M=1<<(S=y-A);S+A<_&&!((M-=I[S+A])<=0);)S++,M<<=1;if(P+=1<<S,1===t&&P>852||2===t&&P>592)return 1;n[h=T&l]=w<<24|S<<16|p-o|0}}return 0!==T&&(n[p+T]=y-A<<24|64<<16|0),s.bits=w,0}function uy(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function hy(){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 ly(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,function(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=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,0):-2}(t)):-2}function py(t,e){var i,r;return t?(r=new hy,t.state=r,r.window=null,0!==(i=function(t,e){var i,r;return t&&t.state?(r=t.state,e<0?(i=0,e=-e):(i=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?-2:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=i,r.wbits=e,ly(t))):-2}(t,e))&&(t.state=null),i):-2}var dy,fy,my=!0;function gy(t){if(my){var e;for(dy=new Int32Array(512),fy=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(cy(1,t.lens,0,288,dy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;cy(2,t.lens,0,32,fy,0,t.work,{bits:5}),my=!1}t.lencode=dy,t.lenbits=9,t.distcode=fy,t.distbits=5}function vy(t,e,i,r){var n,o=t.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),r>=o.wsize?(Jv(o.window,e,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((n=o.wsize-o.wnext)>r&&(n=r),Jv(o.window,e,i-r,n,o.wnext),(r-=n)?(Jv(o.window,e,i-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=n))),0}function yy(t,e){var i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,P=0,T=new Uint8Array(4),E=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return-2;12===(i=t.state).mode&&(i.mode=13),a=t.next_out,n=t.output,c=t.avail_out,o=t.next_in,r=t.input,s=t.avail_in,u=i.hold,h=i.bits,l=s,p=c,S=0;t:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;h<16;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(2&i.wrap&&35615===u){i.check=0,T[0]=255&u,T[1]=u>>>8&255,i.check=iy(i.check,T,2,0),u=0,h=0,i.mode=2;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=30;break}if(8!=(15&u)){t.msg="unknown compression method",i.mode=30;break}if(h-=4,w=8+(15&(u>>>=4)),0===i.wbits)i.wbits=w;else if(w>i.wbits){t.msg="invalid window size",i.mode=30;break}i.dmax=1<<w,t.adler=i.check=1,i.mode=512&u?10:12,u=0,h=0;break;case 2:for(;h<16;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(i.flags=u,8!=(255&i.flags)){t.msg="unknown compression method",i.mode=30;break}if(57344&i.flags){t.msg="unknown header flags set",i.mode=30;break}i.head&&(i.head.text=u>>8&1),512&i.flags&&(T[0]=255&u,T[1]=u>>>8&255,i.check=iy(i.check,T,2,0)),u=0,h=0,i.mode=3;case 3:for(;h<32;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.head&&(i.head.time=u),512&i.flags&&(T[0]=255&u,T[1]=u>>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,i.check=iy(i.check,T,4,0)),u=0,h=0,i.mode=4;case 4:for(;h<16;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.head&&(i.head.xflags=255&u,i.head.os=u>>8),512&i.flags&&(T[0]=255&u,T[1]=u>>>8&255,i.check=iy(i.check,T,2,0)),u=0,h=0,i.mode=5;case 5:if(1024&i.flags){for(;h<16;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.length=u,i.head&&(i.head.extra_len=u),512&i.flags&&(T[0]=255&u,T[1]=u>>>8&255,i.check=iy(i.check,T,2,0)),u=0,h=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&((d=i.length)>s&&(d=s),d&&(i.head&&(w=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),Jv(i.head.extra,r,o,d,w)),512&i.flags&&(i.check=iy(i.check,r,d,o)),s-=d,o+=d,i.length-=d),i.length))break t;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===s)break t;d=0;do{w=r[o+d++],i.head&&w&&i.length<65536&&(i.head.name+=String.fromCharCode(w))}while(w&&d<s);if(512&i.flags&&(i.check=iy(i.check,r,d,o)),s-=d,o+=d,w)break t}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===s)break t;d=0;do{w=r[o+d++],i.head&&w&&i.length<65536&&(i.head.comment+=String.fromCharCode(w))}while(w&&d<s);if(512&i.flags&&(i.check=iy(i.check,r,d,o)),s-=d,o+=d,w)break t}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;h<16;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(u!==(65535&i.check)){t.msg="header crc mismatch",i.mode=30;break}u=0,h=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=12;break;case 10:for(;h<32;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}t.adler=i.check=uy(u),u=0,h=0,i.mode=11;case 11:if(0===i.havedict)return t.next_out=a,t.avail_out=c,t.next_in=o,t.avail_in=s,i.hold=u,i.bits=h,2;t.adler=i.check=1,i.mode=12;case 12:if(5===e||6===e)break t;case 13:if(i.last){u>>>=7&h,h-=7&h,i.mode=27;break}for(;h<3;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}switch(i.last=1&u,h-=1,3&(u>>>=1)){case 0:i.mode=14;break;case 1:if(gy(i),i.mode=20,6===e){u>>>=2,h-=2;break t}break;case 2:i.mode=17;break;case 3:t.msg="invalid block type",i.mode=30}u>>>=2,h-=2;break;case 14:for(u>>>=7&h,h-=7&h;h<32;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if((65535&u)!=(u>>>16^65535)){t.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&u,u=0,h=0,i.mode=15,6===e)break t;case 15:i.mode=16;case 16:if(d=i.length){if(d>s&&(d=s),d>c&&(d=c),0===d)break t;Jv(n,r,o,d,a),s-=d,o+=d,c-=d,a+=d,i.length-=d;break}i.mode=12;break;case 17:for(;h<14;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(i.nlen=257+(31&u),u>>>=5,h-=5,i.ndist=1+(31&u),u>>>=5,h-=5,i.ncode=4+(15&u),u>>>=4,h-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=30;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;h<3;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.lens[E[i.have++]]=7&u,u>>>=3,h-=3}for(;i.have<19;)i.lens[E[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,A={bits:i.lenbits},S=cy(0,i.lens,0,19,i.lencode,0,i.work,A),i.lenbits=A.bits,S){t.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;v=(P=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,y=65535&P,!((g=P>>>24)<=h);){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(y<16)u>>>=g,h-=g,i.lens[i.have++]=y;else{if(16===y){for(M=g+2;h<M;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(u>>>=g,h-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=30;break}w=i.lens[i.have-1],d=3+(3&u),u>>>=2,h-=2}else if(17===y){for(M=g+3;h<M;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}h-=g,w=0,d=3+(7&(u>>>=g)),u>>>=3,h-=3}else{for(M=g+7;h<M;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}h-=g,w=0,d=11+(127&(u>>>=g)),u>>>=7,h-=7}if(i.have+d>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=30;break}for(;d--;)i.lens[i.have++]=w}}if(30===i.mode)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,A={bits:i.lenbits},S=cy(1,i.lens,0,i.nlen,i.lencode,0,i.work,A),i.lenbits=A.bits,S){t.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,A={bits:i.distbits},S=cy(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,A),i.distbits=A.bits,S){t.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===e)break t;case 20:i.mode=21;case 21: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,ry(t,p),a=t.next_out,n=t.output,c=t.avail_out,o=t.next_in,r=t.input,s=t.avail_in,u=i.hold,h=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;v=(P=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,y=65535&P,!((g=P>>>24)<=h);){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(v&&0==(240&v)){for(b=g,x=v,_=y;v=(P=i.lencode[_+((u&(1<<b+x)-1)>>b)])>>>16&255,y=65535&P,!(b+(g=P>>>24)<=h);){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}u>>>=b,h-=b,i.back+=b}if(u>>>=g,h-=g,i.back+=g,i.length=y,0===v){i.mode=26;break}if(32&v){i.back=-1,i.mode=12;break}if(64&v){t.msg="invalid literal/length code",i.mode=30;break}i.extra=15&v,i.mode=22;case 22:if(i.extra){for(M=i.extra;h<M;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.length+=u&(1<<i.extra)-1,u>>>=i.extra,h-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;v=(P=i.distcode[u&(1<<i.distbits)-1])>>>16&255,y=65535&P,!((g=P>>>24)<=h);){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(0==(240&v)){for(b=g,x=v,_=y;v=(P=i.distcode[_+((u&(1<<b+x)-1)>>b)])>>>16&255,y=65535&P,!(b+(g=P>>>24)<=h);){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}u>>>=b,h-=b,i.back+=b}if(u>>>=g,h-=g,i.back+=g,64&v){t.msg="invalid distance code",i.mode=30;break}i.offset=y,i.extra=15&v,i.mode=24;case 24:if(i.extra){for(M=i.extra;h<M;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.offset+=u&(1<<i.extra)-1,u>>>=i.extra,h-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===c)break t;if(d=p-c,i.offset>d){if((d=i.offset-d)>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=30;break}d>i.wnext?(d-=i.wnext,f=i.wsize-d):f=i.wnext-d,d>i.length&&(d=i.length),m=i.window}else m=n,f=a-i.offset,d=i.length;d>c&&(d=c),c-=d,i.length-=d;do{n[a++]=m[f++]}while(--d);0===i.length&&(i.mode=21);break;case 26:if(0===c)break t;n[a++]=i.length,c--,i.mode=21;break;case 27:if(i.wrap){for(;h<32;){if(0===s)break t;s--,u|=r[o++]<<h,h+=8}if(p-=c,t.total_out+=p,i.total+=p,p&&(t.adler=i.check=i.flags?iy(i.check,n,p,a-p):ty(i.check,n,p,a-p)),p=c,(i.flags?u:uy(u))!==i.check){t.msg="incorrect data check",i.mode=30;break}u=0,h=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;h<32;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(u!==(4294967295&i.total)){t.msg="incorrect length check",i.mode=30;break}u=0,h=0}i.mode=29;case 29:S=1;break t;case 30:S=-3;break t;case 31:return-4;case 32:default:return-2}return t.next_out=a,t.avail_out=c,t.next_in=o,t.avail_in=s,i.hold=u,i.bits=h,(i.wsize||p!==t.avail_out&&i.mode<30&&(i.mode<27||4!==e))&&vy(t,t.output,t.next_out,p-t.avail_out)?(i.mode=31,-4):(l-=t.avail_in,p-=t.avail_out,t.total_in+=l,t.total_out+=p,i.total+=p,i.wrap&&p&&(t.adler=i.check=i.flags?iy(i.check,n,p,t.next_out-p):ty(i.check,n,p,t.next_out-p)),t.data_type=i.bits+(i.last?64:0)+(12===i.mode?128:0)+(20===i.mode||15===i.mode?256:0),(0===l&&0===p||4===e)&&0===S&&(S=-5),S)}function by(t,e){var i,r=e.length;return t&&t.state?0!==(i=t.state).wrap&&11!==i.mode?-2:11===i.mode&&ty(1,e,r,0)!==i.check?-3:vy(t,e,r,r)?(i.mode=31,-4):(i.havedict=1,0):-2}var xy=!0,_y=!0;try{String.fromCharCode.apply(null,[0])}catch(t){xy=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){_y=!1}for(var wy=new Uint8Array(256),Sy=0;Sy<256;Sy++)wy[Sy]=Sy>=252?6:Sy>=248?5:Sy>=240?4:Sy>=224?3:Sy>=192?2:1;function Ay(t){var e,i,r,n,o,a=t.length,s=0;for(n=0;n<a;n++)55296==(64512&(i=t.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=t.charCodeAt(n+1)))&&(i=65536+(i-55296<<10)+(r-56320),n++),s+=i<128?1:i<2048?2:i<65536?3:4;for(e=new Uint8Array(s),o=0,n=0;o<s;n++)55296==(64512&(i=t.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=t.charCodeAt(n+1)))&&(i=65536+(i-55296<<10)+(r-56320),n++),i<128?e[o++]=i:i<2048?(e[o++]=192|i>>>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 My(t,e){var i,r,n,o,a=e||t.length,s=new Array(2*a);for(r=0,i=0;i<a;)if((n=t[i++])<128)s[r++]=n;else if((o=wy[n])>4)s[r++]=65533,i+=o-1;else{for(n&=2===o?31:3===o?15:7;o>1&&i<a;)n=n<<6|63&t[i++],o--;o>1?s[r++]=65533:n<65536?s[r++]=n:(n-=65536,s[r++]=55296|n>>10&1023,s[r++]=56320|1023&n)}return function(t,e){if(e<65537&&(t.subarray&&_y||!t.subarray&&xy))return String.fromCharCode.apply(null,Qv(t,e));for(var i="",r=0;r<e;r++)i+=String.fromCharCode(t[r]);return i}(s,r)}function Py(t,e){var i;for((e=e||t.length)>t.length&&(e=t.length),i=e-1;i>=0&&128==(192&t[i]);)i--;return i<0?e:0===i?e:i+wy[t[i]]>e?i:e}wy[254]=wy[254]=1;var Ty={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"};function Ey(){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 Cy(){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}var Iy=Object.prototype.toString;function Ry(t){if(!(this instanceof Ry))return new Ry(t);this.options=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}}return t}({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 Ey,this.strm.avail_out=0;var i,r,n,o=py(this.strm,e.windowBits);if(0!==o)throw new Error(Ty[o]);this.header=new Cy,i=this.strm,r=this.header,i&&i.state&&(0==(2&(n=i.state).wrap)||(n.head=r,r.done=!1))}Ry.prototype.push=function(t,e){var i,r,n,o,a,s,c=this.strm,u=this.options.chunkSize,h=this.options.dictionary,l=!1;if(this.ended)return!1;r=e===~~e?e:!0===e?4:0,"string"==typeof t?c.input=function(t){for(var e=new Uint8Array(t.length),i=0,r=e.length;i<r;i++)e[i]=t.charCodeAt(i);return e}(t):"[object ArrayBuffer]"===Iy.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),2===(i=yy(c,0))&&h&&(s="string"==typeof h?Ay(h):"[object ArrayBuffer]"===Iy.call(h)?new Uint8Array(h):h,i=by(this.strm,s)),-5===i&&!0===l&&(i=0,l=!1),1!==i&&0!==i)return this.onEnd(i),this.ended=!0,!1;c.next_out&&(0!==c.avail_out&&1!==i&&(0!==c.avail_in||4!==r&&2!==r)||("string"===this.options.to?(n=Py(c.output,c.next_out),o=c.next_out-n,a=My(c.output,n),c.next_out=o,c.avail_out=u-o,o&&Jv(c.output,c.output,n,o,0),this.onData(a)):this.onData(Qv(c.output,c.next_out)))),0===c.avail_in&&0===c.avail_out&&(l=!0)}while((c.avail_in>0||0===c.avail_out)&&1!==i);return 1===i&&(r=4),4===r?(i=function(t){if(!t||!t.state)return-2;var e=t.state;return e.window&&(e.window=null),t.state=null,0}(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==r||(this.onEnd(0),c.avail_out=0,!0)},Ry.prototype.onData=function(t){this.chunks.push(t)},Ry.prototype.onEnd=function(t){0===t&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=function(t){var e,i,r,n,o,a;for(r=0,e=0,i=t.length;e<i;e++)r+=t[e].length;for(a=new Uint8Array(r),n=0,e=0,i=t.length;e<i;e++)o=t[e],a.set(o,n),n+=o.length;return a}(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},Sc.add("gz",(function(t){var e;t instanceof ArrayBuffer&&(t=new Uint8Array(t));try{e=function(t,e){var i=new Ry(e);if(i.push(t,!0),i.err)throw i.msg;return i.result}(t)}catch(i){e=t}return e}));var Ly="//mmtf.rcsb.org/v1.0/full/";bc.add("rcsb",new function(){this.getUrl=function(t){var e,i=Lo(t),r=i.name.substr(0,4);return!["pdb","cif"].includes(i.ext)||!1!==i.compressed&&"gz"!==i.compressed?"mmtf"===i.ext?e=i.base.endsWith(".bb")?"//mmtf.rcsb.org/v1.0/reduced/"+r:Ly+r:i.ext?(mc.warn("unsupported ext",i.ext),e=Ly+r):e=Ly+r:e="//files.rcsb.org/download/"+i.path,Co()+e},this.getExt=function(t){var e=Lo(t);if("mmtf"===e.ext||!e.ext)return"mmtf"}});var Oy="//pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/";function Ny(){this.getUrl=function(t){return t}}bc.add("pubchem",new function(){this.getUrl=function(t){var e,i=Lo(t),r=i.name;return i.ext&&"sdf"!==i.ext?(mc.warn("unsupported ext",i.ext),e=Oy+r+"/SDF?record_type=3d"):e=Oy+r+"/SDF?record_type=3d",Co()+e},this.getExt=function(t){var e=Lo(t);if(!e.ext||"sdf"===e.ext)return"sdf"}}),bc.add("ftp",new Ny),bc.add("http",new Ny),bc.add("https",new Ny);"undefined"==typeof window||window.Promise||(window.Promise=p)}).call(this,i(155).setImmediate)},155:function(t,e,i){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(n.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new o(n.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},i(156),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,i(48))},156:function(t,e,i){(function(t,e){!function(t,i){"use strict";if(!t.setImmediate){var r,n,o,a,s,c=1,u={},h=!1,l=t.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(t);p=p&&p.setTimeout?p:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick((function(){f(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,i=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=i,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){f(t.data)},r=function(t){o.port2.postMessage(t)}):l&&"onreadystatechange"in l.createElement("script")?(n=l.documentElement,r=function(t){var e=l.createElement("script");e.onreadystatechange=function(){f(t),e.onreadystatechange=null,n.removeChild(e),e=null},n.appendChild(e)}):r=function(t){setTimeout(f,0,t)}:(a="setImmediate$"+Math.random()+"$",s=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(a)&&f(+e.data.slice(a.length))},t.addEventListener?t.addEventListener("message",s,!1):t.attachEvent("onmessage",s),r=function(e){t.postMessage(a+e,"*")}),p.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),i=0;i<e.length;i++)e[i]=arguments[i+1];var n={callback:t,args:e};return u[c]=n,r(c),c++},p.clearImmediate=d}function d(t){delete u[t]}function f(t){if(h)setTimeout(f,0,t);else{var e=u[t];if(e){h=!0;try{!function(t){var e=t.callback,i=t.args;switch(i.length){case 0:e();break;case 1:e(i[0]);break;case 2:e(i[0],i[1]);break;case 3:e(i[0],i[1],i[2]);break;default:e.apply(void 0,i)}}(e)}finally{d(t),h=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,i(48),i(56))},157:function(t,e,i){"use strict";var r=i(158);t.exports=function(t){var e=typeof t;if("string"===e){var i=t;if(0===(t=+t)&&r(i))return!1}else if("number"!==e)return!1;return t-t<1}},158:function(t,e,i){"use strict";t.exports=function(t){for(var e,i=t.length,r=0;r<i;r++)if(((e=t.charCodeAt(r))<9||e>13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(e<8192||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}},42:function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return y}));var r=i(1),n=i.n(r),o=i(16),a=i(154),s=i(47),c=i(157),u=i.n(c);function h(t){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e<t.length;e++)i[e]=t[e];return i}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function p(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function d(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function f(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function m(t,e){return!e||"object"!==h(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function g(t){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function v(t,e){return(v=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var y=function(t){function e(t){var i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(i=m(this,g(e).call(this,t))).state={stage:null,orientationMatrix:null,structuresList:[]},i.ref=n.a.createRef(),i}var i,r,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&v(t,e)}(e,t),i=e,(r=[{key:"componentDidMount",value:function(){var t=this.props,e=t.stageParameters,i=t.width,r=t.height,n=function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?p(Object(i),!0).forEach((function(e){d(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):p(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({},e),o=new a.b(this.ref.current,n),s=o.viewerControls.getOrientation(),c=u()(i)?i+"px":i,h=u()(r)?r+"px":r;o.setSize(c,h),this.setState({stage:o,orientationMatrix:s})}},{key:"shouldComponentUpdate",value:function(t,e){var i=this.props,r=i.stageParameters,n=i.data,o=i.downloadImage,a=i.molStyles,c=i.height,u=i.width;if(null!==n&&null!==t.data){if(void 0!==e.data)return!0;var h=t.data[0].selectedValue,l=n[0].selectedValue;if(h!==l)return!0;var p=n[0].resetView;if(h===l&&!0===p)return!0;if(!0===n[0].uploaded)return!0}return!(Object(s.a)(t.molStyles,a)&&Object(s.a)(t.stageParameters,r)&&t.downloadImage===o&&Object(s.a)(t.height,c)&&Object(s.a)(t.width,u))}},{key:"componentDidUpdate",value:function(){var t=this.props,e=t.data,i=t.stageParameters,r=t.downloadImage,n=t.sideByside,o=t.height,a=t.width,s=this.state,c=s.stage,h=s.structuresList,l=u()(a)?a+"px":a,p=u()(o)?o+"px":o;c.setParameters(i),c.setSize(l,p),(void 0===r||!1===r&&"placeholder"!==e[0].selectedValue)&&(c.eachComponent((function(t){t.removeAllRepresentations()})),this.processDataFromBackend(e,h,n)),!0===r&&this.generateImage(),this.props.setProps({downloadImage:!1})}},{key:"highlightAtoms",value:function(t,e,i,r,n){""!==r&&(t.sele=e+" and @"+r,i.addRepresentation("ball+stick",t)),""!==n&&(t.sele=e+".CA and ("+n.replace(/,/g," or ")+")",i.addRepresentation("ball+stick",t))}},{key:"addMolStyle",value:function(t,e,i,r){var n=this.props.molStyles,o=l(n.representations),a=i.atoms,s=i.residues,c={sele:e,showBox:o.includes("axes+box")};":"!==e&&(c.color=r),o.forEach((function(e){var i=e;"axes+box"===i&&(i="axes"),t.addRepresentation(i,c)})),""===a&&""===s||(c.radius=n.chosenAtomsRadius,c.color=n.chosenAtomsColor,this.highlightAtoms(c,e,t,a,s))}},{key:"showStructure",value:function(t,e,i,r,n,o,s){var c=this.state,u=c.stage,h=c.orientationMatrix,l=t,p=":";if(u.viewerControls.orient(h),"ALL"===e)this.addMolStyle(t,p,r,n);else{if(p+=e,"ALL"!==i&&(p+="/0 and "+i),!0===s){var d=new a.a(p),f=t.structure.getView(d),m=(l=u.addComponentFromObject(f)).getCenter(),g=f.getPrincipalAxes();l.setRotation(g.getRotationQuaternion()),l.setPosition([0-m.x-o,0-m.y,0-m.z])}this.addMolStyle(l,p,r,n)}u.autoView()}},{key:"processDataFromBackend",value:function(t,e){for(var i=this.props.molStyles,r=this.state.stage,n=0;n<t.length;n++){var o=t[n].filename,a=n*i.molSpacingXaxis,s=i.sideByside;e.includes(o)?this.showStructure(r.getComponentsByName(o).list[0],t[n].chain,t[n].aaRange,t[n].chosen,t[n].color,a,s):this.loadData(t[n],a,s)}}},{key:"loadData",value:function(t,e,i){var r=this,n=this.state.stage,o=new Blob([t.config.input],{type:t.config.type});n.loadFile(o,{ext:t.ext,defaultRepresentation:!1}).then((function(n){n.name=t.filename,r.showStructure(n,t.chain,t.aaRange,t.chosen,t.color,e,i),r.setState((function(e){return{structuresList:e.structuresList.concat([t.filename])}}))}))}},{key:"generateImage",value:function(){var t=this.props.imageParameters;this.state.stage.makeImage({factor:1,antialias:t.antialias,trim:t.trim,transparent:t.transparent}).then((function(e){Object(a.c)(e,t.defaultFilename+".png")}))}},{key:"render",value:function(){var t=this.props.id;return n.a.createElement("div",{id:t,ref:this.ref})}}])&&f(i.prototype,r),o&&f(i,o),e}(r.Component);y.defaultProps=o.b,y.propTypes=o.c}}]);
\ No newline at end of file
diff --git a/dash_bio/bundle.js b/dash_bio/bundle.js
index 0bbfd79d7..0f7dda4b4 100644
--- a/dash_bio/bundle.js
+++ b/dash_bio/bundle.js
@@ -1 +1 @@
-window.dash_bio=function(t){function n(n){for(var e,o,a=n[0],i=n[1],u=0,s=[];u<a.length;u++)o=a[u],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&s.push(r[o][0]),r[o]=0;for(e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e]);for(h&&h(n);s.length;)s.shift()()}var e={},r={11:0};function o(t){return a.p+""+({0:"async-alignment",1:"async-circos",2:"async-ideogram",3:"async-igv",4:"async-moleculeviewer2",5:"async-moleculeviewer3",6:"async-needle",7:"async-nglmoleculeviewer",8:"async-onco",9:"async-sequence",10:"async-speck"}[t]||t)+".js"}function a(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.e=function(t){var n=[],e=r[t];if(0!==e)if(e)n.push(e[2]);else{var i=new Promise((function(n,o){e=r[t]=[n,o]}));n.push(e[2]=i);var u,s=document.createElement("script");s.charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.src=o(t);var l=new Error;u=function(n){s.onerror=s.onload=null,clearTimeout(c);var e=r[t];if(0!==e){if(e){var o=n&&("load"===n.type?"missing":n.type),a=n&&n.target&&n.target.src;l.message="Loading chunk "+t+" failed.\n("+o+": "+a+")",l.name="ChunkLoadError",l.type=o,l.request=a,e[1](l)}r[t]=void 0}};var c=setTimeout((function(){u({type:"timeout",target:s})}),12e4);s.onerror=s.onload=u,document.head.appendChild(s)}return Promise.all(n)},a.m=t,a.c=e,a.d=function(t,n,e){a.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,n){if(1&n&&(t=a(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(a.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var r in t)a.d(e,r,function(n){return t[n]}.bind(null,r));return e},a.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(n,"a",n),n},a.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},a.p="",a.oe=function(t){throw console.error(t),t};var i,u=function(){var t=document.currentScript;if(!t){for(var n=document.getElementsByTagName("script"),e=[],r=0;r<n.length;r++)e.push(n[r]);t=(e=e.filter((function(t){return!t.async&&!t.text&&!t.textContent}))).slice(-1)[0]}return t};if(Object.defineProperty(a,"p",{get:(i=u().src.split("/").slice(0,-1).join("/")+"/",function(){return i})}),void 0!==o){var s=o;o=function(t){var n=function(t){return/\/_dash-component-suites\//.test(t.src)}(u()),e=s(t);if(!n)return e;var r=e.split("/"),o=r.slice(-1)[0].split(".");return o.splice(1,0,"v0_6_0m1611814889"),r.splice(-1,1,o.join(".")),r.join("/")}}var l=window.webpackJsonpdash_bio=window.webpackJsonpdash_bio||[],c=l.push.bind(l);l.push=n,l=l.slice();for(var f=0;f<l.length;f++)n(l[f]);var h=c;return a(a.s=33)}([function(t,n,e){t.exports=e(25)()},function(t,n){t.exports=window.React},function(t,n,e){"use strict";n.a={alignmentChart:function(){return e.e(0).then(e.bind(null,36))},circos:function(){return e.e(1).then(e.bind(null,37))},ideogram:function(){return Promise.all([e.e(0),e.e(2)]).then(e.bind(null,38))},igv:function(){return Promise.all([e.e(0),e.e(3)]).then(e.bind(null,39))},molecule2dViewer:function(){return Promise.all([e.e(0),e.e(4)]).then(e.bind(null,40))},molecule3dViewer:function(){return Promise.all([e.e(0),e.e(5)]).then(e.bind(null,41))},nglmoleculeViewer:function(){return Promise.all([e.e(0),e.e(7)]).then(e.bind(null,42))},needlePlot:function(){return Promise.all([e.e(0),e.e(6)]).then(e.bind(null,45))},oncoPrint:function(){return Promise.all([e.e(0),e.e(8)]).then(e.bind(null,43))},sequenceViewer:function(){return Promise.all([e.e(0),e.e(9)]).then(e.bind(null,44))},speck:function(){return e.e(10).then(e.bind(null,46))}}},function(t,n,e){"use strict";e.d(n,"a",(function(){return o}));var r=e(4);function o(t){return function n(e){return 0===arguments.length||Object(r.a)(e)?n:t.apply(this,arguments)}}},function(t,n,e){"use strict";function r(t){return null!=t&&"object"==typeof t&&!0===t["@@functional/placeholder"]}e.d(n,"a",(function(){return r}))},function(t,n,e){"use strict";function r(t,n){return Object.prototype.hasOwnProperty.call(n,t)}e.d(n,"a",(function(){return r}))},function(t,n){t.exports={},t.exports[0]=t.exports.Xx={symbol:"Xx",name:"unknown",mass:1,radius:1,color:[1,.078,.576],number:0},t.exports[1]=t.exports.H={symbol:"H",name:"hydrogen",mass:1.00794,radius:.31,color:[1,1,1],number:1},t.exports[2]=t.exports.He={symbol:"He",name:"helium",mass:4.002602,radius:.28,color:[.851,1,1],number:2},t.exports[3]=t.exports.Li={symbol:"Li",name:"lithium",mass:6.941,radius:1.28,color:[.8,.502,1],number:3},t.exports[4]=t.exports.Be={symbol:"Be",name:"beryllium",mass:9.012182,radius:.96,color:[.761,1,0],number:4},t.exports[5]=t.exports.B={symbol:"B",name:"boron",mass:10.811,radius:.84,color:[1,.71,.71],number:5},t.exports[6]=t.exports.C={symbol:"C",name:"carbon",mass:12.0107,radius:.73,color:[.565,.565,.565],number:6},t.exports[7]=t.exports.N={symbol:"N",name:"nitrogen",mass:14.0067,radius:.71,color:[.188,.314,.973],number:7},t.exports[8]=t.exports.O={symbol:"O",name:"oxygen",mass:15.9994,radius:.66,color:[1,.051,.051],number:8},t.exports[9]=t.exports.F={symbol:"F",name:"fluorine",mass:18.9984032,radius:.57,color:[.565,.878,.314],number:9},t.exports[10]=t.exports.Ne={symbol:"Ne",name:"neon",mass:20.1797,radius:.58,color:[.702,.89,.961],number:10},t.exports[11]=t.exports.Na={symbol:"Na",name:"sodium",mass:22.98976928,radius:1.66,color:[.671,.361,.949],number:11},t.exports[12]=t.exports.Mg={symbol:"Mg",name:"magnesium",mass:24.305,radius:1.41,color:[.541,1,0],number:12},t.exports[13]=t.exports.Al={symbol:"Al",name:"aluminum",mass:26.9815386,radius:1.21,color:[.749,.651,.651],number:13},t.exports[14]=t.exports.Si={symbol:"Si",name:"silicon",mass:28.0855,radius:1.11,color:[.941,.784,.627],number:14},t.exports[15]=t.exports.P={symbol:"P",name:"phosphorus",mass:30.973762,radius:1.07,color:[1,.502,0],number:15},t.exports[16]=t.exports.S={symbol:"S",name:"sulfur",mass:32.065,radius:1.05,color:[1,1,.188],number:16},t.exports[17]=t.exports.Cl={symbol:"Cl",name:"chlorine",mass:35.453,radius:1.02,color:[.122,.941,.122],number:17},t.exports[18]=t.exports.Ar={symbol:"Ar",name:"argon",mass:39.948,radius:1.06,color:[.502,.82,.89],number:18},t.exports[19]=t.exports.K={symbol:"K",name:"potassium",mass:39.0983,radius:2.03,color:[.561,.251,.831],number:19},t.exports[20]=t.exports.Ca={symbol:"Ca",name:"calcium",mass:40.078,radius:1.76,color:[.239,1,0],number:20},t.exports[21]=t.exports.Sc={symbol:"Sc",name:"scandium",mass:44.955912,radius:1.7,color:[.902,.902,.902],number:21},t.exports[22]=t.exports.Ti={symbol:"Ti",name:"titanium",mass:47.867,radius:1.6,color:[.749,.761,.78],number:22},t.exports[23]=t.exports.V={symbol:"V",name:"vanadium",mass:50.9415,radius:1.53,color:[.651,.651,.671],number:23},t.exports[24]=t.exports.Cr={symbol:"Cr",name:"chromium",mass:51.9961,radius:1.39,color:[.541,.6,.78],number:24},t.exports[25]=t.exports.Mn={symbol:"Mn",name:"manganese",mass:54.938045,radius:1.39,color:[.611,.478,.78],number:25},t.exports[26]=t.exports.Fe={symbol:"Fe",name:"iron",mass:55.845,radius:1.32,color:[.878,.4,.2],number:26},t.exports[27]=t.exports.Co={symbol:"Co",name:"cobalt",mass:58.6934,radius:1.26,color:[.941,.565,.627],number:27},t.exports[28]=t.exports.Ni={symbol:"Ni",name:"nickel",mass:58.933195,radius:1.24,color:[.314,.816,.314],number:28},t.exports[29]=t.exports.Cu={symbol:"Cu",name:"copper",mass:63.546,radius:1.32,color:[.784,.502,.2],number:29},t.exports[30]=t.exports.Zn={symbol:"Zn",name:"zinc",mass:65.38,radius:1.22,color:[.49,.502,.69],number:30},t.exports[31]=t.exports.Ga={symbol:"Ga",name:"gallium",mass:69.723,radius:1.22,color:[.761,.561,.561],number:31},t.exports[32]=t.exports.Ge={symbol:"Ge",name:"germanium",mass:72.64,radius:1.2,color:[.4,.561,.561],number:32},t.exports[33]=t.exports.As={symbol:"As",name:"arsenic",mass:74.9216,radius:1.19,color:[.741,.502,.89],number:33},t.exports[34]=t.exports.Se={symbol:"Se",name:"selenium",mass:78.96,radius:1.2,color:[1,.631,0],number:34},t.exports[35]=t.exports.Br={symbol:"Br",name:"bromine",mass:79.904,radius:1.2,color:[.651,.161,.161],number:35},t.exports[36]=t.exports.Kr={symbol:"Kr",name:"krypton",mass:83.798,radius:1.16,color:[.361,.722,.82],number:36},t.exports[37]=t.exports.Rb={symbol:"Rb",name:"rubidium",mass:85.4678,radius:2.2,color:[.439,.18,.69],number:37},t.exports[38]=t.exports.Sr={symbol:"Sr",name:"strontium",mass:87.62,radius:1.95,color:[0,1,0],number:38},t.exports[39]=t.exports.Y={symbol:"Y",name:"yttrium",mass:88.90585,radius:1.9,color:[.58,1,1],number:39},t.exports[40]=t.exports.Zr={symbol:"Zr",name:"zirconium",mass:91.224,radius:1.75,color:[.58,.878,.878],number:40},t.exports[41]=t.exports.Nb={symbol:"Nb",name:"niobium",mass:92.90638,radius:1.64,color:[.451,.761,.788],number:41},t.exports[42]=t.exports.Mo={symbol:"Mo",name:"molybdenum",mass:95.96,radius:1.54,color:[.329,.71,.71],number:42},t.exports[43]=t.exports.Tc={symbol:"Tc",name:"technetium",mass:98,radius:1.47,color:[.231,.62,.62],number:43},t.exports[44]=t.exports.Ru={symbol:"Ru",name:"ruthenium",mass:101.07,radius:1.46,color:[.141,.561,.561],number:44},t.exports[45]=t.exports.Rh={symbol:"Rh",name:"rhodium",mass:102.9055,radius:1.42,color:[.039,.49,.549],number:45},t.exports[46]=t.exports.Pd={symbol:"Pd",name:"palladium",mass:106.42,radius:1.39,color:[0,.412,.522],number:46},t.exports[47]=t.exports.Ag={symbol:"Ag",name:"silver",mass:107.8682,radius:1.45,color:[.753,.753,.753],number:47},t.exports[48]=t.exports.Cd={symbol:"Cd",name:"cadmium",mass:112.411,radius:1.44,color:[1,.851,.561],number:48},t.exports[49]=t.exports.In={symbol:"In",name:"indium",mass:114.818,radius:1.42,color:[.651,.459,.451],number:49},t.exports[50]=t.exports.Sn={symbol:"Sn",name:"tin",mass:118.71,radius:1.39,color:[.4,.502,.502],number:50},t.exports[51]=t.exports.Sb={symbol:"Sb",name:"antimony",mass:121.76,radius:1.39,color:[.62,.388,.71],number:51},t.exports[52]=t.exports.Te={symbol:"Te",name:"tellurium",mass:127.6,radius:1.38,color:[.831,.478,0],number:52},t.exports[53]=t.exports.I={symbol:"I",name:"iodine",mass:126.9047,radius:1.39,color:[.58,0,.58],number:53},t.exports[54]=t.exports.Xe={symbol:"Xe",name:"xenon",mass:131.293,radius:1.4,color:[.259,.62,.69],number:54},t.exports[55]=t.exports.Cs={symbol:"Cs",name:"cesium",mass:132.9054519,radius:2.44,color:[.341,.09,.561],number:55},t.exports[56]=t.exports.Ba={symbol:"Ba",name:"barium",mass:137.327,radius:2.15,color:[0,.788,0],number:56},t.exports[57]=t.exports.La={symbol:"La",name:"lanthanum",mass:138.90547,radius:2.07,color:[.439,.831,1],number:57},t.exports[58]=t.exports.Ce={symbol:"Ce",name:"cerium",mass:140.116,radius:2.04,color:[1,1,.78],number:58},t.exports[59]=t.exports.Pr={symbol:"Pr",name:"praseodymium",mass:140.90765,radius:2.03,color:[.851,1,.78],number:59},t.exports[60]=t.exports.Nd={symbol:"Nd",name:"neodymium",mass:144.242,radius:2.01,color:[.78,1,.78],number:60},t.exports[61]=t.exports.Pm={symbol:"Pm",name:"promethium",mass:145,radius:1.99,color:[.639,1,.78],number:61},t.exports[62]=t.exports.Sm={symbol:"Sm",name:"samarium",mass:150.36,radius:1.98,color:[.561,1,.78],number:62},t.exports[63]=t.exports.Eu={symbol:"Eu",name:"europium",mass:151.964,radius:1.98,color:[.38,1,.78],number:63},t.exports[64]=t.exports.Gd={symbol:"Gd",name:"gadolinium",mass:157.25,radius:1.96,color:[.271,1,.78],number:64},t.exports[65]=t.exports.Tb={symbol:"Tb",name:"terbium",mass:158.92535,radius:1.94,color:[.189,1,.78],number:65},t.exports[66]=t.exports.Dy={symbol:"Dy",name:"dysprosium",mass:162.5,radius:1.92,color:[.122,1,.78],number:66},t.exports[67]=t.exports.Ho={symbol:"Ho",name:"holmium",mass:164.93032,radius:1.92,color:[0,1,.612],number:67},t.exports[68]=t.exports.Er={symbol:"Er",name:"erbium",mass:167.259,radius:1.89,color:[0,.902,.459],number:68},t.exports[69]=t.exports.Tm={symbol:"Tm",name:"thulium",mass:168.93421,radius:1.9,color:[0,.831,.322],number:69},t.exports[70]=t.exports.Yb={symbol:"Yb",name:"ytterbium",mass:173.054,radius:1.87,color:[0,.749,.22],number:70},t.exports[71]=t.exports.Lu={symbol:"Lu",name:"lutetium",mass:174.9668,radius:1.87,color:[0,.671,.141],number:71},t.exports[72]=t.exports.Hf={symbol:"Hf",name:"hafnium",mass:178.49,radius:1.75,color:[.302,.761,1],number:72},t.exports[73]=t.exports.Ta={symbol:"Ta",name:"tantalum",mass:180.94788,radius:1.7,color:[.302,.651,1],number:73},t.exports[74]=t.exports.W={symbol:"W",name:"tungsten",mass:183.84,radius:1.62,color:[.129,.58,.839],number:74},t.exports[75]=t.exports.Re={symbol:"Re",name:"rhenium",mass:186.207,radius:1.51,color:[.149,.49,.671],number:75},t.exports[76]=t.exports.Os={symbol:"Os",name:"osmium",mass:190.23,radius:1.44,color:[.149,.4,.588],number:76},t.exports[77]=t.exports.Ir={symbol:"Ir",name:"iridium",mass:192.217,radius:1.41,color:[.09,.329,.529],number:77},t.exports[78]=t.exports.Pt={symbol:"Pt",name:"platinum",mass:195.084,radius:1.36,color:[.816,.816,.878],number:78},t.exports[79]=t.exports.Au={symbol:"Au",name:"gold",mass:196.966569,radius:1.36,color:[1,.82,.137],number:79},t.exports[80]=t.exports.Hg={symbol:"Hg",name:"mercury",mass:200.59,radius:1.32,color:[.722,.722,.816],number:80},t.exports[81]=t.exports.Tl={symbol:"Tl",name:"thallium",mass:204.3833,radius:1.45,color:[.651,.329,.302],number:81},t.exports[82]=t.exports.Pb={symbol:"Pb",name:"lead",mass:207.2,radius:1.46,color:[.341,.349,.38],number:82},t.exports[83]=t.exports.Bi={symbol:"Bi",name:"bismuth",mass:208.9804,radius:1.48,color:[.62,.31,.71],number:83},t.exports[84]=t.exports.Po={symbol:"Po",name:"polonium",mass:210,radius:1.4,color:[.671,.361,0],number:84},t.exports[85]=t.exports.At={symbol:"At",name:"astatine",mass:210,radius:1.5,color:[.459,.31,.271],number:85},t.exports[86]=t.exports.Rn={symbol:"Rn",name:"radon",mass:220,radius:1.5,color:[.259,.51,.588],number:86},t.exports[87]=t.exports.Fr={symbol:"Fr",name:"francium",mass:223,radius:2.6,color:[.259,0,.4],number:87},t.exports[88]=t.exports.Ra={symbol:"Ra",name:"radium",mass:226,radius:2.21,color:[0,.49,0],number:88},t.exports[89]=t.exports.Ac={symbol:"Ac",name:"actinium",mass:227,radius:2.15,color:[.439,.671,.98],number:89},t.exports[90]=t.exports.Th={symbol:"Th",name:"thorium",mass:231.03588,radius:2.06,color:[0,.729,1],number:90},t.exports[91]=t.exports.Pa={symbol:"Pa",name:"protactinium",mass:232.03806,radius:2,color:[0,.631,1],number:91},t.exports[92]=t.exports.U={symbol:"U",name:"uranium",mass:237,radius:1.96,color:[0,.561,1],number:92},t.exports[93]=t.exports.Np={symbol:"Np",name:"neptunium",mass:238.02891,radius:1.9,color:[0,.502,1],number:93},t.exports[94]=t.exports.Pu={symbol:"Pu",name:"plutonium",mass:243,radius:1.87,color:[0,.42,1],number:94},t.exports[95]=t.exports.Am={symbol:"Am",name:"americium",mass:244,radius:1.8,color:[.329,.361,.949],number:95},t.exports[96]=t.exports.Cm={symbol:"Cm",name:"curium",mass:247,radius:1.69,color:[.471,.361,.89],number:96},t.exports[97]=t.exports.Bk={symbol:"Bk",name:"berkelium",mass:247,radius:1.66,color:[.541,.31,.89],number:97},t.exports[98]=t.exports.Cf={symbol:"Cf",name:"californium",mass:251,radius:1.68,color:[.631,.212,.831],number:98},t.exports[99]=t.exports.Es={symbol:"Es",name:"einsteinium",mass:252,radius:1.65,color:[.702,.122,.831],number:99},t.exports[100]=t.exports.Fm={symbol:"Fm",name:"fermium",mass:257,radius:1.67,color:[.702,.122,.729],number:100},t.exports[101]=t.exports.Md={symbol:"Md",name:"mendelevium",mass:258,radius:1.73,color:[.702,.051,.651],number:101},t.exports[102]=t.exports.No={symbol:"No",name:"nobelium",mass:259,radius:1.76,color:[.741,.051,.529],number:102},t.exports[103]=t.exports.Lr={symbol:"Lr",name:"lawrencium",mass:262,radius:1.61,color:[.78,0,.4],number:103},t.exports[104]=t.exports.Rf={symbol:"Rf",name:"rutherfordium",mass:261,radius:1.57,color:[.8,0,.349],number:104},t.exports[105]=t.exports.Db={symbol:"Db",name:"dubnium",mass:262,radius:1.49,color:[.82,0,.31],number:105},t.exports[106]=t.exports.Sg={symbol:"Sg",name:"seaborgium",mass:266,radius:1.43,color:[.851,0,.271],number:106},t.exports[107]=t.exports.Bh={symbol:"Bh",name:"bohrium",mass:264,radius:1.41,color:[.878,0,.22],number:107},t.exports[108]=t.exports.Hs={symbol:"Hs",name:"hassium",mass:277,radius:1.34,color:[.902,0,.18],number:108},t.exports[109]=t.exports.Mt={symbol:"Mt",name:"meitnerium",mass:268,radius:1.29,color:[.922,0,.149],number:109},t.exports[110]=t.exports.Ds={symbol:"Ds",name:"Ds",mass:271,radius:1.28,color:[.922,0,.149],number:110},t.exports[111]=t.exports.Uuu={symbol:"Uuu",name:"Uuu",mass:272,radius:1.21,color:[.922,0,.149],number:111},t.exports[112]=t.exports.Uub={symbol:"Uub",name:"Uub",mass:285,radius:1.22,color:[.922,0,.149],number:112},t.exports[113]=t.exports.Uut={symbol:"Uut",name:"Uut",mass:284,radius:1.36,color:[.922,0,.149],number:113},t.exports[114]=t.exports.Uuq={symbol:"Uuq",name:"Uuq",mass:289,radius:1.43,color:[.922,0,.149],number:114},t.exports[115]=t.exports.Uup={symbol:"Uup",name:"Uup",mass:288,radius:1.62,color:[.922,0,.149],number:115},t.exports[116]=t.exports.Uuh={symbol:"Uuh",name:"Uuh",mass:292,radius:1.75,color:[.922,0,.149],number:116},t.exports[117]=t.exports.Uus={symbol:"Uus",name:"Uus",mass:294,radius:1.65,color:[.922,0,.149],number:117},t.exports[118]=t.exports.Uuo={symbol:"Uuo",name:"Uuo",mass:296,radius:1.57,color:[.922,0,.149],number:118}},function(t,n,e){!function(t){"use strict";var e={};e.exports=n,function(t){if(!n)var n=1e-6;if(!e)var e="undefined"!=typeof Float32Array?Float32Array:Array;if(!r)var r=Math.random;var o={setMatrixArrayType:function(t){e=t}};void 0!==t&&(t.glMatrix=o);var a=Math.PI/180;o.toRadian=function(t){return t*a};var i,u={};u.create=function(){var t=new e(2);return t[0]=0,t[1]=0,t},u.clone=function(t){var n=new e(2);return n[0]=t[0],n[1]=t[1],n},u.fromValues=function(t,n){var r=new e(2);return r[0]=t,r[1]=n,r},u.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t},u.set=function(t,n,e){return t[0]=n,t[1]=e,t},u.add=function(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t},u.subtract=function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t},u.sub=u.subtract,u.multiply=function(t,n,e){return t[0]=n[0]*e[0],t[1]=n[1]*e[1],t},u.mul=u.multiply,u.divide=function(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t},u.div=u.divide,u.min=function(t,n,e){return t[0]=Math.min(n[0],e[0]),t[1]=Math.min(n[1],e[1]),t},u.max=function(t,n,e){return t[0]=Math.max(n[0],e[0]),t[1]=Math.max(n[1],e[1]),t},u.scale=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t},u.scaleAndAdd=function(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t},u.distance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1];return Math.sqrt(e*e+r*r)},u.dist=u.distance,u.squaredDistance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1];return e*e+r*r},u.sqrDist=u.squaredDistance,u.length=function(t){var n=t[0],e=t[1];return Math.sqrt(n*n+e*e)},u.len=u.length,u.squaredLength=function(t){var n=t[0],e=t[1];return n*n+e*e},u.sqrLen=u.squaredLength,u.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t},u.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t},u.normalize=function(t,n){var e=n[0],r=n[1],o=e*e+r*r;return o>0&&(o=1/Math.sqrt(o),t[0]=n[0]*o,t[1]=n[1]*o),t},u.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]},u.cross=function(t,n,e){var r=n[0]*e[1]-n[1]*e[0];return t[0]=t[1]=0,t[2]=r,t},u.lerp=function(t,n,e,r){var o=n[0],a=n[1];return t[0]=o+r*(e[0]-o),t[1]=a+r*(e[1]-a),t},u.random=function(t,n){n=n||1;var e=2*r()*Math.PI;return t[0]=Math.cos(e)*n,t[1]=Math.sin(e)*n,t},u.transformMat2=function(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[2]*o,t[1]=e[1]*r+e[3]*o,t},u.transformMat2d=function(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[2]*o+e[4],t[1]=e[1]*r+e[3]*o+e[5],t},u.transformMat3=function(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[3]*o+e[6],t[1]=e[1]*r+e[4]*o+e[7],t},u.transformMat4=function(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[4]*o+e[12],t[1]=e[1]*r+e[5]*o+e[13],t},u.forEach=(i=u.create(),function(t,n,e,r,o,a){var u,s;for(n||(n=2),e||(e=0),s=r?Math.min(r*n+e,t.length):t.length,u=e;u<s;u+=n)i[0]=t[u],i[1]=t[u+1],o(i,i,a),t[u]=i[0],t[u+1]=i[1];return t}),u.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},void 0!==t&&(t.vec2=u);var s={create:function(){var t=new e(3);return t[0]=0,t[1]=0,t[2]=0,t},clone:function(t){var n=new e(3);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n},fromValues:function(t,n,r){var o=new e(3);return o[0]=t,o[1]=n,o[2]=r,o},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t},set:function(t,n,e,r){return t[0]=n,t[1]=e,t[2]=r,t},add:function(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t},subtract:function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t}};s.sub=s.subtract,s.multiply=function(t,n,e){return t[0]=n[0]*e[0],t[1]=n[1]*e[1],t[2]=n[2]*e[2],t},s.mul=s.multiply,s.divide=function(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t},s.div=s.divide,s.min=function(t,n,e){return t[0]=Math.min(n[0],e[0]),t[1]=Math.min(n[1],e[1]),t[2]=Math.min(n[2],e[2]),t},s.max=function(t,n,e){return t[0]=Math.max(n[0],e[0]),t[1]=Math.max(n[1],e[1]),t[2]=Math.max(n[2],e[2]),t},s.scale=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t},s.scaleAndAdd=function(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t[2]=n[2]+e[2]*r,t},s.distance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2];return Math.sqrt(e*e+r*r+o*o)},s.dist=s.distance,s.squaredDistance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2];return e*e+r*r+o*o},s.sqrDist=s.squaredDistance,s.length=function(t){var n=t[0],e=t[1],r=t[2];return Math.sqrt(n*n+e*e+r*r)},s.len=s.length,s.squaredLength=function(t){var n=t[0],e=t[1],r=t[2];return n*n+e*e+r*r},s.sqrLen=s.squaredLength,s.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t},s.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t},s.normalize=function(t,n){var e=n[0],r=n[1],o=n[2],a=e*e+r*r+o*o;return a>0&&(a=1/Math.sqrt(a),t[0]=n[0]*a,t[1]=n[1]*a,t[2]=n[2]*a),t},s.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]},s.cross=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=e[0],u=e[1],s=e[2];return t[0]=o*s-a*u,t[1]=a*i-r*s,t[2]=r*u-o*i,t},s.lerp=function(t,n,e,r){var o=n[0],a=n[1],i=n[2];return t[0]=o+r*(e[0]-o),t[1]=a+r*(e[1]-a),t[2]=i+r*(e[2]-i),t},s.random=function(t,n){n=n||1;var e=2*r()*Math.PI,o=2*r()-1,a=Math.sqrt(1-o*o)*n;return t[0]=Math.cos(e)*a,t[1]=Math.sin(e)*a,t[2]=o*n,t},s.transformMat4=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=e[3]*r+e[7]*o+e[11]*a+e[15];return i=i||1,t[0]=(e[0]*r+e[4]*o+e[8]*a+e[12])/i,t[1]=(e[1]*r+e[5]*o+e[9]*a+e[13])/i,t[2]=(e[2]*r+e[6]*o+e[10]*a+e[14])/i,t},s.transformMat3=function(t,n,e){var r=n[0],o=n[1],a=n[2];return t[0]=r*e[0]+o*e[3]+a*e[6],t[1]=r*e[1]+o*e[4]+a*e[7],t[2]=r*e[2]+o*e[5]+a*e[8],t},s.transformQuat=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=e[0],u=e[1],s=e[2],l=e[3],c=l*r+u*a-s*o,f=l*o+s*r-i*a,h=l*a+i*o-u*r,p=-i*r-u*o-s*a;return t[0]=c*l+p*-i+f*-s-h*-u,t[1]=f*l+p*-u+h*-i-c*-s,t[2]=h*l+p*-s+c*-u-f*-i,t},s.rotateX=function(t,n,e,r){var o=[],a=[];return o[0]=n[0]-e[0],o[1]=n[1]-e[1],o[2]=n[2]-e[2],a[0]=o[0],a[1]=o[1]*Math.cos(r)-o[2]*Math.sin(r),a[2]=o[1]*Math.sin(r)+o[2]*Math.cos(r),t[0]=a[0]+e[0],t[1]=a[1]+e[1],t[2]=a[2]+e[2],t},s.rotateY=function(t,n,e,r){var o=[],a=[];return o[0]=n[0]-e[0],o[1]=n[1]-e[1],o[2]=n[2]-e[2],a[0]=o[2]*Math.sin(r)+o[0]*Math.cos(r),a[1]=o[1],a[2]=o[2]*Math.cos(r)-o[0]*Math.sin(r),t[0]=a[0]+e[0],t[1]=a[1]+e[1],t[2]=a[2]+e[2],t},s.rotateZ=function(t,n,e,r){var o=[],a=[];return o[0]=n[0]-e[0],o[1]=n[1]-e[1],o[2]=n[2]-e[2],a[0]=o[0]*Math.cos(r)-o[1]*Math.sin(r),a[1]=o[0]*Math.sin(r)+o[1]*Math.cos(r),a[2]=o[2],t[0]=a[0]+e[0],t[1]=a[1]+e[1],t[2]=a[2]+e[2],t},s.forEach=function(){var t=s.create();return function(n,e,r,o,a,i){var u,s;for(e||(e=3),r||(r=0),s=o?Math.min(o*e+r,n.length):n.length,u=r;u<s;u+=e)t[0]=n[u],t[1]=n[u+1],t[2]=n[u+2],a(t,t,i),n[u]=t[0],n[u+1]=t[1],n[u+2]=t[2];return n}}(),s.angle=function(t,n){var e=s.fromValues(t[0],t[1],t[2]),r=s.fromValues(n[0],n[1],n[2]);s.normalize(e,e),s.normalize(r,r);var o=s.dot(e,r);return o>1?0:Math.acos(o)},s.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},void 0!==t&&(t.vec3=s);var l={create:function(){var t=new e(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},clone:function(t){var n=new e(4);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n},fromValues:function(t,n,r,o){var a=new e(4);return a[0]=t,a[1]=n,a[2]=r,a[3]=o,a},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t},set:function(t,n,e,r,o){return t[0]=n,t[1]=e,t[2]=r,t[3]=o,t},add:function(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t[3]=n[3]+e[3],t},subtract:function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t[3]=n[3]-e[3],t}};l.sub=l.subtract,l.multiply=function(t,n,e){return t[0]=n[0]*e[0],t[1]=n[1]*e[1],t[2]=n[2]*e[2],t[3]=n[3]*e[3],t},l.mul=l.multiply,l.divide=function(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t[3]=n[3]/e[3],t},l.div=l.divide,l.min=function(t,n,e){return t[0]=Math.min(n[0],e[0]),t[1]=Math.min(n[1],e[1]),t[2]=Math.min(n[2],e[2]),t[3]=Math.min(n[3],e[3]),t},l.max=function(t,n,e){return t[0]=Math.max(n[0],e[0]),t[1]=Math.max(n[1],e[1]),t[2]=Math.max(n[2],e[2]),t[3]=Math.max(n[3],e[3]),t},l.scale=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t},l.scaleAndAdd=function(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t[2]=n[2]+e[2]*r,t[3]=n[3]+e[3]*r,t},l.distance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2],a=n[3]-t[3];return Math.sqrt(e*e+r*r+o*o+a*a)},l.dist=l.distance,l.squaredDistance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2],a=n[3]-t[3];return e*e+r*r+o*o+a*a},l.sqrDist=l.squaredDistance,l.length=function(t){var n=t[0],e=t[1],r=t[2],o=t[3];return Math.sqrt(n*n+e*e+r*r+o*o)},l.len=l.length,l.squaredLength=function(t){var n=t[0],e=t[1],r=t[2],o=t[3];return n*n+e*e+r*r+o*o},l.sqrLen=l.squaredLength,l.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=-n[3],t},l.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t[3]=1/n[3],t},l.normalize=function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e*e+r*r+o*o+a*a;return i>0&&(i=1/Math.sqrt(i),t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=n[3]*i),t},l.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]*n[3]},l.lerp=function(t,n,e,r){var o=n[0],a=n[1],i=n[2],u=n[3];return t[0]=o+r*(e[0]-o),t[1]=a+r*(e[1]-a),t[2]=i+r*(e[2]-i),t[3]=u+r*(e[3]-u),t},l.random=function(t,n){return n=n||1,t[0]=r(),t[1]=r(),t[2]=r(),t[3]=r(),l.normalize(t,t),l.scale(t,t,n),t},l.transformMat4=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3];return t[0]=e[0]*r+e[4]*o+e[8]*a+e[12]*i,t[1]=e[1]*r+e[5]*o+e[9]*a+e[13]*i,t[2]=e[2]*r+e[6]*o+e[10]*a+e[14]*i,t[3]=e[3]*r+e[7]*o+e[11]*a+e[15]*i,t},l.transformQuat=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=e[0],u=e[1],s=e[2],l=e[3],c=l*r+u*a-s*o,f=l*o+s*r-i*a,h=l*a+i*o-u*r,p=-i*r-u*o-s*a;return t[0]=c*l+p*-i+f*-s-h*-u,t[1]=f*l+p*-u+h*-i-c*-s,t[2]=h*l+p*-s+c*-u-f*-i,t},l.forEach=function(){var t=l.create();return function(n,e,r,o,a,i){var u,s;for(e||(e=4),r||(r=0),s=o?Math.min(o*e+r,n.length):n.length,u=r;u<s;u+=e)t[0]=n[u],t[1]=n[u+1],t[2]=n[u+2],t[3]=n[u+3],a(t,t,i),n[u]=t[0],n[u+1]=t[1],n[u+2]=t[2],n[u+3]=t[3];return n}}(),l.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},void 0!==t&&(t.vec4=l);var c={create:function(){var t=new e(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},clone:function(t){var n=new e(4);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},transpose:function(t,n){if(t===n){var e=n[1];t[1]=n[2],t[2]=e}else t[0]=n[0],t[1]=n[2],t[2]=n[1],t[3]=n[3];return t},invert:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e*a-o*r;return i?(i=1/i,t[0]=a*i,t[1]=-r*i,t[2]=-o*i,t[3]=e*i,t):null},adjoint:function(t,n){var e=n[0];return t[0]=n[3],t[1]=-n[1],t[2]=-n[2],t[3]=e,t},determinant:function(t){return t[0]*t[3]-t[2]*t[1]},multiply:function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=e[0],s=e[1],l=e[2],c=e[3];return t[0]=r*u+a*s,t[1]=o*u+i*s,t[2]=r*l+a*c,t[3]=o*l+i*c,t}};c.mul=c.multiply,c.rotate=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=Math.sin(e),s=Math.cos(e);return t[0]=r*s+a*u,t[1]=o*s+i*u,t[2]=r*-u+a*s,t[3]=o*-u+i*s,t},c.scale=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=e[0],s=e[1];return t[0]=r*u,t[1]=o*u,t[2]=a*s,t[3]=i*s,t},c.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},c.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2))},c.LDU=function(t,n,e,r){return t[2]=r[2]/r[0],e[0]=r[0],e[1]=r[1],e[3]=r[3]-t[2]*e[1],[t,n,e]},void 0!==t&&(t.mat2=c);var f={create:function(){var t=new e(6);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},clone:function(t){var n=new e(6);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},invert:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=e*a-r*o;return s?(s=1/s,t[0]=a*s,t[1]=-r*s,t[2]=-o*s,t[3]=e*s,t[4]=(o*u-a*i)*s,t[5]=(r*i-e*u)*s,t):null},determinant:function(t){return t[0]*t[3]-t[1]*t[2]},multiply:function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=e[0],c=e[1],f=e[2],h=e[3],p=e[4],d=e[5];return t[0]=r*l+a*c,t[1]=o*l+i*c,t[2]=r*f+a*h,t[3]=o*f+i*h,t[4]=r*p+a*d+u,t[5]=o*p+i*d+s,t}};f.mul=f.multiply,f.rotate=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=Math.sin(e),c=Math.cos(e);return t[0]=r*c+a*l,t[1]=o*c+i*l,t[2]=r*-l+a*c,t[3]=o*-l+i*c,t[4]=u,t[5]=s,t},f.scale=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=e[0],c=e[1];return t[0]=r*l,t[1]=o*l,t[2]=a*c,t[3]=i*c,t[4]=u,t[5]=s,t},f.translate=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=e[0],c=e[1];return t[0]=r,t[1]=o,t[2]=a,t[3]=i,t[4]=r*l+a*c+u,t[5]=o*l+i*c+s,t},f.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},f.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+1)},void 0!==t&&(t.mat2d=f);var h={create:function(){var t=new e(9);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},fromMat4:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[4],t[4]=n[5],t[5]=n[6],t[6]=n[8],t[7]=n[9],t[8]=n[10],t},clone:function(t){var n=new e(9);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},transpose:function(t,n){if(t===n){var e=n[1],r=n[2],o=n[5];t[1]=n[3],t[2]=n[6],t[3]=e,t[5]=n[7],t[6]=r,t[7]=o}else t[0]=n[0],t[1]=n[3],t[2]=n[6],t[3]=n[1],t[4]=n[4],t[5]=n[7],t[6]=n[2],t[7]=n[5],t[8]=n[8];return t},invert:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=n[6],l=n[7],c=n[8],f=c*i-u*l,h=-c*a+u*s,p=l*a-i*s,d=e*f+r*h+o*p;return d?(d=1/d,t[0]=f*d,t[1]=(-c*r+o*l)*d,t[2]=(u*r-o*i)*d,t[3]=h*d,t[4]=(c*e-o*s)*d,t[5]=(-u*e+o*a)*d,t[6]=p*d,t[7]=(-l*e+r*s)*d,t[8]=(i*e-r*a)*d,t):null},adjoint:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=n[6],l=n[7],c=n[8];return t[0]=i*c-u*l,t[1]=o*l-r*c,t[2]=r*u-o*i,t[3]=u*s-a*c,t[4]=e*c-o*s,t[5]=o*a-e*u,t[6]=a*l-i*s,t[7]=r*s-e*l,t[8]=e*i-r*a,t},determinant:function(t){var n=t[0],e=t[1],r=t[2],o=t[3],a=t[4],i=t[5],u=t[6],s=t[7],l=t[8];return n*(l*a-i*s)+e*(-l*o+i*u)+r*(s*o-a*u)},multiply:function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=n[6],c=n[7],f=n[8],h=e[0],p=e[1],d=e[2],m=e[3],g=e[4],v=e[5],y=e[6],b=e[7],x=e[8];return t[0]=h*r+p*i+d*l,t[1]=h*o+p*u+d*c,t[2]=h*a+p*s+d*f,t[3]=m*r+g*i+v*l,t[4]=m*o+g*u+v*c,t[5]=m*a+g*s+v*f,t[6]=y*r+b*i+x*l,t[7]=y*o+b*u+x*c,t[8]=y*a+b*s+x*f,t}};h.mul=h.multiply,h.translate=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=n[6],c=n[7],f=n[8],h=e[0],p=e[1];return t[0]=r,t[1]=o,t[2]=a,t[3]=i,t[4]=u,t[5]=s,t[6]=h*r+p*i+l,t[7]=h*o+p*u+c,t[8]=h*a+p*s+f,t},h.rotate=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=n[6],c=n[7],f=n[8],h=Math.sin(e),p=Math.cos(e);return t[0]=p*r+h*i,t[1]=p*o+h*u,t[2]=p*a+h*s,t[3]=p*i-h*r,t[4]=p*u-h*o,t[5]=p*s-h*a,t[6]=l,t[7]=c,t[8]=f,t},h.scale=function(t,n,e){var r=e[0],o=e[1];return t[0]=r*n[0],t[1]=r*n[1],t[2]=r*n[2],t[3]=o*n[3],t[4]=o*n[4],t[5]=o*n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t},h.fromMat2d=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=0,t[3]=n[2],t[4]=n[3],t[5]=0,t[6]=n[4],t[7]=n[5],t[8]=1,t},h.fromQuat=function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e+e,u=r+r,s=o+o,l=e*i,c=r*i,f=r*u,h=o*i,p=o*u,d=o*s,m=a*i,g=a*u,v=a*s;return t[0]=1-f-d,t[3]=c-v,t[6]=h+g,t[1]=c+v,t[4]=1-l-d,t[7]=p-m,t[2]=h-g,t[5]=p+m,t[8]=1-l-f,t},h.normalFromMat4=function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=n[6],l=n[7],c=n[8],f=n[9],h=n[10],p=n[11],d=n[12],m=n[13],g=n[14],v=n[15],y=e*u-r*i,b=e*s-o*i,x=e*l-a*i,M=r*s-o*u,w=r*l-a*u,_=o*l-a*s,k=c*m-f*d,S=c*g-h*d,A=c*v-p*d,E=f*g-h*m,T=f*v-p*m,R=h*v-p*g,N=y*R-b*T+x*E+M*A-w*S+_*k;return N?(N=1/N,t[0]=(u*R-s*T+l*E)*N,t[1]=(s*A-i*R-l*S)*N,t[2]=(i*T-u*A+l*k)*N,t[3]=(o*T-r*R-a*E)*N,t[4]=(e*R-o*A+a*S)*N,t[5]=(r*A-e*T-a*k)*N,t[6]=(m*_-g*w+v*M)*N,t[7]=(g*x-d*_-v*b)*N,t[8]=(d*w-m*x+v*y)*N,t):null},h.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},h.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2))},void 0!==t&&(t.mat3=h);var p={create:function(){var t=new e(16);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},clone:function(t){var n=new e(16);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},transpose:function(t,n){if(t===n){var e=n[1],r=n[2],o=n[3],a=n[6],i=n[7],u=n[11];t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=e,t[6]=n[9],t[7]=n[13],t[8]=r,t[9]=a,t[11]=n[14],t[12]=o,t[13]=i,t[14]=u}else t[0]=n[0],t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=n[1],t[5]=n[5],t[6]=n[9],t[7]=n[13],t[8]=n[2],t[9]=n[6],t[10]=n[10],t[11]=n[14],t[12]=n[3],t[13]=n[7],t[14]=n[11],t[15]=n[15];return t},invert:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=n[6],l=n[7],c=n[8],f=n[9],h=n[10],p=n[11],d=n[12],m=n[13],g=n[14],v=n[15],y=e*u-r*i,b=e*s-o*i,x=e*l-a*i,M=r*s-o*u,w=r*l-a*u,_=o*l-a*s,k=c*m-f*d,S=c*g-h*d,A=c*v-p*d,E=f*g-h*m,T=f*v-p*m,R=h*v-p*g,N=y*R-b*T+x*E+M*A-w*S+_*k;return N?(N=1/N,t[0]=(u*R-s*T+l*E)*N,t[1]=(o*T-r*R-a*E)*N,t[2]=(m*_-g*w+v*M)*N,t[3]=(h*w-f*_-p*M)*N,t[4]=(s*A-i*R-l*S)*N,t[5]=(e*R-o*A+a*S)*N,t[6]=(g*x-d*_-v*b)*N,t[7]=(c*_-h*x+p*b)*N,t[8]=(i*T-u*A+l*k)*N,t[9]=(r*A-e*T-a*k)*N,t[10]=(d*w-m*x+v*y)*N,t[11]=(f*x-c*w-p*y)*N,t[12]=(u*S-i*E-s*k)*N,t[13]=(e*E-r*S+o*k)*N,t[14]=(m*b-d*M-g*y)*N,t[15]=(c*M-f*b+h*y)*N,t):null},adjoint:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=n[6],l=n[7],c=n[8],f=n[9],h=n[10],p=n[11],d=n[12],m=n[13],g=n[14],v=n[15];return t[0]=u*(h*v-p*g)-f*(s*v-l*g)+m*(s*p-l*h),t[1]=-(r*(h*v-p*g)-f*(o*v-a*g)+m*(o*p-a*h)),t[2]=r*(s*v-l*g)-u*(o*v-a*g)+m*(o*l-a*s),t[3]=-(r*(s*p-l*h)-u*(o*p-a*h)+f*(o*l-a*s)),t[4]=-(i*(h*v-p*g)-c*(s*v-l*g)+d*(s*p-l*h)),t[5]=e*(h*v-p*g)-c*(o*v-a*g)+d*(o*p-a*h),t[6]=-(e*(s*v-l*g)-i*(o*v-a*g)+d*(o*l-a*s)),t[7]=e*(s*p-l*h)-i*(o*p-a*h)+c*(o*l-a*s),t[8]=i*(f*v-p*m)-c*(u*v-l*m)+d*(u*p-l*f),t[9]=-(e*(f*v-p*m)-c*(r*v-a*m)+d*(r*p-a*f)),t[10]=e*(u*v-l*m)-i*(r*v-a*m)+d*(r*l-a*u),t[11]=-(e*(u*p-l*f)-i*(r*p-a*f)+c*(r*l-a*u)),t[12]=-(i*(f*g-h*m)-c*(u*g-s*m)+d*(u*h-s*f)),t[13]=e*(f*g-h*m)-c*(r*g-o*m)+d*(r*h-o*f),t[14]=-(e*(u*g-s*m)-i*(r*g-o*m)+d*(r*s-o*u)),t[15]=e*(u*h-s*f)-i*(r*h-o*f)+c*(r*s-o*u),t},determinant:function(t){var n=t[0],e=t[1],r=t[2],o=t[3],a=t[4],i=t[5],u=t[6],s=t[7],l=t[8],c=t[9],f=t[10],h=t[11],p=t[12],d=t[13],m=t[14],g=t[15];return(n*i-e*a)*(f*g-h*m)-(n*u-r*a)*(c*g-h*d)+(n*s-o*a)*(c*m-f*d)+(e*u-r*i)*(l*g-h*p)-(e*s-o*i)*(l*m-f*p)+(r*s-o*u)*(l*d-c*p)},multiply:function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=n[6],c=n[7],f=n[8],h=n[9],p=n[10],d=n[11],m=n[12],g=n[13],v=n[14],y=n[15],b=e[0],x=e[1],M=e[2],w=e[3];return t[0]=b*r+x*u+M*f+w*m,t[1]=b*o+x*s+M*h+w*g,t[2]=b*a+x*l+M*p+w*v,t[3]=b*i+x*c+M*d+w*y,b=e[4],x=e[5],M=e[6],w=e[7],t[4]=b*r+x*u+M*f+w*m,t[5]=b*o+x*s+M*h+w*g,t[6]=b*a+x*l+M*p+w*v,t[7]=b*i+x*c+M*d+w*y,b=e[8],x=e[9],M=e[10],w=e[11],t[8]=b*r+x*u+M*f+w*m,t[9]=b*o+x*s+M*h+w*g,t[10]=b*a+x*l+M*p+w*v,t[11]=b*i+x*c+M*d+w*y,b=e[12],x=e[13],M=e[14],w=e[15],t[12]=b*r+x*u+M*f+w*m,t[13]=b*o+x*s+M*h+w*g,t[14]=b*a+x*l+M*p+w*v,t[15]=b*i+x*c+M*d+w*y,t}};p.mul=p.multiply,p.translate=function(t,n,e){var r,o,a,i,u,s,l,c,f,h,p,d,m=e[0],g=e[1],v=e[2];return n===t?(t[12]=n[0]*m+n[4]*g+n[8]*v+n[12],t[13]=n[1]*m+n[5]*g+n[9]*v+n[13],t[14]=n[2]*m+n[6]*g+n[10]*v+n[14],t[15]=n[3]*m+n[7]*g+n[11]*v+n[15]):(r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=n[6],c=n[7],f=n[8],h=n[9],p=n[10],d=n[11],t[0]=r,t[1]=o,t[2]=a,t[3]=i,t[4]=u,t[5]=s,t[6]=l,t[7]=c,t[8]=f,t[9]=h,t[10]=p,t[11]=d,t[12]=r*m+u*g+f*v+n[12],t[13]=o*m+s*g+h*v+n[13],t[14]=a*m+l*g+p*v+n[14],t[15]=i*m+c*g+d*v+n[15]),t},p.scale=function(t,n,e){var r=e[0],o=e[1],a=e[2];return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=n[3]*r,t[4]=n[4]*o,t[5]=n[5]*o,t[6]=n[6]*o,t[7]=n[7]*o,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=n[11]*a,t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},p.rotate=function(t,e,r,o){var a,i,u,s,l,c,f,h,p,d,m,g,v,y,b,x,M,w,_,k,S,A,E,T,R=o[0],N=o[1],P=o[2],C=Math.sqrt(R*R+N*N+P*P);return Math.abs(C)<n?null:(R*=C=1/C,N*=C,P*=C,a=Math.sin(r),u=1-(i=Math.cos(r)),s=e[0],l=e[1],c=e[2],f=e[3],h=e[4],p=e[5],d=e[6],m=e[7],g=e[8],v=e[9],y=e[10],b=e[11],x=R*R*u+i,M=N*R*u+P*a,w=P*R*u-N*a,_=R*N*u-P*a,k=N*N*u+i,S=P*N*u+R*a,A=R*P*u+N*a,E=N*P*u-R*a,T=P*P*u+i,t[0]=s*x+h*M+g*w,t[1]=l*x+p*M+v*w,t[2]=c*x+d*M+y*w,t[3]=f*x+m*M+b*w,t[4]=s*_+h*k+g*S,t[5]=l*_+p*k+v*S,t[6]=c*_+d*k+y*S,t[7]=f*_+m*k+b*S,t[8]=s*A+h*E+g*T,t[9]=l*A+p*E+v*T,t[10]=c*A+d*E+y*T,t[11]=f*A+m*E+b*T,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)},p.rotateX=function(t,n,e){var r=Math.sin(e),o=Math.cos(e),a=n[4],i=n[5],u=n[6],s=n[7],l=n[8],c=n[9],f=n[10],h=n[11];return n!==t&&(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[4]=a*o+l*r,t[5]=i*o+c*r,t[6]=u*o+f*r,t[7]=s*o+h*r,t[8]=l*o-a*r,t[9]=c*o-i*r,t[10]=f*o-u*r,t[11]=h*o-s*r,t},p.rotateY=function(t,n,e){var r=Math.sin(e),o=Math.cos(e),a=n[0],i=n[1],u=n[2],s=n[3],l=n[8],c=n[9],f=n[10],h=n[11];return n!==t&&(t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[0]=a*o-l*r,t[1]=i*o-c*r,t[2]=u*o-f*r,t[3]=s*o-h*r,t[8]=a*r+l*o,t[9]=i*r+c*o,t[10]=u*r+f*o,t[11]=s*r+h*o,t},p.rotateZ=function(t,n,e){var r=Math.sin(e),o=Math.cos(e),a=n[0],i=n[1],u=n[2],s=n[3],l=n[4],c=n[5],f=n[6],h=n[7];return n!==t&&(t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[0]=a*o+l*r,t[1]=i*o+c*r,t[2]=u*o+f*r,t[3]=s*o+h*r,t[4]=l*o-a*r,t[5]=c*o-i*r,t[6]=f*o-u*r,t[7]=h*o-s*r,t},p.fromRotationTranslation=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=r+r,s=o+o,l=a+a,c=r*u,f=r*s,h=r*l,p=o*s,d=o*l,m=a*l,g=i*u,v=i*s,y=i*l;return t[0]=1-(p+m),t[1]=f+y,t[2]=h-v,t[3]=0,t[4]=f-y,t[5]=1-(c+m),t[6]=d+g,t[7]=0,t[8]=h+v,t[9]=d-g,t[10]=1-(c+p),t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t},p.fromQuat=function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e+e,u=r+r,s=o+o,l=e*i,c=r*i,f=r*u,h=o*i,p=o*u,d=o*s,m=a*i,g=a*u,v=a*s;return t[0]=1-f-d,t[1]=c+v,t[2]=h-g,t[3]=0,t[4]=c-v,t[5]=1-l-d,t[6]=p+m,t[7]=0,t[8]=h+g,t[9]=p-m,t[10]=1-l-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},p.frustum=function(t,n,e,r,o,a,i){var u=1/(e-n),s=1/(o-r),l=1/(a-i);return t[0]=2*a*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*a*s,t[6]=0,t[7]=0,t[8]=(e+n)*u,t[9]=(o+r)*s,t[10]=(i+a)*l,t[11]=-1,t[12]=0,t[13]=0,t[14]=i*a*2*l,t[15]=0,t},p.perspective=function(t,n,e,r,o){var a=1/Math.tan(n/2),i=1/(r-o);return t[0]=a/e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(o+r)*i,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*o*r*i,t[15]=0,t},p.ortho=function(t,n,e,r,o,a,i){var u=1/(n-e),s=1/(r-o),l=1/(a-i);return t[0]=-2*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(n+e)*u,t[13]=(o+r)*s,t[14]=(i+a)*l,t[15]=1,t},p.lookAt=function(t,e,r,o){var a,i,u,s,l,c,f,h,d,m,g=e[0],v=e[1],y=e[2],b=o[0],x=o[1],M=o[2],w=r[0],_=r[1],k=r[2];return Math.abs(g-w)<n&&Math.abs(v-_)<n&&Math.abs(y-k)<n?p.identity(t):(f=g-w,h=v-_,d=y-k,a=x*(d*=m=1/Math.sqrt(f*f+h*h+d*d))-M*(h*=m),i=M*(f*=m)-b*d,u=b*h-x*f,(m=Math.sqrt(a*a+i*i+u*u))?(a*=m=1/m,i*=m,u*=m):(a=0,i=0,u=0),s=h*u-d*i,l=d*a-f*u,c=f*i-h*a,(m=Math.sqrt(s*s+l*l+c*c))?(s*=m=1/m,l*=m,c*=m):(s=0,l=0,c=0),t[0]=a,t[1]=s,t[2]=f,t[3]=0,t[4]=i,t[5]=l,t[6]=h,t[7]=0,t[8]=u,t[9]=c,t[10]=d,t[11]=0,t[12]=-(a*g+i*v+u*y),t[13]=-(s*g+l*v+c*y),t[14]=-(f*g+h*v+d*y),t[15]=1,t)},p.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},p.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2)+Math.pow(t[9],2)+Math.pow(t[10],2)+Math.pow(t[11],2)+Math.pow(t[12],2)+Math.pow(t[13],2)+Math.pow(t[14],2)+Math.pow(t[15],2))},void 0!==t&&(t.mat4=p);var d,m,g,v,y={};y.create=function(){var t=new e(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},y.rotationTo=(d=s.create(),m=s.fromValues(1,0,0),g=s.fromValues(0,1,0),function(t,n,e){var r=s.dot(n,e);return r<-.999999?(s.cross(d,m,n),s.length(d)<1e-6&&s.cross(d,g,n),s.normalize(d,d),y.setAxisAngle(t,d,Math.PI),t):r>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(s.cross(d,n,e),t[0]=d[0],t[1]=d[1],t[2]=d[2],t[3]=1+r,y.normalize(t,t))}),y.setAxes=(v=h.create(),function(t,n,e,r){return v[0]=e[0],v[3]=e[1],v[6]=e[2],v[1]=r[0],v[4]=r[1],v[7]=r[2],v[2]=-n[0],v[5]=-n[1],v[8]=-n[2],y.normalize(t,y.fromMat3(t,v))}),y.clone=l.clone,y.fromValues=l.fromValues,y.copy=l.copy,y.set=l.set,y.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},y.setAxisAngle=function(t,n,e){e*=.5;var r=Math.sin(e);return t[0]=r*n[0],t[1]=r*n[1],t[2]=r*n[2],t[3]=Math.cos(e),t},y.add=l.add,y.multiply=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=e[0],s=e[1],l=e[2],c=e[3];return t[0]=r*c+i*u+o*l-a*s,t[1]=o*c+i*s+a*u-r*l,t[2]=a*c+i*l+r*s-o*u,t[3]=i*c-r*u-o*s-a*l,t},y.mul=y.multiply,y.scale=l.scale,y.rotateX=function(t,n,e){e*=.5;var r=n[0],o=n[1],a=n[2],i=n[3],u=Math.sin(e),s=Math.cos(e);return t[0]=r*s+i*u,t[1]=o*s+a*u,t[2]=a*s-o*u,t[3]=i*s-r*u,t},y.rotateY=function(t,n,e){e*=.5;var r=n[0],o=n[1],a=n[2],i=n[3],u=Math.sin(e),s=Math.cos(e);return t[0]=r*s-a*u,t[1]=o*s+i*u,t[2]=a*s+r*u,t[3]=i*s-o*u,t},y.rotateZ=function(t,n,e){e*=.5;var r=n[0],o=n[1],a=n[2],i=n[3],u=Math.sin(e),s=Math.cos(e);return t[0]=r*s+o*u,t[1]=o*s-r*u,t[2]=a*s+i*u,t[3]=i*s-a*u,t},y.calculateW=function(t,n){var e=n[0],r=n[1],o=n[2];return t[0]=e,t[1]=r,t[2]=o,t[3]=Math.sqrt(Math.abs(1-e*e-r*r-o*o)),t},y.dot=l.dot,y.lerp=l.lerp,y.slerp=function(t,n,e,r){var o,a,i,u,s,l=n[0],c=n[1],f=n[2],h=n[3],p=e[0],d=e[1],m=e[2],g=e[3];return(a=l*p+c*d+f*m+h*g)<0&&(a=-a,p=-p,d=-d,m=-m,g=-g),1-a>1e-6?(o=Math.acos(a),i=Math.sin(o),u=Math.sin((1-r)*o)/i,s=Math.sin(r*o)/i):(u=1-r,s=r),t[0]=u*l+s*p,t[1]=u*c+s*d,t[2]=u*f+s*m,t[3]=u*h+s*g,t},y.invert=function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e*e+r*r+o*o+a*a,u=i?1/i:0;return t[0]=-e*u,t[1]=-r*u,t[2]=-o*u,t[3]=a*u,t},y.conjugate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=n[3],t},y.length=l.length,y.len=y.length,y.squaredLength=l.squaredLength,y.sqrLen=y.squaredLength,y.normalize=l.normalize,y.fromMat3=function(t,n){var e,r=n[0]+n[4]+n[8];if(r>0)e=Math.sqrt(r+1),t[3]=.5*e,e=.5/e,t[0]=(n[5]-n[7])*e,t[1]=(n[6]-n[2])*e,t[2]=(n[1]-n[3])*e;else{var o=0;n[4]>n[0]&&(o=1),n[8]>n[3*o+o]&&(o=2);var a=(o+1)%3,i=(o+2)%3;e=Math.sqrt(n[3*o+o]-n[3*a+a]-n[3*i+i]+1),t[o]=.5*e,e=.5/e,t[3]=(n[3*a+i]-n[3*i+a])*e,t[a]=(n[3*a+o]+n[3*o+a])*e,t[i]=(n[3*i+o]+n[3*o+i])*e}return t},y.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},void 0!==t&&(t.quat=y)}(e.exports)}()},function(t,n,e){"use strict";var r=e(7),o=e(6),a=e(22);function i(t,n,e){return Math.min(n,Math.max(t,e))}t.exports.new=function(){return{aspect:1,zoom:.125,translation:{x:0,y:0},atomScale:.6,relativeAtomScale:1,bondScale:.5,rotation:r.mat4.create(),ao:.75,aoRes:256,brightness:.5,outline:0,spf:32,bonds:!1,bondThreshold:1.2,bondShade:.5,atomShade:.5,resolution:768,dofStrength:0,dofPosition:.5,fxaa:1}},t.exports.center=function(t,n){for(var e=-1/0,a=1/0,i=-1/0,u=1/0,s=0;s<n.atoms.length;s++){var l=n.atoms[s],c=o[l.symbol].radius;c=2.5*t.atomScale*(1+(c-1)*t.relativeAtomScale);var f=r.vec4.fromValues(l.x,l.y,l.z,0);r.vec4.transformMat4(f,f,t.rotation),e=Math.max(e,f[0]+c),a=Math.min(a,f[0]-c),i=Math.max(i,f[1]+c),u=Math.min(u,f[1]-c)}var h=a+(e-a)/2,p=u+(i-u)/2;t.translation.x=h,t.translation.y=p;var d=Math.max(e-a,i-u);t.zoom=1/(1.01*d)},t.exports.override=function(t,n){for(var e in n)t[e]=n[e];l(t)},t.exports.clone=function(t){return s(u(t))};var u=t.exports.serialize=function(t){return JSON.stringify(t)},s=t.exports.deserialize=function(t){return(t=JSON.parse(t)).rotation=r.mat4.clone(t.rotation),t},l=t.exports.resolve=function(t){t.dofStrength=i(0,1,t.dofStrength),t.dofPosition=i(0,1,t.dofPosition),t.zoom=i(.001,2,t.zoom),t.atomScale=i(0,1,t.atomScale),t.relativeAtomScale=i(0,1,t.relativeAtomScale),t.bondScale=i(0,1,t.bondScale),t.bondShade=i(0,1,t.bondShade),t.atomShade=i(0,1,t.atomShade),t.ao=i(0,1,t.ao),t.brightness=i(0,1,t.brightness),t.outline=i(0,1,t.outline)};t.exports.translate=function(t,n,e){t.translation.x-=n/(t.resolution*t.zoom),t.translation.y+=e/(t.resolution*t.zoom),l(t)},t.exports.rotate=function(t,n,e){var o=r.mat4.create();r.mat4.rotateY(o,o,.005*n),r.mat4.rotateX(o,o,.005*e),r.mat4.multiply(t.rotation,o,t.rotation);var a=t.ao;t.ao=0,l(t),t.ao=a},t.exports.getRect=function(t){var n=1/t.zoom,e=n/t.aspect;return{bottom:-e/2+t.translation.y,top:e/2+t.translation.y,left:-n/2+t.translation.x,right:n/2+t.translation.x}},t.exports.getBondRadius=function(t){return t.bondScale*t.atomScale*(1+(a.MIN_ATOM_RADIUS-1)*t.relativeAtomScale)}},function(t,n,e){"use strict";e.d(n,"a",(function(){return a}));var r=e(3),o=e(4);function a(t){return function n(e,a){switch(arguments.length){case 0:return n;case 1:return Object(o.a)(e)?n:Object(r.a)((function(n){return t(e,n)}));default:return Object(o.a)(e)&&Object(o.a)(a)?n:Object(o.a)(e)?Object(r.a)((function(n){return t(n,a)})):Object(o.a)(a)?Object(r.a)((function(n){return t(e,n)})):t(e,a)}}}},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"c",(function(){return g})),e.d(n,"b",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.alignmentChart),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.propTypes={id:o.a.string,setProps:o.a.func,eventDatum:o.a.string,data:o.a.string,extension:o.a.string,colorscale:o.a.oneOfType([o.a.string,o.a.object]),opacity:o.a.oneOfType([o.a.number,o.a.string]),textcolor:o.a.string,textsize:o.a.oneOfType([o.a.number,o.a.string]),showlabel:o.a.bool,showid:o.a.bool,showconservation:o.a.bool,conservationcolor:o.a.string,conservationcolorscale:o.a.oneOfType([o.a.string,o.a.array]),conservationopacity:o.a.oneOfType([o.a.number,o.a.string]),conservationmethod:o.a.oneOf(["conservation","entropy"]),correctgap:o.a.bool,showgap:o.a.bool,gapcolor:o.a.string,gapcolorscale:o.a.oneOfType([o.a.string,o.a.array]),gapopacity:o.a.oneOfType([o.a.number,o.a.string]),groupbars:o.a.bool,showconsensus:o.a.bool,tilewidth:o.a.number,tileheight:o.a.number,overview:o.a.oneOf(["heatmap","slider","none"]),numtiles:o.a.number,scrollskip:o.a.number,tickstart:o.a.oneOfType([o.a.number,o.a.string]),ticksteps:o.a.oneOfType([o.a.number,o.a.string]),width:o.a.oneOfType([o.a.number,o.a.string]),height:o.a.oneOfType([o.a.number,o.a.string])},m.defaultProps={extension:"fasta",colorscale:"clustal2",opacity:null,textcolor:null,textsize:10,showlabel:!0,showid:!0,showconservation:!0,conservationcolor:null,conservationcolorscale:"Viridis",conservationopacity:null,conservationmethod:"entropy",correctgap:!0,showgap:!0,gapcolor:"grey",gapcolorscale:null,gapopacity:null,groupbars:!1,showconsensus:!0,tilewidth:16,tileheight:16,numtiles:null,overview:"heatmap",scrollskip:10,tickstart:null,ticksteps:null,width:null,height:900};var g=m.propTypes,v=m.defaultProps},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.ideogram),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.defaultProps={organism:"human",dataDir:"https://unpkg.com/ideogram@1.5.0/dist/data/bands/native/",annotationsColor:"#F00",annotationsLayout:"tracks",barWidth:3,chrHeight:400,chrMargin:10,chrWidth:10,ploidy:1,rotatable:!0,showBandLabels:!1,showChromosomeLabels:!0,showAnnotTooltip:!0,showFullyBanded:!0,showNonNuclearChromosomes:!1},m.propTypes={id:o.a.string.isRequired,style:o.a.object,setProps:o.a.func,className:o.a.string,annotationsLayout:o.a.oneOf(["tracks","histogram","overlay"]),annotations:o.a.arrayOf(o.a.shape({name:o.a.string,chr:o.a.string,start:o.a.number,stop:o.a.number})),annotationsPath:o.a.string,annotationsData:o.a.string,annotationTracks:o.a.arrayOf(o.a.object),annotationHeight:o.a.number,annotationsColor:o.a.string,histogramScaling:o.a.oneOf(["absolute","relative"]),barWidth:o.a.number,showAnnotTooltip:o.a.bool,assembly:o.a.string,brush:o.a.string,brushData:o.a.shape({start:o.a.string,end:o.a.string,extent:o.a.string}),container:o.a.string,chrHeight:o.a.number,chrMargin:o.a.number,chrWidth:o.a.number,chromosomes:o.a.oneOfType([o.a.arrayOf(o.a.string),o.a.object]),dataDir:o.a.string,organism:o.a.oneOfType([o.a.string,o.a.number]),localOrganism:o.a.object,homology:o.a.shape({chrOne:o.a.shape({organism:o.a.string.isRequired,start:o.a.arrayOf(o.a.number.isRequired),stop:o.a.arrayOf(o.a.number.isRequired)}),chrTwo:o.a.shape({organism:o.a.string.isRequired,start:o.a.arrayOf(o.a.number.isRequired),stop:o.a.arrayOf(o.a.number.isRequired)})}),perspective:o.a.oneOf(["comparative"]),fullChromosomeLabels:o.a.bool,resolution:o.a.number,filterable:o.a.bool,orientation:o.a.oneOf(["vertical","horizontal"]),ploidy:o.a.number,ploidyDesc:o.a.arrayOf(o.a.object),ancestors:o.a.object,rangeSet:o.a.arrayOf(o.a.object),rotatable:o.a.bool,rotated:o.a.bool,sex:o.a.oneOf(["male","female"]),showChromosomeLabels:o.a.bool,showBandLabels:o.a.bool,showFullyBanded:o.a.bool,showNonNuclearChromosomes:o.a.bool};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(1),o=e.n(r),a=e(2),i=e(0),u=e.n(i);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(r.lazy)(a.a.igv),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,a,i;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(a=[{key:"render",value:function(){return o.a.createElement(r.Suspense,{fallback:null},o.a.createElement(d,this.props))}}])&&c(e.prototype,a),i&&c(e,i),n}(r.Component);m.defaultProps={},m.propTypes={id:u.a.string,setProps:u.a.func,style:u.a.object,className:u.a.string,genome:u.a.string,reference:u.a.object,locus:u.a.string,minimumBases:u.a.number,tracks:u.a.array};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.molecule2dViewer),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.defaultProps={width:500,height:500,modelData:{nodes:[],links:[]}},m.propTypes={id:o.a.string,setProps:o.a.func,selectedAtomIds:o.a.arrayOf(o.a.number),width:o.a.number,height:o.a.number,modelData:o.a.shape({nodes:o.a.arrayOf(o.a.shape({id:o.a.number,atom:o.a.string})),links:o.a.arrayOf(o.a.shape({id:o.a.number,source:o.a.number|o.a.shape,target:o.a.number|o.a.shape,bond:o.a.number,strength:o.a.number,distance:o.a.number}))})};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.molecule3dViewer),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.defaultProps={selectionType:"atom",backgroundColor:"#FFFFFF",backgroundOpacity:0},m.propTypes={id:o.a.string,setProps:o.a.func,selectionType:o.a.oneOf(["atom","residue","chain"]),backgroundColor:o.a.string,backgroundOpacity:o.a.number,styles:o.a.arrayOf(o.a.shape({color:o.a.string,visualization_type:o.a.oneOf(["cartoon","sphere","stick"])})),modelData:o.a.shape({atoms:o.a.array,bonds:o.a.array}),atomLabelsShown:o.a.bool,selectedAtomIds:o.a.array,labels:o.a.array,onRenderNewData:o.a.func,onChangeSelection:o.a.func};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.needlePlot),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.propTypes={id:o.a.string,mutationData:o.a.shape({x:o.a.oneOfType([o.a.string,o.a.array]),y:o.a.oneOfType([o.a.string,o.a.array]),mutationGroups:o.a.arrayOf(o.a.string),domains:o.a.array}),xlabel:o.a.string,ylabel:o.a.string,rangeSlider:o.a.bool,needleStyle:o.a.shape({stemColor:o.a.string,stemThickness:o.a.number,stemConstHeight:o.a.bool,headSize:o.a.number,headColor:o.a.oneOfType([o.a.array,o.a.string]),headSymbol:o.a.oneOfType([o.a.array,o.a.string])}),domainStyle:o.a.shape({domainColor:o.a.array,displayMinorDomains:o.a.bool}),setProps:o.a.func},m.defaultProps={mutationData:{x:[],y:[],domains:[],mutationGroups:[]},rangeSlider:!1,needleStyle:{stemColor:"#444",stemThickness:.5,stemConstHeight:!1,headSize:5,headColor:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999","#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999","#e41a1c"],headSymbol:"circle"},domainStyle:{displayMinorDomains:!1,domainColor:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f","#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69"]}};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(1),o=e.n(r),a=e(2),i=e(0),u=e.n(i);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(r.lazy)(a.a.nglmoleculeViewer),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,a,i;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(a=[{key:"render",value:function(){return o.a.createElement(r.Suspense,{fallback:null},o.a.createElement(d,this.props))}}])&&c(e.prototype,a),i&&c(e,i),n}(r.Component);m.defaultProps={data:[{filename:"placeholder",ext:"",selectedValue:"placeholder",chain:"ALL",aaRange:"ALL",chosen:{chosenAtoms:"",chosenResidues:""},color:"red",config:{input:"",type:"text/plain"},uploaded:!1,resetView:!1}],width:"500px",height:"500px",stageParameters:{quality:"medium",backgroundColor:"white",cameraType:"perspective"},imageParameters:{antialias:!0,transparent:!0,trim:!0,defaultFilename:"dash-bio_ngl_output"},downloadImage:!1,molStyles:{representations:["cartoon","axes+box"],chosenAtomsColor:"#ffffff",chosenAtomsRadius:1,molSpacingXaxis:100,sideByside:!1}},m.propTypes={id:u.a.string,setProps:u.a.func,width:u.a.oneOfType([u.a.string,u.a.number]),height:u.a.oneOfType([u.a.string,u.a.number]),stageParameters:u.a.exact({quality:u.a.string,backgroundColor:u.a.string,cameraType:u.a.string}),imageParameters:u.a.exact({antialias:u.a.bool,transparent:u.a.bool,trim:u.a.bool,defaultFilename:u.a.string}),downloadImage:u.a.bool,pdbString:u.a.string,data:u.a.arrayOf(u.a.exact({filename:u.a.string.isRequired,ext:u.a.string,selectedValue:u.a.string.isRequired,chain:u.a.string.isRequired,aaRange:u.a.string.isRequired,color:u.a.string.isRequired,chosen:u.a.exact({residues:u.a.string.isRequired,atoms:u.a.string.isRequired}),config:u.a.exact({input:u.a.string.isRequired,type:u.a.string.isRequired}),uploaded:u.a.bool.isRequired,resetView:u.a.bool.isRequired})),molStyles:u.a.exact({representations:u.a.arrayOf(u.a.string),chosenAtomsColor:u.a.string.isRequired,chosenAtomsRadius:u.a.number.isRequired,molSpacingXaxis:u.a.number.isRequired,sideByside:u.a.bool.isRequired})};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.oncoPrint),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.propTypes={id:o.a.string,setProps:o.a.func,eventDatum:o.a.object,data:o.a.array,padding:o.a.number,colorscale:o.a.oneOfType([o.a.bool,o.a.object]),backgroundcolor:o.a.string,range:o.a.array,showlegend:o.a.bool,showoverview:o.a.bool,width:o.a.oneOfType([o.a.number,o.a.string]),height:o.a.oneOfType([o.a.number,o.a.string])},m.defaultProps={padding:.05,colorscale:null,backgroundcolor:"rgb(190, 190, 190)",range:[null,null],showlegend:!0,showoverview:!0,width:null,height:500};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.sequenceViewer),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.defaultProps={sequence:"-",showLineNumbers:!0,wrapAminoAcids:!0,charsPerLine:40,toolbar:!1,search:!0,title:"",sequenceMaxHeight:"400px",badge:!0,selection:[],coverage:[]},m.propTypes={id:o.a.string,sequence:o.a.string,showLineNumbers:o.a.bool,wrapAminoAcids:o.a.bool,charsPerLine:o.a.number,toolbar:o.a.bool,search:o.a.bool,title:o.a.string,sequenceMaxHeight:o.a.string,badge:o.a.bool,selection:function(t,n,e){if(void 0!==t[n]&&(void 0!==t[n][0]&&"number"!=typeof t[n][0]||void 0!==t[n][1]&&"number"!=typeof t[n][1]||void 0!==t[n][2]&&"string"!=typeof t[n][2]))return new Error("Invalid prop value. Selection should be an array with type [number, number, string].")},coverage:o.a.arrayOf(o.a.shape({start:o.a.number,end:o.a.number,color:o.a.string,bgcolor:o.a.string,tooltip:o.a.string,underscore:o.a.bool,onclick:o.a.func})),legend:o.a.arrayOf(o.a.shape({name:o.a.string,color:o.a.string,underscore:o.a.bool})),coverageClicked:o.a.number,mouseSelection:o.a.shape({start:o.a.number,end:o.a.number,selection:o.a.string}),subpartSelected:o.a.arrayOf(o.a.shape({start:o.a.number,end:o.a.number,sequence:o.a.string})),setProps:o.a.func};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return g})),e.d(n,"b",(function(){return v})),e.d(n,"c",(function(){return y}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2),s=e(21);function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function f(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function h(t,n){return!n||"object"!==l(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function d(t,n){return(d=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var m=Object(a.lazy)(u.a.speck),g=function(t){function n(){return c(this,n),h(this,p(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&d(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(m,this.props))}}])&&f(e.prototype,r),o&&f(e,o),n}(a.Component);g.defaultProps={view:s.speckView.new(),data:[]},g.propTypes={id:o.a.string,data:o.a.arrayOf(o.a.shape({symbol:o.a.string,x:o.a.number,y:o.a.number,z:o.a.number})),scrollZoom:o.a.bool,view:o.a.shape({aspect:o.a.number,zoom:o.a.number,translation:o.a.shape({x:o.a.number,y:o.a.number}),atomScale:o.a.number,relativeAtomScale:o.a.number,bondScale:o.a.number,rotation:o.a.shape({}),ao:o.a.number,aoRes:o.a.number,brightness:o.a.number,outline:o.a.number,spf:o.a.number,bonds:o.a.bool,bondThreshold:o.a.number,bondShade:o.a.number,atomShade:o.a.number,resolution:o.a.number,dofStrength:o.a.number,dofPosition:o.a.number,fxaa:o.a.number}),presetView:o.a.oneOf(["default","stickball","toon","licorice"]),setProps:o.a.func};var v=g.defaultProps,y=g.propTypes},function(t,n,e){"use strict";var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2),s=["CHORDS","HEATMAP","HIGHLIGHT","HISTOGRAM","LINE","SCATTER","STACK","TEXT"];function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function f(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function h(t,n){return!n||"object"!==l(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function d(t,n){return(d=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}e.d(n,"a",(function(){return g})),e.d(n,"c",(function(){return v})),e.d(n,"b",(function(){return y}));var m=Object(a.lazy)(u.a.circos),g=function(t){function n(){return c(this,n),h(this,p(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&d(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(m,this.props))}}])&&f(e.prototype,r),o&&f(e,o),n}(a.Component);g.defaultProps={config:{},size:800,tracks:[]},g.propTypes={enableDownloadSVG:o.a.bool,enableZoomPan:o.a.bool,id:o.a.string,style:o.a.object,eventDatum:o.a.object,selectEvent:o.a.object,setProps:o.a.func,layout:o.a.arrayOf(o.a.shape({len:o.a.number.isRequired,color:o.a.string.isRequired,label:o.a.string.isRequired,id:o.a.string.isRequired})).isRequired,config:o.a.object,size:o.a.number,tracks:o.a.arrayOf(o.a.shape({id:o.a.string,data:o.a.array.isRequired,config:o.a.object,type:o.a.oneOf(s),tooltipContent:o.a.oneOfType([o.a.string,o.a.shape({name:o.a.string.isRequired}),o.a.shape({source:o.a.string.isRequired,sourceID:o.a.string,target:o.a.string.isRequired,targetEnd:o.a.string.isRequired,targetID:o.a.string})]),color:o.a.oneOfType([o.a.string,o.a.shape({name:o.a.string.isRequired})])}))};var v=g.propTypes,y=g.defaultProps},function(t,n,e){var r=e(27),o=e(23),a=e(8),i=e(31),u=e(32);t.exports={speckRenderer:r,speckSystem:o,speckView:a,speckInteractions:i,speckPresetViews:u}},function(t,n,e){"use strict";for(var r=e(6),o=1/0,a=-1/0,i=0;i<=118;i++)o=Math.min(o,r[i].radius),a=Math.max(a,r[i].radius);t.exports.MIN_ATOM_RADIUS=o,t.exports.MAX_ATOM_RADIUS=a},function(t,n,e){"use strict";var r=e(7),o=e(6),a=e(22),i=(t.exports.new=function(){return{atoms:[],farAtom:void 0,bonds:[]}},t.exports.calculateBonds=function(t){var n=[],e=t.atoms.slice();e.sort((function(t,n){return t.z-n.z}));for(var i=0;i<e.length;i++)for(var u=e[i],s=i+1;s<e.length&&e[s].z<e[i].z+5*a.MAX_ATOM_RADIUS;){var l=e[s],c=r.vec3.fromValues(u.x,u.y,u.z),f=r.vec3.fromValues(l.x,l.y,l.z),h=r.vec3.distance(c,f),p=o[u.symbol],d=o[l.symbol];h<2.5*(p.radius+d.radius)&&n.push({posA:{x:u.x,y:u.y,z:u.z},posB:{x:l.x,y:l.y,z:l.z},radA:p.radius,radB:d.radius,colA:{r:p.color[0],g:p.color[1],b:p.color[2]},colB:{r:d.color[0],g:d.color[1],b:d.color[2]},cutoff:h/(p.radius+d.radius)}),s++}n.sort((function(t,n){return t.cutoff-n.cutoff})),t.bonds=n},t.exports.addAtom=function(t,n,e,r,o){t.atoms.push({symbol:n,x:e,y:r,z:o})},t.exports.getCentroid=function(t){for(var n=0,e=0,r=0,o=0;o<t.atoms.length;o++)n+=t.atoms[o].x,e+=t.atoms[o].y,r+=t.atoms[o].z;return{x:n/t.atoms.length,y:e/t.atoms.length,z:r/t.atoms.length}}),u=(t.exports.center=function(t){for(var n=i(t),e=0;e<t.atoms.length;e++){var r=t.atoms[e];r.x-=n.x,r.y-=n.y,r.z-=n.z}},t.exports.getFarAtom=function(t){if(void 0!==t.farAtom)return t.farAtom;t.farAtom=t.atoms[0];for(var n=0,e=0;e<t.atoms.length;e++){var r=t.atoms[e],a=o[r.symbol].radius,i=2.5*Math.sqrt(a*a+a*a+a*a),u=Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z)+i;u>n&&(n=u,t.farAtom=r)}return t.farAtom});t.exports.getRadius=function(t){var n=u(t),e=a.MAX_ATOM_RADIUS,r=2.5*Math.sqrt(e*e+e*e+e*e);return Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z)+r}},function(t,n,e){var o;o=function(){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}return e.m=t,e.c=n,e.p="",e(0)}([function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.rnaPlot=n.RNAGraph=void 0;var o=e(1);Object.defineProperty(n,"RNAGraph",{enumerable:!0,get:function(){return o.RNAGraph}});var a=e(3);Object.defineProperty(n,"rnaPlot",{enumerable:!0,get:function(){return a.rnaPlot}}),n.FornaContainer=function(t,n){var e=this;if(e.options={displayAllLinks:!1,labelInterval:10,applyForce:!0,chargeDistance:110,friction:.35,middleCharge:-30,otherCharge:-30,linkDistanceMultiplier:15,initialSize:null,layout:"standard-polygonal",allowPanningAndZooming:!0,transitionDuration:500,resizeSvgOnResize:!0},arguments.length>1)for(var a in n)e.options.hasOwnProperty(a)&&(e.options[a]=n[a]);null!==e.options.initialSize?(e.options.svgW=e.options.initialSize[0],e.options.svgH=e.options.initialSize[1]):(e.options.svgW=800,e.options.svgH=800),l.default.scale.category20();var u=null,s=null,p=l.default.scale.linear().domain([0,e.options.svgW]).range([0,e.options.svgW]),d=l.default.scale.linear().domain([0,e.options.svgH]).range([0,e.options.svgH]),m=e.graph={nodes:[],links:[]};function g(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function v(t){var n=t,e=t.prevNode;if(null!==e&&t.linked){var r=[-(n.x-e.x),-(n.y-e.y)],o=[-(r=[r[0]/g(r),r[1]/g(r)])[1],r[0]],a=[t.radius*r[0],t.radius*r[1]],i="M"+(a[0]+6*(r[0]+o[0])/2)+","+(a[1]+6*(r[1]+o[1])/2)+"L"+a[0]+","+a[1]+"L"+(a[0]+6*(r[0]-o[0])/2)+","+(a[1]+6*(r[1]-o[1])/2);l.default.select(this).attr("d",i)}}function y(t){return"basepair"==t.linkType||"backbone"==t.linkType||"pseudoknot"==t.linkType||"label_link"==t.linkType||"external"==t.linkType||"chain_chain"==t.linkType}function b(t,n,e){if(t.hasOwnProperty(n.num)){var r=parseFloat(t[n.num]);return isNaN(r)?t[n.num]:e(r)}return"white"}function x(){}function M(){u&&(mpos=l.default.mouse(A.node()),P.attr("x1",u.x).attr("y1",u.y).attr("x2",mpos[0]).attr("y2",mpos[1]))}function w(){u&&P.attr("class","drag_line_hidden"),C()}e.linkStrengths={pseudoknot:0,proteinChain:0,chainChain:0,intermolecule:10,external:0,other:10},e.displayParameters={displayBackground:"true",displayNumbering:"true",displayNodeOutline:"true",displayNodeLabel:"true",displayLinks:"true",displayPseudoknotLinks:"true",displayProteinLinks:"true"},e.colorScheme="structure",e.customColors={},e.animation=e.options.applyForce,e.deaf=!1,e.rnas={},e.extraLinks=[],Array.prototype.equals=function(t){if(!t)return!1;if(this.length!=t.length)return!1;for(var n=0,e=this.length;n<e;n++)if(this[n]instanceof Array&&t[n]instanceof Array){if(!this[n].equals(t[n]))return!1}else if(this[n]!=t[n])return!1;return!0},e.createInitialLayout=function(t,n){var r={sequence:"",name:"empty",positions:[],labelInterval:e.options.labelInterval,avoidOthers:!0,uids:[],circularizeExternal:!0};if(2==arguments.length)for(var a in n)r.hasOwnProperty(a)&&(r[a]=n[a]);var i=new o.RNAGraph(r.sequence,t,r.name);i.circularizeExternal=r.circularizeExternal;var u=i.recalculateElements();if(0===r.positions.length)if("naview"==e.options.layout){var s=new h.NAView,l=s.naview_xy_coordinates(i.pairtable);r.positions=[];for(var f=0;f<l.nbase;f++)r.positions.push([l.x[f],l.y[f]])}else r.positions=(0,c.simpleXyCoordinates)(u.pairtable);return u=u.elementsToJson().addUids(r.uids).addPositions("nucleotide",r.positions).addLabels(1,r.labelInterval).reinforceStems().reinforceLoops().connectFakeNodes().reassignLinkUids().breakNodesToFakeNodes()},e.addRNA=function(t,n){var r=e.createInitialLayout(t,n);if(1===arguments.length&&(n={}),"extraLinks"in n){var o=e.addExternalLinks(r,n.extraLinks);e.extraLinks=e.extraLinks.concat(o)}return"avoidOthers"in n?e.addRNAJSON(r,n.avoidOthers):e.addRNAJSON(r,!0),r},e.addExternalLinks=function(t,n){for(var e=[],r=0;r<n.length;r++){var o={linkType:"external",value:1,uid:generateUUID(),source:null,target:null};if("[object Array]"===Object.prototype.toString.call(n[r][0])){for(var a=0;a<t.nodes.length;a++)if("nucs"in t.nodes[a]&&t.nodes[a].nucs.equals(n[r][0])){o.source=t.nodes[a];break}}else for(a=0;a<t.nodes.length;a++)t.nodes[a].num==n[r][0]&&(o.source=t.nodes[a]);if("[object Array]"===Object.prototype.toString.call(n[r][1]))for(a=0;a<t.nodes.length;a++)"nucs"in t.nodes[a]&&t.nodes[a].nucs.equals(n[r][1])&&(o.target=t.nodes[a]);else for(a=0;a<t.nodes.length;a++)t.nodes[a].num==n[r][1]&&(o.target=t.nodes[a]);null!=o.source&&null!=o.target?e.push(o):console.log("ERROR: source or target of new link not found:",o,n[r])}return e},e.addRNAJSON=function(t,n){var r,o;return n&&(r=e.graph.nodes.length>0?l.default.max(e.graph.nodes.map((function(t){return t.x}))):0,o=l.default.min(t.nodes.map((function(t){return t.x}))),t.nodes.forEach((function(t){t.x+=r-o+20,t.px+=r-o}))),t.nodes.forEach((function(n){n.rna=t})),e.rnas[t.uid]=t,e.recalculateGraph(),e.update(),e.centerView(),t},e.transitionRNA=function(t,n){var r=e.options.transitionDuration,o={uids:e.graph.nodes.filter((function(t){return"nucleotide"==t.nodeType})).map((function(t){return t.uid}))},a=e.createInitialLayout(t,o),i=T.selectAll("g.gnode").data(a.nodes,Y);0===(r=e.options.transitionDuration)?i.attr("transform",(function(t){return"translate("+[t.x,t.y]+")"})):i.transition().attr("transform",(function(t){return"translate("+[t.x,t.y]+")"})).duration(r);var u=E.selectAll("line.link").data(a.links.filter(y),X),s=e.createNewNodes(i.enter()).attr("transform",(function(t){return void 0!==t.x&&void 0!==t.y?"translate("+[0,0]+")":""}));0===r?i.exit().remove():i.exit().transition().attr("transform",(function(t){return void 0!==t.x&&void 0!==t.y?"translate("+[0,0]+")":""})),i.select("path").each(v),e.graph.nodes=i.data(),e.updateStyle(),e.centerView(r),u.exit().remove(),0===r?(u.attr("x1",(function(t){return t.source.x})).attr("y1",(function(t){return t.source.y})).attr("x2",(function(t){return t.target.x})).attr("y2",(function(t){return t.target.y})),e.createNewLinks(u.enter()),e.graph.links=u.data(),e.updateStyle()):u.transition().attr("x1",(function(t){return t.source.x})).attr("y1",(function(t){return t.source.y})).attr("x2",(function(t){return t.target.x})).attr("y2",(function(t){return t.target.y})).duration(r).call((function(t,n){0===t.size()&&setTimeout(n,r);var e=0;t.each((function(){++e})).each("end",(function(){--e||n.apply(this,arguments)}))}),(function(){e.createNewLinks(u.enter()),e.graph.links=u.data(),e.updateStyle(),void 0!==n&&n()})),0===r?s.attr("transform",(function(t){return void 0!==t.x&&void 0!==t.y?"translate("+[t.x,t.y]+")":""})):s.transition().attr("transform",(function(t){return void 0!==t.x&&void 0!==t.y?"translate("+[t.x,t.y]+")":""}))},e.recalculateGraph=function(){for(var t in e.graph.nodes=[],e.graph.links=[],e.rnas)e.graph.nodes=e.graph.nodes.concat(e.rnas[t].nodes),e.graph.links=e.graph.links.concat(e.rnas[t].links);for(var n={},r=0;r<e.graph.nodes.length;r++)n[e.graph.nodes[r].uid]=e.graph.nodes[r];for(e.graph.links.forEach((function(t){t.source=n[t.source.uid],t.target=n[t.target.uid]})),r=0;r<e.extraLinks.length;r++){if(e.extraLinks[r].target.uid in n||console.log("not there:",e.extraLinks[r]),e.extraLinks[r].source=n[e.extraLinks[r].source.uid],e.extraLinks[r].target=n[e.extraLinks[r].target.uid],"intermolecule"==e.extraLinks[r].linkType){fakeLinks=e.graph.links.filter((function(t){return(t.source==e.extraLinks[r].source||t.source==e.extraLinks[r].target||t.target==e.extraLinks[r].source||t.target==e.extraLinks[r].source)&&"fake"==t.linkType}));for(var o=0;o<fakeLinks.length;o++){var a=e.graph.links.indexOf(fakeLinks[o]);e.graph.links.splice(a,1)}}m.links.push(e.extraLinks[r])}},e.addNodes=function(t){t.links.forEach((function(n){"number"==typeof n.source&&(n.source=t.nodes[n.source]),"number"==typeof n.target&&(n.target=t.nodes[n.target])})),e.graph.nodes.length>0?(maxX=l.default.max(e.graph.nodes.map((function(t){return t.x}))),maxY=l.default.max(e.graph.nodes.map((function(t){return t.y})))):(maxX=0,maxY=0),t.nodes.forEach((function(t){t.rna.uid in e.rnas||(e.rnas[t.rna.uid]=t.rna),t.x+=maxX,t.px+=maxX})),r=new o.RNAGraph("",""),r.nodes=t.nodes,r.links=t.links,e.recalculateGraph(),e.update(),e.centerView()},e.addCustomColors=function(t){e.customColors=t},e.addCustomColorsText=function(t){var n=new f.ColorScheme(t);e.customColors=n.colorsJson,e.changeColorScheme("custom")},e.clearNodes=function(){e.graph.nodes=[],e.graph.links=[],e.rnas={},e.extraLinks=[],e.update()},e.toJSON=function(){var t={rnas:e.rnas,extraLinks:e.extraLinks};return JSON.stringify(t,(function(t,n){return"rna"==t?void 0:n}),"\t")},e.fromJSON=function(t){var n,a;try{var i=JSON.parse(t);n=i.rnas,a=i.extraLinks}catch(t){throw t}for(var u in n)"rna"==n[u].type?(r=new o.RNAGraph,r.seq=n[u].seq,r.dotbracket=n[u].dotbracket,r.circular=n[u].circular,r.pairtable=n[u].pairtable,r.uid=n[u].uid,r.structName=n[u].structName,r.nodes=n[u].nodes,r.links=n[u].links,r.rnaLength=n[u].rnaLength,r.elements=n[u].elements,r.nucsToNodes=n[u].nucsToNodes,r.pseudoknotPairs=n[u].pseudoknotPairs):(r=new ProteinGraph,r.size=n[u].size,r.nodes=n[u].nodes,r.uid=n[u].uid),e.addRNAJSON(r,!1);a.forEach((function(t){e.extraLinks.push(t)})),e.recalculateGraph(),e.update()},e.setSize=function(){if(null==e.options.initialSize){var n=l.default.select(t).node().offsetHeight,r=l.default.select(t).node().offsetWidth;e.options.svgW=r,e.options.svgH=n,p.range([0,r]).domain([0,r]),d.range([0,n]).domain([0,n]),e.zoomer.x(p).y(d),e.brusher.x(p).y(d),e.centerView(),e.options.resizeSvgOnResize&&_.attr("width",r).attr("height",n)}},e.setOutlineColor=function(t){T.selectAll("g.gnode").select("[node_type=nucleotide]").style("fill",t)},e.changeColorScheme=function(t){T.selectAll("[node_type=protein]").classed("protein",!0).attr("r",(function(t){return t.radius})),T.selectAll("g.gnode"),T.selectAll("g.gnode").selectAll("circle");var n=T.selectAll("g.gnode").select("[node_type=nucleotide]");if(e.colorScheme=t,"sequence"==t){var r=l.default.scale.ordinal().range(["#dbdb8d","#98df8a","#ff9896","#aec7e8","#aec7e8"]).domain(["A","C","G","U","T"]);n.style("fill",(function(t){return r(t.name)}))}else"structure"==t?(r=l.default.scale.category10().domain(["s","m","i","e","t","h","x"]).range(["lightgreen","#ff9896","#dbdb8d","lightsalmon","lightcyan","lightblue","transparent"]),n.style("fill",(function(t){return r(t.elemType)}))):"positions"==t?n.style("fill",(function(t){return l.default.scale.linear().range(["#98df8a","#dbdb8d","#ff9896"]).interpolate(l.default.interpolateLab).domain([1,1+(t.rna.rnaLength-1)/2,t.rna.rnaLength])(t.num)})):"custom"==t&&(void 0!==e.customColors&&"domain"in e.customColors&&"range"in e.customColors&&(r=l.default.scale.linear().interpolate(l.default.interpolateLab).domain(e.customColors.domain).range(e.customColors.range)),n.style("fill",(function(t){return void 0!==e.customColors&&e.customColors.hasOwnProperty("colorValues")?e.customColors.colorValues.hasOwnProperty(t.structName)&&e.customColors.colorValues[t.structName].hasOwnProperty(t.num)?b(e.customColors.colorValues[t.structName],t,r):e.customColors.colorValues.hasOwnProperty("")?b(e.customColors.colorValues[""],t,r):"white":"white"})))},window.addEventListener("resize",e.setSize,!1),e.zoomer=l.default.behavior.zoom().scaleExtent([.1,10]).x(p).y(d).on("zoomstart",R).on("zoom",N),l.default.select(t).select("svg").remove();var _=l.default.select(t).classed("forna-container",!0).attr("tabindex",1).on("keydown.brush",B).on("keyup.brush",I).each((function(){this.focus()})).append("svg:svg").attr("width",e.options.svgW).attr("height",e.options.svgH).attr("id","plotting-area");e.options.svg=_;var k=_.append("svg:g").on("mousemove",M).on("mousedown",x).on("mouseup",w);e.options.allowPanningAndZooming&&k.call(e.zoomer);var S=k.append("g").datum((function(){return{selected:!1,previouslySelected:!1}})).attr("class","brush"),A=k.append("svg:g"),E=A.append("svg:g"),T=A.append("svg:g");function R(){var t=T.selectAll("g.gnode").selectAll(".outline_node");t.each((function(t){t.selected=!1,t.previouslySelected=!1})),t.classed("selected",!1)}function N(){A.attr("transform","translate("+l.default.event.translate+") scale("+l.default.event.scale+")")}e.brusher=l.default.svg.brush().x(p).y(d).on("brushstart",(function(t){T.selectAll("g.gnode").selectAll(".outline_node").each((function(t){t.previouslySelected=L&&t.selected}))})).on("brush",(function(){var t=T.selectAll("g.gnode").selectAll(".outline_node"),n=l.default.event.target.extent();t.classed("selected",(function(t){return t.selected=e.options.applyForce&&t.previouslySelected^(n[0][0]<=t.x&&t.x<n[1][0]&&n[0][1]<=t.y&&t.y<n[1][1])}))})).on("brushend",(function(){l.default.event.target.clear(),l.default.select(this).call(l.default.event.target)})),S.call(e.brusher).on("mousedown.brush",null).on("touchstart.brush",null).on("touchmove.brush",null).on("touchend.brush",null),S.select(".background").style("cursor","auto"),e.getBoundingBoxTransform=function(){if(0===e.graph.nodes.length)return{translate:[0,0],scale:1};var t=l.default.min(e.graph.nodes.map((function(t){return t.x}))),n=l.default.min(e.graph.nodes.map((function(t){return t.y}))),r=l.default.max(e.graph.nodes.map((function(t){return t.x})))-t,o=l.default.max(e.graph.nodes.map((function(t){return t.y})))-n,a=e.options.svgW/(r+1),i=e.options.svgH/(o+1),u=.8*Math.min(a,i),s=r*u,c=o*u;return{translate:[-t*u+(e.options.svgW-s)/2,-n*u+(e.options.svgH-c)/2],scale:u}},e.centerView=function(t){0===arguments.length&&(t=0);var n=e.getBoundingBoxTransform();null!==n&&(A.transition().attr("transform","translate("+n.translate+") scale("+n.scale+")").duration(t),e.zoomer.translate(n.translate),e.zoomer.scale(n.scale))},e.force=l.default.layout.force().charge((function(t){return"middle"==t.nodeType?e.options.middleCharge:e.options.otherCharge})).friction(e.options.friction).linkDistance((function(t){return e.options.linkDistanceMultiplier*t.value})).linkStrength((function(t){return t.linkType in e.linkStrengths?e.linkStrengths[t.linkType]:e.linkStrengths.other})).gravity(0).nodes(e.graph.nodes).links(e.graph.links).chargeDistance(e.options.chargeDistance).size([e.options.svgW,e.options.svgH]);var P=A.append("line").attr("class","drag_line").attr("x1",0).attr("y1",0).attr("x2",0).attr("y2",0);function C(){u=null,s=null}var O=!1,L=!1;function U(t){var n=T.selectAll("g.gnode");return n.filter((function(t){return t.selected}))}function D(t){l.default.event.sourceEvent.stopPropagation(),t.selected||L||T.selectAll("g.gnode").selectAll(".outline_node").classed("selected",(function(t){return t.selected=e.options.applyForce&&(t.previouslySelected=!1)})),l.default.select(this).select(".outline_node").classed("selected",(function(n){return t.previouslySelected=t.selected,t.selected=e.options.applyForce&&!0})),U().each((function(t){t.fixed|=2}))}function z(t){U().each((function(t){t.x+=l.default.event.dx,t.y+=l.default.event.dy,t.px+=l.default.event.dx,t.py+=l.default.event.dy})),e.resumeForce(),l.default.event.sourceEvent.preventDefault()}function q(t){U().each((function(t){t.fixed&=-7}))}function j(t){var n=t.radius+16,e=t.x-n,r=t.x+n,o=t.y-n,a=t.y+n;return function(n,i,u,s,l){if(n.point&&n.point!==t){var c=t.x-n.point.x,f=t.y-n.point.y,h=Math.sqrt(c*c+f*f),p=t.radius+n.point.radius;h<p&&(h=(h-p)/h*.1,t.x-=c*=h,t.y-=f*=h,n.point.x+=c,n.point.y+=f)}return i>r||s<e||u>a||l<o}}e.resumeForce=function(){e.animation&&e.force.resume()};var F=l.default.behavior.drag().on("dragstart",D).on("drag",z).on("dragend",q);function B(){if(!e.deaf&&!O){switch(l.default.event.keyCode){case 16:O=!0;break;case 17:L=!0;break;case 67:e.centerView()}(O||L)&&(k.call(e.zoomer).on("mousedown.zoom",null).on("touchstart.zoom",null).on("touchmove.zoom",null).on("touchend.zoom",null),A.selectAll("g.gnode").on("mousedown.drag",null)),L&&(S.select(".background").style("cursor","crosshair"),S.call(e.brusher))}}function I(){O=!1,L=!1,S.call(e.brusher).on("mousedown.brush",null).on("touchstart.brush",null).on("touchmove.brush",null).on("touchend.brush",null),S.select(".background").style("cursor","auto"),k.call(e.zoomer),A.selectAll("g.gnode").call(F)}l.default.select(t).on("keydown",B).on("keyup",I).on("contextmenu",(function(){l.default.event.preventDefault()}));var X=function(t){return t.uid},Y=function(t){return t.uid},V=function(t){var n=t.getPositions("nucleotide"),r=t.getPositions("label"),o=t.getUids();t.recalculateElements().elementsToJson().addPseudoknots().addPositions("nucleotide",n).addUids(o).addLabels(1,e.options.labelInterval).addPositions("label",r).reinforceStems().reinforceLoops().updateLinkUids()},H=function(t){if(index=e.graph.links.indexOf(t),index>-1){if(t.source.rna==t.target.rna){var n=t.source.rna;n.addPseudoknots(),n.pairtable[t.source.num]=0,n.pairtable[t.target.num]=0,V(n)}else extraLinkIndex=e.extraLinks.indexOf(t),e.extraLinks.splice(extraLinkIndex,1);e.recalculateGraph()}e.update()},G=function(t){O&&(t.linkType in{backbone:!0,fake:!0,fake_fake:!0,label_link:!0}||H(t))};e.addLink=function(t){t.source.rna==t.target.rna?(r=t.source.rna,r.pairtable[t.source.num]=t.target.num,r.pairtable[t.target.num]=t.source.num,V(r)):(t.linkType="intermolecule",e.extraLinks.push(t)),e.recalculateGraph(),e.update()};var W=function(t){l.default.event.defaultPrevented||(L||T.selectAll("g.gnode").selectAll(".outline_node").classed("selected",(function(t){return t.selected=e.options.applyForce&&(t.previouslySelected=!1)})),l.default.select(this).select("circle").classed("selected",t.selected=e.options.applyForce&&!t.previouslySelected))},Z=function(t){if(u){if((s=t)==u)return void C();var n={source:u,target:s,linkType:"basepair",value:1,uid:generateUUID()};for(i=0;i<e.graph.links.length;i++){if(!(e.graph.links[i].source!=u&&e.graph.links[i].target!=u&&e.graph.links[i].source!=s&&e.graph.links[i].target!=s||"basepair"!=e.graph.links[i].linkType&&"pseudoknot"!=e.graph.links[i].linkType))return;if((e.graph.links[i].source==s&&e.graph.links[i].target==u||e.graph.links[i].source==u&&e.graph.links[i].target==s)&&"backbone"==e.graph.links[i].linkType)return}if("middle"==s.nodeType||"middle"==u.nodeType||"label"==s.nodeType||"label"==u.nodeType)return;e.addLink(n)}},J=function(t){t.selected||L||T.selectAll("g.gnode").selectAll(".outline_node").classed("selected",(function(t){return t.selected=t.previouslySelected=!1})),l.default.select(this).classed("selected",(function(n){return t.previouslySelected=t.selected,t.selected=e.options.applyForce&&!0})),O&&(u=t,P.attr("class","drag_line").attr("x1",u.x).attr("y1",u.y).attr("x2",u.x).attr("y2",u.y))};e.startAnimation=function(){e.animation=!0,A.selectAll("g.gnode").call(F),e.force.start()},e.stopAnimation=function(){e.animation=!1,A.selectAll("g.gnode").on("mousedown.drag",null),e.force.stop()},e.setFriction=function(t){e.force.friction(t),e.resumeForce()},e.setCharge=function(t){e.force.charge(t),e.resumeForce()},e.setGravity=function(t){e.force.gravity(t),e.resumeForce()},e.setPseudoknotStrength=function(t){e.linkStrengths.pseudoknot=t,e.update()},e.displayBackground=function(t){e.displayParameters.displayBackground=t,e.updateStyle()},e.displayNumbering=function(t){e.displayParameters.displayNumbering=t,e.updateStyle()},e.displayNodeOutline=function(t){e.displayParameters.displayNodeOutline=t,e.updateStyle()},e.displayNodeLabel=function(t){e.displayParameters.displayNodeLabel=t,e.updateStyle()},e.displayLinks=function(t){e.displayParameters.displayLinks=t,e.updateStyle()},e.displayPseudoknotLinks=function(t){e.displayParameters.displayPseudoknotLinks=t,e.updateStyle()},e.displayProteinLinks=function(t){e.displayParameters.displayProteinLinks=t,e.updateStyle()},e.updateStyle=function(){T.selectAll("[node_type=label]").classed("transparent",!e.displayParameters.displayNumbering),T.selectAll("[label_type=label]").classed("transparent",!e.displayParameters.displayNumbering),E.selectAll("[linkType=label_link]").classed("transparent",!e.displayParameters.displayNumbering),_.selectAll("circle").classed("hidden_outline",!e.displayParameters.displayNodeOutline),T.selectAll("[label_type=nucleotide]").classed("transparent",!e.displayParameters.displayNodeLabel),_.selectAll("[link_type=real],[link_type=basepair],[link_type=backbone],[link_type=pseudoknot],[link_type=protein_chain],[link_type=chain_chain],[link_type=external]").classed("transparent",!e.displayParameters.displayLinks),_.selectAll("[link_type=pseudoknot]").classed("transparent",!e.displayParameters.displayPseudoknotLinks),_.selectAll("[link_type=protein_chain]").classed("transparent",!e.displayParameters.displayProteinLinks),E.selectAll("[link_type=fake]").classed("transparent",!e.options.displayAllLinks),E.selectAll("[link_type=fake_fake]").classed("transparent",!e.options.displayAllLinks)},e.createNewLinks=function(t){var n=t.append("svg:line");return n.append("svg:title").text(X),n.classed("link",!0).attr("x1",(function(t){return t.source.x})).attr("y1",(function(t){return t.source.y})).attr("x2",(function(t){return t.target.x})).attr("y2",(function(t){return t.target.y})).attr("link_type",(function(t){return t.linkType})).attr("class",(function(t){return l.default.select(this).attr("class")+" "+t.linkType})).attr("pointer-events",(function(t){return"fake"==t.linkType?"none":"all"})),n},e.createNewNodes=function(t){(t=t.append("g").classed("noselect",!0).classed("gnode",!0).attr("struct_name",(function(t){return t.structName})).attr("transform",(function(t){return void 0!==t.x&&void 0!==t.y?"translate("+[t.x,t.y]+")":""})).each((function(t){t.selected=t.previouslySelected=!1}))).call(F).on("mousedown",J).on("mousedrag",(function(t){})).on("mouseup",Z).attr("num",(function(t){return"n"+t.num})).attr("rnum",(function(t){return"n"+(t.rna.rnaLength-t.num+1)})).on("click",W).transition().duration(750).ease("elastic");var n=t.filter((function(t){return"label"==t.nodeType||"protein"==t.nodeType})),e=t.filter((function(t){return"nucleotide"==t.nodeType}));return n.append("svg:circle").attr("class","outline_node").attr("r",(function(t){return t.radius+1})),e.append("svg:circle").attr("class","outline_node").attr("r",(function(t){return t.radius+1})),n.append("svg:circle").attr("class","node").classed("label",(function(t){return"label"==t.nodeType})).attr("r",(function(t){return"middle"==t.nodeType?0:t.radius})).attr("node_type",(function(t){return t.nodeType})).attr("node_num",(function(t){return t.num})),e.append("svg:circle").attr("class","node").attr("node_type",(function(t){return t.nodeType})).attr("node_num",(function(t){return t.num})).attr("r",(function(t){return t.radius})).append("svg:title").text((function(t){return"nucleotide"==t.nodeType?t.structName+":"+t.num:""})),e.append("svg:path").attr("class","node").attr("node_type",(function(t){return t.nodeType})).attr("node_num",(function(t){return t.num})).append("svg:title").text((function(t){return"nucleotide"==t.nodeType?t.structName+":"+t.num:""})),t.append("text").text((function(t){return t.name})).attr("text-anchor","middle").attr("font-size",8).attr("font-weight","bold").attr("y",2.5).attr("class","node-label").attr("label_type",(function(t){return t.nodeType})).append("svg:title").text((function(t){return"nucleotide"==t.nodeType?t.structName+":"+t.num:""})),t},e.update=function(){e.force.nodes(e.graph.nodes).links(e.graph.links),e.animation&&e.force.start();var t=E.selectAll("line.link").data(e.graph.links.filter(y),X);t.attr("class","").classed("link",!0).attr("link_type",(function(t){return t.linkType})).attr("class",(function(t){return l.default.select(this).attr("class")+" "+t.linkType}));var n=t.enter();e.createNewLinks(n),t.exit().remove(),l.default.scale.category10().domain([0,1,2,3,4,5,6,7,8,9]);var r=T.selectAll("g.gnode").data(e.graph.nodes,Y),o=r.enter();e.createNewNodes(o),r.exit().remove();var a,i=e.graph.nodes.filter((function(t){return"nucleotide"==t.nodeType||"label"==t.nodeType}));a=e.displayFakeLinks?t:E.selectAll("[link_type=real],[link_type=pseudoknot],[link_type=protein_chain],[link_type=chain_chain],[link_type=label_link],[link_type=backbone],[link_type=basepair],[link_type=intermolecule],[link_type=external]"),r.selectAll("path").each(v),a.on("click",G),e.force.on("tick",(function(){for(var t=l.default.geom.quadtree(i),n=0,e=i.length;++n<e;)t.visit(j(i[n]));a.attr("x1",(function(t){return t.source.x})).attr("y1",(function(t){return t.source.y})).attr("x2",(function(t){return t.target.x})).attr("y2",(function(t){return t.target.y})),r.attr("transform",(function(t){return"translate("+[t.x,t.y]+")"})),r.select("path").each(v)})),e.changeColorScheme(e.colorScheme),e.animation&&e.force.start(),e.updateStyle()},e.setSize()},e(15);var u,s=e(17),l=(u=s)&&u.__esModule?u:{default:u},c=e(4),f=e(2),h=e(5)},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.ProteinGraph=i,n.RNAGraph=u,n.moleculesToJson=function(t){for(var n={},e=[],r=[],o=0;o<t.molecules.length;o++){var s,l=t.molecules[o];"rna"==l.type?((s=new u(l.seq,l.ss,l.header)).circularizeExternal=!0,s.elementsToJson().addPositions("nucleotide",l.positions).addLabels().reinforceStems().reinforceLoops()):"protein"==l.type&&(s=new i(l.header,l.size)),s.addUids(l.uids);for(var c=0;c<s.nodes.length;c++)n[s.nodes[c].uid]=s.nodes[c];e.push(s)}for(o=0;o<t.extraLinks.length;o++)link=t.extraLinks[o],link.source=n[link.source],link.target=n[link.target],link.uid=a(),r.push(link);return{graphs:e,extraLinks:r}};var r=e(2),o=function(t,n){return t-n};function a(){var t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(n){var e=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==n?e:3&e|8).toString(16)}))}function i(t,n,e){var r=this;r.type="protein",r.size=n,r.nodes=[{name:"P",num:1,radius:3*Math.sqrt(n),rna:r,nodeType:"protein",structName:t,elemType:"p",size:n,uid:a()}],r.links=[],r.uid=a(),r.addUids=function(t){for(var n=0;n<t.length;n++)r.nodes[n].uid=t[n];return r},r.getUids=function(){uids=[];for(var t=0;t<r.dotbracket.length;t++)uids.push(r.nodes[t].uid);return uids}}function u(t,n,e,i){var u=this;u.type="rna",u.circularizeExternal=!1,0===arguments.length?(u.seq="",u.dotbracket="",u.structName=""):(u.seq=t,u.dotbracket=n,u.structName=e),arguments.length<4&&(i=1),u.circular=!1,u.dotbracket.length>0&&"*"==u.dotbracket[u.dotbracket.length-1]&&(u.dotbracket=u.dotbracket.slice(0,u.dotbracket.length-1),u.circular=!0),u.uid=a(),u.elements=[],u.pseudoknotPairs=[],u.nucsToNodes={},u.addUids=function(t){for(var n=u.nodes.filter((function(t){return"nucleotide"==t.nodeType})),e=0;e<t.length&&e<n.length;e++)n[e].uid=t[e];return u},u.computePairtable=function(){u.pairtable=r.rnaUtilities.dotbracketToPairtable(u.dotbracket)},u.removeBreaks=function(t){for(var n=[],e=-1;(e=t.indexOf("&"))>=0;)n.push(e),t=t.substring(0,e)+"oo"+t.substring(e+1,t.length);return{targetString:t,breaks:n}};var s=u.removeBreaks(u.dotbracket);u.dotbracket=s.targetString,u.dotBracketBreaks=s.breaks,s=u.removeBreaks(u.seq),u.seq=s.targetString,u.seqBreaks=s.breaks,u.calculateStartNumberArray=function(){u.startNumberArray=[];for(var t=0;t<u.dotbracket.length;t++)u.startNumberArray.push(i),"o"==u.dotbracket[t]&&(i=-t)},u.calculateStartNumberArray(),u.rnaLength=u.dotbracket.length,(0,r.arraysEqual)(u.dotBracketBreaks,u.seqBreaks)||(console.log("WARNING: Sequence and structure breaks not equal"),console.log("WARNING: Using the breaks in the structure")),u.computePairtable(),u.addPositions=function(t,n){for(var e=u.nodes.filter((function(n){return n.nodeType==t})),r=0;r<e.length;r++)e[r].x=n[r][0],e[r].px=n[r][0],e[r].y=n[r][1],e[r].py=n[r][1];return u},u.breakNodesToFakeNodes=function(){for(var t=u.nodes.filter((function(t){return"nucleotide"==t.nodeType})),n=0;n<t.length;n++)"o"==u.dotbracket[n]&&(t[n].nodeType="middle");for(n=0;n<u.elements.length;n++){for(var e=!1,r=0;r<u.elements[n][2].length;r++)u.dotBracketBreaks.indexOf(u.elements[n][2][r])>=0&&(e=!0);e?u.elements[n][2].map((function(t){0!=t&&(u.nodes[t-1].elemType="e")})):u.elements[n][2].map((function(t){0!=t&&(u.nodes[t-1].elemType=u.elements[n][0])}))}return u},u.getPositions=function(t){for(var n=[],e=u.nodes.filter((function(n){return n.nodeType==t})),r=0;r<e.length;r++)n.push([e[r].x,e[r].y]);return n},u.getUids=function(){for(var t=[],n=0;n<u.dotbracket.length;n++)t.push(u.nodes[n].uid);return t},u.reinforceStems=function(){for(var t=u.pairtable,n=u.elements.filter((function(t){return"s"==t[0]&&t[2].length>=4})),e=0;e<n.length;e++)for(var r=n[e][2],o=r.slice(0,r.length/2),a=0;a<o.length-1;a++)u.addFakeNode([o[a],o[a+1],t[o[a+1]],t[o[a]]]);return u},u.reinforceLoops=function(){for(var t=function(t){return 0!==t&&t<=u.dotbracket.length},n=0;n<u.elements.length;n++)if("s"!=u.elements[n][0]&&(u.circularizeExternal||"e"!=u.elements[n][0])){var e=u.elements[n][2].filter(t);if("e"==u.elements[n][0]){var r={name:"",num:-3,radius:0,rna:u,nodeType:"middle",elemType:"f",nucs:[],x:u.nodes[u.rnaLength-1].x,y:u.nodes[u.rnaLength-1].y,px:u.nodes[u.rnaLength-1].px,py:u.nodes[u.rnaLength-1].py,uid:a()},o={name:"",num:-2,radius:0,rna:u,nodeType:"middle",elemType:"f",nucs:[],x:u.nodes[0].x,y:u.nodes[0].y,px:u.nodes[0].px,py:u.nodes[0].py,uid:a()};e.push(u.nodes.length+1),e.push(u.nodes.length+2),u.nodes.push(r),u.nodes.push(o)}u.addFakeNode(e)}return u},u.updateLinkUids=function(){for(var t=0;t<u.links.length;t++)u.links[t].uid=u.links[t].source.uid+u.links[t].target.uid;return u},u.addFakeNode=function(t){for(var n=6.283/(2*t.length),e=18/(2*Math.tan(n)),r="",o=0;o<t.length;o++)r+=u.nodes[t[o]-1].uid;var i={name:"",num:-1,radius:e,rna:u,nodeType:"middle",elemType:"f",nucs:t,uid:r};u.nodes.push(i);var s=0,l=0,c=0;n=3.14159*(t.length-2)/(2*t.length),e=.5/Math.cos(n);for(var f=0;f<t.length;f++)if(!(0===t[f]||t[f]>u.dotbracket.length)){u.links.push({source:u.nodes[t[f]-1],target:u.nodes[u.nodes.length-1],linkType:"fake",value:e,uid:a()}),t.length>4&&u.links.push({source:u.nodes[t[f]-1],target:u.nodes[t[(f+Math.floor(t.length/2))%t.length]-1],linkType:"fake",value:2*e,uid:a()});var h=3.14159*(t.length-2)/t.length,p=2*Math.cos(1.570795-h/2);u.links.push({source:u.nodes[t[f]-1],target:u.nodes[t[(f+2)%t.length]-1],linkType:"fake",value:p});var d=u.nodes[t[f]-1];"x"in d&&(s+=d.x,l+=d.y,c+=1)}return c>0&&(i.x=s/c,i.y=l/c,i.px=i.x,i.py=i.y),u},u.connectFakeNodes=function(){for(var t={},n=u.nodes.filter((function(t){return"middle"==t.nodeType})),e=new Set,r=1;r<=u.nodes.length;r++)t[r]=[];for(r=0;r<n.length;r++)for(var o=n[r],a=0;a<o.nucs.length;a++){for(var i=o.nucs[a],s=0;s<t[i].length;s++)if(!e.has(JSON.stringify([t[i][s].uid,o.uid].sort()))){var l=t[i][s].radius+o.radius;u.links.push({source:t[i][s],target:o,value:l/18,linkType:"fake_fake"}),e.add(JSON.stringify([t[i][s].uid,o.uid].sort()))}t[i].push(o)}return u},u.addExtraLinks=function(t){if(void 0===t)return u;for(var n=0;n<t.length;n++){var e={source:u.getNodeFromNucleotides(t[n].from),target:u.getNodeFromNucleotides(t[n].to),linkType:"extra",extraLinkType:t[n].linkType,uid:a()};u.links.push(e)}return u},u.elementsToJson=function(){var t=u.pairtable;u.elements,u.nodes=[],u.links=[];var n={};u.elements.sort();for(var e=0;e<u.elements.length;e++)for(var r=u.elements[e][2],o=0;o<r.length;o++)n[r[o]]=u.elements[e][0];for(e=1;e<=t[0];e++){var i=u.seq[e-1];(u.dotBracketBreaks.indexOf(e-1)>=0||u.dotBracketBreaks.indexOf(e-2)>=0)&&(i=""),u.nodes.push({name:i,num:e+u.startNumberArray[e-1]-1,radius:5,rna:u,nodeType:"nucleotide",structName:u.structName,elemType:n[e],uid:a(),linked:!1})}for(e=0;e<u.nodes.length;e++)u.nodes[e].prevNode=0===e?null:u.nodes[e-1],e==u.nodes.length-1?u.nodes[e].nextNode=null:u.nodes[e].nextNode=u.nodes[e+1];for(e=1;e<=t[0];e++)0!==t[e]&&u.links.push({source:u.nodes[e-1],target:u.nodes[t[e]-1],linkType:"basepair",value:1,uid:a()}),e>1&&-1===u.dotBracketBreaks.indexOf(e-1)&&-1==u.dotBracketBreaks.indexOf(e-2)&&-1==u.dotBracketBreaks.indexOf(e-3)&&(u.links.push({source:u.nodes[e-2],target:u.nodes[e-1],linkType:"backbone",value:1,uid:a()}),u.nodes[e-1].linked=!0);for(e=0;e<u.pseudoknotPairs.length;e++)u.links.push({source:u.nodes[u.pseudoknotPairs[e][0]-1],target:u.nodes[u.pseudoknotPairs[e][1]-1],linkType:"pseudoknot",value:1,uid:a()});return u.circular&&u.links.push({source:u.nodes[0],target:u.nodes[u.rnaLength-1],linkType:"backbone",value:1,uid:a()}),u},u.ptToElements=function(t,n,e,r){var a=[],i=[e-1],s=[r+1];if(e>r)return[];for(;0===t[e];e++)i.push(e);for(;0===t[r];r--)s.push(r);if(e>r){if(i.push(e),0===n)return[["e",n,i.sort(o)]];for(var l=!1,c=[],f=[],h=0;h<i.length;h++)l?f.push(i[h]):c.push(i[h]),u.dotBracketBreaks.indexOf(i[h])>=0&&(l=!0);return[["h",n,i.sort(o)]]}if(t[e]!=r){var p=i;for(h=e,p.push(h);h<=r;){for(a=a.concat(u.ptToElements(t,n,h,t[h])),p.push(t[h]),h=t[h]+1;0===t[h]&&h<=r;h++)p.push(h);p.push(h)}return p.pop(),(p=p.concat(s)).length>0&&(0===n?a.push(["e",n,p.sort(o)]):a.push(["m",n,p.sort(o)])),a}t[e]===r&&(i.push(e),s.push(r),i.concat(s).length>4&&(0===n?a.push(["e",n,i.concat(s).sort(o)]):a.push(["i",n,i.concat(s).sort(o)])));for(var d=[];t[e]===r&&e<r;)d.push(e),d.push(r),e+=1,r-=1,n+=1;return i=[e-1],s=[r+1],a.push(["s",n,d.sort(o)]),a.concat(u.ptToElements(t,n,e,r))},u.addLabels=function(t,n){if(0===arguments.length&&(t=1,n=10),1===arguments.length&&(n=10),0===n)return u;n<=0&&console.log("The label interval entered in invalid:",n);for(var e=1;e<=u.pairtable[0];e++)if(e%n==0){var r,o,i,s,l=u.nodes[e-1];1==u.rnaLength?(s=[l.x-15,l.y],i=[l.x-15,l.y]):(r=1==e?u.nodes[u.rnaLength-1]:u.nodes[e-2],o=e==u.rnaLength?u.nodes[0]:u.nodes[e],0!==u.pairtable[o.num]&&0!==u.pairtable[r.num]&&0!==u.pairtable[l.num]&&(r=o=u.nodes[u.pairtable[l.num]-1]),0===u.pairtable[l.num]||0!==u.pairtable[o.num]&&0!==u.pairtable[r.num]?(s=[o.x-l.x,o.y-l.y],i=[r.x-l.x,r.y-l.y]):(s=[l.x-o.x,l.y-o.y],i=[l.x-r.x,l.y-r.y]));var c=[s[0]+i[0],s[1]+i[1]],f=Math.sqrt(c[0]*c[0]+c[1]*c[1]),h=[c[0]/f,c[1]/f],p=[-15*h[0],-15*h[1]],d=u.nodes[e-1].x+p[0],m=u.nodes[e-1].y+p[1],g={name:e+u.startNumberArray[e-1]-1,num:-1,radius:6,rna:u,nodeType:"label",structName:u.structName,elemType:"l",x:d,y:m,px:d,py:m,uid:a()},v={source:u.nodes[e-1],target:g,value:1,linkType:"label_link",uid:a()};u.nodes.push(g),u.links.push(v)}return u},u.recalculateElements=function(){if(u.removePseudoknots(),u.elements=u.ptToElements(u.pairtable,0,1,u.dotbracket.length),u.circular&&(externalLoop=u.elements.filter((function(t){if("e"==t[0])return!0})),externalLoop.length>0)){eloop=externalLoop[0],nucs=eloop[2].sort(o),prev=nucs[0],hloop=!0,numGreater=0;for(var t=1;t<nucs.length;t++)nucs[t]-prev>1&&(numGreater+=1),prev=nucs[t];1==numGreater?eloop[0]="h":2==numGreater?eloop[0]="i":eloop[0]="m"}return u},u.reassignLinkUids=function(){for(var t=0;t<u.links.length;t++)u.links[t].uid=u.links[t].source.uid+u.links[t].target.uid;return u},u.removePseudoknots=function(){return u.pairtable.length>1&&(u.pseudoknotPairs=u.pseudoknotPairs.concat(r.rnaUtilities.removePseudoknotsFromPairtable(u.pairtable))),u},u.addPseudoknots=function(){for(var t=u.pairtable,n=u.pseudoknotPairs,e=0;e<n.length;e++)t[n[e][0]]=n[e][1],t[n[e][1]]=n[e][0];return u.pseudoknotPairs=[],u},u.addName=function(t){return void 0===t?(u.name="",u):(u.name=t,u)},u.rnaLength>0&&u.recalculateElements()}void 0===String.prototype.trim&&(String.prototype.trim=function(){return String(this).replace(/^\s+|\s+$/g,"")})},function(t,n,e){t.exports=function(t){function n(r){if(e[r])return e[r].exports;var o=e[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var e={};return n.m=t,n.c=e,n.p="",n(0)}([function(t,n,e){t.exports=e(1)},function(t,n){"use strict";function e(){var t=this;t.bracketLeft="([{<ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),t.bracketRight=")]}>abcdefghijklmnopqrstuvwxyz".split(""),t.inverseBrackets=function(t){for(var n={},e=0;e<t.length;e++)n[t[e]]=e;return n},t.maximumMatching=function(t){for(var n=t[0],e=new Array(n+1),r=0;n>=r;r++){e[r]=new Array(n+1);for(var o=r;n>=o;o++)e[r][o]=0}var a=0;for(r=n-0-1;r>0;r--)for(o=r+0+1;n>=o;o++){a=e[r][o-1];for(var i=o-0-1;i>=r;i--)t[i]===o&&(a=Math.max(a,(i>r?e[r][i-1]:0)+1+(o-i-1>0?e[i+1][o-1]:0)));e[r][o]=a}return a=e[1][n],e},t.backtrackMaximumMatching=function(n,e){var r=Array.apply(null,Array(n.length)).map((function(){return 0}));return t.mmBt(n,r,e,1,n.length-1),r},t.mmBt=function(n,e,r,o,a){var i=n[o][a];if(!(0>a-o-1)){if(n[o][a-1]==i)return void t.mmBt(n,e,r,o,a-1);for(var u=a-0-1;u>=o;u--)if(r[a]===u&&(u>o?n[o][u-1]:0)+(a-u-1>0?n[u+1][a-1]:0)+1==i)return e[u]=a,e[a]=u,u>o&&t.mmBt(n,e,r,o,u-1),void t.mmBt(n,e,r,u+1,a-1);console.log("FAILED!!!"+o+","+a+": backtracking failed!")}},t.dotbracketToPairtable=function(n){var e=Array.apply(null,new Array(n.length+1)).map(Number.prototype.valueOf,0);e[0]=n.length;for(var r={},o=0;o<t.bracketLeft.length;o++)r[o]=[];var a=t.inverseBrackets(t.bracketLeft),i=t.inverseBrackets(t.bracketRight);for(o=0;o<n.length;o++){var u=n[o],s=o+1;if("."==u||"o"==u)e[s]=0;else if(u in a)r[a[u]].push(s);else{if(!(u in i))throw"Unknown symbol in dotbracket string";var l=r[i[u]].pop();e[s]=l,e[l]=s}}for(var c in r)if(r[c].length>0)throw"Unmatched base at position "+r[c][0];return e},t.insertIntoStack=function(t,n,e){for(var r=0;t[r].length>0&&t[r][t[r].length-1]<e;)r+=1;return t[r].push(e),r},t.deleteFromStack=function(t,n){for(var e=0;0===t[e].length||t[e][t[e].length-1]!=n;)e+=1;return t[e].pop(),e},t.pairtableToDotbracket=function(n){for(var e={},r=0;r<n[0];r++)e[r]=[];var o={},a="";for(r=1;r<n[0]+1;r++){if(0!==n[r]&&n[r]in o)throw"Invalid pairtable contains duplicate entries";o[n[r]]=!0,a+=0===n[r]?".":n[r]>r?t.bracketLeft[t.insertIntoStack(e,r,n[r])]:t.bracketRight[t.deleteFromStack(e,r)]}return a},t.findUnmatched=function(n,e,r){for(var o=[],a=[],i=e,u=r,s=e;r>=s;s++)0!==n[s]&&(n[s]<e||n[s]>r)&&a.push([s,n[s]]);for(s=i;u>=s;s++){for(;0===n[s]&&u>=s;)s++;for(r=n[s];n[s]===r;)s++,r--;o=o.concat(t.findUnmatched(n,s,r))}return a.length>0&&o.push(a),o},t.removePseudoknotsFromPairtable=function(n){for(var e=t.maximumMatching(n),r=t.backtrackMaximumMatching(e,n),o=[],a=1;a<n.length;a++)n[a]<a||r[a]!=n[a]&&(o.push([a,n[a]]),n[n[a]]=0,n[a]=0);return o},t.ptToElements=function(n,e,o,a,i){var u=[],s=[o-1],l=[a+1];if(arguments.length<5&&(i=[]),o>a)return[];for(;0===n[o];o++)s.push(o);for(;0===n[a];a--)l.push(a);if(o>a){if(s.push(o),0===e)return[["e",e,s.sort(r)]];for(var c=!1,f=[],h=[],p=0;p<s.length;p++)c?h.push(s[p]):f.push(s[p]),i.indexOf(s[p])>=0&&(c=!0);return[["h",e,s.sort(r)]]}if(n[o]!=a){var d=s;for(p=o,d.push(p);a>=p;){for(u=u.concat(t.ptToElements(n,e,p,n[p],i)),d.push(n[p]),p=n[p]+1;0===n[p]&&a>=p;p++)d.push(p);d.push(p)}return d.pop(),(d=d.concat(l)).length>0&&(0===e?u.push(["e",e,d.sort(r)]):u.push(["m",e,d.sort(r)])),u}if(n[o]===a){s.push(o),l.push(a);var m=s.concat(l);m.length>4&&(0===e?u.push(["e",e,s.concat(l).sort(r)]):u.push(["i",e,s.concat(l).sort(r)]))}for(var g=[];n[o]===a&&a>o;)g.push(o),g.push(a),o+=1,a-=1,e+=1;return s=[o-1],l=[a+1],u.push(["s",e,g.sort(r)]),u.concat(t.ptToElements(n,e,o,a,i))}}Object.defineProperty(n,"__esModule",{value:!0}),n.arraysEqual=function(t,n){if(t===n)return!0;if(null===t||null===n)return!1;if(t.length!=n.length)return!1;for(var e=0;e<t.length;++e)if(t[e]!==n[e])return!1;return!0},n.RNAUtilities=e,n.ColorScheme=function(t){var n=this;return n.colorsText=t,n.parseRange=function(t){for(var n=t.split(","),e=[],r=0;r<n.length;r++){var o=n[r].split("-");if(1==o.length)e.push(parseInt(o[0]));else if(2==o.length)for(var a=parseInt(o[0]),i=parseInt(o[1]),u=a;i>=u;u++)e.push(u);else console.log("Malformed range (too many dashes):",t)}return e},n.parseColorText=function(t){for(var e=t.split("\n"),r="",o=1,a={colorValues:{"":{}},range:["white","steelblue"]},i=[],u=0;u<e.length;u++)if(">"!=e[u][0])for(var s=e[u].trim().split(/[\s]+/),l=0;l<s.length;l++)if(isNaN(s[l])){if(0===s[l].search("range")){var c=s[l].split("=")[1].split(":");a.range=[c[0],c[1]];continue}if(0==s[l].search("domain")){c=s[l].split("=")[1].split(":"),a.domain=[c[0],c[1]];continue}for(var f=s[l].split(":"),h=n.parseRange(f[0]),p=f[1],d=0;d<h.length;d++)isNaN(p)?a.colorValues[r][h[d]]=p:(a.colorValues[r][h[d]]=+p,i.push(Number(p)))}else a.colorValues[r][o]=Number(s[l]),o+=1,i.push(Number(s[l]));else r=e[u].trim().slice(1),o=1,a.colorValues[r]={};return"domain"in a||(a.domain=[Math.min.apply(null,i),Math.max.apply(null,i)]),n.colorsJson=a,n},n.normalizeColors=function(){var t;for(var e in n.colorsJson){var r=Number.MAX_VALUE,o=Number.MIN_VALUE;for(var a in n.colorsJson.colorValues[e])"number"==typeof(t=n.colorsJson.colorValues[e][a])&&(r>t&&(r=t),t>o&&(o=t));for(a in n.colorsJson.colorValues[e])"number"==typeof(t=n.colorsJson.colorValues[e][a])&&(n.colorsJson.colorValues[e][a]=(t-r)/(o-r))}return n},n.parseColorText(n.colorsText),n};var r=function(t,n){return t-n};n.rnaUtilities=new e}])},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.rnaPlot=function(){var t,n,e={width:400,height:400,nucleotideRadius:5,rnaEdgePadding:0,labelInterval:0,showNucleotideLabels:!0,startNucleotideNumber:1,bundleExternalLinks:!1};function a(a){a.each((function(a){var i=new r.RNAGraph(a.sequence,a.structure,a.name).recalculateElements().elementsToJson().addName(a.name);a.rnaGraph=i;for(var u=(new o.NAView).naview_xy_coordinates(i.pairtable),s=[],l=0;l<u.nbase;l++)s.push([u.x[l],u.y[l]]);i.addPositions("nucleotide",s).reinforceStems().reinforceLoops().addExtraLinks(a.extraLinks).addLabels(e.startNucleotideNumber,e.labelInterval);var c=function(r,o){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=d3.extent(r),u=d3.extent(o),s=30;""!=a&&(u[1]+=s),i[0]-=e.nucleotideRadius+e.rnaEdgePadding,u[0]-=e.nucleotideRadius+e.rnaEdgePadding,i[1]+=e.nucleotideRadius+e.rnaEdgePadding,u[1]+=e.nucleotideRadius+e.rnaEdgePadding;var l,c=i[1]-i[0],f=u[1]-u[0],h=c-e.width,p=f-e.height;function d(t,n,e){var r=(t.range()[1]-t.range()[0])/(t.domain()[1]-t.domain()[0]),o=(n[1]-n[0])*r,a=(e[1]-e[0]-o)/2;return{scaleFactor:r,scale:d3.scale.linear().domain(n).range([e[0]+a,e[1]-a])}}return h>p?(l=d(t=d3.scale.linear().domain(i).range([0,e.width]),u,[0,e.height]),n=l.scale):(l=d(n=d3.scale.linear().domain(u).range([0,e.height]),i,[0,e.width]),t=l.scale),t.range()[0],t.domain()[0],n.range()[0],n.domain()[0],"translate("+-(t.domain()[0]*l.scaleFactor-t.range()[0])+","+-(n.domain()[0]*l.scaleFactor-n.range()[0])+")scale("+l.scaleFactor+")"}(i.nodes.map((function(t){return t.x})),i.nodes.map((function(t){return t.y}))),f=d3.select(this).append("g").attr("transform",c),h=i.nodes.filter((function(t){return"nucleotide"==t.nodeType})),p=i.nodes.filter((function(t){return"label"==t.nodeType})),d=i.links;!function(t,n){n=n.filter((function(t){return null!==t.source&&null!==t.target})),t.selectAll(".rna-link").data(n).enter().append("svg:line").attr("x1",(function(t){return t.source.x})).attr("x2",(function(t){return t.target.x})).attr("y1",(function(t){return t.source.y})).attr("y2",(function(t){return t.target.y})).attr("link-type",(function(t){return t.linkType})).attr("extra-link-type",(function(t){return t.extraLinkType})).classed("rna-link",!0)}(f,d),function(t,n){var r=t.selectAll(".rna-base").data(n).enter().append("svg:g").attr("transform",(function(t){return"translate("+t.x+","+t.y+")"}));r.append("svg:circle").attr("r",e.nucleotideRadius).classed("rna-base",!0),e.showNucleotideLabels&&r.append("svg:text").text((function(t){return t.name})).attr("text-anchor","middle").attr("dominant-baseline","central").classed("nucleotide-label",!0).append("svg:title").text((function(t){return t.struct_name+":"+t.num}))}(f,h),function(t,n){t.selectAll(".rnaLabel").data(n).enter().append("svg:g").attr("transform",(function(t){return"translate("+t.x+","+t.y+")"})).append("svg:text").text((function(t){return t.name})).attr("text-anchor","middle").attr("font-weight","bold").attr("dominant-baseline","central").classed("number-label",!0)}(f,p),function(r,o){r.append("svg:text").attr("transform","translate("+t.invert(e.width/2)+","+n.invert(e.height)+")").attr("dy",-10).classed("rna-name",!0).text(o)}(f,a.name),e.bundleExternalLinks&&function(t,n){var e={},r=[];n=n.filter((function(t){return"correct"==t.linkType||"incorrect"==t.linkType||"extra"==t.linkType})),t.selectAll("[link-type=extra]").remove();for(var o=0;o<n.length;o++)null!==n[o].source&&null!==n[o].target&&(e[n[o].source.uid]=n[o].source,e[n[o].target.uid]=n[o].target,r.push({source:n[o].source.uid,target:n[o].target.uid,linkType:n[o].linkType,extraLinkType:n[o].extraLinkType}));var a=d3.ForceEdgeBundling().nodes(e).edges(r).compatibility_threshold(.8).step_size(.2)(),i=d3.svg.line().x((function(t){return t.x})).y((function(t){return t.y})).interpolate("linear");for(o=0;o<a.length;o++){var u=a[o];t.append("path").attr("d",i(u)).style("fill","none").attr("link-type",(function(t){return r[o].linkType})).attr("extra-link-type",(function(t){return r[o].extraLinkType})).style("stroke-opacity",.4)}}(f,d)}))}return a.width=function(t){return arguments.length?(e.width=t,a):e.width},a.height=function(t){return arguments.length?(e.height=t,a):e.height},a.showNucleotideLabels=function(t){return arguments.length?(e.showNucleotideLabels=t,a):e.showNucleotideLabels},a.rnaEdgePadding=function(t){return arguments.length?(e.rnaEdgePadding=t,a):e.rnaEdgePadding},a.nucleotideRadius=function(t){return arguments.length?(e.nucleotideRadius=t,a):e.nucleotideRadius},a.labelInterval=function(t){return arguments.length?(e.labelInterval=t,a):e.labelInterval},a.showNucleotideLabels=function(t){return arguments.length?(e.showNucleotideLabels=t,a):e.showNucleotideLabels},a.startNucleotideNumber=function(t){return arguments.length?(e.startNucleotideNumber=t,a):e.startNucleotideNumber},a.bundleExternalLinks=function(t){return arguments.length?(e.bundleExternalLinks=t,a):e.bundleExternalLinks},a},e(4);var r=e(1),o=e(5);e(2),e(11),void 0===String.prototype.trim&&(String.prototype.trim=function(){return String(this).replace(/^\s+|\s+$/g,"")})},function(t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.simpleXyCoordinates=function(t){var n,e,r,o=[],a=[];e=t[0];var i=Array.apply(null,new Array(e+5)).map(Number.prototype.valueOf,0),u=Array.apply(null,new Array(16+Math.floor(e/5))).map(Number.prototype.valueOf,0),s=Array.apply(null,new Array(16+Math.floor(e/5))).map(Number.prototype.valueOf,0),l=0,c=0,f=Math.PI/2;(function t(n,e,r){var o,a,h,p,d,m,g,v,y,b,x,M,w=2,_=0,k=0,S=Array.apply(null,new Array(3+2*Math.floor((e-n)/5))).map(Number.prototype.valueOf,0);for(o=n-1,e++;n!=e;)if((a=r[n])&&0!=n){w+=2,h=n,p=a,S[++_]=h,S[++_]=p,n=a+1,d=h,m=p,v=0;do{h++,p--,v++}while(r[h]==p&&r[h]>h);if(g=v-2,v>=2&&(i[d+1+g]+=f,i[m-1-g]+=f,i[d]+=f,i[m]+=f,v>2))for(;g>=1;g--)i[d+g]=Math.PI,i[m-g]=Math.PI;s[++c]=v,h<=p&&t(h,p,r)}else n++,w++,k++;for(M=Math.PI*(w-2)/w,S[++_]=e,y=o<0?0:o,b=1;b<=_;b++){for(x=S[b]-y,g=0;g<=x;g++)i[y+g]+=M;if(b>_)break;y=S[++b]}u[++l]=k})(0,e+1,t),u[l]-=2,r=0,o[0]=100,a[0]=100;var h=[];for(h.push([o[0],a[0]]),n=1;n<e;n++)o[n]=o[n-1]+15*Math.cos(r),a[n]=a[n-1]+15*Math.sin(r),h.push([o[n],a[n]]),r+=Math.PI-i[n+1];return h}},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.NAView=s;var r=e(6),o=e(7),a=e(9),i=e(10),u=e(8);function s(){this.ANUM=9999,this.MAXITER=500,this.bases=[],this.nbase=null,this.nregion=null,this.loop_count=null,this.root=new u.Loop,this.loops=[],this.regions=[],this.rlphead=new r.Radloop,this.lencut=.8,this.RADIUS_REDUCTION_FACTOR=1.4,this.angleinc=null,this._h=null,this.HELIX_FACTOR=.6,this.BACKBONE_DISTANCE=27}function l(){var t=new u.Loop,n=null,e=null;for(n=0;n<this.loop_count;n++){for(t=this.loops[n],e=0;e<this.loop_count;e++)this.loops[e].setMark(!1);t.setDepth(c(t))}}function c(t){var n=null,e=null,r=null;if(t.getNconnection()<=1)return 0;if(t.isMark())return-1;t.setMark(!0),n=0,e=0;for(var o=0;null!=t.getConnection(o);o++)(r=c(t.getConnection(o).getLoop()))>=0&&(1==++n?e=r:e>r&&(e=r));return t.setMark(!1),e+1}s.prototype.naview_xy_coordinates=function(t){var n,e=[],r=[];if(0===t.length||0===t[0])return 0;this.nbase=t[0],this.bases=[];for(var o=0;o<this.nbase+1;o++)this.bases.push(new i.Base);for(this.regions=[],o=0;o<this.nbase+1;o++)this.regions.push(new a.Region);for(this.read_in_bases(t),this.rlphead=null,this.find_regions(),this.loop_count=0,this.loops=[],o=0;o<this.nbase+1;o++)this.loops.push(new u.Loop);for(this.construct_loop(0),this.find_central_loop(),this.traverse_loop(this.root,null),n=0;n<this.nbase;n++)e.push(100+this.BACKBONE_DISTANCE*this.bases[n+1].getX()),r.push(100+this.BACKBONE_DISTANCE*this.bases[n+1].getY());return{nbase:this.nbase,x:e,y:r}},s.prototype.read_in_bases=function(t){var n=null,e=null;for(this.bases.push(new i.Base),this.bases[0].setMate(0),this.bases[0].setExtracted(!1),this.bases[0].setX(this.ANUM),this.bases[0].setY(this.ANUM),e=0,n=1;n<=this.nbase;n++)this.bases.push(new i.Base),this.bases[n].setExtracted(!1),this.bases[n].setX(this.ANUM),this.bases[n].setY(this.ANUM),this.bases[n].setMate(t[n]),t[n]>n&&e++;0==e&&(this.bases[1].setMate(this.nbase),this.bases[this.nbase].setMate(1))},s.prototype.find_regions=function(){var t,n=null,e=null;t=this.nbase+1;var r=[];for(n=0;n<t;n++)r.push(!1);for(this.nregion=0,n=0;n<=this.nbase;n++)if(0!=(e=this.bases[n].getMate())&&!r[n]){for(this.regions[this.nregion].setStart1(n),this.regions[this.nregion].setEnd2(e),r[n]=!0,r[e]=!0,this.bases[n].setRegion(this.regions[this.nregion]),this.bases[e].setRegion(this.regions[this.nregion]),n++,e--;n<e&&this.bases[n].getMate()==e;n++,e--)r[e]=!0,r[n]=!0,this.bases[n].setRegion(this.regions[this.nregion]),this.bases[e].setRegion(this.regions[this.nregion]);this.regions[this.nregion].setEnd1(--n),this.regions[this.nregion].setStart2(e+1),this.nregion++}},s.prototype.construct_loop=function(t){var n=null,e=null,i=new u.Loop,s=new u.Loop,l=new o.Connection,c=new a.Region,f=new r.Radloop;for((i=this.loops[this.loop_count++]).setNconnection(0),i.setDepth(0),i.setNumber(this.loop_count),i.setRadius(0),f=this.rlphead;null!=f;f=f.getNext())f.getLoopnumber()==this.loop_count&&i.setRadius(f.getRadius());n=t;do{0!=(e=this.bases[n].getMate())&&(c=this.bases[n].getRegion(),this.bases[c.getStart1()].isExtracted()||(n==c.getStart1()?(this.bases[c.getStart1()].setExtracted(!0),this.bases[c.getEnd1()].setExtracted(!0),this.bases[c.getStart2()].setExtracted(!0),this.bases[c.getEnd2()].setExtracted(!0),s=this.construct_loop(c.getEnd1()<this.nbase?c.getEnd1()+1:0)):n==c.getStart2()?(this.bases[c.getStart2()].setExtracted(!0),this.bases[c.getEnd2()].setExtracted(!0),this.bases[c.getStart1()].setExtracted(!0),this.bases[c.getEnd1()].setExtracted(!0),s=this.construct_loop(c.getEnd2()<this.nbase?c.getEnd2()+1:0)):console.log("Something went terribly wrong ...."),i.setNconnection(i.getNconnection()+1),l=new o.Connection,i.setConnection(i.getNconnection()-1,l),i.setConnection(i.getNconnection(),null),l.setLoop(s),l.setRegion(c),n==c.getStart1()?(l.setStart(c.getStart1()),l.setEnd(c.getEnd2())):(l.setStart(c.getStart2()),l.setEnd(c.getEnd1())),l.setExtruded(!1),l.setBroken(!1),s.setNconnection(s.getNconnection()+1),l=new o.Connection,s.setConnection(s.getNconnection()-1,l),s.setConnection(s.getNconnection(),null),l.setLoop(i),l.setRegion(c),n==c.getStart1()?(l.setStart(c.getStart2()),l.setEnd(c.getEnd1())):(l.setStart(c.getStart1()),l.setEnd(c.getEnd2())),l.setExtruded(!1),l.setBroken(!1)),n=e),++n>this.nbase&&(n=0)}while(n!=t);return i},s.prototype.find_central_loop=function(){var t=new u.Loop,n=null,e=null,r=null;for(l.bind(this)(),n=0,e=-1,r=0;r<this.loop_count;r++)(t=this.loops[r]).getNconnection()>n?(e=t.getDepth(),n=t.getNconnection(),this.root=t):t.getDepth()>e&&t.getNconnection()==n&&(e=t.getDepth(),this.root=t)},s.prototype.traverse_loop=function(t,n){var e,r,o,a,i,u,s,l,c,f,h,p,d,m,g,v,y,b,x,M,w,_,k,S,A,E,T,R,N,P,C,O,L,U,D,z,q,j,F,B,I,X,Y,V,H,G,W,Z,J,$,K,Q,tt,nt,et,rt,ot,at,it,ut,st,lt,ct,ft,ht,pt,dt,mt,gt,vt=0;u=2*Math.PI/(this.nbase+1),b=null,P=-1;var yt=0;for(k=0;null!=(v=t.getConnection(yt));yt++,k++)e=-Math.sin(u*v.getStart()),r=Math.cos(u*v.getStart()),o=-Math.sin(u*v.getEnd()),a=Math.cos(u*v.getEnd())-r,i=e-o,s=Math.sqrt(a*a+i*i),v.setXrad(a/s),v.setYrad(i/s),v.setAngle(Math.atan2(i,a)),v.getAngle()<0&&v.setAngle(v.getAngle()+2*Math.PI),null!=n&&n.getRegion()==v.getRegion()&&(b=v,P=k);t:for(;;){this.determine_radius(t,this.lencut),l=t.getRadius()/this.RADIUS_REDUCTION_FACTOR,null==n?c=f=0:(h=(this.bases[b.getStart()].getX()+this.bases[b.getEnd()].getX())/2,p=(this.bases[b.getStart()].getY()+this.bases[b.getEnd()].getY())/2,c=h-l*b.getXrad(),f=p-l*b.getYrad()),T=-1==P?0:P,v=t.getConnection(T),E=0,C=!1;do{if((w=T-1)<0&&(w=t.getNconnection()-1),x=t.getConnection(w),this.connected_connection(x,v)?(T=w,v=x):C=!0,++E>t.getNconnection()){for(A=-1,k=0;k<t.getNconnection();k++)(w=k+1)>=t.getNconnection()&&(w=0),v=t.getConnection(k),(ht=(y=t.getConnection(w)).getAngle()-v.getAngle())<0&&(ht+=2*Math.PI),ht>A&&(A=ht,vt=k);R=vt,(T=vt+1)>=t.getNconnection()&&(T=0),(v=t.getConnection(R)).setBroken(!0),C=!0}}while(!C);for(O=!1,G=T;!O;){for(E=0,C=!1,R=T,L=!1;!C;)if(v=t.getConnection(R),R==P&&(L=!0),(w=R+1)>=t.getNconnection()&&(w=0),y=t.getConnection(w),this.connected_connection(v,y)){if(++E>=t.getNconnection())break;R=w}else C=!0;for(k=W=Z=N=this.find_ic_middle(T,R,n,b,t),C=!1,$=0;!C;)(k=$<0?W:0==$?N:Z)>=0&&(v=t.getConnection(k),null!=n&&b==v||(0==$?(d=v.getAngle()-Math.asin(.5/l),m=v.getAngle()+Math.asin(.5/l),this.bases[v.getStart()].setX(c+l*Math.cos(d)),this.bases[v.getStart()].setY(f+l*Math.sin(d)),this.bases[v.getEnd()].setX(c+l*Math.cos(m)),this.bases[v.getEnd()].setY(f+l*Math.sin(m))):$<0?((w=k+1)>=t.getNconnection()&&(w=0),v=t.getConnection(k),y=t.getConnection(w),et=v.getXrad(),rt=v.getYrad(),ht=(v.getAngle()+y.getAngle())/2,v.getAngle()>y.getAngle()&&(ht-=Math.PI),it=Math.cos(ht),lt=Math.sin(ht),ct=-it,(S=y.getAngle()-v.getAngle())<0&&(S+=2*Math.PI),ft=v.isExtruded()?S<=Math.PI/2?2:1.5:1,this.bases[v.getEnd()].setX(this.bases[y.getStart()].getX()+ft*lt),this.bases[v.getEnd()].setY(this.bases[y.getStart()].getY()+ft*ct),this.bases[v.getStart()].setX(this.bases[v.getEnd()].getX()+rt),this.bases[v.getStart()].setY(this.bases[v.getEnd()].getY()-et)):((w=k-1)<0&&(w=t.getNconnection()-1),v=t.getConnection(w),ot=(y=t.getConnection(k)).getXrad(),at=y.getYrad(),ht=(v.getAngle()+y.getAngle())/2,v.getAngle()>y.getAngle()&&(ht-=Math.PI),it=Math.cos(ht),lt=-Math.sin(ht),ct=it,(S=y.getAngle()-v.getAngle())<0&&(S+=2*Math.PI),ft=v.isExtruded()?S<=Math.PI/2?2:1.5:1,this.bases[y.getStart()].setX(this.bases[v.getEnd()].getX()+ft*lt),this.bases[y.getStart()].setY(this.bases[v.getEnd()].getY()+ft*ct),this.bases[y.getEnd()].setX(this.bases[y.getStart()].getX()-at),this.bases[y.getEnd()].setY(this.bases[y.getStart()].getY()+ot)))),$<0?(Z==R?Z=-1:Z>=0&&++Z>=t.getNconnection()&&(Z=0),$=1):(W==T?W=-1:W>=0&&--W<0&&(W=t.getNconnection()-1),$=-1),C=-1==W&&-1==Z;if((J=R+1)>=t.getNconnection()&&(J=0),R!=T&&(T!=G||J!=G))if(v=t.getConnection(T),y=t.getConnection(R),Q=this.bases[y.getEnd()].getX()-this.bases[v.getStart()].getX(),tt=this.bases[y.getEnd()].getY()-this.bases[v.getStart()].getY(),D=this.bases[v.getStart()].getX()+Q/2,z=this.bases[v.getStart()].getY()+tt/2,F=Q/(nt=Math.sqrt(Q*Q+tt*tt)),B=tt/nt,I=c-D,X=f-z,q=(Y=(I/=nt=Math.sqrt(Q*Q+tt*tt))*F+(X/=nt)*B)*F-I,j=Y*B-X,q/=nt=Math.sqrt(q*q+j*j),j/=nt,Q=this.bases[v.getStart()].getX()-c,tt=this.bases[v.getStart()].getY()-f,(ht=Math.atan2(tt,Q))<0&&(ht+=2*Math.PI),Q=this.bases[y.getEnd()].getX()-c,tt=this.bases[y.getEnd()].getY()-f,(pt=Math.atan2(tt,Q))<0&&(pt+=2*Math.PI),pt<ht&&(pt+=2*Math.PI),V=c+(U=pt-ht>Math.PI?-1:1)*l*q,H=f+U*l*j,L)c-=V-D,f-=H-z;else for(k=T;M=(v=t.getConnection(k)).getStart(),this.bases[M].setX(this.bases[M].getX()+V-D),this.bases[M].setY(this.bases[M].getY()+H-z),M=v.getEnd(),this.bases[M].setX(this.bases[M].getX()+V-D),this.bases[M].setY(this.bases[M].getY()+H-z),k!=R;)++k>=t.getNconnection()&&(k=0);O=(T=J)==G}for(k=0;k<t.getNconnection();k++){if(v=t.getConnection(k),(w=k+1)>=t.getNconnection()&&(w=0),y=t.getConnection(w),Q=this.bases[v.getEnd()].getX()-c,tt=this.bases[v.getEnd()].getY()-f,st=Math.sqrt(Q*Q+tt*tt),(ht=Math.atan2(tt,Q))<0&&(ht+=2*Math.PI),Q=this.bases[y.getStart()].getX()-c,tt=this.bases[y.getStart()].getY()-f,ut=Math.sqrt(Q*Q+tt*tt),(pt=Math.atan2(tt,Q))<0&&(pt+=2*Math.PI),pt<ht&&(pt+=2*Math.PI),K=pt-ht,(gt=y.getAngle()-v.getAngle())<=0&&(gt+=2*Math.PI),Math.abs(K-gt)>Math.PI)if(v.isExtruded())console.log("Warning from traverse_loop. Loop "+t.getNumber()+" has crossed regions\n");else if(y.getStart()-v.getEnd()!=1){v.setExtruded(!0);continue t}if(v.isExtruded())this.construct_extruded_segment(v,y);else for((_=y.getStart()-v.getEnd())<0&&(_+=this.nbase+1),u=K/_,w=1;w<_;w++)(M=v.getEnd()+w)>this.nbase&&(M-=this.nbase+1),nt=st+(ut-st)*((g=ht+w*u)-ht)/K,this.bases[M].setX(c+nt*Math.cos(g)),this.bases[M].setY(f+nt*Math.sin(g))}break}for(k=0;k<t.getNconnection();k++)P!=k&&(v=t.getConnection(k),this.generate_region(v),this.traverse_loop(v.getLoop(),v));for(_=0,dt=0,mt=0,k=0;k<t.getNconnection();k++)if((w=k+1)>=t.getNconnection()&&(w=0),v=t.getConnection(k),y=t.getConnection(w),_+=2,dt+=this.bases[v.getStart()].getX()+this.bases[v.getEnd()].getX(),mt+=this.bases[v.getStart()].getY()+this.bases[v.getEnd()].getY(),!v.isExtruded())for(w=v.getEnd()+1;w!=y.getStart();w++)w>this.nbase&&(w-=this.nbase+1),_++,dt+=this.bases[w].getX(),mt+=this.bases[w].getY();t.setX(dt/_),t.setY(mt/_)},s.prototype.determine_radius=function(t,n){var e,r,a,i,u,s,l,c,f,h,p,d=0,m=new o.Connection,g=new o.Connection;do{for(e=1e10,u=0,i=0,c=0;c<t.getNconnection();c++)m=t.getConnection(c),(f=c+1)>=t.getNconnection()&&(f=0),g=t.getConnection(f),h=m.getEnd(),(p=g.getStart())<h&&(p+=this.nbase+1),(a=g.getAngle()-m.getAngle())<=0&&(a+=2*Math.PI),i+=a*(1/(r=m.isExtruded()?a<=Math.PI/2?2:1.5:p-h)+1),u+=a*a/r,(l=a/r)<e&&!m.isExtruded()&&r>1&&(e=l,d=c);(s=i/u)<.7071068&&(s=.7071068),e*s<n&&t.getConnection(d).setExtruded(!0)}while(e*s<n);t.getRadius()>0?s=t.getRadius():t.setRadius(s)},s.prototype.find_ic_middle=function(t,n,e,r,o){var a,i,u,s,l;for(a=0,i=-1,u=t,l=!1;!l;)a++>2*o.getNconnection()&&console.log("Infinite loop in 'find_ic_middle'"),null!=e&&o.getConnection(u)==r&&(i=u),l=u==n,++u>=o.getNconnection()&&(u=0);if(-1==i){for(s=1,u=t;s<(a+1)/2;s++)++u>=o.getNconnection()&&(u=0);i=u}return i},s.prototype.construct_extruded_segment=function(t,n){var e,r,o,a,i,u,s,l,c,f,h,p,d,m,g,v,y,b;if(e=t.getAngle(),(o=r=n.getAngle())<e&&(o+=2*Math.PI),a=(e+o)/2,d=t.getEnd(),(g=(m=n.getStart())-d)<0&&(g+=this.nbase+1),(h=n.getAngle()-t.getAngle())<0&&(h+=2*Math.PI),2==g)this.construct_circle_segment(d,m);else{i=this.bases[m].getX()-this.bases[d].getX(),u=this.bases[m].getY()-this.bases[d].getY(),i/=f=Math.sqrt(i*i+u*u),u/=f,f>=1.5&&h<=Math.PI/2&&((v=d+1)>this.nbase&&(v-=this.nbase+1),(y=m-1)<0&&(y+=this.nbase+1),this.bases[v].setX(this.bases[d].getX()+.5*i),this.bases[v].setY(this.bases[d].getY()+.5*u),this.bases[y].setX(this.bases[m].getX()-.5*i),this.bases[y].setY(this.bases[m].getY()-.5*u),d=v,m=y);do{b=!1,this.construct_circle_segment(d,m),(v=d+1)>this.nbase&&(v-=this.nbase+1),i=this.bases[v].getX()-this.bases[d].getX(),u=this.bases[v].getY()-this.bases[d].getY(),(s=Math.atan2(u,i))<0&&(s+=2*Math.PI),(p=s-e)<0&&(p+=2*Math.PI),p>Math.PI&&(b=!0),(y=m-1)<0&&(y+=this.nbase+1),i=this.bases[y].getX()-this.bases[m].getX(),u=this.bases[y].getY()-this.bases[m].getY(),(l=Math.atan2(u,i))<0&&(l+=2*Math.PI),(p=r-l)<0&&(p+=2*Math.PI),p>Math.PI&&(b=!0),b&&(c=this.minf2(a,e+.5),this.bases[v].setX(this.bases[d].getX()+Math.cos(c)),this.bases[v].setY(this.bases[d].getY()+Math.sin(c)),d=v,c=this.maxf2(a,o-.5),this.bases[y].setX(this.bases[m].getX()+Math.cos(c)),this.bases[y].setY(this.bases[m].getY()+Math.sin(c)),m=y,g-=2)}while(b&&g>1)}},s.prototype.construct_circle_segment=function(t,n){var e,r,o,a,i,u,s,l,c,f,h,p,d,m,g;if(e=this.bases[n].getX()-this.bases[t].getX(),r=this.bases[n].getY()-this.bases[t].getY(),o=Math.sqrt(e*e+r*r),(d=n-t)<0&&(d+=this.nbase+1),o>=d)for(e/=o,r/=o,m=1;m<d;m++)(g=t+m)>this.nbase&&(g-=this.nbase+1),this.bases[g].setX(this.bases[t].getX()+e*m/d),this.bases[g].setY(this.bases[t].getY()+r*m/d);else for(this.find_center_for_arc(d-1,o),e/=o,r/=o,a=this.bases[t].getX()+e*o/2,i=this.bases[t].getY()+r*o/2,u=r,s=-e,l=a+this._h*u,c=i+this._h*s,f=this.bases[t].getX()-l,h=this.bases[t].getY()-c,o=Math.sqrt(f*f+h*h),p=Math.atan2(h,f),m=1;m<d;m++)(g=t+m)>this.nbase&&(g-=this.nbase+1),this.bases[g].setX(l+o*Math.cos(p+m*this.angleinc)),this.bases[g].setY(c+o*Math.sin(p+m*this.angleinc))},s.prototype.find_center_for_arc=function(t,n){var e,r,o,a,i,u,s,l;o=-(r=(t+1)/Math.PI)-n/(t+1.000001-n),n<1&&(o=0),l=0;do{e=(r+o)/2,i=1-.5/((a=Math.sqrt(e*e+n*n/4))*a),Math.abs(i)>1&&console.log("Unexpected large magnitude discriminant = "+i+" "+a),(s=(u=Math.acos(i))*(t+1)+2*Math.acos(e/a)-2*Math.PI)>0?o=e:r=e}while(Math.abs(s)>1e-4&&++l<this.MAXITER);l>=this.MAXITER&&(noIterationFailureYet&&(console.log("Iteration failed in find_center_for_arc"),noIterationFailureYet=!1),e=0,u=0),this._h=e,this.angleinc=u},s.prototype.generate_region=function(t){var n,e,r,o,a,i;for(i=t.getRegion(),n=0,t.getStart()==i.getStart1()?(e=i.getStart1(),r=i.getEnd1()):(e=i.getStart2(),r=i.getEnd2()),(this.bases[t.getStart()].getX()>this.ANUM-100||this.bases[t.getEnd()].getX()>this.ANUM-100)&&console.log("Bad region passed to generate_region. Coordinates not defined."),o=e+1;o<=r;o++)n++,this.bases[o].setX(this.bases[t.getStart()].getX()+this.HELIX_FACTOR*n*t.getXrad()),this.bases[o].setY(this.bases[t.getStart()].getY()+this.HELIX_FACTOR*n*t.getYrad()),a=this.bases[o].getMate(),this.bases[a].setX(this.bases[t.getEnd()].getX()+this.HELIX_FACTOR*n*t.getXrad()),this.bases[a].setY(this.bases[t.getEnd()].getY()+this.HELIX_FACTOR*n*t.getYrad())},s.prototype.minf2=function(t,n){return t<n?t:n},s.prototype.maxf2=function(t,n){return t>n?t:n},s.prototype.connected_connection=function(t,n){return!!t.isExtruded()||t.getEnd()+1==n.getStart()}},function(t,n){"use strict";function e(){this.radius=null,this.loopnumber=null,this.next=null,this.prev=null}Object.defineProperty(n,"__esModule",{value:!0}),n.Radloop=e,e.prototype.getRadius=function(){return this.radius},e.prototype.setRadius=function(t){this.radius=t},e.prototype.getLoopnumber=function(){return this.loopnumber},e.prototype.setLoopnumber=function(t){this.loopnumber=t},e.prototype.getNext=function(){return this.next},e.prototype.setNext=function(t){this.next=t},e.prototype.getPrev=function(){return this.prev},e.prototype.setPrev=function(t){this.prev=t}},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.Connection=a;var r=e(8),o=e(9);function a(){this.loop=new r.Loop,this.region=new o.Region,this.start=null,this.end=null,this.xrad=null,this.yrad=null,this.angle=null,this.extruded=null,this.broken=null,this._isNull=!1}a.prototype.isNull=function(){return this._isNull},a.prototype.setNull=function(t){this._isNull=t},a.prototype.getLoop=function(){return this.loop},a.prototype.setLoop=function(t){this.loop=t},a.prototype.getRegion=function(){return this.region},a.prototype.setRegion=function(t){this.region=t},a.prototype.getStart=function(){return this.start},a.prototype.setStart=function(t){this.start=t},a.prototype.getEnd=function(){return this.end},a.prototype.setEnd=function(t){this.end=t},a.prototype.getXrad=function(){return this.xrad},a.prototype.setXrad=function(t){this.xrad=t},a.prototype.getYrad=function(){return this.yrad},a.prototype.setYrad=function(t){this.yrad=t},a.prototype.getAngle=function(){return this.angle},a.prototype.setAngle=function(t){this.angle=t},a.prototype.isExtruded=function(){return this.extruded},a.prototype.setExtruded=function(t){this.extruded=t},a.prototype.isBroken=function(){return this.broken},a.prototype.setBroken=function(t){this.broken=t}},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.Loop=o;var r=e(7);function o(){this.nconnection=null,this.connections=[],this._connections=[],this.number=null,this.depth=null,this.mark=null,this.x=null,this.y=null,this.radius=null}o.prototype.getNconnection=function(){return this.nconnection},o.prototype.setNconnection=function(t){this.nconnection=t},o.prototype.setConnection=function(t,n){null!=n?this._connections[t]=n:(this._connections[t]||(this._connections[t]=new r.Connection),this._connections[t].setNull(!0))},o.prototype.getConnection=function(t){var n=e(7);this._connections[t]||(this._connections[t]=new n);var r=this._connections[t];return r.isNull()?null:r},o.prototype.addConnection=function(t,n){this._connections.push(n)},o.prototype.getNumber=function(){return this.number},o.prototype.setNumber=function(t){this.number=t},o.prototype.getDepth=function(){return this.depth},o.prototype.setDepth=function(t){this.depth=t},o.prototype.isMark=function(){return this.mark},o.prototype.setMark=function(t){this.mark=t},o.prototype.getX=function(){return this.x},o.prototype.setX=function(t){this.x=t},o.prototype.getY=function(){return this.y},o.prototype.setY=function(t){this.y=t},o.prototype.getRadius=function(){return this.radius},o.prototype.setRadius=function(t){this.radius=t}},function(t,n){"use strict";function e(){this._start1=null,this._end1=null,this._start2=null,this._end2=null}Object.defineProperty(n,"__esModule",{value:!0}),n.Region=e,e.prototype.getStart1=function(){return this._start1},e.prototype.setStart1=function(t){this._start1=t},e.prototype.getEnd1=function(){return this._end1},e.prototype.setEnd1=function(t){this._end1=t},e.prototype.getStart2=function(){return this._start2},e.prototype.setStart2=function(t){this._start2=t},e.prototype.getEnd2=function(){return this._end2},e.prototype.setEnd2=function(t){this._end2=t}},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.Base=o;var r=e(9);function o(){this.mate=null,this.x=null,this.y=null,this.extracted=null,this.region=new r.Region}o.prototype.getMate=function(){return this.mate},o.prototype.setMate=function(t){this.mate=t},o.prototype.getX=function(){return this.x},o.prototype.setX=function(t){this.x=t},o.prototype.getY=function(){return this.y},o.prototype.setY=function(t){this.y=t},o.prototype.isExtracted=function(){return this.extracted},o.prototype.setExtracted=function(t){this.extracted=t},o.prototype.getRegion=function(){return this.region},o.prototype.setRegion=function(t){this.region=t}},function(t,n,e){var r=e(12);"string"==typeof r&&(r=[[t.id,r,""]]),e(14)(r,{}),r.locals&&(t.exports=r.locals)},function(t,n,e){(t.exports=e(13)()).push([t.id,'.forna-container .structure-background-rect {\r\n    stroke: black;\r\n    stroke-width: 5;\r\n    fill: transparent;\r\n}\r\n\r\n.forna-container circle.rna-base {\r\n  stroke: #ccc;\r\n  stroke-width: 1px;\r\n  opacity: 1;\r\n  fill: white;\r\n}\r\n\r\n.forna-container circle.rna-base.label {\r\n    stroke: transparent;\r\n    stroke-width: 0;\r\n    fill: white;\r\n}\r\n\r\n.forna-container line.link {\r\n  stroke: #999;\r\n  stroke-opacity: 0.8;\r\n  stroke-width: 2;\r\n}\r\n\r\n.forna-container line.rna-link {\r\n  stroke: #999;\r\n  stroke-opacity: 0.8;\r\n  stroke-width: 2;\r\n}\r\n\r\n.forna-container .overlay {\r\n    fill: transparent;\r\n}\r\n\r\n.forna-container .rna-name {\r\n    text-anchor: middle;\r\n    dy: -10;\r\n    font-family: Tahoma, Geneva, sans-serif;\r\n    font-size: 8pt;\r\n}\r\n\r\n.forna-container line.rna-link[link-type="backbone"] {\r\n    stroke: transparent;\r\n}\r\n\r\n.forna-container line.rna-link[link-type="basepair"] {\r\n    stroke: transparent;\r\n}\r\n\r\n.forna-container line.rna-link[link-type="fake"] {\r\n    stroke: transparent;\r\n}\r\n\r\n.forna-container line.rna-link[link-type="extra"] {\r\n    stroke: grey;\r\n}\r\n\r\n.forna-container line.rna-link[extra-link-type="correct"] {\r\n    stroke: green;\r\n}\r\n\r\n.forna-container line.rna-link[extra-link-type="incorrect"] {\r\n    stroke: green;\r\n}\r\n\r\n\r\n.forna-container path {\r\n    stroke-width: 2;\r\n}\r\n\r\n.forna-container path[extra-link-type="correct"] {\r\n    stroke: green;\r\n}\r\n\r\n.forna-container path[extra-link-type="incorrect"] {\r\n    stroke: red;\r\n}\r\n\r\n\r\n.forna-container line.basepair {\r\n  stroke: red;\r\n}\r\n\r\n.forna-container line.intermolecule {\r\n  stroke: blue;\r\n}\r\n\r\n.forna-container line.chain_chain {\r\n  stroke-dasharray: 3,3;\r\n}\r\n\r\n.forna-container line.fake {\r\n  stroke: green;\r\n}\r\n\r\n.forna-container .transparent {\r\n    fill: transparent;\r\n    stroke-width: 0;\r\n    stroke-opacity: 0;\r\n    opacity: 0;\r\n}\r\n\r\n.forna-container .d3-tip {\r\n    line-height: 1;\r\n    font-weight: bold;\r\n    padding: 6px;\r\n    background: rgba(0, 0, 0, 0.6);\r\n    color: #fff;\r\n    border-radius: 4px;\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container text.nucleotide-label {\r\n    font-size: 5.5pt;\r\n    font-weight: bold;\r\n    font-family: Tahoma, Geneva, sans-serif;\r\n    color: rgb(100,100,100);\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container text.number-label {\r\n    font-size: 5.5pt;\r\n    font-weight: bold;\r\n    font-family: Tahoma, Geneva, sans-serif;\r\n    color: rgb(100,100,100);\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container text {\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container g.gnode {\r\n\r\n}\r\n\r\n.forna-container .brush .extent {\r\n  fill-opacity: .1;\r\n  stroke: #fff;\r\n  shape-rendering: crispEdges;\r\n}\r\n\r\n.forna-container .noselect {\r\n    -webkit-touch-callout: none;\r\n    -webkit-user-select: none;\r\n    -khtml-user-select: none;\r\n    -moz-user-select: none;\r\n    -ms-user-select: none;\r\n    user-select: none;\r\n}\r\n',""])},function(t,n){t.exports=function(){var t=[];return t.toString=function(){for(var t=[],n=0;n<this.length;n++){var e=this[n];e[2]?t.push("@media "+e[2]+"{"+e[1]+"}"):t.push(e[1])}return t.join("")},t.i=function(n,e){"string"==typeof n&&(n=[[null,n,""]]);for(var r={},o=0;o<this.length;o++){var a=this[o][0];"number"==typeof a&&(r[a]=!0)}for(o=0;o<n.length;o++){var i=n[o];"number"==typeof i[0]&&r[i[0]]||(e&&!i[2]?i[2]=e:e&&(i[2]="("+i[2]+") and ("+e+")"),t.push(i))}},t}},function(t,n,e){var r={},o=function(t){var n;return function(){return void 0===n&&(n=t.apply(this,arguments)),n}},a=o((function(){return/msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase())})),i=o((function(){return document.head||document.getElementsByTagName("head")[0]})),u=null,s=0,l=[];function c(t,n){for(var e=0;e<t.length;e++){var o=t[e],a=r[o.id];if(a){a.refs++;for(var i=0;i<a.parts.length;i++)a.parts[i](o.parts[i]);for(;i<o.parts.length;i++)a.parts.push(m(o.parts[i],n))}else{var u=[];for(i=0;i<o.parts.length;i++)u.push(m(o.parts[i],n));r[o.id]={id:o.id,refs:1,parts:u}}}}function f(t){for(var n=[],e={},r=0;r<t.length;r++){var o=t[r],a=o[0],i={css:o[1],media:o[2],sourceMap:o[3]};e[a]?e[a].parts.push(i):n.push(e[a]={id:a,parts:[i]})}return n}function h(t,n){var e=i(),r=l[l.length-1];if("top"===t.insertAt)r?r.nextSibling?e.insertBefore(n,r.nextSibling):e.appendChild(n):e.insertBefore(n,e.firstChild),l.push(n);else{if("bottom"!==t.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");e.appendChild(n)}}function p(t){t.parentNode.removeChild(t);var n=l.indexOf(t);n>=0&&l.splice(n,1)}function d(t){var n=document.createElement("style");return n.type="text/css",h(t,n),n}function m(t,n){var e,r,o;if(n.singleton){var a=s++;e=u||(u=d(n)),r=y.bind(null,e,a,!1),o=y.bind(null,e,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(e=function(t){var n=document.createElement("link");return n.rel="stylesheet",h(t,n),n}(n),r=x.bind(null,e),o=function(){p(e),e.href&&URL.revokeObjectURL(e.href)}):(e=d(n),r=b.bind(null,e),o=function(){p(e)});return r(t),function(n){if(n){if(n.css===t.css&&n.media===t.media&&n.sourceMap===t.sourceMap)return;r(t=n)}else o()}}t.exports=function(t,n){void 0===(n=n||{}).singleton&&(n.singleton=a()),void 0===n.insertAt&&(n.insertAt="bottom");var e=f(t);return c(e,n),function(t){for(var o=[],a=0;a<e.length;a++){var i=e[a];(u=r[i.id]).refs--,o.push(u)}for(t&&c(f(t),n),a=0;a<o.length;a++){var u;if(0===(u=o[a]).refs){for(var s=0;s<u.parts.length;s++)u.parts[s]();delete r[u.id]}}}};var g,v=(g=[],function(t,n){return g[t]=n,g.filter(Boolean).join("\n")});function y(t,n,e,r){var o=e?"":r.css;if(t.styleSheet)t.styleSheet.cssText=v(n,o);else{var a=document.createTextNode(o),i=t.childNodes;i[n]&&t.removeChild(i[n]),i.length?t.insertBefore(a,i[n]):t.appendChild(a)}}function b(t,n){var e=n.css,r=n.media;if(r&&t.setAttribute("media",r),t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}function x(t,n){var e=n.css,r=n.sourceMap;r&&(e+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var o=new Blob([e],{type:"text/css"}),a=t.href;t.href=URL.createObjectURL(o),a&&URL.revokeObjectURL(a)}},function(t,n,e){var r=e(16);"string"==typeof r&&(r=[[t.id,r,""]]),e(14)(r,{}),r.locals&&(t.exports=r.locals)},function(t,n,e){(t.exports=e(13)()).push([t.id,".forna-container svg {\r\n  display: block;\r\n  min-width: 100%;\r\n  width: 100%;\r\n  min-height: 100%;\r\n}\r\n\r\n.forna-container circle.node {\r\n  stroke: #ccc;\r\n  stroke-width: 1px;\r\n  opacity: 1;\r\n  fill: white;\r\n}\r\n\r\n.forna-container polygon.node {\r\n  stroke: #ccc;\r\n  stroke-width: 1px;\r\n  opacity: 1;\r\n  fill: white;\r\n}\r\n\r\n.forna-container circle.node.label {\r\n    stroke: transparent;\r\n    stroke-width: 0;\r\n    fill: white;\r\n    display: inline;\r\n}\r\n\r\n.forna-container circle.outline_node {\r\n    stroke-width: 1px;\r\n    fill: red;\r\n}\r\n\r\n.forna-container circle.protein {\r\n    fill: gray;\r\n    fill-opacity: 0.5;\r\n    stroke-width: 4;\r\n}\r\n\r\n.forna-container circle.hidden_outline {\r\n    stroke-width: 0px;\r\n}\r\n\r\n\r\n.forna-container line.link {\r\n  stroke: #999;\r\n  stroke-opacity: 0.8;\r\n  stroke-width: 2;\r\n}\r\n\r\n.forna-container line.pseudoknot {\r\n    stroke: red;\r\n}\r\n\r\n.forna-container line.basepair {\r\n  stroke: red;\r\n}\r\n\r\n.forna-container line.intermolecule {\r\n  stroke: blue;\r\n}\r\n\r\n.forna-container line.chain_chain {\r\n  stroke-dasharray: 3,3;\r\n}\r\n\r\n.forna-container line.fake {\r\n  stroke: green;\r\n}\r\n\r\n.forna-container .transparent {\r\n    fill: transparent;\r\n    stroke-width: 0;\r\n    stroke-opacity: 0;\r\n    opacity: 0;\r\n    visibility: hidden;\r\n}\r\n\r\n.forna-container .drag_line {\r\n  stroke: #999;\r\n  stroke-width: 2;\r\n  pointer-events: none;\r\n}\r\n\r\n.forna-container .drag_line_hidden {\r\n  stroke: #999;\r\n  stroke-width: 0;\r\n  pointer-events: none;\r\n}\r\n\r\n.forna-container .d3-tip {\r\n    line-height: 1;\r\n    font-weight: bold;\r\n    padding: 6px;\r\n    background: rgba(0, 0, 0, 0.6);\r\n    color: #fff;\r\n    border-radius: 4px;\r\n    pointer-events: none;\r\n          }\r\n\r\n.forna-container text.node-label {\r\n    font-weight: bold;\r\n    font-family: Tahoma, Geneva, sans-serif;\r\n    color: rgb(100,100,100);\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container text {\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container g.gnode {\r\n\r\n}\r\n\r\n.forna-container circle.outline_node.selected {\r\n    visibility: visible;\r\n}\r\n\r\n.forna-container circle.outline_node {\r\n    visibility: hidden;\r\n}\r\n\r\n.forna-container .brush .extent {\r\n  fill-opacity: .1;\r\n  stroke: #fff;\r\n  shape-rendering: crispEdges;\r\n}\r\n\r\n.forna-container .noselect {\r\n    -webkit-touch-callout: none;\r\n    -webkit-user-select: none;\r\n    -khtml-user-select: none;\r\n    -moz-user-select: none;\r\n    -ms-user-select: none;\r\n    user-select: none;\r\n}\r\n",""])},function(t,n,e){var r,o;!function(){var a={version:"3.5.17"},i=[].slice,u=function(t){return i.call(t)},s=this.document;function l(t){return t&&(t.ownerDocument||t.document||t).documentElement}function c(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(s)try{u(s.documentElement.childNodes)[0].nodeType}catch(t){u=function(t){for(var n=t.length,e=new Array(n);n--;)e[n]=t[n];return e}}if(Date.now||(Date.now=function(){return+new Date}),s)try{s.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var f=this.Element.prototype,h=f.setAttribute,p=f.setAttributeNS,d=this.CSSStyleDeclaration.prototype,m=d.setProperty;f.setAttribute=function(t,n){h.call(this,t,n+"")},f.setAttributeNS=function(t,n,e){p.call(this,t,n,e+"")},d.setProperty=function(t,n,e){m.call(this,t,n+"",e)}}function g(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function v(t){return null===t?NaN:+t}function y(t){return!isNaN(t)}function b(t){return{left:function(n,e,r,o){for(arguments.length<3&&(r=0),arguments.length<4&&(o=n.length);r<o;){var a=r+o>>>1;t(n[a],e)<0?r=a+1:o=a}return r},right:function(n,e,r,o){for(arguments.length<3&&(r=0),arguments.length<4&&(o=n.length);r<o;){var a=r+o>>>1;t(n[a],e)>0?o=a:r=a+1}return r}}}a.ascending=g,a.descending=function(t,n){return n<t?-1:n>t?1:n>=t?0:NaN},a.min=function(t,n){var e,r,o=-1,a=t.length;if(1===arguments.length){for(;++o<a;)if(null!=(r=t[o])&&r>=r){e=r;break}for(;++o<a;)null!=(r=t[o])&&e>r&&(e=r)}else{for(;++o<a;)if(null!=(r=n.call(t,t[o],o))&&r>=r){e=r;break}for(;++o<a;)null!=(r=n.call(t,t[o],o))&&e>r&&(e=r)}return e},a.max=function(t,n){var e,r,o=-1,a=t.length;if(1===arguments.length){for(;++o<a;)if(null!=(r=t[o])&&r>=r){e=r;break}for(;++o<a;)null!=(r=t[o])&&r>e&&(e=r)}else{for(;++o<a;)if(null!=(r=n.call(t,t[o],o))&&r>=r){e=r;break}for(;++o<a;)null!=(r=n.call(t,t[o],o))&&r>e&&(e=r)}return e},a.extent=function(t,n){var e,r,o,a=-1,i=t.length;if(1===arguments.length){for(;++a<i;)if(null!=(r=t[a])&&r>=r){e=o=r;break}for(;++a<i;)null!=(r=t[a])&&(e>r&&(e=r),o<r&&(o=r))}else{for(;++a<i;)if(null!=(r=n.call(t,t[a],a))&&r>=r){e=o=r;break}for(;++a<i;)null!=(r=n.call(t,t[a],a))&&(e>r&&(e=r),o<r&&(o=r))}return[e,o]},a.sum=function(t,n){var e,r=0,o=t.length,a=-1;if(1===arguments.length)for(;++a<o;)y(e=+t[a])&&(r+=e);else for(;++a<o;)y(e=+n.call(t,t[a],a))&&(r+=e);return r},a.mean=function(t,n){var e,r=0,o=t.length,a=-1,i=o;if(1===arguments.length)for(;++a<o;)y(e=v(t[a]))?r+=e:--i;else for(;++a<o;)y(e=v(n.call(t,t[a],a)))?r+=e:--i;if(i)return r/i},a.quantile=function(t,n){var e=(t.length-1)*n+1,r=Math.floor(e),o=+t[r-1],a=e-r;return a?o+a*(t[r]-o):o},a.median=function(t,n){var e,r=[],o=t.length,i=-1;if(1===arguments.length)for(;++i<o;)y(e=v(t[i]))&&r.push(e);else for(;++i<o;)y(e=v(n.call(t,t[i],i)))&&r.push(e);if(r.length)return a.quantile(r.sort(g),.5)},a.variance=function(t,n){var e,r,o=t.length,a=0,i=0,u=-1,s=0;if(1===arguments.length)for(;++u<o;)y(e=v(t[u]))&&(i+=(r=e-a)*(e-(a+=r/++s)));else for(;++u<o;)y(e=v(n.call(t,t[u],u)))&&(i+=(r=e-a)*(e-(a+=r/++s)));if(s>1)return i/(s-1)},a.deviation=function(){var t=a.variance.apply(this,arguments);return t?Math.sqrt(t):t};var x=b(g);function M(t){return t.length}a.bisectLeft=x.left,a.bisect=a.bisectRight=x.right,a.bisector=function(t){return b(1===t.length?function(n,e){return g(t(n),e)}:t)},a.shuffle=function(t,n,e){(a=arguments.length)<3&&(e=t.length,a<2&&(n=0));for(var r,o,a=e-n;a;)o=Math.random()*a--|0,r=t[a+n],t[a+n]=t[o+n],t[o+n]=r;return t},a.permute=function(t,n){for(var e=n.length,r=new Array(e);e--;)r[e]=t[n[e]];return r},a.pairs=function(t){for(var n=0,e=t.length-1,r=t[0],o=new Array(e<0?0:e);n<e;)o[n]=[r,r=t[++n]];return o},a.transpose=function(t){if(!(o=t.length))return[];for(var n=-1,e=a.min(t,M),r=new Array(e);++n<e;)for(var o,i=-1,u=r[n]=new Array(o);++i<o;)u[i]=t[i][n];return r},a.zip=function(){return a.transpose(arguments)},a.keys=function(t){var n=[];for(var e in t)n.push(e);return n},a.values=function(t){var n=[];for(var e in t)n.push(t[e]);return n},a.entries=function(t){var n=[];for(var e in t)n.push({key:e,value:t[e]});return n},a.merge=function(t){for(var n,e,r,o=t.length,a=-1,i=0;++a<o;)i+=t[a].length;for(e=new Array(i);--o>=0;)for(n=(r=t[o]).length;--n>=0;)e[--i]=r[n];return e};var w=Math.abs;function _(t){for(var n=1;t*n%1;)n*=10;return n}function k(t,n){for(var e in n)Object.defineProperty(t.prototype,e,{value:n[e],enumerable:!1})}function S(){this._=Object.create(null)}function A(t){return"__proto__"==(t+="")||"\0"===t[0]?"\0"+t:t}function E(t){return"\0"===(t+="")[0]?t.slice(1):t}function T(t){return A(t)in this._}function R(t){return(t=A(t))in this._&&delete this._[t]}function N(){var t=[];for(var n in this._)t.push(E(n));return t}function P(){var t=0;for(var n in this._)++t;return t}function C(){for(var t in this._)return!1;return!0}function O(){this._=Object.create(null)}function L(t){return t}function U(t,n,e){return function(){var r=e.apply(n,arguments);return r===n?t:r}}function D(t,n){if(n in t)return n;n=n.charAt(0).toUpperCase()+n.slice(1);for(var e=0,r=z.length;e<r;++e){var o=z[e]+n;if(o in t)return o}}a.range=function(t,n,e){if(arguments.length<3&&(e=1,arguments.length<2&&(n=t,t=0)),(n-t)/e==1/0)throw new Error("infinite range");var r,o=[],a=_(w(e)),i=-1;if(t*=a,n*=a,(e*=a)<0)for(;(r=t+e*++i)>n;)o.push(r/a);else for(;(r=t+e*++i)<n;)o.push(r/a);return o},a.map=function(t,n){var e=new S;if(t instanceof S)t.forEach((function(t,n){e.set(t,n)}));else if(Array.isArray(t)){var r,o=-1,a=t.length;if(1===arguments.length)for(;++o<a;)e.set(o,t[o]);else for(;++o<a;)e.set(n.call(t,r=t[o],o),r)}else for(var i in t)e.set(i,t[i]);return e},k(S,{has:T,get:function(t){return this._[A(t)]},set:function(t,n){return this._[A(t)]=n},remove:R,keys:N,values:function(){var t=[];for(var n in this._)t.push(this._[n]);return t},entries:function(){var t=[];for(var n in this._)t.push({key:E(n),value:this._[n]});return t},size:P,empty:C,forEach:function(t){for(var n in this._)t.call(this,E(n),this._[n])}}),a.nest=function(){var t,n,e={},r=[],o=[];function i(o,a,u){if(u>=r.length)return n?n.call(e,a):t?a.sort(t):a;for(var s,l,c,f,h=-1,p=a.length,d=r[u++],m=new S;++h<p;)(f=m.get(s=d(l=a[h])))?f.push(l):m.set(s,[l]);return o?(l=o(),c=function(t,n){l.set(t,i(o,n,u))}):(l={},c=function(t,n){l[t]=i(o,n,u)}),m.forEach(c),l}return e.map=function(t,n){return i(n,t,0)},e.entries=function(t){return function t(n,e){if(e>=r.length)return n;var a=[],i=o[e++];return n.forEach((function(n,r){a.push({key:n,values:t(r,e)})})),i?a.sort((function(t,n){return i(t.key,n.key)})):a}(i(a.map,t,0),0)},e.key=function(t){return r.push(t),e},e.sortKeys=function(t){return o[r.length-1]=t,e},e.sortValues=function(n){return t=n,e},e.rollup=function(t){return n=t,e},e},a.set=function(t){var n=new O;if(t)for(var e=0,r=t.length;e<r;++e)n.add(t[e]);return n},k(O,{has:T,add:function(t){return this._[A(t+="")]=!0,t},remove:R,values:N,size:P,empty:C,forEach:function(t){for(var n in this._)t.call(this,E(n))}}),a.behavior={},a.rebind=function(t,n){for(var e,r=1,o=arguments.length;++r<o;)t[e=arguments[r]]=U(t,n,n[e]);return t};var z=["webkit","ms","moz","Moz","o","O"];function q(){}function j(){}function F(t){var n=[],e=new S;function r(){for(var e,r=n,o=-1,a=r.length;++o<a;)(e=r[o].on)&&e.apply(this,arguments);return t}return r.on=function(r,o){var a,i=e.get(r);return arguments.length<2?i&&i.on:(i&&(i.on=null,n=n.slice(0,a=n.indexOf(i)).concat(n.slice(a+1)),e.remove(r)),o&&n.push(e.set(r,{on:o})),t)},r}function B(){a.event.preventDefault()}function I(){for(var t,n=a.event;t=n.sourceEvent;)n=t;return n}function X(t){for(var n=new j,e=0,r=arguments.length;++e<r;)n[arguments[e]]=F(n);return n.of=function(e,r){return function(o){try{var i=o.sourceEvent=a.event;o.target=t,a.event=o,n[o.type].apply(e,r)}finally{a.event=i}}},n}a.dispatch=function(){for(var t=new j,n=-1,e=arguments.length;++n<e;)t[arguments[n]]=F(t);return t},j.prototype.on=function(t,n){var e=t.indexOf("."),r="";if(e>=0&&(r=t.slice(e+1),t=t.slice(0,e)),t)return arguments.length<2?this[t].on(r):this[t].on(r,n);if(2===arguments.length){if(null==n)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}},a.event=null,a.requote=function(t){return t.replace(Y,"\\$&")};var Y=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,V={}.__proto__?function(t,n){t.__proto__=n}:function(t,n){for(var e in n)t[e]=n[e]};function H(t){return V(t,J),t}var G=function(t,n){return n.querySelector(t)},W=function(t,n){return n.querySelectorAll(t)},Z=function(t,n){var e=t.matches||t[D(t,"matchesSelector")];return(Z=function(t,n){return e.call(t,n)})(t,n)};"function"==typeof Sizzle&&(G=function(t,n){return Sizzle(t,n)[0]||null},W=Sizzle,Z=Sizzle.matchesSelector),a.selection=function(){return a.select(s.documentElement)};var J=a.selection.prototype=[];function $(t){return"function"==typeof t?t:function(){return G(t,this)}}function K(t){return"function"==typeof t?t:function(){return W(t,this)}}J.select=function(t){var n,e,r,o,a=[];t=$(t);for(var i=-1,u=this.length;++i<u;){a.push(n=[]),n.parentNode=(r=this[i]).parentNode;for(var s=-1,l=r.length;++s<l;)(o=r[s])?(n.push(e=t.call(o,o.__data__,s,i)),e&&"__data__"in o&&(e.__data__=o.__data__)):n.push(null)}return H(a)},J.selectAll=function(t){var n,e,r=[];t=K(t);for(var o=-1,a=this.length;++o<a;)for(var i=this[o],s=-1,l=i.length;++s<l;)(e=i[s])&&(r.push(n=u(t.call(e,e.__data__,s,o))),n.parentNode=e);return H(r)};var Q="http://www.w3.org/1999/xhtml",tt={svg:"http://www.w3.org/2000/svg",xhtml:Q,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function nt(t,n){return t=a.ns.qualify(t),null==n?t.local?function(){this.removeAttributeNS(t.space,t.local)}:function(){this.removeAttribute(t)}:"function"==typeof n?t.local?function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}:function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}:t.local?function(){this.setAttributeNS(t.space,t.local,n)}:function(){this.setAttribute(t,n)}}function et(t){return t.trim().replace(/\s+/g," ")}function rt(t){return new RegExp("(?:^|\\s+)"+a.requote(t)+"(?:\\s+|$)","g")}function ot(t){return(t+"").trim().split(/^|\s+/)}function at(t,n){var e=(t=ot(t).map(it)).length;return"function"==typeof n?function(){for(var r=-1,o=n.apply(this,arguments);++r<e;)t[r](this,o)}:function(){for(var r=-1;++r<e;)t[r](this,n)}}function it(t){var n=rt(t);return function(e,r){if(o=e.classList)return r?o.add(t):o.remove(t);var o=e.getAttribute("class")||"";r?(n.lastIndex=0,n.test(o)||e.setAttribute("class",et(o+" "+t))):e.setAttribute("class",et(o.replace(n," ")))}}function ut(t,n,e){return null==n?function(){this.style.removeProperty(t)}:"function"==typeof n?function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}:function(){this.style.setProperty(t,n,e)}}function st(t,n){return null==n?function(){delete this[t]}:"function"==typeof n?function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}:function(){this[t]=n}}function lt(t){return"function"==typeof t?t:(t=a.ns.qualify(t)).local?function(){return this.ownerDocument.createElementNS(t.space,t.local)}:function(){var n=this.ownerDocument,e=this.namespaceURI;return e===Q&&n.documentElement.namespaceURI===Q?n.createElement(t):n.createElementNS(e,t)}}function ct(){var t=this.parentNode;t&&t.removeChild(this)}function ft(t){return{__data__:t}}function ht(t){return function(){return Z(this,t)}}function pt(t){return arguments.length||(t=g),function(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}}function dt(t,n){for(var e=0,r=t.length;e<r;e++)for(var o,a=t[e],i=0,u=a.length;i<u;i++)(o=a[i])&&n(o,i,e);return t}function mt(t){return V(t,gt),t}a.ns={prefix:tt,qualify:function(t){var n=t.indexOf(":"),e=t;return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),tt.hasOwnProperty(e)?{space:tt[e],local:t}:t}},J.attr=function(t,n){if(arguments.length<2){if("string"==typeof t){var e=this.node();return(t=a.ns.qualify(t)).local?e.getAttributeNS(t.space,t.local):e.getAttribute(t)}for(n in t)this.each(nt(n,t[n]));return this}return this.each(nt(t,n))},J.classed=function(t,n){if(arguments.length<2){if("string"==typeof t){var e=this.node(),r=(t=ot(t)).length,o=-1;if(n=e.classList){for(;++o<r;)if(!n.contains(t[o]))return!1}else for(n=e.getAttribute("class");++o<r;)if(!rt(t[o]).test(n))return!1;return!0}for(n in t)this.each(at(n,t[n]));return this}return this.each(at(t,n))},J.style=function(t,n,e){var r=arguments.length;if(r<3){if("string"!=typeof t){for(e in r<2&&(n=""),t)this.each(ut(e,t[e],n));return this}if(r<2){var o=this.node();return c(o).getComputedStyle(o,null).getPropertyValue(t)}e=""}return this.each(ut(t,n,e))},J.property=function(t,n){if(arguments.length<2){if("string"==typeof t)return this.node()[t];for(n in t)this.each(st(n,t[n]));return this}return this.each(st(t,n))},J.text=function(t){return arguments.length?this.each("function"==typeof t?function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}:null==t?function(){this.textContent=""}:function(){this.textContent=t}):this.node().textContent},J.html=function(t){return arguments.length?this.each("function"==typeof t?function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}:null==t?function(){this.innerHTML=""}:function(){this.innerHTML=t}):this.node().innerHTML},J.append=function(t){return t=lt(t),this.select((function(){return this.appendChild(t.apply(this,arguments))}))},J.insert=function(t,n){return t=lt(t),n=$(n),this.select((function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)}))},J.remove=function(){return this.each(ct)},J.data=function(t,n){var e,r,o=-1,a=this.length;if(!arguments.length){for(t=new Array(a=(e=this[0]).length);++o<a;)(r=e[o])&&(t[o]=r.__data__);return t}function i(t,e){var r,o,a,i=t.length,c=e.length,f=Math.min(i,c),h=new Array(c),p=new Array(c),d=new Array(i);if(n){var m,g=new S,v=new Array(i);for(r=-1;++r<i;)(o=t[r])&&(g.has(m=n.call(o,o.__data__,r))?d[r]=o:g.set(m,o),v[r]=m);for(r=-1;++r<c;)(o=g.get(m=n.call(e,a=e[r],r)))?!0!==o&&(h[r]=o,o.__data__=a):p[r]=ft(a),g.set(m,!0);for(r=-1;++r<i;)r in v&&!0!==g.get(v[r])&&(d[r]=t[r])}else{for(r=-1;++r<f;)o=t[r],a=e[r],o?(o.__data__=a,h[r]=o):p[r]=ft(a);for(;r<c;++r)p[r]=ft(e[r]);for(;r<i;++r)d[r]=t[r]}p.update=h,p.parentNode=h.parentNode=d.parentNode=t.parentNode,u.push(p),s.push(h),l.push(d)}var u=mt([]),s=H([]),l=H([]);if("function"==typeof t)for(;++o<a;)i(e=this[o],t.call(e,e.parentNode.__data__,o));else for(;++o<a;)i(e=this[o],t);return s.enter=function(){return u},s.exit=function(){return l},s},J.datum=function(t){return arguments.length?this.property("__data__",t):this.property("__data__")},J.filter=function(t){var n,e,r,o=[];"function"!=typeof t&&(t=ht(t));for(var a=0,i=this.length;a<i;a++){o.push(n=[]),n.parentNode=(e=this[a]).parentNode;for(var u=0,s=e.length;u<s;u++)(r=e[u])&&t.call(r,r.__data__,u,a)&&n.push(r)}return H(o)},J.order=function(){for(var t=-1,n=this.length;++t<n;)for(var e,r=this[t],o=r.length-1,a=r[o];--o>=0;)(e=r[o])&&(a&&a!==e.nextSibling&&a.parentNode.insertBefore(e,a),a=e);return this},J.sort=function(t){t=pt.apply(this,arguments);for(var n=-1,e=this.length;++n<e;)this[n].sort(t);return this.order()},J.each=function(t){return dt(this,(function(n,e,r){t.call(n,n.__data__,e,r)}))},J.call=function(t){var n=u(arguments);return t.apply(n[0]=this,n),this},J.empty=function(){return!this.node()},J.node=function(){for(var t=0,n=this.length;t<n;t++)for(var e=this[t],r=0,o=e.length;r<o;r++){var a=e[r];if(a)return a}return null},J.size=function(){var t=0;return dt(this,(function(){++t})),t};var gt=[];function vt(t){var n,e;return function(r,o,a){var i,u=t[a].update,s=u.length;for(a!=e&&(e=a,n=0),o>=n&&(n=o+1);!(i=u[n])&&++n<s;);return i}}function yt(t,n,e){var r="__on"+t,o=t.indexOf("."),i=xt;o>0&&(t=t.slice(0,o));var s=bt.get(t);function l(){var n=this[r];n&&(this.removeEventListener(t,n,n.$),delete this[r])}return s&&(t=s,i=Mt),o?n?function(){var o=i(n,u(arguments));l.call(this),this.addEventListener(t,this[r]=o,o.$=e),o._=n}:l:n?q:function(){var n,e=new RegExp("^__on([^.]+)"+a.requote(t)+"$");for(var r in this)if(n=r.match(e)){var o=this[r];this.removeEventListener(n[1],o,o.$),delete this[r]}}}a.selection.enter=mt,a.selection.enter.prototype=gt,gt.append=J.append,gt.empty=J.empty,gt.node=J.node,gt.call=J.call,gt.size=J.size,gt.select=function(t){for(var n,e,r,o,a,i=[],u=-1,s=this.length;++u<s;){r=(o=this[u]).update,i.push(n=[]),n.parentNode=o.parentNode;for(var l=-1,c=o.length;++l<c;)(a=o[l])?(n.push(r[l]=e=t.call(o.parentNode,a.__data__,l,u)),e.__data__=a.__data__):n.push(null)}return H(i)},gt.insert=function(t,n){return arguments.length<2&&(n=vt(this)),J.insert.call(this,t,n)},a.select=function(t){var n;return"string"==typeof t?(n=[G(t,s)]).parentNode=s.documentElement:(n=[t]).parentNode=l(t),H([n])},a.selectAll=function(t){var n;return"string"==typeof t?(n=u(W(t,s))).parentNode=s.documentElement:(n=u(t)).parentNode=null,H([n])},J.on=function(t,n,e){var r=arguments.length;if(r<3){if("string"!=typeof t){for(e in r<2&&(n=!1),t)this.each(yt(e,t[e],n));return this}if(r<2)return(r=this.node()["__on"+t])&&r._;e=!1}return this.each(yt(t,n,e))};var bt=a.map({mouseenter:"mouseover",mouseleave:"mouseout"});function xt(t,n){return function(e){var r=a.event;a.event=e,n[0]=this.__data__;try{t.apply(this,n)}finally{a.event=r}}}function Mt(t,n){var e=xt(t,n);return function(t){var n=t.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||e.call(this,t)}}s&&bt.forEach((function(t){"on"+t in s&&bt.remove(t)}));var wt,_t=0;function kt(t){var n=".dragsuppress-"+ ++_t,e="click"+n,r=a.select(c(t)).on("touchmove"+n,B).on("dragstart"+n,B).on("selectstart"+n,B);if(null==wt&&(wt=!("onselectstart"in t)&&D(t.style,"userSelect")),wt){var o=l(t).style,i=o[wt];o[wt]="none"}return function(t){if(r.on(n,null),wt&&(o[wt]=i),t){var a=function(){r.on(e,null)};r.on(e,(function(){B(),a()}),!0),setTimeout(a,0)}}}a.mouse=function(t){return At(t,I())};var St=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;function At(t,n){n.changedTouches&&(n=n.changedTouches[0]);var e=t.ownerSVGElement||t;if(e.createSVGPoint){var r=e.createSVGPoint();if(St<0){var o=c(t);if(o.scrollX||o.scrollY){var i=(e=a.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important"))[0][0].getScreenCTM();St=!(i.f||i.e),e.remove()}}return St?(r.x=n.pageX,r.y=n.pageY):(r.x=n.clientX,r.y=n.clientY),[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}var u=t.getBoundingClientRect();return[n.clientX-u.left-t.clientLeft,n.clientY-u.top-t.clientTop]}function Et(){return a.event.changedTouches[0].identifier}a.touch=function(t,n,e){if(arguments.length<3&&(e=n,n=I().changedTouches),n)for(var r,o=0,a=n.length;o<a;++o)if((r=n[o]).identifier===e)return At(t,r)},a.behavior.drag=function(){var t=X(o,"drag","dragstart","dragend"),n=null,e=i(q,a.mouse,c,"mousemove","mouseup"),r=i(Et,a.touch,L,"touchmove","touchend");function o(){this.on("mousedown.drag",e).on("touchstart.drag",r)}function i(e,r,o,i,u){return function(){var s,l=this,c=a.event.target.correspondingElement||a.event.target,f=l.parentNode,h=t.of(l,arguments),p=0,d=e(),m=".drag"+(null==d?"":"-"+d),g=a.select(o(c)).on(i+m,b).on(u+m,x),v=kt(c),y=r(f,d);function b(){var t,n,e=r(f,d);e&&(t=e[0]-y[0],n=e[1]-y[1],p|=t|n,y=e,h({type:"drag",x:e[0]+s[0],y:e[1]+s[1],dx:t,dy:n}))}function x(){r(f,d)&&(g.on(i+m,null).on(u+m,null),v(p),h({type:"dragend"}))}s=n?[(s=n.apply(l,arguments)).x-y[0],s.y-y[1]]:[0,0],h({type:"dragstart"})}}return o.origin=function(t){return arguments.length?(n=t,o):n},a.rebind(o,t,"on")},a.touches=function(t,n){return arguments.length<2&&(n=I().touches),n?u(n).map((function(n){var e=At(t,n);return e.identifier=n.identifier,e})):[]};var Tt=1e-6,Rt=Tt*Tt,Nt=Math.PI,Pt=2*Nt,Ct=Pt-Tt,Ot=Nt/2,Lt=Nt/180,Ut=180/Nt;function Dt(t){return t>0?1:t<0?-1:0}function zt(t,n,e){return(n[0]-t[0])*(e[1]-t[1])-(n[1]-t[1])*(e[0]-t[0])}function qt(t){return t>1?0:t<-1?Nt:Math.acos(t)}function jt(t){return t>1?Ot:t<-1?-Ot:Math.asin(t)}function Ft(t){return((t=Math.exp(t))+1/t)/2}function Bt(t){return(t=Math.sin(t/2))*t}var It=Math.SQRT2;a.interpolateZoom=function(t,n){var e,r,o=t[0],a=t[1],i=t[2],u=n[0],s=n[1],l=n[2],c=u-o,f=s-a,h=c*c+f*f;if(h<Rt)r=Math.log(l/i)/It,e=function(t){return[o+t*c,a+t*f,i*Math.exp(It*t*r)]};else{var p=Math.sqrt(h),d=(l*l-i*i+4*h)/(2*i*2*p),m=(l*l-i*i-4*h)/(2*l*2*p),g=Math.log(Math.sqrt(d*d+1)-d),v=Math.log(Math.sqrt(m*m+1)-m);r=(v-g)/It,e=function(t){var n,e=t*r,u=Ft(g),s=i/(2*p)*(u*(n=It*e+g,((n=Math.exp(2*n))-1)/(n+1))-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[o+s*c,a+s*f,i*u/Ft(It*e+g)]}}return e.duration=1e3*r,e},a.behavior.zoom=function(){var t,n,e,r,o,i,u,l,f,h={x:0,y:0,k:1},p=[960,500],d=Vt,m=250,g=0,v="mousedown.zoom",y="mousemove.zoom",b="mouseup.zoom",x="touchstart.zoom",M=X(w,"zoomstart","zoom","zoomend");function w(t){t.on(v,P).on(Yt+".zoom",O).on("dblclick.zoom",L).on(x,C)}function _(t){return[(t[0]-h.x)/h.k,(t[1]-h.y)/h.k]}function k(t){h.k=Math.max(d[0],Math.min(d[1],t))}function S(t,n){n=function(t){return[t[0]*h.k+h.x,t[1]*h.k+h.y]}(n),h.x+=t[0]-n[0],h.y+=t[1]-n[1]}function A(t,e,r,o){t.__chart__={x:h.x,y:h.y,k:h.k},k(Math.pow(2,o)),S(n=e,r),t=a.select(t),m>0&&(t=t.transition().duration(m)),t.call(w.event)}function E(){u&&u.domain(i.range().map((function(t){return(t-h.x)/h.k})).map(i.invert)),f&&f.domain(l.range().map((function(t){return(t-h.y)/h.k})).map(l.invert))}function T(t){g++||t({type:"zoomstart"})}function R(t){E(),t({type:"zoom",scale:h.k,translate:[h.x,h.y]})}function N(t){--g||(t({type:"zoomend"}),n=null)}function P(){var t=this,n=M.of(t,arguments),e=0,r=a.select(c(t)).on(y,u).on(b,s),o=_(a.mouse(t)),i=kt(t);function u(){e=1,S(a.mouse(t),o),R(n)}function s(){r.on(y,null).on(b,null),i(e),N(n)}Mu.call(t),T(n)}function C(){var t,n=this,e=M.of(n,arguments),r={},i=0,u=".zoom-"+a.event.changedTouches[0].identifier,s="touchmove"+u,l="touchend"+u,c=[],f=a.select(n),p=kt(n);function d(){var e=a.touches(n);return t=h.k,e.forEach((function(t){t.identifier in r&&(r[t.identifier]=_(t))})),e}function m(){var t=a.event.target;a.select(t).on(s,g).on(l,y),c.push(t);for(var e=a.event.changedTouches,u=0,f=e.length;u<f;++u)r[e[u].identifier]=null;var p=d(),m=Date.now();if(1===p.length){if(m-o<500){var v=p[0];A(n,v,r[v.identifier],Math.floor(Math.log(h.k)/Math.LN2)+1),B()}o=m}else if(p.length>1){v=p[0];var b=p[1],x=v[0]-b[0],M=v[1]-b[1];i=x*x+M*M}}function g(){var u,s,l,c,f=a.touches(n);Mu.call(n);for(var h=0,p=f.length;h<p;++h,c=null)if(l=f[h],c=r[l.identifier]){if(s)break;u=l,s=c}if(c){var d=(d=l[0]-u[0])*d+(d=l[1]-u[1])*d,m=i&&Math.sqrt(d/i);u=[(u[0]+l[0])/2,(u[1]+l[1])/2],s=[(s[0]+c[0])/2,(s[1]+c[1])/2],k(m*t)}o=null,S(u,s),R(e)}function y(){if(a.event.touches.length){for(var t=a.event.changedTouches,n=0,o=t.length;n<o;++n)delete r[t[n].identifier];for(var i in r)return void d()}a.selectAll(c).on(u,null),f.on(v,P).on(x,C),p(),N(e)}m(),T(e),f.on(v,null).on(x,m)}function O(){var o=M.of(this,arguments);r?clearTimeout(r):(Mu.call(this),t=_(n=e||a.mouse(this)),T(o)),r=setTimeout((function(){r=null,N(o)}),50),B(),k(Math.pow(2,.002*Xt())*h.k),S(n,t),R(o)}function L(){var t=a.mouse(this),n=Math.log(h.k)/Math.LN2;A(this,t,_(t),a.event.shiftKey?Math.ceil(n)-1:Math.floor(n)+1)}return Yt||(Yt="onwheel"in s?(Xt=function(){return-a.event.deltaY*(a.event.deltaMode?120:1)},"wheel"):"onmousewheel"in s?(Xt=function(){return a.event.wheelDelta},"mousewheel"):(Xt=function(){return-a.event.detail},"MozMousePixelScroll")),w.event=function(t){t.each((function(){var t=M.of(this,arguments),e=h;ku?a.select(this).transition().each("start.zoom",(function(){h=this.__chart__||{x:0,y:0,k:1},T(t)})).tween("zoom:zoom",(function(){var r=p[0],o=p[1],i=n?n[0]:r/2,u=n?n[1]:o/2,s=a.interpolateZoom([(i-h.x)/h.k,(u-h.y)/h.k,r/h.k],[(i-e.x)/e.k,(u-e.y)/e.k,r/e.k]);return function(n){var e=s(n),o=r/e[2];this.__chart__=h={x:i-e[0]*o,y:u-e[1]*o,k:o},R(t)}})).each("interrupt.zoom",(function(){N(t)})).each("end.zoom",(function(){N(t)})):(this.__chart__=h,T(t),R(t),N(t))}))},w.translate=function(t){return arguments.length?(h={x:+t[0],y:+t[1],k:h.k},E(),w):[h.x,h.y]},w.scale=function(t){return arguments.length?(h={x:h.x,y:h.y,k:null},k(+t),E(),w):h.k},w.scaleExtent=function(t){return arguments.length?(d=null==t?Vt:[+t[0],+t[1]],w):d},w.center=function(t){return arguments.length?(e=t&&[+t[0],+t[1]],w):e},w.size=function(t){return arguments.length?(p=t&&[+t[0],+t[1]],w):p},w.duration=function(t){return arguments.length?(m=+t,w):m},w.x=function(t){return arguments.length?(u=t,i=t.copy(),h={x:0,y:0,k:1},w):u},w.y=function(t){return arguments.length?(f=t,l=t.copy(),h={x:0,y:0,k:1},w):f},a.rebind(w,M,"on")};var Xt,Yt,Vt=[0,1/0];function Ht(){}function Gt(t,n,e){return this instanceof Gt?(this.h=+t,this.s=+n,void(this.l=+e)):arguments.length<2?t instanceof Gt?new Gt(t.h,t.s,t.l):pn(""+t,dn,Gt):new Gt(t,n,e)}a.color=Ht,Ht.prototype.toString=function(){return this.rgb()+""},a.hsl=Gt;var Wt=Gt.prototype=new Ht;function Zt(t,n,e){var r,o;function a(t){return Math.round(255*function(t){return t>360?t-=360:t<0&&(t+=360),t<60?r+(o-r)*t/60:t<180?o:t<240?r+(o-r)*(240-t)/60:r}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,n=isNaN(n)?0:n<0?0:n>1?1:n,r=2*(e=e<0?0:e>1?1:e)-(o=e<=.5?e*(1+n):e+n-e*n),new sn(a(t+120),a(t),a(t-120))}function Jt(t,n,e){return this instanceof Jt?(this.h=+t,this.c=+n,void(this.l=+e)):arguments.length<2?t instanceof Jt?new Jt(t.h,t.c,t.l):rn(t instanceof Qt?t.l:(t=mn((t=a.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new Jt(t,n,e)}Wt.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new Gt(this.h,this.s,this.l/t)},Wt.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new Gt(this.h,this.s,t*this.l)},Wt.rgb=function(){return Zt(this.h,this.s,this.l)},a.hcl=Jt;var $t=Jt.prototype=new Ht;function Kt(t,n,e){return isNaN(t)&&(t=0),isNaN(n)&&(n=0),new Qt(e,Math.cos(t*=Lt)*n,Math.sin(t)*n)}function Qt(t,n,e){return this instanceof Qt?(this.l=+t,this.a=+n,void(this.b=+e)):arguments.length<2?t instanceof Qt?new Qt(t.l,t.a,t.b):t instanceof Jt?Kt(t.h,t.c,t.l):mn((t=sn(t)).r,t.g,t.b):new Qt(t,n,e)}$t.brighter=function(t){return new Jt(this.h,this.c,Math.min(100,this.l+tn*(arguments.length?t:1)))},$t.darker=function(t){return new Jt(this.h,this.c,Math.max(0,this.l-tn*(arguments.length?t:1)))},$t.rgb=function(){return Kt(this.h,this.c,this.l).rgb()},a.lab=Qt;var tn=18,nn=Qt.prototype=new Ht;function en(t,n,e){var r=(t+16)/116,o=r+n/500,a=r-e/200;return new sn(un(3.2404542*(o=.95047*on(o))-1.5371385*(r=1*on(r))-.4985314*(a=1.08883*on(a))),un(-.969266*o+1.8760108*r+.041556*a),un(.0556434*o-.2040259*r+1.0572252*a))}function rn(t,n,e){return t>0?new Jt(Math.atan2(e,n)*Ut,Math.sqrt(n*n+e*e),t):new Jt(NaN,NaN,t)}function on(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function an(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function un(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function sn(t,n,e){return this instanceof sn?(this.r=~~t,this.g=~~n,void(this.b=~~e)):arguments.length<2?t instanceof sn?new sn(t.r,t.g,t.b):pn(""+t,sn,Zt):new sn(t,n,e)}function ln(t){return new sn(t>>16,t>>8&255,255&t)}function cn(t){return ln(t)+""}nn.brighter=function(t){return new Qt(Math.min(100,this.l+tn*(arguments.length?t:1)),this.a,this.b)},nn.darker=function(t){return new Qt(Math.max(0,this.l-tn*(arguments.length?t:1)),this.a,this.b)},nn.rgb=function(){return en(this.l,this.a,this.b)},a.rgb=sn;var fn=sn.prototype=new Ht;function hn(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function pn(t,n,e){var r,o,a,i=0,u=0,s=0;if(r=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(o=r[2].split(","),r[1]){case"hsl":return e(parseFloat(o[0]),parseFloat(o[1])/100,parseFloat(o[2])/100);case"rgb":return n(vn(o[0]),vn(o[1]),vn(o[2]))}return(a=yn.get(t))?n(a.r,a.g,a.b):(null==t||"#"!==t.charAt(0)||isNaN(a=parseInt(t.slice(1),16))||(4===t.length?(i=(3840&a)>>4,i|=i>>4,u=240&a,u|=u>>4,s=15&a,s|=s<<4):7===t.length&&(i=(16711680&a)>>16,u=(65280&a)>>8,s=255&a)),n(i,u,s))}function dn(t,n,e){var r,o,a=Math.min(t/=255,n/=255,e/=255),i=Math.max(t,n,e),u=i-a,s=(i+a)/2;return u?(o=s<.5?u/(i+a):u/(2-i-a),r=t==i?(n-e)/u+(n<e?6:0):n==i?(e-t)/u+2:(t-n)/u+4,r*=60):(r=NaN,o=s>0&&s<1?0:r),new Gt(r,o,s)}function mn(t,n,e){var r=an((.4124564*(t=gn(t))+.3575761*(n=gn(n))+.1804375*(e=gn(e)))/.95047),o=an((.2126729*t+.7151522*n+.072175*e)/1);return Qt(116*o-16,500*(r-o),200*(o-an((.0193339*t+.119192*n+.9503041*e)/1.08883)))}function gn(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function vn(t){var n=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*n):n}fn.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var n=this.r,e=this.g,r=this.b,o=30;return n||e||r?(n&&n<o&&(n=o),e&&e<o&&(e=o),r&&r<o&&(r=o),new sn(Math.min(255,n/t),Math.min(255,e/t),Math.min(255,r/t))):new sn(o,o,o)},fn.darker=function(t){return new sn((t=Math.pow(.7,arguments.length?t:1))*this.r,t*this.g,t*this.b)},fn.hsl=function(){return dn(this.r,this.g,this.b)},fn.toString=function(){return"#"+hn(this.r)+hn(this.g)+hn(this.b)};var yn=a.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});function bn(t){return"function"==typeof t?t:function(){return t}}function xn(t){return function(n,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),Mn(n,e,t,r)}}function Mn(t,n,e,r){var o={},i=a.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,c=null;function f(){var t,n=l.status;if(!n&&function(t){var n=t.responseType;return n&&"text"!==n?t.response:t.responseText}(l)||n>=200&&n<300||304===n){try{t=e.call(o,l)}catch(t){return void i.error.call(o,t)}i.load.call(o,t)}else i.error.call(o,l)}return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=f:l.onreadystatechange=function(){l.readyState>3&&f()},l.onprogress=function(t){var n=a.event;a.event=t;try{i.progress.call(o,l)}finally{a.event=n}},o.header=function(t,n){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==n?delete s[t]:s[t]=n+"",o)},o.mimeType=function(t){return arguments.length?(n=null==t?null:t+"",o):n},o.responseType=function(t){return arguments.length?(c=t,o):c},o.response=function(t){return e=t,o},["get","post"].forEach((function(t){o[t]=function(){return o.send.apply(o,[t].concat(u(arguments)))}})),o.send=function(e,r,a){if(2===arguments.length&&"function"==typeof r&&(a=r,r=null),l.open(e,t,!0),null==n||"accept"in s||(s.accept=n+",*/*"),l.setRequestHeader)for(var u in s)l.setRequestHeader(u,s[u]);return null!=n&&l.overrideMimeType&&l.overrideMimeType(n),null!=c&&(l.responseType=c),null!=a&&o.on("error",a).on("load",(function(t){a(null,t)})),i.beforesend.call(o,l),l.send(null==r?null:r),o},o.abort=function(){return l.abort(),o},a.rebind(o,i,"on"),null==r?o:o.get(function(t){return 1===t.length?function(n,e){t(null==n?e:null)}:t}(r))}yn.forEach((function(t,n){yn.set(t,ln(n))})),a.functor=bn,a.xhr=xn(L),a.dsv=function(t,n){var e=new RegExp('["'+t+"\n]"),r=t.charCodeAt(0);function o(t,e,r){arguments.length<3&&(r=e,e=null);var o=Mn(t,n,null==e?a:i(e),r);return o.row=function(t){return arguments.length?o.response(null==(e=t)?a:i(t)):e},o}function a(t){return o.parse(t.responseText)}function i(t){return function(n){return o.parse(n.responseText,t)}}function u(n){return n.map(s).join(t)}function s(t){return e.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}return o.parse=function(t,n){var e;return o.parseRows(t,(function(t,r){if(e)return e(t,r-1);var o=new Function("d","return {"+t.map((function(t,n){return JSON.stringify(t)+": d["+n+"]"})).join(",")+"}");e=n?function(t,e){return n(o(t),e)}:o}))},o.parseRows=function(t,n){var e,o,a={},i={},u=[],s=t.length,l=0,c=0;function f(){if(l>=s)return i;if(o)return o=!1,a;var n=l;if(34===t.charCodeAt(n)){for(var e=n;e++<s;)if(34===t.charCodeAt(e)){if(34!==t.charCodeAt(e+1))break;++e}return l=e+2,13===(u=t.charCodeAt(e+1))?(o=!0,10===t.charCodeAt(e+2)&&++l):10===u&&(o=!0),t.slice(n+1,e).replace(/""/g,'"')}for(;l<s;){var u,c=1;if(10===(u=t.charCodeAt(l++)))o=!0;else if(13===u)o=!0,10===t.charCodeAt(l)&&(++l,++c);else if(u!==r)continue;return t.slice(n,l-c)}return t.slice(n)}for(;(e=f())!==i;){for(var h=[];e!==a&&e!==i;)h.push(e),e=f();n&&null==(h=n(h,c++))||u.push(h)}return u},o.format=function(n){if(Array.isArray(n[0]))return o.formatRows(n);var e=new O,r=[];return n.forEach((function(t){for(var n in t)e.has(n)||r.push(e.add(n))})),[r.map(s).join(t)].concat(n.map((function(n){return r.map((function(t){return s(n[t])})).join(t)}))).join("\n")},o.formatRows=function(t){return t.map(u).join("\n")},o},a.csv=a.dsv(",","text/csv"),a.tsv=a.dsv("\t","text/tab-separated-values");var wn,_n,kn,Sn,An=this[D(this,"requestAnimationFrame")]||function(t){setTimeout(t,17)};function En(t,n,e){var r=arguments.length;r<2&&(n=0),r<3&&(e=Date.now());var o=e+n,a={c:t,t:o,n:null};return _n?_n.n=a:wn=a,_n=a,kn||(Sn=clearTimeout(Sn),kn=1,An(Tn)),a}function Tn(){var t=Rn(),n=Nn()-t;n>24?(isFinite(n)&&(clearTimeout(Sn),Sn=setTimeout(Tn,n)),kn=0):(kn=1,An(Tn))}function Rn(){for(var t=Date.now(),n=wn;n;)t>=n.t&&n.c(t-n.t)&&(n.c=null),n=n.n;return t}function Nn(){for(var t,n=wn,e=1/0;n;)n.c?(n.t<e&&(e=n.t),n=(t=n).n):n=t?t.n=n.n:wn=n.n;return _n=t,e}function Pn(t,n){return n-(t?Math.ceil(Math.log(t)/Math.LN10):1)}a.timer=function(){En.apply(this,arguments)},a.timer.flush=function(){Rn(),Nn()},a.round=function(t,n){return n?Math.round(t*(n=Math.pow(10,n)))/n:Math.round(t)};var Cn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map((function(t,n){var e=Math.pow(10,3*w(8-n));return{scale:n>8?function(t){return t/e}:function(t){return t*e},symbol:t}}));function On(t){var n=t.decimal,e=t.thousands,r=t.grouping,o=t.currency,i=r&&e?function(t,n){for(var o=t.length,a=[],i=0,u=r[0],s=0;o>0&&u>0&&(s+u+1>n&&(u=Math.max(1,n-s)),a.push(t.substring(o-=u,o+u)),!((s+=u+1)>n));)u=r[i=(i+1)%r.length];return a.reverse().join(e)}:L;return function(t){var e=Ln.exec(t),r=e[1]||" ",u=e[2]||">",s=e[3]||"-",l=e[4]||"",c=e[5],f=+e[6],h=e[7],p=e[8],d=e[9],m=1,g="",v="",y=!1,b=!0;switch(p&&(p=+p.substring(1)),(c||"0"===r&&"="===u)&&(c=r="0",u="="),d){case"n":h=!0,d="g";break;case"%":m=100,v="%",d="f";break;case"p":m=100,v="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(g="0"+d.toLowerCase());case"c":b=!1;case"d":y=!0,p=0;break;case"s":m=-1,d="r"}"$"===l&&(g=o[0],v=o[1]),"r"!=d||p||(d="g"),null!=p&&("g"==d?p=Math.max(1,Math.min(21,p)):"e"!=d&&"f"!=d||(p=Math.max(0,Math.min(20,p)))),d=Un.get(d)||Dn;var x=c&&h;return function(t){var e=v;if(y&&t%1)return"";var o=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(m<0){var l=a.formatPrefix(t,p);t=l.scale(t),e=l.symbol+v}else t*=m;var M,w,_=(t=d(t,p)).lastIndexOf(".");if(_<0){var k=b?t.lastIndexOf("e"):-1;k<0?(M=t,w=""):(M=t.substring(0,k),w=t.substring(k))}else M=t.substring(0,_),w=n+t.substring(_+1);!c&&h&&(M=i(M,1/0));var S=g.length+M.length+w.length+(x?0:o.length),A=S<f?new Array(S=f-S+1).join(r):"";return x&&(M=i(A+M,A.length?f-w.length:1/0)),o+=g,t=M+w,("<"===u?o+t+A:">"===u?A+o+t:"^"===u?A.substring(0,S>>=1)+o+t+A.substring(S):o+(x?t:A+t))+e}}}a.formatPrefix=function(t,n){var e=0;return(t=+t)&&(t<0&&(t*=-1),n&&(t=a.round(t,Pn(t,n))),e=1+Math.floor(1e-12+Math.log(t)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((e-1)/3)))),Cn[8+e/3]};var Ln=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Un=a.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,n){return t.toPrecision(n)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},r:function(t,n){return(t=a.round(t,Pn(t,n))).toFixed(Math.max(0,Math.min(20,Pn(t*(1+1e-15),n))))}});function Dn(t){return t+""}var zn=a.time={},qn=Date;function jn(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}jn.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){Fn.setUTCDate.apply(this._,arguments)},setDay:function(){Fn.setUTCDay.apply(this._,arguments)},setFullYear:function(){Fn.setUTCFullYear.apply(this._,arguments)},setHours:function(){Fn.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Fn.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Fn.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Fn.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Fn.setUTCSeconds.apply(this._,arguments)},setTime:function(){Fn.setTime.apply(this._,arguments)}};var Fn=Date.prototype;function Bn(t,n,e){function r(n){var e=t(n),r=a(e,1);return n-e<r-n?e:r}function o(e){return n(e=t(new qn(e-1)),1),e}function a(t,e){return n(t=new qn(+t),e),t}function i(t,r,a){var i=o(t),u=[];if(a>1)for(;i<r;)e(i)%a||u.push(new Date(+i)),n(i,1);else for(;i<r;)u.push(new Date(+i)),n(i,1);return u}t.floor=t,t.round=r,t.ceil=o,t.offset=a,t.range=i;var u=t.utc=In(t);return u.floor=u,u.round=In(r),u.ceil=In(o),u.offset=In(a),u.range=function(t,n,e){try{qn=jn;var r=new jn;return r._=t,i(r,n,e)}finally{qn=Date}},t}function In(t){return function(n,e){try{qn=jn;var r=new jn;return r._=n,t(r,e)._}finally{qn=Date}}}function Xn(t){var n=t.dateTime,e=t.date,r=t.time,o=t.periods,i=t.days,u=t.shortDays,s=t.months,l=t.shortMonths;function c(t){var n=t.length;function e(e){for(var r,o,a,i=[],u=-1,s=0;++u<n;)37===t.charCodeAt(u)&&(i.push(t.slice(s,u)),null!=(o=Yn[r=t.charAt(++u)])&&(r=t.charAt(++u)),(a=M[r])&&(r=a(e,null==o?"e"===r?" ":"0":o)),i.push(r),s=u+1);return i.push(t.slice(s,u)),i.join("")}return e.parse=function(n){var e={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null};if(f(e,t,n,0)!=n.length)return null;"p"in e&&(e.H=e.H%12+12*e.p);var r=null!=e.Z&&qn!==jn,o=new(r?jn:qn);return"j"in e?o.setFullYear(e.y,0,e.j):"W"in e||"U"in e?("w"in e||(e.w="W"in e?1:0),o.setFullYear(e.y,0,1),o.setFullYear(e.y,0,"W"in e?(e.w+6)%7+7*e.W-(o.getDay()+5)%7:e.w+7*e.U-(o.getDay()+6)%7)):o.setFullYear(e.y,e.m,e.d),o.setHours(e.H+(e.Z/100|0),e.M+e.Z%100,e.S,e.L),r?o._:o},e.toString=function(){return t},e}function f(t,n,e,r){for(var o,a,i,u=0,s=n.length,l=e.length;u<s;){if(r>=l)return-1;if(37===(o=n.charCodeAt(u++))){if(i=n.charAt(u++),!(a=w[i in Yn?n.charAt(u++):i])||(r=a(t,e,r))<0)return-1}else if(o!=e.charCodeAt(r++))return-1}return r}c.utc=function(t){var n=c(t);function e(t){try{var e=new(qn=jn);return e._=t,n(e)}finally{qn=Date}}return e.parse=function(t){try{qn=jn;var e=n.parse(t);return e&&e._}finally{qn=Date}},e.toString=n.toString,e},c.multi=c.utc.multi=fe;var h=a.map(),p=Wn(i),d=Zn(i),m=Wn(u),g=Zn(u),v=Wn(s),y=Zn(s),b=Wn(l),x=Zn(l);o.forEach((function(t,n){h.set(t.toLowerCase(),n)}));var M={a:function(t){return u[t.getDay()]},A:function(t){return i[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:c(n),d:function(t,n){return Gn(t.getDate(),n,2)},e:function(t,n){return Gn(t.getDate(),n,2)},H:function(t,n){return Gn(t.getHours(),n,2)},I:function(t,n){return Gn(t.getHours()%12||12,n,2)},j:function(t,n){return Gn(1+zn.dayOfYear(t),n,3)},L:function(t,n){return Gn(t.getMilliseconds(),n,3)},m:function(t,n){return Gn(t.getMonth()+1,n,2)},M:function(t,n){return Gn(t.getMinutes(),n,2)},p:function(t){return o[+(t.getHours()>=12)]},S:function(t,n){return Gn(t.getSeconds(),n,2)},U:function(t,n){return Gn(zn.sundayOfYear(t),n,2)},w:function(t){return t.getDay()},W:function(t,n){return Gn(zn.mondayOfYear(t),n,2)},x:c(e),X:c(r),y:function(t,n){return Gn(t.getFullYear()%100,n,2)},Y:function(t,n){return Gn(t.getFullYear()%1e4,n,4)},Z:le,"%":function(){return"%"}},w={a:function(t,n,e){m.lastIndex=0;var r=m.exec(n.slice(e));return r?(t.w=g.get(r[0].toLowerCase()),e+r[0].length):-1},A:function(t,n,e){p.lastIndex=0;var r=p.exec(n.slice(e));return r?(t.w=d.get(r[0].toLowerCase()),e+r[0].length):-1},b:function(t,n,e){b.lastIndex=0;var r=b.exec(n.slice(e));return r?(t.m=x.get(r[0].toLowerCase()),e+r[0].length):-1},B:function(t,n,e){v.lastIndex=0;var r=v.exec(n.slice(e));return r?(t.m=y.get(r[0].toLowerCase()),e+r[0].length):-1},c:function(t,n,e){return f(t,M.c.toString(),n,e)},d:re,e:re,H:ae,I:ae,j:oe,L:se,m:ee,M:ie,p:function(t,n,e){var r=h.get(n.slice(e,e+=2).toLowerCase());return null==r?-1:(t.p=r,e)},S:ue,U:$n,w:Jn,W:Kn,x:function(t,n,e){return f(t,M.x.toString(),n,e)},X:function(t,n,e){return f(t,M.X.toString(),n,e)},y:te,Y:Qn,Z:ne,"%":ce};return c}zn.year=Bn((function(t){return(t=zn.day(t)).setMonth(0,1),t}),(function(t,n){t.setFullYear(t.getFullYear()+n)}),(function(t){return t.getFullYear()})),zn.years=zn.year.range,zn.years.utc=zn.year.utc.range,zn.day=Bn((function(t){var n=new qn(2e3,0);return n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),n}),(function(t,n){t.setDate(t.getDate()+n)}),(function(t){return t.getDate()-1})),zn.days=zn.day.range,zn.days.utc=zn.day.utc.range,zn.dayOfYear=function(t){var n=zn.year(t);return Math.floor((t-n-6e4*(t.getTimezoneOffset()-n.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(t,n){n=7-n;var e=zn[t]=Bn((function(t){return(t=zn.day(t)).setDate(t.getDate()-(t.getDay()+n)%7),t}),(function(t,n){t.setDate(t.getDate()+7*Math.floor(n))}),(function(t){var e=zn.year(t).getDay();return Math.floor((zn.dayOfYear(t)+(e+n)%7)/7)-(e!==n)}));zn[t+"s"]=e.range,zn[t+"s"].utc=e.utc.range,zn[t+"OfYear"]=function(t){var e=zn.year(t).getDay();return Math.floor((zn.dayOfYear(t)+(e+n)%7)/7)}})),zn.week=zn.sunday,zn.weeks=zn.sunday.range,zn.weeks.utc=zn.sunday.utc.range,zn.weekOfYear=zn.sundayOfYear;var Yn={"-":"",_:" ",0:"0"},Vn=/^\s*\d+/,Hn=/^%/;function Gn(t,n,e){var r=t<0?"-":"",o=(r?-t:t)+"",a=o.length;return r+(a<e?new Array(e-a+1).join(n)+o:o)}function Wn(t){return new RegExp("^(?:"+t.map(a.requote).join("|")+")","i")}function Zn(t){for(var n=new S,e=-1,r=t.length;++e<r;)n.set(t[e].toLowerCase(),e);return n}function Jn(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function $n(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e));return r?(t.U=+r[0],e+r[0].length):-1}function Kn(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e));return r?(t.W=+r[0],e+r[0].length):-1}function Qn(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function te(t,n,e){Vn.lastIndex=0;var r,o=Vn.exec(n.slice(e,e+2));return o?(t.y=(r=+o[0])+(r>68?1900:2e3),e+o[0].length):-1}function ne(t,n,e){return/^[+-]\d{4}$/.test(n=n.slice(e,e+5))?(t.Z=-n,e+5):-1}function ee(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function re(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function oe(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+3));return r?(t.j=+r[0],e+r[0].length):-1}function ae(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function ie(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function ue(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function se(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function le(t){var n=t.getTimezoneOffset(),e=n>0?"-":"+",r=w(n)/60|0,o=w(n)%60;return e+Gn(r,"0",2)+Gn(o,"0",2)}function ce(t,n,e){Hn.lastIndex=0;var r=Hn.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function fe(t){for(var n=t.length,e=-1;++e<n;)t[e][0]=this(t[e][0]);return function(n){for(var e=0,r=t[e];!r[1](n);)r=t[++e];return r[0](n)}}a.locale=function(t){return{numberFormat:On(t),timeFormat:Xn(t)}};var he=a.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function pe(){}a.format=he.numberFormat,a.geo={},pe.prototype={s:0,t:0,add:function(t){me(t,this.t,de),me(de.s,this.s,this),this.s?this.t+=de.t:this.s=de.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var de=new pe;function me(t,n,e){var r=e.s=t+n,o=r-t,a=r-o;e.t=t-a+(n-o)}function ge(t,n){t&&ye.hasOwnProperty(t.type)&&ye[t.type](t,n)}a.geo.stream=function(t,n){t&&ve.hasOwnProperty(t.type)?ve[t.type](t,n):ge(t,n)};var ve={Feature:function(t,n){ge(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,o=e.length;++r<o;)ge(e[r].geometry,n)}},ye={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,o=e.length;++r<o;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){be(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,o=e.length;++r<o;)be(e[r],n,0)},Polygon:function(t,n){xe(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,o=e.length;++r<o;)xe(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,o=e.length;++r<o;)ge(e[r],n)}};function be(t,n,e){var r,o=-1,a=t.length-e;for(n.lineStart();++o<a;)r=t[o],n.point(r[0],r[1],r[2]);n.lineEnd()}function xe(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)be(t[e],n,1);n.polygonEnd()}a.geo.area=function(t){return Me=0,a.geo.stream(t,Le),Me};var Me,we,_e,ke,Se,Ae,Ee,Te,Re,Ne,Pe,Ce,Oe=new pe,Le={sphere:function(){Me+=4*Nt},point:q,lineStart:q,lineEnd:q,polygonStart:function(){Oe.reset(),Le.lineStart=Ue},polygonEnd:function(){var t=2*Oe;Me+=t<0?4*Nt+t:t,Le.lineStart=Le.lineEnd=Le.point=q}};function Ue(){var t,n,e,r,o;function a(t,n){n=n*Lt/2+Nt/4;var a=(t*=Lt)-e,i=a>=0?1:-1,u=i*a,s=Math.cos(n),l=Math.sin(n),c=o*l,f=r*s+c*Math.cos(u),h=c*i*Math.sin(u);Oe.add(Math.atan2(h,f)),e=t,r=s,o=l}Le.point=function(i,u){Le.point=a,e=(t=i)*Lt,r=Math.cos(u=(n=u)*Lt/2+Nt/4),o=Math.sin(u)},Le.lineEnd=function(){a(t,n)}}function De(t){var n=t[0],e=t[1],r=Math.cos(e);return[r*Math.cos(n),r*Math.sin(n),Math.sin(e)]}function ze(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function qe(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function je(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function Fe(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function Be(t){var n=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}function Ie(t){return[Math.atan2(t[1],t[0]),jt(t[2])]}function Xe(t,n){return w(t[0]-n[0])<Tt&&w(t[1]-n[1])<Tt}a.geo.bounds=function(){var t,n,e,r,o,i,u,s,l,c,f,h={point:p,lineStart:m,lineEnd:g,polygonStart:function(){h.point=v,h.lineStart=y,h.lineEnd=b,l=0,Le.polygonStart()},polygonEnd:function(){Le.polygonEnd(),h.point=p,h.lineStart=m,h.lineEnd=g,Oe<0?(t=-(e=180),n=-(r=90)):l>Tt?r=90:l<-Tt&&(n=-90),f[0]=t,f[1]=e}};function p(o,a){c.push(f=[t=o,e=o]),a<n&&(n=a),a>r&&(r=a)}function d(a,i){var u=De([a*Lt,i*Lt]);if(s){var l=qe(s,u),c=qe([l[1],-l[0],0],l);Be(c),c=Ie(c);var f=a-o,h=f>0?1:-1,d=c[0]*Ut*h,m=w(f)>180;if(m^(h*o<d&&d<h*a))(g=c[1]*Ut)>r&&(r=g);else if(m^(h*o<(d=(d+360)%360-180)&&d<h*a)){var g;(g=-c[1]*Ut)<n&&(n=g)}else i<n&&(n=i),i>r&&(r=i);m?a<o?x(t,a)>x(t,e)&&(e=a):x(a,e)>x(t,e)&&(t=a):e>=t?(a<t&&(t=a),a>e&&(e=a)):a>o?x(t,a)>x(t,e)&&(e=a):x(a,e)>x(t,e)&&(t=a)}else p(a,i);s=u,o=a}function m(){h.point=d}function g(){f[0]=t,f[1]=e,h.point=p,s=null}function v(t,n){if(s){var e=t-o;l+=w(e)>180?e+(e>0?360:-360):e}else i=t,u=n;Le.point(t,n),d(t,n)}function y(){Le.lineStart()}function b(){v(i,u),Le.lineEnd(),w(l)>Tt&&(t=-(e=180)),f[0]=t,f[1]=e,s=null}function x(t,n){return(n-=t)<0?n+360:n}function M(t,n){return t[0]-n[0]}function _(t,n){return n[0]<=n[1]?n[0]<=t&&t<=n[1]:t<n[0]||n[1]<t}return function(o){if(r=e=-(t=n=1/0),c=[],a.geo.stream(o,h),l=c.length){c.sort(M);for(var i=1,u=[m=c[0]];i<l;++i)_((p=c[i])[0],m)||_(p[1],m)?(x(m[0],p[1])>x(m[0],m[1])&&(m[1]=p[1]),x(p[0],m[1])>x(m[0],m[1])&&(m[0]=p[0])):u.push(m=p);for(var s,l,p,d=-1/0,m=(i=0,u[l=u.length-1]);i<=l;m=p,++i)p=u[i],(s=x(m[1],p[0]))>d&&(d=s,t=p[0],e=m[1])}return c=f=null,t===1/0||n===1/0?[[NaN,NaN],[NaN,NaN]]:[[t,n],[e,r]]}}(),a.geo.centroid=function(t){we=_e=ke=Se=Ae=Ee=Te=Re=Ne=Pe=Ce=0,a.geo.stream(t,Ye);var n=Ne,e=Pe,r=Ce,o=n*n+e*e+r*r;return o<Rt&&(n=Ee,e=Te,r=Re,_e<Tt&&(n=ke,e=Se,r=Ae),(o=n*n+e*e+r*r)<Rt)?[NaN,NaN]:[Math.atan2(e,n)*Ut,jt(r/Math.sqrt(o))*Ut]};var Ye={sphere:q,point:Ve,lineStart:Ge,lineEnd:We,polygonStart:function(){Ye.lineStart=Ze},polygonEnd:function(){Ye.lineStart=Ge}};function Ve(t,n){t*=Lt;var e=Math.cos(n*=Lt);He(e*Math.cos(t),e*Math.sin(t),Math.sin(n))}function He(t,n,e){++we,ke+=(t-ke)/we,Se+=(n-Se)/we,Ae+=(e-Ae)/we}function Ge(){var t,n,e;function r(r,o){r*=Lt;var a=Math.cos(o*=Lt),i=a*Math.cos(r),u=a*Math.sin(r),s=Math.sin(o),l=Math.atan2(Math.sqrt((l=n*s-e*u)*l+(l=e*i-t*s)*l+(l=t*u-n*i)*l),t*i+n*u+e*s);_e+=l,Ee+=l*(t+(t=i)),Te+=l*(n+(n=u)),Re+=l*(e+(e=s)),He(t,n,e)}Ye.point=function(o,a){o*=Lt;var i=Math.cos(a*=Lt);t=i*Math.cos(o),n=i*Math.sin(o),e=Math.sin(a),Ye.point=r,He(t,n,e)}}function We(){Ye.point=Ve}function Ze(){var t,n,e,r,o;function a(t,n){t*=Lt;var a=Math.cos(n*=Lt),i=a*Math.cos(t),u=a*Math.sin(t),s=Math.sin(n),l=r*s-o*u,c=o*i-e*s,f=e*u-r*i,h=Math.sqrt(l*l+c*c+f*f),p=e*i+r*u+o*s,d=h&&-qt(p)/h,m=Math.atan2(h,p);Ne+=d*l,Pe+=d*c,Ce+=d*f,_e+=m,Ee+=m*(e+(e=i)),Te+=m*(r+(r=u)),Re+=m*(o+(o=s)),He(e,r,o)}Ye.point=function(i,u){t=i,n=u,Ye.point=a,i*=Lt;var s=Math.cos(u*=Lt);e=s*Math.cos(i),r=s*Math.sin(i),o=Math.sin(u),He(e,r,o)},Ye.lineEnd=function(){a(t,n),Ye.lineEnd=We,Ye.point=Ve}}function Je(t,n){function e(e,r){return e=t(e,r),n(e[0],e[1])}return t.invert&&n.invert&&(e.invert=function(e,r){return(e=n.invert(e,r))&&t.invert(e[0],e[1])}),e}function $e(){return!0}function Ke(t,n,e,r,o){var a=[],i=[];if(t.forEach((function(t){if(!((n=t.length-1)<=0)){var n,e=t[0],r=t[n];if(Xe(e,r)){o.lineStart();for(var u=0;u<n;++u)o.point((e=t[u])[0],e[1]);o.lineEnd()}else{var s=new tr(e,t,null,!0),l=new tr(e,null,s,!1);s.o=l,a.push(s),i.push(l),s=new tr(r,t,null,!1),l=new tr(r,null,s,!0),s.o=l,a.push(s),i.push(l)}}})),i.sort(n),Qe(a),Qe(i),a.length){for(var u=0,s=e,l=i.length;u<l;++u)i[u].e=s=!s;for(var c,f,h=a[0];;){for(var p=h,d=!0;p.v;)if((p=p.n)===h)return;c=p.z,o.lineStart();do{if(p.v=p.o.v=!0,p.e){if(d)for(u=0,l=c.length;u<l;++u)o.point((f=c[u])[0],f[1]);else r(p.x,p.n.x,1,o);p=p.n}else{if(d)for(u=(c=p.p.z).length-1;u>=0;--u)o.point((f=c[u])[0],f[1]);else r(p.x,p.p.x,-1,o);p=p.p}c=(p=p.o).z,d=!d}while(!p.v);o.lineEnd()}}}function Qe(t){if(n=t.length){for(var n,e,r=0,o=t[0];++r<n;)o.n=e=t[r],e.p=o,o=e;o.n=e=t[0],e.p=o}}function tr(t,n,e,r){this.x=t,this.z=n,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function nr(t,n,e,r){return function(o,i){var u,s=n(i),l=o.invert(r[0],r[1]),c={point:f,lineStart:p,lineEnd:d,polygonStart:function(){c.point=x,c.lineStart=M,c.lineEnd=w,u=[],m=[]},polygonEnd:function(){c.point=f,c.lineStart=p,c.lineEnd=d,u=a.merge(u);var t=function(t,n){var e=t[0],r=t[1],o=[Math.sin(e),-Math.cos(e),0],a=0,i=0;Oe.reset();for(var u=0,s=n.length;u<s;++u){var l=n[u],c=l.length;if(c)for(var f=l[0],h=f[0],p=f[1]/2+Nt/4,d=Math.sin(p),m=Math.cos(p),g=1;;){g===c&&(g=0);var v=(t=l[g])[0],y=t[1]/2+Nt/4,b=Math.sin(y),x=Math.cos(y),M=v-h,w=M>=0?1:-1,_=w*M,k=_>Nt,S=d*b;if(Oe.add(Math.atan2(S*w*Math.sin(_),m*x+S*Math.cos(_))),a+=k?M+w*Pt:M,k^h>=e^v>=e){var A=qe(De(f),De(t));Be(A);var E=qe(o,A);Be(E);var T=(k^M>=0?-1:1)*jt(E[2]);(r>T||r===T&&(A[0]||A[1]))&&(i+=k^M>=0?1:-1)}if(!g++)break;h=v,d=b,m=x,f=t}}return(a<-Tt||a<Tt&&Oe<-Tt)^1&i}(l,m);u.length?(b||(i.polygonStart(),b=!0),Ke(u,or,t,e,i)):t&&(b||(i.polygonStart(),b=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),b&&(i.polygonEnd(),b=!1),u=m=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function f(n,e){var r=o(n,e);t(n=r[0],e=r[1])&&i.point(n,e)}function h(t,n){var e=o(t,n);s.point(e[0],e[1])}function p(){c.point=h,s.lineStart()}function d(){c.point=f,s.lineEnd()}var m,g,v=rr(),y=n(v),b=!1;function x(t,n){g.push([t,n]);var e=o(t,n);y.point(e[0],e[1])}function M(){y.lineStart(),g=[]}function w(){x(g[0][0],g[0][1]),y.lineEnd();var t,n=y.clean(),e=v.buffer(),r=e.length;if(g.pop(),m.push(g),g=null,r)if(1&n){var o,a=-1;if((r=(t=e[0]).length-1)>0){for(b||(i.polygonStart(),b=!0),i.lineStart();++a<r;)i.point((o=t[a])[0],o[1]);i.lineEnd()}}else r>1&&2&n&&e.push(e.pop().concat(e.shift())),u.push(e.filter(er))}return c}}function er(t){return t.length>1}function rr(){var t,n=[];return{lineStart:function(){n.push(t=[])},point:function(n,e){t.push([n,e])},lineEnd:q,buffer:function(){var e=n;return n=[],t=null,e},rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))}}}function or(t,n){return((t=t.x)[0]<0?t[1]-Ot-Tt:Ot-t[1])-((n=n.x)[0]<0?n[1]-Ot-Tt:Ot-n[1])}var ar=nr($e,(function(t){var n,e=NaN,r=NaN,o=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(a,i){var u=a>0?Nt:-Nt,s=w(a-e);w(s-Nt)<Tt?(t.point(e,r=(r+i)/2>0?Ot:-Ot),t.point(o,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(a,r),n=0):o!==u&&s>=Nt&&(w(e-o)<Tt&&(e-=o*Tt),w(a-u)<Tt&&(a-=u*Tt),r=function(t,n,e,r){var o,a,i=Math.sin(t-e);return w(i)>Tt?Math.atan((Math.sin(n)*(a=Math.cos(r))*Math.sin(e)-Math.sin(r)*(o=Math.cos(n))*Math.sin(t))/(o*a*i)):(n+r)/2}(e,r,a,i),t.point(o,r),t.lineEnd(),t.lineStart(),t.point(u,r),n=0),t.point(e=a,r=i),o=u},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}}),(function(t,n,e,r){var o;if(null==t)o=e*Ot,r.point(-Nt,o),r.point(0,o),r.point(Nt,o),r.point(Nt,0),r.point(Nt,-o),r.point(0,-o),r.point(-Nt,-o),r.point(-Nt,0),r.point(-Nt,o);else if(w(t[0]-n[0])>Tt){var a=t[0]<n[0]?Nt:-Nt;o=e*a/2,r.point(-a,o),r.point(0,o),r.point(a,o)}else r.point(n[0],n[1])}),[-Nt,-Nt/2]);function ir(t){var n=Math.cos(t),e=n>0,r=w(n)>Tt;return nr(o,(function(t){var n,u,s,l,c;return{lineStart:function(){l=s=!1,c=1},point:function(f,h){var p,d=[f,h],m=o(f,h),g=e?m?0:i(f,h):m?i(f+(f<0?Nt:-Nt),h):0;if(!n&&(l=s=m)&&t.lineStart(),m!==s&&(p=a(n,d),(Xe(n,p)||Xe(d,p))&&(d[0]+=Tt,d[1]+=Tt,m=o(d[0],d[1]))),m!==s)c=0,m?(t.lineStart(),p=a(d,n),t.point(p[0],p[1])):(p=a(n,d),t.point(p[0],p[1]),t.lineEnd()),n=p;else if(r&&n&&e^m){var v;g&u||!(v=a(d,n,!0))||(c=0,e?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1])))}!m||n&&Xe(n,d)||t.point(d[0],d[1]),n=d,s=m,u=g},lineEnd:function(){s&&t.lineEnd(),n=null},clean:function(){return c|(l&&s)<<1}}}),Ir(t,6*Lt),e?[0,-t]:[-Nt,t-Nt]);function o(t,e){return Math.cos(t)*Math.cos(e)>n}function a(t,e,r){var o=[1,0,0],a=qe(De(t),De(e)),i=ze(a,a),u=a[0],s=i-u*u;if(!s)return!r&&t;var l=n*i/s,c=-n*u/s,f=qe(o,a),h=Fe(o,l);je(h,Fe(a,c));var p=f,d=ze(h,p),m=ze(p,p),g=d*d-m*(ze(h,h)-1);if(!(g<0)){var v=Math.sqrt(g),y=Fe(p,(-d-v)/m);if(je(y,h),y=Ie(y),!r)return y;var b,x=t[0],M=e[0],_=t[1],k=e[1];M<x&&(b=x,x=M,M=b);var S=M-x,A=w(S-Nt)<Tt;if(!A&&k<_&&(b=_,_=k,k=b),A||S<Tt?A?_+k>0^y[1]<(w(y[0]-x)<Tt?_:k):_<=y[1]&&y[1]<=k:S>Nt^(x<=y[0]&&y[0]<=M)){var E=Fe(p,(-d+v)/m);return je(E,h),[y,Ie(E)]}}}function i(n,r){var o=e?t:Nt-t,a=0;return n<-o?a|=1:n>o&&(a|=2),r<-o?a|=4:r>o&&(a|=8),a}}function ur(t,n,e,r){return function(o){var a,i=o.a,u=o.b,s=i.x,l=i.y,c=0,f=1,h=u.x-s,p=u.y-l;if(a=t-s,h||!(a>0)){if(a/=h,h<0){if(a<c)return;a<f&&(f=a)}else if(h>0){if(a>f)return;a>c&&(c=a)}if(a=e-s,h||!(a<0)){if(a/=h,h<0){if(a>f)return;a>c&&(c=a)}else if(h>0){if(a<c)return;a<f&&(f=a)}if(a=n-l,p||!(a>0)){if(a/=p,p<0){if(a<c)return;a<f&&(f=a)}else if(p>0){if(a>f)return;a>c&&(c=a)}if(a=r-l,p||!(a<0)){if(a/=p,p<0){if(a>f)return;a>c&&(c=a)}else if(p>0){if(a<c)return;a<f&&(f=a)}return c>0&&(o.a={x:s+c*h,y:l+c*p}),f<1&&(o.b={x:s+f*h,y:l+f*p}),o}}}}}}function sr(t,n,e,r){return function(s){var l,c,f,h,p,d,m,g,v,y,b,x=s,M=rr(),w=ur(t,n,e,r),_={point:A,lineStart:function(){_.point=E,c&&c.push(f=[]),y=!0,v=!1,m=g=NaN},lineEnd:function(){l&&(E(h,p),d&&v&&M.rejoin(),l.push(M.buffer())),_.point=A,v&&s.lineEnd()},polygonStart:function(){s=M,l=[],c=[],b=!0},polygonEnd:function(){s=x,l=a.merge(l);var n=function(t){for(var n=0,e=c.length,r=t[1],o=0;o<e;++o)for(var a,i=1,u=c[o],s=u.length,l=u[0];i<s;++i)a=u[i],l[1]<=r?a[1]>r&&zt(l,a,t)>0&&++n:a[1]<=r&&zt(l,a,t)<0&&--n,l=a;return 0!==n}([t,r]),e=b&&n,o=l.length;(e||o)&&(s.polygonStart(),e&&(s.lineStart(),k(null,null,1,s),s.lineEnd()),o&&Ke(l,i,n,k,s),s.polygonEnd()),l=c=f=null}};function k(a,i,s,l){var c=0,f=0;if(null==a||(c=o(a,s))!==(f=o(i,s))||u(a,i)<0^s>0)do{l.point(0===c||3===c?t:e,c>1?r:n)}while((c=(c+s+4)%4)!==f);else l.point(i[0],i[1])}function S(o,a){return t<=o&&o<=e&&n<=a&&a<=r}function A(t,n){S(t,n)&&s.point(t,n)}function E(t,n){var e=S(t=Math.max(-1e9,Math.min(1e9,t)),n=Math.max(-1e9,Math.min(1e9,n)));if(c&&f.push([t,n]),y)h=t,p=n,d=e,y=!1,e&&(s.lineStart(),s.point(t,n));else if(e&&v)s.point(t,n);else{var r={a:{x:m,y:g},b:{x:t,y:n}};w(r)?(v||(s.lineStart(),s.point(r.a.x,r.a.y)),s.point(r.b.x,r.b.y),e||s.lineEnd(),b=!1):e&&(s.lineStart(),s.point(t,n),b=!1)}m=t,g=n,v=e}return _};function o(r,o){return w(r[0]-t)<Tt?o>0?0:3:w(r[0]-e)<Tt?o>0?2:1:w(r[1]-n)<Tt?o>0?1:0:o>0?3:2}function i(t,n){return u(t.x,n.x)}function u(t,n){var e=o(t,1),r=o(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}}function lr(t){var n=0,e=Nt/3,r=Lr(t),o=r(n,e);return o.parallels=function(t){return arguments.length?r(n=t[0]*Nt/180,e=t[1]*Nt/180):[n/Nt*180,e/Nt*180]},o}function cr(t,n){var e=Math.sin(t),r=(e+Math.sin(n))/2,o=1+e*(2*r-e),a=Math.sqrt(o)/r;function i(t,n){var e=Math.sqrt(o-2*r*Math.sin(n))/r;return[e*Math.sin(t*=r),a-e*Math.cos(t)]}return i.invert=function(t,n){var e=a-n;return[Math.atan2(t,e)/r,jt((o-(t*t+e*e)*r*r)/(2*r))]},i}a.geo.clipExtent=function(){var t,n,e,r,o,a,i={stream:function(t){return o&&(o.valid=!1),(o=a(t)).valid=!0,o},extent:function(u){return arguments.length?(a=sr(t=+u[0][0],n=+u[0][1],e=+u[1][0],r=+u[1][1]),o&&(o.valid=!1,o=null),i):[[t,n],[e,r]]}};return i.extent([[0,0],[960,500]])},(a.geo.conicEqualArea=function(){return lr(cr)}).raw=cr,a.geo.albers=function(){return a.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},a.geo.albersUsa=function(){var t,n,e,r,o=a.geo.albers(),i=a.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),u=a.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),s={point:function(n,e){t=[n,e]}};function l(o){var a=o[0],i=o[1];return t=null,n(a,i),t||(e(a,i),t)||r(a,i),t}return l.invert=function(t){var n=o.scale(),e=o.translate(),r=(t[0]-e[0])/n,a=(t[1]-e[1])/n;return(a>=.12&&a<.234&&r>=-.425&&r<-.214?i:a>=.166&&a<.234&&r>=-.214&&r<-.115?u:o).invert(t)},l.stream=function(t){var n=o.stream(t),e=i.stream(t),r=u.stream(t);return{point:function(t,o){n.point(t,o),e.point(t,o),r.point(t,o)},sphere:function(){n.sphere(),e.sphere(),r.sphere()},lineStart:function(){n.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){n.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){n.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){n.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},l.precision=function(t){return arguments.length?(o.precision(t),i.precision(t),u.precision(t),l):o.precision()},l.scale=function(t){return arguments.length?(o.scale(t),i.scale(.35*t),u.scale(t),l.translate(o.translate())):o.scale()},l.translate=function(t){if(!arguments.length)return o.translate();var a=o.scale(),c=+t[0],f=+t[1];return n=o.translate(t).clipExtent([[c-.455*a,f-.238*a],[c+.455*a,f+.238*a]]).stream(s).point,e=i.translate([c-.307*a,f+.201*a]).clipExtent([[c-.425*a+Tt,f+.12*a+Tt],[c-.214*a-Tt,f+.234*a-Tt]]).stream(s).point,r=u.translate([c-.205*a,f+.212*a]).clipExtent([[c-.214*a+Tt,f+.166*a+Tt],[c-.115*a-Tt,f+.234*a-Tt]]).stream(s).point,l},l.scale(1070)};var fr,hr,pr,dr,mr,gr,vr={point:q,lineStart:q,lineEnd:q,polygonStart:function(){hr=0,vr.lineStart=yr},polygonEnd:function(){vr.lineStart=vr.lineEnd=vr.point=q,fr+=w(hr/2)}};function yr(){var t,n,e,r;function o(t,n){hr+=r*t-e*n,e=t,r=n}vr.point=function(a,i){vr.point=o,t=e=a,n=r=i},vr.lineEnd=function(){o(t,n)}}var br={point:function(t,n){t<pr&&(pr=t),t>mr&&(mr=t),n<dr&&(dr=n),n>gr&&(gr=n)},lineStart:q,lineEnd:q,polygonStart:q,polygonEnd:q};function xr(){var t=Mr(4.5),n=[],e={point:r,lineStart:function(){e.point=o},lineEnd:i,polygonStart:function(){e.lineEnd=u},polygonEnd:function(){e.lineEnd=i,e.point=r},pointRadius:function(n){return t=Mr(n),e},result:function(){if(n.length){var t=n.join("");return n=[],t}}};function r(e,r){n.push("M",e,",",r,t)}function o(t,r){n.push("M",t,",",r),e.point=a}function a(t,e){n.push("L",t,",",e)}function i(){e.point=r}function u(){n.push("Z")}return e}function Mr(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}var wr,_r={point:kr,lineStart:Sr,lineEnd:Ar,polygonStart:function(){_r.lineStart=Er},polygonEnd:function(){_r.point=kr,_r.lineStart=Sr,_r.lineEnd=Ar}};function kr(t,n){ke+=t,Se+=n,++Ae}function Sr(){var t,n;function e(e,r){var o=e-t,a=r-n,i=Math.sqrt(o*o+a*a);Ee+=i*(t+e)/2,Te+=i*(n+r)/2,Re+=i,kr(t=e,n=r)}_r.point=function(r,o){_r.point=e,kr(t=r,n=o)}}function Ar(){_r.point=kr}function Er(){var t,n,e,r;function o(t,n){var o=t-e,a=n-r,i=Math.sqrt(o*o+a*a);Ee+=i*(e+t)/2,Te+=i*(r+n)/2,Re+=i,Ne+=(i=r*t-e*n)*(e+t),Pe+=i*(r+n),Ce+=3*i,kr(e=t,r=n)}_r.point=function(a,i){_r.point=o,kr(t=e=a,n=r=i)},_r.lineEnd=function(){o(t,n)}}function Tr(t){var n=4.5,e={point:r,lineStart:function(){e.point=o},lineEnd:i,polygonStart:function(){e.lineEnd=u},polygonEnd:function(){e.lineEnd=i,e.point=r},pointRadius:function(t){return n=t,e},result:q};function r(e,r){t.moveTo(e+n,r),t.arc(e,r,n,0,Pt)}function o(n,r){t.moveTo(n,r),e.point=a}function a(n,e){t.lineTo(n,e)}function i(){e.point=r}function u(){t.closePath()}return e}function Rr(t){var n=.5,e=Math.cos(30*Lt),r=16;function o(t){return(r?i:a)(t)}function a(n){return Cr(n,(function(e,r){e=t(e,r),n.point(e[0],e[1])}))}function i(n){var e,o,a,i,s,l,c,f,h,p,d,m,g={point:v,lineStart:y,lineEnd:x,polygonStart:function(){n.polygonStart(),g.lineStart=M},polygonEnd:function(){n.polygonEnd(),g.lineStart=y}};function v(e,r){e=t(e,r),n.point(e[0],e[1])}function y(){f=NaN,g.point=b,n.lineStart()}function b(e,o){var a=De([e,o]),i=t(e,o);u(f,h,c,p,d,m,f=i[0],h=i[1],c=e,p=a[0],d=a[1],m=a[2],r,n),n.point(f,h)}function x(){g.point=v,n.lineEnd()}function M(){y(),g.point=w,g.lineEnd=_}function w(t,n){b(e=t,n),o=f,a=h,i=p,s=d,l=m,g.point=b}function _(){u(f,h,c,p,d,m,o,a,e,i,s,l,r,n),g.lineEnd=x,x()}return g}function u(r,o,a,i,s,l,c,f,h,p,d,m,g,v){var y=c-r,b=f-o,x=y*y+b*b;if(x>4*n&&g--){var M=i+p,_=s+d,k=l+m,S=Math.sqrt(M*M+_*_+k*k),A=Math.asin(k/=S),E=w(w(k)-1)<Tt||w(a-h)<Tt?(a+h)/2:Math.atan2(_,M),T=t(E,A),R=T[0],N=T[1],P=R-r,C=N-o,O=b*P-y*C;(O*O/x>n||w((y*P+b*C)/x-.5)>.3||i*p+s*d+l*m<e)&&(u(r,o,a,i,s,l,R,N,E,M/=S,_/=S,k,g,v),v.point(R,N),u(R,N,E,M,_,k,c,f,h,p,d,m,g,v))}}return o.precision=function(t){return arguments.length?(r=(n=t*t)>0&&16,o):Math.sqrt(n)},o}function Nr(t){var n=Rr((function(n,e){return t([n*Ut,e*Ut])}));return function(t){return Ur(n(t))}}function Pr(t){this.stream=t}function Cr(t,n){return{point:n,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function Or(t){return Lr((function(){return t}))()}function Lr(t){var n,e,r,o,i,u,s=Rr((function(t,e){return[(t=n(t,e))[0]*l+o,i-t[1]*l]})),l=150,c=480,f=250,h=0,p=0,d=0,m=0,g=0,v=ar,y=L,b=null,x=null;function M(t){return[(t=r(t[0]*Lt,t[1]*Lt))[0]*l+o,i-t[1]*l]}function w(t){return(t=r.invert((t[0]-o)/l,(i-t[1])/l))&&[t[0]*Ut,t[1]*Ut]}function _(){r=Je(e=qr(d,m,g),n);var t=n(h,p);return o=c-t[0]*l,i=f+t[1]*l,k()}function k(){return u&&(u.valid=!1,u=null),M}return M.stream=function(t){return u&&(u.valid=!1),(u=Ur(v(e,s(y(t))))).valid=!0,u},M.clipAngle=function(t){return arguments.length?(v=null==t?(b=t,ar):ir((b=+t)*Lt),k()):b},M.clipExtent=function(t){return arguments.length?(x=t,y=t?sr(t[0][0],t[0][1],t[1][0],t[1][1]):L,k()):x},M.scale=function(t){return arguments.length?(l=+t,_()):l},M.translate=function(t){return arguments.length?(c=+t[0],f=+t[1],_()):[c,f]},M.center=function(t){return arguments.length?(h=t[0]%360*Lt,p=t[1]%360*Lt,_()):[h*Ut,p*Ut]},M.rotate=function(t){return arguments.length?(d=t[0]%360*Lt,m=t[1]%360*Lt,g=t.length>2?t[2]%360*Lt:0,_()):[d*Ut,m*Ut,g*Ut]},a.rebind(M,s,"precision"),function(){return n=t.apply(this,arguments),M.invert=n.invert&&w,_()}}function Ur(t){return Cr(t,(function(n,e){t.point(n*Lt,e*Lt)}))}function Dr(t,n){return[t,n]}function zr(t,n){return[t>Nt?t-Pt:t<-Nt?t+Pt:t,n]}function qr(t,n,e){return t?n||e?Je(Fr(t),Br(n,e)):Fr(t):n||e?Br(n,e):zr}function jr(t){return function(n,e){return[(n+=t)>Nt?n-Pt:n<-Nt?n+Pt:n,e]}}function Fr(t){var n=jr(t);return n.invert=jr(-t),n}function Br(t,n){var e=Math.cos(t),r=Math.sin(t),o=Math.cos(n),a=Math.sin(n);function i(t,n){var i=Math.cos(n),u=Math.cos(t)*i,s=Math.sin(t)*i,l=Math.sin(n),c=l*e+u*r;return[Math.atan2(s*o-c*a,u*e-l*r),jt(c*o+s*a)]}return i.invert=function(t,n){var i=Math.cos(n),u=Math.cos(t)*i,s=Math.sin(t)*i,l=Math.sin(n),c=l*o-s*a;return[Math.atan2(s*o+l*a,u*e+c*r),jt(c*e-u*r)]},i}function Ir(t,n){var e=Math.cos(t),r=Math.sin(t);return function(o,a,i,u){var s=i*n;null!=o?(o=Xr(e,o),a=Xr(e,a),(i>0?o<a:o>a)&&(o+=i*Pt)):(o=t+i*Pt,a=t-.5*s);for(var l,c=o;i>0?c>a:c<a;c-=s)u.point((l=Ie([e,-r*Math.cos(c),-r*Math.sin(c)]))[0],l[1])}}function Xr(t,n){var e=De(n);e[0]-=t,Be(e);var r=qt(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-Tt)%(2*Math.PI)}function Yr(t,n,e){var r=a.range(t,n-Tt,e).concat(n);return function(t){return r.map((function(n){return[t,n]}))}}function Vr(t,n,e){var r=a.range(t,n-Tt,e).concat(n);return function(t){return r.map((function(n){return[n,t]}))}}function Hr(t){return t.source}function Gr(t){return t.target}a.geo.path=function(){var t,n,e,r,o,i=4.5;function u(t){return t&&("function"==typeof i&&r.pointRadius(+i.apply(this,arguments)),o&&o.valid||(o=e(r)),a.geo.stream(t,o)),r.result()}function s(){return o=null,u}return u.area=function(t){return fr=0,a.geo.stream(t,e(vr)),fr},u.centroid=function(t){return ke=Se=Ae=Ee=Te=Re=Ne=Pe=Ce=0,a.geo.stream(t,e(_r)),Ce?[Ne/Ce,Pe/Ce]:Re?[Ee/Re,Te/Re]:Ae?[ke/Ae,Se/Ae]:[NaN,NaN]},u.bounds=function(t){return mr=gr=-(pr=dr=1/0),a.geo.stream(t,e(br)),[[pr,dr],[mr,gr]]},u.projection=function(n){return arguments.length?(e=(t=n)?n.stream||Nr(n):L,s()):t},u.context=function(t){return arguments.length?(r=null==(n=t)?new xr:new Tr(t),"function"!=typeof i&&r.pointRadius(i),s()):n},u.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(r.pointRadius(+t),+t),u):i},u.projection(a.geo.albersUsa()).context(null)},a.geo.transform=function(t){return{stream:function(n){var e=new Pr(n);for(var r in t)e[r]=t[r];return e}}},Pr.prototype={point:function(t,n){this.stream.point(t,n)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},a.geo.projection=Or,a.geo.projectionMutator=Lr,(a.geo.equirectangular=function(){return Or(Dr)}).raw=Dr.invert=Dr,a.geo.rotation=function(t){function n(n){return(n=t(n[0]*Lt,n[1]*Lt))[0]*=Ut,n[1]*=Ut,n}return t=qr(t[0]%360*Lt,t[1]*Lt,t.length>2?t[2]*Lt:0),n.invert=function(n){return(n=t.invert(n[0]*Lt,n[1]*Lt))[0]*=Ut,n[1]*=Ut,n},n},zr.invert=Dr,a.geo.circle=function(){var t,n,e=[0,0],r=6;function o(){var t="function"==typeof e?e.apply(this,arguments):e,r=qr(-t[0]*Lt,-t[1]*Lt,0).invert,o=[];return n(null,null,1,{point:function(t,n){o.push(t=r(t,n)),t[0]*=Ut,t[1]*=Ut}}),{type:"Polygon",coordinates:[o]}}return o.origin=function(t){return arguments.length?(e=t,o):e},o.angle=function(e){return arguments.length?(n=Ir((t=+e)*Lt,r*Lt),o):t},o.precision=function(e){return arguments.length?(n=Ir(t*Lt,(r=+e)*Lt),o):r},o.angle(90)},a.geo.distance=function(t,n){var e,r=(n[0]-t[0])*Lt,o=t[1]*Lt,a=n[1]*Lt,i=Math.sin(r),u=Math.cos(r),s=Math.sin(o),l=Math.cos(o),c=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((e=f*i)*e+(e=l*c-s*f*u)*e),s*c+l*f*u)},a.geo.graticule=function(){var t,n,e,r,o,i,u,s,l,c,f,h,p=10,d=p,m=90,g=360,v=2.5;function y(){return{type:"MultiLineString",coordinates:b()}}function b(){return a.range(Math.ceil(r/m)*m,e,m).map(f).concat(a.range(Math.ceil(s/g)*g,u,g).map(h)).concat(a.range(Math.ceil(n/p)*p,t,p).filter((function(t){return w(t%m)>Tt})).map(l)).concat(a.range(Math.ceil(i/d)*d,o,d).filter((function(t){return w(t%g)>Tt})).map(c))}return y.lines=function(){return b().map((function(t){return{type:"LineString",coordinates:t}}))},y.outline=function(){return{type:"Polygon",coordinates:[f(r).concat(h(u).slice(1),f(e).reverse().slice(1),h(s).reverse().slice(1))]}},y.extent=function(t){return arguments.length?y.majorExtent(t).minorExtent(t):y.minorExtent()},y.majorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],s=+t[0][1],u=+t[1][1],r>e&&(t=r,r=e,e=t),s>u&&(t=s,s=u,u=t),y.precision(v)):[[r,s],[e,u]]},y.minorExtent=function(e){return arguments.length?(n=+e[0][0],t=+e[1][0],i=+e[0][1],o=+e[1][1],n>t&&(e=n,n=t,t=e),i>o&&(e=i,i=o,o=e),y.precision(v)):[[n,i],[t,o]]},y.step=function(t){return arguments.length?y.majorStep(t).minorStep(t):y.minorStep()},y.majorStep=function(t){return arguments.length?(m=+t[0],g=+t[1],y):[m,g]},y.minorStep=function(t){return arguments.length?(p=+t[0],d=+t[1],y):[p,d]},y.precision=function(a){return arguments.length?(v=+a,l=Yr(i,o,90),c=Vr(n,t,v),f=Yr(s,u,90),h=Vr(r,e,v),y):v},y.majorExtent([[-180,-90+Tt],[180,90-Tt]]).minorExtent([[-180,-80-Tt],[180,80+Tt]])},a.geo.greatArc=function(){var t,n,e=Hr,r=Gr;function o(){return{type:"LineString",coordinates:[t||e.apply(this,arguments),n||r.apply(this,arguments)]}}return o.distance=function(){return a.geo.distance(t||e.apply(this,arguments),n||r.apply(this,arguments))},o.source=function(n){return arguments.length?(e=n,t="function"==typeof n?null:n,o):e},o.target=function(t){return arguments.length?(r=t,n="function"==typeof t?null:t,o):r},o.precision=function(){return arguments.length?o:0},o},a.geo.interpolate=function(t,n){return e=t[0]*Lt,r=t[1]*Lt,o=n[0]*Lt,a=n[1]*Lt,i=Math.cos(r),u=Math.sin(r),s=Math.cos(a),l=Math.sin(a),c=i*Math.cos(e),f=i*Math.sin(e),h=s*Math.cos(o),p=s*Math.sin(o),d=2*Math.asin(Math.sqrt(Bt(a-r)+i*s*Bt(o-e))),m=1/Math.sin(d),(g=d?function(t){var n=Math.sin(t*=d)*m,e=Math.sin(d-t)*m,r=e*c+n*h,o=e*f+n*p,a=e*u+n*l;return[Math.atan2(o,r)*Ut,Math.atan2(a,Math.sqrt(r*r+o*o))*Ut]}:function(){return[e*Ut,r*Ut]}).distance=d,g;var e,r,o,a,i,u,s,l,c,f,h,p,d,m,g},a.geo.length=function(t){return wr=0,a.geo.stream(t,Wr),wr};var Wr={sphere:q,point:q,lineStart:function(){var t,n,e;function r(r,o){var a=Math.sin(o*=Lt),i=Math.cos(o),u=w((r*=Lt)-t),s=Math.cos(u);wr+=Math.atan2(Math.sqrt((u=i*Math.sin(u))*u+(u=e*a-n*i*s)*u),n*a+e*i*s),t=r,n=a,e=i}Wr.point=function(o,a){t=o*Lt,n=Math.sin(a*=Lt),e=Math.cos(a),Wr.point=r},Wr.lineEnd=function(){Wr.point=Wr.lineEnd=q}},lineEnd:q,polygonStart:q,polygonEnd:q};function Zr(t,n){function e(n,e){var r=Math.cos(n),o=Math.cos(e),a=t(r*o);return[a*o*Math.sin(n),a*Math.sin(e)]}return e.invert=function(t,e){var r=Math.sqrt(t*t+e*e),o=n(r),a=Math.sin(o),i=Math.cos(o);return[Math.atan2(t*a,r*i),Math.asin(r&&e*a/r)]},e}var Jr=Zr((function(t){return Math.sqrt(2/(1+t))}),(function(t){return 2*Math.asin(t/2)}));(a.geo.azimuthalEqualArea=function(){return Or(Jr)}).raw=Jr;var $r=Zr((function(t){var n=Math.acos(t);return n&&n/Math.sin(n)}),L);function Kr(t,n){var e=Math.cos(t),r=function(t){return Math.tan(Nt/4+t/2)},o=t===n?Math.sin(t):Math.log(e/Math.cos(n))/Math.log(r(n)/r(t)),a=e*Math.pow(r(t),o)/o;if(!o)return no;function i(t,n){a>0?n<-Ot+Tt&&(n=-Ot+Tt):n>Ot-Tt&&(n=Ot-Tt);var e=a/Math.pow(r(n),o);return[e*Math.sin(o*t),a-e*Math.cos(o*t)]}return i.invert=function(t,n){var e=a-n,r=Dt(o)*Math.sqrt(t*t+e*e);return[Math.atan2(t,e)/o,2*Math.atan(Math.pow(a/r,1/o))-Ot]},i}function Qr(t,n){var e=Math.cos(t),r=t===n?Math.sin(t):(e-Math.cos(n))/(n-t),o=e/r+t;if(w(r)<Tt)return Dr;function a(t,n){var e=o-n;return[e*Math.sin(r*t),o-e*Math.cos(r*t)]}return a.invert=function(t,n){var e=o-n;return[Math.atan2(t,e)/r,o-Dt(r)*Math.sqrt(t*t+e*e)]},a}(a.geo.azimuthalEquidistant=function(){return Or($r)}).raw=$r,(a.geo.conicConformal=function(){return lr(Kr)}).raw=Kr,(a.geo.conicEquidistant=function(){return lr(Qr)}).raw=Qr;var to=Zr((function(t){return 1/t}),Math.atan);function no(t,n){return[t,Math.log(Math.tan(Nt/4+n/2))]}function eo(t){var n,e=Or(t),r=e.scale,o=e.translate,a=e.clipExtent;return e.scale=function(){var t=r.apply(e,arguments);return t===e?n?e.clipExtent(null):e:t},e.translate=function(){var t=o.apply(e,arguments);return t===e?n?e.clipExtent(null):e:t},e.clipExtent=function(t){var i=a.apply(e,arguments);if(i===e){if(n=null==t){var u=Nt*r(),s=o();a([[s[0]-u,s[1]-u],[s[0]+u,s[1]+u]])}}else n&&(i=null);return i},e.clipExtent(null)}(a.geo.gnomonic=function(){return Or(to)}).raw=to,no.invert=function(t,n){return[t,2*Math.atan(Math.exp(n))-Ot]},(a.geo.mercator=function(){return eo(no)}).raw=no;var ro=Zr((function(){return 1}),Math.asin);(a.geo.orthographic=function(){return Or(ro)}).raw=ro;var oo=Zr((function(t){return 1/(1+t)}),(function(t){return 2*Math.atan(t)}));function ao(t,n){return[Math.log(Math.tan(Nt/4+n/2)),-t]}function io(t){return t[0]}function uo(t){return t[1]}function so(t){for(var n=t.length,e=[0,1],r=2,o=2;o<n;o++){for(;r>1&&zt(t[e[r-2]],t[e[r-1]],t[o])<=0;)--r;e[r++]=o}return e.slice(0,r)}function lo(t,n){return t[0]-n[0]||t[1]-n[1]}(a.geo.stereographic=function(){return Or(oo)}).raw=oo,ao.invert=function(t,n){return[-n,2*Math.atan(Math.exp(t))-Ot]},(a.geo.transverseMercator=function(){var t=eo(ao),n=t.center,e=t.rotate;return t.center=function(t){return t?n([-t[1],t[0]]):[(t=n())[1],-t[0]]},t.rotate=function(t){return t?e([t[0],t[1],t.length>2?t[2]+90:90]):[(t=e())[0],t[1],t[2]-90]},e([0,0,90])}).raw=ao,a.geom={},a.geom.hull=function(t){var n=io,e=uo;if(arguments.length)return r(t);function r(t){if(t.length<3)return[];var r,o=bn(n),a=bn(e),i=t.length,u=[],s=[];for(r=0;r<i;r++)u.push([+o.call(this,t[r],r),+a.call(this,t[r],r),r]);for(u.sort(lo),r=0;r<i;r++)s.push([u[r][0],-u[r][1]]);var l=so(u),c=so(s),f=c[0]===l[0],h=c[c.length-1]===l[l.length-1],p=[];for(r=l.length-1;r>=0;--r)p.push(t[u[l[r]][2]]);for(r=+f;r<c.length-h;++r)p.push(t[u[c[r]][2]]);return p}return r.x=function(t){return arguments.length?(n=t,r):n},r.y=function(t){return arguments.length?(e=t,r):e},r},a.geom.polygon=function(t){return V(t,co),t};var co=a.geom.polygon.prototype=[];function fo(t,n,e){return(e[0]-n[0])*(t[1]-n[1])<(e[1]-n[1])*(t[0]-n[0])}function ho(t,n,e,r){var o=t[0],a=e[0],i=n[0]-o,u=r[0]-a,s=t[1],l=e[1],c=n[1]-s,f=r[1]-l,h=(u*(s-l)-f*(o-a))/(f*i-u*c);return[o+h*i,s+h*c]}function po(t){var n=t[0],e=t[t.length-1];return!(n[0]-e[0]||n[1]-e[1])}co.area=function(){for(var t,n=-1,e=this.length,r=this[e-1],o=0;++n<e;)t=r,r=this[n],o+=t[1]*r[0]-t[0]*r[1];return.5*o},co.centroid=function(t){var n,e,r=-1,o=this.length,a=0,i=0,u=this[o-1];for(arguments.length||(t=-1/(6*this.area()));++r<o;)n=u,u=this[r],e=n[0]*u[1]-u[0]*n[1],a+=(n[0]+u[0])*e,i+=(n[1]+u[1])*e;return[a*t,i*t]},co.clip=function(t){for(var n,e,r,o,a,i,u=po(t),s=-1,l=this.length-po(this),c=this[l-1];++s<l;){for(n=t.slice(),t.length=0,o=this[s],a=n[(r=n.length-u)-1],e=-1;++e<r;)fo(i=n[e],c,o)?(fo(a,c,o)||t.push(ho(a,i,c,o)),t.push(i)):fo(a,c,o)&&t.push(ho(a,i,c,o)),a=i;u&&t.push(t[0]),c=o}return t};var mo,go,vo,yo,bo,xo=[],Mo=[];function wo(){Fo(this),this.edge=this.site=this.circle=null}function _o(t){var n=xo.pop()||new wo;return n.site=t,n}function ko(t){Oo(t),vo.remove(t),xo.push(t),Fo(t)}function So(t){var n=t.circle,e=n.x,r=n.cy,o={x:e,y:r},a=t.P,i=t.N,u=[t];ko(t);for(var s=a;s.circle&&w(e-s.circle.x)<Tt&&w(r-s.circle.cy)<Tt;)a=s.P,u.unshift(s),ko(s),s=a;u.unshift(s),Oo(s);for(var l=i;l.circle&&w(e-l.circle.x)<Tt&&w(r-l.circle.cy)<Tt;)i=l.N,u.push(l),ko(l),l=i;u.push(l),Oo(l);var c,f=u.length;for(c=1;c<f;++c)l=u[c],s=u[c-1],zo(l.edge,s.site,l.site,o);s=u[0],(l=u[f-1]).edge=Do(s.site,l.site,null,o),Co(s),Co(l)}function Ao(t){for(var n,e,r,o,a=t.x,i=t.y,u=vo._;u;)if((r=Eo(u,i)-a)>Tt)u=u.L;else{if(!((o=a-To(u,i))>Tt)){r>-Tt?(n=u.P,e=u):o>-Tt?(n=u,e=u.N):n=e=u;break}if(!u.R){n=u;break}u=u.R}var s=_o(t);if(vo.insert(n,s),n||e){if(n===e)return Oo(n),e=_o(n.site),vo.insert(s,e),s.edge=e.edge=Do(n.site,s.site),Co(n),void Co(e);if(e){Oo(n),Oo(e);var l=n.site,c=l.x,f=l.y,h=t.x-c,p=t.y-f,d=e.site,m=d.x-c,g=d.y-f,v=2*(h*g-p*m),y=h*h+p*p,b=m*m+g*g,x={x:(g*y-p*b)/v+c,y:(h*b-m*y)/v+f};zo(e.edge,l,d,x),s.edge=Do(l,t,null,x),e.edge=Do(t,d,null,x),Co(n),Co(e)}else s.edge=Do(n.site,s.site)}}function Eo(t,n){var e=t.site,r=e.x,o=e.y,a=o-n;if(!a)return r;var i=t.P;if(!i)return-1/0;var u=(e=i.site).x,s=e.y,l=s-n;if(!l)return u;var c=u-r,f=1/a-1/l,h=c/l;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*l)-s+l/2+o-a/2)))/f+r:(r+u)/2}function To(t,n){var e=t.N;if(e)return Eo(e,n);var r=t.site;return r.y===n?r.x:1/0}function Ro(t){this.site=t,this.edges=[]}function No(t,n){return n.angle-t.angle}function Po(){Fo(this),this.x=this.y=this.arc=this.site=this.cy=null}function Co(t){var n=t.P,e=t.N;if(n&&e){var r=n.site,o=t.site,a=e.site;if(r!==a){var i=o.x,u=o.y,s=r.x-i,l=r.y-u,c=a.x-i,f=2*(s*(g=a.y-u)-l*c);if(!(f>=-Rt)){var h=s*s+l*l,p=c*c+g*g,d=(g*h-l*p)/f,m=(s*p-c*h)/f,g=m+u,v=Mo.pop()||new Po;v.arc=t,v.site=o,v.x=d+i,v.y=g+Math.sqrt(d*d+m*m),v.cy=g,t.circle=v;for(var y=null,b=bo._;b;)if(v.y<b.y||v.y===b.y&&v.x<=b.x){if(!b.L){y=b.P;break}b=b.L}else{if(!b.R){y=b;break}b=b.R}bo.insert(y,v),y||(yo=v)}}}}function Oo(t){var n=t.circle;n&&(n.P||(yo=n.N),bo.remove(n),Mo.push(n),Fo(n),t.circle=null)}function Lo(t,n){var e=t.b;if(e)return!0;var r,o,a=t.a,i=n[0][0],u=n[1][0],s=n[0][1],l=n[1][1],c=t.l,f=t.r,h=c.x,p=c.y,d=f.x,m=f.y,g=(h+d)/2,v=(p+m)/2;if(m===p){if(g<i||g>=u)return;if(h>d){if(a){if(a.y>=l)return}else a={x:g,y:s};e={x:g,y:l}}else{if(a){if(a.y<s)return}else a={x:g,y:l};e={x:g,y:s}}}else if(o=v-(r=(h-d)/(m-p))*g,r<-1||r>1)if(h>d){if(a){if(a.y>=l)return}else a={x:(s-o)/r,y:s};e={x:(l-o)/r,y:l}}else{if(a){if(a.y<s)return}else a={x:(l-o)/r,y:l};e={x:(s-o)/r,y:s}}else if(p<m){if(a){if(a.x>=u)return}else a={x:i,y:r*i+o};e={x:u,y:r*u+o}}else{if(a){if(a.x<i)return}else a={x:u,y:r*u+o};e={x:i,y:r*i+o}}return t.a=a,t.b=e,!0}function Uo(t,n){this.l=t,this.r=n,this.a=this.b=null}function Do(t,n,e,r){var o=new Uo(t,n);return mo.push(o),e&&zo(o,t,n,e),r&&zo(o,n,t,r),go[t.i].edges.push(new qo(o,t,n)),go[n.i].edges.push(new qo(o,n,t)),o}function zo(t,n,e,r){t.a||t.b?t.l===e?t.b=r:t.a=r:(t.a=r,t.l=n,t.r=e)}function qo(t,n,e){var r=t.a,o=t.b;this.edge=t,this.site=n,this.angle=e?Math.atan2(e.y-n.y,e.x-n.x):t.l===n?Math.atan2(o.x-r.x,r.y-o.y):Math.atan2(r.x-o.x,o.y-r.y)}function jo(){this._=null}function Fo(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function Bo(t,n){var e=n,r=n.R,o=e.U;o?o.L===e?o.L=r:o.R=r:t._=r,r.U=o,e.U=r,e.R=r.L,e.R&&(e.R.U=e),r.L=e}function Io(t,n){var e=n,r=n.L,o=e.U;o?o.L===e?o.L=r:o.R=r:t._=r,r.U=o,e.U=r,e.L=r.R,e.L&&(e.L.U=e),r.R=e}function Xo(t){for(;t.L;)t=t.L;return t}function Yo(t,n){var e,r,o,a=t.sort(Vo).pop();for(mo=[],go=new Array(t.length),vo=new jo,bo=new jo;;)if(o=yo,a&&(!o||a.y<o.y||a.y===o.y&&a.x<o.x))a.x===e&&a.y===r||(go[a.i]=new Ro(a),Ao(a),e=a.x,r=a.y),a=t.pop();else{if(!o)break;So(o.arc)}n&&(function(t){for(var n,e=mo,r=ur(t[0][0],t[0][1],t[1][0],t[1][1]),o=e.length;o--;)(!Lo(n=e[o],t)||!r(n)||w(n.a.x-n.b.x)<Tt&&w(n.a.y-n.b.y)<Tt)&&(n.a=n.b=null,e.splice(o,1))}(n),function(t){for(var n,e,r,o,a,i,u,s,l,c,f=t[0][0],h=t[1][0],p=t[0][1],d=t[1][1],m=go,g=m.length;g--;)if((a=m[g])&&a.prepare())for(s=(u=a.edges).length,i=0;i<s;)r=(c=u[i].end()).x,o=c.y,n=(l=u[++i%s].start()).x,e=l.y,(w(r-n)>Tt||w(o-e)>Tt)&&(u.splice(i,0,new qo((v=a.site,y=c,b=w(r-f)<Tt&&d-o>Tt?{x:f,y:w(n-f)<Tt?e:d}:w(o-d)<Tt&&h-r>Tt?{x:w(e-d)<Tt?n:h,y:d}:w(r-h)<Tt&&o-p>Tt?{x:h,y:w(n-h)<Tt?e:p}:w(o-p)<Tt&&r-f>Tt?{x:w(e-p)<Tt?n:f,y:p}:null,x=void 0,(x=new Uo(v,null)).a=y,x.b=b,mo.push(x),x),a.site,null)),++s);var v,y,b,x}(n));var i={cells:go,edges:mo};return vo=bo=mo=go=null,i}function Vo(t,n){return n.y-t.y||n.x-t.x}Ro.prototype.prepare=function(){for(var t,n=this.edges,e=n.length;e--;)(t=n[e].edge).b&&t.a||n.splice(e,1);return n.sort(No),n.length},qo.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}},jo.prototype={insert:function(t,n){var e,r,o;if(t){if(n.P=t,n.N=t.N,t.N&&(t.N.P=n),t.N=n,t.R){for(t=t.R;t.L;)t=t.L;t.L=n}else t.R=n;e=t}else this._?(t=Xo(this._),n.P=null,n.N=t,t.P=t.L=n,e=t):(n.P=n.N=null,this._=n,e=null);for(n.L=n.R=null,n.U=e,n.C=!0,t=n;e&&e.C;)e===(r=e.U).L?(o=r.R)&&o.C?(e.C=o.C=!1,r.C=!0,t=r):(t===e.R&&(Bo(this,e),e=(t=e).U),e.C=!1,r.C=!0,Io(this,r)):(o=r.L)&&o.C?(e.C=o.C=!1,r.C=!0,t=r):(t===e.L&&(Io(this,e),e=(t=e).U),e.C=!1,r.C=!0,Bo(this,r)),e=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var n,e,r,o=t.U,a=t.L,i=t.R;if(e=a?i?Xo(i):a:i,o?o.L===t?o.L=e:o.R=e:this._=e,a&&i?(r=e.C,e.C=t.C,e.L=a,a.U=e,e!==i?(o=e.U,e.U=t.U,t=e.R,o.L=t,e.R=i,i.U=e):(e.U=o,o=e,t=e.R)):(r=t.C,t=e),t&&(t.U=o),!r)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===o.L){if((n=o.R).C&&(n.C=!1,o.C=!0,Bo(this,o),n=o.R),n.L&&n.L.C||n.R&&n.R.C){n.R&&n.R.C||(n.L.C=!1,n.C=!0,Io(this,n),n=o.R),n.C=o.C,o.C=n.R.C=!1,Bo(this,o),t=this._;break}}else if((n=o.L).C&&(n.C=!1,o.C=!0,Io(this,o),n=o.L),n.L&&n.L.C||n.R&&n.R.C){n.L&&n.L.C||(n.R.C=!1,n.C=!0,Bo(this,n),n=o.L),n.C=o.C,o.C=n.L.C=!1,Io(this,o),t=this._;break}n.C=!0,t=o,o=o.U}while(!t.C);t&&(t.C=!1)}}},a.geom.voronoi=function(t){var n=io,e=uo,r=n,o=e,a=Ho;if(t)return i(t);function i(t){var n=new Array(t.length),e=a[0][0],r=a[0][1],o=a[1][0],i=a[1][1];return Yo(u(t),a).cells.forEach((function(a,u){var s=a.edges,l=a.site;(n[u]=s.length?s.map((function(t){var n=t.start();return[n.x,n.y]})):l.x>=e&&l.x<=o&&l.y>=r&&l.y<=i?[[e,i],[o,i],[o,r],[e,r]]:[]).point=t[u]})),n}function u(t){return t.map((function(t,n){return{x:Math.round(r(t,n)/Tt)*Tt,y:Math.round(o(t,n)/Tt)*Tt,i:n}}))}return i.links=function(t){return Yo(u(t)).edges.filter((function(t){return t.l&&t.r})).map((function(n){return{source:t[n.l.i],target:t[n.r.i]}}))},i.triangles=function(t){var n=[];return Yo(u(t)).cells.forEach((function(e,r){for(var o,a=e.site,i=e.edges.sort(No),u=-1,s=i.length,l=i[s-1].edge,c=l.l===a?l.r:l.l;++u<s;)o=c,c=(l=i[u].edge).l===a?l.r:l.l,r<o.i&&r<c.i&&Go(a,o,c)<0&&n.push([t[r],t[o.i],t[c.i]])})),n},i.x=function(t){return arguments.length?(r=bn(n=t),i):n},i.y=function(t){return arguments.length?(o=bn(e=t),i):e},i.clipExtent=function(t){return arguments.length?(a=null==t?Ho:t,i):a===Ho?null:a},i.size=function(t){return arguments.length?i.clipExtent(t&&[[0,0],t]):a===Ho?null:a&&a[1]},i};var Ho=[[-1e6,-1e6],[1e6,1e6]];function Go(t,n,e){return(t.x-e.x)*(n.y-t.y)-(t.x-n.x)*(e.y-t.y)}function Wo(t){return t.x}function Zo(t){return t.y}function Jo(t,n,e,r,o,a){if(!t(n,e,r,o,a)){var i=.5*(e+o),u=.5*(r+a),s=n.nodes;s[0]&&Jo(t,s[0],e,r,i,u),s[1]&&Jo(t,s[1],i,r,o,u),s[2]&&Jo(t,s[2],e,u,i,a),s[3]&&Jo(t,s[3],i,u,o,a)}}function $o(t,n,e,r,o,a,i){var u,s=1/0;return function t(l,c,f,h,p){if(!(c>a||f>i||h<r||p<o)){if(d=l.point){var d,m=n-l.x,g=e-l.y,v=m*m+g*g;if(v<s){var y=Math.sqrt(s=v);r=n-y,o=e-y,a=n+y,i=e+y,u=d}}for(var b=l.nodes,x=.5*(c+h),M=.5*(f+p),w=(e>=M)<<1|n>=x,_=w+4;w<_;++w)if(l=b[3&w])switch(3&w){case 0:t(l,c,f,x,M);break;case 1:t(l,x,f,h,M);break;case 2:t(l,c,M,x,p);break;case 3:t(l,x,M,h,p)}}}(t,r,o,a,i),u}function Ko(t,n){t=a.rgb(t),n=a.rgb(n);var e=t.r,r=t.g,o=t.b,i=n.r-e,u=n.g-r,s=n.b-o;return function(t){return"#"+hn(Math.round(e+i*t))+hn(Math.round(r+u*t))+hn(Math.round(o+s*t))}}function Qo(t,n){var e,r={},o={};for(e in t)e in n?r[e]=oa(t[e],n[e]):o[e]=t[e];for(e in n)e in t||(o[e]=n[e]);return function(t){for(e in r)o[e]=r[e](t);return o}}function ta(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}function na(t,n){var e,r,o,a=ea.lastIndex=ra.lastIndex=0,i=-1,u=[],s=[];for(t+="",n+="";(e=ea.exec(t))&&(r=ra.exec(n));)(o=r.index)>a&&(o=n.slice(a,o),u[i]?u[i]+=o:u[++i]=o),(e=e[0])===(r=r[0])?u[i]?u[i]+=r:u[++i]=r:(u[++i]=null,s.push({i:i,x:ta(e,r)})),a=ra.lastIndex;return a<n.length&&(o=n.slice(a),u[i]?u[i]+=o:u[++i]=o),u.length<2?s[0]?(n=s[0].x,function(t){return n(t)+""}):function(){return n}:(n=s.length,function(t){for(var e,r=0;r<n;++r)u[(e=s[r]).i]=e.x(t);return u.join("")})}a.geom.delaunay=function(t){return a.geom.voronoi().triangles(t)},a.geom.quadtree=function(t,n,e,r,o){var a,i=io,u=uo;if(a=arguments.length)return i=Wo,u=Zo,3===a&&(o=e,r=n,e=n=0),s(t);function s(t){var s,l,c,f,h,p,d,m,g,v=bn(i),y=bn(u);if(null!=n)p=n,d=e,m=r,g=o;else if(m=g=-(p=d=1/0),l=[],c=[],h=t.length,a)for(f=0;f<h;++f)(s=t[f]).x<p&&(p=s.x),s.y<d&&(d=s.y),s.x>m&&(m=s.x),s.y>g&&(g=s.y),l.push(s.x),c.push(s.y);else for(f=0;f<h;++f){var b=+v(s=t[f],f),x=+y(s,f);b<p&&(p=b),x<d&&(d=x),b>m&&(m=b),x>g&&(g=x),l.push(b),c.push(x)}var M=m-p,_=g-d;function k(t,n,e,r,o,a,i,u){if(!isNaN(e)&&!isNaN(r))if(t.leaf){var s=t.x,l=t.y;if(null!=s)if(w(s-e)+w(l-r)<.01)S(t,n,e,r,o,a,i,u);else{var c=t.point;t.x=t.y=t.point=null,S(t,c,s,l,o,a,i,u),S(t,n,e,r,o,a,i,u)}else t.x=e,t.y=r,t.point=n}else S(t,n,e,r,o,a,i,u)}function S(t,n,e,r,o,a,i,u){var s=.5*(o+i),l=.5*(a+u),c=e>=s,f=r>=l,h=f<<1|c;t.leaf=!1,c?o=s:i=s,f?a=l:u=l,k(t=t.nodes[h]||(t.nodes[h]={leaf:!0,nodes:[],point:null,x:null,y:null}),n,e,r,o,a,i,u)}M>_?g=d+M:m=p+_;var A={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){k(A,t,+v(t,++f),+y(t,f),p,d,m,g)},visit:function(t){Jo(t,A,p,d,m,g)},find:function(t){return $o(A,t[0],t[1],p,d,m,g)}};if(f=-1,null==n){for(;++f<h;)k(A,t[f],l[f],c[f],p,d,m,g);--f}else t.forEach(A.add);return l=c=t=s=null,A}return s.x=function(t){return arguments.length?(i=t,s):i},s.y=function(t){return arguments.length?(u=t,s):u},s.extent=function(t){return arguments.length?(null==t?n=e=r=o=null:(n=+t[0][0],e=+t[0][1],r=+t[1][0],o=+t[1][1]),s):null==n?null:[[n,e],[r,o]]},s.size=function(t){return arguments.length?(null==t?n=e=r=o=null:(n=e=0,r=+t[0],o=+t[1]),s):null==n?null:[r-n,o-e]},s},a.interpolateRgb=Ko,a.interpolateObject=Qo,a.interpolateNumber=ta,a.interpolateString=na;var ea=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ra=new RegExp(ea.source,"g");function oa(t,n){for(var e,r=a.interpolators.length;--r>=0&&!(e=a.interpolators[r](t,n)););return e}function aa(t,n){var e,r=[],o=[],a=t.length,i=n.length,u=Math.min(t.length,n.length);for(e=0;e<u;++e)r.push(oa(t[e],n[e]));for(;e<a;++e)o[e]=t[e];for(;e<i;++e)o[e]=n[e];return function(t){for(e=0;e<u;++e)o[e]=r[e](t);return o}}a.interpolate=oa,a.interpolators=[function(t,n){var e=typeof n;return("string"===e?yn.has(n.toLowerCase())||/^(#|rgb\(|hsl\()/i.test(n)?Ko:na:n instanceof Ht?Ko:Array.isArray(n)?aa:"object"===e&&isNaN(n)?Qo:ta)(t,n)}],a.interpolateArray=aa;var ia=function(){return L},ua=a.map({linear:ia,poly:function(t){return function(n){return Math.pow(n,t)}},quad:function(){return ha},cubic:function(){return pa},sin:function(){return ma},exp:function(){return ga},circle:function(){return va},elastic:function(t,n){var e;return arguments.length<2&&(n=.45),arguments.length?e=n/Pt*Math.asin(1/t):(t=1,e=n/4),function(r){return 1+t*Math.pow(2,-10*r)*Math.sin((r-e)*Pt/n)}},back:function(t){return t||(t=1.70158),function(n){return n*n*((t+1)*n-t)}},bounce:function(){return ya}}),sa=a.map({in:L,out:ca,"in-out":fa,"out-in":function(t){return fa(ca(t))}});function la(t){return function(n){return n<=0?0:n>=1?1:t(n)}}function ca(t){return function(n){return 1-t(1-n)}}function fa(t){return function(n){return.5*(n<.5?t(2*n):2-t(2-2*n))}}function ha(t){return t*t}function pa(t){return t*t*t}function da(t){if(t<=0)return 0;if(t>=1)return 1;var n=t*t,e=n*t;return 4*(t<.5?e:3*(t-n)+e-.75)}function ma(t){return 1-Math.cos(t*Ot)}function ga(t){return Math.pow(2,10*(t-1))}function va(t){return 1-Math.sqrt(1-t*t)}function ya(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function ba(t,n){return n-=t,function(e){return Math.round(t+n*e)}}function xa(t){var n=[t.a,t.b],e=[t.c,t.d],r=wa(n),o=Ma(n,e),a=wa(function(t,n,e){return t[0]+=e*n[0],t[1]+=e*n[1],t}(e,n,-o))||0;n[0]*e[1]<e[0]*n[1]&&(n[0]*=-1,n[1]*=-1,r*=-1,o*=-1),this.rotate=(r?Math.atan2(n[1],n[0]):Math.atan2(-e[0],e[1]))*Ut,this.translate=[t.e,t.f],this.scale=[r,a],this.skew=a?Math.atan2(o,a)*Ut:0}function Ma(t,n){return t[0]*n[0]+t[1]*n[1]}function wa(t){var n=Math.sqrt(Ma(t,t));return n&&(t[0]/=n,t[1]/=n),n}a.ease=function(t){var n=t.indexOf("-"),e=n>=0?t.slice(0,n):t,r=n>=0?t.slice(n+1):"in";return e=ua.get(e)||ia,la((r=sa.get(r)||L)(e.apply(null,i.call(arguments,1))))},a.interpolateHcl=function(t,n){t=a.hcl(t),n=a.hcl(n);var e=t.h,r=t.c,o=t.l,i=n.h-e,u=n.c-r,s=n.l-o;return isNaN(u)&&(u=0,r=isNaN(r)?n.c:r),isNaN(i)?(i=0,e=isNaN(e)?n.h:e):i>180?i-=360:i<-180&&(i+=360),function(t){return Kt(e+i*t,r+u*t,o+s*t)+""}},a.interpolateHsl=function(t,n){t=a.hsl(t),n=a.hsl(n);var e=t.h,r=t.s,o=t.l,i=n.h-e,u=n.s-r,s=n.l-o;return isNaN(u)&&(u=0,r=isNaN(r)?n.s:r),isNaN(i)?(i=0,e=isNaN(e)?n.h:e):i>180?i-=360:i<-180&&(i+=360),function(t){return Zt(e+i*t,r+u*t,o+s*t)+""}},a.interpolateLab=function(t,n){t=a.lab(t),n=a.lab(n);var e=t.l,r=t.a,o=t.b,i=n.l-e,u=n.a-r,s=n.b-o;return function(t){return en(e+i*t,r+u*t,o+s*t)+""}},a.interpolateRound=ba,a.transform=function(t){var n=s.createElementNS(a.ns.prefix.svg,"g");return(a.transform=function(t){if(null!=t){n.setAttribute("transform",t);var e=n.transform.baseVal.consolidate()}return new xa(e?e.matrix:_a)})(t)},xa.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var _a={a:1,b:0,c:0,d:1,e:0,f:0};function ka(t){return t.length?t.pop()+",":""}function Sa(t,n){var e=[],r=[];return t=a.transform(t),n=a.transform(n),function(t,n,e,r){if(t[0]!==n[0]||t[1]!==n[1]){var o=e.push("translate(",null,",",null,")");r.push({i:o-4,x:ta(t[0],n[0])},{i:o-2,x:ta(t[1],n[1])})}else(n[0]||n[1])&&e.push("translate("+n+")")}(t.translate,n.translate,e,r),function(t,n,e,r){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),r.push({i:e.push(ka(e)+"rotate(",null,")")-2,x:ta(t,n)})):n&&e.push(ka(e)+"rotate("+n+")")}(t.rotate,n.rotate,e,r),function(t,n,e,r){t!==n?r.push({i:e.push(ka(e)+"skewX(",null,")")-2,x:ta(t,n)}):n&&e.push(ka(e)+"skewX("+n+")")}(t.skew,n.skew,e,r),function(t,n,e,r){if(t[0]!==n[0]||t[1]!==n[1]){var o=e.push(ka(e)+"scale(",null,",",null,")");r.push({i:o-4,x:ta(t[0],n[0])},{i:o-2,x:ta(t[1],n[1])})}else 1===n[0]&&1===n[1]||e.push(ka(e)+"scale("+n+")")}(t.scale,n.scale,e,r),t=n=null,function(t){for(var n,o=-1,a=r.length;++o<a;)e[(n=r[o]).i]=n.x(t);return e.join("")}}function Aa(t,n){return n=(n-=t=+t)||1/n,function(e){return(e-t)/n}}function Ea(t,n){return n=(n-=t=+t)||1/n,function(e){return Math.max(0,Math.min(1,(e-t)/n))}}function Ta(t){for(var n=t.source,e=t.target,r=function(t,n){if(t===n)return t;for(var e=Ra(t),r=Ra(n),o=e.pop(),a=r.pop(),i=null;o===a;)i=o,o=e.pop(),a=r.pop();return i}(n,e),o=[n];n!==r;)n=n.parent,o.push(n);for(var a=o.length;e!==r;)o.splice(a,0,e),e=e.parent;return o}function Ra(t){for(var n=[],e=t.parent;null!=e;)n.push(t),t=e,e=e.parent;return n.push(t),n}function Na(t){t.fixed|=2}function Pa(t){t.fixed&=-7}function Ca(t){t.fixed|=4,t.px=t.x,t.py=t.y}function Oa(t){t.fixed&=-5}a.interpolateTransform=Sa,a.layout={},a.layout.bundle=function(){return function(t){for(var n=[],e=-1,r=t.length;++e<r;)n.push(Ta(t[e]));return n}},a.layout.chord=function(){var t,n,e,r,o,i,u,s={},l=0;function c(){var s,c,h,p,d,m={},g=[],v=a.range(r),y=[];for(t=[],n=[],s=0,p=-1;++p<r;){for(c=0,d=-1;++d<r;)c+=e[p][d];g.push(c),y.push(a.range(r)),s+=c}for(o&&v.sort((function(t,n){return o(g[t],g[n])})),i&&y.forEach((function(t,n){t.sort((function(t,r){return i(e[n][t],e[n][r])}))})),s=(Pt-l*r)/s,c=0,p=-1;++p<r;){for(h=c,d=-1;++d<r;){var b=v[p],x=y[b][d],M=e[b][x],w=c,_=c+=M*s;m[b+"-"+x]={index:b,subindex:x,startAngle:w,endAngle:_,value:M}}n[b]={index:b,startAngle:h,endAngle:c,value:g[b]},c+=l}for(p=-1;++p<r;)for(d=p-1;++d<r;){var k=m[p+"-"+d],S=m[d+"-"+p];(k.value||S.value)&&t.push(k.value<S.value?{source:S,target:k}:{source:k,target:S})}u&&f()}function f(){t.sort((function(t,n){return u((t.source.value+t.target.value)/2,(n.source.value+n.target.value)/2)}))}return s.matrix=function(o){return arguments.length?(r=(e=o)&&e.length,t=n=null,s):e},s.padding=function(e){return arguments.length?(l=e,t=n=null,s):l},s.sortGroups=function(e){return arguments.length?(o=e,t=n=null,s):o},s.sortSubgroups=function(n){return arguments.length?(i=n,t=null,s):i},s.sortChords=function(n){return arguments.length?(u=n,t&&f(),s):u},s.chords=function(){return t||c(),t},s.groups=function(){return n||c(),n},s},a.layout.force=function(){var t,n,e,r,o,i,u={},s=a.dispatch("start","tick","end"),l=[1,1],c=.9,f=La,h=Ua,p=-30,d=Da,m=.1,g=.64,v=[],y=[];function b(t){return function(n,e,r,o){if(n.point!==t){var a=n.cx-t.x,i=n.cy-t.y,u=o-e,s=a*a+i*i;if(u*u/g<s){if(s<d){var l=n.charge/s;t.px-=a*l,t.py-=i*l}return!0}n.point&&s&&s<d&&(l=n.pointCharge/s,t.px-=a*l,t.py-=i*l)}return!n.charge}}function x(t){t.px=a.event.x,t.py=a.event.y,u.resume()}return u.tick=function(){if((e*=.99)<.005)return t=null,s.end({type:"end",alpha:e=0}),!0;var n,u,f,h,d,g,x,M,w,_=v.length,k=y.length;for(u=0;u<k;++u)h=(f=y[u]).source,(g=(M=(d=f.target).x-h.x)*M+(w=d.y-h.y)*w)&&(M*=g=e*o[u]*((g=Math.sqrt(g))-r[u])/g,w*=g,d.x-=M*(x=h.weight+d.weight?h.weight/(h.weight+d.weight):.5),d.y-=w*x,h.x+=M*(x=1-x),h.y+=w*x);if((x=e*m)&&(M=l[0]/2,w=l[1]/2,u=-1,x))for(;++u<_;)(f=v[u]).x+=(M-f.x)*x,f.y+=(w-f.y)*x;if(p)for(function t(n,e,r){var o=0,a=0;if(n.charge=0,!n.leaf)for(var i,u=n.nodes,s=u.length,l=-1;++l<s;)null!=(i=u[l])&&(t(i,e,r),n.charge+=i.charge,o+=i.charge*i.cx,a+=i.charge*i.cy);if(n.point){n.leaf||(n.point.x+=Math.random()-.5,n.point.y+=Math.random()-.5);var c=e*r[n.point.index];n.charge+=n.pointCharge=c,o+=c*n.point.x,a+=c*n.point.y}n.cx=o/n.charge,n.cy=a/n.charge}(n=a.geom.quadtree(v),e,i),u=-1;++u<_;)(f=v[u]).fixed||n.visit(b(f));for(u=-1;++u<_;)(f=v[u]).fixed?(f.x=f.px,f.y=f.py):(f.x-=(f.px-(f.px=f.x))*c,f.y-=(f.py-(f.py=f.y))*c);s.tick({type:"tick",alpha:e})},u.nodes=function(t){return arguments.length?(v=t,u):v},u.links=function(t){return arguments.length?(y=t,u):y},u.size=function(t){return arguments.length?(l=t,u):l},u.linkDistance=function(t){return arguments.length?(f="function"==typeof t?t:+t,u):f},u.distance=u.linkDistance,u.linkStrength=function(t){return arguments.length?(h="function"==typeof t?t:+t,u):h},u.friction=function(t){return arguments.length?(c=+t,u):c},u.charge=function(t){return arguments.length?(p="function"==typeof t?t:+t,u):p},u.chargeDistance=function(t){return arguments.length?(d=t*t,u):Math.sqrt(d)},u.gravity=function(t){return arguments.length?(m=+t,u):m},u.theta=function(t){return arguments.length?(g=t*t,u):Math.sqrt(g)},u.alpha=function(n){return arguments.length?(n=+n,e?n>0?e=n:(t.c=null,t.t=NaN,t=null,s.end({type:"end",alpha:e=0})):n>0&&(s.start({type:"start",alpha:e=n}),t=En(u.tick)),u):e},u.start=function(){var t,n,e,a=v.length,s=y.length,c=l[0],d=l[1];for(t=0;t<a;++t)(e=v[t]).index=t,e.weight=0;for(t=0;t<s;++t)"number"==typeof(e=y[t]).source&&(e.source=v[e.source]),"number"==typeof e.target&&(e.target=v[e.target]),++e.source.weight,++e.target.weight;for(t=0;t<a;++t)e=v[t],isNaN(e.x)&&(e.x=m("x",c)),isNaN(e.y)&&(e.y=m("y",d)),isNaN(e.px)&&(e.px=e.x),isNaN(e.py)&&(e.py=e.y);if(r=[],"function"==typeof f)for(t=0;t<s;++t)r[t]=+f.call(this,y[t],t);else for(t=0;t<s;++t)r[t]=f;if(o=[],"function"==typeof h)for(t=0;t<s;++t)o[t]=+h.call(this,y[t],t);else for(t=0;t<s;++t)o[t]=h;if(i=[],"function"==typeof p)for(t=0;t<a;++t)i[t]=+p.call(this,v[t],t);else for(t=0;t<a;++t)i[t]=p;function m(e,r){if(!n){for(n=new Array(a),l=0;l<a;++l)n[l]=[];for(l=0;l<s;++l){var o=y[l];n[o.source.index].push(o.target),n[o.target.index].push(o.source)}}for(var i,u=n[t],l=-1,c=u.length;++l<c;)if(!isNaN(i=u[l][e]))return i;return Math.random()*r}return u.resume()},u.resume=function(){return u.alpha(.1)},u.stop=function(){return u.alpha(0)},u.drag=function(){if(n||(n=a.behavior.drag().origin(L).on("dragstart.force",Na).on("drag.force",x).on("dragend.force",Pa)),!arguments.length)return n;this.on("mouseover.force",Ca).on("mouseout.force",Oa).call(n)},a.rebind(u,s,"on")};var La=20,Ua=1,Da=1/0;function za(t,n){return a.rebind(t,n,"sort","children","value"),t.nodes=t,t.links=Xa,t}function qa(t,n){for(var e=[t];null!=(t=e.pop());)if(n(t),(o=t.children)&&(r=o.length))for(var r,o;--r>=0;)e.push(o[r])}function ja(t,n){for(var e=[t],r=[];null!=(t=e.pop());)if(r.push(t),(a=t.children)&&(o=a.length))for(var o,a,i=-1;++i<o;)e.push(a[i]);for(;null!=(t=r.pop());)n(t)}function Fa(t){return t.children}function Ba(t){return t.value}function Ia(t,n){return n.value-t.value}function Xa(t){return a.merge(t.map((function(t){return(t.children||[]).map((function(n){return{source:t,target:n}}))})))}a.layout.hierarchy=function(){var t=Ia,n=Fa,e=Ba;function r(o){var a,i=[o],u=[];for(o.depth=0;null!=(a=i.pop());)if(u.push(a),(l=n.call(r,a,a.depth))&&(s=l.length)){for(var s,l,c;--s>=0;)i.push(c=l[s]),c.parent=a,c.depth=a.depth+1;e&&(a.value=0),a.children=l}else e&&(a.value=+e.call(r,a,a.depth)||0),delete a.children;return ja(o,(function(n){var r,o;t&&(r=n.children)&&r.sort(t),e&&(o=n.parent)&&(o.value+=n.value)})),u}return r.sort=function(n){return arguments.length?(t=n,r):t},r.children=function(t){return arguments.length?(n=t,r):n},r.value=function(t){return arguments.length?(e=t,r):e},r.revalue=function(t){return e&&(qa(t,(function(t){t.children&&(t.value=0)})),ja(t,(function(t){var n;t.children||(t.value=+e.call(r,t,t.depth)||0),(n=t.parent)&&(n.value+=t.value)}))),t},r},a.layout.partition=function(){var t=a.layout.hierarchy(),n=[1,1];function e(e,r){var o=t.call(this,e,r);return function t(n,e,r,o){var a=n.children;if(n.x=e,n.y=n.depth*o,n.dx=r,n.dy=o,a&&(i=a.length)){var i,u,s,l=-1;for(r=n.value?r/n.value:0;++l<i;)t(u=a[l],e,s=u.value*r,o),e+=s}}(o[0],0,n[0],n[1]/function t(n){var e=n.children,r=0;if(e&&(o=e.length))for(var o,a=-1;++a<o;)r=Math.max(r,t(e[a]));return 1+r}(o[0])),o}return e.size=function(t){return arguments.length?(n=t,e):n},za(e,t)},a.layout.pie=function(){var t=Number,n=Ya,e=0,r=Pt,o=0;function i(u){var s,l=u.length,c=u.map((function(n,e){return+t.call(i,n,e)})),f=+("function"==typeof e?e.apply(this,arguments):e),h=("function"==typeof r?r.apply(this,arguments):r)-f,p=Math.min(Math.abs(h)/l,+("function"==typeof o?o.apply(this,arguments):o)),d=p*(h<0?-1:1),m=a.sum(c),g=m?(h-l*d)/m:0,v=a.range(l),y=[];return null!=n&&v.sort(n===Ya?function(t,n){return c[n]-c[t]}:function(t,e){return n(u[t],u[e])}),v.forEach((function(t){y[t]={data:u[t],value:s=c[t],startAngle:f,endAngle:f+=s*g+d,padAngle:p}})),y}return i.value=function(n){return arguments.length?(t=n,i):t},i.sort=function(t){return arguments.length?(n=t,i):n},i.startAngle=function(t){return arguments.length?(e=t,i):e},i.endAngle=function(t){return arguments.length?(r=t,i):r},i.padAngle=function(t){return arguments.length?(o=t,i):o},i};var Ya={};function Va(t){return t.x}function Ha(t){return t.y}function Ga(t,n,e){t.y0=n,t.y=e}a.layout.stack=function(){var t=L,n=Ja,e=$a,r=Ga,o=Va,i=Ha;function u(s,l){if(!(p=s.length))return s;var c=s.map((function(n,e){return t.call(u,n,e)})),f=c.map((function(t){return t.map((function(t,n){return[o.call(u,t,n),i.call(u,t,n)]}))})),h=n.call(u,f,l);c=a.permute(c,h),f=a.permute(f,h);var p,d,m,g,v=e.call(u,f,l),y=c[0].length;for(m=0;m<y;++m)for(r.call(u,c[0][m],g=v[m],f[0][m][1]),d=1;d<p;++d)r.call(u,c[d][m],g+=f[d-1][m][1],f[d][m][1]);return s}return u.values=function(n){return arguments.length?(t=n,u):t},u.order=function(t){return arguments.length?(n="function"==typeof t?t:Wa.get(t)||Ja,u):n},u.offset=function(t){return arguments.length?(e="function"==typeof t?t:Za.get(t)||$a,u):e},u.x=function(t){return arguments.length?(o=t,u):o},u.y=function(t){return arguments.length?(i=t,u):i},u.out=function(t){return arguments.length?(r=t,u):r},u};var Wa=a.map({"inside-out":function(t){var n,e,r=t.length,o=t.map(Ka),i=t.map(Qa),u=a.range(r).sort((function(t,n){return o[t]-o[n]})),s=0,l=0,c=[],f=[];for(n=0;n<r;++n)e=u[n],s<l?(s+=i[e],c.push(e)):(l+=i[e],f.push(e));return f.reverse().concat(c)},reverse:function(t){return a.range(t.length).reverse()},default:Ja}),Za=a.map({silhouette:function(t){var n,e,r,o=t.length,a=t[0].length,i=[],u=0,s=[];for(e=0;e<a;++e){for(n=0,r=0;n<o;n++)r+=t[n][e][1];r>u&&(u=r),i.push(r)}for(e=0;e<a;++e)s[e]=(u-i[e])/2;return s},wiggle:function(t){var n,e,r,o,a,i,u,s,l,c=t.length,f=t[0],h=f.length,p=[];for(p[0]=s=l=0,e=1;e<h;++e){for(n=0,o=0;n<c;++n)o+=t[n][e][1];for(n=0,a=0,u=f[e][0]-f[e-1][0];n<c;++n){for(r=0,i=(t[n][e][1]-t[n][e-1][1])/(2*u);r<n;++r)i+=(t[r][e][1]-t[r][e-1][1])/u;a+=i*t[n][e][1]}p[e]=s-=o?a/o*u:0,s<l&&(l=s)}for(e=0;e<h;++e)p[e]-=l;return p},expand:function(t){var n,e,r,o=t.length,a=t[0].length,i=1/o,u=[];for(e=0;e<a;++e){for(n=0,r=0;n<o;n++)r+=t[n][e][1];if(r)for(n=0;n<o;n++)t[n][e][1]/=r;else for(n=0;n<o;n++)t[n][e][1]=i}for(e=0;e<a;++e)u[e]=0;return u},zero:$a});function Ja(t){return a.range(t.length)}function $a(t){for(var n=-1,e=t[0].length,r=[];++n<e;)r[n]=0;return r}function Ka(t){for(var n,e=1,r=0,o=t[0][1],a=t.length;e<a;++e)(n=t[e][1])>o&&(r=e,o=n);return r}function Qa(t){return t.reduce(ti,0)}function ti(t,n){return t+n[1]}function ni(t,n){return ei(t,Math.ceil(Math.log(n.length)/Math.LN2+1))}function ei(t,n){for(var e=-1,r=+t[0],o=(t[1]-r)/n,a=[];++e<=n;)a[e]=o*e+r;return a}function ri(t){return[a.min(t),a.max(t)]}function oi(t,n){return t.value-n.value}function ai(t,n){var e=t._pack_next;t._pack_next=n,n._pack_prev=t,n._pack_next=e,e._pack_prev=n}function ii(t,n){t._pack_next=n,n._pack_prev=t}function ui(t,n){var e=n.x-t.x,r=n.y-t.y,o=t.r+n.r;return.999*o*o>e*e+r*r}function si(t){if((n=t.children)&&(s=n.length)){var n,e,r,o,a,i,u,s,l=1/0,c=-1/0,f=1/0,h=-1/0;if(n.forEach(li),(e=n[0]).x=-e.r,e.y=0,b(e),s>1&&((r=n[1]).x=r.r,r.y=0,b(r),s>2))for(fi(e,r,o=n[2]),b(o),ai(e,o),e._pack_prev=o,ai(o,r),r=e._pack_next,a=3;a<s;a++){fi(e,r,o=n[a]);var p=0,d=1,m=1;for(i=r._pack_next;i!==r;i=i._pack_next,d++)if(ui(i,o)){p=1;break}if(1==p)for(u=e._pack_prev;u!==i._pack_prev&&!ui(u,o);u=u._pack_prev,m++);p?(d<m||d==m&&r.r<e.r?ii(e,r=i):ii(e=u,r),a--):(ai(e,o),r=o,b(o))}var g=(l+c)/2,v=(f+h)/2,y=0;for(a=0;a<s;a++)(o=n[a]).x-=g,o.y-=v,y=Math.max(y,o.r+Math.sqrt(o.x*o.x+o.y*o.y));t.r=y,n.forEach(ci)}function b(t){l=Math.min(t.x-t.r,l),c=Math.max(t.x+t.r,c),f=Math.min(t.y-t.r,f),h=Math.max(t.y+t.r,h)}}function li(t){t._pack_next=t._pack_prev=t}function ci(t){delete t._pack_next,delete t._pack_prev}function fi(t,n,e){var r=t.r+e.r,o=n.x-t.x,a=n.y-t.y;if(r&&(o||a)){var i=n.r+e.r,u=o*o+a*a,s=.5+((r*=r)-(i*=i))/(2*u),l=Math.sqrt(Math.max(0,2*i*(r+u)-(r-=u)*r-i*i))/(2*u);e.x=t.x+s*o+l*a,e.y=t.y+s*a-l*o}else e.x=t.x+r,e.y=t.y}function hi(t,n){return t.parent==n.parent?1:2}function pi(t){var n=t.children;return n.length?n[0]:t.t}function di(t){var n,e=t.children;return(n=e.length)?e[n-1]:t.t}function mi(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function gi(t,n,e){return t.a.parent===n.parent?t.a:e}function vi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function yi(t,n){var e=t.x+n[3],r=t.y+n[0],o=t.dx-n[1]-n[3],a=t.dy-n[0]-n[2];return o<0&&(e+=o/2,o=0),a<0&&(r+=a/2,a=0),{x:e,y:r,dx:o,dy:a}}function bi(t){var n=t[0],e=t[t.length-1];return n<e?[n,e]:[e,n]}function xi(t){return t.rangeExtent?t.rangeExtent():bi(t.range())}function Mi(t,n,e,r){var o=e(t[0],t[1]),a=r(n[0],n[1]);return function(t){return a(o(t))}}function wi(t,n){var e,r=0,o=t.length-1,a=t[r],i=t[o];return i<a&&(e=r,r=o,o=e,e=a,a=i,i=e),t[r]=n.floor(a),t[o]=n.ceil(i),t}function _i(t){return t?{floor:function(n){return Math.floor(n/t)*t},ceil:function(n){return Math.ceil(n/t)*t}}:ki}a.layout.histogram=function(){var t=!0,n=Number,e=ri,r=ni;function o(o,i){for(var u,s,l=[],c=o.map(n,this),f=e.call(this,c,i),h=r.call(this,f,c,i),p=(i=-1,c.length),d=h.length-1,m=t?1:1/p;++i<d;)(u=l[i]=[]).dx=h[i+1]-(u.x=h[i]),u.y=0;if(d>0)for(i=-1;++i<p;)(s=c[i])>=f[0]&&s<=f[1]&&((u=l[a.bisect(h,s,1,d)-1]).y+=m,u.push(o[i]));return l}return o.value=function(t){return arguments.length?(n=t,o):n},o.range=function(t){return arguments.length?(e=bn(t),o):e},o.bins=function(t){return arguments.length?(r="number"==typeof t?function(n){return ei(n,t)}:bn(t),o):r},o.frequency=function(n){return arguments.length?(t=!!n,o):t},o},a.layout.pack=function(){var t,n=a.layout.hierarchy().sort(oi),e=0,r=[1,1];function o(o,a){var i=n.call(this,o,a),u=i[0],s=r[0],l=r[1],c=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(u.x=u.y=0,ja(u,(function(t){t.r=+c(t.value)})),ja(u,si),e){var f=e*(t?1:Math.max(2*u.r/s,2*u.r/l))/2;ja(u,(function(t){t.r+=f})),ja(u,si),ja(u,(function(t){t.r-=f}))}return function t(n,e,r,o){var a=n.children;if(n.x=e+=o*n.x,n.y=r+=o*n.y,n.r*=o,a)for(var i=-1,u=a.length;++i<u;)t(a[i],e,r,o)}(u,s/2,l/2,t?1:1/Math.max(2*u.r/s,2*u.r/l)),i}return o.size=function(t){return arguments.length?(r=t,o):r},o.radius=function(n){return arguments.length?(t=null==n||"function"==typeof n?n:+n,o):t},o.padding=function(t){return arguments.length?(e=+t,o):e},za(o,n)},a.layout.tree=function(){var t=a.layout.hierarchy().sort(null).value(null),n=hi,e=[1,1],r=null;function o(o,a){var l=t.call(this,o,a),c=l[0],f=function(t){for(var n,e={A:null,children:[t]},r=[e];null!=(n=r.pop());)for(var o,a=n.children,i=0,u=a.length;i<u;++i)r.push((a[i]=o={_:a[i],parent:n,children:(o=a[i].children)&&o.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:i}).a=o);return e.children[0]}(c);if(ja(f,i),f.parent.m=-f.z,qa(f,u),r)qa(c,s);else{var h=c,p=c,d=c;qa(c,(function(t){t.x<h.x&&(h=t),t.x>p.x&&(p=t),t.depth>d.depth&&(d=t)}));var m=n(h,p)/2-h.x,g=e[0]/(p.x+n(p,h)/2+m),v=e[1]/(d.depth||1);qa(c,(function(t){t.x=(t.x+m)*g,t.y=t.depth*v}))}return l}function i(t){var e=t.children,r=t.parent.children,o=t.i?r[t.i-1]:null;if(e.length){!function(t){for(var n,e=0,r=0,o=t.children,a=o.length;--a>=0;)(n=o[a]).z+=e,n.m+=e,e+=n.s+(r+=n.c)}(t);var a=(e[0].z+e[e.length-1].z)/2;o?(t.z=o.z+n(t._,o._),t.m=t.z-a):t.z=a}else o&&(t.z=o.z+n(t._,o._));t.parent.A=function(t,e,r){if(e){for(var o,a=t,i=t,u=e,s=a.parent.children[0],l=a.m,c=i.m,f=u.m,h=s.m;u=di(u),a=pi(a),u&&a;)s=pi(s),(i=di(i)).a=t,(o=u.z+f-a.z-l+n(u._,a._))>0&&(mi(gi(u,t,r),t,o),l+=o,c+=o),f+=u.m,l+=a.m,h+=s.m,c+=i.m;u&&!di(i)&&(i.t=u,i.m+=f-c),a&&!pi(s)&&(s.t=a,s.m+=l-h,r=t)}return r}(t,o,t.parent.A||r[0])}function u(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=e[0],t.y=t.depth*e[1]}return o.separation=function(t){return arguments.length?(n=t,o):n},o.size=function(t){return arguments.length?(r=null==(e=t)?s:null,o):r?null:e},o.nodeSize=function(t){return arguments.length?(r=null==(e=t)?null:s,o):r?e:null},za(o,t)},a.layout.cluster=function(){var t=a.layout.hierarchy().sort(null).value(null),n=hi,e=[1,1],r=!1;function o(o,i){var u,s=t.call(this,o,i),l=s[0],c=0;ja(l,(function(t){var e=t.children;e&&e.length?(t.x=function(t){return t.reduce((function(t,n){return t+n.x}),0)/t.length}(e),t.y=function(t){return 1+a.max(t,(function(t){return t.y}))}(e)):(t.x=u?c+=n(t,u):0,t.y=0,u=t)}));var f=function t(n){var e=n.children;return e&&e.length?t(e[0]):n}(l),h=function t(n){var e,r=n.children;return r&&(e=r.length)?t(r[e-1]):n}(l),p=f.x-n(f,h)/2,d=h.x+n(h,f)/2;return ja(l,r?function(t){t.x=(t.x-l.x)*e[0],t.y=(l.y-t.y)*e[1]}:function(t){t.x=(t.x-p)/(d-p)*e[0],t.y=(1-(l.y?t.y/l.y:1))*e[1]}),s}return o.separation=function(t){return arguments.length?(n=t,o):n},o.size=function(t){return arguments.length?(r=null==(e=t),o):r?null:e},o.nodeSize=function(t){return arguments.length?(r=null!=(e=t),o):r?e:null},za(o,t)},a.layout.treemap=function(){var t,n=a.layout.hierarchy(),e=Math.round,r=[1,1],o=null,i=vi,u=!1,s="squarify",l=.5*(1+Math.sqrt(5));function c(t,n){for(var e,r,o=-1,a=t.length;++o<a;)r=(e=t[o]).value*(n<0?0:n),e.area=isNaN(r)||r<=0?0:r}function f(t){var n=t.children;if(n&&n.length){var e,r,o,a=i(t),u=[],l=n.slice(),h=1/0,m="slice"===s?a.dx:"dice"===s?a.dy:"slice-dice"===s?1&t.depth?a.dy:a.dx:Math.min(a.dx,a.dy);for(c(l,a.dx*a.dy/t.value),u.area=0;(o=l.length)>0;)u.push(e=l[o-1]),u.area+=e.area,"squarify"!==s||(r=p(u,m))<=h?(l.pop(),h=r):(u.area-=u.pop().area,d(u,m,a,!1),m=Math.min(a.dx,a.dy),u.length=u.area=0,h=1/0);u.length&&(d(u,m,a,!0),u.length=u.area=0),n.forEach(f)}}function h(t){var n=t.children;if(n&&n.length){var e,r=i(t),o=n.slice(),a=[];for(c(o,r.dx*r.dy/t.value),a.area=0;e=o.pop();)a.push(e),a.area+=e.area,null!=e.z&&(d(a,e.z?r.dx:r.dy,r,!o.length),a.length=a.area=0);n.forEach(h)}}function p(t,n){for(var e,r=t.area,o=0,a=1/0,i=-1,u=t.length;++i<u;)(e=t[i].area)&&(e<a&&(a=e),e>o&&(o=e));return n*=n,(r*=r)?Math.max(n*o*l/r,r/(n*a*l)):1/0}function d(t,n,r,o){var a,i=-1,u=t.length,s=r.x,l=r.y,c=n?e(t.area/n):0;if(n==r.dx){for((o||c>r.dy)&&(c=r.dy);++i<u;)(a=t[i]).x=s,a.y=l,a.dy=c,s+=a.dx=Math.min(r.x+r.dx-s,c?e(a.area/c):0);a.z=!0,a.dx+=r.x+r.dx-s,r.y+=c,r.dy-=c}else{for((o||c>r.dx)&&(c=r.dx);++i<u;)(a=t[i]).x=s,a.y=l,a.dx=c,l+=a.dy=Math.min(r.y+r.dy-l,c?e(a.area/c):0);a.z=!1,a.dy+=r.y+r.dy-l,r.x+=c,r.dx-=c}}function m(e){var o=t||n(e),a=o[0];return a.x=a.y=0,a.value?(a.dx=r[0],a.dy=r[1]):a.dx=a.dy=0,t&&n.revalue(a),c([a],a.dx*a.dy/a.value),(t?h:f)(a),u&&(t=o),o}return m.size=function(t){return arguments.length?(r=t,m):r},m.padding=function(t){if(!arguments.length)return o;function n(n){var e=t.call(m,n,n.depth);return null==e?vi(n):yi(n,"number"==typeof e?[e,e,e,e]:e)}function e(n){return yi(n,t)}var r;return i=null==(o=t)?vi:"function"==(r=typeof t)?n:"number"===r?(t=[t,t,t,t],e):e,m},m.round=function(t){return arguments.length?(e=t?Math.round:Number,m):e!=Number},m.sticky=function(n){return arguments.length?(u=n,t=null,m):u},m.ratio=function(t){return arguments.length?(l=t,m):l},m.mode=function(t){return arguments.length?(s=t+"",m):s},za(m,n)},a.random={normal:function(t,n){var e=arguments.length;return e<2&&(n=1),e<1&&(t=0),function(){var e,r,o;do{o=(e=2*Math.random()-1)*e+(r=2*Math.random()-1)*r}while(!o||o>1);return t+n*e*Math.sqrt(-2*Math.log(o)/o)}},logNormal:function(){var t=a.random.normal.apply(a,arguments);return function(){return Math.exp(t())}},bates:function(t){var n=a.random.irwinHall(t);return function(){return n()/t}},irwinHall:function(t){return function(){for(var n=0,e=0;e<t;e++)n+=Math.random();return n}}},a.scale={};var ki={floor:L,ceil:L};function Si(t,n,e,r){var o=[],i=[],u=0,s=Math.min(t.length,n.length)-1;for(t[s]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++u<=s;)o.push(e(t[u-1],t[u])),i.push(r(n[u-1],n[u]));return function(n){var e=a.bisect(t,n,1,s)-1;return i[e](o[e](n))}}function Ai(t,n){return a.rebind(t,n,"range","rangeRound","interpolate","clamp")}function Ei(t,n){return wi(t,_i(Ti(t,n)[2])),wi(t,_i(Ti(t,n)[2])),t}function Ti(t,n){null==n&&(n=10);var e=bi(t),r=e[1]-e[0],o=Math.pow(10,Math.floor(Math.log(r/n)/Math.LN10)),a=n/r*o;return a<=.15?o*=10:a<=.35?o*=5:a<=.75&&(o*=2),e[0]=Math.ceil(e[0]/o)*o,e[1]=Math.floor(e[1]/o)*o+.5*o,e[2]=o,e}function Ri(t,n){return a.range.apply(a,Ti(t,n))}function Ni(t,n,e){var r=Ti(t,n);if(e){var o=Ln.exec(e);if(o.shift(),"s"===o[8]){var i=a.formatPrefix(Math.max(w(r[0]),w(r[1])));return o[7]||(o[7]="."+Ci(i.scale(r[2]))),o[8]="f",e=a.format(o.join("")),function(t){return e(i.scale(t))+i.symbol}}o[7]||(o[7]="."+function(t,n){var e=Ci(n[2]);return t in Pi?Math.abs(e-Ci(Math.max(w(n[0]),w(n[1]))))+ +("e"!==t):e-2*("%"===t)}(o[8],r)),e=o.join("")}else e=",."+Ci(r[2])+"f";return a.format(e)}a.scale.linear=function(){return function t(n,e,r,o){var a,i;function u(){var t=Math.min(n.length,e.length)>2?Si:Mi,u=o?Ea:Aa;return a=t(n,e,u,r),i=t(e,n,u,oa),s}function s(t){return a(t)}return s.invert=function(t){return i(t)},s.domain=function(t){return arguments.length?(n=t.map(Number),u()):n},s.range=function(t){return arguments.length?(e=t,u()):e},s.rangeRound=function(t){return s.range(t).interpolate(ba)},s.clamp=function(t){return arguments.length?(o=t,u()):o},s.interpolate=function(t){return arguments.length?(r=t,u()):r},s.ticks=function(t){return Ri(n,t)},s.tickFormat=function(t,e){return Ni(n,t,e)},s.nice=function(t){return Ei(n,t),u()},s.copy=function(){return t(n,e,r,o)},u()}([0,1],[0,1],oa,!1)};var Pi={s:1,g:1,p:1,r:1,e:1};function Ci(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}a.scale.log=function(){return function t(n,e,r,o){function i(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function u(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function s(t){return n(i(t))}return s.invert=function(t){return u(n.invert(t))},s.domain=function(t){return arguments.length?(r=t[0]>=0,n.domain((o=t.map(Number)).map(i)),s):o},s.base=function(t){return arguments.length?(e=+t,n.domain(o.map(i)),s):e},s.nice=function(){var t=wi(o.map(i),r?Math:Li);return n.domain(t),o=t.map(u),s},s.ticks=function(){var t=bi(o),n=[],a=t[0],s=t[1],l=Math.floor(i(a)),c=Math.ceil(i(s)),f=e%1?2:e;if(isFinite(c-l)){if(r){for(;l<c;l++)for(var h=1;h<f;h++)n.push(u(l)*h);n.push(u(l))}else for(n.push(u(l));l++<c;)for(h=f-1;h>0;h--)n.push(u(l)*h);for(l=0;n[l]<a;l++);for(c=n.length;n[c-1]>s;c--);n=n.slice(l,c)}return n},s.tickFormat=function(t,n){if(!arguments.length)return Oi;arguments.length<2?n=Oi:"function"!=typeof n&&(n=a.format(n));var r=Math.max(1,e*t/s.ticks().length);return function(t){var o=t/u(Math.round(i(t)));return o*e<e-.5&&(o*=e),o<=r?n(t):""}},s.copy=function(){return t(n.copy(),e,r,o)},Ai(s,n)}(a.scale.linear().domain([0,1]),10,!0,[1,10])};var Oi=a.format(".0e"),Li={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};function Ui(t){return function(n){return n<0?-Math.pow(-n,t):Math.pow(n,t)}}a.scale.pow=function(){return function t(n,e,r){var o=Ui(e),a=Ui(1/e);function i(t){return n(o(t))}return i.invert=function(t){return a(n.invert(t))},i.domain=function(t){return arguments.length?(n.domain((r=t.map(Number)).map(o)),i):r},i.ticks=function(t){return Ri(r,t)},i.tickFormat=function(t,n){return Ni(r,t,n)},i.nice=function(t){return i.domain(Ei(r,t))},i.exponent=function(t){return arguments.length?(o=Ui(e=t),a=Ui(1/e),n.domain(r.map(o)),i):e},i.copy=function(){return t(n.copy(),e,r)},Ai(i,n)}(a.scale.linear(),1,[0,1])},a.scale.sqrt=function(){return a.scale.pow().exponent(.5)},a.scale.ordinal=function(){return function t(n,e){var r,o,i;function u(t){return o[((r.get(t)||("range"===e.t?r.set(t,n.push(t)):NaN))-1)%o.length]}function s(t,e){return a.range(n.length).map((function(n){return t+e*n}))}return u.domain=function(t){if(!arguments.length)return n;n=[],r=new S;for(var o,a=-1,i=t.length;++a<i;)r.has(o=t[a])||r.set(o,n.push(o));return u[e.t].apply(u,e.a)},u.range=function(t){return arguments.length?(o=t,i=0,e={t:"range",a:arguments},u):o},u.rangePoints=function(t,r){arguments.length<2&&(r=0);var a=t[0],l=t[1],c=n.length<2?(a=(a+l)/2,0):(l-a)/(n.length-1+r);return o=s(a+c*r/2,c),i=0,e={t:"rangePoints",a:arguments},u},u.rangeRoundPoints=function(t,r){arguments.length<2&&(r=0);var a=t[0],l=t[1],c=n.length<2?(a=l=Math.round((a+l)/2),0):(l-a)/(n.length-1+r)|0;return o=s(a+Math.round(c*r/2+(l-a-(n.length-1+r)*c)/2),c),i=0,e={t:"rangeRoundPoints",a:arguments},u},u.rangeBands=function(t,r,a){arguments.length<2&&(r=0),arguments.length<3&&(a=r);var l=t[1]<t[0],c=t[l-0],f=t[1-l],h=(f-c)/(n.length-r+2*a);return o=s(c+h*a,h),l&&o.reverse(),i=h*(1-r),e={t:"rangeBands",a:arguments},u},u.rangeRoundBands=function(t,r,a){arguments.length<2&&(r=0),arguments.length<3&&(a=r);var l=t[1]<t[0],c=t[l-0],f=t[1-l],h=Math.floor((f-c)/(n.length-r+2*a));return o=s(c+Math.round((f-c-(n.length-r)*h)/2),h),l&&o.reverse(),i=Math.round(h*(1-r)),e={t:"rangeRoundBands",a:arguments},u},u.rangeBand=function(){return i},u.rangeExtent=function(){return bi(e.a[0])},u.copy=function(){return t(n,e)},u.domain(n)}([],{t:"range",a:[[]]})},a.scale.category10=function(){return a.scale.ordinal().range(Di)},a.scale.category20=function(){return a.scale.ordinal().range(zi)},a.scale.category20b=function(){return a.scale.ordinal().range(qi)},a.scale.category20c=function(){return a.scale.ordinal().range(ji)};var Di=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(cn),zi=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(cn),qi=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(cn),ji=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(cn);function Fi(){return 0}a.scale.quantile=function(){return function t(n,e){var r;function o(){var t=0,o=e.length;for(r=[];++t<o;)r[t-1]=a.quantile(n,t/o);return i}function i(t){if(!isNaN(t=+t))return e[a.bisect(r,t)]}return i.domain=function(t){return arguments.length?(n=t.map(v).filter(y).sort(g),o()):n},i.range=function(t){return arguments.length?(e=t,o()):e},i.quantiles=function(){return r},i.invertExtent=function(t){return(t=e.indexOf(t))<0?[NaN,NaN]:[t>0?r[t-1]:n[0],t<r.length?r[t]:n[n.length-1]]},i.copy=function(){return t(n,e)},o()}([],[])},a.scale.quantize=function(){return function t(n,e,r){var o,a;function i(t){return r[Math.max(0,Math.min(a,Math.floor(o*(t-n))))]}function u(){return o=r.length/(e-n),a=r.length-1,i}return i.domain=function(t){return arguments.length?(n=+t[0],e=+t[t.length-1],u()):[n,e]},i.range=function(t){return arguments.length?(r=t,u()):r},i.invertExtent=function(t){return[t=(t=r.indexOf(t))<0?NaN:t/o+n,t+1/o]},i.copy=function(){return t(n,e,r)},u()}(0,1,[0,1])},a.scale.threshold=function(){return function t(n,e){function r(t){if(t<=t)return e[a.bisect(n,t)]}return r.domain=function(t){return arguments.length?(n=t,r):n},r.range=function(t){return arguments.length?(e=t,r):e},r.invertExtent=function(t){return t=e.indexOf(t),[n[t-1],n[t]]},r.copy=function(){return t(n,e)},r}([.5],[0,1])},a.scale.identity=function(){return function t(n){function e(t){return+t}return e.invert=e,e.domain=e.range=function(t){return arguments.length?(n=t.map(e),e):n},e.ticks=function(t){return Ri(n,t)},e.tickFormat=function(t,e){return Ni(n,t,e)},e.copy=function(){return t(n)},e}([0,1])},a.svg={},a.svg.arc=function(){var t=Ii,n=Xi,e=Fi,r=Bi,o=Yi,a=Vi,i=Hi;function u(){var u=Math.max(0,+t.apply(this,arguments)),l=Math.max(0,+n.apply(this,arguments)),c=o.apply(this,arguments)-Ot,f=a.apply(this,arguments)-Ot,h=Math.abs(f-c),p=c>f?0:1;if(l<u&&(d=l,l=u,u=d),h>=Ct)return s(l,p)+(u?s(u,1-p):"")+"Z";var d,m,g,v,y,b,x,M,w,_,k,S,A=0,E=0,T=[];if((v=(+i.apply(this,arguments)||0)/2)&&(g=r===Bi?Math.sqrt(u*u+l*l):+r.apply(this,arguments),p||(E*=-1),l&&(E=jt(g/l*Math.sin(v))),u&&(A=jt(g/u*Math.sin(v)))),l){y=l*Math.cos(c+E),b=l*Math.sin(c+E),x=l*Math.cos(f-E),M=l*Math.sin(f-E);var R=Math.abs(f-c-2*E)<=Nt?0:1;if(E&&Gi(y,b,x,M)===p^R){var N=(c+f)/2;y=l*Math.cos(N),b=l*Math.sin(N),x=M=null}}else y=b=0;if(u){w=u*Math.cos(f-A),_=u*Math.sin(f-A),k=u*Math.cos(c+A),S=u*Math.sin(c+A);var P=Math.abs(c-f+2*A)<=Nt?0:1;if(A&&Gi(w,_,k,S)===1-p^P){var C=(c+f)/2;w=u*Math.cos(C),_=u*Math.sin(C),k=S=null}}else w=_=0;if(h>Tt&&(d=Math.min(Math.abs(l-u)/2,+e.apply(this,arguments)))>.001){m=u<l^p?0:1;var O=d,L=d;if(h<Nt){var U=null==k?[w,_]:null==x?[y,b]:ho([y,b],[k,S],[x,M],[w,_]),D=y-U[0],z=b-U[1],q=x-U[0],j=M-U[1],F=1/Math.sin(Math.acos((D*q+z*j)/(Math.sqrt(D*D+z*z)*Math.sqrt(q*q+j*j)))/2),B=Math.sqrt(U[0]*U[0]+U[1]*U[1]);L=Math.min(d,(u-B)/(F-1)),O=Math.min(d,(l-B)/(F+1))}if(null!=x){var I=Wi(null==k?[w,_]:[k,S],[y,b],l,O,p),X=Wi([x,M],[w,_],l,O,p);d===O?T.push("M",I[0],"A",O,",",O," 0 0,",m," ",I[1],"A",l,",",l," 0 ",1-p^Gi(I[1][0],I[1][1],X[1][0],X[1][1]),",",p," ",X[1],"A",O,",",O," 0 0,",m," ",X[0]):T.push("M",I[0],"A",O,",",O," 0 1,",m," ",X[0])}else T.push("M",y,",",b);if(null!=k){var Y=Wi([y,b],[k,S],u,-L,p),V=Wi([w,_],null==x?[y,b]:[x,M],u,-L,p);d===L?T.push("L",V[0],"A",L,",",L," 0 0,",m," ",V[1],"A",u,",",u," 0 ",p^Gi(V[1][0],V[1][1],Y[1][0],Y[1][1]),",",1-p," ",Y[1],"A",L,",",L," 0 0,",m," ",Y[0]):T.push("L",V[0],"A",L,",",L," 0 0,",m," ",Y[0])}else T.push("L",w,",",_)}else T.push("M",y,",",b),null!=x&&T.push("A",l,",",l," 0 ",R,",",p," ",x,",",M),T.push("L",w,",",_),null!=k&&T.push("A",u,",",u," 0 ",P,",",1-p," ",k,",",S);return T.push("Z"),T.join("")}function s(t,n){return"M0,"+t+"A"+t+","+t+" 0 1,"+n+" 0,"+-t+"A"+t+","+t+" 0 1,"+n+" 0,"+t}return u.innerRadius=function(n){return arguments.length?(t=bn(n),u):t},u.outerRadius=function(t){return arguments.length?(n=bn(t),u):n},u.cornerRadius=function(t){return arguments.length?(e=bn(t),u):e},u.padRadius=function(t){return arguments.length?(r=t==Bi?Bi:bn(t),u):r},u.startAngle=function(t){return arguments.length?(o=bn(t),u):o},u.endAngle=function(t){return arguments.length?(a=bn(t),u):a},u.padAngle=function(t){return arguments.length?(i=bn(t),u):i},u.centroid=function(){var e=(+t.apply(this,arguments)+ +n.apply(this,arguments))/2,r=(+o.apply(this,arguments)+ +a.apply(this,arguments))/2-Ot;return[Math.cos(r)*e,Math.sin(r)*e]},u};var Bi="auto";function Ii(t){return t.innerRadius}function Xi(t){return t.outerRadius}function Yi(t){return t.startAngle}function Vi(t){return t.endAngle}function Hi(t){return t&&t.padAngle}function Gi(t,n,e,r){return(t-e)*n-(n-r)*t>0?0:1}function Wi(t,n,e,r,o){var a=t[0]-n[0],i=t[1]-n[1],u=(o?r:-r)/Math.sqrt(a*a+i*i),s=u*i,l=-u*a,c=t[0]+s,f=t[1]+l,h=n[0]+s,p=n[1]+l,d=(c+h)/2,m=(f+p)/2,g=h-c,v=p-f,y=g*g+v*v,b=e-r,x=c*p-h*f,M=(v<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*v-g*M)/y,_=(-x*g-v*M)/y,k=(x*v+g*M)/y,S=(-x*g+v*M)/y,A=w-d,E=_-m,T=k-d,R=S-m;return A*A+E*E>T*T+R*R&&(w=k,_=S),[[w-s,_-l],[w*e/b,_*e/b]]}function Zi(t){var n=io,e=uo,r=$e,o=$i,a=o.key,i=.7;function u(a){var u,s=[],l=[],c=-1,f=a.length,h=bn(n),p=bn(e);function d(){s.push("M",o(t(l),i))}for(;++c<f;)r.call(this,u=a[c],c)?l.push([+h.call(this,u,c),+p.call(this,u,c)]):l.length&&(d(),l=[]);return l.length&&d(),s.length?s.join(""):null}return u.x=function(t){return arguments.length?(n=t,u):n},u.y=function(t){return arguments.length?(e=t,u):e},u.defined=function(t){return arguments.length?(r=t,u):r},u.interpolate=function(t){return arguments.length?(a="function"==typeof t?o=t:(o=Ji.get(t)||$i).key,u):a},u.tension=function(t){return arguments.length?(i=t,u):i},u}a.svg.line=function(){return Zi(L)};var Ji=a.map({linear:$i,"linear-closed":Ki,step:function(t){for(var n=0,e=t.length,r=t[0],o=[r[0],",",r[1]];++n<e;)o.push("H",(r[0]+(r=t[n])[0])/2,"V",r[1]);return e>1&&o.push("H",r[0]),o.join("")},"step-before":Qi,"step-after":tu,basis:ru,"basis-open":function(t){if(t.length<4)return $i(t);for(var n,e=[],r=-1,o=t.length,a=[0],i=[0];++r<3;)n=t[r],a.push(n[0]),i.push(n[1]);for(e.push(ou(uu,a)+","+ou(uu,i)),--r;++r<o;)n=t[r],a.shift(),a.push(n[0]),i.shift(),i.push(n[1]),su(e,a,i);return e.join("")},"basis-closed":function(t){for(var n,e,r=-1,o=t.length,a=o+4,i=[],u=[];++r<4;)e=t[r%o],i.push(e[0]),u.push(e[1]);for(n=[ou(uu,i),",",ou(uu,u)],--r;++r<a;)e=t[r%o],i.shift(),i.push(e[0]),u.shift(),u.push(e[1]),su(n,i,u);return n.join("")},bundle:function(t,n){var e=t.length-1;if(e)for(var r,o,a=t[0][0],i=t[0][1],u=t[e][0]-a,s=t[e][1]-i,l=-1;++l<=e;)r=t[l],o=l/e,r[0]=n*r[0]+(1-n)*(a+o*u),r[1]=n*r[1]+(1-n)*(i+o*s);return ru(t)},cardinal:function(t,n){return t.length<3?$i(t):t[0]+nu(t,eu(t,n))},"cardinal-open":function(t,n){return t.length<4?$i(t):t[1]+nu(t.slice(1,-1),eu(t,n))},"cardinal-closed":function(t,n){return t.length<3?Ki(t):t[0]+nu((t.push(t[0]),t),eu([t[t.length-2]].concat(t,[t[1]]),n))},monotone:function(t){return t.length<3?$i(t):t[0]+nu(t,function(t){for(var n,e,r,o,a=[],i=function(t){for(var n=0,e=t.length-1,r=[],o=t[0],a=t[1],i=r[0]=lu(o,a);++n<e;)r[n]=(i+(i=lu(o=a,a=t[n+1])))/2;return r[n]=i,r}(t),u=-1,s=t.length-1;++u<s;)n=lu(t[u],t[u+1]),w(n)<Tt?i[u]=i[u+1]=0:(e=i[u]/n,r=i[u+1]/n,(o=e*e+r*r)>9&&(o=3*n/Math.sqrt(o),i[u]=o*e,i[u+1]=o*r));for(u=-1;++u<=s;)o=(t[Math.min(s,u+1)][0]-t[Math.max(0,u-1)][0])/(6*(1+i[u]*i[u])),a.push([o||0,i[u]*o||0]);return a}(t))}});function $i(t){return t.length>1?t.join("L"):t+"Z"}function Ki(t){return t.join("L")+"Z"}function Qi(t){for(var n=0,e=t.length,r=t[0],o=[r[0],",",r[1]];++n<e;)o.push("V",(r=t[n])[1],"H",r[0]);return o.join("")}function tu(t){for(var n=0,e=t.length,r=t[0],o=[r[0],",",r[1]];++n<e;)o.push("H",(r=t[n])[0],"V",r[1]);return o.join("")}function nu(t,n){if(n.length<1||t.length!=n.length&&t.length!=n.length+2)return $i(t);var e=t.length!=n.length,r="",o=t[0],a=t[1],i=n[0],u=i,s=1;if(e&&(r+="Q"+(a[0]-2*i[0]/3)+","+(a[1]-2*i[1]/3)+","+a[0]+","+a[1],o=t[1],s=2),n.length>1){u=n[1],a=t[s],s++,r+="C"+(o[0]+i[0])+","+(o[1]+i[1])+","+(a[0]-u[0])+","+(a[1]-u[1])+","+a[0]+","+a[1];for(var l=2;l<n.length;l++,s++)a=t[s],u=n[l],r+="S"+(a[0]-u[0])+","+(a[1]-u[1])+","+a[0]+","+a[1]}if(e){var c=t[s];r+="Q"+(a[0]+2*u[0]/3)+","+(a[1]+2*u[1]/3)+","+c[0]+","+c[1]}return r}function eu(t,n){for(var e,r=[],o=(1-n)/2,a=t[0],i=t[1],u=1,s=t.length;++u<s;)e=a,a=i,i=t[u],r.push([o*(i[0]-e[0]),o*(i[1]-e[1])]);return r}function ru(t){if(t.length<3)return $i(t);var n=1,e=t.length,r=t[0],o=r[0],a=r[1],i=[o,o,o,(r=t[1])[0]],u=[a,a,a,r[1]],s=[o,",",a,"L",ou(uu,i),",",ou(uu,u)];for(t.push(t[e-1]);++n<=e;)r=t[n],i.shift(),i.push(r[0]),u.shift(),u.push(r[1]),su(s,i,u);return t.pop(),s.push("L",r),s.join("")}function ou(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]*n[3]}Ji.forEach((function(t,n){n.key=t,n.closed=/-closed$/.test(t)}));var au=[0,2/3,1/3,0],iu=[0,1/3,2/3,0],uu=[0,1/6,2/3,1/6];function su(t,n,e){t.push("C",ou(au,n),",",ou(au,e),",",ou(iu,n),",",ou(iu,e),",",ou(uu,n),",",ou(uu,e))}function lu(t,n){return(n[1]-t[1])/(n[0]-t[0])}function cu(t){for(var n,e,r,o=-1,a=t.length;++o<a;)e=(n=t[o])[0],r=n[1]-Ot,n[0]=e*Math.cos(r),n[1]=e*Math.sin(r);return t}function fu(t){var n=io,e=io,r=0,o=uo,a=$e,i=$i,u=i.key,s=i,l="L",c=.7;function f(u){var f,h,p,d=[],m=[],g=[],v=-1,y=u.length,b=bn(n),x=bn(r),M=n===e?function(){return h}:bn(e),w=r===o?function(){return p}:bn(o);function _(){d.push("M",i(t(g),c),l,s(t(m.reverse()),c),"Z")}for(;++v<y;)a.call(this,f=u[v],v)?(m.push([h=+b.call(this,f,v),p=+x.call(this,f,v)]),g.push([+M.call(this,f,v),+w.call(this,f,v)])):m.length&&(_(),m=[],g=[]);return m.length&&_(),d.length?d.join(""):null}return f.x=function(t){return arguments.length?(n=e=t,f):e},f.x0=function(t){return arguments.length?(n=t,f):n},f.x1=function(t){return arguments.length?(e=t,f):e},f.y=function(t){return arguments.length?(r=o=t,f):o},f.y0=function(t){return arguments.length?(r=t,f):r},f.y1=function(t){return arguments.length?(o=t,f):o},f.defined=function(t){return arguments.length?(a=t,f):a},f.interpolate=function(t){return arguments.length?(u="function"==typeof t?i=t:(i=Ji.get(t)||$i).key,s=i.reverse||i,l=i.closed?"M":"L",f):u},f.tension=function(t){return arguments.length?(c=t,f):c},f}function hu(t){return t.radius}function pu(t){return[t.x,t.y]}function du(t){return function(){var n=t.apply(this,arguments),e=n[0],r=n[1]-Ot;return[e*Math.cos(r),e*Math.sin(r)]}}function mu(){return 64}function gu(){return"circle"}function vu(t){var n=Math.sqrt(t/Nt);return"M0,"+n+"A"+n+","+n+" 0 1,1 0,"+-n+"A"+n+","+n+" 0 1,1 0,"+n+"Z"}a.svg.line.radial=function(){var t=Zi(cu);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},Qi.reverse=tu,tu.reverse=Qi,a.svg.area=function(){return fu(L)},a.svg.area.radial=function(){var t=fu(cu);return t.radius=t.x,delete t.x,t.innerRadius=t.x0,delete t.x0,t.outerRadius=t.x1,delete t.x1,t.angle=t.y,delete t.y,t.startAngle=t.y0,delete t.y0,t.endAngle=t.y1,delete t.y1,t},a.svg.chord=function(){var t=Hr,n=Gr,e=hu,r=Yi,o=Vi;function a(e,r){var o=i(this,t,e,r),a=i(this,n,e,r);return"M"+o.p0+u(o.r,o.p1,o.a1-o.a0)+(function(t,n){return t.a0==n.a0&&t.a1==n.a1}(o,a)?s(o.r,o.p1,o.r,o.p0):s(o.r,o.p1,a.r,a.p0)+u(a.r,a.p1,a.a1-a.a0)+s(a.r,a.p1,o.r,o.p0))+"Z"}function i(t,n,a,i){var u=n.call(t,a,i),s=e.call(t,u,i),l=r.call(t,u,i)-Ot,c=o.call(t,u,i)-Ot;return{r:s,a0:l,a1:c,p0:[s*Math.cos(l),s*Math.sin(l)],p1:[s*Math.cos(c),s*Math.sin(c)]}}function u(t,n,e){return"A"+t+","+t+" 0 "+ +(e>Nt)+",1 "+n}function s(t,n,e,r){return"Q 0,0 "+r}return a.radius=function(t){return arguments.length?(e=bn(t),a):e},a.source=function(n){return arguments.length?(t=bn(n),a):t},a.target=function(t){return arguments.length?(n=bn(t),a):n},a.startAngle=function(t){return arguments.length?(r=bn(t),a):r},a.endAngle=function(t){return arguments.length?(o=bn(t),a):o},a},a.svg.diagonal=function(){var t=Hr,n=Gr,e=pu;function r(r,o){var a=t.call(this,r,o),i=n.call(this,r,o),u=(a.y+i.y)/2,s=[a,{x:a.x,y:u},{x:i.x,y:u},i];return"M"+(s=s.map(e))[0]+"C"+s[1]+" "+s[2]+" "+s[3]}return r.source=function(n){return arguments.length?(t=bn(n),r):t},r.target=function(t){return arguments.length?(n=bn(t),r):n},r.projection=function(t){return arguments.length?(e=t,r):e},r},a.svg.diagonal.radial=function(){var t=a.svg.diagonal(),n=pu,e=t.projection;return t.projection=function(t){return arguments.length?e(du(n=t)):n},t},a.svg.symbol=function(){var t=gu,n=mu;function e(e,r){return(yu.get(t.call(this,e,r))||vu)(n.call(this,e,r))}return e.type=function(n){return arguments.length?(t=bn(n),e):t},e.size=function(t){return arguments.length?(n=bn(t),e):n},e};var yu=a.map({circle:vu,cross:function(t){var n=Math.sqrt(t/5)/2;return"M"+-3*n+","+-n+"H"+-n+"V"+-3*n+"H"+n+"V"+-n+"H"+3*n+"V"+n+"H"+n+"V"+3*n+"H"+-n+"V"+n+"H"+-3*n+"Z"},diamond:function(t){var n=Math.sqrt(t/(2*xu)),e=n*xu;return"M0,"+-n+"L"+e+",0 0,"+n+" "+-e+",0Z"},square:function(t){var n=Math.sqrt(t)/2;return"M"+-n+","+-n+"L"+n+","+-n+" "+n+","+n+" "+-n+","+n+"Z"},"triangle-down":function(t){var n=Math.sqrt(t/bu),e=n*bu/2;return"M0,"+e+"L"+n+","+-e+" "+-n+","+-e+"Z"},"triangle-up":function(t){var n=Math.sqrt(t/bu),e=n*bu/2;return"M0,"+-e+"L"+n+","+e+" "+-n+","+e+"Z"}});a.svg.symbolTypes=yu.keys();var bu=Math.sqrt(3),xu=Math.tan(30*Lt);J.transition=function(t){for(var n,e,r=ku||++Eu,o=Nu(t),a=[],i=Su||{time:Date.now(),ease:da,delay:0,duration:250},u=-1,s=this.length;++u<s;){a.push(n=[]);for(var l=this[u],c=-1,f=l.length;++c<f;)(e=l[c])&&Pu(e,c,o,r,i),n.push(e)}return _u(a,o,r)},J.interrupt=function(t){return this.each(null==t?Mu:wu(Nu(t)))};var Mu=wu(Nu());function wu(t){return function(){var n,e,r;(n=this[t])&&(r=n[e=n.active])&&(r.timer.c=null,r.timer.t=NaN,--n.count?delete n[e]:delete this[t],n.active+=.5,r.event&&r.event.interrupt.call(this,this.__data__,r.index))}}function _u(t,n,e){return V(t,Au),t.namespace=n,t.id=e,t}var ku,Su,Au=[],Eu=0;function Tu(t,n,e,r){var o=t.id,a=t.namespace;return dt(t,"function"==typeof e?function(t,i,u){t[a][o].tween.set(n,r(e.call(t,t.__data__,i,u)))}:(e=r(e),function(t){t[a][o].tween.set(n,e)}))}function Ru(t){return null==t&&(t=""),function(){this.textContent=t}}function Nu(t){return null==t?"__transition__":"__transition_"+t+"__"}function Pu(t,n,e,r,o){var a,i,u,s,l,c=t[e]||(t[e]={active:0,count:0}),f=c[r];function h(e){var o=c.active,h=c[o];for(var d in h&&(h.timer.c=null,h.timer.t=NaN,--c.count,delete c[o],h.event&&h.event.interrupt.call(t,t.__data__,h.index)),c)if(+d<r){var m=c[d];m.timer.c=null,m.timer.t=NaN,--c.count,delete c[d]}i.c=p,En((function(){return i.c&&p(e||1)&&(i.c=null,i.t=NaN),1}),0,a),c.active=r,f.event&&f.event.start.call(t,t.__data__,n),l=[],f.tween.forEach((function(e,r){(r=r.call(t,t.__data__,n))&&l.push(r)})),s=f.ease,u=f.duration}function p(o){for(var a=o/u,i=s(a),h=l.length;h>0;)l[--h].call(t,i);if(a>=1)return f.event&&f.event.end.call(t,t.__data__,n),--c.count?delete c[r]:delete t[e],1}f||(a=o.time,i=En((function(t){var n=f.delay;if(i.t=n+a,n<=t)return h(t-n);i.c=h}),0,a),f=c[r]={tween:new S,time:a,timer:i,delay:o.delay,duration:o.duration,ease:o.ease,index:n},o=null,++c.count)}Au.call=J.call,Au.empty=J.empty,Au.node=J.node,Au.size=J.size,a.transition=function(t,n){return t&&t.transition?ku?t.transition(n):t:a.selection().transition(t)},a.transition.prototype=Au,Au.select=function(t){var n,e,r,o=this.id,a=this.namespace,i=[];t=$(t);for(var u=-1,s=this.length;++u<s;){i.push(n=[]);for(var l=this[u],c=-1,f=l.length;++c<f;)(r=l[c])&&(e=t.call(r,r.__data__,c,u))?("__data__"in r&&(e.__data__=r.__data__),Pu(e,c,a,o,r[a][o]),n.push(e)):n.push(null)}return _u(i,a,o)},Au.selectAll=function(t){var n,e,r,o,a,i=this.id,u=this.namespace,s=[];t=K(t);for(var l=-1,c=this.length;++l<c;)for(var f=this[l],h=-1,p=f.length;++h<p;)if(r=f[h]){a=r[u][i],e=t.call(r,r.__data__,h,l),s.push(n=[]);for(var d=-1,m=e.length;++d<m;)(o=e[d])&&Pu(o,d,u,i,a),n.push(o)}return _u(s,u,i)},Au.filter=function(t){var n,e,r=[];"function"!=typeof t&&(t=ht(t));for(var o=0,a=this.length;o<a;o++){r.push(n=[]);for(var i,u=0,s=(i=this[o]).length;u<s;u++)(e=i[u])&&t.call(e,e.__data__,u,o)&&n.push(e)}return _u(r,this.namespace,this.id)},Au.tween=function(t,n){var e=this.id,r=this.namespace;return arguments.length<2?this.node()[r][e].tween.get(t):dt(this,null==n?function(n){n[r][e].tween.remove(t)}:function(o){o[r][e].tween.set(t,n)})},Au.attr=function(t,n){if(arguments.length<2){for(n in t)this.attr(n,t[n]);return this}var e="transform"==t?Sa:oa,r=a.ns.qualify(t);function o(){this.removeAttribute(r)}function i(){this.removeAttributeNS(r.space,r.local)}function u(t){return null==t?o:(t+="",function(){var n,o=this.getAttribute(r);return o!==t&&(n=e(o,t),function(t){this.setAttribute(r,n(t))})})}function s(t){return null==t?i:(t+="",function(){var n,o=this.getAttributeNS(r.space,r.local);return o!==t&&(n=e(o,t),function(t){this.setAttributeNS(r.space,r.local,n(t))})})}return Tu(this,"attr."+t,n,r.local?s:u)},Au.attrTween=function(t,n){var e=a.ns.qualify(t);return this.tween("attr."+t,e.local?function(t,r){var o=n.call(this,t,r,this.getAttributeNS(e.space,e.local));return o&&function(t){this.setAttributeNS(e.space,e.local,o(t))}}:function(t,r){var o=n.call(this,t,r,this.getAttribute(e));return o&&function(t){this.setAttribute(e,o(t))}})},Au.style=function(t,n,e){var r=arguments.length;if(r<3){if("string"!=typeof t){for(e in r<2&&(n=""),t)this.style(e,t[e],n);return this}e=""}function o(){this.style.removeProperty(t)}function a(n){return null==n?o:(n+="",function(){var r,o=c(this).getComputedStyle(this,null).getPropertyValue(t);return o!==n&&(r=oa(o,n),function(n){this.style.setProperty(t,r(n),e)})})}return Tu(this,"style."+t,n,a)},Au.styleTween=function(t,n,e){function r(r,o){var a=n.call(this,r,o,c(this).getComputedStyle(this,null).getPropertyValue(t));return a&&function(n){this.style.setProperty(t,a(n),e)}}return arguments.length<3&&(e=""),this.tween("style."+t,r)},Au.text=function(t){return Tu(this,"text",t,Ru)},Au.remove=function(){var t=this.namespace;return this.each("end.transition",(function(){var n;this[t].count<2&&(n=this.parentNode)&&n.removeChild(this)}))},Au.ease=function(t){var n=this.id,e=this.namespace;return arguments.length<1?this.node()[e][n].ease:("function"!=typeof t&&(t=a.ease.apply(a,arguments)),dt(this,(function(r){r[e][n].ease=t})))},Au.delay=function(t){var n=this.id,e=this.namespace;return arguments.length<1?this.node()[e][n].delay:dt(this,"function"==typeof t?function(r,o,a){r[e][n].delay=+t.call(r,r.__data__,o,a)}:(t=+t,function(r){r[e][n].delay=t}))},Au.duration=function(t){var n=this.id,e=this.namespace;return arguments.length<1?this.node()[e][n].duration:dt(this,"function"==typeof t?function(r,o,a){r[e][n].duration=Math.max(1,t.call(r,r.__data__,o,a))}:(t=Math.max(1,t),function(r){r[e][n].duration=t}))},Au.each=function(t,n){var e=this.id,r=this.namespace;if(arguments.length<2){var o=Su,i=ku;try{ku=e,dt(this,(function(n,o,a){Su=n[r][e],t.call(n,n.__data__,o,a)}))}finally{Su=o,ku=i}}else dt(this,(function(o){var i=o[r][e];(i.event||(i.event=a.dispatch("start","end","interrupt"))).on(t,n)}));return this},Au.transition=function(){for(var t,n,e,r=this.id,o=++Eu,a=this.namespace,i=[],u=0,s=this.length;u<s;u++){i.push(t=[]);for(var l,c=0,f=(l=this[u]).length;c<f;c++)(n=l[c])&&Pu(n,c,a,o,{time:(e=n[a][r]).time,ease:e.ease,delay:e.delay+e.duration,duration:e.duration}),t.push(n)}return _u(i,a,o)},a.svg.axis=function(){var t,n=a.scale.linear(),e=Cu,r=6,o=6,i=3,s=[10],l=null;function c(u){u.each((function(){var u,c=a.select(this),f=this.__chart__||n,h=this.__chart__=n.copy(),p=null==l?h.ticks?h.ticks.apply(h,s):h.domain():l,d=null==t?h.tickFormat?h.tickFormat.apply(h,s):L:t,m=c.selectAll(".tick").data(p,h),g=m.enter().insert("g",".domain").attr("class","tick").style("opacity",Tt),v=a.transition(m.exit()).style("opacity",Tt).remove(),y=a.transition(m.order()).style("opacity",1),b=Math.max(r,0)+i,x=xi(h),M=c.selectAll(".domain").data([0]),w=(M.enter().append("path").attr("class","domain"),a.transition(M));g.append("line"),g.append("text");var _,k,S,A,E=g.select("line"),T=y.select("line"),R=m.select("text").text(d),N=g.select("text"),P=y.select("text"),C="top"===e||"left"===e?-1:1;if("bottom"===e||"top"===e?(u=Lu,_="x",S="y",k="x2",A="y2",R.attr("dy",C<0?"0em":".71em").style("text-anchor","middle"),w.attr("d","M"+x[0]+","+C*o+"V0H"+x[1]+"V"+C*o)):(u=Uu,_="y",S="x",k="y2",A="x2",R.attr("dy",".32em").style("text-anchor",C<0?"end":"start"),w.attr("d","M"+C*o+","+x[0]+"H0V"+x[1]+"H"+C*o)),E.attr(A,C*r),N.attr(S,C*b),T.attr(k,0).attr(A,C*r),P.attr(_,0).attr(S,C*b),h.rangeBand){var O=h,U=O.rangeBand()/2;f=h=function(t){return O(t)+U}}else f.rangeBand?f=h:v.call(u,h,f);g.call(u,f,h),y.call(u,h,h)}))}return c.scale=function(t){return arguments.length?(n=t,c):n},c.orient=function(t){return arguments.length?(e=t in Ou?t+"":Cu,c):e},c.ticks=function(){return arguments.length?(s=u(arguments),c):s},c.tickValues=function(t){return arguments.length?(l=t,c):l},c.tickFormat=function(n){return arguments.length?(t=n,c):t},c.tickSize=function(t){var n=arguments.length;return n?(r=+t,o=+arguments[n-1],c):r},c.innerTickSize=function(t){return arguments.length?(r=+t,c):r},c.outerTickSize=function(t){return arguments.length?(o=+t,c):o},c.tickPadding=function(t){return arguments.length?(i=+t,c):i},c.tickSubdivide=function(){return arguments.length&&c},c};var Cu="bottom",Ou={top:1,right:1,bottom:1,left:1};function Lu(t,n,e){t.attr("transform",(function(t){var r=n(t);return"translate("+(isFinite(r)?r:e(t))+",0)"}))}function Uu(t,n,e){t.attr("transform",(function(t){var r=n(t);return"translate(0,"+(isFinite(r)?r:e(t))+")"}))}a.svg.brush=function(){var t,n,e=X(h,"brushstart","brush","brushend"),r=null,o=null,i=[0,0],u=[0,0],s=!0,l=!0,f=zu[0];function h(t){t.each((function(){var t=a.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",g).on("touchstart.brush",g),n=t.selectAll(".background").data([0]);n.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),t.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var e=t.selectAll(".resize").data(f,L);e.exit().remove(),e.enter().append("g").attr("class",(function(t){return"resize "+t})).style("cursor",(function(t){return Du[t]})).append("rect").attr("x",(function(t){return/[ew]$/.test(t)?-3:null})).attr("y",(function(t){return/^[ns]/.test(t)?-3:null})).attr("width",6).attr("height",6).style("visibility","hidden"),e.style("display",h.empty()?"none":null);var i,u=a.transition(t),s=a.transition(n);r&&(i=xi(r),s.attr("x",i[0]).attr("width",i[1]-i[0]),d(u)),o&&(i=xi(o),s.attr("y",i[0]).attr("height",i[1]-i[0]),m(u)),p(u)}))}function p(t){t.selectAll(".resize").attr("transform",(function(t){return"translate("+i[+/e$/.test(t)]+","+u[+/^s/.test(t)]+")"}))}function d(t){t.select(".extent").attr("x",i[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",i[1]-i[0])}function m(t){t.select(".extent").attr("y",u[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",u[1]-u[0])}function g(){var f,g,v=this,y=a.select(a.event.target),b=e.of(v,arguments),x=a.select(v),M=y.datum(),w=!/^(n|s)$/.test(M)&&r,_=!/^(e|w)$/.test(M)&&o,k=y.classed("extent"),S=kt(v),A=a.mouse(v),E=a.select(c(v)).on("keydown.brush",N).on("keyup.brush",P);if(a.event.changedTouches?E.on("touchmove.brush",C).on("touchend.brush",L):E.on("mousemove.brush",C).on("mouseup.brush",L),x.interrupt().selectAll("*").interrupt(),k)A[0]=i[0]-A[0],A[1]=u[0]-A[1];else if(M){var T=+/w$/.test(M),R=+/^n/.test(M);g=[i[1-T]-A[0],u[1-R]-A[1]],A[0]=i[T],A[1]=u[R]}else a.event.altKey&&(f=A.slice());function N(){32==a.event.keyCode&&(k||(f=null,A[0]-=i[1],A[1]-=u[1],k=2),B())}function P(){32==a.event.keyCode&&2==k&&(A[0]+=i[1],A[1]+=u[1],k=0,B())}function C(){var t=a.mouse(v),n=!1;g&&(t[0]+=g[0],t[1]+=g[1]),k||(a.event.altKey?(f||(f=[(i[0]+i[1])/2,(u[0]+u[1])/2]),A[0]=i[+(t[0]<f[0])],A[1]=u[+(t[1]<f[1])]):f=null),w&&O(t,r,0)&&(d(x),n=!0),_&&O(t,o,1)&&(m(x),n=!0),n&&(p(x),b({type:"brush",mode:k?"move":"resize"}))}function O(e,r,o){var a,c,h=xi(r),p=h[0],d=h[1],m=A[o],g=o?u:i,v=g[1]-g[0];if(k&&(p-=m,d-=v+m),a=(o?l:s)?Math.max(p,Math.min(d,e[o])):e[o],k?c=(a+=m)+v:(f&&(m=Math.max(p,Math.min(d,2*f[o]-a))),m<a?(c=a,a=m):c=m),g[0]!=a||g[1]!=c)return o?n=null:t=null,g[0]=a,g[1]=c,!0}function L(){C(),x.style("pointer-events","all").selectAll(".resize").style("display",h.empty()?"none":null),a.select("body").style("cursor",null),E.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),S(),b({type:"brushend"})}x.style("pointer-events","none").selectAll(".resize").style("display",null),a.select("body").style("cursor",y.style("cursor")),b({type:"brushstart"}),C()}return h.event=function(r){r.each((function(){var r=e.of(this,arguments),o={x:i,y:u,i:t,j:n},s=this.__chart__||o;this.__chart__=o,ku?a.select(this).transition().each("start.brush",(function(){t=s.i,n=s.j,i=s.x,u=s.y,r({type:"brushstart"})})).tween("brush:brush",(function(){var e=aa(i,o.x),a=aa(u,o.y);return t=n=null,function(t){i=o.x=e(t),u=o.y=a(t),r({type:"brush",mode:"resize"})}})).each("end.brush",(function(){t=o.i,n=o.j,r({type:"brush",mode:"resize"}),r({type:"brushend"})})):(r({type:"brushstart"}),r({type:"brush",mode:"resize"}),r({type:"brushend"}))}))},h.x=function(t){return arguments.length?(f=zu[!(r=t)<<1|!o],h):r},h.y=function(t){return arguments.length?(f=zu[!r<<1|!(o=t)],h):o},h.clamp=function(t){return arguments.length?(r&&o?(s=!!t[0],l=!!t[1]):r?s=!!t:o&&(l=!!t),h):r&&o?[s,l]:r?s:o?l:null},h.extent=function(e){var a,s,l,c,f;return arguments.length?(r&&(a=e[0],s=e[1],o&&(a=a[0],s=s[0]),t=[a,s],r.invert&&(a=r(a),s=r(s)),s<a&&(f=a,a=s,s=f),a==i[0]&&s==i[1]||(i=[a,s])),o&&(l=e[0],c=e[1],r&&(l=l[1],c=c[1]),n=[l,c],o.invert&&(l=o(l),c=o(c)),c<l&&(f=l,l=c,c=f),l==u[0]&&c==u[1]||(u=[l,c])),h):(r&&(t?(a=t[0],s=t[1]):(a=i[0],s=i[1],r.invert&&(a=r.invert(a),s=r.invert(s)),s<a&&(f=a,a=s,s=f))),o&&(n?(l=n[0],c=n[1]):(l=u[0],c=u[1],o.invert&&(l=o.invert(l),c=o.invert(c)),c<l&&(f=l,l=c,c=f))),r&&o?[[a,l],[s,c]]:r?[a,s]:o&&[l,c])},h.clear=function(){return h.empty()||(i=[0,0],u=[0,0],t=n=null),h},h.empty=function(){return!!r&&i[0]==i[1]||!!o&&u[0]==u[1]},a.rebind(h,e,"on")};var Du={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},zu=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],qu=zn.format=he.timeFormat,ju=qu.utc,Fu=ju("%Y-%m-%dT%H:%M:%S.%LZ");function Bu(t){return t.toISOString()}function Iu(t,n,e){function r(n){return t(n)}function o(t,e){var r=(t[1]-t[0])/e,o=a.bisect(Yu,r);return o==Yu.length?[n.year,Ti(t.map((function(t){return t/31536e6})),e)[2]]:o?n[r/Yu[o-1]<Yu[o]/r?o-1:o]:[Gu,Ti(t,e)[2]]}return r.invert=function(n){return Xu(t.invert(n))},r.domain=function(n){return arguments.length?(t.domain(n),r):t.domain().map(Xu)},r.nice=function(t,n){var e=r.domain(),a=bi(e),i=null==t?o(a,10):"number"==typeof t&&o(a,t);function u(e){return!isNaN(e)&&!t.range(e,Xu(+e+1),n).length}return i&&(t=i[0],n=i[1]),r.domain(wi(e,n>1?{floor:function(n){for(;u(n=t.floor(n));)n=Xu(n-1);return n},ceil:function(n){for(;u(n=t.ceil(n));)n=Xu(+n+1);return n}}:t))},r.ticks=function(t,n){var e=bi(r.domain()),a=null==t?o(e,10):"number"==typeof t?o(e,t):!t.range&&[{range:t},n];return a&&(t=a[0],n=a[1]),t.range(e[0],Xu(+e[1]+1),n<1?1:n)},r.tickFormat=function(){return e},r.copy=function(){return Iu(t.copy(),n,e)},Ai(r,t)}function Xu(t){return new Date(t)}qu.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Bu:Fu,Bu.parse=function(t){var n=new Date(t);return isNaN(n)?null:n},Bu.toString=Fu.toString,zn.second=Bn((function(t){return new qn(1e3*Math.floor(t/1e3))}),(function(t,n){t.setTime(t.getTime()+1e3*Math.floor(n))}),(function(t){return t.getSeconds()})),zn.seconds=zn.second.range,zn.seconds.utc=zn.second.utc.range,zn.minute=Bn((function(t){return new qn(6e4*Math.floor(t/6e4))}),(function(t,n){t.setTime(t.getTime()+6e4*Math.floor(n))}),(function(t){return t.getMinutes()})),zn.minutes=zn.minute.range,zn.minutes.utc=zn.minute.utc.range,zn.hour=Bn((function(t){var n=t.getTimezoneOffset()/60;return new qn(36e5*(Math.floor(t/36e5-n)+n))}),(function(t,n){t.setTime(t.getTime()+36e5*Math.floor(n))}),(function(t){return t.getHours()})),zn.hours=zn.hour.range,zn.hours.utc=zn.hour.utc.range,zn.month=Bn((function(t){return(t=zn.day(t)).setDate(1),t}),(function(t,n){t.setMonth(t.getMonth()+n)}),(function(t){return t.getMonth()})),zn.months=zn.month.range,zn.months.utc=zn.month.utc.range;var Yu=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Vu=[[zn.second,1],[zn.second,5],[zn.second,15],[zn.second,30],[zn.minute,1],[zn.minute,5],[zn.minute,15],[zn.minute,30],[zn.hour,1],[zn.hour,3],[zn.hour,6],[zn.hour,12],[zn.day,1],[zn.day,2],[zn.week,1],[zn.month,1],[zn.month,3],[zn.year,1]],Hu=qu.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",$e]]),Gu={range:function(t,n,e){return a.range(Math.ceil(t/e)*e,+n,e).map(Xu)},floor:L,ceil:L};Vu.year=zn.year,zn.scale=function(){return Iu(a.scale.linear(),Vu,Hu)};var Wu=Vu.map((function(t){return[t[0].utc,t[1]]})),Zu=ju.multi([[".%L",function(t){return t.getUTCMilliseconds()}],[":%S",function(t){return t.getUTCSeconds()}],["%I:%M",function(t){return t.getUTCMinutes()}],["%I %p",function(t){return t.getUTCHours()}],["%a %d",function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],["%b %d",function(t){return 1!=t.getUTCDate()}],["%B",function(t){return t.getUTCMonth()}],["%Y",$e]]);function Ju(t){return JSON.parse(t.responseText)}function $u(t){var n=s.createRange();return n.selectNode(s.body),n.createContextualFragment(t.responseText)}Wu.year=zn.year.utc,zn.scale.utc=function(){return Iu(a.scale.linear(),Wu,Zu)},a.text=xn((function(t){return t.responseText})),a.json=function(t,n){return Mn(t,"application/json",Ju,n)},a.html=function(t,n){return Mn(t,"text/html",$u,n)},a.xml=xn((function(t){return t.responseXML})),this.d3=a,void 0===(o="function"==typeof(r=a)?r.call(n,e,n,t):r)||(t.exports=o)}()}])},t.exports=o()},function(t,n,e){"use strict";var r=e(26);function o(){}t.exports=function(){function t(t,n,e,o,a,i){if(i!==r){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function n(){return t}t.isRequired=t;var e={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:n,element:t,instanceOf:n,node:t,objectOf:n,oneOf:n,oneOfType:n,shape:n,exact:n};return e.checkPropTypes=o,e.PropTypes=e,e}},function(t,n,e){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,n,e){"use strict";var r=e(7),o=e(28),a=e(29),i=e(6),u=e(8),s=e(23),l=e(30);function c(t,n){return n=n.split("// __split__"),new o.Program(t,n[0],n[1])}t.exports=function(t,n,e){var f,h,p,d,m,g,v,y,b,x,M,w,_,k,S,A,E,T,R,N,P,C,O,L,U,D,z,q=this,j=null,F=null,B=null,I=null,X=null,Y=null,V=0,H=!1,G=!1;function W(t){p.viewport(0,0,e,e);var o=u.clone(t);o.zoom=1/f,o.translation.x=0,o.translation.y=0;for(var a=r.mat4.create(),i=0;i<3;i++){var s=r.vec3.random(r.vec3.create(),1);r.mat4.rotate(a,a,10*Math.random(),s)}o.rotation=r.mat4.multiply(r.mat4.create(),a,o.rotation),E.bind(),p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT);var l=u.getRect(o),c=r.mat4.create();r.mat4.ortho(c,l.left,l.right,l.bottom,l.top,0,f);var h=r.mat4.create();r.mat4.lookAt(h,[0,0,0],[0,0,-1],[0,1,0]);var d=r.mat4.create();r.mat4.translate(d,d,[0,0,-f/2]),r.mat4.multiply(d,d,o.rotation),P.setUniform("uProjection","Matrix4fv",!1,c),P.setUniform("uView","Matrix4fv",!1,h),P.setUniform("uModel","Matrix4fv",!1,d),P.setUniform("uBottomLeft","2fv",[l.left,l.bottom]),P.setUniform("uTopRight","2fv",[l.right,l.top]),P.setUniform("uAtomScale","1f",2.5*o.atomScale),P.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),P.setUniform("uRes","1f",e),P.setUniform("uDepth","1f",f),P.setUniform("uMode","1i",0),P.setUniform("uAtomShade","1f",t.atomShade),j.render(),t.bonds&&null!=F&&(C.setUniform("uProjection","Matrix4fv",!1,c),C.setUniform("uView","Matrix4fv",!1,h),C.setUniform("uModel","Matrix4fv",!1,d),C.setUniform("uRotation","Matrix4fv",!1,o.rotation),C.setUniform("uDepth","1f",f),C.setUniform("uBottomLeft","2fv",[l.left,l.bottom]),C.setUniform("uTopRight","2fv",[l.right,l.top]),C.setUniform("uRes","1f",e),C.setUniform("uBondRadius","1f",2.5*u.getBondRadius(t)),C.setUniform("uBondShade","1f",t.bondShade),C.setUniform("uAtomScale","1f",2.5*t.atomScale),C.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),C.setUniform("uMode","1i",0),F.render()),p.viewport(0,0,n,n);var y=u.getRect(t),x=u.getRect(o),M=r.mat4.invert(r.mat4.create(),a);T.bind(),p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT),O.setUniform("uSceneDepth","1i",g.index),O.setUniform("uSceneNormal","1i",m.index),O.setUniform("uRandRotDepth","1i",v.index),O.setUniform("uAccumulator","1i",b.index),O.setUniform("uSceneBottomLeft","2fv",[y.left,y.bottom]),O.setUniform("uSceneTopRight","2fv",[y.right,y.top]),O.setUniform("uRotBottomLeft","2fv",[x.left,x.bottom]),O.setUniform("uRotTopRight","2fv",[x.right,x.top]),O.setUniform("uRes","1f",n),O.setUniform("uDepth","1f",f),O.setUniform("uRot","Matrix4fv",!1,a),O.setUniform("uInvRot","Matrix4fv",!1,M),O.setUniform("uSampleCount","1i",V),B.render(),b.activate(),b.bind(),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGBA,0,0,n,n,0)}q.getAOProgress=function(){return V/1024},q.initialize=function(){t.width=t.height=n,(p=t.getContext("webgl")).enable(p.DEPTH_TEST),p.enable(p.CULL_FACE),p.clearColor(0,0,0,0),p.clearDepth(1),p.viewport(0,0,n,n),window.gl=p,o.getExtensions(p,["EXT_frag_depth","WEBGL_depth_texture"]),q.createTextures(),P=c(p,l.shaders.atom),C=c(p,l.shaders.bond),z=c(p,l.shaders["textured-quad"]),O=c(p,l.shaders.accumulator),L=c(p,l.shaders.ao),U=c(p,l.shaders.fxaa),D=c(p,l.shaders.dof);var e=[-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0],r=o.buildAttribs(p,{aPosition:3});r.aPosition.buffer.set(new Float32Array(e));var a=e.length/9;new o.Renderable(p,z,r,a),B=new o.Renderable(p,O,r,a),I=new o.Renderable(p,L,r,a),Y=new o.Renderable(p,U,r,a),X=new o.Renderable(p,D,r,a),0},q.createTextures=function(){y=new o.Texture(p,0,null,e,e),v=new o.Texture(p,1,null,e,e,{internalFormat:p.DEPTH_COMPONENT,format:p.DEPTH_COMPONENT,type:p.UNSIGNED_SHORT}),E=new o.Framebuffer(p,[y],v),d=new o.Texture(p,2,null,n,n),m=new o.Texture(p,3,null,n,n),g=new o.Texture(p,4,null,n,n,{internalFormat:p.DEPTH_COMPONENT,format:p.DEPTH_COMPONENT,type:p.UNSIGNED_SHORT}),S=new o.Framebuffer(p,[d],g),A=new o.Framebuffer(p,[m],g),b=new o.Texture(p,5,null,n,n),x=new o.Texture(p,6,null,n,n),T=new o.Framebuffer(p,[x]),k=new o.Texture(p,7,null,n,n),N=new o.Framebuffer(p,[k]),M=new o.Texture(p,8,null,n,n),w=new o.Texture(p,9,null,n,n),R=new o.Framebuffer(p,[w]),_=new o.Texture(p,10,null,n,n),new o.Framebuffer(p,[_])},q.setResolution=function(r,o){e=o,n=r,t.width=t.height=n,p.viewport(0,0,n,n),q.createTextures()},q.setSystem=function(t,n){function e(t){for(var n=[],e=0;e<36;e++)n.push.apply(n,t);return n}h=t;for(var r=o.buildAttribs(p,{aImposter:3,aPosition:3,aRadius:1,aColor:3}),u=[],s=[],l=[],c=[],f=0;f<h.atoms.length;f++){u.push.apply(u,a.position);var d=h.atoms[f];s.push.apply(s,e([d.x,d.y,d.z])),l.push.apply(l,e([i[d.symbol].radius]));var m=i[d.symbol].color;c.push.apply(c,e([m[0],m[1],m[2]]))}r.aImposter.buffer.set(new Float32Array(u)),r.aPosition.buffer.set(new Float32Array(s)),r.aRadius.buffer.set(new Float32Array(l)),r.aColor.buffer.set(new Float32Array(c));var g=u.length/9;if(j=new o.Renderable(p,P,r,g),n.bonds&&(F=null,h.bonds.length>0)){r=o.buildAttribs(p,{aImposter:3,aPosA:3,aPosB:3,aRadA:1,aRadB:1,aColA:3,aColB:3}),u=[];var v=[],y=[],b=[],x=[],M=[],w=[];for(f=0;f<h.bonds.length;f++){var _=h.bonds[f];if(_.cutoff>n.bondThreshold)break;u.push.apply(u,a.position),v.push.apply(v,e([_.posA.x,_.posA.y,_.posA.z])),y.push.apply(y,e([_.posB.x,_.posB.y,_.posB.z])),b.push.apply(b,e([_.radA])),x.push.apply(x,e([_.radB])),M.push.apply(M,e([_.colA.r,_.colA.g,_.colA.b])),w.push.apply(w,e([_.colB.r,_.colB.g,_.colB.b]))}r.aImposter.buffer.set(new Float32Array(u)),r.aPosA.buffer.set(new Float32Array(v)),r.aPosB.buffer.set(new Float32Array(y)),r.aRadA.buffer.set(new Float32Array(b)),r.aRadB.buffer.set(new Float32Array(x)),r.aColA.buffer.set(new Float32Array(M)),r.aColB.buffer.set(new Float32Array(w));g=u.length/9;F=new o.Renderable(p,C,r,g)}},q.reset=function(){V=0,H=!1,G=!1,b.reset(),x.reset()},q.render=function(t){if(void 0!==h&&null!=j){if(f=2*s.getRadius(h),H)if(G)for(var e=0;e<t.spf&&!(V>1024);e++)W(t),V++;else!function(t){G=!0,p.viewport(0,0,n,n),A.bind(),p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT);var e=u.getRect(t),o=r.mat4.create();r.mat4.ortho(o,e.left,e.right,e.bottom,e.top,0,f);var a=r.mat4.create();r.mat4.lookAt(a,[0,0,0],[0,0,-1],[0,1,0]);var i=r.mat4.create();r.mat4.translate(i,i,[0,0,-f/2]),r.mat4.multiply(i,i,t.rotation),P.setUniform("uProjection","Matrix4fv",!1,o),P.setUniform("uView","Matrix4fv",!1,a),P.setUniform("uModel","Matrix4fv",!1,i),P.setUniform("uBottomLeft","2fv",[e.left,e.bottom]),P.setUniform("uTopRight","2fv",[e.right,e.top]),P.setUniform("uAtomScale","1f",2.5*t.atomScale),P.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),P.setUniform("uRes","1f",n),P.setUniform("uDepth","1f",f),P.setUniform("uMode","1i",1),P.setUniform("uAtomShade","1f",t.atomShade),j.render(),t.bonds&&null!=F&&(A.bind(),C.setUniform("uProjection","Matrix4fv",!1,o),C.setUniform("uView","Matrix4fv",!1,a),C.setUniform("uModel","Matrix4fv",!1,i),C.setUniform("uRotation","Matrix4fv",!1,t.rotation),C.setUniform("uDepth","1f",f),C.setUniform("uBottomLeft","2fv",[e.left,e.bottom]),C.setUniform("uTopRight","2fv",[e.right,e.top]),C.setUniform("uRes","1f",n),C.setUniform("uBondRadius","1f",2.5*u.getBondRadius(t)),C.setUniform("uBondShade","1f",t.bondShade),C.setUniform("uAtomScale","1f",2.5*t.atomScale),C.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),C.setUniform("uMode","1i",1),F.render())}(t);else!function(t){H=!0,p.viewport(0,0,n,n),S.bind(),p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT);var e=u.getRect(t),o=r.mat4.create();r.mat4.ortho(o,e.left,e.right,e.bottom,e.top,0,f);var a=r.mat4.create();r.mat4.lookAt(a,[0,0,0],[0,0,-1],[0,1,0]);var i=r.mat4.create();r.mat4.translate(i,i,[0,0,-f/2]),r.mat4.multiply(i,i,t.rotation),P.setUniform("uProjection","Matrix4fv",!1,o),P.setUniform("uView","Matrix4fv",!1,a),P.setUniform("uModel","Matrix4fv",!1,i),P.setUniform("uBottomLeft","2fv",[e.left,e.bottom]),P.setUniform("uTopRight","2fv",[e.right,e.top]),P.setUniform("uAtomScale","1f",2.5*t.atomScale),P.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),P.setUniform("uRes","1f",n),P.setUniform("uDepth","1f",f),P.setUniform("uMode","1i",0),P.setUniform("uAtomShade","1f",t.atomShade),j.render(),t.bonds&&null!=F&&(S.bind(),C.setUniform("uProjection","Matrix4fv",!1,o),C.setUniform("uView","Matrix4fv",!1,a),C.setUniform("uModel","Matrix4fv",!1,i),C.setUniform("uRotation","Matrix4fv",!1,t.rotation),C.setUniform("uDepth","1f",f),C.setUniform("uBottomLeft","2fv",[e.left,e.bottom]),C.setUniform("uTopRight","2fv",[e.right,e.top]),C.setUniform("uRes","1f",n),C.setUniform("uBondRadius","1f",2.5*u.getBondRadius(t)),C.setUniform("uBondShade","1f",t.bondShade),C.setUniform("uAtomScale","1f",2.5*t.atomScale),C.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),C.setUniform("uMode","1i",0),F.render())}(t);!function(t){p.viewport(0,0,n,n),t.fxaa>0||t.dofStrength>0?N.bind():p.bindFramebuffer(p.FRAMEBUFFER,null);if(p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT),L.setUniform("uSceneColor","1i",d.index),L.setUniform("uSceneDepth","1i",g.index),L.setUniform("uAccumulatorOut","1i",x.index),L.setUniform("uRes","1f",n),L.setUniform("uAO","1f",2*t.ao),L.setUniform("uBrightness","1f",2*t.brightness),L.setUniform("uOutlineStrength","1f",t.outline),I.render(),t.fxaa>0){t.dofStrength>0?R.bind():p.bindFramebuffer(p.FRAMEBUFFER,null);for(var e=0;e<t.fxaa;e++)p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT),0==e?U.setUniform("uTexture","1i",k.index):U.setUniform("uTexture","1i",M.index),U.setUniform("uRes","1f",n),Y.render(),M.activate(),M.bind(),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGBA,0,0,n,n,0)}t.dofStrength>0&&(p.bindFramebuffer(p.FRAMEBUFFER,null),p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT),t.fxaa>0?D.setUniform("uColor","1i",M.index):D.setUniform("uColor","1i",k.index),D.setUniform("uDepth","1i",g.index),D.setUniform("uDOFPosition","1f",t.dofPosition),D.setUniform("uDOFStrength","1f",t.dofStrength),D.setUniform("uRes","1f",n),X.render())}(t)}},q.initialize()}},function(t,n){function e(t){var n=this;n.initialize=function(){n.buffer=t.createBuffer()},n.bind=function(){t.bindBuffer(t.ARRAY_BUFFER,n.buffer)},n.set=function(e){n.bind(),t.bufferData(t.ARRAY_BUFFER,e,t.STATIC_DRAW)},n.initialize()}t.exports.buildAttribs=function(t,n){var r={};for(var o in n)r[o]={buffer:new e(t),size:n[o]};return r},t.exports.getExtensions=function(t,n){for(var e={},r=0;r<n.length;r++){var o=t.getExtension(n[r]);if(null===o)throw"Extension "+n[r]+" not available.";e[n[r]]=o}return e},t.exports.Framebuffer=function(t,n,e,r){var o=this;o.initialize=function(){if(o.fb=t.createFramebuffer(),o.bind(),n.length>1){for(var a=[],i=0;i<n.length;i++)a.push(r["COLOR_ATTACHMENT"+i+"_WEBGL"]);r.drawBuffersWEBGL(a);for(i=0;i<n.length;i++)t.framebufferTexture2D(t.FRAMEBUFFER,r["COLOR_ATTACHMENT"+i+"_WEBGL"],t.TEXTURE_2D,n[i].texture,0)}else t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n[0].texture,0);void 0!==e&&t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,e.texture,0)},o.bind=function(){t.bindFramebuffer(t.FRAMEBUFFER,o.fb)},o.initialize()},t.exports.Texture=function(t,n,e,r,o,a){(a=a||{}).target=a.target||t.TEXTURE_2D,a.mag=a.mag||t.NEAREST,a.min=a.min||t.NEAREST,a.wraps=a.wraps||t.CLAMP_TO_EDGE,a.wrapt=a.wrapt||t.CLAMP_TO_EDGE,a.internalFormat=a.internalFormat||t.RGBA,a.format=a.format||t.RGBA,a.type=a.type||t.UNSIGNED_BYTE;var i=this;i.initialize=function(){i.index=n,i.activate(),i.texture=t.createTexture(),i.bind(),t.texParameteri(a.target,t.TEXTURE_MAG_FILTER,a.mag),t.texParameteri(a.target,t.TEXTURE_MIN_FILTER,a.min),t.texParameteri(a.target,t.TEXTURE_WRAP_S,a.wraps),t.texParameteri(a.target,t.TEXTURE_WRAP_T,a.wrapt),t.texImage2D(a.target,0,a.internalFormat,r,o,0,a.format,a.type,e)},i.bind=function(){t.bindTexture(a.target,i.texture)},i.activate=function(){t.activeTexture(t.TEXTURE0+i.index)},i.reset=function(){i.activate(),i.bind(),t.texImage2D(a.target,0,a.internalFormat,r,o,0,a.format,a.type,e)},i.initialize()},t.exports.GLBuffer=e,t.exports.Renderable=function(t,n,e,r){var o=this;o.primitiveCount=r,o.initialize=function(){},o.render=function(){for(name in n.use(),e){var a=e[name].buffer,i=e[name].size;try{var u=n.attribs[name].location}catch(t){throw console.log("Could not find location for",name),t}a.bind(),t.enableVertexAttribArray(u),t.vertexAttribPointer(u,i,t.FLOAT,!1,0,0)}for(name in t.drawArrays(t.TRIANGLES,0,3*r),o.buffers)t.disableVertexAttribArray(n.attributes[name].location)},o.initialize()},t.exports.InstancedRenderable=function(t,n,e,r,o){var a=this;a.initialize=function(){},a.render=function(){for(name in n.use(),e){var i=e[name].buffer,u=e[name].size;try{var s=n.attribs[name].location}catch(t){throw console.log("Could not find location for",name),t}i.bind(),t.enableVertexAttribArray(s),t.vertexAttribPointer(s,u,t.FLOAT,!1,0,0),o.vertexAttribDivisorANGLE(s,e[name].divisor)}for(name in o.drawArraysInstancedANGLE(t.TRIANGLES,0,36,r),a.buffers)t.disableVertexAttribArray(n.attributes[name].location)},a.initialize()},t.exports.Program=function(t,n,e){var r=this;r.initialize=function(){r.program=r.compileProgram(n,e),r.attribs=r.gatherAttribs(),r.uniforms=r.gatherUniforms()},r.use=function(){t.useProgram(r.program)},r.compileProgram=function(n,e){var o=r.compileShader(n,t.VERTEX_SHADER),a=r.compileShader(e,t.FRAGMENT_SHADER),i=t.createProgram();if(t.attachShader(i,o),t.attachShader(i,a),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS))throw console.log(t.getProgramInfoLog(i)),"Failed to compile program.";return i},r.compileShader=function(n,e){var r=t.createShader(e);if(t.shaderSource(r,n),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(r),a=parseInt(o.split(":")[2]),i=n.split("\n");for(var u in i){var s=parseInt(u);console.log(s+"  "+i[u]),u==a-1&&console.warn(o)}throw typeString=e==t.VERTEX_SHADER?"vertex":"fragment","Failed to compile "+typeString+" shader."}return r},r.setUniform=function(n,e,o){var a=Array.prototype.slice.call(arguments,2);r.use();try{var i=r.uniforms[n].location}catch(t){throw console.log(n),t}t["uniform"+e].apply(t,[i].concat(a))},r.gatherUniforms=function(){for(var n={},e=t.getProgramParameter(r.program,t.ACTIVE_UNIFORMS),o=0;o<e;o++){var a=t.getActiveUniform(r.program,o);n[a.name]={name:a.name,location:t.getUniformLocation(r.program,a.name),type:a.type,size:a.size}}return n},r.gatherAttribs=function(){for(var n={},e=t.getProgramParameter(r.program,t.ACTIVE_ATTRIBUTES),o=0;o<e;o++){var a=t.getActiveAttrib(r.program,o);n[a.name]={name:a.name,location:t.getAttribLocation(r.program,a.name),type:a.type,size:a.size}}return n},r.initialize()}},function(t,n){var e=-1;t.exports={position:[e,e,e,e,e,1,e,1,1,e,e,e,e,1,1,e,1,e,1,e,1,1,e,e,1,1,e,1,e,1,1,1,e,1,1,1,e,e,e,1,e,e,1,e,1,e,e,e,1,e,1,e,e,1,e,1,1,1,1,1,1,1,e,e,1,1,1,1,e,e,1,e,1,e,e,e,e,e,e,1,e,1,e,e,e,1,e,1,1,e,e,e,1,1,e,1,1,1,1,e,e,1,1,1,1,e,1,1],normal:[e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1]}},function(t,n,e){"use strict";var r={accumulator:"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uSceneDepth;\nuniform sampler2D uSceneNormal;\nuniform sampler2D uRandRotDepth;\nuniform sampler2D uAccumulator;\nuniform mat4 uRot;\nuniform mat4 uInvRot;\nuniform vec2 uSceneBottomLeft;\nuniform vec2 uSceneTopRight;\nuniform vec2 uRotBottomLeft;\nuniform vec2 uRotTopRight;\nuniform float uDepth;\nuniform float uRes;\nuniform int uSampleCount;\n\nvoid main() {\n\n    float dScene = texture2D(uSceneDepth, gl_FragCoord.xy/uRes).r;\n\n    vec3 r = vec3(uSceneBottomLeft + (gl_FragCoord.xy/uRes) * (uSceneTopRight - uSceneBottomLeft), 0.0);\n\n    r.z = -(dScene - 0.5) * uDepth;\n    r = vec3(uRot * vec4(r, 1));\n    float depth = -r.z/uDepth + 0.5;\n\n    vec2 p = (r.xy - uRotBottomLeft)/(uRotTopRight - uRotBottomLeft);\n\n    float dRandRot = texture2D(uRandRotDepth, p).r;\n\n    float ao = step(dRandRot, depth * 0.99);\n\n    vec3 normal = texture2D(uSceneNormal, gl_FragCoord.xy/uRes).rgb * 2.0 - 1.0;\n    vec3 dir = vec3(uInvRot * vec4(0, 0, 1, 0));\n    float mag = dot(dir, normal);\n    float sampled = step(0.0, mag);\n\n    ao *= sampled;\n\n    vec4 acc = texture2D(uAccumulator, gl_FragCoord.xy/uRes);\n\n    if (uSampleCount < 256) {\n        acc.r += ao/255.0;\n    } else if (uSampleCount < 512) {\n        acc.g += ao/255.0;\n    } else if (uSampleCount < 768) {\n        acc.b += ao/255.0;\n    } else {\n        acc.a += ao/255.0;\n    }\n        \n    gl_FragColor = acc;\n\n}\n",ao:"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uSceneColor;\nuniform sampler2D uSceneDepth;\nuniform sampler2D uAccumulatorOut;\nuniform float uRes;\nuniform float uAO;\nuniform float uBrightness;\nuniform float uOutlineStrength;\n\nvoid main() {\n    vec2 p = gl_FragCoord.xy/uRes;\n    vec4 sceneColor = texture2D(uSceneColor, p);\n    if (uOutlineStrength > 0.0) {\n        float depth = texture2D(uSceneDepth, p).r;\n        float r = 1.0/511.0;\n        float d0 = abs(texture2D(uSceneDepth, p + vec2(-r,  0)).r - depth);\n        float d1 = abs(texture2D(uSceneDepth, p + vec2( r,  0)).r - depth);\n        float d2 = abs(texture2D(uSceneDepth, p + vec2( 0, -r)).r - depth);\n        float d3 = abs(texture2D(uSceneDepth, p + vec2( 0,  r)).r - depth);\n        float d = max(d0, d1);\n        d = max(d, d2);\n        d = max(d, d3);\n        sceneColor.rgb *= pow(1.0 - d, uOutlineStrength * 32.0);\n        sceneColor.a = max(step(0.003, d), sceneColor.a);\n    }\n    vec4 dAccum = texture2D(uAccumulatorOut, p);\n    float shade = max(0.0, 1.0 - (dAccum.r + dAccum.g + dAccum.b + dAccum.a) * 0.25 * uAO);\n    shade = pow(shade, 2.0);\n    gl_FragColor = vec4(uBrightness * sceneColor.rgb * shade, sceneColor.a);\n}\n",atom:"#version 100\nprecision highp float;\n\nattribute vec3 aImposter;\nattribute vec3 aPosition;\nattribute float aRadius;\nattribute vec3 aColor;\n\nuniform mat4 uView;\nuniform mat4 uProjection;\nuniform mat4 uModel;\nuniform float uAtomScale;\nuniform float uRelativeAtomScale;\nuniform float uAtomShade;\n\nvarying vec3 vColor;\nvarying vec3 vPosition;\nvarying float vRadius;\n\nvoid main() {\n    vRadius = uAtomScale * (1.0 + (aRadius - 1.0) * uRelativeAtomScale);\n    gl_Position = uProjection * uView * uModel * vec4(vRadius * aImposter + aPosition, 1.0);\n    vColor = mix(aColor, vec3(1,1,1), uAtomShade);\n    vPosition = vec3(uModel * vec4(aPosition, 1));\n}\n\n\n// __split__\n\n\n#version 100\n#extension GL_EXT_frag_depth: enable\nprecision highp float;\n\nuniform vec2 uBottomLeft;\nuniform vec2 uTopRight;\nuniform float uRes;\nuniform float uDepth;\nuniform int uMode;\n\nvarying vec3 vPosition;\nvarying float vRadius;\nvarying vec3 vColor;\n\nvec2 res = vec2(uRes, uRes);\n\nfloat raySphereIntersect(vec3 r0, vec3 rd) {\n    float a = dot(rd, rd);\n    vec3 s0_r0 = r0 - vPosition;\n    float b = 2.0 * dot(rd, s0_r0);\n    float c = dot(s0_r0, s0_r0) - (vRadius * vRadius);\n    float disc = b*b - 4.0*a*c;\n    if (disc <= 0.0) {\n        return -1.0;\n    }\n    return (-b - sqrt(disc))/(2.0*a);\n}\n\nvoid main() {\n    vec3 r0 = vec3(uBottomLeft + (gl_FragCoord.xy/res) * (uTopRight - uBottomLeft), 0.0);\n    vec3 rd = vec3(0, 0, -1);\n    float t = raySphereIntersect(r0, rd);\n    if (t < 0.0) {\n        discard;\n    }\n    vec3 coord = r0 + rd * t;\n    vec3 normal = normalize(coord - vPosition);\n    if (uMode == 0) {\n        gl_FragColor = vec4(vColor, 1);\n    } else if (uMode == 1) {\n        gl_FragColor = vec4(normal * 0.5 + 0.5, 1.0);\n    }\n    gl_FragDepthEXT = -coord.z/uDepth;\n}\n",blur:"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uTexture;\nuniform float uRes;\nuniform int leftRight;\n\nvoid main() {\n    vec2 dir;\n    if (leftRight == 1) {\n        dir = vec2(1,0)/uRes;\n    } else {\n        dir = vec2(0,1)/uRes;\n    }\n    const int range = 16;\n    vec4 sample = vec4(0,0,0,0);\n    for (int i = -range; i <= range; i++) {\n        vec2 p = gl_FragCoord.xy/uRes + dir * float(i);\n        sample += texture2D(uTexture, p);\n    }\n    sample /= float(range) * 2.0 + 1.0;\n    gl_FragColor = sample;\n}\n",bond:"#version 100\nprecision highp float;\n\nattribute vec3 aImposter;\nattribute vec3 aPosA;\nattribute vec3 aPosB;\nattribute float aRadA;\nattribute float aRadB;\nattribute vec3 aColA;\nattribute vec3 aColB;\n\nuniform mat4 uView;\nuniform mat4 uProjection;\nuniform mat4 uModel;\nuniform mat4 uRotation;\nuniform float uBondRadius;\nuniform float uAtomScale;\nuniform float uRelativeAtomScale;\n\nvarying vec3 vNormal;\nvarying vec3 vPosA, vPosB;\nvarying float vRadA, vRadB;\nvarying vec3 vColA, vColB;\nvarying float vRadius;\n\nmat3 alignVector(vec3 a, vec3 b) {\n    vec3 v = cross(a, b);\n    float s = length(v);\n    float c = dot(a, b);\n    mat3 I = mat3(\n        1, 0, 0,\n        0, 1, 0,\n        0, 0, 1\n    );\n    mat3 vx = mat3(\n        0, v.z, -v.y,\n        -v.z, 0, v.x,\n        v.y, -v.x, 0\n    );\n    return I + vx + vx * vx * ((1.0 - c) / (s * s));\n}\n\nvoid main() {\n    vRadius = uBondRadius;\n    vec3 pos = vec3(aImposter);\n    // Scale the box in x and z to be bond-radius.\n    pos = pos * vec3(vRadius, 1, vRadius);\n    // Shift the origin-centered cube so that the bottom is at the origin.\n    pos = pos + vec3(0, 1, 0);\n    // Stretch the box in y so that it is the length of the bond.\n    pos = pos * vec3(1, length(aPosA - aPosB) * 0.5, 1);\n    // Find the rotation that aligns vec3(0, 1, 0) with vec3(uPosB - uPosA) and apply it.\n    vec3 a = normalize(vec3(-0.000001, 1.000001, 0.000001));\n    vec3 b = normalize(aPosB - aPosA);\n    mat3 R = alignVector(a, b);\n    pos = R * pos;\n    // Shift the cube so that the bottom is centered at the middle of atom A.\n    pos = pos + aPosA;\n\n    vec4 position = uModel * vec4(pos, 1);\n    gl_Position = uProjection * uView * position;\n    vPosA = aPosA;\n    vPosB = aPosB;\n    vRadA = uAtomScale * (1.0 + (aRadA - 1.0) * uRelativeAtomScale);\n    vRadB = uAtomScale * (1.0 + (aRadB - 1.0) * uRelativeAtomScale);\n    vColA = aColA;\n    vColB = aColB;\n}\n\n\n// __split__\n\n\n#version 100\n#extension GL_EXT_frag_depth: enable\nprecision highp float;\n\nuniform mat4 uRotation;\nuniform vec2 uBottomLeft;\nuniform vec2 uTopRight;\nuniform float uDepth;\nuniform float uRes;\nuniform float uBondShade;\nuniform int uMode;\n\nvarying vec3 vPosA, vPosB;\nvarying float vRadA, vRadB;\nvarying vec3 vColA, vColB;\nvarying float vRadius;\n\nmat3 alignVector(vec3 a, vec3 b) {\n    vec3 v = cross(a, b);\n    float s = length(v);\n    float c = dot(a, b);\n    mat3 I = mat3(\n        1, 0, 0,\n        0, 1, 0,\n        0, 0, 1\n    );\n    mat3 vx = mat3(\n        0, v.z, -v.y,\n        -v.z, 0, v.x,\n        v.y, -v.x, 0\n    );\n    return I + vx + vx * vx * ((1.0 - c) / (s * s));\n}\n\nvoid main() {\n\n    vec2 res = vec2(uRes, uRes);\n    vec3 r0 = vec3(uBottomLeft + (gl_FragCoord.xy/res) * (uTopRight - uBottomLeft), uDepth/2.0);\n    vec3 rd = vec3(0, 0, -1);\n\n    vec3 i = normalize(vPosB - vPosA);\n         i = vec3(uRotation * vec4(i, 0));\n    vec3 j = normalize(vec3(-0.000001, 1.000001, 0.000001));\n    mat3 R = alignVector(i, j);\n\n    vec3 r0p = r0 - vec3(uRotation * vec4(vPosA, 0));\n    r0p = R * r0p;\n    vec3 rdp = R * rd;\n\n    float a = dot(rdp.xz, rdp.xz);\n    float b = 2.0 * dot(rdp.xz, r0p.xz);\n    float c = dot(r0p.xz, r0p.xz) - vRadius*vRadius;\n    float disc = b*b - 4.0*a*c;\n    if (disc <= 0.0) {\n        discard;\n    }\n    float t = (-b - sqrt(disc))/(2.0*a);\n    if (t < 0.0) {\n        discard;\n    }\n\n    vec3 coord = r0p + rdp * t;\n    if (coord.y < 0.0 || coord.y > length(vPosA - vPosB)) {\n        discard;\n    }\n\n    vec3 color;\n    if (coord.y < vRadA + 0.5 * (length(vPosA - vPosB) - (vRadA + vRadB))) {\n        color = vColA;\n    } else {\n        color = vColB;\n    }\n\n    color = mix(color, vec3(1,1,1), uBondShade);\n\n    R = alignVector(j, i);\n    vec3 normal = normalize(R * vec3(coord.x, 0, coord.z));\n\n    coord = r0 + rd * t;\n    if (uMode == 0) {\n        gl_FragColor = vec4(color, 1);\n    } else if (uMode == 1) {\n        gl_FragColor = vec4(normal * 0.5 + 0.5, 1.0);\n    }\n    gl_FragDepthEXT = -(coord.z - uDepth/2.0)/uDepth;\n}\n",dof:"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uColor;\nuniform sampler2D uDepth;\nuniform float uRes;\nuniform float uDOFPosition;\nuniform float uDOFStrength;\nuniform int leftRight;\n\nvoid main() {\n\n    vec2 samples[64];\n    samples[0] = vec2(0.857612, 0.019885);\n    samples[1] = vec2(0.563809, -0.028071);\n    samples[2] = vec2(0.825599, -0.346856);\n    samples[3] = vec2(0.126584, -0.380959);\n    samples[4] = vec2(0.782948, 0.594322);\n    samples[5] = vec2(0.292148, -0.543265);\n    samples[6] = vec2(0.130700, 0.330220);\n    samples[7] = vec2(0.236088, 0.159604);\n    samples[8] = vec2(-0.305259, 0.810505);\n    samples[9] = vec2(0.269616, 0.923026);\n    samples[10] = vec2(0.484486, 0.371845);\n    samples[11] = vec2(-0.638057, 0.080447);\n    samples[12] = vec2(0.199629, 0.667280);\n    samples[13] = vec2(-0.861043, -0.370583);\n    samples[14] = vec2(-0.040652, -0.996174);\n    samples[15] = vec2(0.330458, -0.282111);\n    samples[16] = vec2(0.647795, -0.214354);\n    samples[17] = vec2(0.030422, -0.189908);\n    samples[18] = vec2(0.177430, -0.721124);\n    samples[19] = vec2(-0.461163, -0.327434);\n    samples[20] = vec2(-0.410012, -0.734504);\n    samples[21] = vec2(-0.616334, -0.626069);\n    samples[22] = vec2(0.590759, -0.726479);\n    samples[23] = vec2(-0.590794, 0.805365);\n    samples[24] = vec2(-0.924561, -0.163739);\n    samples[25] = vec2(-0.323028, 0.526960);\n    samples[26] = vec2(0.642128, 0.752577);\n    samples[27] = vec2(0.173625, -0.952386);\n    samples[28] = vec2(0.759014, 0.330311);\n    samples[29] = vec2(-0.360526, -0.032013);\n    samples[30] = vec2(-0.035320, 0.968156);\n    samples[31] = vec2(0.585478, -0.431068);\n    samples[32] = vec2(-0.244766, -0.906947);\n    samples[33] = vec2(-0.853096, 0.184615);\n    samples[34] = vec2(-0.089061, 0.104648);\n    samples[35] = vec2(-0.437613, 0.285308);\n    samples[36] = vec2(-0.654098, 0.379841);\n    samples[37] = vec2(-0.128663, 0.456572);\n    samples[38] = vec2(0.015980, -0.568170);\n    samples[39] = vec2(-0.043966, -0.771940);\n    samples[40] = vec2(0.346512, -0.071238);\n    samples[41] = vec2(-0.207921, -0.209121);\n    samples[42] = vec2(-0.624075, -0.189224);\n    samples[43] = vec2(-0.120618, 0.689339);\n    samples[44] = vec2(-0.664679, -0.410200);\n    samples[45] = vec2(0.371945, -0.880573);\n    samples[46] = vec2(-0.743251, 0.629998);\n    samples[47] = vec2(-0.191926, -0.413946);\n    samples[48] = vec2(0.449574, 0.833373);\n    samples[49] = vec2(0.299587, 0.449113);\n    samples[50] = vec2(-0.900432, 0.399319);\n    samples[51] = vec2(0.762613, -0.544796);\n    samples[52] = vec2(0.606462, 0.174233);\n    samples[53] = vec2(0.962185, -0.167019);\n    samples[54] = vec2(0.960990, 0.249552);\n    samples[55] = vec2(0.570397, 0.559146);\n    samples[56] = vec2(-0.537514, 0.555019);\n    samples[57] = vec2(0.108491, -0.003232);\n    samples[58] = vec2(-0.237693, -0.615428);\n    samples[59] = vec2(-0.217313, 0.261084);\n    samples[60] = vec2(-0.998966, 0.025692);\n    samples[61] = vec2(-0.418554, -0.527508);\n    samples[62] = vec2(-0.822629, -0.567797);\n    samples[63] = vec2(0.061945, 0.522105);\n\n    float invRes = 1.0/uRes;\n    vec2 coord = gl_FragCoord.xy * invRes;\n\n    float strength = uDOFStrength * uRes/768.0;\n\n    float depth = texture2D(uDepth, coord).r;\n    float range = uDOFPosition - depth;\n    float scale = abs(range);\n\n    vec4 sample = texture2D(uColor, coord);\n    float count = 1.0;\n    for(int i = 0; i < 64; i++) {\n        vec2 p = samples[i];\n        p = coord + scale * 64.0 * strength * p * invRes;\n        float d = texture2D(uDepth, p).r;\n        float r = uDOFPosition - d;\n        float s = abs(r);\n        sample += texture2D(uColor, p) * s;\n        count += s;\n    }\n\n    gl_FragColor = sample/count;\n}",fxaa:"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uTexture;\nuniform float uRes;\n\nvoid main() {\n    float FXAA_SPAN_MAX = 8.0;\n    float FXAA_REDUCE_MUL = 1.0/8.0;\n    float FXAA_REDUCE_MIN = 1.0/128.0;\n\n    vec2 texCoords = gl_FragCoord.xy/uRes;\n\n    vec4 rgbNW = texture2D(uTexture, texCoords + (vec2(-1.0, -1.0) / uRes));\n    vec4 rgbNE = texture2D(uTexture, texCoords + (vec2(1.0, -1.0) / uRes));\n    vec4 rgbSW = texture2D(uTexture, texCoords + (vec2(-1.0, 1.0) / uRes));\n    vec4 rgbSE = texture2D(uTexture, texCoords + (vec2(1.0, 1.0) / uRes));\n    vec4 rgbM  = texture2D(uTexture, texCoords);\n\n    vec4 luma = vec4(0.299, 0.587, 0.114, 1.0);\n    float lumaNW = dot(rgbNW, luma);\n    float lumaNE = dot(rgbNE, luma);\n    float lumaSW = dot(rgbSW, luma);\n    float lumaSE = dot(rgbSE, luma);\n    float lumaM  = dot(rgbM,  luma);\n\n    float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n    float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n    vec2 dir;\n    dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n    dir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n    float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n    float rcpDirMin = 1.0/(min(abs(dir.x), abs(dir.y)) + dirReduce);\n\n    dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) / uRes;\n\n    vec4 rgbA = (1.0/2.0) * \n        (texture2D(uTexture, texCoords.xy + dir * (1.0/3.0 - 0.5)) + \n         texture2D(uTexture, texCoords.xy + dir * (2.0/3.0 - 0.5)));\n    vec4 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * \n        (texture2D(uTexture, texCoords.xy + dir * (0.0/3.0 - 0.5)) +\n         texture2D(uTexture, texCoords.xy + dir * (3.0/3.0 - 0.5)));\n    float lumaB = dot(rgbB, luma);\n\n    if((lumaB < lumaMin) || (lumaB > lumaMax)){\n        gl_FragColor = rgbA;\n    } else {\n        gl_FragColor = rgbB;\n    }\n\n}","textured-quad":"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uTexture;\nuniform float uRes;\n\nvoid main() {\n    gl_FragColor = texture2D(uTexture, gl_FragCoord.xy/uRes);\n}\n"};t.exports={shaders:r}},function(t,n,e){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=e(8);t.exports=function(t){if(arguments.length>1)throw"Error: The Speck Interactions module has changed!";if(0===arguments.length||"object"!==r(t))throw"Error: Arguments not provided to interactions";var n=void 0===t.scrollZoom||t.scrollZoom,e=t.container,a=t.getRotation,i=t.setRotation,u=t.getTranslation,s=t.setTranslation,l=t.getZoom,c=t.setZoom,f=t.refreshView,h={buttonDown:!1,shiftDown:!1,lastX:0,lastY:0};function p(t){0===t.button&&(h={buttonDown:!0,shiftDown:h.shiftDown,lastX:t.clientX,lastY:t.clientY})}function d(t){if(0===t.button){if(!h.buttonDown)return;h.buttonDown=!1}}function m(t){h.shiftDown=t.shiftKey}function g(t){if(h.buttonDown&&0!==t.buttons){t.preventDefault();var n=t.clientX-h.lastX,e=t.clientY-h.lastY;if(0!==n||0!==e){if(h.lastX=t.clientX,h.lastY=t.clientY,h.shiftDown){var r=u(),c=.001/l();s({x:r.x-n*c,y:r.y+e*c})}else{var p={rotation:new Float32Array(a())};o.rotate(p,n,e),i(p.rotation)}f()}}}function v(t){t.preventDefault(),c(l()*(t.deltaY<0?1/.9:.9)),f()}function y(){e.removeEventListener("mousedown",p),window.removeEventListener("mouseup",d),window.removeEventListener("keydown",m),window.removeEventListener("keyup",m),window.removeEventListener("mousemove",g),e.removeEventListener("wheel",v)}return e.addEventListener("mousedown",p),window.addEventListener("mouseup",d),window.addEventListener("keydown",m),window.addEventListener("keyup",m),window.addEventListener("mousemove",g),n&&e.addEventListener("wheel",v),y}},function(t,n){t.exports={default:{atomScale:.6,relativeAtomScale:1,bondScale:.5,ao:.75,aoRes:256,brightness:.5,outline:0,spf:32,bonds:!1,bondThreshold:1.2,bondShade:.5,atomShade:.5,dofStrength:0,dofPosition:.5,fxaa:1},stickball:{atomScale:.24,relativeAtomScale:.64,bondScale:.5,bonds:!0,bondThreshold:1.2},toon:{ao:0,spf:0,brightness:.5,outline:1},licorice:{atomScale:.1,relativeAtomScale:0,bondScale:1,bonds:!0,bondThreshold:1.2}}},function(t,n,e){"use strict";e.r(n);var r=e(10),o=e(20),a=e(1),i=e.n(a),u=e(0),s=e.n(u),l=e(24),c=e(47);function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function h(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function d(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function m(t,n){return(m=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var g=function(t){function n(t){var e;return function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n),(e=function(t,n){return!n||"object"!==f(n)&&"function"!=typeof n?d(t):n}(this,p(n).call(this,t))).renderNewSequences=e.renderNewSequences.bind(d(e)),e.containerRef=i.a.createRef(),e}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&m(t,n)}(n,t),e=n,(r=[{key:"componentDidMount",value:function(){var t=this.props,n=t.height,e=t.width,r=t.nodeFillColor,o=t.colorScheme,a=t.customColors,i=t.allowPanningAndZooming;this._fornaContainer=new l.FornaContainer(this.containerRef.current,{initialSize:[e,n],allowPanningAndZooming:i}),this._fornaContainer.addCustomColors(a),this._fornaContainer.changeColorScheme(o),this.renderNewSequences(),void 0!==r&&this._fornaContainer.setOutlineColor(r)}},{key:"componentDidUpdate",value:function(){this.renderNewSequences()}},{key:"renderNewSequences",value:function(){var t=this,n=this.props.sequences;this._fornaContainer&&(this._fornaContainer.clearNodes(),n.forEach((function(n){var e=Object.assign({},n.options,{sequence:n.sequence,structure:n.structure});t._fornaContainer.addRNA(n.structure,e)})))}},{key:"shouldComponentUpdate",value:function(t){var n=this.props,e=n.sequences,r=n.colorScheme;return!c.a(e,t.sequences)||(this._fornaContainer.addCustomColors(t.customColors),this._fornaContainer.changeColorScheme(r),void 0!==t.nodeFillColor&&this._fornaContainer.setOutlineColor(t.nodeFillColor),!1)}},{key:"render",value:function(){return i.a.createElement("div",{id:this.props.id,ref:this.containerRef,style:{outline:"none"}})}}])&&h(e.prototype,r),o&&h(e,o),n}(a.Component);g.propTypes={id:s.a.string,height:s.a.number,width:s.a.number,sequences:s.a.arrayOf(s.a.exact({sequence:s.a.string.isRequired,structure:s.a.string.isRequired,options:s.a.exact({applyForce:s.a.bool,circularizeExternal:s.a.bool,labelInterval:s.a.number,name:s.a.string,avoidOthers:s.a.bool})})),nodeFillColor:s.a.string,colorScheme:s.a.oneOf(["sequence","structure","positions","custom"]),customColors:s.a.exact({domain:s.a.arrayOf(s.a.number),range:s.a.arrayOf(s.a.string),colorValues:s.a.objectOf(s.a.objectOf(s.a.oneOfType([s.a.string,s.a.number])))}),allowPanningAndZooming:s.a.bool,setProps:s.a.func},g.defaultProps={height:500,width:300,sequences:[],allowPanningAndZooming:!0,colorScheme:"sequence"};var v=e(11),y=e(12),b=e(13),x=e(14),M=e(15),w=e(16),_=e(17),k=e(18),S=e(19);e.d(n,"AlignmentChart",(function(){return r.a})),e.d(n,"Circos",(function(){return o.a})),e.d(n,"FornaContainer",(function(){return g})),e.d(n,"Ideogram",(function(){return v.a})),e.d(n,"Igv",(function(){return y.a})),e.d(n,"Molecule2dViewer",(function(){return b.a})),e.d(n,"Molecule3dViewer",(function(){return x.a})),e.d(n,"NeedlePlot",(function(){return M.a})),e.d(n,"NglMoleculeViewer",(function(){return w.a})),e.d(n,"OncoPrint",(function(){return _.a})),e.d(n,"SequenceViewer",(function(){return k.a})),e.d(n,"Speck",(function(){return S.a}))},,function(t,n){t.exports=window.ReactDOM},,,,,,,,,,,,function(t,n,e){"use strict";var r=e(9);function o(t){for(var n,e=[];!(n=t.next()).done;)e.push(n.value);return e}function a(t,n,e){for(var r=0,o=e.length;r<o;){if(t(n,e[r]))return!0;r+=1}return!1}var i=e(5);var u="function"==typeof Object.is?Object.is:function(t,n){return t===n?0!==t||1/t==1/n:t!=t&&n!=n},s=e(3),l=Object.prototype.toString,c=function(){return"[object Arguments]"===l.call(arguments)?function(t){return"[object Arguments]"===l.call(t)}:function(t){return Object(i.a)("callee",t)}}(),f=!{toString:null}.propertyIsEnumerable("toString"),h=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],p=function(){return arguments.propertyIsEnumerable("length")}(),d=function(t,n){for(var e=0;e<t.length;){if(t[e]===n)return!0;e+=1}return!1},m="function"!=typeof Object.keys||p?Object(s.a)((function(t){if(Object(t)!==t)return[];var n,e,r=[],o=p&&c(t);for(n in t)!Object(i.a)(n,t)||o&&"length"===n||(r[r.length]=n);if(f)for(e=h.length-1;e>=0;)n=h[e],Object(i.a)(n,t)&&!d(r,n)&&(r[r.length]=n),e-=1;return r})):Object(s.a)((function(t){return Object(t)!==t?[]:Object.keys(t)})),g=Object(s.a)((function(t){return null===t?"Null":void 0===t?"Undefined":Object.prototype.toString.call(t).slice(8,-1)}));function v(t,n,e,r){var i=o(t);function u(t,n){return y(t,n,e.slice(),r.slice())}return!a((function(t,n){return!a(u,n,t)}),o(n),i)}function y(t,n,e,r){if(u(t,n))return!0;var o,a,s=g(t);if(s!==g(n))return!1;if(null==t||null==n)return!1;if("function"==typeof t["fantasy-land/equals"]||"function"==typeof n["fantasy-land/equals"])return"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](n)&&"function"==typeof n["fantasy-land/equals"]&&n["fantasy-land/equals"](t);if("function"==typeof t.equals||"function"==typeof n.equals)return"function"==typeof t.equals&&t.equals(n)&&"function"==typeof n.equals&&n.equals(t);switch(s){case"Arguments":case"Array":case"Object":if("function"==typeof t.constructor&&"Promise"===(o=t.constructor,null==(a=String(o).match(/^function (\w*)/))?"":a[1]))return t===n;break;case"Boolean":case"Number":case"String":if(typeof t!=typeof n||!u(t.valueOf(),n.valueOf()))return!1;break;case"Date":if(!u(t.valueOf(),n.valueOf()))return!1;break;case"Error":return t.name===n.name&&t.message===n.message;case"RegExp":if(t.source!==n.source||t.global!==n.global||t.ignoreCase!==n.ignoreCase||t.multiline!==n.multiline||t.sticky!==n.sticky||t.unicode!==n.unicode)return!1}for(var l=e.length-1;l>=0;){if(e[l]===t)return r[l]===n;l-=1}switch(s){case"Map":return t.size===n.size&&v(t.entries(),n.entries(),e.concat([t]),r.concat([n]));case"Set":return t.size===n.size&&v(t.values(),n.values(),e.concat([t]),r.concat([n]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var c=m(t);if(c.length!==m(n).length)return!1;var f=e.concat([t]),h=r.concat([n]);for(l=c.length-1;l>=0;){var p=c[l];if(!Object(i.a)(p,n)||!y(n[p],t[p],f,h))return!1;l-=1}return!0}var b=Object(r.a)((function(t,n){return y(t,n,[],[])}));n.a=b}]);
\ No newline at end of file
+window.dash_bio=function(t){function n(n){for(var e,o,a=n[0],i=n[1],u=0,s=[];u<a.length;u++)o=a[u],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&s.push(r[o][0]),r[o]=0;for(e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e]);for(h&&h(n);s.length;)s.shift()()}var e={},r={11:0};function o(t){return a.p+""+({0:"async-alignment",1:"async-circos",2:"async-ideogram",3:"async-igv",4:"async-moleculeviewer2",5:"async-moleculeviewer3",6:"async-needle",7:"async-nglmoleculeviewer",8:"async-onco",9:"async-sequence",10:"async-speck"}[t]||t)+".js"}function a(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.e=function(t){var n=[],e=r[t];if(0!==e)if(e)n.push(e[2]);else{var i=new Promise((function(n,o){e=r[t]=[n,o]}));n.push(e[2]=i);var u,s=document.createElement("script");s.charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.src=o(t);var l=new Error;u=function(n){s.onerror=s.onload=null,clearTimeout(c);var e=r[t];if(0!==e){if(e){var o=n&&("load"===n.type?"missing":n.type),a=n&&n.target&&n.target.src;l.message="Loading chunk "+t+" failed.\n("+o+": "+a+")",l.name="ChunkLoadError",l.type=o,l.request=a,e[1](l)}r[t]=void 0}};var c=setTimeout((function(){u({type:"timeout",target:s})}),12e4);s.onerror=s.onload=u,document.head.appendChild(s)}return Promise.all(n)},a.m=t,a.c=e,a.d=function(t,n,e){a.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,n){if(1&n&&(t=a(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(a.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var r in t)a.d(e,r,function(n){return t[n]}.bind(null,r));return e},a.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(n,"a",n),n},a.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},a.p="",a.oe=function(t){throw console.error(t),t};var i,u=function(){var t=document.currentScript;if(!t){for(var n=document.getElementsByTagName("script"),e=[],r=0;r<n.length;r++)e.push(n[r]);t=(e=e.filter((function(t){return!t.async&&!t.text&&!t.textContent}))).slice(-1)[0]}return t};if(Object.defineProperty(a,"p",{get:(i=u().src.split("/").slice(0,-1).join("/")+"/",function(){return i})}),void 0!==o){var s=o;o=function(t){var n=function(t){return/\/_dash-component-suites\//.test(t.src)}(u()),e=s(t);if(!n)return e;var r=e.split("/"),o=r.slice(-1)[0].split(".");return o.splice(1,0,"v0_6_1m1613375614"),r.splice(-1,1,o.join(".")),r.join("/")}}var l=window.webpackJsonpdash_bio=window.webpackJsonpdash_bio||[],c=l.push.bind(l);l.push=n,l=l.slice();for(var f=0;f<l.length;f++)n(l[f]);var h=c;return a(a.s=33)}([function(t,n,e){t.exports=e(25)()},function(t,n){t.exports=window.React},function(t,n,e){"use strict";n.a={alignmentChart:function(){return e.e(0).then(e.bind(null,36))},circos:function(){return e.e(1).then(e.bind(null,37))},ideogram:function(){return Promise.all([e.e(0),e.e(2)]).then(e.bind(null,38))},igv:function(){return Promise.all([e.e(0),e.e(3)]).then(e.bind(null,39))},molecule2dViewer:function(){return Promise.all([e.e(0),e.e(4)]).then(e.bind(null,40))},molecule3dViewer:function(){return Promise.all([e.e(0),e.e(5)]).then(e.bind(null,41))},nglmoleculeViewer:function(){return Promise.all([e.e(0),e.e(7)]).then(e.bind(null,42))},needlePlot:function(){return Promise.all([e.e(0),e.e(6)]).then(e.bind(null,45))},oncoPrint:function(){return Promise.all([e.e(0),e.e(8)]).then(e.bind(null,43))},sequenceViewer:function(){return Promise.all([e.e(0),e.e(9)]).then(e.bind(null,44))},speck:function(){return e.e(10).then(e.bind(null,46))}}},function(t,n,e){"use strict";e.d(n,"a",(function(){return o}));var r=e(4);function o(t){return function n(e){return 0===arguments.length||Object(r.a)(e)?n:t.apply(this,arguments)}}},function(t,n,e){"use strict";function r(t){return null!=t&&"object"==typeof t&&!0===t["@@functional/placeholder"]}e.d(n,"a",(function(){return r}))},function(t,n,e){"use strict";function r(t,n){return Object.prototype.hasOwnProperty.call(n,t)}e.d(n,"a",(function(){return r}))},function(t,n){t.exports={},t.exports[0]=t.exports.Xx={symbol:"Xx",name:"unknown",mass:1,radius:1,color:[1,.078,.576],number:0},t.exports[1]=t.exports.H={symbol:"H",name:"hydrogen",mass:1.00794,radius:.31,color:[1,1,1],number:1},t.exports[2]=t.exports.He={symbol:"He",name:"helium",mass:4.002602,radius:.28,color:[.851,1,1],number:2},t.exports[3]=t.exports.Li={symbol:"Li",name:"lithium",mass:6.941,radius:1.28,color:[.8,.502,1],number:3},t.exports[4]=t.exports.Be={symbol:"Be",name:"beryllium",mass:9.012182,radius:.96,color:[.761,1,0],number:4},t.exports[5]=t.exports.B={symbol:"B",name:"boron",mass:10.811,radius:.84,color:[1,.71,.71],number:5},t.exports[6]=t.exports.C={symbol:"C",name:"carbon",mass:12.0107,radius:.73,color:[.565,.565,.565],number:6},t.exports[7]=t.exports.N={symbol:"N",name:"nitrogen",mass:14.0067,radius:.71,color:[.188,.314,.973],number:7},t.exports[8]=t.exports.O={symbol:"O",name:"oxygen",mass:15.9994,radius:.66,color:[1,.051,.051],number:8},t.exports[9]=t.exports.F={symbol:"F",name:"fluorine",mass:18.9984032,radius:.57,color:[.565,.878,.314],number:9},t.exports[10]=t.exports.Ne={symbol:"Ne",name:"neon",mass:20.1797,radius:.58,color:[.702,.89,.961],number:10},t.exports[11]=t.exports.Na={symbol:"Na",name:"sodium",mass:22.98976928,radius:1.66,color:[.671,.361,.949],number:11},t.exports[12]=t.exports.Mg={symbol:"Mg",name:"magnesium",mass:24.305,radius:1.41,color:[.541,1,0],number:12},t.exports[13]=t.exports.Al={symbol:"Al",name:"aluminum",mass:26.9815386,radius:1.21,color:[.749,.651,.651],number:13},t.exports[14]=t.exports.Si={symbol:"Si",name:"silicon",mass:28.0855,radius:1.11,color:[.941,.784,.627],number:14},t.exports[15]=t.exports.P={symbol:"P",name:"phosphorus",mass:30.973762,radius:1.07,color:[1,.502,0],number:15},t.exports[16]=t.exports.S={symbol:"S",name:"sulfur",mass:32.065,radius:1.05,color:[1,1,.188],number:16},t.exports[17]=t.exports.Cl={symbol:"Cl",name:"chlorine",mass:35.453,radius:1.02,color:[.122,.941,.122],number:17},t.exports[18]=t.exports.Ar={symbol:"Ar",name:"argon",mass:39.948,radius:1.06,color:[.502,.82,.89],number:18},t.exports[19]=t.exports.K={symbol:"K",name:"potassium",mass:39.0983,radius:2.03,color:[.561,.251,.831],number:19},t.exports[20]=t.exports.Ca={symbol:"Ca",name:"calcium",mass:40.078,radius:1.76,color:[.239,1,0],number:20},t.exports[21]=t.exports.Sc={symbol:"Sc",name:"scandium",mass:44.955912,radius:1.7,color:[.902,.902,.902],number:21},t.exports[22]=t.exports.Ti={symbol:"Ti",name:"titanium",mass:47.867,radius:1.6,color:[.749,.761,.78],number:22},t.exports[23]=t.exports.V={symbol:"V",name:"vanadium",mass:50.9415,radius:1.53,color:[.651,.651,.671],number:23},t.exports[24]=t.exports.Cr={symbol:"Cr",name:"chromium",mass:51.9961,radius:1.39,color:[.541,.6,.78],number:24},t.exports[25]=t.exports.Mn={symbol:"Mn",name:"manganese",mass:54.938045,radius:1.39,color:[.611,.478,.78],number:25},t.exports[26]=t.exports.Fe={symbol:"Fe",name:"iron",mass:55.845,radius:1.32,color:[.878,.4,.2],number:26},t.exports[27]=t.exports.Co={symbol:"Co",name:"cobalt",mass:58.6934,radius:1.26,color:[.941,.565,.627],number:27},t.exports[28]=t.exports.Ni={symbol:"Ni",name:"nickel",mass:58.933195,radius:1.24,color:[.314,.816,.314],number:28},t.exports[29]=t.exports.Cu={symbol:"Cu",name:"copper",mass:63.546,radius:1.32,color:[.784,.502,.2],number:29},t.exports[30]=t.exports.Zn={symbol:"Zn",name:"zinc",mass:65.38,radius:1.22,color:[.49,.502,.69],number:30},t.exports[31]=t.exports.Ga={symbol:"Ga",name:"gallium",mass:69.723,radius:1.22,color:[.761,.561,.561],number:31},t.exports[32]=t.exports.Ge={symbol:"Ge",name:"germanium",mass:72.64,radius:1.2,color:[.4,.561,.561],number:32},t.exports[33]=t.exports.As={symbol:"As",name:"arsenic",mass:74.9216,radius:1.19,color:[.741,.502,.89],number:33},t.exports[34]=t.exports.Se={symbol:"Se",name:"selenium",mass:78.96,radius:1.2,color:[1,.631,0],number:34},t.exports[35]=t.exports.Br={symbol:"Br",name:"bromine",mass:79.904,radius:1.2,color:[.651,.161,.161],number:35},t.exports[36]=t.exports.Kr={symbol:"Kr",name:"krypton",mass:83.798,radius:1.16,color:[.361,.722,.82],number:36},t.exports[37]=t.exports.Rb={symbol:"Rb",name:"rubidium",mass:85.4678,radius:2.2,color:[.439,.18,.69],number:37},t.exports[38]=t.exports.Sr={symbol:"Sr",name:"strontium",mass:87.62,radius:1.95,color:[0,1,0],number:38},t.exports[39]=t.exports.Y={symbol:"Y",name:"yttrium",mass:88.90585,radius:1.9,color:[.58,1,1],number:39},t.exports[40]=t.exports.Zr={symbol:"Zr",name:"zirconium",mass:91.224,radius:1.75,color:[.58,.878,.878],number:40},t.exports[41]=t.exports.Nb={symbol:"Nb",name:"niobium",mass:92.90638,radius:1.64,color:[.451,.761,.788],number:41},t.exports[42]=t.exports.Mo={symbol:"Mo",name:"molybdenum",mass:95.96,radius:1.54,color:[.329,.71,.71],number:42},t.exports[43]=t.exports.Tc={symbol:"Tc",name:"technetium",mass:98,radius:1.47,color:[.231,.62,.62],number:43},t.exports[44]=t.exports.Ru={symbol:"Ru",name:"ruthenium",mass:101.07,radius:1.46,color:[.141,.561,.561],number:44},t.exports[45]=t.exports.Rh={symbol:"Rh",name:"rhodium",mass:102.9055,radius:1.42,color:[.039,.49,.549],number:45},t.exports[46]=t.exports.Pd={symbol:"Pd",name:"palladium",mass:106.42,radius:1.39,color:[0,.412,.522],number:46},t.exports[47]=t.exports.Ag={symbol:"Ag",name:"silver",mass:107.8682,radius:1.45,color:[.753,.753,.753],number:47},t.exports[48]=t.exports.Cd={symbol:"Cd",name:"cadmium",mass:112.411,radius:1.44,color:[1,.851,.561],number:48},t.exports[49]=t.exports.In={symbol:"In",name:"indium",mass:114.818,radius:1.42,color:[.651,.459,.451],number:49},t.exports[50]=t.exports.Sn={symbol:"Sn",name:"tin",mass:118.71,radius:1.39,color:[.4,.502,.502],number:50},t.exports[51]=t.exports.Sb={symbol:"Sb",name:"antimony",mass:121.76,radius:1.39,color:[.62,.388,.71],number:51},t.exports[52]=t.exports.Te={symbol:"Te",name:"tellurium",mass:127.6,radius:1.38,color:[.831,.478,0],number:52},t.exports[53]=t.exports.I={symbol:"I",name:"iodine",mass:126.9047,radius:1.39,color:[.58,0,.58],number:53},t.exports[54]=t.exports.Xe={symbol:"Xe",name:"xenon",mass:131.293,radius:1.4,color:[.259,.62,.69],number:54},t.exports[55]=t.exports.Cs={symbol:"Cs",name:"cesium",mass:132.9054519,radius:2.44,color:[.341,.09,.561],number:55},t.exports[56]=t.exports.Ba={symbol:"Ba",name:"barium",mass:137.327,radius:2.15,color:[0,.788,0],number:56},t.exports[57]=t.exports.La={symbol:"La",name:"lanthanum",mass:138.90547,radius:2.07,color:[.439,.831,1],number:57},t.exports[58]=t.exports.Ce={symbol:"Ce",name:"cerium",mass:140.116,radius:2.04,color:[1,1,.78],number:58},t.exports[59]=t.exports.Pr={symbol:"Pr",name:"praseodymium",mass:140.90765,radius:2.03,color:[.851,1,.78],number:59},t.exports[60]=t.exports.Nd={symbol:"Nd",name:"neodymium",mass:144.242,radius:2.01,color:[.78,1,.78],number:60},t.exports[61]=t.exports.Pm={symbol:"Pm",name:"promethium",mass:145,radius:1.99,color:[.639,1,.78],number:61},t.exports[62]=t.exports.Sm={symbol:"Sm",name:"samarium",mass:150.36,radius:1.98,color:[.561,1,.78],number:62},t.exports[63]=t.exports.Eu={symbol:"Eu",name:"europium",mass:151.964,radius:1.98,color:[.38,1,.78],number:63},t.exports[64]=t.exports.Gd={symbol:"Gd",name:"gadolinium",mass:157.25,radius:1.96,color:[.271,1,.78],number:64},t.exports[65]=t.exports.Tb={symbol:"Tb",name:"terbium",mass:158.92535,radius:1.94,color:[.189,1,.78],number:65},t.exports[66]=t.exports.Dy={symbol:"Dy",name:"dysprosium",mass:162.5,radius:1.92,color:[.122,1,.78],number:66},t.exports[67]=t.exports.Ho={symbol:"Ho",name:"holmium",mass:164.93032,radius:1.92,color:[0,1,.612],number:67},t.exports[68]=t.exports.Er={symbol:"Er",name:"erbium",mass:167.259,radius:1.89,color:[0,.902,.459],number:68},t.exports[69]=t.exports.Tm={symbol:"Tm",name:"thulium",mass:168.93421,radius:1.9,color:[0,.831,.322],number:69},t.exports[70]=t.exports.Yb={symbol:"Yb",name:"ytterbium",mass:173.054,radius:1.87,color:[0,.749,.22],number:70},t.exports[71]=t.exports.Lu={symbol:"Lu",name:"lutetium",mass:174.9668,radius:1.87,color:[0,.671,.141],number:71},t.exports[72]=t.exports.Hf={symbol:"Hf",name:"hafnium",mass:178.49,radius:1.75,color:[.302,.761,1],number:72},t.exports[73]=t.exports.Ta={symbol:"Ta",name:"tantalum",mass:180.94788,radius:1.7,color:[.302,.651,1],number:73},t.exports[74]=t.exports.W={symbol:"W",name:"tungsten",mass:183.84,radius:1.62,color:[.129,.58,.839],number:74},t.exports[75]=t.exports.Re={symbol:"Re",name:"rhenium",mass:186.207,radius:1.51,color:[.149,.49,.671],number:75},t.exports[76]=t.exports.Os={symbol:"Os",name:"osmium",mass:190.23,radius:1.44,color:[.149,.4,.588],number:76},t.exports[77]=t.exports.Ir={symbol:"Ir",name:"iridium",mass:192.217,radius:1.41,color:[.09,.329,.529],number:77},t.exports[78]=t.exports.Pt={symbol:"Pt",name:"platinum",mass:195.084,radius:1.36,color:[.816,.816,.878],number:78},t.exports[79]=t.exports.Au={symbol:"Au",name:"gold",mass:196.966569,radius:1.36,color:[1,.82,.137],number:79},t.exports[80]=t.exports.Hg={symbol:"Hg",name:"mercury",mass:200.59,radius:1.32,color:[.722,.722,.816],number:80},t.exports[81]=t.exports.Tl={symbol:"Tl",name:"thallium",mass:204.3833,radius:1.45,color:[.651,.329,.302],number:81},t.exports[82]=t.exports.Pb={symbol:"Pb",name:"lead",mass:207.2,radius:1.46,color:[.341,.349,.38],number:82},t.exports[83]=t.exports.Bi={symbol:"Bi",name:"bismuth",mass:208.9804,radius:1.48,color:[.62,.31,.71],number:83},t.exports[84]=t.exports.Po={symbol:"Po",name:"polonium",mass:210,radius:1.4,color:[.671,.361,0],number:84},t.exports[85]=t.exports.At={symbol:"At",name:"astatine",mass:210,radius:1.5,color:[.459,.31,.271],number:85},t.exports[86]=t.exports.Rn={symbol:"Rn",name:"radon",mass:220,radius:1.5,color:[.259,.51,.588],number:86},t.exports[87]=t.exports.Fr={symbol:"Fr",name:"francium",mass:223,radius:2.6,color:[.259,0,.4],number:87},t.exports[88]=t.exports.Ra={symbol:"Ra",name:"radium",mass:226,radius:2.21,color:[0,.49,0],number:88},t.exports[89]=t.exports.Ac={symbol:"Ac",name:"actinium",mass:227,radius:2.15,color:[.439,.671,.98],number:89},t.exports[90]=t.exports.Th={symbol:"Th",name:"thorium",mass:231.03588,radius:2.06,color:[0,.729,1],number:90},t.exports[91]=t.exports.Pa={symbol:"Pa",name:"protactinium",mass:232.03806,radius:2,color:[0,.631,1],number:91},t.exports[92]=t.exports.U={symbol:"U",name:"uranium",mass:237,radius:1.96,color:[0,.561,1],number:92},t.exports[93]=t.exports.Np={symbol:"Np",name:"neptunium",mass:238.02891,radius:1.9,color:[0,.502,1],number:93},t.exports[94]=t.exports.Pu={symbol:"Pu",name:"plutonium",mass:243,radius:1.87,color:[0,.42,1],number:94},t.exports[95]=t.exports.Am={symbol:"Am",name:"americium",mass:244,radius:1.8,color:[.329,.361,.949],number:95},t.exports[96]=t.exports.Cm={symbol:"Cm",name:"curium",mass:247,radius:1.69,color:[.471,.361,.89],number:96},t.exports[97]=t.exports.Bk={symbol:"Bk",name:"berkelium",mass:247,radius:1.66,color:[.541,.31,.89],number:97},t.exports[98]=t.exports.Cf={symbol:"Cf",name:"californium",mass:251,radius:1.68,color:[.631,.212,.831],number:98},t.exports[99]=t.exports.Es={symbol:"Es",name:"einsteinium",mass:252,radius:1.65,color:[.702,.122,.831],number:99},t.exports[100]=t.exports.Fm={symbol:"Fm",name:"fermium",mass:257,radius:1.67,color:[.702,.122,.729],number:100},t.exports[101]=t.exports.Md={symbol:"Md",name:"mendelevium",mass:258,radius:1.73,color:[.702,.051,.651],number:101},t.exports[102]=t.exports.No={symbol:"No",name:"nobelium",mass:259,radius:1.76,color:[.741,.051,.529],number:102},t.exports[103]=t.exports.Lr={symbol:"Lr",name:"lawrencium",mass:262,radius:1.61,color:[.78,0,.4],number:103},t.exports[104]=t.exports.Rf={symbol:"Rf",name:"rutherfordium",mass:261,radius:1.57,color:[.8,0,.349],number:104},t.exports[105]=t.exports.Db={symbol:"Db",name:"dubnium",mass:262,radius:1.49,color:[.82,0,.31],number:105},t.exports[106]=t.exports.Sg={symbol:"Sg",name:"seaborgium",mass:266,radius:1.43,color:[.851,0,.271],number:106},t.exports[107]=t.exports.Bh={symbol:"Bh",name:"bohrium",mass:264,radius:1.41,color:[.878,0,.22],number:107},t.exports[108]=t.exports.Hs={symbol:"Hs",name:"hassium",mass:277,radius:1.34,color:[.902,0,.18],number:108},t.exports[109]=t.exports.Mt={symbol:"Mt",name:"meitnerium",mass:268,radius:1.29,color:[.922,0,.149],number:109},t.exports[110]=t.exports.Ds={symbol:"Ds",name:"Ds",mass:271,radius:1.28,color:[.922,0,.149],number:110},t.exports[111]=t.exports.Uuu={symbol:"Uuu",name:"Uuu",mass:272,radius:1.21,color:[.922,0,.149],number:111},t.exports[112]=t.exports.Uub={symbol:"Uub",name:"Uub",mass:285,radius:1.22,color:[.922,0,.149],number:112},t.exports[113]=t.exports.Uut={symbol:"Uut",name:"Uut",mass:284,radius:1.36,color:[.922,0,.149],number:113},t.exports[114]=t.exports.Uuq={symbol:"Uuq",name:"Uuq",mass:289,radius:1.43,color:[.922,0,.149],number:114},t.exports[115]=t.exports.Uup={symbol:"Uup",name:"Uup",mass:288,radius:1.62,color:[.922,0,.149],number:115},t.exports[116]=t.exports.Uuh={symbol:"Uuh",name:"Uuh",mass:292,radius:1.75,color:[.922,0,.149],number:116},t.exports[117]=t.exports.Uus={symbol:"Uus",name:"Uus",mass:294,radius:1.65,color:[.922,0,.149],number:117},t.exports[118]=t.exports.Uuo={symbol:"Uuo",name:"Uuo",mass:296,radius:1.57,color:[.922,0,.149],number:118}},function(t,n,e){!function(t){"use strict";var e={};e.exports=n,function(t){if(!n)var n=1e-6;if(!e)var e="undefined"!=typeof Float32Array?Float32Array:Array;if(!r)var r=Math.random;var o={setMatrixArrayType:function(t){e=t}};void 0!==t&&(t.glMatrix=o);var a=Math.PI/180;o.toRadian=function(t){return t*a};var i,u={};u.create=function(){var t=new e(2);return t[0]=0,t[1]=0,t},u.clone=function(t){var n=new e(2);return n[0]=t[0],n[1]=t[1],n},u.fromValues=function(t,n){var r=new e(2);return r[0]=t,r[1]=n,r},u.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t},u.set=function(t,n,e){return t[0]=n,t[1]=e,t},u.add=function(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t},u.subtract=function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t},u.sub=u.subtract,u.multiply=function(t,n,e){return t[0]=n[0]*e[0],t[1]=n[1]*e[1],t},u.mul=u.multiply,u.divide=function(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t},u.div=u.divide,u.min=function(t,n,e){return t[0]=Math.min(n[0],e[0]),t[1]=Math.min(n[1],e[1]),t},u.max=function(t,n,e){return t[0]=Math.max(n[0],e[0]),t[1]=Math.max(n[1],e[1]),t},u.scale=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t},u.scaleAndAdd=function(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t},u.distance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1];return Math.sqrt(e*e+r*r)},u.dist=u.distance,u.squaredDistance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1];return e*e+r*r},u.sqrDist=u.squaredDistance,u.length=function(t){var n=t[0],e=t[1];return Math.sqrt(n*n+e*e)},u.len=u.length,u.squaredLength=function(t){var n=t[0],e=t[1];return n*n+e*e},u.sqrLen=u.squaredLength,u.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t},u.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t},u.normalize=function(t,n){var e=n[0],r=n[1],o=e*e+r*r;return o>0&&(o=1/Math.sqrt(o),t[0]=n[0]*o,t[1]=n[1]*o),t},u.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]},u.cross=function(t,n,e){var r=n[0]*e[1]-n[1]*e[0];return t[0]=t[1]=0,t[2]=r,t},u.lerp=function(t,n,e,r){var o=n[0],a=n[1];return t[0]=o+r*(e[0]-o),t[1]=a+r*(e[1]-a),t},u.random=function(t,n){n=n||1;var e=2*r()*Math.PI;return t[0]=Math.cos(e)*n,t[1]=Math.sin(e)*n,t},u.transformMat2=function(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[2]*o,t[1]=e[1]*r+e[3]*o,t},u.transformMat2d=function(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[2]*o+e[4],t[1]=e[1]*r+e[3]*o+e[5],t},u.transformMat3=function(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[3]*o+e[6],t[1]=e[1]*r+e[4]*o+e[7],t},u.transformMat4=function(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[4]*o+e[12],t[1]=e[1]*r+e[5]*o+e[13],t},u.forEach=(i=u.create(),function(t,n,e,r,o,a){var u,s;for(n||(n=2),e||(e=0),s=r?Math.min(r*n+e,t.length):t.length,u=e;u<s;u+=n)i[0]=t[u],i[1]=t[u+1],o(i,i,a),t[u]=i[0],t[u+1]=i[1];return t}),u.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},void 0!==t&&(t.vec2=u);var s={create:function(){var t=new e(3);return t[0]=0,t[1]=0,t[2]=0,t},clone:function(t){var n=new e(3);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n},fromValues:function(t,n,r){var o=new e(3);return o[0]=t,o[1]=n,o[2]=r,o},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t},set:function(t,n,e,r){return t[0]=n,t[1]=e,t[2]=r,t},add:function(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t},subtract:function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t}};s.sub=s.subtract,s.multiply=function(t,n,e){return t[0]=n[0]*e[0],t[1]=n[1]*e[1],t[2]=n[2]*e[2],t},s.mul=s.multiply,s.divide=function(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t},s.div=s.divide,s.min=function(t,n,e){return t[0]=Math.min(n[0],e[0]),t[1]=Math.min(n[1],e[1]),t[2]=Math.min(n[2],e[2]),t},s.max=function(t,n,e){return t[0]=Math.max(n[0],e[0]),t[1]=Math.max(n[1],e[1]),t[2]=Math.max(n[2],e[2]),t},s.scale=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t},s.scaleAndAdd=function(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t[2]=n[2]+e[2]*r,t},s.distance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2];return Math.sqrt(e*e+r*r+o*o)},s.dist=s.distance,s.squaredDistance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2];return e*e+r*r+o*o},s.sqrDist=s.squaredDistance,s.length=function(t){var n=t[0],e=t[1],r=t[2];return Math.sqrt(n*n+e*e+r*r)},s.len=s.length,s.squaredLength=function(t){var n=t[0],e=t[1],r=t[2];return n*n+e*e+r*r},s.sqrLen=s.squaredLength,s.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t},s.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t},s.normalize=function(t,n){var e=n[0],r=n[1],o=n[2],a=e*e+r*r+o*o;return a>0&&(a=1/Math.sqrt(a),t[0]=n[0]*a,t[1]=n[1]*a,t[2]=n[2]*a),t},s.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]},s.cross=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=e[0],u=e[1],s=e[2];return t[0]=o*s-a*u,t[1]=a*i-r*s,t[2]=r*u-o*i,t},s.lerp=function(t,n,e,r){var o=n[0],a=n[1],i=n[2];return t[0]=o+r*(e[0]-o),t[1]=a+r*(e[1]-a),t[2]=i+r*(e[2]-i),t},s.random=function(t,n){n=n||1;var e=2*r()*Math.PI,o=2*r()-1,a=Math.sqrt(1-o*o)*n;return t[0]=Math.cos(e)*a,t[1]=Math.sin(e)*a,t[2]=o*n,t},s.transformMat4=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=e[3]*r+e[7]*o+e[11]*a+e[15];return i=i||1,t[0]=(e[0]*r+e[4]*o+e[8]*a+e[12])/i,t[1]=(e[1]*r+e[5]*o+e[9]*a+e[13])/i,t[2]=(e[2]*r+e[6]*o+e[10]*a+e[14])/i,t},s.transformMat3=function(t,n,e){var r=n[0],o=n[1],a=n[2];return t[0]=r*e[0]+o*e[3]+a*e[6],t[1]=r*e[1]+o*e[4]+a*e[7],t[2]=r*e[2]+o*e[5]+a*e[8],t},s.transformQuat=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=e[0],u=e[1],s=e[2],l=e[3],c=l*r+u*a-s*o,f=l*o+s*r-i*a,h=l*a+i*o-u*r,p=-i*r-u*o-s*a;return t[0]=c*l+p*-i+f*-s-h*-u,t[1]=f*l+p*-u+h*-i-c*-s,t[2]=h*l+p*-s+c*-u-f*-i,t},s.rotateX=function(t,n,e,r){var o=[],a=[];return o[0]=n[0]-e[0],o[1]=n[1]-e[1],o[2]=n[2]-e[2],a[0]=o[0],a[1]=o[1]*Math.cos(r)-o[2]*Math.sin(r),a[2]=o[1]*Math.sin(r)+o[2]*Math.cos(r),t[0]=a[0]+e[0],t[1]=a[1]+e[1],t[2]=a[2]+e[2],t},s.rotateY=function(t,n,e,r){var o=[],a=[];return o[0]=n[0]-e[0],o[1]=n[1]-e[1],o[2]=n[2]-e[2],a[0]=o[2]*Math.sin(r)+o[0]*Math.cos(r),a[1]=o[1],a[2]=o[2]*Math.cos(r)-o[0]*Math.sin(r),t[0]=a[0]+e[0],t[1]=a[1]+e[1],t[2]=a[2]+e[2],t},s.rotateZ=function(t,n,e,r){var o=[],a=[];return o[0]=n[0]-e[0],o[1]=n[1]-e[1],o[2]=n[2]-e[2],a[0]=o[0]*Math.cos(r)-o[1]*Math.sin(r),a[1]=o[0]*Math.sin(r)+o[1]*Math.cos(r),a[2]=o[2],t[0]=a[0]+e[0],t[1]=a[1]+e[1],t[2]=a[2]+e[2],t},s.forEach=function(){var t=s.create();return function(n,e,r,o,a,i){var u,s;for(e||(e=3),r||(r=0),s=o?Math.min(o*e+r,n.length):n.length,u=r;u<s;u+=e)t[0]=n[u],t[1]=n[u+1],t[2]=n[u+2],a(t,t,i),n[u]=t[0],n[u+1]=t[1],n[u+2]=t[2];return n}}(),s.angle=function(t,n){var e=s.fromValues(t[0],t[1],t[2]),r=s.fromValues(n[0],n[1],n[2]);s.normalize(e,e),s.normalize(r,r);var o=s.dot(e,r);return o>1?0:Math.acos(o)},s.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},void 0!==t&&(t.vec3=s);var l={create:function(){var t=new e(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},clone:function(t){var n=new e(4);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n},fromValues:function(t,n,r,o){var a=new e(4);return a[0]=t,a[1]=n,a[2]=r,a[3]=o,a},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t},set:function(t,n,e,r,o){return t[0]=n,t[1]=e,t[2]=r,t[3]=o,t},add:function(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t[3]=n[3]+e[3],t},subtract:function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t[3]=n[3]-e[3],t}};l.sub=l.subtract,l.multiply=function(t,n,e){return t[0]=n[0]*e[0],t[1]=n[1]*e[1],t[2]=n[2]*e[2],t[3]=n[3]*e[3],t},l.mul=l.multiply,l.divide=function(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t[3]=n[3]/e[3],t},l.div=l.divide,l.min=function(t,n,e){return t[0]=Math.min(n[0],e[0]),t[1]=Math.min(n[1],e[1]),t[2]=Math.min(n[2],e[2]),t[3]=Math.min(n[3],e[3]),t},l.max=function(t,n,e){return t[0]=Math.max(n[0],e[0]),t[1]=Math.max(n[1],e[1]),t[2]=Math.max(n[2],e[2]),t[3]=Math.max(n[3],e[3]),t},l.scale=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t},l.scaleAndAdd=function(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t[2]=n[2]+e[2]*r,t[3]=n[3]+e[3]*r,t},l.distance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2],a=n[3]-t[3];return Math.sqrt(e*e+r*r+o*o+a*a)},l.dist=l.distance,l.squaredDistance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2],a=n[3]-t[3];return e*e+r*r+o*o+a*a},l.sqrDist=l.squaredDistance,l.length=function(t){var n=t[0],e=t[1],r=t[2],o=t[3];return Math.sqrt(n*n+e*e+r*r+o*o)},l.len=l.length,l.squaredLength=function(t){var n=t[0],e=t[1],r=t[2],o=t[3];return n*n+e*e+r*r+o*o},l.sqrLen=l.squaredLength,l.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=-n[3],t},l.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t[3]=1/n[3],t},l.normalize=function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e*e+r*r+o*o+a*a;return i>0&&(i=1/Math.sqrt(i),t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=n[3]*i),t},l.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]*n[3]},l.lerp=function(t,n,e,r){var o=n[0],a=n[1],i=n[2],u=n[3];return t[0]=o+r*(e[0]-o),t[1]=a+r*(e[1]-a),t[2]=i+r*(e[2]-i),t[3]=u+r*(e[3]-u),t},l.random=function(t,n){return n=n||1,t[0]=r(),t[1]=r(),t[2]=r(),t[3]=r(),l.normalize(t,t),l.scale(t,t,n),t},l.transformMat4=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3];return t[0]=e[0]*r+e[4]*o+e[8]*a+e[12]*i,t[1]=e[1]*r+e[5]*o+e[9]*a+e[13]*i,t[2]=e[2]*r+e[6]*o+e[10]*a+e[14]*i,t[3]=e[3]*r+e[7]*o+e[11]*a+e[15]*i,t},l.transformQuat=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=e[0],u=e[1],s=e[2],l=e[3],c=l*r+u*a-s*o,f=l*o+s*r-i*a,h=l*a+i*o-u*r,p=-i*r-u*o-s*a;return t[0]=c*l+p*-i+f*-s-h*-u,t[1]=f*l+p*-u+h*-i-c*-s,t[2]=h*l+p*-s+c*-u-f*-i,t},l.forEach=function(){var t=l.create();return function(n,e,r,o,a,i){var u,s;for(e||(e=4),r||(r=0),s=o?Math.min(o*e+r,n.length):n.length,u=r;u<s;u+=e)t[0]=n[u],t[1]=n[u+1],t[2]=n[u+2],t[3]=n[u+3],a(t,t,i),n[u]=t[0],n[u+1]=t[1],n[u+2]=t[2],n[u+3]=t[3];return n}}(),l.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},void 0!==t&&(t.vec4=l);var c={create:function(){var t=new e(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},clone:function(t){var n=new e(4);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},transpose:function(t,n){if(t===n){var e=n[1];t[1]=n[2],t[2]=e}else t[0]=n[0],t[1]=n[2],t[2]=n[1],t[3]=n[3];return t},invert:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e*a-o*r;return i?(i=1/i,t[0]=a*i,t[1]=-r*i,t[2]=-o*i,t[3]=e*i,t):null},adjoint:function(t,n){var e=n[0];return t[0]=n[3],t[1]=-n[1],t[2]=-n[2],t[3]=e,t},determinant:function(t){return t[0]*t[3]-t[2]*t[1]},multiply:function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=e[0],s=e[1],l=e[2],c=e[3];return t[0]=r*u+a*s,t[1]=o*u+i*s,t[2]=r*l+a*c,t[3]=o*l+i*c,t}};c.mul=c.multiply,c.rotate=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=Math.sin(e),s=Math.cos(e);return t[0]=r*s+a*u,t[1]=o*s+i*u,t[2]=r*-u+a*s,t[3]=o*-u+i*s,t},c.scale=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=e[0],s=e[1];return t[0]=r*u,t[1]=o*u,t[2]=a*s,t[3]=i*s,t},c.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},c.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2))},c.LDU=function(t,n,e,r){return t[2]=r[2]/r[0],e[0]=r[0],e[1]=r[1],e[3]=r[3]-t[2]*e[1],[t,n,e]},void 0!==t&&(t.mat2=c);var f={create:function(){var t=new e(6);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},clone:function(t){var n=new e(6);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},invert:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=e*a-r*o;return s?(s=1/s,t[0]=a*s,t[1]=-r*s,t[2]=-o*s,t[3]=e*s,t[4]=(o*u-a*i)*s,t[5]=(r*i-e*u)*s,t):null},determinant:function(t){return t[0]*t[3]-t[1]*t[2]},multiply:function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=e[0],c=e[1],f=e[2],h=e[3],p=e[4],d=e[5];return t[0]=r*l+a*c,t[1]=o*l+i*c,t[2]=r*f+a*h,t[3]=o*f+i*h,t[4]=r*p+a*d+u,t[5]=o*p+i*d+s,t}};f.mul=f.multiply,f.rotate=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=Math.sin(e),c=Math.cos(e);return t[0]=r*c+a*l,t[1]=o*c+i*l,t[2]=r*-l+a*c,t[3]=o*-l+i*c,t[4]=u,t[5]=s,t},f.scale=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=e[0],c=e[1];return t[0]=r*l,t[1]=o*l,t[2]=a*c,t[3]=i*c,t[4]=u,t[5]=s,t},f.translate=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=e[0],c=e[1];return t[0]=r,t[1]=o,t[2]=a,t[3]=i,t[4]=r*l+a*c+u,t[5]=o*l+i*c+s,t},f.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},f.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+1)},void 0!==t&&(t.mat2d=f);var h={create:function(){var t=new e(9);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},fromMat4:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[4],t[4]=n[5],t[5]=n[6],t[6]=n[8],t[7]=n[9],t[8]=n[10],t},clone:function(t){var n=new e(9);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},transpose:function(t,n){if(t===n){var e=n[1],r=n[2],o=n[5];t[1]=n[3],t[2]=n[6],t[3]=e,t[5]=n[7],t[6]=r,t[7]=o}else t[0]=n[0],t[1]=n[3],t[2]=n[6],t[3]=n[1],t[4]=n[4],t[5]=n[7],t[6]=n[2],t[7]=n[5],t[8]=n[8];return t},invert:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=n[6],l=n[7],c=n[8],f=c*i-u*l,h=-c*a+u*s,p=l*a-i*s,d=e*f+r*h+o*p;return d?(d=1/d,t[0]=f*d,t[1]=(-c*r+o*l)*d,t[2]=(u*r-o*i)*d,t[3]=h*d,t[4]=(c*e-o*s)*d,t[5]=(-u*e+o*a)*d,t[6]=p*d,t[7]=(-l*e+r*s)*d,t[8]=(i*e-r*a)*d,t):null},adjoint:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=n[6],l=n[7],c=n[8];return t[0]=i*c-u*l,t[1]=o*l-r*c,t[2]=r*u-o*i,t[3]=u*s-a*c,t[4]=e*c-o*s,t[5]=o*a-e*u,t[6]=a*l-i*s,t[7]=r*s-e*l,t[8]=e*i-r*a,t},determinant:function(t){var n=t[0],e=t[1],r=t[2],o=t[3],a=t[4],i=t[5],u=t[6],s=t[7],l=t[8];return n*(l*a-i*s)+e*(-l*o+i*u)+r*(s*o-a*u)},multiply:function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=n[6],c=n[7],f=n[8],h=e[0],p=e[1],d=e[2],m=e[3],g=e[4],v=e[5],y=e[6],b=e[7],x=e[8];return t[0]=h*r+p*i+d*l,t[1]=h*o+p*u+d*c,t[2]=h*a+p*s+d*f,t[3]=m*r+g*i+v*l,t[4]=m*o+g*u+v*c,t[5]=m*a+g*s+v*f,t[6]=y*r+b*i+x*l,t[7]=y*o+b*u+x*c,t[8]=y*a+b*s+x*f,t}};h.mul=h.multiply,h.translate=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=n[6],c=n[7],f=n[8],h=e[0],p=e[1];return t[0]=r,t[1]=o,t[2]=a,t[3]=i,t[4]=u,t[5]=s,t[6]=h*r+p*i+l,t[7]=h*o+p*u+c,t[8]=h*a+p*s+f,t},h.rotate=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=n[6],c=n[7],f=n[8],h=Math.sin(e),p=Math.cos(e);return t[0]=p*r+h*i,t[1]=p*o+h*u,t[2]=p*a+h*s,t[3]=p*i-h*r,t[4]=p*u-h*o,t[5]=p*s-h*a,t[6]=l,t[7]=c,t[8]=f,t},h.scale=function(t,n,e){var r=e[0],o=e[1];return t[0]=r*n[0],t[1]=r*n[1],t[2]=r*n[2],t[3]=o*n[3],t[4]=o*n[4],t[5]=o*n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t},h.fromMat2d=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=0,t[3]=n[2],t[4]=n[3],t[5]=0,t[6]=n[4],t[7]=n[5],t[8]=1,t},h.fromQuat=function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e+e,u=r+r,s=o+o,l=e*i,c=r*i,f=r*u,h=o*i,p=o*u,d=o*s,m=a*i,g=a*u,v=a*s;return t[0]=1-f-d,t[3]=c-v,t[6]=h+g,t[1]=c+v,t[4]=1-l-d,t[7]=p-m,t[2]=h-g,t[5]=p+m,t[8]=1-l-f,t},h.normalFromMat4=function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=n[6],l=n[7],c=n[8],f=n[9],h=n[10],p=n[11],d=n[12],m=n[13],g=n[14],v=n[15],y=e*u-r*i,b=e*s-o*i,x=e*l-a*i,M=r*s-o*u,w=r*l-a*u,_=o*l-a*s,k=c*m-f*d,S=c*g-h*d,A=c*v-p*d,E=f*g-h*m,T=f*v-p*m,R=h*v-p*g,N=y*R-b*T+x*E+M*A-w*S+_*k;return N?(N=1/N,t[0]=(u*R-s*T+l*E)*N,t[1]=(s*A-i*R-l*S)*N,t[2]=(i*T-u*A+l*k)*N,t[3]=(o*T-r*R-a*E)*N,t[4]=(e*R-o*A+a*S)*N,t[5]=(r*A-e*T-a*k)*N,t[6]=(m*_-g*w+v*M)*N,t[7]=(g*x-d*_-v*b)*N,t[8]=(d*w-m*x+v*y)*N,t):null},h.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},h.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2))},void 0!==t&&(t.mat3=h);var p={create:function(){var t=new e(16);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},clone:function(t){var n=new e(16);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},transpose:function(t,n){if(t===n){var e=n[1],r=n[2],o=n[3],a=n[6],i=n[7],u=n[11];t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=e,t[6]=n[9],t[7]=n[13],t[8]=r,t[9]=a,t[11]=n[14],t[12]=o,t[13]=i,t[14]=u}else t[0]=n[0],t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=n[1],t[5]=n[5],t[6]=n[9],t[7]=n[13],t[8]=n[2],t[9]=n[6],t[10]=n[10],t[11]=n[14],t[12]=n[3],t[13]=n[7],t[14]=n[11],t[15]=n[15];return t},invert:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=n[6],l=n[7],c=n[8],f=n[9],h=n[10],p=n[11],d=n[12],m=n[13],g=n[14],v=n[15],y=e*u-r*i,b=e*s-o*i,x=e*l-a*i,M=r*s-o*u,w=r*l-a*u,_=o*l-a*s,k=c*m-f*d,S=c*g-h*d,A=c*v-p*d,E=f*g-h*m,T=f*v-p*m,R=h*v-p*g,N=y*R-b*T+x*E+M*A-w*S+_*k;return N?(N=1/N,t[0]=(u*R-s*T+l*E)*N,t[1]=(o*T-r*R-a*E)*N,t[2]=(m*_-g*w+v*M)*N,t[3]=(h*w-f*_-p*M)*N,t[4]=(s*A-i*R-l*S)*N,t[5]=(e*R-o*A+a*S)*N,t[6]=(g*x-d*_-v*b)*N,t[7]=(c*_-h*x+p*b)*N,t[8]=(i*T-u*A+l*k)*N,t[9]=(r*A-e*T-a*k)*N,t[10]=(d*w-m*x+v*y)*N,t[11]=(f*x-c*w-p*y)*N,t[12]=(u*S-i*E-s*k)*N,t[13]=(e*E-r*S+o*k)*N,t[14]=(m*b-d*M-g*y)*N,t[15]=(c*M-f*b+h*y)*N,t):null},adjoint:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=n[6],l=n[7],c=n[8],f=n[9],h=n[10],p=n[11],d=n[12],m=n[13],g=n[14],v=n[15];return t[0]=u*(h*v-p*g)-f*(s*v-l*g)+m*(s*p-l*h),t[1]=-(r*(h*v-p*g)-f*(o*v-a*g)+m*(o*p-a*h)),t[2]=r*(s*v-l*g)-u*(o*v-a*g)+m*(o*l-a*s),t[3]=-(r*(s*p-l*h)-u*(o*p-a*h)+f*(o*l-a*s)),t[4]=-(i*(h*v-p*g)-c*(s*v-l*g)+d*(s*p-l*h)),t[5]=e*(h*v-p*g)-c*(o*v-a*g)+d*(o*p-a*h),t[6]=-(e*(s*v-l*g)-i*(o*v-a*g)+d*(o*l-a*s)),t[7]=e*(s*p-l*h)-i*(o*p-a*h)+c*(o*l-a*s),t[8]=i*(f*v-p*m)-c*(u*v-l*m)+d*(u*p-l*f),t[9]=-(e*(f*v-p*m)-c*(r*v-a*m)+d*(r*p-a*f)),t[10]=e*(u*v-l*m)-i*(r*v-a*m)+d*(r*l-a*u),t[11]=-(e*(u*p-l*f)-i*(r*p-a*f)+c*(r*l-a*u)),t[12]=-(i*(f*g-h*m)-c*(u*g-s*m)+d*(u*h-s*f)),t[13]=e*(f*g-h*m)-c*(r*g-o*m)+d*(r*h-o*f),t[14]=-(e*(u*g-s*m)-i*(r*g-o*m)+d*(r*s-o*u)),t[15]=e*(u*h-s*f)-i*(r*h-o*f)+c*(r*s-o*u),t},determinant:function(t){var n=t[0],e=t[1],r=t[2],o=t[3],a=t[4],i=t[5],u=t[6],s=t[7],l=t[8],c=t[9],f=t[10],h=t[11],p=t[12],d=t[13],m=t[14],g=t[15];return(n*i-e*a)*(f*g-h*m)-(n*u-r*a)*(c*g-h*d)+(n*s-o*a)*(c*m-f*d)+(e*u-r*i)*(l*g-h*p)-(e*s-o*i)*(l*m-f*p)+(r*s-o*u)*(l*d-c*p)},multiply:function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=n[6],c=n[7],f=n[8],h=n[9],p=n[10],d=n[11],m=n[12],g=n[13],v=n[14],y=n[15],b=e[0],x=e[1],M=e[2],w=e[3];return t[0]=b*r+x*u+M*f+w*m,t[1]=b*o+x*s+M*h+w*g,t[2]=b*a+x*l+M*p+w*v,t[3]=b*i+x*c+M*d+w*y,b=e[4],x=e[5],M=e[6],w=e[7],t[4]=b*r+x*u+M*f+w*m,t[5]=b*o+x*s+M*h+w*g,t[6]=b*a+x*l+M*p+w*v,t[7]=b*i+x*c+M*d+w*y,b=e[8],x=e[9],M=e[10],w=e[11],t[8]=b*r+x*u+M*f+w*m,t[9]=b*o+x*s+M*h+w*g,t[10]=b*a+x*l+M*p+w*v,t[11]=b*i+x*c+M*d+w*y,b=e[12],x=e[13],M=e[14],w=e[15],t[12]=b*r+x*u+M*f+w*m,t[13]=b*o+x*s+M*h+w*g,t[14]=b*a+x*l+M*p+w*v,t[15]=b*i+x*c+M*d+w*y,t}};p.mul=p.multiply,p.translate=function(t,n,e){var r,o,a,i,u,s,l,c,f,h,p,d,m=e[0],g=e[1],v=e[2];return n===t?(t[12]=n[0]*m+n[4]*g+n[8]*v+n[12],t[13]=n[1]*m+n[5]*g+n[9]*v+n[13],t[14]=n[2]*m+n[6]*g+n[10]*v+n[14],t[15]=n[3]*m+n[7]*g+n[11]*v+n[15]):(r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=n[6],c=n[7],f=n[8],h=n[9],p=n[10],d=n[11],t[0]=r,t[1]=o,t[2]=a,t[3]=i,t[4]=u,t[5]=s,t[6]=l,t[7]=c,t[8]=f,t[9]=h,t[10]=p,t[11]=d,t[12]=r*m+u*g+f*v+n[12],t[13]=o*m+s*g+h*v+n[13],t[14]=a*m+l*g+p*v+n[14],t[15]=i*m+c*g+d*v+n[15]),t},p.scale=function(t,n,e){var r=e[0],o=e[1],a=e[2];return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=n[3]*r,t[4]=n[4]*o,t[5]=n[5]*o,t[6]=n[6]*o,t[7]=n[7]*o,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=n[11]*a,t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},p.rotate=function(t,e,r,o){var a,i,u,s,l,c,f,h,p,d,m,g,v,y,b,x,M,w,_,k,S,A,E,T,R=o[0],N=o[1],P=o[2],C=Math.sqrt(R*R+N*N+P*P);return Math.abs(C)<n?null:(R*=C=1/C,N*=C,P*=C,a=Math.sin(r),u=1-(i=Math.cos(r)),s=e[0],l=e[1],c=e[2],f=e[3],h=e[4],p=e[5],d=e[6],m=e[7],g=e[8],v=e[9],y=e[10],b=e[11],x=R*R*u+i,M=N*R*u+P*a,w=P*R*u-N*a,_=R*N*u-P*a,k=N*N*u+i,S=P*N*u+R*a,A=R*P*u+N*a,E=N*P*u-R*a,T=P*P*u+i,t[0]=s*x+h*M+g*w,t[1]=l*x+p*M+v*w,t[2]=c*x+d*M+y*w,t[3]=f*x+m*M+b*w,t[4]=s*_+h*k+g*S,t[5]=l*_+p*k+v*S,t[6]=c*_+d*k+y*S,t[7]=f*_+m*k+b*S,t[8]=s*A+h*E+g*T,t[9]=l*A+p*E+v*T,t[10]=c*A+d*E+y*T,t[11]=f*A+m*E+b*T,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)},p.rotateX=function(t,n,e){var r=Math.sin(e),o=Math.cos(e),a=n[4],i=n[5],u=n[6],s=n[7],l=n[8],c=n[9],f=n[10],h=n[11];return n!==t&&(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[4]=a*o+l*r,t[5]=i*o+c*r,t[6]=u*o+f*r,t[7]=s*o+h*r,t[8]=l*o-a*r,t[9]=c*o-i*r,t[10]=f*o-u*r,t[11]=h*o-s*r,t},p.rotateY=function(t,n,e){var r=Math.sin(e),o=Math.cos(e),a=n[0],i=n[1],u=n[2],s=n[3],l=n[8],c=n[9],f=n[10],h=n[11];return n!==t&&(t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[0]=a*o-l*r,t[1]=i*o-c*r,t[2]=u*o-f*r,t[3]=s*o-h*r,t[8]=a*r+l*o,t[9]=i*r+c*o,t[10]=u*r+f*o,t[11]=s*r+h*o,t},p.rotateZ=function(t,n,e){var r=Math.sin(e),o=Math.cos(e),a=n[0],i=n[1],u=n[2],s=n[3],l=n[4],c=n[5],f=n[6],h=n[7];return n!==t&&(t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[0]=a*o+l*r,t[1]=i*o+c*r,t[2]=u*o+f*r,t[3]=s*o+h*r,t[4]=l*o-a*r,t[5]=c*o-i*r,t[6]=f*o-u*r,t[7]=h*o-s*r,t},p.fromRotationTranslation=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=r+r,s=o+o,l=a+a,c=r*u,f=r*s,h=r*l,p=o*s,d=o*l,m=a*l,g=i*u,v=i*s,y=i*l;return t[0]=1-(p+m),t[1]=f+y,t[2]=h-v,t[3]=0,t[4]=f-y,t[5]=1-(c+m),t[6]=d+g,t[7]=0,t[8]=h+v,t[9]=d-g,t[10]=1-(c+p),t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t},p.fromQuat=function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e+e,u=r+r,s=o+o,l=e*i,c=r*i,f=r*u,h=o*i,p=o*u,d=o*s,m=a*i,g=a*u,v=a*s;return t[0]=1-f-d,t[1]=c+v,t[2]=h-g,t[3]=0,t[4]=c-v,t[5]=1-l-d,t[6]=p+m,t[7]=0,t[8]=h+g,t[9]=p-m,t[10]=1-l-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},p.frustum=function(t,n,e,r,o,a,i){var u=1/(e-n),s=1/(o-r),l=1/(a-i);return t[0]=2*a*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*a*s,t[6]=0,t[7]=0,t[8]=(e+n)*u,t[9]=(o+r)*s,t[10]=(i+a)*l,t[11]=-1,t[12]=0,t[13]=0,t[14]=i*a*2*l,t[15]=0,t},p.perspective=function(t,n,e,r,o){var a=1/Math.tan(n/2),i=1/(r-o);return t[0]=a/e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(o+r)*i,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*o*r*i,t[15]=0,t},p.ortho=function(t,n,e,r,o,a,i){var u=1/(n-e),s=1/(r-o),l=1/(a-i);return t[0]=-2*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(n+e)*u,t[13]=(o+r)*s,t[14]=(i+a)*l,t[15]=1,t},p.lookAt=function(t,e,r,o){var a,i,u,s,l,c,f,h,d,m,g=e[0],v=e[1],y=e[2],b=o[0],x=o[1],M=o[2],w=r[0],_=r[1],k=r[2];return Math.abs(g-w)<n&&Math.abs(v-_)<n&&Math.abs(y-k)<n?p.identity(t):(f=g-w,h=v-_,d=y-k,a=x*(d*=m=1/Math.sqrt(f*f+h*h+d*d))-M*(h*=m),i=M*(f*=m)-b*d,u=b*h-x*f,(m=Math.sqrt(a*a+i*i+u*u))?(a*=m=1/m,i*=m,u*=m):(a=0,i=0,u=0),s=h*u-d*i,l=d*a-f*u,c=f*i-h*a,(m=Math.sqrt(s*s+l*l+c*c))?(s*=m=1/m,l*=m,c*=m):(s=0,l=0,c=0),t[0]=a,t[1]=s,t[2]=f,t[3]=0,t[4]=i,t[5]=l,t[6]=h,t[7]=0,t[8]=u,t[9]=c,t[10]=d,t[11]=0,t[12]=-(a*g+i*v+u*y),t[13]=-(s*g+l*v+c*y),t[14]=-(f*g+h*v+d*y),t[15]=1,t)},p.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},p.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2)+Math.pow(t[9],2)+Math.pow(t[10],2)+Math.pow(t[11],2)+Math.pow(t[12],2)+Math.pow(t[13],2)+Math.pow(t[14],2)+Math.pow(t[15],2))},void 0!==t&&(t.mat4=p);var d,m,g,v,y={};y.create=function(){var t=new e(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},y.rotationTo=(d=s.create(),m=s.fromValues(1,0,0),g=s.fromValues(0,1,0),function(t,n,e){var r=s.dot(n,e);return r<-.999999?(s.cross(d,m,n),s.length(d)<1e-6&&s.cross(d,g,n),s.normalize(d,d),y.setAxisAngle(t,d,Math.PI),t):r>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(s.cross(d,n,e),t[0]=d[0],t[1]=d[1],t[2]=d[2],t[3]=1+r,y.normalize(t,t))}),y.setAxes=(v=h.create(),function(t,n,e,r){return v[0]=e[0],v[3]=e[1],v[6]=e[2],v[1]=r[0],v[4]=r[1],v[7]=r[2],v[2]=-n[0],v[5]=-n[1],v[8]=-n[2],y.normalize(t,y.fromMat3(t,v))}),y.clone=l.clone,y.fromValues=l.fromValues,y.copy=l.copy,y.set=l.set,y.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},y.setAxisAngle=function(t,n,e){e*=.5;var r=Math.sin(e);return t[0]=r*n[0],t[1]=r*n[1],t[2]=r*n[2],t[3]=Math.cos(e),t},y.add=l.add,y.multiply=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=e[0],s=e[1],l=e[2],c=e[3];return t[0]=r*c+i*u+o*l-a*s,t[1]=o*c+i*s+a*u-r*l,t[2]=a*c+i*l+r*s-o*u,t[3]=i*c-r*u-o*s-a*l,t},y.mul=y.multiply,y.scale=l.scale,y.rotateX=function(t,n,e){e*=.5;var r=n[0],o=n[1],a=n[2],i=n[3],u=Math.sin(e),s=Math.cos(e);return t[0]=r*s+i*u,t[1]=o*s+a*u,t[2]=a*s-o*u,t[3]=i*s-r*u,t},y.rotateY=function(t,n,e){e*=.5;var r=n[0],o=n[1],a=n[2],i=n[3],u=Math.sin(e),s=Math.cos(e);return t[0]=r*s-a*u,t[1]=o*s+i*u,t[2]=a*s+r*u,t[3]=i*s-o*u,t},y.rotateZ=function(t,n,e){e*=.5;var r=n[0],o=n[1],a=n[2],i=n[3],u=Math.sin(e),s=Math.cos(e);return t[0]=r*s+o*u,t[1]=o*s-r*u,t[2]=a*s+i*u,t[3]=i*s-a*u,t},y.calculateW=function(t,n){var e=n[0],r=n[1],o=n[2];return t[0]=e,t[1]=r,t[2]=o,t[3]=Math.sqrt(Math.abs(1-e*e-r*r-o*o)),t},y.dot=l.dot,y.lerp=l.lerp,y.slerp=function(t,n,e,r){var o,a,i,u,s,l=n[0],c=n[1],f=n[2],h=n[3],p=e[0],d=e[1],m=e[2],g=e[3];return(a=l*p+c*d+f*m+h*g)<0&&(a=-a,p=-p,d=-d,m=-m,g=-g),1-a>1e-6?(o=Math.acos(a),i=Math.sin(o),u=Math.sin((1-r)*o)/i,s=Math.sin(r*o)/i):(u=1-r,s=r),t[0]=u*l+s*p,t[1]=u*c+s*d,t[2]=u*f+s*m,t[3]=u*h+s*g,t},y.invert=function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e*e+r*r+o*o+a*a,u=i?1/i:0;return t[0]=-e*u,t[1]=-r*u,t[2]=-o*u,t[3]=a*u,t},y.conjugate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=n[3],t},y.length=l.length,y.len=y.length,y.squaredLength=l.squaredLength,y.sqrLen=y.squaredLength,y.normalize=l.normalize,y.fromMat3=function(t,n){var e,r=n[0]+n[4]+n[8];if(r>0)e=Math.sqrt(r+1),t[3]=.5*e,e=.5/e,t[0]=(n[5]-n[7])*e,t[1]=(n[6]-n[2])*e,t[2]=(n[1]-n[3])*e;else{var o=0;n[4]>n[0]&&(o=1),n[8]>n[3*o+o]&&(o=2);var a=(o+1)%3,i=(o+2)%3;e=Math.sqrt(n[3*o+o]-n[3*a+a]-n[3*i+i]+1),t[o]=.5*e,e=.5/e,t[3]=(n[3*a+i]-n[3*i+a])*e,t[a]=(n[3*a+o]+n[3*o+a])*e,t[i]=(n[3*i+o]+n[3*o+i])*e}return t},y.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},void 0!==t&&(t.quat=y)}(e.exports)}()},function(t,n,e){"use strict";var r=e(7),o=e(6),a=e(22);function i(t,n,e){return Math.min(n,Math.max(t,e))}t.exports.new=function(){return{aspect:1,zoom:.125,translation:{x:0,y:0},atomScale:.6,relativeAtomScale:1,bondScale:.5,rotation:r.mat4.create(),ao:.75,aoRes:256,brightness:.5,outline:0,spf:32,bonds:!1,bondThreshold:1.2,bondShade:.5,atomShade:.5,resolution:768,dofStrength:0,dofPosition:.5,fxaa:1}},t.exports.center=function(t,n){for(var e=-1/0,a=1/0,i=-1/0,u=1/0,s=0;s<n.atoms.length;s++){var l=n.atoms[s],c=o[l.symbol].radius;c=2.5*t.atomScale*(1+(c-1)*t.relativeAtomScale);var f=r.vec4.fromValues(l.x,l.y,l.z,0);r.vec4.transformMat4(f,f,t.rotation),e=Math.max(e,f[0]+c),a=Math.min(a,f[0]-c),i=Math.max(i,f[1]+c),u=Math.min(u,f[1]-c)}var h=a+(e-a)/2,p=u+(i-u)/2;t.translation.x=h,t.translation.y=p;var d=Math.max(e-a,i-u);t.zoom=1/(1.01*d)},t.exports.override=function(t,n){for(var e in n)t[e]=n[e];l(t)},t.exports.clone=function(t){return s(u(t))};var u=t.exports.serialize=function(t){return JSON.stringify(t)},s=t.exports.deserialize=function(t){return(t=JSON.parse(t)).rotation=r.mat4.clone(t.rotation),t},l=t.exports.resolve=function(t){t.dofStrength=i(0,1,t.dofStrength),t.dofPosition=i(0,1,t.dofPosition),t.zoom=i(.001,2,t.zoom),t.atomScale=i(0,1,t.atomScale),t.relativeAtomScale=i(0,1,t.relativeAtomScale),t.bondScale=i(0,1,t.bondScale),t.bondShade=i(0,1,t.bondShade),t.atomShade=i(0,1,t.atomShade),t.ao=i(0,1,t.ao),t.brightness=i(0,1,t.brightness),t.outline=i(0,1,t.outline)};t.exports.translate=function(t,n,e){t.translation.x-=n/(t.resolution*t.zoom),t.translation.y+=e/(t.resolution*t.zoom),l(t)},t.exports.rotate=function(t,n,e){var o=r.mat4.create();r.mat4.rotateY(o,o,.005*n),r.mat4.rotateX(o,o,.005*e),r.mat4.multiply(t.rotation,o,t.rotation);var a=t.ao;t.ao=0,l(t),t.ao=a},t.exports.getRect=function(t){var n=1/t.zoom,e=n/t.aspect;return{bottom:-e/2+t.translation.y,top:e/2+t.translation.y,left:-n/2+t.translation.x,right:n/2+t.translation.x}},t.exports.getBondRadius=function(t){return t.bondScale*t.atomScale*(1+(a.MIN_ATOM_RADIUS-1)*t.relativeAtomScale)}},function(t,n,e){"use strict";e.d(n,"a",(function(){return a}));var r=e(3),o=e(4);function a(t){return function n(e,a){switch(arguments.length){case 0:return n;case 1:return Object(o.a)(e)?n:Object(r.a)((function(n){return t(e,n)}));default:return Object(o.a)(e)&&Object(o.a)(a)?n:Object(o.a)(e)?Object(r.a)((function(n){return t(n,a)})):Object(o.a)(a)?Object(r.a)((function(n){return t(e,n)})):t(e,a)}}}},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"c",(function(){return g})),e.d(n,"b",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.alignmentChart),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.propTypes={id:o.a.string,setProps:o.a.func,eventDatum:o.a.string,data:o.a.string,extension:o.a.string,colorscale:o.a.oneOfType([o.a.string,o.a.object]),opacity:o.a.oneOfType([o.a.number,o.a.string]),textcolor:o.a.string,textsize:o.a.oneOfType([o.a.number,o.a.string]),showlabel:o.a.bool,showid:o.a.bool,showconservation:o.a.bool,conservationcolor:o.a.string,conservationcolorscale:o.a.oneOfType([o.a.string,o.a.array]),conservationopacity:o.a.oneOfType([o.a.number,o.a.string]),conservationmethod:o.a.oneOf(["conservation","entropy"]),correctgap:o.a.bool,showgap:o.a.bool,gapcolor:o.a.string,gapcolorscale:o.a.oneOfType([o.a.string,o.a.array]),gapopacity:o.a.oneOfType([o.a.number,o.a.string]),groupbars:o.a.bool,showconsensus:o.a.bool,tilewidth:o.a.number,tileheight:o.a.number,overview:o.a.oneOf(["heatmap","slider","none"]),numtiles:o.a.number,scrollskip:o.a.number,tickstart:o.a.oneOfType([o.a.number,o.a.string]),ticksteps:o.a.oneOfType([o.a.number,o.a.string]),width:o.a.oneOfType([o.a.number,o.a.string]),height:o.a.oneOfType([o.a.number,o.a.string])},m.defaultProps={extension:"fasta",colorscale:"clustal2",opacity:null,textcolor:null,textsize:10,showlabel:!0,showid:!0,showconservation:!0,conservationcolor:null,conservationcolorscale:"Viridis",conservationopacity:null,conservationmethod:"entropy",correctgap:!0,showgap:!0,gapcolor:"grey",gapcolorscale:null,gapopacity:null,groupbars:!1,showconsensus:!0,tilewidth:16,tileheight:16,numtiles:null,overview:"heatmap",scrollskip:10,tickstart:null,ticksteps:null,width:null,height:900};var g=m.propTypes,v=m.defaultProps},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.ideogram),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.defaultProps={organism:"human",dataDir:"https://unpkg.com/ideogram@1.5.0/dist/data/bands/native/",annotationsColor:"#F00",annotationsLayout:"tracks",barWidth:3,chrHeight:400,chrMargin:10,chrWidth:10,ploidy:1,rotatable:!0,showBandLabels:!1,showChromosomeLabels:!0,showAnnotTooltip:!0,showFullyBanded:!0,showNonNuclearChromosomes:!1},m.propTypes={id:o.a.string.isRequired,style:o.a.object,setProps:o.a.func,className:o.a.string,annotationsLayout:o.a.oneOf(["tracks","histogram","overlay"]),annotations:o.a.arrayOf(o.a.shape({name:o.a.string,chr:o.a.string,start:o.a.number,stop:o.a.number})),annotationsPath:o.a.string,annotationsData:o.a.string,annotationTracks:o.a.arrayOf(o.a.object),annotationHeight:o.a.number,annotationsColor:o.a.string,histogramScaling:o.a.oneOf(["absolute","relative"]),barWidth:o.a.number,showAnnotTooltip:o.a.bool,assembly:o.a.string,brush:o.a.string,brushData:o.a.shape({start:o.a.string,end:o.a.string,extent:o.a.string}),container:o.a.string,chrHeight:o.a.number,chrMargin:o.a.number,chrWidth:o.a.number,chromosomes:o.a.oneOfType([o.a.arrayOf(o.a.string),o.a.object]),dataDir:o.a.string,organism:o.a.oneOfType([o.a.string,o.a.number]),localOrganism:o.a.object,homology:o.a.shape({chrOne:o.a.shape({organism:o.a.string.isRequired,start:o.a.arrayOf(o.a.number.isRequired),stop:o.a.arrayOf(o.a.number.isRequired)}),chrTwo:o.a.shape({organism:o.a.string.isRequired,start:o.a.arrayOf(o.a.number.isRequired),stop:o.a.arrayOf(o.a.number.isRequired)})}),perspective:o.a.oneOf(["comparative"]),fullChromosomeLabels:o.a.bool,resolution:o.a.number,filterable:o.a.bool,orientation:o.a.oneOf(["vertical","horizontal"]),ploidy:o.a.number,ploidyDesc:o.a.arrayOf(o.a.object),ancestors:o.a.object,rangeSet:o.a.arrayOf(o.a.object),rotatable:o.a.bool,rotated:o.a.bool,sex:o.a.oneOf(["male","female"]),showChromosomeLabels:o.a.bool,showBandLabels:o.a.bool,showFullyBanded:o.a.bool,showNonNuclearChromosomes:o.a.bool};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(1),o=e.n(r),a=e(2),i=e(0),u=e.n(i);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(r.lazy)(a.a.igv),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,a,i;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(a=[{key:"render",value:function(){return o.a.createElement(r.Suspense,{fallback:null},o.a.createElement(d,this.props))}}])&&c(e.prototype,a),i&&c(e,i),n}(r.Component);m.defaultProps={},m.propTypes={id:u.a.string,setProps:u.a.func,style:u.a.object,className:u.a.string,genome:u.a.string,reference:u.a.object,locus:u.a.string,minimumBases:u.a.number,tracks:u.a.array};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.molecule2dViewer),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.defaultProps={width:500,height:500,modelData:{nodes:[],links:[]}},m.propTypes={id:o.a.string,setProps:o.a.func,selectedAtomIds:o.a.arrayOf(o.a.number),width:o.a.number,height:o.a.number,modelData:o.a.shape({nodes:o.a.arrayOf(o.a.shape({id:o.a.number,atom:o.a.string})),links:o.a.arrayOf(o.a.shape({id:o.a.number,source:o.a.number|o.a.shape,target:o.a.number|o.a.shape,bond:o.a.number,strength:o.a.number,distance:o.a.number}))})};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.molecule3dViewer),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.defaultProps={selectionType:"atom",backgroundColor:"#FFFFFF",backgroundOpacity:0},m.propTypes={id:o.a.string,setProps:o.a.func,selectionType:o.a.oneOf(["atom","residue","chain"]),backgroundColor:o.a.string,backgroundOpacity:o.a.number,styles:o.a.arrayOf(o.a.shape({color:o.a.string,visualization_type:o.a.oneOf(["cartoon","sphere","stick"])})),modelData:o.a.shape({atoms:o.a.array,bonds:o.a.array}),atomLabelsShown:o.a.bool,selectedAtomIds:o.a.array,labels:o.a.array,onRenderNewData:o.a.func,onChangeSelection:o.a.func};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.needlePlot),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.propTypes={id:o.a.string,mutationData:o.a.shape({x:o.a.oneOfType([o.a.string,o.a.array]),y:o.a.oneOfType([o.a.string,o.a.array]),mutationGroups:o.a.arrayOf(o.a.string),domains:o.a.array}),xlabel:o.a.string,ylabel:o.a.string,rangeSlider:o.a.bool,needleStyle:o.a.shape({stemColor:o.a.string,stemThickness:o.a.number,stemConstHeight:o.a.bool,headSize:o.a.number,headColor:o.a.oneOfType([o.a.array,o.a.string]),headSymbol:o.a.oneOfType([o.a.array,o.a.string])}),domainStyle:o.a.shape({domainColor:o.a.array,displayMinorDomains:o.a.bool}),setProps:o.a.func},m.defaultProps={mutationData:{x:[],y:[],domains:[],mutationGroups:[]},rangeSlider:!1,needleStyle:{stemColor:"#444",stemThickness:.5,stemConstHeight:!1,headSize:5,headColor:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999","#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999","#e41a1c"],headSymbol:"circle"},domainStyle:{displayMinorDomains:!1,domainColor:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f","#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69"]}};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(1),o=e.n(r),a=e(2),i=e(0),u=e.n(i);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(r.lazy)(a.a.nglmoleculeViewer),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,a,i;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(a=[{key:"render",value:function(){return o.a.createElement(r.Suspense,{fallback:null},o.a.createElement(d,this.props))}}])&&c(e.prototype,a),i&&c(e,i),n}(r.Component);m.defaultProps={data:[{filename:"placeholder",ext:"",selectedValue:"placeholder",chain:"ALL",aaRange:"ALL",chosen:{chosenAtoms:"",chosenResidues:""},color:"red",config:{input:"",type:"text/plain"},uploaded:!1,resetView:!1}],width:"600px",height:"600px",stageParameters:{quality:"medium",backgroundColor:"white",cameraType:"perspective"},imageParameters:{antialias:!0,transparent:!0,trim:!0,defaultFilename:"dash-bio_ngl_output"},downloadImage:!1,molStyles:{representations:["cartoon","axes+box"],chosenAtomsColor:"#ffffff",chosenAtomsRadius:1,molSpacingXaxis:100,sideByside:!1}},m.propTypes={id:u.a.string,setProps:u.a.func,width:u.a.oneOfType([u.a.string,u.a.number]),height:u.a.oneOfType([u.a.string,u.a.number]),stageParameters:u.a.exact({quality:u.a.string,backgroundColor:u.a.string,cameraType:u.a.string}),imageParameters:u.a.exact({antialias:u.a.bool,transparent:u.a.bool,trim:u.a.bool,defaultFilename:u.a.string}),downloadImage:u.a.bool,pdbString:u.a.string,data:u.a.arrayOf(u.a.exact({filename:u.a.string.isRequired,ext:u.a.string,selectedValue:u.a.string.isRequired,chain:u.a.string.isRequired,aaRange:u.a.string.isRequired,color:u.a.string.isRequired,chosen:u.a.exact({residues:u.a.string.isRequired,atoms:u.a.string.isRequired}),config:u.a.exact({input:u.a.string.isRequired,type:u.a.string.isRequired}),uploaded:u.a.bool.isRequired,resetView:u.a.bool.isRequired})),molStyles:u.a.exact({representations:u.a.arrayOf(u.a.string),chosenAtomsColor:u.a.string.isRequired,chosenAtomsRadius:u.a.number.isRequired,molSpacingXaxis:u.a.number.isRequired,sideByside:u.a.bool.isRequired})};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.oncoPrint),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.propTypes={id:o.a.string,setProps:o.a.func,eventDatum:o.a.object,data:o.a.array,padding:o.a.number,colorscale:o.a.oneOfType([o.a.bool,o.a.object]),backgroundcolor:o.a.string,range:o.a.array,showlegend:o.a.bool,showoverview:o.a.bool,width:o.a.oneOfType([o.a.number,o.a.string]),height:o.a.oneOfType([o.a.number,o.a.string])},m.defaultProps={padding:.05,colorscale:null,backgroundcolor:"rgb(190, 190, 190)",range:[null,null],showlegend:!0,showoverview:!0,width:null,height:500};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.sequenceViewer),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.defaultProps={sequence:"-",showLineNumbers:!0,wrapAminoAcids:!0,charsPerLine:40,toolbar:!1,search:!0,title:"",sequenceMaxHeight:"400px",badge:!0,selection:[],coverage:[]},m.propTypes={id:o.a.string,sequence:o.a.string,showLineNumbers:o.a.bool,wrapAminoAcids:o.a.bool,charsPerLine:o.a.number,toolbar:o.a.bool,search:o.a.bool,title:o.a.string,sequenceMaxHeight:o.a.string,badge:o.a.bool,selection:function(t,n,e){if(void 0!==t[n]&&(void 0!==t[n][0]&&"number"!=typeof t[n][0]||void 0!==t[n][1]&&"number"!=typeof t[n][1]||void 0!==t[n][2]&&"string"!=typeof t[n][2]))return new Error("Invalid prop value. Selection should be an array with type [number, number, string].")},coverage:o.a.arrayOf(o.a.shape({start:o.a.number,end:o.a.number,color:o.a.string,bgcolor:o.a.string,tooltip:o.a.string,underscore:o.a.bool,onclick:o.a.func})),legend:o.a.arrayOf(o.a.shape({name:o.a.string,color:o.a.string,underscore:o.a.bool})),coverageClicked:o.a.number,mouseSelection:o.a.shape({start:o.a.number,end:o.a.number,selection:o.a.string}),subpartSelected:o.a.arrayOf(o.a.shape({start:o.a.number,end:o.a.number,sequence:o.a.string})),setProps:o.a.func};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return g})),e.d(n,"b",(function(){return v})),e.d(n,"c",(function(){return y}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2),s=e(21);function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function f(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function h(t,n){return!n||"object"!==l(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function d(t,n){return(d=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var m=Object(a.lazy)(u.a.speck),g=function(t){function n(){return c(this,n),h(this,p(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&d(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(m,this.props))}}])&&f(e.prototype,r),o&&f(e,o),n}(a.Component);g.defaultProps={view:s.speckView.new(),data:[]},g.propTypes={id:o.a.string,data:o.a.arrayOf(o.a.shape({symbol:o.a.string,x:o.a.number,y:o.a.number,z:o.a.number})),scrollZoom:o.a.bool,view:o.a.shape({aspect:o.a.number,zoom:o.a.number,translation:o.a.shape({x:o.a.number,y:o.a.number}),atomScale:o.a.number,relativeAtomScale:o.a.number,bondScale:o.a.number,rotation:o.a.shape({}),ao:o.a.number,aoRes:o.a.number,brightness:o.a.number,outline:o.a.number,spf:o.a.number,bonds:o.a.bool,bondThreshold:o.a.number,bondShade:o.a.number,atomShade:o.a.number,resolution:o.a.number,dofStrength:o.a.number,dofPosition:o.a.number,fxaa:o.a.number}),presetView:o.a.oneOf(["default","stickball","toon","licorice"]),setProps:o.a.func};var v=g.defaultProps,y=g.propTypes},function(t,n,e){"use strict";var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2),s=["CHORDS","HEATMAP","HIGHLIGHT","HISTOGRAM","LINE","SCATTER","STACK","TEXT"];function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function f(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function h(t,n){return!n||"object"!==l(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function d(t,n){return(d=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}e.d(n,"a",(function(){return g})),e.d(n,"c",(function(){return v})),e.d(n,"b",(function(){return y}));var m=Object(a.lazy)(u.a.circos),g=function(t){function n(){return c(this,n),h(this,p(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&d(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(m,this.props))}}])&&f(e.prototype,r),o&&f(e,o),n}(a.Component);g.defaultProps={config:{},size:800,tracks:[]},g.propTypes={enableDownloadSVG:o.a.bool,enableZoomPan:o.a.bool,id:o.a.string,style:o.a.object,eventDatum:o.a.object,selectEvent:o.a.object,setProps:o.a.func,layout:o.a.arrayOf(o.a.shape({len:o.a.number.isRequired,color:o.a.string.isRequired,label:o.a.string.isRequired,id:o.a.string.isRequired})).isRequired,config:o.a.object,size:o.a.number,tracks:o.a.arrayOf(o.a.shape({id:o.a.string,data:o.a.array.isRequired,config:o.a.object,type:o.a.oneOf(s),tooltipContent:o.a.oneOfType([o.a.string,o.a.shape({name:o.a.string.isRequired}),o.a.shape({source:o.a.string.isRequired,sourceID:o.a.string,target:o.a.string.isRequired,targetEnd:o.a.string.isRequired,targetID:o.a.string})]),color:o.a.oneOfType([o.a.string,o.a.shape({name:o.a.string.isRequired})])}))};var v=g.propTypes,y=g.defaultProps},function(t,n,e){var r=e(27),o=e(23),a=e(8),i=e(31),u=e(32);t.exports={speckRenderer:r,speckSystem:o,speckView:a,speckInteractions:i,speckPresetViews:u}},function(t,n,e){"use strict";for(var r=e(6),o=1/0,a=-1/0,i=0;i<=118;i++)o=Math.min(o,r[i].radius),a=Math.max(a,r[i].radius);t.exports.MIN_ATOM_RADIUS=o,t.exports.MAX_ATOM_RADIUS=a},function(t,n,e){"use strict";var r=e(7),o=e(6),a=e(22),i=(t.exports.new=function(){return{atoms:[],farAtom:void 0,bonds:[]}},t.exports.calculateBonds=function(t){var n=[],e=t.atoms.slice();e.sort((function(t,n){return t.z-n.z}));for(var i=0;i<e.length;i++)for(var u=e[i],s=i+1;s<e.length&&e[s].z<e[i].z+5*a.MAX_ATOM_RADIUS;){var l=e[s],c=r.vec3.fromValues(u.x,u.y,u.z),f=r.vec3.fromValues(l.x,l.y,l.z),h=r.vec3.distance(c,f),p=o[u.symbol],d=o[l.symbol];h<2.5*(p.radius+d.radius)&&n.push({posA:{x:u.x,y:u.y,z:u.z},posB:{x:l.x,y:l.y,z:l.z},radA:p.radius,radB:d.radius,colA:{r:p.color[0],g:p.color[1],b:p.color[2]},colB:{r:d.color[0],g:d.color[1],b:d.color[2]},cutoff:h/(p.radius+d.radius)}),s++}n.sort((function(t,n){return t.cutoff-n.cutoff})),t.bonds=n},t.exports.addAtom=function(t,n,e,r,o){t.atoms.push({symbol:n,x:e,y:r,z:o})},t.exports.getCentroid=function(t){for(var n=0,e=0,r=0,o=0;o<t.atoms.length;o++)n+=t.atoms[o].x,e+=t.atoms[o].y,r+=t.atoms[o].z;return{x:n/t.atoms.length,y:e/t.atoms.length,z:r/t.atoms.length}}),u=(t.exports.center=function(t){for(var n=i(t),e=0;e<t.atoms.length;e++){var r=t.atoms[e];r.x-=n.x,r.y-=n.y,r.z-=n.z}},t.exports.getFarAtom=function(t){if(void 0!==t.farAtom)return t.farAtom;t.farAtom=t.atoms[0];for(var n=0,e=0;e<t.atoms.length;e++){var r=t.atoms[e],a=o[r.symbol].radius,i=2.5*Math.sqrt(a*a+a*a+a*a),u=Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z)+i;u>n&&(n=u,t.farAtom=r)}return t.farAtom});t.exports.getRadius=function(t){var n=u(t),e=a.MAX_ATOM_RADIUS,r=2.5*Math.sqrt(e*e+e*e+e*e);return Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z)+r}},function(t,n,e){var o;o=function(){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}return e.m=t,e.c=n,e.p="",e(0)}([function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.rnaPlot=n.RNAGraph=void 0;var o=e(1);Object.defineProperty(n,"RNAGraph",{enumerable:!0,get:function(){return o.RNAGraph}});var a=e(3);Object.defineProperty(n,"rnaPlot",{enumerable:!0,get:function(){return a.rnaPlot}}),n.FornaContainer=function(t,n){var e=this;if(e.options={displayAllLinks:!1,labelInterval:10,applyForce:!0,chargeDistance:110,friction:.35,middleCharge:-30,otherCharge:-30,linkDistanceMultiplier:15,initialSize:null,layout:"standard-polygonal",allowPanningAndZooming:!0,transitionDuration:500,resizeSvgOnResize:!0},arguments.length>1)for(var a in n)e.options.hasOwnProperty(a)&&(e.options[a]=n[a]);null!==e.options.initialSize?(e.options.svgW=e.options.initialSize[0],e.options.svgH=e.options.initialSize[1]):(e.options.svgW=800,e.options.svgH=800),l.default.scale.category20();var u=null,s=null,p=l.default.scale.linear().domain([0,e.options.svgW]).range([0,e.options.svgW]),d=l.default.scale.linear().domain([0,e.options.svgH]).range([0,e.options.svgH]),m=e.graph={nodes:[],links:[]};function g(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function v(t){var n=t,e=t.prevNode;if(null!==e&&t.linked){var r=[-(n.x-e.x),-(n.y-e.y)],o=[-(r=[r[0]/g(r),r[1]/g(r)])[1],r[0]],a=[t.radius*r[0],t.radius*r[1]],i="M"+(a[0]+6*(r[0]+o[0])/2)+","+(a[1]+6*(r[1]+o[1])/2)+"L"+a[0]+","+a[1]+"L"+(a[0]+6*(r[0]-o[0])/2)+","+(a[1]+6*(r[1]-o[1])/2);l.default.select(this).attr("d",i)}}function y(t){return"basepair"==t.linkType||"backbone"==t.linkType||"pseudoknot"==t.linkType||"label_link"==t.linkType||"external"==t.linkType||"chain_chain"==t.linkType}function b(t,n,e){if(t.hasOwnProperty(n.num)){var r=parseFloat(t[n.num]);return isNaN(r)?t[n.num]:e(r)}return"white"}function x(){}function M(){u&&(mpos=l.default.mouse(A.node()),P.attr("x1",u.x).attr("y1",u.y).attr("x2",mpos[0]).attr("y2",mpos[1]))}function w(){u&&P.attr("class","drag_line_hidden"),C()}e.linkStrengths={pseudoknot:0,proteinChain:0,chainChain:0,intermolecule:10,external:0,other:10},e.displayParameters={displayBackground:"true",displayNumbering:"true",displayNodeOutline:"true",displayNodeLabel:"true",displayLinks:"true",displayPseudoknotLinks:"true",displayProteinLinks:"true"},e.colorScheme="structure",e.customColors={},e.animation=e.options.applyForce,e.deaf=!1,e.rnas={},e.extraLinks=[],Array.prototype.equals=function(t){if(!t)return!1;if(this.length!=t.length)return!1;for(var n=0,e=this.length;n<e;n++)if(this[n]instanceof Array&&t[n]instanceof Array){if(!this[n].equals(t[n]))return!1}else if(this[n]!=t[n])return!1;return!0},e.createInitialLayout=function(t,n){var r={sequence:"",name:"empty",positions:[],labelInterval:e.options.labelInterval,avoidOthers:!0,uids:[],circularizeExternal:!0};if(2==arguments.length)for(var a in n)r.hasOwnProperty(a)&&(r[a]=n[a]);var i=new o.RNAGraph(r.sequence,t,r.name);i.circularizeExternal=r.circularizeExternal;var u=i.recalculateElements();if(0===r.positions.length)if("naview"==e.options.layout){var s=new h.NAView,l=s.naview_xy_coordinates(i.pairtable);r.positions=[];for(var f=0;f<l.nbase;f++)r.positions.push([l.x[f],l.y[f]])}else r.positions=(0,c.simpleXyCoordinates)(u.pairtable);return u=u.elementsToJson().addUids(r.uids).addPositions("nucleotide",r.positions).addLabels(1,r.labelInterval).reinforceStems().reinforceLoops().connectFakeNodes().reassignLinkUids().breakNodesToFakeNodes()},e.addRNA=function(t,n){var r=e.createInitialLayout(t,n);if(1===arguments.length&&(n={}),"extraLinks"in n){var o=e.addExternalLinks(r,n.extraLinks);e.extraLinks=e.extraLinks.concat(o)}return"avoidOthers"in n?e.addRNAJSON(r,n.avoidOthers):e.addRNAJSON(r,!0),r},e.addExternalLinks=function(t,n){for(var e=[],r=0;r<n.length;r++){var o={linkType:"external",value:1,uid:generateUUID(),source:null,target:null};if("[object Array]"===Object.prototype.toString.call(n[r][0])){for(var a=0;a<t.nodes.length;a++)if("nucs"in t.nodes[a]&&t.nodes[a].nucs.equals(n[r][0])){o.source=t.nodes[a];break}}else for(a=0;a<t.nodes.length;a++)t.nodes[a].num==n[r][0]&&(o.source=t.nodes[a]);if("[object Array]"===Object.prototype.toString.call(n[r][1]))for(a=0;a<t.nodes.length;a++)"nucs"in t.nodes[a]&&t.nodes[a].nucs.equals(n[r][1])&&(o.target=t.nodes[a]);else for(a=0;a<t.nodes.length;a++)t.nodes[a].num==n[r][1]&&(o.target=t.nodes[a]);null!=o.source&&null!=o.target?e.push(o):console.log("ERROR: source or target of new link not found:",o,n[r])}return e},e.addRNAJSON=function(t,n){var r,o;return n&&(r=e.graph.nodes.length>0?l.default.max(e.graph.nodes.map((function(t){return t.x}))):0,o=l.default.min(t.nodes.map((function(t){return t.x}))),t.nodes.forEach((function(t){t.x+=r-o+20,t.px+=r-o}))),t.nodes.forEach((function(n){n.rna=t})),e.rnas[t.uid]=t,e.recalculateGraph(),e.update(),e.centerView(),t},e.transitionRNA=function(t,n){var r=e.options.transitionDuration,o={uids:e.graph.nodes.filter((function(t){return"nucleotide"==t.nodeType})).map((function(t){return t.uid}))},a=e.createInitialLayout(t,o),i=T.selectAll("g.gnode").data(a.nodes,Y);0===(r=e.options.transitionDuration)?i.attr("transform",(function(t){return"translate("+[t.x,t.y]+")"})):i.transition().attr("transform",(function(t){return"translate("+[t.x,t.y]+")"})).duration(r);var u=E.selectAll("line.link").data(a.links.filter(y),X),s=e.createNewNodes(i.enter()).attr("transform",(function(t){return void 0!==t.x&&void 0!==t.y?"translate("+[0,0]+")":""}));0===r?i.exit().remove():i.exit().transition().attr("transform",(function(t){return void 0!==t.x&&void 0!==t.y?"translate("+[0,0]+")":""})),i.select("path").each(v),e.graph.nodes=i.data(),e.updateStyle(),e.centerView(r),u.exit().remove(),0===r?(u.attr("x1",(function(t){return t.source.x})).attr("y1",(function(t){return t.source.y})).attr("x2",(function(t){return t.target.x})).attr("y2",(function(t){return t.target.y})),e.createNewLinks(u.enter()),e.graph.links=u.data(),e.updateStyle()):u.transition().attr("x1",(function(t){return t.source.x})).attr("y1",(function(t){return t.source.y})).attr("x2",(function(t){return t.target.x})).attr("y2",(function(t){return t.target.y})).duration(r).call((function(t,n){0===t.size()&&setTimeout(n,r);var e=0;t.each((function(){++e})).each("end",(function(){--e||n.apply(this,arguments)}))}),(function(){e.createNewLinks(u.enter()),e.graph.links=u.data(),e.updateStyle(),void 0!==n&&n()})),0===r?s.attr("transform",(function(t){return void 0!==t.x&&void 0!==t.y?"translate("+[t.x,t.y]+")":""})):s.transition().attr("transform",(function(t){return void 0!==t.x&&void 0!==t.y?"translate("+[t.x,t.y]+")":""}))},e.recalculateGraph=function(){for(var t in e.graph.nodes=[],e.graph.links=[],e.rnas)e.graph.nodes=e.graph.nodes.concat(e.rnas[t].nodes),e.graph.links=e.graph.links.concat(e.rnas[t].links);for(var n={},r=0;r<e.graph.nodes.length;r++)n[e.graph.nodes[r].uid]=e.graph.nodes[r];for(e.graph.links.forEach((function(t){t.source=n[t.source.uid],t.target=n[t.target.uid]})),r=0;r<e.extraLinks.length;r++){if(e.extraLinks[r].target.uid in n||console.log("not there:",e.extraLinks[r]),e.extraLinks[r].source=n[e.extraLinks[r].source.uid],e.extraLinks[r].target=n[e.extraLinks[r].target.uid],"intermolecule"==e.extraLinks[r].linkType){fakeLinks=e.graph.links.filter((function(t){return(t.source==e.extraLinks[r].source||t.source==e.extraLinks[r].target||t.target==e.extraLinks[r].source||t.target==e.extraLinks[r].source)&&"fake"==t.linkType}));for(var o=0;o<fakeLinks.length;o++){var a=e.graph.links.indexOf(fakeLinks[o]);e.graph.links.splice(a,1)}}m.links.push(e.extraLinks[r])}},e.addNodes=function(t){t.links.forEach((function(n){"number"==typeof n.source&&(n.source=t.nodes[n.source]),"number"==typeof n.target&&(n.target=t.nodes[n.target])})),e.graph.nodes.length>0?(maxX=l.default.max(e.graph.nodes.map((function(t){return t.x}))),maxY=l.default.max(e.graph.nodes.map((function(t){return t.y})))):(maxX=0,maxY=0),t.nodes.forEach((function(t){t.rna.uid in e.rnas||(e.rnas[t.rna.uid]=t.rna),t.x+=maxX,t.px+=maxX})),r=new o.RNAGraph("",""),r.nodes=t.nodes,r.links=t.links,e.recalculateGraph(),e.update(),e.centerView()},e.addCustomColors=function(t){e.customColors=t},e.addCustomColorsText=function(t){var n=new f.ColorScheme(t);e.customColors=n.colorsJson,e.changeColorScheme("custom")},e.clearNodes=function(){e.graph.nodes=[],e.graph.links=[],e.rnas={},e.extraLinks=[],e.update()},e.toJSON=function(){var t={rnas:e.rnas,extraLinks:e.extraLinks};return JSON.stringify(t,(function(t,n){return"rna"==t?void 0:n}),"\t")},e.fromJSON=function(t){var n,a;try{var i=JSON.parse(t);n=i.rnas,a=i.extraLinks}catch(t){throw t}for(var u in n)"rna"==n[u].type?(r=new o.RNAGraph,r.seq=n[u].seq,r.dotbracket=n[u].dotbracket,r.circular=n[u].circular,r.pairtable=n[u].pairtable,r.uid=n[u].uid,r.structName=n[u].structName,r.nodes=n[u].nodes,r.links=n[u].links,r.rnaLength=n[u].rnaLength,r.elements=n[u].elements,r.nucsToNodes=n[u].nucsToNodes,r.pseudoknotPairs=n[u].pseudoknotPairs):(r=new ProteinGraph,r.size=n[u].size,r.nodes=n[u].nodes,r.uid=n[u].uid),e.addRNAJSON(r,!1);a.forEach((function(t){e.extraLinks.push(t)})),e.recalculateGraph(),e.update()},e.setSize=function(){if(null==e.options.initialSize){var n=l.default.select(t).node().offsetHeight,r=l.default.select(t).node().offsetWidth;e.options.svgW=r,e.options.svgH=n,p.range([0,r]).domain([0,r]),d.range([0,n]).domain([0,n]),e.zoomer.x(p).y(d),e.brusher.x(p).y(d),e.centerView(),e.options.resizeSvgOnResize&&_.attr("width",r).attr("height",n)}},e.setOutlineColor=function(t){T.selectAll("g.gnode").select("[node_type=nucleotide]").style("fill",t)},e.changeColorScheme=function(t){T.selectAll("[node_type=protein]").classed("protein",!0).attr("r",(function(t){return t.radius})),T.selectAll("g.gnode"),T.selectAll("g.gnode").selectAll("circle");var n=T.selectAll("g.gnode").select("[node_type=nucleotide]");if(e.colorScheme=t,"sequence"==t){var r=l.default.scale.ordinal().range(["#dbdb8d","#98df8a","#ff9896","#aec7e8","#aec7e8"]).domain(["A","C","G","U","T"]);n.style("fill",(function(t){return r(t.name)}))}else"structure"==t?(r=l.default.scale.category10().domain(["s","m","i","e","t","h","x"]).range(["lightgreen","#ff9896","#dbdb8d","lightsalmon","lightcyan","lightblue","transparent"]),n.style("fill",(function(t){return r(t.elemType)}))):"positions"==t?n.style("fill",(function(t){return l.default.scale.linear().range(["#98df8a","#dbdb8d","#ff9896"]).interpolate(l.default.interpolateLab).domain([1,1+(t.rna.rnaLength-1)/2,t.rna.rnaLength])(t.num)})):"custom"==t&&(void 0!==e.customColors&&"domain"in e.customColors&&"range"in e.customColors&&(r=l.default.scale.linear().interpolate(l.default.interpolateLab).domain(e.customColors.domain).range(e.customColors.range)),n.style("fill",(function(t){return void 0!==e.customColors&&e.customColors.hasOwnProperty("colorValues")?e.customColors.colorValues.hasOwnProperty(t.structName)&&e.customColors.colorValues[t.structName].hasOwnProperty(t.num)?b(e.customColors.colorValues[t.structName],t,r):e.customColors.colorValues.hasOwnProperty("")?b(e.customColors.colorValues[""],t,r):"white":"white"})))},window.addEventListener("resize",e.setSize,!1),e.zoomer=l.default.behavior.zoom().scaleExtent([.1,10]).x(p).y(d).on("zoomstart",R).on("zoom",N),l.default.select(t).select("svg").remove();var _=l.default.select(t).classed("forna-container",!0).attr("tabindex",1).on("keydown.brush",B).on("keyup.brush",I).each((function(){this.focus()})).append("svg:svg").attr("width",e.options.svgW).attr("height",e.options.svgH).attr("id","plotting-area");e.options.svg=_;var k=_.append("svg:g").on("mousemove",M).on("mousedown",x).on("mouseup",w);e.options.allowPanningAndZooming&&k.call(e.zoomer);var S=k.append("g").datum((function(){return{selected:!1,previouslySelected:!1}})).attr("class","brush"),A=k.append("svg:g"),E=A.append("svg:g"),T=A.append("svg:g");function R(){var t=T.selectAll("g.gnode").selectAll(".outline_node");t.each((function(t){t.selected=!1,t.previouslySelected=!1})),t.classed("selected",!1)}function N(){A.attr("transform","translate("+l.default.event.translate+") scale("+l.default.event.scale+")")}e.brusher=l.default.svg.brush().x(p).y(d).on("brushstart",(function(t){T.selectAll("g.gnode").selectAll(".outline_node").each((function(t){t.previouslySelected=L&&t.selected}))})).on("brush",(function(){var t=T.selectAll("g.gnode").selectAll(".outline_node"),n=l.default.event.target.extent();t.classed("selected",(function(t){return t.selected=e.options.applyForce&&t.previouslySelected^(n[0][0]<=t.x&&t.x<n[1][0]&&n[0][1]<=t.y&&t.y<n[1][1])}))})).on("brushend",(function(){l.default.event.target.clear(),l.default.select(this).call(l.default.event.target)})),S.call(e.brusher).on("mousedown.brush",null).on("touchstart.brush",null).on("touchmove.brush",null).on("touchend.brush",null),S.select(".background").style("cursor","auto"),e.getBoundingBoxTransform=function(){if(0===e.graph.nodes.length)return{translate:[0,0],scale:1};var t=l.default.min(e.graph.nodes.map((function(t){return t.x}))),n=l.default.min(e.graph.nodes.map((function(t){return t.y}))),r=l.default.max(e.graph.nodes.map((function(t){return t.x})))-t,o=l.default.max(e.graph.nodes.map((function(t){return t.y})))-n,a=e.options.svgW/(r+1),i=e.options.svgH/(o+1),u=.8*Math.min(a,i),s=r*u,c=o*u;return{translate:[-t*u+(e.options.svgW-s)/2,-n*u+(e.options.svgH-c)/2],scale:u}},e.centerView=function(t){0===arguments.length&&(t=0);var n=e.getBoundingBoxTransform();null!==n&&(A.transition().attr("transform","translate("+n.translate+") scale("+n.scale+")").duration(t),e.zoomer.translate(n.translate),e.zoomer.scale(n.scale))},e.force=l.default.layout.force().charge((function(t){return"middle"==t.nodeType?e.options.middleCharge:e.options.otherCharge})).friction(e.options.friction).linkDistance((function(t){return e.options.linkDistanceMultiplier*t.value})).linkStrength((function(t){return t.linkType in e.linkStrengths?e.linkStrengths[t.linkType]:e.linkStrengths.other})).gravity(0).nodes(e.graph.nodes).links(e.graph.links).chargeDistance(e.options.chargeDistance).size([e.options.svgW,e.options.svgH]);var P=A.append("line").attr("class","drag_line").attr("x1",0).attr("y1",0).attr("x2",0).attr("y2",0);function C(){u=null,s=null}var O=!1,L=!1;function U(t){var n=T.selectAll("g.gnode");return n.filter((function(t){return t.selected}))}function D(t){l.default.event.sourceEvent.stopPropagation(),t.selected||L||T.selectAll("g.gnode").selectAll(".outline_node").classed("selected",(function(t){return t.selected=e.options.applyForce&&(t.previouslySelected=!1)})),l.default.select(this).select(".outline_node").classed("selected",(function(n){return t.previouslySelected=t.selected,t.selected=e.options.applyForce&&!0})),U().each((function(t){t.fixed|=2}))}function z(t){U().each((function(t){t.x+=l.default.event.dx,t.y+=l.default.event.dy,t.px+=l.default.event.dx,t.py+=l.default.event.dy})),e.resumeForce(),l.default.event.sourceEvent.preventDefault()}function q(t){U().each((function(t){t.fixed&=-7}))}function j(t){var n=t.radius+16,e=t.x-n,r=t.x+n,o=t.y-n,a=t.y+n;return function(n,i,u,s,l){if(n.point&&n.point!==t){var c=t.x-n.point.x,f=t.y-n.point.y,h=Math.sqrt(c*c+f*f),p=t.radius+n.point.radius;h<p&&(h=(h-p)/h*.1,t.x-=c*=h,t.y-=f*=h,n.point.x+=c,n.point.y+=f)}return i>r||s<e||u>a||l<o}}e.resumeForce=function(){e.animation&&e.force.resume()};var F=l.default.behavior.drag().on("dragstart",D).on("drag",z).on("dragend",q);function B(){if(!e.deaf&&!O){switch(l.default.event.keyCode){case 16:O=!0;break;case 17:L=!0;break;case 67:e.centerView()}(O||L)&&(k.call(e.zoomer).on("mousedown.zoom",null).on("touchstart.zoom",null).on("touchmove.zoom",null).on("touchend.zoom",null),A.selectAll("g.gnode").on("mousedown.drag",null)),L&&(S.select(".background").style("cursor","crosshair"),S.call(e.brusher))}}function I(){O=!1,L=!1,S.call(e.brusher).on("mousedown.brush",null).on("touchstart.brush",null).on("touchmove.brush",null).on("touchend.brush",null),S.select(".background").style("cursor","auto"),k.call(e.zoomer),A.selectAll("g.gnode").call(F)}l.default.select(t).on("keydown",B).on("keyup",I).on("contextmenu",(function(){l.default.event.preventDefault()}));var X=function(t){return t.uid},Y=function(t){return t.uid},V=function(t){var n=t.getPositions("nucleotide"),r=t.getPositions("label"),o=t.getUids();t.recalculateElements().elementsToJson().addPseudoknots().addPositions("nucleotide",n).addUids(o).addLabels(1,e.options.labelInterval).addPositions("label",r).reinforceStems().reinforceLoops().updateLinkUids()},H=function(t){if(index=e.graph.links.indexOf(t),index>-1){if(t.source.rna==t.target.rna){var n=t.source.rna;n.addPseudoknots(),n.pairtable[t.source.num]=0,n.pairtable[t.target.num]=0,V(n)}else extraLinkIndex=e.extraLinks.indexOf(t),e.extraLinks.splice(extraLinkIndex,1);e.recalculateGraph()}e.update()},G=function(t){O&&(t.linkType in{backbone:!0,fake:!0,fake_fake:!0,label_link:!0}||H(t))};e.addLink=function(t){t.source.rna==t.target.rna?(r=t.source.rna,r.pairtable[t.source.num]=t.target.num,r.pairtable[t.target.num]=t.source.num,V(r)):(t.linkType="intermolecule",e.extraLinks.push(t)),e.recalculateGraph(),e.update()};var W=function(t){l.default.event.defaultPrevented||(L||T.selectAll("g.gnode").selectAll(".outline_node").classed("selected",(function(t){return t.selected=e.options.applyForce&&(t.previouslySelected=!1)})),l.default.select(this).select("circle").classed("selected",t.selected=e.options.applyForce&&!t.previouslySelected))},Z=function(t){if(u){if((s=t)==u)return void C();var n={source:u,target:s,linkType:"basepair",value:1,uid:generateUUID()};for(i=0;i<e.graph.links.length;i++){if(!(e.graph.links[i].source!=u&&e.graph.links[i].target!=u&&e.graph.links[i].source!=s&&e.graph.links[i].target!=s||"basepair"!=e.graph.links[i].linkType&&"pseudoknot"!=e.graph.links[i].linkType))return;if((e.graph.links[i].source==s&&e.graph.links[i].target==u||e.graph.links[i].source==u&&e.graph.links[i].target==s)&&"backbone"==e.graph.links[i].linkType)return}if("middle"==s.nodeType||"middle"==u.nodeType||"label"==s.nodeType||"label"==u.nodeType)return;e.addLink(n)}},J=function(t){t.selected||L||T.selectAll("g.gnode").selectAll(".outline_node").classed("selected",(function(t){return t.selected=t.previouslySelected=!1})),l.default.select(this).classed("selected",(function(n){return t.previouslySelected=t.selected,t.selected=e.options.applyForce&&!0})),O&&(u=t,P.attr("class","drag_line").attr("x1",u.x).attr("y1",u.y).attr("x2",u.x).attr("y2",u.y))};e.startAnimation=function(){e.animation=!0,A.selectAll("g.gnode").call(F),e.force.start()},e.stopAnimation=function(){e.animation=!1,A.selectAll("g.gnode").on("mousedown.drag",null),e.force.stop()},e.setFriction=function(t){e.force.friction(t),e.resumeForce()},e.setCharge=function(t){e.force.charge(t),e.resumeForce()},e.setGravity=function(t){e.force.gravity(t),e.resumeForce()},e.setPseudoknotStrength=function(t){e.linkStrengths.pseudoknot=t,e.update()},e.displayBackground=function(t){e.displayParameters.displayBackground=t,e.updateStyle()},e.displayNumbering=function(t){e.displayParameters.displayNumbering=t,e.updateStyle()},e.displayNodeOutline=function(t){e.displayParameters.displayNodeOutline=t,e.updateStyle()},e.displayNodeLabel=function(t){e.displayParameters.displayNodeLabel=t,e.updateStyle()},e.displayLinks=function(t){e.displayParameters.displayLinks=t,e.updateStyle()},e.displayPseudoknotLinks=function(t){e.displayParameters.displayPseudoknotLinks=t,e.updateStyle()},e.displayProteinLinks=function(t){e.displayParameters.displayProteinLinks=t,e.updateStyle()},e.updateStyle=function(){T.selectAll("[node_type=label]").classed("transparent",!e.displayParameters.displayNumbering),T.selectAll("[label_type=label]").classed("transparent",!e.displayParameters.displayNumbering),E.selectAll("[linkType=label_link]").classed("transparent",!e.displayParameters.displayNumbering),_.selectAll("circle").classed("hidden_outline",!e.displayParameters.displayNodeOutline),T.selectAll("[label_type=nucleotide]").classed("transparent",!e.displayParameters.displayNodeLabel),_.selectAll("[link_type=real],[link_type=basepair],[link_type=backbone],[link_type=pseudoknot],[link_type=protein_chain],[link_type=chain_chain],[link_type=external]").classed("transparent",!e.displayParameters.displayLinks),_.selectAll("[link_type=pseudoknot]").classed("transparent",!e.displayParameters.displayPseudoknotLinks),_.selectAll("[link_type=protein_chain]").classed("transparent",!e.displayParameters.displayProteinLinks),E.selectAll("[link_type=fake]").classed("transparent",!e.options.displayAllLinks),E.selectAll("[link_type=fake_fake]").classed("transparent",!e.options.displayAllLinks)},e.createNewLinks=function(t){var n=t.append("svg:line");return n.append("svg:title").text(X),n.classed("link",!0).attr("x1",(function(t){return t.source.x})).attr("y1",(function(t){return t.source.y})).attr("x2",(function(t){return t.target.x})).attr("y2",(function(t){return t.target.y})).attr("link_type",(function(t){return t.linkType})).attr("class",(function(t){return l.default.select(this).attr("class")+" "+t.linkType})).attr("pointer-events",(function(t){return"fake"==t.linkType?"none":"all"})),n},e.createNewNodes=function(t){(t=t.append("g").classed("noselect",!0).classed("gnode",!0).attr("struct_name",(function(t){return t.structName})).attr("transform",(function(t){return void 0!==t.x&&void 0!==t.y?"translate("+[t.x,t.y]+")":""})).each((function(t){t.selected=t.previouslySelected=!1}))).call(F).on("mousedown",J).on("mousedrag",(function(t){})).on("mouseup",Z).attr("num",(function(t){return"n"+t.num})).attr("rnum",(function(t){return"n"+(t.rna.rnaLength-t.num+1)})).on("click",W).transition().duration(750).ease("elastic");var n=t.filter((function(t){return"label"==t.nodeType||"protein"==t.nodeType})),e=t.filter((function(t){return"nucleotide"==t.nodeType}));return n.append("svg:circle").attr("class","outline_node").attr("r",(function(t){return t.radius+1})),e.append("svg:circle").attr("class","outline_node").attr("r",(function(t){return t.radius+1})),n.append("svg:circle").attr("class","node").classed("label",(function(t){return"label"==t.nodeType})).attr("r",(function(t){return"middle"==t.nodeType?0:t.radius})).attr("node_type",(function(t){return t.nodeType})).attr("node_num",(function(t){return t.num})),e.append("svg:circle").attr("class","node").attr("node_type",(function(t){return t.nodeType})).attr("node_num",(function(t){return t.num})).attr("r",(function(t){return t.radius})).append("svg:title").text((function(t){return"nucleotide"==t.nodeType?t.structName+":"+t.num:""})),e.append("svg:path").attr("class","node").attr("node_type",(function(t){return t.nodeType})).attr("node_num",(function(t){return t.num})).append("svg:title").text((function(t){return"nucleotide"==t.nodeType?t.structName+":"+t.num:""})),t.append("text").text((function(t){return t.name})).attr("text-anchor","middle").attr("font-size",8).attr("font-weight","bold").attr("y",2.5).attr("class","node-label").attr("label_type",(function(t){return t.nodeType})).append("svg:title").text((function(t){return"nucleotide"==t.nodeType?t.structName+":"+t.num:""})),t},e.update=function(){e.force.nodes(e.graph.nodes).links(e.graph.links),e.animation&&e.force.start();var t=E.selectAll("line.link").data(e.graph.links.filter(y),X);t.attr("class","").classed("link",!0).attr("link_type",(function(t){return t.linkType})).attr("class",(function(t){return l.default.select(this).attr("class")+" "+t.linkType}));var n=t.enter();e.createNewLinks(n),t.exit().remove(),l.default.scale.category10().domain([0,1,2,3,4,5,6,7,8,9]);var r=T.selectAll("g.gnode").data(e.graph.nodes,Y),o=r.enter();e.createNewNodes(o),r.exit().remove();var a,i=e.graph.nodes.filter((function(t){return"nucleotide"==t.nodeType||"label"==t.nodeType}));a=e.displayFakeLinks?t:E.selectAll("[link_type=real],[link_type=pseudoknot],[link_type=protein_chain],[link_type=chain_chain],[link_type=label_link],[link_type=backbone],[link_type=basepair],[link_type=intermolecule],[link_type=external]"),r.selectAll("path").each(v),a.on("click",G),e.force.on("tick",(function(){for(var t=l.default.geom.quadtree(i),n=0,e=i.length;++n<e;)t.visit(j(i[n]));a.attr("x1",(function(t){return t.source.x})).attr("y1",(function(t){return t.source.y})).attr("x2",(function(t){return t.target.x})).attr("y2",(function(t){return t.target.y})),r.attr("transform",(function(t){return"translate("+[t.x,t.y]+")"})),r.select("path").each(v)})),e.changeColorScheme(e.colorScheme),e.animation&&e.force.start(),e.updateStyle()},e.setSize()},e(15);var u,s=e(17),l=(u=s)&&u.__esModule?u:{default:u},c=e(4),f=e(2),h=e(5)},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.ProteinGraph=i,n.RNAGraph=u,n.moleculesToJson=function(t){for(var n={},e=[],r=[],o=0;o<t.molecules.length;o++){var s,l=t.molecules[o];"rna"==l.type?((s=new u(l.seq,l.ss,l.header)).circularizeExternal=!0,s.elementsToJson().addPositions("nucleotide",l.positions).addLabels().reinforceStems().reinforceLoops()):"protein"==l.type&&(s=new i(l.header,l.size)),s.addUids(l.uids);for(var c=0;c<s.nodes.length;c++)n[s.nodes[c].uid]=s.nodes[c];e.push(s)}for(o=0;o<t.extraLinks.length;o++)link=t.extraLinks[o],link.source=n[link.source],link.target=n[link.target],link.uid=a(),r.push(link);return{graphs:e,extraLinks:r}};var r=e(2),o=function(t,n){return t-n};function a(){var t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(n){var e=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==n?e:3&e|8).toString(16)}))}function i(t,n,e){var r=this;r.type="protein",r.size=n,r.nodes=[{name:"P",num:1,radius:3*Math.sqrt(n),rna:r,nodeType:"protein",structName:t,elemType:"p",size:n,uid:a()}],r.links=[],r.uid=a(),r.addUids=function(t){for(var n=0;n<t.length;n++)r.nodes[n].uid=t[n];return r},r.getUids=function(){uids=[];for(var t=0;t<r.dotbracket.length;t++)uids.push(r.nodes[t].uid);return uids}}function u(t,n,e,i){var u=this;u.type="rna",u.circularizeExternal=!1,0===arguments.length?(u.seq="",u.dotbracket="",u.structName=""):(u.seq=t,u.dotbracket=n,u.structName=e),arguments.length<4&&(i=1),u.circular=!1,u.dotbracket.length>0&&"*"==u.dotbracket[u.dotbracket.length-1]&&(u.dotbracket=u.dotbracket.slice(0,u.dotbracket.length-1),u.circular=!0),u.uid=a(),u.elements=[],u.pseudoknotPairs=[],u.nucsToNodes={},u.addUids=function(t){for(var n=u.nodes.filter((function(t){return"nucleotide"==t.nodeType})),e=0;e<t.length&&e<n.length;e++)n[e].uid=t[e];return u},u.computePairtable=function(){u.pairtable=r.rnaUtilities.dotbracketToPairtable(u.dotbracket)},u.removeBreaks=function(t){for(var n=[],e=-1;(e=t.indexOf("&"))>=0;)n.push(e),t=t.substring(0,e)+"oo"+t.substring(e+1,t.length);return{targetString:t,breaks:n}};var s=u.removeBreaks(u.dotbracket);u.dotbracket=s.targetString,u.dotBracketBreaks=s.breaks,s=u.removeBreaks(u.seq),u.seq=s.targetString,u.seqBreaks=s.breaks,u.calculateStartNumberArray=function(){u.startNumberArray=[];for(var t=0;t<u.dotbracket.length;t++)u.startNumberArray.push(i),"o"==u.dotbracket[t]&&(i=-t)},u.calculateStartNumberArray(),u.rnaLength=u.dotbracket.length,(0,r.arraysEqual)(u.dotBracketBreaks,u.seqBreaks)||(console.log("WARNING: Sequence and structure breaks not equal"),console.log("WARNING: Using the breaks in the structure")),u.computePairtable(),u.addPositions=function(t,n){for(var e=u.nodes.filter((function(n){return n.nodeType==t})),r=0;r<e.length;r++)e[r].x=n[r][0],e[r].px=n[r][0],e[r].y=n[r][1],e[r].py=n[r][1];return u},u.breakNodesToFakeNodes=function(){for(var t=u.nodes.filter((function(t){return"nucleotide"==t.nodeType})),n=0;n<t.length;n++)"o"==u.dotbracket[n]&&(t[n].nodeType="middle");for(n=0;n<u.elements.length;n++){for(var e=!1,r=0;r<u.elements[n][2].length;r++)u.dotBracketBreaks.indexOf(u.elements[n][2][r])>=0&&(e=!0);e?u.elements[n][2].map((function(t){0!=t&&(u.nodes[t-1].elemType="e")})):u.elements[n][2].map((function(t){0!=t&&(u.nodes[t-1].elemType=u.elements[n][0])}))}return u},u.getPositions=function(t){for(var n=[],e=u.nodes.filter((function(n){return n.nodeType==t})),r=0;r<e.length;r++)n.push([e[r].x,e[r].y]);return n},u.getUids=function(){for(var t=[],n=0;n<u.dotbracket.length;n++)t.push(u.nodes[n].uid);return t},u.reinforceStems=function(){for(var t=u.pairtable,n=u.elements.filter((function(t){return"s"==t[0]&&t[2].length>=4})),e=0;e<n.length;e++)for(var r=n[e][2],o=r.slice(0,r.length/2),a=0;a<o.length-1;a++)u.addFakeNode([o[a],o[a+1],t[o[a+1]],t[o[a]]]);return u},u.reinforceLoops=function(){for(var t=function(t){return 0!==t&&t<=u.dotbracket.length},n=0;n<u.elements.length;n++)if("s"!=u.elements[n][0]&&(u.circularizeExternal||"e"!=u.elements[n][0])){var e=u.elements[n][2].filter(t);if("e"==u.elements[n][0]){var r={name:"",num:-3,radius:0,rna:u,nodeType:"middle",elemType:"f",nucs:[],x:u.nodes[u.rnaLength-1].x,y:u.nodes[u.rnaLength-1].y,px:u.nodes[u.rnaLength-1].px,py:u.nodes[u.rnaLength-1].py,uid:a()},o={name:"",num:-2,radius:0,rna:u,nodeType:"middle",elemType:"f",nucs:[],x:u.nodes[0].x,y:u.nodes[0].y,px:u.nodes[0].px,py:u.nodes[0].py,uid:a()};e.push(u.nodes.length+1),e.push(u.nodes.length+2),u.nodes.push(r),u.nodes.push(o)}u.addFakeNode(e)}return u},u.updateLinkUids=function(){for(var t=0;t<u.links.length;t++)u.links[t].uid=u.links[t].source.uid+u.links[t].target.uid;return u},u.addFakeNode=function(t){for(var n=6.283/(2*t.length),e=18/(2*Math.tan(n)),r="",o=0;o<t.length;o++)r+=u.nodes[t[o]-1].uid;var i={name:"",num:-1,radius:e,rna:u,nodeType:"middle",elemType:"f",nucs:t,uid:r};u.nodes.push(i);var s=0,l=0,c=0;n=3.14159*(t.length-2)/(2*t.length),e=.5/Math.cos(n);for(var f=0;f<t.length;f++)if(!(0===t[f]||t[f]>u.dotbracket.length)){u.links.push({source:u.nodes[t[f]-1],target:u.nodes[u.nodes.length-1],linkType:"fake",value:e,uid:a()}),t.length>4&&u.links.push({source:u.nodes[t[f]-1],target:u.nodes[t[(f+Math.floor(t.length/2))%t.length]-1],linkType:"fake",value:2*e,uid:a()});var h=3.14159*(t.length-2)/t.length,p=2*Math.cos(1.570795-h/2);u.links.push({source:u.nodes[t[f]-1],target:u.nodes[t[(f+2)%t.length]-1],linkType:"fake",value:p});var d=u.nodes[t[f]-1];"x"in d&&(s+=d.x,l+=d.y,c+=1)}return c>0&&(i.x=s/c,i.y=l/c,i.px=i.x,i.py=i.y),u},u.connectFakeNodes=function(){for(var t={},n=u.nodes.filter((function(t){return"middle"==t.nodeType})),e=new Set,r=1;r<=u.nodes.length;r++)t[r]=[];for(r=0;r<n.length;r++)for(var o=n[r],a=0;a<o.nucs.length;a++){for(var i=o.nucs[a],s=0;s<t[i].length;s++)if(!e.has(JSON.stringify([t[i][s].uid,o.uid].sort()))){var l=t[i][s].radius+o.radius;u.links.push({source:t[i][s],target:o,value:l/18,linkType:"fake_fake"}),e.add(JSON.stringify([t[i][s].uid,o.uid].sort()))}t[i].push(o)}return u},u.addExtraLinks=function(t){if(void 0===t)return u;for(var n=0;n<t.length;n++){var e={source:u.getNodeFromNucleotides(t[n].from),target:u.getNodeFromNucleotides(t[n].to),linkType:"extra",extraLinkType:t[n].linkType,uid:a()};u.links.push(e)}return u},u.elementsToJson=function(){var t=u.pairtable;u.elements,u.nodes=[],u.links=[];var n={};u.elements.sort();for(var e=0;e<u.elements.length;e++)for(var r=u.elements[e][2],o=0;o<r.length;o++)n[r[o]]=u.elements[e][0];for(e=1;e<=t[0];e++){var i=u.seq[e-1];(u.dotBracketBreaks.indexOf(e-1)>=0||u.dotBracketBreaks.indexOf(e-2)>=0)&&(i=""),u.nodes.push({name:i,num:e+u.startNumberArray[e-1]-1,radius:5,rna:u,nodeType:"nucleotide",structName:u.structName,elemType:n[e],uid:a(),linked:!1})}for(e=0;e<u.nodes.length;e++)u.nodes[e].prevNode=0===e?null:u.nodes[e-1],e==u.nodes.length-1?u.nodes[e].nextNode=null:u.nodes[e].nextNode=u.nodes[e+1];for(e=1;e<=t[0];e++)0!==t[e]&&u.links.push({source:u.nodes[e-1],target:u.nodes[t[e]-1],linkType:"basepair",value:1,uid:a()}),e>1&&-1===u.dotBracketBreaks.indexOf(e-1)&&-1==u.dotBracketBreaks.indexOf(e-2)&&-1==u.dotBracketBreaks.indexOf(e-3)&&(u.links.push({source:u.nodes[e-2],target:u.nodes[e-1],linkType:"backbone",value:1,uid:a()}),u.nodes[e-1].linked=!0);for(e=0;e<u.pseudoknotPairs.length;e++)u.links.push({source:u.nodes[u.pseudoknotPairs[e][0]-1],target:u.nodes[u.pseudoknotPairs[e][1]-1],linkType:"pseudoknot",value:1,uid:a()});return u.circular&&u.links.push({source:u.nodes[0],target:u.nodes[u.rnaLength-1],linkType:"backbone",value:1,uid:a()}),u},u.ptToElements=function(t,n,e,r){var a=[],i=[e-1],s=[r+1];if(e>r)return[];for(;0===t[e];e++)i.push(e);for(;0===t[r];r--)s.push(r);if(e>r){if(i.push(e),0===n)return[["e",n,i.sort(o)]];for(var l=!1,c=[],f=[],h=0;h<i.length;h++)l?f.push(i[h]):c.push(i[h]),u.dotBracketBreaks.indexOf(i[h])>=0&&(l=!0);return[["h",n,i.sort(o)]]}if(t[e]!=r){var p=i;for(h=e,p.push(h);h<=r;){for(a=a.concat(u.ptToElements(t,n,h,t[h])),p.push(t[h]),h=t[h]+1;0===t[h]&&h<=r;h++)p.push(h);p.push(h)}return p.pop(),(p=p.concat(s)).length>0&&(0===n?a.push(["e",n,p.sort(o)]):a.push(["m",n,p.sort(o)])),a}t[e]===r&&(i.push(e),s.push(r),i.concat(s).length>4&&(0===n?a.push(["e",n,i.concat(s).sort(o)]):a.push(["i",n,i.concat(s).sort(o)])));for(var d=[];t[e]===r&&e<r;)d.push(e),d.push(r),e+=1,r-=1,n+=1;return i=[e-1],s=[r+1],a.push(["s",n,d.sort(o)]),a.concat(u.ptToElements(t,n,e,r))},u.addLabels=function(t,n){if(0===arguments.length&&(t=1,n=10),1===arguments.length&&(n=10),0===n)return u;n<=0&&console.log("The label interval entered in invalid:",n);for(var e=1;e<=u.pairtable[0];e++)if(e%n==0){var r,o,i,s,l=u.nodes[e-1];1==u.rnaLength?(s=[l.x-15,l.y],i=[l.x-15,l.y]):(r=1==e?u.nodes[u.rnaLength-1]:u.nodes[e-2],o=e==u.rnaLength?u.nodes[0]:u.nodes[e],0!==u.pairtable[o.num]&&0!==u.pairtable[r.num]&&0!==u.pairtable[l.num]&&(r=o=u.nodes[u.pairtable[l.num]-1]),0===u.pairtable[l.num]||0!==u.pairtable[o.num]&&0!==u.pairtable[r.num]?(s=[o.x-l.x,o.y-l.y],i=[r.x-l.x,r.y-l.y]):(s=[l.x-o.x,l.y-o.y],i=[l.x-r.x,l.y-r.y]));var c=[s[0]+i[0],s[1]+i[1]],f=Math.sqrt(c[0]*c[0]+c[1]*c[1]),h=[c[0]/f,c[1]/f],p=[-15*h[0],-15*h[1]],d=u.nodes[e-1].x+p[0],m=u.nodes[e-1].y+p[1],g={name:e+u.startNumberArray[e-1]-1,num:-1,radius:6,rna:u,nodeType:"label",structName:u.structName,elemType:"l",x:d,y:m,px:d,py:m,uid:a()},v={source:u.nodes[e-1],target:g,value:1,linkType:"label_link",uid:a()};u.nodes.push(g),u.links.push(v)}return u},u.recalculateElements=function(){if(u.removePseudoknots(),u.elements=u.ptToElements(u.pairtable,0,1,u.dotbracket.length),u.circular&&(externalLoop=u.elements.filter((function(t){if("e"==t[0])return!0})),externalLoop.length>0)){eloop=externalLoop[0],nucs=eloop[2].sort(o),prev=nucs[0],hloop=!0,numGreater=0;for(var t=1;t<nucs.length;t++)nucs[t]-prev>1&&(numGreater+=1),prev=nucs[t];1==numGreater?eloop[0]="h":2==numGreater?eloop[0]="i":eloop[0]="m"}return u},u.reassignLinkUids=function(){for(var t=0;t<u.links.length;t++)u.links[t].uid=u.links[t].source.uid+u.links[t].target.uid;return u},u.removePseudoknots=function(){return u.pairtable.length>1&&(u.pseudoknotPairs=u.pseudoknotPairs.concat(r.rnaUtilities.removePseudoknotsFromPairtable(u.pairtable))),u},u.addPseudoknots=function(){for(var t=u.pairtable,n=u.pseudoknotPairs,e=0;e<n.length;e++)t[n[e][0]]=n[e][1],t[n[e][1]]=n[e][0];return u.pseudoknotPairs=[],u},u.addName=function(t){return void 0===t?(u.name="",u):(u.name=t,u)},u.rnaLength>0&&u.recalculateElements()}void 0===String.prototype.trim&&(String.prototype.trim=function(){return String(this).replace(/^\s+|\s+$/g,"")})},function(t,n,e){t.exports=function(t){function n(r){if(e[r])return e[r].exports;var o=e[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var e={};return n.m=t,n.c=e,n.p="",n(0)}([function(t,n,e){t.exports=e(1)},function(t,n){"use strict";function e(){var t=this;t.bracketLeft="([{<ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),t.bracketRight=")]}>abcdefghijklmnopqrstuvwxyz".split(""),t.inverseBrackets=function(t){for(var n={},e=0;e<t.length;e++)n[t[e]]=e;return n},t.maximumMatching=function(t){for(var n=t[0],e=new Array(n+1),r=0;n>=r;r++){e[r]=new Array(n+1);for(var o=r;n>=o;o++)e[r][o]=0}var a=0;for(r=n-0-1;r>0;r--)for(o=r+0+1;n>=o;o++){a=e[r][o-1];for(var i=o-0-1;i>=r;i--)t[i]===o&&(a=Math.max(a,(i>r?e[r][i-1]:0)+1+(o-i-1>0?e[i+1][o-1]:0)));e[r][o]=a}return a=e[1][n],e},t.backtrackMaximumMatching=function(n,e){var r=Array.apply(null,Array(n.length)).map((function(){return 0}));return t.mmBt(n,r,e,1,n.length-1),r},t.mmBt=function(n,e,r,o,a){var i=n[o][a];if(!(0>a-o-1)){if(n[o][a-1]==i)return void t.mmBt(n,e,r,o,a-1);for(var u=a-0-1;u>=o;u--)if(r[a]===u&&(u>o?n[o][u-1]:0)+(a-u-1>0?n[u+1][a-1]:0)+1==i)return e[u]=a,e[a]=u,u>o&&t.mmBt(n,e,r,o,u-1),void t.mmBt(n,e,r,u+1,a-1);console.log("FAILED!!!"+o+","+a+": backtracking failed!")}},t.dotbracketToPairtable=function(n){var e=Array.apply(null,new Array(n.length+1)).map(Number.prototype.valueOf,0);e[0]=n.length;for(var r={},o=0;o<t.bracketLeft.length;o++)r[o]=[];var a=t.inverseBrackets(t.bracketLeft),i=t.inverseBrackets(t.bracketRight);for(o=0;o<n.length;o++){var u=n[o],s=o+1;if("."==u||"o"==u)e[s]=0;else if(u in a)r[a[u]].push(s);else{if(!(u in i))throw"Unknown symbol in dotbracket string";var l=r[i[u]].pop();e[s]=l,e[l]=s}}for(var c in r)if(r[c].length>0)throw"Unmatched base at position "+r[c][0];return e},t.insertIntoStack=function(t,n,e){for(var r=0;t[r].length>0&&t[r][t[r].length-1]<e;)r+=1;return t[r].push(e),r},t.deleteFromStack=function(t,n){for(var e=0;0===t[e].length||t[e][t[e].length-1]!=n;)e+=1;return t[e].pop(),e},t.pairtableToDotbracket=function(n){for(var e={},r=0;r<n[0];r++)e[r]=[];var o={},a="";for(r=1;r<n[0]+1;r++){if(0!==n[r]&&n[r]in o)throw"Invalid pairtable contains duplicate entries";o[n[r]]=!0,a+=0===n[r]?".":n[r]>r?t.bracketLeft[t.insertIntoStack(e,r,n[r])]:t.bracketRight[t.deleteFromStack(e,r)]}return a},t.findUnmatched=function(n,e,r){for(var o=[],a=[],i=e,u=r,s=e;r>=s;s++)0!==n[s]&&(n[s]<e||n[s]>r)&&a.push([s,n[s]]);for(s=i;u>=s;s++){for(;0===n[s]&&u>=s;)s++;for(r=n[s];n[s]===r;)s++,r--;o=o.concat(t.findUnmatched(n,s,r))}return a.length>0&&o.push(a),o},t.removePseudoknotsFromPairtable=function(n){for(var e=t.maximumMatching(n),r=t.backtrackMaximumMatching(e,n),o=[],a=1;a<n.length;a++)n[a]<a||r[a]!=n[a]&&(o.push([a,n[a]]),n[n[a]]=0,n[a]=0);return o},t.ptToElements=function(n,e,o,a,i){var u=[],s=[o-1],l=[a+1];if(arguments.length<5&&(i=[]),o>a)return[];for(;0===n[o];o++)s.push(o);for(;0===n[a];a--)l.push(a);if(o>a){if(s.push(o),0===e)return[["e",e,s.sort(r)]];for(var c=!1,f=[],h=[],p=0;p<s.length;p++)c?h.push(s[p]):f.push(s[p]),i.indexOf(s[p])>=0&&(c=!0);return[["h",e,s.sort(r)]]}if(n[o]!=a){var d=s;for(p=o,d.push(p);a>=p;){for(u=u.concat(t.ptToElements(n,e,p,n[p],i)),d.push(n[p]),p=n[p]+1;0===n[p]&&a>=p;p++)d.push(p);d.push(p)}return d.pop(),(d=d.concat(l)).length>0&&(0===e?u.push(["e",e,d.sort(r)]):u.push(["m",e,d.sort(r)])),u}if(n[o]===a){s.push(o),l.push(a);var m=s.concat(l);m.length>4&&(0===e?u.push(["e",e,s.concat(l).sort(r)]):u.push(["i",e,s.concat(l).sort(r)]))}for(var g=[];n[o]===a&&a>o;)g.push(o),g.push(a),o+=1,a-=1,e+=1;return s=[o-1],l=[a+1],u.push(["s",e,g.sort(r)]),u.concat(t.ptToElements(n,e,o,a,i))}}Object.defineProperty(n,"__esModule",{value:!0}),n.arraysEqual=function(t,n){if(t===n)return!0;if(null===t||null===n)return!1;if(t.length!=n.length)return!1;for(var e=0;e<t.length;++e)if(t[e]!==n[e])return!1;return!0},n.RNAUtilities=e,n.ColorScheme=function(t){var n=this;return n.colorsText=t,n.parseRange=function(t){for(var n=t.split(","),e=[],r=0;r<n.length;r++){var o=n[r].split("-");if(1==o.length)e.push(parseInt(o[0]));else if(2==o.length)for(var a=parseInt(o[0]),i=parseInt(o[1]),u=a;i>=u;u++)e.push(u);else console.log("Malformed range (too many dashes):",t)}return e},n.parseColorText=function(t){for(var e=t.split("\n"),r="",o=1,a={colorValues:{"":{}},range:["white","steelblue"]},i=[],u=0;u<e.length;u++)if(">"!=e[u][0])for(var s=e[u].trim().split(/[\s]+/),l=0;l<s.length;l++)if(isNaN(s[l])){if(0===s[l].search("range")){var c=s[l].split("=")[1].split(":");a.range=[c[0],c[1]];continue}if(0==s[l].search("domain")){c=s[l].split("=")[1].split(":"),a.domain=[c[0],c[1]];continue}for(var f=s[l].split(":"),h=n.parseRange(f[0]),p=f[1],d=0;d<h.length;d++)isNaN(p)?a.colorValues[r][h[d]]=p:(a.colorValues[r][h[d]]=+p,i.push(Number(p)))}else a.colorValues[r][o]=Number(s[l]),o+=1,i.push(Number(s[l]));else r=e[u].trim().slice(1),o=1,a.colorValues[r]={};return"domain"in a||(a.domain=[Math.min.apply(null,i),Math.max.apply(null,i)]),n.colorsJson=a,n},n.normalizeColors=function(){var t;for(var e in n.colorsJson){var r=Number.MAX_VALUE,o=Number.MIN_VALUE;for(var a in n.colorsJson.colorValues[e])"number"==typeof(t=n.colorsJson.colorValues[e][a])&&(r>t&&(r=t),t>o&&(o=t));for(a in n.colorsJson.colorValues[e])"number"==typeof(t=n.colorsJson.colorValues[e][a])&&(n.colorsJson.colorValues[e][a]=(t-r)/(o-r))}return n},n.parseColorText(n.colorsText),n};var r=function(t,n){return t-n};n.rnaUtilities=new e}])},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.rnaPlot=function(){var t,n,e={width:400,height:400,nucleotideRadius:5,rnaEdgePadding:0,labelInterval:0,showNucleotideLabels:!0,startNucleotideNumber:1,bundleExternalLinks:!1};function a(a){a.each((function(a){var i=new r.RNAGraph(a.sequence,a.structure,a.name).recalculateElements().elementsToJson().addName(a.name);a.rnaGraph=i;for(var u=(new o.NAView).naview_xy_coordinates(i.pairtable),s=[],l=0;l<u.nbase;l++)s.push([u.x[l],u.y[l]]);i.addPositions("nucleotide",s).reinforceStems().reinforceLoops().addExtraLinks(a.extraLinks).addLabels(e.startNucleotideNumber,e.labelInterval);var c=function(r,o){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=d3.extent(r),u=d3.extent(o),s=30;""!=a&&(u[1]+=s),i[0]-=e.nucleotideRadius+e.rnaEdgePadding,u[0]-=e.nucleotideRadius+e.rnaEdgePadding,i[1]+=e.nucleotideRadius+e.rnaEdgePadding,u[1]+=e.nucleotideRadius+e.rnaEdgePadding;var l,c=i[1]-i[0],f=u[1]-u[0],h=c-e.width,p=f-e.height;function d(t,n,e){var r=(t.range()[1]-t.range()[0])/(t.domain()[1]-t.domain()[0]),o=(n[1]-n[0])*r,a=(e[1]-e[0]-o)/2;return{scaleFactor:r,scale:d3.scale.linear().domain(n).range([e[0]+a,e[1]-a])}}return h>p?(l=d(t=d3.scale.linear().domain(i).range([0,e.width]),u,[0,e.height]),n=l.scale):(l=d(n=d3.scale.linear().domain(u).range([0,e.height]),i,[0,e.width]),t=l.scale),t.range()[0],t.domain()[0],n.range()[0],n.domain()[0],"translate("+-(t.domain()[0]*l.scaleFactor-t.range()[0])+","+-(n.domain()[0]*l.scaleFactor-n.range()[0])+")scale("+l.scaleFactor+")"}(i.nodes.map((function(t){return t.x})),i.nodes.map((function(t){return t.y}))),f=d3.select(this).append("g").attr("transform",c),h=i.nodes.filter((function(t){return"nucleotide"==t.nodeType})),p=i.nodes.filter((function(t){return"label"==t.nodeType})),d=i.links;!function(t,n){n=n.filter((function(t){return null!==t.source&&null!==t.target})),t.selectAll(".rna-link").data(n).enter().append("svg:line").attr("x1",(function(t){return t.source.x})).attr("x2",(function(t){return t.target.x})).attr("y1",(function(t){return t.source.y})).attr("y2",(function(t){return t.target.y})).attr("link-type",(function(t){return t.linkType})).attr("extra-link-type",(function(t){return t.extraLinkType})).classed("rna-link",!0)}(f,d),function(t,n){var r=t.selectAll(".rna-base").data(n).enter().append("svg:g").attr("transform",(function(t){return"translate("+t.x+","+t.y+")"}));r.append("svg:circle").attr("r",e.nucleotideRadius).classed("rna-base",!0),e.showNucleotideLabels&&r.append("svg:text").text((function(t){return t.name})).attr("text-anchor","middle").attr("dominant-baseline","central").classed("nucleotide-label",!0).append("svg:title").text((function(t){return t.struct_name+":"+t.num}))}(f,h),function(t,n){t.selectAll(".rnaLabel").data(n).enter().append("svg:g").attr("transform",(function(t){return"translate("+t.x+","+t.y+")"})).append("svg:text").text((function(t){return t.name})).attr("text-anchor","middle").attr("font-weight","bold").attr("dominant-baseline","central").classed("number-label",!0)}(f,p),function(r,o){r.append("svg:text").attr("transform","translate("+t.invert(e.width/2)+","+n.invert(e.height)+")").attr("dy",-10).classed("rna-name",!0).text(o)}(f,a.name),e.bundleExternalLinks&&function(t,n){var e={},r=[];n=n.filter((function(t){return"correct"==t.linkType||"incorrect"==t.linkType||"extra"==t.linkType})),t.selectAll("[link-type=extra]").remove();for(var o=0;o<n.length;o++)null!==n[o].source&&null!==n[o].target&&(e[n[o].source.uid]=n[o].source,e[n[o].target.uid]=n[o].target,r.push({source:n[o].source.uid,target:n[o].target.uid,linkType:n[o].linkType,extraLinkType:n[o].extraLinkType}));var a=d3.ForceEdgeBundling().nodes(e).edges(r).compatibility_threshold(.8).step_size(.2)(),i=d3.svg.line().x((function(t){return t.x})).y((function(t){return t.y})).interpolate("linear");for(o=0;o<a.length;o++){var u=a[o];t.append("path").attr("d",i(u)).style("fill","none").attr("link-type",(function(t){return r[o].linkType})).attr("extra-link-type",(function(t){return r[o].extraLinkType})).style("stroke-opacity",.4)}}(f,d)}))}return a.width=function(t){return arguments.length?(e.width=t,a):e.width},a.height=function(t){return arguments.length?(e.height=t,a):e.height},a.showNucleotideLabels=function(t){return arguments.length?(e.showNucleotideLabels=t,a):e.showNucleotideLabels},a.rnaEdgePadding=function(t){return arguments.length?(e.rnaEdgePadding=t,a):e.rnaEdgePadding},a.nucleotideRadius=function(t){return arguments.length?(e.nucleotideRadius=t,a):e.nucleotideRadius},a.labelInterval=function(t){return arguments.length?(e.labelInterval=t,a):e.labelInterval},a.showNucleotideLabels=function(t){return arguments.length?(e.showNucleotideLabels=t,a):e.showNucleotideLabels},a.startNucleotideNumber=function(t){return arguments.length?(e.startNucleotideNumber=t,a):e.startNucleotideNumber},a.bundleExternalLinks=function(t){return arguments.length?(e.bundleExternalLinks=t,a):e.bundleExternalLinks},a},e(4);var r=e(1),o=e(5);e(2),e(11),void 0===String.prototype.trim&&(String.prototype.trim=function(){return String(this).replace(/^\s+|\s+$/g,"")})},function(t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.simpleXyCoordinates=function(t){var n,e,r,o=[],a=[];e=t[0];var i=Array.apply(null,new Array(e+5)).map(Number.prototype.valueOf,0),u=Array.apply(null,new Array(16+Math.floor(e/5))).map(Number.prototype.valueOf,0),s=Array.apply(null,new Array(16+Math.floor(e/5))).map(Number.prototype.valueOf,0),l=0,c=0,f=Math.PI/2;(function t(n,e,r){var o,a,h,p,d,m,g,v,y,b,x,M,w=2,_=0,k=0,S=Array.apply(null,new Array(3+2*Math.floor((e-n)/5))).map(Number.prototype.valueOf,0);for(o=n-1,e++;n!=e;)if((a=r[n])&&0!=n){w+=2,h=n,p=a,S[++_]=h,S[++_]=p,n=a+1,d=h,m=p,v=0;do{h++,p--,v++}while(r[h]==p&&r[h]>h);if(g=v-2,v>=2&&(i[d+1+g]+=f,i[m-1-g]+=f,i[d]+=f,i[m]+=f,v>2))for(;g>=1;g--)i[d+g]=Math.PI,i[m-g]=Math.PI;s[++c]=v,h<=p&&t(h,p,r)}else n++,w++,k++;for(M=Math.PI*(w-2)/w,S[++_]=e,y=o<0?0:o,b=1;b<=_;b++){for(x=S[b]-y,g=0;g<=x;g++)i[y+g]+=M;if(b>_)break;y=S[++b]}u[++l]=k})(0,e+1,t),u[l]-=2,r=0,o[0]=100,a[0]=100;var h=[];for(h.push([o[0],a[0]]),n=1;n<e;n++)o[n]=o[n-1]+15*Math.cos(r),a[n]=a[n-1]+15*Math.sin(r),h.push([o[n],a[n]]),r+=Math.PI-i[n+1];return h}},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.NAView=s;var r=e(6),o=e(7),a=e(9),i=e(10),u=e(8);function s(){this.ANUM=9999,this.MAXITER=500,this.bases=[],this.nbase=null,this.nregion=null,this.loop_count=null,this.root=new u.Loop,this.loops=[],this.regions=[],this.rlphead=new r.Radloop,this.lencut=.8,this.RADIUS_REDUCTION_FACTOR=1.4,this.angleinc=null,this._h=null,this.HELIX_FACTOR=.6,this.BACKBONE_DISTANCE=27}function l(){var t=new u.Loop,n=null,e=null;for(n=0;n<this.loop_count;n++){for(t=this.loops[n],e=0;e<this.loop_count;e++)this.loops[e].setMark(!1);t.setDepth(c(t))}}function c(t){var n=null,e=null,r=null;if(t.getNconnection()<=1)return 0;if(t.isMark())return-1;t.setMark(!0),n=0,e=0;for(var o=0;null!=t.getConnection(o);o++)(r=c(t.getConnection(o).getLoop()))>=0&&(1==++n?e=r:e>r&&(e=r));return t.setMark(!1),e+1}s.prototype.naview_xy_coordinates=function(t){var n,e=[],r=[];if(0===t.length||0===t[0])return 0;this.nbase=t[0],this.bases=[];for(var o=0;o<this.nbase+1;o++)this.bases.push(new i.Base);for(this.regions=[],o=0;o<this.nbase+1;o++)this.regions.push(new a.Region);for(this.read_in_bases(t),this.rlphead=null,this.find_regions(),this.loop_count=0,this.loops=[],o=0;o<this.nbase+1;o++)this.loops.push(new u.Loop);for(this.construct_loop(0),this.find_central_loop(),this.traverse_loop(this.root,null),n=0;n<this.nbase;n++)e.push(100+this.BACKBONE_DISTANCE*this.bases[n+1].getX()),r.push(100+this.BACKBONE_DISTANCE*this.bases[n+1].getY());return{nbase:this.nbase,x:e,y:r}},s.prototype.read_in_bases=function(t){var n=null,e=null;for(this.bases.push(new i.Base),this.bases[0].setMate(0),this.bases[0].setExtracted(!1),this.bases[0].setX(this.ANUM),this.bases[0].setY(this.ANUM),e=0,n=1;n<=this.nbase;n++)this.bases.push(new i.Base),this.bases[n].setExtracted(!1),this.bases[n].setX(this.ANUM),this.bases[n].setY(this.ANUM),this.bases[n].setMate(t[n]),t[n]>n&&e++;0==e&&(this.bases[1].setMate(this.nbase),this.bases[this.nbase].setMate(1))},s.prototype.find_regions=function(){var t,n=null,e=null;t=this.nbase+1;var r=[];for(n=0;n<t;n++)r.push(!1);for(this.nregion=0,n=0;n<=this.nbase;n++)if(0!=(e=this.bases[n].getMate())&&!r[n]){for(this.regions[this.nregion].setStart1(n),this.regions[this.nregion].setEnd2(e),r[n]=!0,r[e]=!0,this.bases[n].setRegion(this.regions[this.nregion]),this.bases[e].setRegion(this.regions[this.nregion]),n++,e--;n<e&&this.bases[n].getMate()==e;n++,e--)r[e]=!0,r[n]=!0,this.bases[n].setRegion(this.regions[this.nregion]),this.bases[e].setRegion(this.regions[this.nregion]);this.regions[this.nregion].setEnd1(--n),this.regions[this.nregion].setStart2(e+1),this.nregion++}},s.prototype.construct_loop=function(t){var n=null,e=null,i=new u.Loop,s=new u.Loop,l=new o.Connection,c=new a.Region,f=new r.Radloop;for((i=this.loops[this.loop_count++]).setNconnection(0),i.setDepth(0),i.setNumber(this.loop_count),i.setRadius(0),f=this.rlphead;null!=f;f=f.getNext())f.getLoopnumber()==this.loop_count&&i.setRadius(f.getRadius());n=t;do{0!=(e=this.bases[n].getMate())&&(c=this.bases[n].getRegion(),this.bases[c.getStart1()].isExtracted()||(n==c.getStart1()?(this.bases[c.getStart1()].setExtracted(!0),this.bases[c.getEnd1()].setExtracted(!0),this.bases[c.getStart2()].setExtracted(!0),this.bases[c.getEnd2()].setExtracted(!0),s=this.construct_loop(c.getEnd1()<this.nbase?c.getEnd1()+1:0)):n==c.getStart2()?(this.bases[c.getStart2()].setExtracted(!0),this.bases[c.getEnd2()].setExtracted(!0),this.bases[c.getStart1()].setExtracted(!0),this.bases[c.getEnd1()].setExtracted(!0),s=this.construct_loop(c.getEnd2()<this.nbase?c.getEnd2()+1:0)):console.log("Something went terribly wrong ...."),i.setNconnection(i.getNconnection()+1),l=new o.Connection,i.setConnection(i.getNconnection()-1,l),i.setConnection(i.getNconnection(),null),l.setLoop(s),l.setRegion(c),n==c.getStart1()?(l.setStart(c.getStart1()),l.setEnd(c.getEnd2())):(l.setStart(c.getStart2()),l.setEnd(c.getEnd1())),l.setExtruded(!1),l.setBroken(!1),s.setNconnection(s.getNconnection()+1),l=new o.Connection,s.setConnection(s.getNconnection()-1,l),s.setConnection(s.getNconnection(),null),l.setLoop(i),l.setRegion(c),n==c.getStart1()?(l.setStart(c.getStart2()),l.setEnd(c.getEnd1())):(l.setStart(c.getStart1()),l.setEnd(c.getEnd2())),l.setExtruded(!1),l.setBroken(!1)),n=e),++n>this.nbase&&(n=0)}while(n!=t);return i},s.prototype.find_central_loop=function(){var t=new u.Loop,n=null,e=null,r=null;for(l.bind(this)(),n=0,e=-1,r=0;r<this.loop_count;r++)(t=this.loops[r]).getNconnection()>n?(e=t.getDepth(),n=t.getNconnection(),this.root=t):t.getDepth()>e&&t.getNconnection()==n&&(e=t.getDepth(),this.root=t)},s.prototype.traverse_loop=function(t,n){var e,r,o,a,i,u,s,l,c,f,h,p,d,m,g,v,y,b,x,M,w,_,k,S,A,E,T,R,N,P,C,O,L,U,D,z,q,j,F,B,I,X,Y,V,H,G,W,Z,J,$,K,Q,tt,nt,et,rt,ot,at,it,ut,st,lt,ct,ft,ht,pt,dt,mt,gt,vt=0;u=2*Math.PI/(this.nbase+1),b=null,P=-1;var yt=0;for(k=0;null!=(v=t.getConnection(yt));yt++,k++)e=-Math.sin(u*v.getStart()),r=Math.cos(u*v.getStart()),o=-Math.sin(u*v.getEnd()),a=Math.cos(u*v.getEnd())-r,i=e-o,s=Math.sqrt(a*a+i*i),v.setXrad(a/s),v.setYrad(i/s),v.setAngle(Math.atan2(i,a)),v.getAngle()<0&&v.setAngle(v.getAngle()+2*Math.PI),null!=n&&n.getRegion()==v.getRegion()&&(b=v,P=k);t:for(;;){this.determine_radius(t,this.lencut),l=t.getRadius()/this.RADIUS_REDUCTION_FACTOR,null==n?c=f=0:(h=(this.bases[b.getStart()].getX()+this.bases[b.getEnd()].getX())/2,p=(this.bases[b.getStart()].getY()+this.bases[b.getEnd()].getY())/2,c=h-l*b.getXrad(),f=p-l*b.getYrad()),T=-1==P?0:P,v=t.getConnection(T),E=0,C=!1;do{if((w=T-1)<0&&(w=t.getNconnection()-1),x=t.getConnection(w),this.connected_connection(x,v)?(T=w,v=x):C=!0,++E>t.getNconnection()){for(A=-1,k=0;k<t.getNconnection();k++)(w=k+1)>=t.getNconnection()&&(w=0),v=t.getConnection(k),(ht=(y=t.getConnection(w)).getAngle()-v.getAngle())<0&&(ht+=2*Math.PI),ht>A&&(A=ht,vt=k);R=vt,(T=vt+1)>=t.getNconnection()&&(T=0),(v=t.getConnection(R)).setBroken(!0),C=!0}}while(!C);for(O=!1,G=T;!O;){for(E=0,C=!1,R=T,L=!1;!C;)if(v=t.getConnection(R),R==P&&(L=!0),(w=R+1)>=t.getNconnection()&&(w=0),y=t.getConnection(w),this.connected_connection(v,y)){if(++E>=t.getNconnection())break;R=w}else C=!0;for(k=W=Z=N=this.find_ic_middle(T,R,n,b,t),C=!1,$=0;!C;)(k=$<0?W:0==$?N:Z)>=0&&(v=t.getConnection(k),null!=n&&b==v||(0==$?(d=v.getAngle()-Math.asin(.5/l),m=v.getAngle()+Math.asin(.5/l),this.bases[v.getStart()].setX(c+l*Math.cos(d)),this.bases[v.getStart()].setY(f+l*Math.sin(d)),this.bases[v.getEnd()].setX(c+l*Math.cos(m)),this.bases[v.getEnd()].setY(f+l*Math.sin(m))):$<0?((w=k+1)>=t.getNconnection()&&(w=0),v=t.getConnection(k),y=t.getConnection(w),et=v.getXrad(),rt=v.getYrad(),ht=(v.getAngle()+y.getAngle())/2,v.getAngle()>y.getAngle()&&(ht-=Math.PI),it=Math.cos(ht),lt=Math.sin(ht),ct=-it,(S=y.getAngle()-v.getAngle())<0&&(S+=2*Math.PI),ft=v.isExtruded()?S<=Math.PI/2?2:1.5:1,this.bases[v.getEnd()].setX(this.bases[y.getStart()].getX()+ft*lt),this.bases[v.getEnd()].setY(this.bases[y.getStart()].getY()+ft*ct),this.bases[v.getStart()].setX(this.bases[v.getEnd()].getX()+rt),this.bases[v.getStart()].setY(this.bases[v.getEnd()].getY()-et)):((w=k-1)<0&&(w=t.getNconnection()-1),v=t.getConnection(w),ot=(y=t.getConnection(k)).getXrad(),at=y.getYrad(),ht=(v.getAngle()+y.getAngle())/2,v.getAngle()>y.getAngle()&&(ht-=Math.PI),it=Math.cos(ht),lt=-Math.sin(ht),ct=it,(S=y.getAngle()-v.getAngle())<0&&(S+=2*Math.PI),ft=v.isExtruded()?S<=Math.PI/2?2:1.5:1,this.bases[y.getStart()].setX(this.bases[v.getEnd()].getX()+ft*lt),this.bases[y.getStart()].setY(this.bases[v.getEnd()].getY()+ft*ct),this.bases[y.getEnd()].setX(this.bases[y.getStart()].getX()-at),this.bases[y.getEnd()].setY(this.bases[y.getStart()].getY()+ot)))),$<0?(Z==R?Z=-1:Z>=0&&++Z>=t.getNconnection()&&(Z=0),$=1):(W==T?W=-1:W>=0&&--W<0&&(W=t.getNconnection()-1),$=-1),C=-1==W&&-1==Z;if((J=R+1)>=t.getNconnection()&&(J=0),R!=T&&(T!=G||J!=G))if(v=t.getConnection(T),y=t.getConnection(R),Q=this.bases[y.getEnd()].getX()-this.bases[v.getStart()].getX(),tt=this.bases[y.getEnd()].getY()-this.bases[v.getStart()].getY(),D=this.bases[v.getStart()].getX()+Q/2,z=this.bases[v.getStart()].getY()+tt/2,F=Q/(nt=Math.sqrt(Q*Q+tt*tt)),B=tt/nt,I=c-D,X=f-z,q=(Y=(I/=nt=Math.sqrt(Q*Q+tt*tt))*F+(X/=nt)*B)*F-I,j=Y*B-X,q/=nt=Math.sqrt(q*q+j*j),j/=nt,Q=this.bases[v.getStart()].getX()-c,tt=this.bases[v.getStart()].getY()-f,(ht=Math.atan2(tt,Q))<0&&(ht+=2*Math.PI),Q=this.bases[y.getEnd()].getX()-c,tt=this.bases[y.getEnd()].getY()-f,(pt=Math.atan2(tt,Q))<0&&(pt+=2*Math.PI),pt<ht&&(pt+=2*Math.PI),V=c+(U=pt-ht>Math.PI?-1:1)*l*q,H=f+U*l*j,L)c-=V-D,f-=H-z;else for(k=T;M=(v=t.getConnection(k)).getStart(),this.bases[M].setX(this.bases[M].getX()+V-D),this.bases[M].setY(this.bases[M].getY()+H-z),M=v.getEnd(),this.bases[M].setX(this.bases[M].getX()+V-D),this.bases[M].setY(this.bases[M].getY()+H-z),k!=R;)++k>=t.getNconnection()&&(k=0);O=(T=J)==G}for(k=0;k<t.getNconnection();k++){if(v=t.getConnection(k),(w=k+1)>=t.getNconnection()&&(w=0),y=t.getConnection(w),Q=this.bases[v.getEnd()].getX()-c,tt=this.bases[v.getEnd()].getY()-f,st=Math.sqrt(Q*Q+tt*tt),(ht=Math.atan2(tt,Q))<0&&(ht+=2*Math.PI),Q=this.bases[y.getStart()].getX()-c,tt=this.bases[y.getStart()].getY()-f,ut=Math.sqrt(Q*Q+tt*tt),(pt=Math.atan2(tt,Q))<0&&(pt+=2*Math.PI),pt<ht&&(pt+=2*Math.PI),K=pt-ht,(gt=y.getAngle()-v.getAngle())<=0&&(gt+=2*Math.PI),Math.abs(K-gt)>Math.PI)if(v.isExtruded())console.log("Warning from traverse_loop. Loop "+t.getNumber()+" has crossed regions\n");else if(y.getStart()-v.getEnd()!=1){v.setExtruded(!0);continue t}if(v.isExtruded())this.construct_extruded_segment(v,y);else for((_=y.getStart()-v.getEnd())<0&&(_+=this.nbase+1),u=K/_,w=1;w<_;w++)(M=v.getEnd()+w)>this.nbase&&(M-=this.nbase+1),nt=st+(ut-st)*((g=ht+w*u)-ht)/K,this.bases[M].setX(c+nt*Math.cos(g)),this.bases[M].setY(f+nt*Math.sin(g))}break}for(k=0;k<t.getNconnection();k++)P!=k&&(v=t.getConnection(k),this.generate_region(v),this.traverse_loop(v.getLoop(),v));for(_=0,dt=0,mt=0,k=0;k<t.getNconnection();k++)if((w=k+1)>=t.getNconnection()&&(w=0),v=t.getConnection(k),y=t.getConnection(w),_+=2,dt+=this.bases[v.getStart()].getX()+this.bases[v.getEnd()].getX(),mt+=this.bases[v.getStart()].getY()+this.bases[v.getEnd()].getY(),!v.isExtruded())for(w=v.getEnd()+1;w!=y.getStart();w++)w>this.nbase&&(w-=this.nbase+1),_++,dt+=this.bases[w].getX(),mt+=this.bases[w].getY();t.setX(dt/_),t.setY(mt/_)},s.prototype.determine_radius=function(t,n){var e,r,a,i,u,s,l,c,f,h,p,d=0,m=new o.Connection,g=new o.Connection;do{for(e=1e10,u=0,i=0,c=0;c<t.getNconnection();c++)m=t.getConnection(c),(f=c+1)>=t.getNconnection()&&(f=0),g=t.getConnection(f),h=m.getEnd(),(p=g.getStart())<h&&(p+=this.nbase+1),(a=g.getAngle()-m.getAngle())<=0&&(a+=2*Math.PI),i+=a*(1/(r=m.isExtruded()?a<=Math.PI/2?2:1.5:p-h)+1),u+=a*a/r,(l=a/r)<e&&!m.isExtruded()&&r>1&&(e=l,d=c);(s=i/u)<.7071068&&(s=.7071068),e*s<n&&t.getConnection(d).setExtruded(!0)}while(e*s<n);t.getRadius()>0?s=t.getRadius():t.setRadius(s)},s.prototype.find_ic_middle=function(t,n,e,r,o){var a,i,u,s,l;for(a=0,i=-1,u=t,l=!1;!l;)a++>2*o.getNconnection()&&console.log("Infinite loop in 'find_ic_middle'"),null!=e&&o.getConnection(u)==r&&(i=u),l=u==n,++u>=o.getNconnection()&&(u=0);if(-1==i){for(s=1,u=t;s<(a+1)/2;s++)++u>=o.getNconnection()&&(u=0);i=u}return i},s.prototype.construct_extruded_segment=function(t,n){var e,r,o,a,i,u,s,l,c,f,h,p,d,m,g,v,y,b;if(e=t.getAngle(),(o=r=n.getAngle())<e&&(o+=2*Math.PI),a=(e+o)/2,d=t.getEnd(),(g=(m=n.getStart())-d)<0&&(g+=this.nbase+1),(h=n.getAngle()-t.getAngle())<0&&(h+=2*Math.PI),2==g)this.construct_circle_segment(d,m);else{i=this.bases[m].getX()-this.bases[d].getX(),u=this.bases[m].getY()-this.bases[d].getY(),i/=f=Math.sqrt(i*i+u*u),u/=f,f>=1.5&&h<=Math.PI/2&&((v=d+1)>this.nbase&&(v-=this.nbase+1),(y=m-1)<0&&(y+=this.nbase+1),this.bases[v].setX(this.bases[d].getX()+.5*i),this.bases[v].setY(this.bases[d].getY()+.5*u),this.bases[y].setX(this.bases[m].getX()-.5*i),this.bases[y].setY(this.bases[m].getY()-.5*u),d=v,m=y);do{b=!1,this.construct_circle_segment(d,m),(v=d+1)>this.nbase&&(v-=this.nbase+1),i=this.bases[v].getX()-this.bases[d].getX(),u=this.bases[v].getY()-this.bases[d].getY(),(s=Math.atan2(u,i))<0&&(s+=2*Math.PI),(p=s-e)<0&&(p+=2*Math.PI),p>Math.PI&&(b=!0),(y=m-1)<0&&(y+=this.nbase+1),i=this.bases[y].getX()-this.bases[m].getX(),u=this.bases[y].getY()-this.bases[m].getY(),(l=Math.atan2(u,i))<0&&(l+=2*Math.PI),(p=r-l)<0&&(p+=2*Math.PI),p>Math.PI&&(b=!0),b&&(c=this.minf2(a,e+.5),this.bases[v].setX(this.bases[d].getX()+Math.cos(c)),this.bases[v].setY(this.bases[d].getY()+Math.sin(c)),d=v,c=this.maxf2(a,o-.5),this.bases[y].setX(this.bases[m].getX()+Math.cos(c)),this.bases[y].setY(this.bases[m].getY()+Math.sin(c)),m=y,g-=2)}while(b&&g>1)}},s.prototype.construct_circle_segment=function(t,n){var e,r,o,a,i,u,s,l,c,f,h,p,d,m,g;if(e=this.bases[n].getX()-this.bases[t].getX(),r=this.bases[n].getY()-this.bases[t].getY(),o=Math.sqrt(e*e+r*r),(d=n-t)<0&&(d+=this.nbase+1),o>=d)for(e/=o,r/=o,m=1;m<d;m++)(g=t+m)>this.nbase&&(g-=this.nbase+1),this.bases[g].setX(this.bases[t].getX()+e*m/d),this.bases[g].setY(this.bases[t].getY()+r*m/d);else for(this.find_center_for_arc(d-1,o),e/=o,r/=o,a=this.bases[t].getX()+e*o/2,i=this.bases[t].getY()+r*o/2,u=r,s=-e,l=a+this._h*u,c=i+this._h*s,f=this.bases[t].getX()-l,h=this.bases[t].getY()-c,o=Math.sqrt(f*f+h*h),p=Math.atan2(h,f),m=1;m<d;m++)(g=t+m)>this.nbase&&(g-=this.nbase+1),this.bases[g].setX(l+o*Math.cos(p+m*this.angleinc)),this.bases[g].setY(c+o*Math.sin(p+m*this.angleinc))},s.prototype.find_center_for_arc=function(t,n){var e,r,o,a,i,u,s,l;o=-(r=(t+1)/Math.PI)-n/(t+1.000001-n),n<1&&(o=0),l=0;do{e=(r+o)/2,i=1-.5/((a=Math.sqrt(e*e+n*n/4))*a),Math.abs(i)>1&&console.log("Unexpected large magnitude discriminant = "+i+" "+a),(s=(u=Math.acos(i))*(t+1)+2*Math.acos(e/a)-2*Math.PI)>0?o=e:r=e}while(Math.abs(s)>1e-4&&++l<this.MAXITER);l>=this.MAXITER&&(noIterationFailureYet&&(console.log("Iteration failed in find_center_for_arc"),noIterationFailureYet=!1),e=0,u=0),this._h=e,this.angleinc=u},s.prototype.generate_region=function(t){var n,e,r,o,a,i;for(i=t.getRegion(),n=0,t.getStart()==i.getStart1()?(e=i.getStart1(),r=i.getEnd1()):(e=i.getStart2(),r=i.getEnd2()),(this.bases[t.getStart()].getX()>this.ANUM-100||this.bases[t.getEnd()].getX()>this.ANUM-100)&&console.log("Bad region passed to generate_region. Coordinates not defined."),o=e+1;o<=r;o++)n++,this.bases[o].setX(this.bases[t.getStart()].getX()+this.HELIX_FACTOR*n*t.getXrad()),this.bases[o].setY(this.bases[t.getStart()].getY()+this.HELIX_FACTOR*n*t.getYrad()),a=this.bases[o].getMate(),this.bases[a].setX(this.bases[t.getEnd()].getX()+this.HELIX_FACTOR*n*t.getXrad()),this.bases[a].setY(this.bases[t.getEnd()].getY()+this.HELIX_FACTOR*n*t.getYrad())},s.prototype.minf2=function(t,n){return t<n?t:n},s.prototype.maxf2=function(t,n){return t>n?t:n},s.prototype.connected_connection=function(t,n){return!!t.isExtruded()||t.getEnd()+1==n.getStart()}},function(t,n){"use strict";function e(){this.radius=null,this.loopnumber=null,this.next=null,this.prev=null}Object.defineProperty(n,"__esModule",{value:!0}),n.Radloop=e,e.prototype.getRadius=function(){return this.radius},e.prototype.setRadius=function(t){this.radius=t},e.prototype.getLoopnumber=function(){return this.loopnumber},e.prototype.setLoopnumber=function(t){this.loopnumber=t},e.prototype.getNext=function(){return this.next},e.prototype.setNext=function(t){this.next=t},e.prototype.getPrev=function(){return this.prev},e.prototype.setPrev=function(t){this.prev=t}},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.Connection=a;var r=e(8),o=e(9);function a(){this.loop=new r.Loop,this.region=new o.Region,this.start=null,this.end=null,this.xrad=null,this.yrad=null,this.angle=null,this.extruded=null,this.broken=null,this._isNull=!1}a.prototype.isNull=function(){return this._isNull},a.prototype.setNull=function(t){this._isNull=t},a.prototype.getLoop=function(){return this.loop},a.prototype.setLoop=function(t){this.loop=t},a.prototype.getRegion=function(){return this.region},a.prototype.setRegion=function(t){this.region=t},a.prototype.getStart=function(){return this.start},a.prototype.setStart=function(t){this.start=t},a.prototype.getEnd=function(){return this.end},a.prototype.setEnd=function(t){this.end=t},a.prototype.getXrad=function(){return this.xrad},a.prototype.setXrad=function(t){this.xrad=t},a.prototype.getYrad=function(){return this.yrad},a.prototype.setYrad=function(t){this.yrad=t},a.prototype.getAngle=function(){return this.angle},a.prototype.setAngle=function(t){this.angle=t},a.prototype.isExtruded=function(){return this.extruded},a.prototype.setExtruded=function(t){this.extruded=t},a.prototype.isBroken=function(){return this.broken},a.prototype.setBroken=function(t){this.broken=t}},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.Loop=o;var r=e(7);function o(){this.nconnection=null,this.connections=[],this._connections=[],this.number=null,this.depth=null,this.mark=null,this.x=null,this.y=null,this.radius=null}o.prototype.getNconnection=function(){return this.nconnection},o.prototype.setNconnection=function(t){this.nconnection=t},o.prototype.setConnection=function(t,n){null!=n?this._connections[t]=n:(this._connections[t]||(this._connections[t]=new r.Connection),this._connections[t].setNull(!0))},o.prototype.getConnection=function(t){var n=e(7);this._connections[t]||(this._connections[t]=new n);var r=this._connections[t];return r.isNull()?null:r},o.prototype.addConnection=function(t,n){this._connections.push(n)},o.prototype.getNumber=function(){return this.number},o.prototype.setNumber=function(t){this.number=t},o.prototype.getDepth=function(){return this.depth},o.prototype.setDepth=function(t){this.depth=t},o.prototype.isMark=function(){return this.mark},o.prototype.setMark=function(t){this.mark=t},o.prototype.getX=function(){return this.x},o.prototype.setX=function(t){this.x=t},o.prototype.getY=function(){return this.y},o.prototype.setY=function(t){this.y=t},o.prototype.getRadius=function(){return this.radius},o.prototype.setRadius=function(t){this.radius=t}},function(t,n){"use strict";function e(){this._start1=null,this._end1=null,this._start2=null,this._end2=null}Object.defineProperty(n,"__esModule",{value:!0}),n.Region=e,e.prototype.getStart1=function(){return this._start1},e.prototype.setStart1=function(t){this._start1=t},e.prototype.getEnd1=function(){return this._end1},e.prototype.setEnd1=function(t){this._end1=t},e.prototype.getStart2=function(){return this._start2},e.prototype.setStart2=function(t){this._start2=t},e.prototype.getEnd2=function(){return this._end2},e.prototype.setEnd2=function(t){this._end2=t}},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.Base=o;var r=e(9);function o(){this.mate=null,this.x=null,this.y=null,this.extracted=null,this.region=new r.Region}o.prototype.getMate=function(){return this.mate},o.prototype.setMate=function(t){this.mate=t},o.prototype.getX=function(){return this.x},o.prototype.setX=function(t){this.x=t},o.prototype.getY=function(){return this.y},o.prototype.setY=function(t){this.y=t},o.prototype.isExtracted=function(){return this.extracted},o.prototype.setExtracted=function(t){this.extracted=t},o.prototype.getRegion=function(){return this.region},o.prototype.setRegion=function(t){this.region=t}},function(t,n,e){var r=e(12);"string"==typeof r&&(r=[[t.id,r,""]]),e(14)(r,{}),r.locals&&(t.exports=r.locals)},function(t,n,e){(t.exports=e(13)()).push([t.id,'.forna-container .structure-background-rect {\r\n    stroke: black;\r\n    stroke-width: 5;\r\n    fill: transparent;\r\n}\r\n\r\n.forna-container circle.rna-base {\r\n  stroke: #ccc;\r\n  stroke-width: 1px;\r\n  opacity: 1;\r\n  fill: white;\r\n}\r\n\r\n.forna-container circle.rna-base.label {\r\n    stroke: transparent;\r\n    stroke-width: 0;\r\n    fill: white;\r\n}\r\n\r\n.forna-container line.link {\r\n  stroke: #999;\r\n  stroke-opacity: 0.8;\r\n  stroke-width: 2;\r\n}\r\n\r\n.forna-container line.rna-link {\r\n  stroke: #999;\r\n  stroke-opacity: 0.8;\r\n  stroke-width: 2;\r\n}\r\n\r\n.forna-container .overlay {\r\n    fill: transparent;\r\n}\r\n\r\n.forna-container .rna-name {\r\n    text-anchor: middle;\r\n    dy: -10;\r\n    font-family: Tahoma, Geneva, sans-serif;\r\n    font-size: 8pt;\r\n}\r\n\r\n.forna-container line.rna-link[link-type="backbone"] {\r\n    stroke: transparent;\r\n}\r\n\r\n.forna-container line.rna-link[link-type="basepair"] {\r\n    stroke: transparent;\r\n}\r\n\r\n.forna-container line.rna-link[link-type="fake"] {\r\n    stroke: transparent;\r\n}\r\n\r\n.forna-container line.rna-link[link-type="extra"] {\r\n    stroke: grey;\r\n}\r\n\r\n.forna-container line.rna-link[extra-link-type="correct"] {\r\n    stroke: green;\r\n}\r\n\r\n.forna-container line.rna-link[extra-link-type="incorrect"] {\r\n    stroke: green;\r\n}\r\n\r\n\r\n.forna-container path {\r\n    stroke-width: 2;\r\n}\r\n\r\n.forna-container path[extra-link-type="correct"] {\r\n    stroke: green;\r\n}\r\n\r\n.forna-container path[extra-link-type="incorrect"] {\r\n    stroke: red;\r\n}\r\n\r\n\r\n.forna-container line.basepair {\r\n  stroke: red;\r\n}\r\n\r\n.forna-container line.intermolecule {\r\n  stroke: blue;\r\n}\r\n\r\n.forna-container line.chain_chain {\r\n  stroke-dasharray: 3,3;\r\n}\r\n\r\n.forna-container line.fake {\r\n  stroke: green;\r\n}\r\n\r\n.forna-container .transparent {\r\n    fill: transparent;\r\n    stroke-width: 0;\r\n    stroke-opacity: 0;\r\n    opacity: 0;\r\n}\r\n\r\n.forna-container .d3-tip {\r\n    line-height: 1;\r\n    font-weight: bold;\r\n    padding: 6px;\r\n    background: rgba(0, 0, 0, 0.6);\r\n    color: #fff;\r\n    border-radius: 4px;\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container text.nucleotide-label {\r\n    font-size: 5.5pt;\r\n    font-weight: bold;\r\n    font-family: Tahoma, Geneva, sans-serif;\r\n    color: rgb(100,100,100);\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container text.number-label {\r\n    font-size: 5.5pt;\r\n    font-weight: bold;\r\n    font-family: Tahoma, Geneva, sans-serif;\r\n    color: rgb(100,100,100);\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container text {\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container g.gnode {\r\n\r\n}\r\n\r\n.forna-container .brush .extent {\r\n  fill-opacity: .1;\r\n  stroke: #fff;\r\n  shape-rendering: crispEdges;\r\n}\r\n\r\n.forna-container .noselect {\r\n    -webkit-touch-callout: none;\r\n    -webkit-user-select: none;\r\n    -khtml-user-select: none;\r\n    -moz-user-select: none;\r\n    -ms-user-select: none;\r\n    user-select: none;\r\n}\r\n',""])},function(t,n){t.exports=function(){var t=[];return t.toString=function(){for(var t=[],n=0;n<this.length;n++){var e=this[n];e[2]?t.push("@media "+e[2]+"{"+e[1]+"}"):t.push(e[1])}return t.join("")},t.i=function(n,e){"string"==typeof n&&(n=[[null,n,""]]);for(var r={},o=0;o<this.length;o++){var a=this[o][0];"number"==typeof a&&(r[a]=!0)}for(o=0;o<n.length;o++){var i=n[o];"number"==typeof i[0]&&r[i[0]]||(e&&!i[2]?i[2]=e:e&&(i[2]="("+i[2]+") and ("+e+")"),t.push(i))}},t}},function(t,n,e){var r={},o=function(t){var n;return function(){return void 0===n&&(n=t.apply(this,arguments)),n}},a=o((function(){return/msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase())})),i=o((function(){return document.head||document.getElementsByTagName("head")[0]})),u=null,s=0,l=[];function c(t,n){for(var e=0;e<t.length;e++){var o=t[e],a=r[o.id];if(a){a.refs++;for(var i=0;i<a.parts.length;i++)a.parts[i](o.parts[i]);for(;i<o.parts.length;i++)a.parts.push(m(o.parts[i],n))}else{var u=[];for(i=0;i<o.parts.length;i++)u.push(m(o.parts[i],n));r[o.id]={id:o.id,refs:1,parts:u}}}}function f(t){for(var n=[],e={},r=0;r<t.length;r++){var o=t[r],a=o[0],i={css:o[1],media:o[2],sourceMap:o[3]};e[a]?e[a].parts.push(i):n.push(e[a]={id:a,parts:[i]})}return n}function h(t,n){var e=i(),r=l[l.length-1];if("top"===t.insertAt)r?r.nextSibling?e.insertBefore(n,r.nextSibling):e.appendChild(n):e.insertBefore(n,e.firstChild),l.push(n);else{if("bottom"!==t.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");e.appendChild(n)}}function p(t){t.parentNode.removeChild(t);var n=l.indexOf(t);n>=0&&l.splice(n,1)}function d(t){var n=document.createElement("style");return n.type="text/css",h(t,n),n}function m(t,n){var e,r,o;if(n.singleton){var a=s++;e=u||(u=d(n)),r=y.bind(null,e,a,!1),o=y.bind(null,e,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(e=function(t){var n=document.createElement("link");return n.rel="stylesheet",h(t,n),n}(n),r=x.bind(null,e),o=function(){p(e),e.href&&URL.revokeObjectURL(e.href)}):(e=d(n),r=b.bind(null,e),o=function(){p(e)});return r(t),function(n){if(n){if(n.css===t.css&&n.media===t.media&&n.sourceMap===t.sourceMap)return;r(t=n)}else o()}}t.exports=function(t,n){void 0===(n=n||{}).singleton&&(n.singleton=a()),void 0===n.insertAt&&(n.insertAt="bottom");var e=f(t);return c(e,n),function(t){for(var o=[],a=0;a<e.length;a++){var i=e[a];(u=r[i.id]).refs--,o.push(u)}for(t&&c(f(t),n),a=0;a<o.length;a++){var u;if(0===(u=o[a]).refs){for(var s=0;s<u.parts.length;s++)u.parts[s]();delete r[u.id]}}}};var g,v=(g=[],function(t,n){return g[t]=n,g.filter(Boolean).join("\n")});function y(t,n,e,r){var o=e?"":r.css;if(t.styleSheet)t.styleSheet.cssText=v(n,o);else{var a=document.createTextNode(o),i=t.childNodes;i[n]&&t.removeChild(i[n]),i.length?t.insertBefore(a,i[n]):t.appendChild(a)}}function b(t,n){var e=n.css,r=n.media;if(r&&t.setAttribute("media",r),t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}function x(t,n){var e=n.css,r=n.sourceMap;r&&(e+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var o=new Blob([e],{type:"text/css"}),a=t.href;t.href=URL.createObjectURL(o),a&&URL.revokeObjectURL(a)}},function(t,n,e){var r=e(16);"string"==typeof r&&(r=[[t.id,r,""]]),e(14)(r,{}),r.locals&&(t.exports=r.locals)},function(t,n,e){(t.exports=e(13)()).push([t.id,".forna-container svg {\r\n  display: block;\r\n  min-width: 100%;\r\n  width: 100%;\r\n  min-height: 100%;\r\n}\r\n\r\n.forna-container circle.node {\r\n  stroke: #ccc;\r\n  stroke-width: 1px;\r\n  opacity: 1;\r\n  fill: white;\r\n}\r\n\r\n.forna-container polygon.node {\r\n  stroke: #ccc;\r\n  stroke-width: 1px;\r\n  opacity: 1;\r\n  fill: white;\r\n}\r\n\r\n.forna-container circle.node.label {\r\n    stroke: transparent;\r\n    stroke-width: 0;\r\n    fill: white;\r\n    display: inline;\r\n}\r\n\r\n.forna-container circle.outline_node {\r\n    stroke-width: 1px;\r\n    fill: red;\r\n}\r\n\r\n.forna-container circle.protein {\r\n    fill: gray;\r\n    fill-opacity: 0.5;\r\n    stroke-width: 4;\r\n}\r\n\r\n.forna-container circle.hidden_outline {\r\n    stroke-width: 0px;\r\n}\r\n\r\n\r\n.forna-container line.link {\r\n  stroke: #999;\r\n  stroke-opacity: 0.8;\r\n  stroke-width: 2;\r\n}\r\n\r\n.forna-container line.pseudoknot {\r\n    stroke: red;\r\n}\r\n\r\n.forna-container line.basepair {\r\n  stroke: red;\r\n}\r\n\r\n.forna-container line.intermolecule {\r\n  stroke: blue;\r\n}\r\n\r\n.forna-container line.chain_chain {\r\n  stroke-dasharray: 3,3;\r\n}\r\n\r\n.forna-container line.fake {\r\n  stroke: green;\r\n}\r\n\r\n.forna-container .transparent {\r\n    fill: transparent;\r\n    stroke-width: 0;\r\n    stroke-opacity: 0;\r\n    opacity: 0;\r\n    visibility: hidden;\r\n}\r\n\r\n.forna-container .drag_line {\r\n  stroke: #999;\r\n  stroke-width: 2;\r\n  pointer-events: none;\r\n}\r\n\r\n.forna-container .drag_line_hidden {\r\n  stroke: #999;\r\n  stroke-width: 0;\r\n  pointer-events: none;\r\n}\r\n\r\n.forna-container .d3-tip {\r\n    line-height: 1;\r\n    font-weight: bold;\r\n    padding: 6px;\r\n    background: rgba(0, 0, 0, 0.6);\r\n    color: #fff;\r\n    border-radius: 4px;\r\n    pointer-events: none;\r\n          }\r\n\r\n.forna-container text.node-label {\r\n    font-weight: bold;\r\n    font-family: Tahoma, Geneva, sans-serif;\r\n    color: rgb(100,100,100);\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container text {\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container g.gnode {\r\n\r\n}\r\n\r\n.forna-container circle.outline_node.selected {\r\n    visibility: visible;\r\n}\r\n\r\n.forna-container circle.outline_node {\r\n    visibility: hidden;\r\n}\r\n\r\n.forna-container .brush .extent {\r\n  fill-opacity: .1;\r\n  stroke: #fff;\r\n  shape-rendering: crispEdges;\r\n}\r\n\r\n.forna-container .noselect {\r\n    -webkit-touch-callout: none;\r\n    -webkit-user-select: none;\r\n    -khtml-user-select: none;\r\n    -moz-user-select: none;\r\n    -ms-user-select: none;\r\n    user-select: none;\r\n}\r\n",""])},function(t,n,e){var r,o;!function(){var a={version:"3.5.17"},i=[].slice,u=function(t){return i.call(t)},s=this.document;function l(t){return t&&(t.ownerDocument||t.document||t).documentElement}function c(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(s)try{u(s.documentElement.childNodes)[0].nodeType}catch(t){u=function(t){for(var n=t.length,e=new Array(n);n--;)e[n]=t[n];return e}}if(Date.now||(Date.now=function(){return+new Date}),s)try{s.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var f=this.Element.prototype,h=f.setAttribute,p=f.setAttributeNS,d=this.CSSStyleDeclaration.prototype,m=d.setProperty;f.setAttribute=function(t,n){h.call(this,t,n+"")},f.setAttributeNS=function(t,n,e){p.call(this,t,n,e+"")},d.setProperty=function(t,n,e){m.call(this,t,n+"",e)}}function g(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function v(t){return null===t?NaN:+t}function y(t){return!isNaN(t)}function b(t){return{left:function(n,e,r,o){for(arguments.length<3&&(r=0),arguments.length<4&&(o=n.length);r<o;){var a=r+o>>>1;t(n[a],e)<0?r=a+1:o=a}return r},right:function(n,e,r,o){for(arguments.length<3&&(r=0),arguments.length<4&&(o=n.length);r<o;){var a=r+o>>>1;t(n[a],e)>0?o=a:r=a+1}return r}}}a.ascending=g,a.descending=function(t,n){return n<t?-1:n>t?1:n>=t?0:NaN},a.min=function(t,n){var e,r,o=-1,a=t.length;if(1===arguments.length){for(;++o<a;)if(null!=(r=t[o])&&r>=r){e=r;break}for(;++o<a;)null!=(r=t[o])&&e>r&&(e=r)}else{for(;++o<a;)if(null!=(r=n.call(t,t[o],o))&&r>=r){e=r;break}for(;++o<a;)null!=(r=n.call(t,t[o],o))&&e>r&&(e=r)}return e},a.max=function(t,n){var e,r,o=-1,a=t.length;if(1===arguments.length){for(;++o<a;)if(null!=(r=t[o])&&r>=r){e=r;break}for(;++o<a;)null!=(r=t[o])&&r>e&&(e=r)}else{for(;++o<a;)if(null!=(r=n.call(t,t[o],o))&&r>=r){e=r;break}for(;++o<a;)null!=(r=n.call(t,t[o],o))&&r>e&&(e=r)}return e},a.extent=function(t,n){var e,r,o,a=-1,i=t.length;if(1===arguments.length){for(;++a<i;)if(null!=(r=t[a])&&r>=r){e=o=r;break}for(;++a<i;)null!=(r=t[a])&&(e>r&&(e=r),o<r&&(o=r))}else{for(;++a<i;)if(null!=(r=n.call(t,t[a],a))&&r>=r){e=o=r;break}for(;++a<i;)null!=(r=n.call(t,t[a],a))&&(e>r&&(e=r),o<r&&(o=r))}return[e,o]},a.sum=function(t,n){var e,r=0,o=t.length,a=-1;if(1===arguments.length)for(;++a<o;)y(e=+t[a])&&(r+=e);else for(;++a<o;)y(e=+n.call(t,t[a],a))&&(r+=e);return r},a.mean=function(t,n){var e,r=0,o=t.length,a=-1,i=o;if(1===arguments.length)for(;++a<o;)y(e=v(t[a]))?r+=e:--i;else for(;++a<o;)y(e=v(n.call(t,t[a],a)))?r+=e:--i;if(i)return r/i},a.quantile=function(t,n){var e=(t.length-1)*n+1,r=Math.floor(e),o=+t[r-1],a=e-r;return a?o+a*(t[r]-o):o},a.median=function(t,n){var e,r=[],o=t.length,i=-1;if(1===arguments.length)for(;++i<o;)y(e=v(t[i]))&&r.push(e);else for(;++i<o;)y(e=v(n.call(t,t[i],i)))&&r.push(e);if(r.length)return a.quantile(r.sort(g),.5)},a.variance=function(t,n){var e,r,o=t.length,a=0,i=0,u=-1,s=0;if(1===arguments.length)for(;++u<o;)y(e=v(t[u]))&&(i+=(r=e-a)*(e-(a+=r/++s)));else for(;++u<o;)y(e=v(n.call(t,t[u],u)))&&(i+=(r=e-a)*(e-(a+=r/++s)));if(s>1)return i/(s-1)},a.deviation=function(){var t=a.variance.apply(this,arguments);return t?Math.sqrt(t):t};var x=b(g);function M(t){return t.length}a.bisectLeft=x.left,a.bisect=a.bisectRight=x.right,a.bisector=function(t){return b(1===t.length?function(n,e){return g(t(n),e)}:t)},a.shuffle=function(t,n,e){(a=arguments.length)<3&&(e=t.length,a<2&&(n=0));for(var r,o,a=e-n;a;)o=Math.random()*a--|0,r=t[a+n],t[a+n]=t[o+n],t[o+n]=r;return t},a.permute=function(t,n){for(var e=n.length,r=new Array(e);e--;)r[e]=t[n[e]];return r},a.pairs=function(t){for(var n=0,e=t.length-1,r=t[0],o=new Array(e<0?0:e);n<e;)o[n]=[r,r=t[++n]];return o},a.transpose=function(t){if(!(o=t.length))return[];for(var n=-1,e=a.min(t,M),r=new Array(e);++n<e;)for(var o,i=-1,u=r[n]=new Array(o);++i<o;)u[i]=t[i][n];return r},a.zip=function(){return a.transpose(arguments)},a.keys=function(t){var n=[];for(var e in t)n.push(e);return n},a.values=function(t){var n=[];for(var e in t)n.push(t[e]);return n},a.entries=function(t){var n=[];for(var e in t)n.push({key:e,value:t[e]});return n},a.merge=function(t){for(var n,e,r,o=t.length,a=-1,i=0;++a<o;)i+=t[a].length;for(e=new Array(i);--o>=0;)for(n=(r=t[o]).length;--n>=0;)e[--i]=r[n];return e};var w=Math.abs;function _(t){for(var n=1;t*n%1;)n*=10;return n}function k(t,n){for(var e in n)Object.defineProperty(t.prototype,e,{value:n[e],enumerable:!1})}function S(){this._=Object.create(null)}function A(t){return"__proto__"==(t+="")||"\0"===t[0]?"\0"+t:t}function E(t){return"\0"===(t+="")[0]?t.slice(1):t}function T(t){return A(t)in this._}function R(t){return(t=A(t))in this._&&delete this._[t]}function N(){var t=[];for(var n in this._)t.push(E(n));return t}function P(){var t=0;for(var n in this._)++t;return t}function C(){for(var t in this._)return!1;return!0}function O(){this._=Object.create(null)}function L(t){return t}function U(t,n,e){return function(){var r=e.apply(n,arguments);return r===n?t:r}}function D(t,n){if(n in t)return n;n=n.charAt(0).toUpperCase()+n.slice(1);for(var e=0,r=z.length;e<r;++e){var o=z[e]+n;if(o in t)return o}}a.range=function(t,n,e){if(arguments.length<3&&(e=1,arguments.length<2&&(n=t,t=0)),(n-t)/e==1/0)throw new Error("infinite range");var r,o=[],a=_(w(e)),i=-1;if(t*=a,n*=a,(e*=a)<0)for(;(r=t+e*++i)>n;)o.push(r/a);else for(;(r=t+e*++i)<n;)o.push(r/a);return o},a.map=function(t,n){var e=new S;if(t instanceof S)t.forEach((function(t,n){e.set(t,n)}));else if(Array.isArray(t)){var r,o=-1,a=t.length;if(1===arguments.length)for(;++o<a;)e.set(o,t[o]);else for(;++o<a;)e.set(n.call(t,r=t[o],o),r)}else for(var i in t)e.set(i,t[i]);return e},k(S,{has:T,get:function(t){return this._[A(t)]},set:function(t,n){return this._[A(t)]=n},remove:R,keys:N,values:function(){var t=[];for(var n in this._)t.push(this._[n]);return t},entries:function(){var t=[];for(var n in this._)t.push({key:E(n),value:this._[n]});return t},size:P,empty:C,forEach:function(t){for(var n in this._)t.call(this,E(n),this._[n])}}),a.nest=function(){var t,n,e={},r=[],o=[];function i(o,a,u){if(u>=r.length)return n?n.call(e,a):t?a.sort(t):a;for(var s,l,c,f,h=-1,p=a.length,d=r[u++],m=new S;++h<p;)(f=m.get(s=d(l=a[h])))?f.push(l):m.set(s,[l]);return o?(l=o(),c=function(t,n){l.set(t,i(o,n,u))}):(l={},c=function(t,n){l[t]=i(o,n,u)}),m.forEach(c),l}return e.map=function(t,n){return i(n,t,0)},e.entries=function(t){return function t(n,e){if(e>=r.length)return n;var a=[],i=o[e++];return n.forEach((function(n,r){a.push({key:n,values:t(r,e)})})),i?a.sort((function(t,n){return i(t.key,n.key)})):a}(i(a.map,t,0),0)},e.key=function(t){return r.push(t),e},e.sortKeys=function(t){return o[r.length-1]=t,e},e.sortValues=function(n){return t=n,e},e.rollup=function(t){return n=t,e},e},a.set=function(t){var n=new O;if(t)for(var e=0,r=t.length;e<r;++e)n.add(t[e]);return n},k(O,{has:T,add:function(t){return this._[A(t+="")]=!0,t},remove:R,values:N,size:P,empty:C,forEach:function(t){for(var n in this._)t.call(this,E(n))}}),a.behavior={},a.rebind=function(t,n){for(var e,r=1,o=arguments.length;++r<o;)t[e=arguments[r]]=U(t,n,n[e]);return t};var z=["webkit","ms","moz","Moz","o","O"];function q(){}function j(){}function F(t){var n=[],e=new S;function r(){for(var e,r=n,o=-1,a=r.length;++o<a;)(e=r[o].on)&&e.apply(this,arguments);return t}return r.on=function(r,o){var a,i=e.get(r);return arguments.length<2?i&&i.on:(i&&(i.on=null,n=n.slice(0,a=n.indexOf(i)).concat(n.slice(a+1)),e.remove(r)),o&&n.push(e.set(r,{on:o})),t)},r}function B(){a.event.preventDefault()}function I(){for(var t,n=a.event;t=n.sourceEvent;)n=t;return n}function X(t){for(var n=new j,e=0,r=arguments.length;++e<r;)n[arguments[e]]=F(n);return n.of=function(e,r){return function(o){try{var i=o.sourceEvent=a.event;o.target=t,a.event=o,n[o.type].apply(e,r)}finally{a.event=i}}},n}a.dispatch=function(){for(var t=new j,n=-1,e=arguments.length;++n<e;)t[arguments[n]]=F(t);return t},j.prototype.on=function(t,n){var e=t.indexOf("."),r="";if(e>=0&&(r=t.slice(e+1),t=t.slice(0,e)),t)return arguments.length<2?this[t].on(r):this[t].on(r,n);if(2===arguments.length){if(null==n)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}},a.event=null,a.requote=function(t){return t.replace(Y,"\\$&")};var Y=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,V={}.__proto__?function(t,n){t.__proto__=n}:function(t,n){for(var e in n)t[e]=n[e]};function H(t){return V(t,J),t}var G=function(t,n){return n.querySelector(t)},W=function(t,n){return n.querySelectorAll(t)},Z=function(t,n){var e=t.matches||t[D(t,"matchesSelector")];return(Z=function(t,n){return e.call(t,n)})(t,n)};"function"==typeof Sizzle&&(G=function(t,n){return Sizzle(t,n)[0]||null},W=Sizzle,Z=Sizzle.matchesSelector),a.selection=function(){return a.select(s.documentElement)};var J=a.selection.prototype=[];function $(t){return"function"==typeof t?t:function(){return G(t,this)}}function K(t){return"function"==typeof t?t:function(){return W(t,this)}}J.select=function(t){var n,e,r,o,a=[];t=$(t);for(var i=-1,u=this.length;++i<u;){a.push(n=[]),n.parentNode=(r=this[i]).parentNode;for(var s=-1,l=r.length;++s<l;)(o=r[s])?(n.push(e=t.call(o,o.__data__,s,i)),e&&"__data__"in o&&(e.__data__=o.__data__)):n.push(null)}return H(a)},J.selectAll=function(t){var n,e,r=[];t=K(t);for(var o=-1,a=this.length;++o<a;)for(var i=this[o],s=-1,l=i.length;++s<l;)(e=i[s])&&(r.push(n=u(t.call(e,e.__data__,s,o))),n.parentNode=e);return H(r)};var Q="http://www.w3.org/1999/xhtml",tt={svg:"http://www.w3.org/2000/svg",xhtml:Q,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function nt(t,n){return t=a.ns.qualify(t),null==n?t.local?function(){this.removeAttributeNS(t.space,t.local)}:function(){this.removeAttribute(t)}:"function"==typeof n?t.local?function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}:function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}:t.local?function(){this.setAttributeNS(t.space,t.local,n)}:function(){this.setAttribute(t,n)}}function et(t){return t.trim().replace(/\s+/g," ")}function rt(t){return new RegExp("(?:^|\\s+)"+a.requote(t)+"(?:\\s+|$)","g")}function ot(t){return(t+"").trim().split(/^|\s+/)}function at(t,n){var e=(t=ot(t).map(it)).length;return"function"==typeof n?function(){for(var r=-1,o=n.apply(this,arguments);++r<e;)t[r](this,o)}:function(){for(var r=-1;++r<e;)t[r](this,n)}}function it(t){var n=rt(t);return function(e,r){if(o=e.classList)return r?o.add(t):o.remove(t);var o=e.getAttribute("class")||"";r?(n.lastIndex=0,n.test(o)||e.setAttribute("class",et(o+" "+t))):e.setAttribute("class",et(o.replace(n," ")))}}function ut(t,n,e){return null==n?function(){this.style.removeProperty(t)}:"function"==typeof n?function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}:function(){this.style.setProperty(t,n,e)}}function st(t,n){return null==n?function(){delete this[t]}:"function"==typeof n?function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}:function(){this[t]=n}}function lt(t){return"function"==typeof t?t:(t=a.ns.qualify(t)).local?function(){return this.ownerDocument.createElementNS(t.space,t.local)}:function(){var n=this.ownerDocument,e=this.namespaceURI;return e===Q&&n.documentElement.namespaceURI===Q?n.createElement(t):n.createElementNS(e,t)}}function ct(){var t=this.parentNode;t&&t.removeChild(this)}function ft(t){return{__data__:t}}function ht(t){return function(){return Z(this,t)}}function pt(t){return arguments.length||(t=g),function(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}}function dt(t,n){for(var e=0,r=t.length;e<r;e++)for(var o,a=t[e],i=0,u=a.length;i<u;i++)(o=a[i])&&n(o,i,e);return t}function mt(t){return V(t,gt),t}a.ns={prefix:tt,qualify:function(t){var n=t.indexOf(":"),e=t;return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),tt.hasOwnProperty(e)?{space:tt[e],local:t}:t}},J.attr=function(t,n){if(arguments.length<2){if("string"==typeof t){var e=this.node();return(t=a.ns.qualify(t)).local?e.getAttributeNS(t.space,t.local):e.getAttribute(t)}for(n in t)this.each(nt(n,t[n]));return this}return this.each(nt(t,n))},J.classed=function(t,n){if(arguments.length<2){if("string"==typeof t){var e=this.node(),r=(t=ot(t)).length,o=-1;if(n=e.classList){for(;++o<r;)if(!n.contains(t[o]))return!1}else for(n=e.getAttribute("class");++o<r;)if(!rt(t[o]).test(n))return!1;return!0}for(n in t)this.each(at(n,t[n]));return this}return this.each(at(t,n))},J.style=function(t,n,e){var r=arguments.length;if(r<3){if("string"!=typeof t){for(e in r<2&&(n=""),t)this.each(ut(e,t[e],n));return this}if(r<2){var o=this.node();return c(o).getComputedStyle(o,null).getPropertyValue(t)}e=""}return this.each(ut(t,n,e))},J.property=function(t,n){if(arguments.length<2){if("string"==typeof t)return this.node()[t];for(n in t)this.each(st(n,t[n]));return this}return this.each(st(t,n))},J.text=function(t){return arguments.length?this.each("function"==typeof t?function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}:null==t?function(){this.textContent=""}:function(){this.textContent=t}):this.node().textContent},J.html=function(t){return arguments.length?this.each("function"==typeof t?function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}:null==t?function(){this.innerHTML=""}:function(){this.innerHTML=t}):this.node().innerHTML},J.append=function(t){return t=lt(t),this.select((function(){return this.appendChild(t.apply(this,arguments))}))},J.insert=function(t,n){return t=lt(t),n=$(n),this.select((function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)}))},J.remove=function(){return this.each(ct)},J.data=function(t,n){var e,r,o=-1,a=this.length;if(!arguments.length){for(t=new Array(a=(e=this[0]).length);++o<a;)(r=e[o])&&(t[o]=r.__data__);return t}function i(t,e){var r,o,a,i=t.length,c=e.length,f=Math.min(i,c),h=new Array(c),p=new Array(c),d=new Array(i);if(n){var m,g=new S,v=new Array(i);for(r=-1;++r<i;)(o=t[r])&&(g.has(m=n.call(o,o.__data__,r))?d[r]=o:g.set(m,o),v[r]=m);for(r=-1;++r<c;)(o=g.get(m=n.call(e,a=e[r],r)))?!0!==o&&(h[r]=o,o.__data__=a):p[r]=ft(a),g.set(m,!0);for(r=-1;++r<i;)r in v&&!0!==g.get(v[r])&&(d[r]=t[r])}else{for(r=-1;++r<f;)o=t[r],a=e[r],o?(o.__data__=a,h[r]=o):p[r]=ft(a);for(;r<c;++r)p[r]=ft(e[r]);for(;r<i;++r)d[r]=t[r]}p.update=h,p.parentNode=h.parentNode=d.parentNode=t.parentNode,u.push(p),s.push(h),l.push(d)}var u=mt([]),s=H([]),l=H([]);if("function"==typeof t)for(;++o<a;)i(e=this[o],t.call(e,e.parentNode.__data__,o));else for(;++o<a;)i(e=this[o],t);return s.enter=function(){return u},s.exit=function(){return l},s},J.datum=function(t){return arguments.length?this.property("__data__",t):this.property("__data__")},J.filter=function(t){var n,e,r,o=[];"function"!=typeof t&&(t=ht(t));for(var a=0,i=this.length;a<i;a++){o.push(n=[]),n.parentNode=(e=this[a]).parentNode;for(var u=0,s=e.length;u<s;u++)(r=e[u])&&t.call(r,r.__data__,u,a)&&n.push(r)}return H(o)},J.order=function(){for(var t=-1,n=this.length;++t<n;)for(var e,r=this[t],o=r.length-1,a=r[o];--o>=0;)(e=r[o])&&(a&&a!==e.nextSibling&&a.parentNode.insertBefore(e,a),a=e);return this},J.sort=function(t){t=pt.apply(this,arguments);for(var n=-1,e=this.length;++n<e;)this[n].sort(t);return this.order()},J.each=function(t){return dt(this,(function(n,e,r){t.call(n,n.__data__,e,r)}))},J.call=function(t){var n=u(arguments);return t.apply(n[0]=this,n),this},J.empty=function(){return!this.node()},J.node=function(){for(var t=0,n=this.length;t<n;t++)for(var e=this[t],r=0,o=e.length;r<o;r++){var a=e[r];if(a)return a}return null},J.size=function(){var t=0;return dt(this,(function(){++t})),t};var gt=[];function vt(t){var n,e;return function(r,o,a){var i,u=t[a].update,s=u.length;for(a!=e&&(e=a,n=0),o>=n&&(n=o+1);!(i=u[n])&&++n<s;);return i}}function yt(t,n,e){var r="__on"+t,o=t.indexOf("."),i=xt;o>0&&(t=t.slice(0,o));var s=bt.get(t);function l(){var n=this[r];n&&(this.removeEventListener(t,n,n.$),delete this[r])}return s&&(t=s,i=Mt),o?n?function(){var o=i(n,u(arguments));l.call(this),this.addEventListener(t,this[r]=o,o.$=e),o._=n}:l:n?q:function(){var n,e=new RegExp("^__on([^.]+)"+a.requote(t)+"$");for(var r in this)if(n=r.match(e)){var o=this[r];this.removeEventListener(n[1],o,o.$),delete this[r]}}}a.selection.enter=mt,a.selection.enter.prototype=gt,gt.append=J.append,gt.empty=J.empty,gt.node=J.node,gt.call=J.call,gt.size=J.size,gt.select=function(t){for(var n,e,r,o,a,i=[],u=-1,s=this.length;++u<s;){r=(o=this[u]).update,i.push(n=[]),n.parentNode=o.parentNode;for(var l=-1,c=o.length;++l<c;)(a=o[l])?(n.push(r[l]=e=t.call(o.parentNode,a.__data__,l,u)),e.__data__=a.__data__):n.push(null)}return H(i)},gt.insert=function(t,n){return arguments.length<2&&(n=vt(this)),J.insert.call(this,t,n)},a.select=function(t){var n;return"string"==typeof t?(n=[G(t,s)]).parentNode=s.documentElement:(n=[t]).parentNode=l(t),H([n])},a.selectAll=function(t){var n;return"string"==typeof t?(n=u(W(t,s))).parentNode=s.documentElement:(n=u(t)).parentNode=null,H([n])},J.on=function(t,n,e){var r=arguments.length;if(r<3){if("string"!=typeof t){for(e in r<2&&(n=!1),t)this.each(yt(e,t[e],n));return this}if(r<2)return(r=this.node()["__on"+t])&&r._;e=!1}return this.each(yt(t,n,e))};var bt=a.map({mouseenter:"mouseover",mouseleave:"mouseout"});function xt(t,n){return function(e){var r=a.event;a.event=e,n[0]=this.__data__;try{t.apply(this,n)}finally{a.event=r}}}function Mt(t,n){var e=xt(t,n);return function(t){var n=t.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||e.call(this,t)}}s&&bt.forEach((function(t){"on"+t in s&&bt.remove(t)}));var wt,_t=0;function kt(t){var n=".dragsuppress-"+ ++_t,e="click"+n,r=a.select(c(t)).on("touchmove"+n,B).on("dragstart"+n,B).on("selectstart"+n,B);if(null==wt&&(wt=!("onselectstart"in t)&&D(t.style,"userSelect")),wt){var o=l(t).style,i=o[wt];o[wt]="none"}return function(t){if(r.on(n,null),wt&&(o[wt]=i),t){var a=function(){r.on(e,null)};r.on(e,(function(){B(),a()}),!0),setTimeout(a,0)}}}a.mouse=function(t){return At(t,I())};var St=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;function At(t,n){n.changedTouches&&(n=n.changedTouches[0]);var e=t.ownerSVGElement||t;if(e.createSVGPoint){var r=e.createSVGPoint();if(St<0){var o=c(t);if(o.scrollX||o.scrollY){var i=(e=a.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important"))[0][0].getScreenCTM();St=!(i.f||i.e),e.remove()}}return St?(r.x=n.pageX,r.y=n.pageY):(r.x=n.clientX,r.y=n.clientY),[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}var u=t.getBoundingClientRect();return[n.clientX-u.left-t.clientLeft,n.clientY-u.top-t.clientTop]}function Et(){return a.event.changedTouches[0].identifier}a.touch=function(t,n,e){if(arguments.length<3&&(e=n,n=I().changedTouches),n)for(var r,o=0,a=n.length;o<a;++o)if((r=n[o]).identifier===e)return At(t,r)},a.behavior.drag=function(){var t=X(o,"drag","dragstart","dragend"),n=null,e=i(q,a.mouse,c,"mousemove","mouseup"),r=i(Et,a.touch,L,"touchmove","touchend");function o(){this.on("mousedown.drag",e).on("touchstart.drag",r)}function i(e,r,o,i,u){return function(){var s,l=this,c=a.event.target.correspondingElement||a.event.target,f=l.parentNode,h=t.of(l,arguments),p=0,d=e(),m=".drag"+(null==d?"":"-"+d),g=a.select(o(c)).on(i+m,b).on(u+m,x),v=kt(c),y=r(f,d);function b(){var t,n,e=r(f,d);e&&(t=e[0]-y[0],n=e[1]-y[1],p|=t|n,y=e,h({type:"drag",x:e[0]+s[0],y:e[1]+s[1],dx:t,dy:n}))}function x(){r(f,d)&&(g.on(i+m,null).on(u+m,null),v(p),h({type:"dragend"}))}s=n?[(s=n.apply(l,arguments)).x-y[0],s.y-y[1]]:[0,0],h({type:"dragstart"})}}return o.origin=function(t){return arguments.length?(n=t,o):n},a.rebind(o,t,"on")},a.touches=function(t,n){return arguments.length<2&&(n=I().touches),n?u(n).map((function(n){var e=At(t,n);return e.identifier=n.identifier,e})):[]};var Tt=1e-6,Rt=Tt*Tt,Nt=Math.PI,Pt=2*Nt,Ct=Pt-Tt,Ot=Nt/2,Lt=Nt/180,Ut=180/Nt;function Dt(t){return t>0?1:t<0?-1:0}function zt(t,n,e){return(n[0]-t[0])*(e[1]-t[1])-(n[1]-t[1])*(e[0]-t[0])}function qt(t){return t>1?0:t<-1?Nt:Math.acos(t)}function jt(t){return t>1?Ot:t<-1?-Ot:Math.asin(t)}function Ft(t){return((t=Math.exp(t))+1/t)/2}function Bt(t){return(t=Math.sin(t/2))*t}var It=Math.SQRT2;a.interpolateZoom=function(t,n){var e,r,o=t[0],a=t[1],i=t[2],u=n[0],s=n[1],l=n[2],c=u-o,f=s-a,h=c*c+f*f;if(h<Rt)r=Math.log(l/i)/It,e=function(t){return[o+t*c,a+t*f,i*Math.exp(It*t*r)]};else{var p=Math.sqrt(h),d=(l*l-i*i+4*h)/(2*i*2*p),m=(l*l-i*i-4*h)/(2*l*2*p),g=Math.log(Math.sqrt(d*d+1)-d),v=Math.log(Math.sqrt(m*m+1)-m);r=(v-g)/It,e=function(t){var n,e=t*r,u=Ft(g),s=i/(2*p)*(u*(n=It*e+g,((n=Math.exp(2*n))-1)/(n+1))-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[o+s*c,a+s*f,i*u/Ft(It*e+g)]}}return e.duration=1e3*r,e},a.behavior.zoom=function(){var t,n,e,r,o,i,u,l,f,h={x:0,y:0,k:1},p=[960,500],d=Vt,m=250,g=0,v="mousedown.zoom",y="mousemove.zoom",b="mouseup.zoom",x="touchstart.zoom",M=X(w,"zoomstart","zoom","zoomend");function w(t){t.on(v,P).on(Yt+".zoom",O).on("dblclick.zoom",L).on(x,C)}function _(t){return[(t[0]-h.x)/h.k,(t[1]-h.y)/h.k]}function k(t){h.k=Math.max(d[0],Math.min(d[1],t))}function S(t,n){n=function(t){return[t[0]*h.k+h.x,t[1]*h.k+h.y]}(n),h.x+=t[0]-n[0],h.y+=t[1]-n[1]}function A(t,e,r,o){t.__chart__={x:h.x,y:h.y,k:h.k},k(Math.pow(2,o)),S(n=e,r),t=a.select(t),m>0&&(t=t.transition().duration(m)),t.call(w.event)}function E(){u&&u.domain(i.range().map((function(t){return(t-h.x)/h.k})).map(i.invert)),f&&f.domain(l.range().map((function(t){return(t-h.y)/h.k})).map(l.invert))}function T(t){g++||t({type:"zoomstart"})}function R(t){E(),t({type:"zoom",scale:h.k,translate:[h.x,h.y]})}function N(t){--g||(t({type:"zoomend"}),n=null)}function P(){var t=this,n=M.of(t,arguments),e=0,r=a.select(c(t)).on(y,u).on(b,s),o=_(a.mouse(t)),i=kt(t);function u(){e=1,S(a.mouse(t),o),R(n)}function s(){r.on(y,null).on(b,null),i(e),N(n)}Mu.call(t),T(n)}function C(){var t,n=this,e=M.of(n,arguments),r={},i=0,u=".zoom-"+a.event.changedTouches[0].identifier,s="touchmove"+u,l="touchend"+u,c=[],f=a.select(n),p=kt(n);function d(){var e=a.touches(n);return t=h.k,e.forEach((function(t){t.identifier in r&&(r[t.identifier]=_(t))})),e}function m(){var t=a.event.target;a.select(t).on(s,g).on(l,y),c.push(t);for(var e=a.event.changedTouches,u=0,f=e.length;u<f;++u)r[e[u].identifier]=null;var p=d(),m=Date.now();if(1===p.length){if(m-o<500){var v=p[0];A(n,v,r[v.identifier],Math.floor(Math.log(h.k)/Math.LN2)+1),B()}o=m}else if(p.length>1){v=p[0];var b=p[1],x=v[0]-b[0],M=v[1]-b[1];i=x*x+M*M}}function g(){var u,s,l,c,f=a.touches(n);Mu.call(n);for(var h=0,p=f.length;h<p;++h,c=null)if(l=f[h],c=r[l.identifier]){if(s)break;u=l,s=c}if(c){var d=(d=l[0]-u[0])*d+(d=l[1]-u[1])*d,m=i&&Math.sqrt(d/i);u=[(u[0]+l[0])/2,(u[1]+l[1])/2],s=[(s[0]+c[0])/2,(s[1]+c[1])/2],k(m*t)}o=null,S(u,s),R(e)}function y(){if(a.event.touches.length){for(var t=a.event.changedTouches,n=0,o=t.length;n<o;++n)delete r[t[n].identifier];for(var i in r)return void d()}a.selectAll(c).on(u,null),f.on(v,P).on(x,C),p(),N(e)}m(),T(e),f.on(v,null).on(x,m)}function O(){var o=M.of(this,arguments);r?clearTimeout(r):(Mu.call(this),t=_(n=e||a.mouse(this)),T(o)),r=setTimeout((function(){r=null,N(o)}),50),B(),k(Math.pow(2,.002*Xt())*h.k),S(n,t),R(o)}function L(){var t=a.mouse(this),n=Math.log(h.k)/Math.LN2;A(this,t,_(t),a.event.shiftKey?Math.ceil(n)-1:Math.floor(n)+1)}return Yt||(Yt="onwheel"in s?(Xt=function(){return-a.event.deltaY*(a.event.deltaMode?120:1)},"wheel"):"onmousewheel"in s?(Xt=function(){return a.event.wheelDelta},"mousewheel"):(Xt=function(){return-a.event.detail},"MozMousePixelScroll")),w.event=function(t){t.each((function(){var t=M.of(this,arguments),e=h;ku?a.select(this).transition().each("start.zoom",(function(){h=this.__chart__||{x:0,y:0,k:1},T(t)})).tween("zoom:zoom",(function(){var r=p[0],o=p[1],i=n?n[0]:r/2,u=n?n[1]:o/2,s=a.interpolateZoom([(i-h.x)/h.k,(u-h.y)/h.k,r/h.k],[(i-e.x)/e.k,(u-e.y)/e.k,r/e.k]);return function(n){var e=s(n),o=r/e[2];this.__chart__=h={x:i-e[0]*o,y:u-e[1]*o,k:o},R(t)}})).each("interrupt.zoom",(function(){N(t)})).each("end.zoom",(function(){N(t)})):(this.__chart__=h,T(t),R(t),N(t))}))},w.translate=function(t){return arguments.length?(h={x:+t[0],y:+t[1],k:h.k},E(),w):[h.x,h.y]},w.scale=function(t){return arguments.length?(h={x:h.x,y:h.y,k:null},k(+t),E(),w):h.k},w.scaleExtent=function(t){return arguments.length?(d=null==t?Vt:[+t[0],+t[1]],w):d},w.center=function(t){return arguments.length?(e=t&&[+t[0],+t[1]],w):e},w.size=function(t){return arguments.length?(p=t&&[+t[0],+t[1]],w):p},w.duration=function(t){return arguments.length?(m=+t,w):m},w.x=function(t){return arguments.length?(u=t,i=t.copy(),h={x:0,y:0,k:1},w):u},w.y=function(t){return arguments.length?(f=t,l=t.copy(),h={x:0,y:0,k:1},w):f},a.rebind(w,M,"on")};var Xt,Yt,Vt=[0,1/0];function Ht(){}function Gt(t,n,e){return this instanceof Gt?(this.h=+t,this.s=+n,void(this.l=+e)):arguments.length<2?t instanceof Gt?new Gt(t.h,t.s,t.l):pn(""+t,dn,Gt):new Gt(t,n,e)}a.color=Ht,Ht.prototype.toString=function(){return this.rgb()+""},a.hsl=Gt;var Wt=Gt.prototype=new Ht;function Zt(t,n,e){var r,o;function a(t){return Math.round(255*function(t){return t>360?t-=360:t<0&&(t+=360),t<60?r+(o-r)*t/60:t<180?o:t<240?r+(o-r)*(240-t)/60:r}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,n=isNaN(n)?0:n<0?0:n>1?1:n,r=2*(e=e<0?0:e>1?1:e)-(o=e<=.5?e*(1+n):e+n-e*n),new sn(a(t+120),a(t),a(t-120))}function Jt(t,n,e){return this instanceof Jt?(this.h=+t,this.c=+n,void(this.l=+e)):arguments.length<2?t instanceof Jt?new Jt(t.h,t.c,t.l):rn(t instanceof Qt?t.l:(t=mn((t=a.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new Jt(t,n,e)}Wt.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new Gt(this.h,this.s,this.l/t)},Wt.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new Gt(this.h,this.s,t*this.l)},Wt.rgb=function(){return Zt(this.h,this.s,this.l)},a.hcl=Jt;var $t=Jt.prototype=new Ht;function Kt(t,n,e){return isNaN(t)&&(t=0),isNaN(n)&&(n=0),new Qt(e,Math.cos(t*=Lt)*n,Math.sin(t)*n)}function Qt(t,n,e){return this instanceof Qt?(this.l=+t,this.a=+n,void(this.b=+e)):arguments.length<2?t instanceof Qt?new Qt(t.l,t.a,t.b):t instanceof Jt?Kt(t.h,t.c,t.l):mn((t=sn(t)).r,t.g,t.b):new Qt(t,n,e)}$t.brighter=function(t){return new Jt(this.h,this.c,Math.min(100,this.l+tn*(arguments.length?t:1)))},$t.darker=function(t){return new Jt(this.h,this.c,Math.max(0,this.l-tn*(arguments.length?t:1)))},$t.rgb=function(){return Kt(this.h,this.c,this.l).rgb()},a.lab=Qt;var tn=18,nn=Qt.prototype=new Ht;function en(t,n,e){var r=(t+16)/116,o=r+n/500,a=r-e/200;return new sn(un(3.2404542*(o=.95047*on(o))-1.5371385*(r=1*on(r))-.4985314*(a=1.08883*on(a))),un(-.969266*o+1.8760108*r+.041556*a),un(.0556434*o-.2040259*r+1.0572252*a))}function rn(t,n,e){return t>0?new Jt(Math.atan2(e,n)*Ut,Math.sqrt(n*n+e*e),t):new Jt(NaN,NaN,t)}function on(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function an(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function un(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function sn(t,n,e){return this instanceof sn?(this.r=~~t,this.g=~~n,void(this.b=~~e)):arguments.length<2?t instanceof sn?new sn(t.r,t.g,t.b):pn(""+t,sn,Zt):new sn(t,n,e)}function ln(t){return new sn(t>>16,t>>8&255,255&t)}function cn(t){return ln(t)+""}nn.brighter=function(t){return new Qt(Math.min(100,this.l+tn*(arguments.length?t:1)),this.a,this.b)},nn.darker=function(t){return new Qt(Math.max(0,this.l-tn*(arguments.length?t:1)),this.a,this.b)},nn.rgb=function(){return en(this.l,this.a,this.b)},a.rgb=sn;var fn=sn.prototype=new Ht;function hn(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function pn(t,n,e){var r,o,a,i=0,u=0,s=0;if(r=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(o=r[2].split(","),r[1]){case"hsl":return e(parseFloat(o[0]),parseFloat(o[1])/100,parseFloat(o[2])/100);case"rgb":return n(vn(o[0]),vn(o[1]),vn(o[2]))}return(a=yn.get(t))?n(a.r,a.g,a.b):(null==t||"#"!==t.charAt(0)||isNaN(a=parseInt(t.slice(1),16))||(4===t.length?(i=(3840&a)>>4,i|=i>>4,u=240&a,u|=u>>4,s=15&a,s|=s<<4):7===t.length&&(i=(16711680&a)>>16,u=(65280&a)>>8,s=255&a)),n(i,u,s))}function dn(t,n,e){var r,o,a=Math.min(t/=255,n/=255,e/=255),i=Math.max(t,n,e),u=i-a,s=(i+a)/2;return u?(o=s<.5?u/(i+a):u/(2-i-a),r=t==i?(n-e)/u+(n<e?6:0):n==i?(e-t)/u+2:(t-n)/u+4,r*=60):(r=NaN,o=s>0&&s<1?0:r),new Gt(r,o,s)}function mn(t,n,e){var r=an((.4124564*(t=gn(t))+.3575761*(n=gn(n))+.1804375*(e=gn(e)))/.95047),o=an((.2126729*t+.7151522*n+.072175*e)/1);return Qt(116*o-16,500*(r-o),200*(o-an((.0193339*t+.119192*n+.9503041*e)/1.08883)))}function gn(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function vn(t){var n=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*n):n}fn.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var n=this.r,e=this.g,r=this.b,o=30;return n||e||r?(n&&n<o&&(n=o),e&&e<o&&(e=o),r&&r<o&&(r=o),new sn(Math.min(255,n/t),Math.min(255,e/t),Math.min(255,r/t))):new sn(o,o,o)},fn.darker=function(t){return new sn((t=Math.pow(.7,arguments.length?t:1))*this.r,t*this.g,t*this.b)},fn.hsl=function(){return dn(this.r,this.g,this.b)},fn.toString=function(){return"#"+hn(this.r)+hn(this.g)+hn(this.b)};var yn=a.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});function bn(t){return"function"==typeof t?t:function(){return t}}function xn(t){return function(n,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),Mn(n,e,t,r)}}function Mn(t,n,e,r){var o={},i=a.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,c=null;function f(){var t,n=l.status;if(!n&&function(t){var n=t.responseType;return n&&"text"!==n?t.response:t.responseText}(l)||n>=200&&n<300||304===n){try{t=e.call(o,l)}catch(t){return void i.error.call(o,t)}i.load.call(o,t)}else i.error.call(o,l)}return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=f:l.onreadystatechange=function(){l.readyState>3&&f()},l.onprogress=function(t){var n=a.event;a.event=t;try{i.progress.call(o,l)}finally{a.event=n}},o.header=function(t,n){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==n?delete s[t]:s[t]=n+"",o)},o.mimeType=function(t){return arguments.length?(n=null==t?null:t+"",o):n},o.responseType=function(t){return arguments.length?(c=t,o):c},o.response=function(t){return e=t,o},["get","post"].forEach((function(t){o[t]=function(){return o.send.apply(o,[t].concat(u(arguments)))}})),o.send=function(e,r,a){if(2===arguments.length&&"function"==typeof r&&(a=r,r=null),l.open(e,t,!0),null==n||"accept"in s||(s.accept=n+",*/*"),l.setRequestHeader)for(var u in s)l.setRequestHeader(u,s[u]);return null!=n&&l.overrideMimeType&&l.overrideMimeType(n),null!=c&&(l.responseType=c),null!=a&&o.on("error",a).on("load",(function(t){a(null,t)})),i.beforesend.call(o,l),l.send(null==r?null:r),o},o.abort=function(){return l.abort(),o},a.rebind(o,i,"on"),null==r?o:o.get(function(t){return 1===t.length?function(n,e){t(null==n?e:null)}:t}(r))}yn.forEach((function(t,n){yn.set(t,ln(n))})),a.functor=bn,a.xhr=xn(L),a.dsv=function(t,n){var e=new RegExp('["'+t+"\n]"),r=t.charCodeAt(0);function o(t,e,r){arguments.length<3&&(r=e,e=null);var o=Mn(t,n,null==e?a:i(e),r);return o.row=function(t){return arguments.length?o.response(null==(e=t)?a:i(t)):e},o}function a(t){return o.parse(t.responseText)}function i(t){return function(n){return o.parse(n.responseText,t)}}function u(n){return n.map(s).join(t)}function s(t){return e.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}return o.parse=function(t,n){var e;return o.parseRows(t,(function(t,r){if(e)return e(t,r-1);var o=new Function("d","return {"+t.map((function(t,n){return JSON.stringify(t)+": d["+n+"]"})).join(",")+"}");e=n?function(t,e){return n(o(t),e)}:o}))},o.parseRows=function(t,n){var e,o,a={},i={},u=[],s=t.length,l=0,c=0;function f(){if(l>=s)return i;if(o)return o=!1,a;var n=l;if(34===t.charCodeAt(n)){for(var e=n;e++<s;)if(34===t.charCodeAt(e)){if(34!==t.charCodeAt(e+1))break;++e}return l=e+2,13===(u=t.charCodeAt(e+1))?(o=!0,10===t.charCodeAt(e+2)&&++l):10===u&&(o=!0),t.slice(n+1,e).replace(/""/g,'"')}for(;l<s;){var u,c=1;if(10===(u=t.charCodeAt(l++)))o=!0;else if(13===u)o=!0,10===t.charCodeAt(l)&&(++l,++c);else if(u!==r)continue;return t.slice(n,l-c)}return t.slice(n)}for(;(e=f())!==i;){for(var h=[];e!==a&&e!==i;)h.push(e),e=f();n&&null==(h=n(h,c++))||u.push(h)}return u},o.format=function(n){if(Array.isArray(n[0]))return o.formatRows(n);var e=new O,r=[];return n.forEach((function(t){for(var n in t)e.has(n)||r.push(e.add(n))})),[r.map(s).join(t)].concat(n.map((function(n){return r.map((function(t){return s(n[t])})).join(t)}))).join("\n")},o.formatRows=function(t){return t.map(u).join("\n")},o},a.csv=a.dsv(",","text/csv"),a.tsv=a.dsv("\t","text/tab-separated-values");var wn,_n,kn,Sn,An=this[D(this,"requestAnimationFrame")]||function(t){setTimeout(t,17)};function En(t,n,e){var r=arguments.length;r<2&&(n=0),r<3&&(e=Date.now());var o=e+n,a={c:t,t:o,n:null};return _n?_n.n=a:wn=a,_n=a,kn||(Sn=clearTimeout(Sn),kn=1,An(Tn)),a}function Tn(){var t=Rn(),n=Nn()-t;n>24?(isFinite(n)&&(clearTimeout(Sn),Sn=setTimeout(Tn,n)),kn=0):(kn=1,An(Tn))}function Rn(){for(var t=Date.now(),n=wn;n;)t>=n.t&&n.c(t-n.t)&&(n.c=null),n=n.n;return t}function Nn(){for(var t,n=wn,e=1/0;n;)n.c?(n.t<e&&(e=n.t),n=(t=n).n):n=t?t.n=n.n:wn=n.n;return _n=t,e}function Pn(t,n){return n-(t?Math.ceil(Math.log(t)/Math.LN10):1)}a.timer=function(){En.apply(this,arguments)},a.timer.flush=function(){Rn(),Nn()},a.round=function(t,n){return n?Math.round(t*(n=Math.pow(10,n)))/n:Math.round(t)};var Cn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map((function(t,n){var e=Math.pow(10,3*w(8-n));return{scale:n>8?function(t){return t/e}:function(t){return t*e},symbol:t}}));function On(t){var n=t.decimal,e=t.thousands,r=t.grouping,o=t.currency,i=r&&e?function(t,n){for(var o=t.length,a=[],i=0,u=r[0],s=0;o>0&&u>0&&(s+u+1>n&&(u=Math.max(1,n-s)),a.push(t.substring(o-=u,o+u)),!((s+=u+1)>n));)u=r[i=(i+1)%r.length];return a.reverse().join(e)}:L;return function(t){var e=Ln.exec(t),r=e[1]||" ",u=e[2]||">",s=e[3]||"-",l=e[4]||"",c=e[5],f=+e[6],h=e[7],p=e[8],d=e[9],m=1,g="",v="",y=!1,b=!0;switch(p&&(p=+p.substring(1)),(c||"0"===r&&"="===u)&&(c=r="0",u="="),d){case"n":h=!0,d="g";break;case"%":m=100,v="%",d="f";break;case"p":m=100,v="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(g="0"+d.toLowerCase());case"c":b=!1;case"d":y=!0,p=0;break;case"s":m=-1,d="r"}"$"===l&&(g=o[0],v=o[1]),"r"!=d||p||(d="g"),null!=p&&("g"==d?p=Math.max(1,Math.min(21,p)):"e"!=d&&"f"!=d||(p=Math.max(0,Math.min(20,p)))),d=Un.get(d)||Dn;var x=c&&h;return function(t){var e=v;if(y&&t%1)return"";var o=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(m<0){var l=a.formatPrefix(t,p);t=l.scale(t),e=l.symbol+v}else t*=m;var M,w,_=(t=d(t,p)).lastIndexOf(".");if(_<0){var k=b?t.lastIndexOf("e"):-1;k<0?(M=t,w=""):(M=t.substring(0,k),w=t.substring(k))}else M=t.substring(0,_),w=n+t.substring(_+1);!c&&h&&(M=i(M,1/0));var S=g.length+M.length+w.length+(x?0:o.length),A=S<f?new Array(S=f-S+1).join(r):"";return x&&(M=i(A+M,A.length?f-w.length:1/0)),o+=g,t=M+w,("<"===u?o+t+A:">"===u?A+o+t:"^"===u?A.substring(0,S>>=1)+o+t+A.substring(S):o+(x?t:A+t))+e}}}a.formatPrefix=function(t,n){var e=0;return(t=+t)&&(t<0&&(t*=-1),n&&(t=a.round(t,Pn(t,n))),e=1+Math.floor(1e-12+Math.log(t)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((e-1)/3)))),Cn[8+e/3]};var Ln=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Un=a.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,n){return t.toPrecision(n)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},r:function(t,n){return(t=a.round(t,Pn(t,n))).toFixed(Math.max(0,Math.min(20,Pn(t*(1+1e-15),n))))}});function Dn(t){return t+""}var zn=a.time={},qn=Date;function jn(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}jn.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){Fn.setUTCDate.apply(this._,arguments)},setDay:function(){Fn.setUTCDay.apply(this._,arguments)},setFullYear:function(){Fn.setUTCFullYear.apply(this._,arguments)},setHours:function(){Fn.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Fn.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Fn.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Fn.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Fn.setUTCSeconds.apply(this._,arguments)},setTime:function(){Fn.setTime.apply(this._,arguments)}};var Fn=Date.prototype;function Bn(t,n,e){function r(n){var e=t(n),r=a(e,1);return n-e<r-n?e:r}function o(e){return n(e=t(new qn(e-1)),1),e}function a(t,e){return n(t=new qn(+t),e),t}function i(t,r,a){var i=o(t),u=[];if(a>1)for(;i<r;)e(i)%a||u.push(new Date(+i)),n(i,1);else for(;i<r;)u.push(new Date(+i)),n(i,1);return u}t.floor=t,t.round=r,t.ceil=o,t.offset=a,t.range=i;var u=t.utc=In(t);return u.floor=u,u.round=In(r),u.ceil=In(o),u.offset=In(a),u.range=function(t,n,e){try{qn=jn;var r=new jn;return r._=t,i(r,n,e)}finally{qn=Date}},t}function In(t){return function(n,e){try{qn=jn;var r=new jn;return r._=n,t(r,e)._}finally{qn=Date}}}function Xn(t){var n=t.dateTime,e=t.date,r=t.time,o=t.periods,i=t.days,u=t.shortDays,s=t.months,l=t.shortMonths;function c(t){var n=t.length;function e(e){for(var r,o,a,i=[],u=-1,s=0;++u<n;)37===t.charCodeAt(u)&&(i.push(t.slice(s,u)),null!=(o=Yn[r=t.charAt(++u)])&&(r=t.charAt(++u)),(a=M[r])&&(r=a(e,null==o?"e"===r?" ":"0":o)),i.push(r),s=u+1);return i.push(t.slice(s,u)),i.join("")}return e.parse=function(n){var e={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null};if(f(e,t,n,0)!=n.length)return null;"p"in e&&(e.H=e.H%12+12*e.p);var r=null!=e.Z&&qn!==jn,o=new(r?jn:qn);return"j"in e?o.setFullYear(e.y,0,e.j):"W"in e||"U"in e?("w"in e||(e.w="W"in e?1:0),o.setFullYear(e.y,0,1),o.setFullYear(e.y,0,"W"in e?(e.w+6)%7+7*e.W-(o.getDay()+5)%7:e.w+7*e.U-(o.getDay()+6)%7)):o.setFullYear(e.y,e.m,e.d),o.setHours(e.H+(e.Z/100|0),e.M+e.Z%100,e.S,e.L),r?o._:o},e.toString=function(){return t},e}function f(t,n,e,r){for(var o,a,i,u=0,s=n.length,l=e.length;u<s;){if(r>=l)return-1;if(37===(o=n.charCodeAt(u++))){if(i=n.charAt(u++),!(a=w[i in Yn?n.charAt(u++):i])||(r=a(t,e,r))<0)return-1}else if(o!=e.charCodeAt(r++))return-1}return r}c.utc=function(t){var n=c(t);function e(t){try{var e=new(qn=jn);return e._=t,n(e)}finally{qn=Date}}return e.parse=function(t){try{qn=jn;var e=n.parse(t);return e&&e._}finally{qn=Date}},e.toString=n.toString,e},c.multi=c.utc.multi=fe;var h=a.map(),p=Wn(i),d=Zn(i),m=Wn(u),g=Zn(u),v=Wn(s),y=Zn(s),b=Wn(l),x=Zn(l);o.forEach((function(t,n){h.set(t.toLowerCase(),n)}));var M={a:function(t){return u[t.getDay()]},A:function(t){return i[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:c(n),d:function(t,n){return Gn(t.getDate(),n,2)},e:function(t,n){return Gn(t.getDate(),n,2)},H:function(t,n){return Gn(t.getHours(),n,2)},I:function(t,n){return Gn(t.getHours()%12||12,n,2)},j:function(t,n){return Gn(1+zn.dayOfYear(t),n,3)},L:function(t,n){return Gn(t.getMilliseconds(),n,3)},m:function(t,n){return Gn(t.getMonth()+1,n,2)},M:function(t,n){return Gn(t.getMinutes(),n,2)},p:function(t){return o[+(t.getHours()>=12)]},S:function(t,n){return Gn(t.getSeconds(),n,2)},U:function(t,n){return Gn(zn.sundayOfYear(t),n,2)},w:function(t){return t.getDay()},W:function(t,n){return Gn(zn.mondayOfYear(t),n,2)},x:c(e),X:c(r),y:function(t,n){return Gn(t.getFullYear()%100,n,2)},Y:function(t,n){return Gn(t.getFullYear()%1e4,n,4)},Z:le,"%":function(){return"%"}},w={a:function(t,n,e){m.lastIndex=0;var r=m.exec(n.slice(e));return r?(t.w=g.get(r[0].toLowerCase()),e+r[0].length):-1},A:function(t,n,e){p.lastIndex=0;var r=p.exec(n.slice(e));return r?(t.w=d.get(r[0].toLowerCase()),e+r[0].length):-1},b:function(t,n,e){b.lastIndex=0;var r=b.exec(n.slice(e));return r?(t.m=x.get(r[0].toLowerCase()),e+r[0].length):-1},B:function(t,n,e){v.lastIndex=0;var r=v.exec(n.slice(e));return r?(t.m=y.get(r[0].toLowerCase()),e+r[0].length):-1},c:function(t,n,e){return f(t,M.c.toString(),n,e)},d:re,e:re,H:ae,I:ae,j:oe,L:se,m:ee,M:ie,p:function(t,n,e){var r=h.get(n.slice(e,e+=2).toLowerCase());return null==r?-1:(t.p=r,e)},S:ue,U:$n,w:Jn,W:Kn,x:function(t,n,e){return f(t,M.x.toString(),n,e)},X:function(t,n,e){return f(t,M.X.toString(),n,e)},y:te,Y:Qn,Z:ne,"%":ce};return c}zn.year=Bn((function(t){return(t=zn.day(t)).setMonth(0,1),t}),(function(t,n){t.setFullYear(t.getFullYear()+n)}),(function(t){return t.getFullYear()})),zn.years=zn.year.range,zn.years.utc=zn.year.utc.range,zn.day=Bn((function(t){var n=new qn(2e3,0);return n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),n}),(function(t,n){t.setDate(t.getDate()+n)}),(function(t){return t.getDate()-1})),zn.days=zn.day.range,zn.days.utc=zn.day.utc.range,zn.dayOfYear=function(t){var n=zn.year(t);return Math.floor((t-n-6e4*(t.getTimezoneOffset()-n.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(t,n){n=7-n;var e=zn[t]=Bn((function(t){return(t=zn.day(t)).setDate(t.getDate()-(t.getDay()+n)%7),t}),(function(t,n){t.setDate(t.getDate()+7*Math.floor(n))}),(function(t){var e=zn.year(t).getDay();return Math.floor((zn.dayOfYear(t)+(e+n)%7)/7)-(e!==n)}));zn[t+"s"]=e.range,zn[t+"s"].utc=e.utc.range,zn[t+"OfYear"]=function(t){var e=zn.year(t).getDay();return Math.floor((zn.dayOfYear(t)+(e+n)%7)/7)}})),zn.week=zn.sunday,zn.weeks=zn.sunday.range,zn.weeks.utc=zn.sunday.utc.range,zn.weekOfYear=zn.sundayOfYear;var Yn={"-":"",_:" ",0:"0"},Vn=/^\s*\d+/,Hn=/^%/;function Gn(t,n,e){var r=t<0?"-":"",o=(r?-t:t)+"",a=o.length;return r+(a<e?new Array(e-a+1).join(n)+o:o)}function Wn(t){return new RegExp("^(?:"+t.map(a.requote).join("|")+")","i")}function Zn(t){for(var n=new S,e=-1,r=t.length;++e<r;)n.set(t[e].toLowerCase(),e);return n}function Jn(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function $n(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e));return r?(t.U=+r[0],e+r[0].length):-1}function Kn(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e));return r?(t.W=+r[0],e+r[0].length):-1}function Qn(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function te(t,n,e){Vn.lastIndex=0;var r,o=Vn.exec(n.slice(e,e+2));return o?(t.y=(r=+o[0])+(r>68?1900:2e3),e+o[0].length):-1}function ne(t,n,e){return/^[+-]\d{4}$/.test(n=n.slice(e,e+5))?(t.Z=-n,e+5):-1}function ee(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function re(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function oe(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+3));return r?(t.j=+r[0],e+r[0].length):-1}function ae(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function ie(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function ue(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function se(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function le(t){var n=t.getTimezoneOffset(),e=n>0?"-":"+",r=w(n)/60|0,o=w(n)%60;return e+Gn(r,"0",2)+Gn(o,"0",2)}function ce(t,n,e){Hn.lastIndex=0;var r=Hn.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function fe(t){for(var n=t.length,e=-1;++e<n;)t[e][0]=this(t[e][0]);return function(n){for(var e=0,r=t[e];!r[1](n);)r=t[++e];return r[0](n)}}a.locale=function(t){return{numberFormat:On(t),timeFormat:Xn(t)}};var he=a.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function pe(){}a.format=he.numberFormat,a.geo={},pe.prototype={s:0,t:0,add:function(t){me(t,this.t,de),me(de.s,this.s,this),this.s?this.t+=de.t:this.s=de.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var de=new pe;function me(t,n,e){var r=e.s=t+n,o=r-t,a=r-o;e.t=t-a+(n-o)}function ge(t,n){t&&ye.hasOwnProperty(t.type)&&ye[t.type](t,n)}a.geo.stream=function(t,n){t&&ve.hasOwnProperty(t.type)?ve[t.type](t,n):ge(t,n)};var ve={Feature:function(t,n){ge(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,o=e.length;++r<o;)ge(e[r].geometry,n)}},ye={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,o=e.length;++r<o;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){be(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,o=e.length;++r<o;)be(e[r],n,0)},Polygon:function(t,n){xe(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,o=e.length;++r<o;)xe(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,o=e.length;++r<o;)ge(e[r],n)}};function be(t,n,e){var r,o=-1,a=t.length-e;for(n.lineStart();++o<a;)r=t[o],n.point(r[0],r[1],r[2]);n.lineEnd()}function xe(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)be(t[e],n,1);n.polygonEnd()}a.geo.area=function(t){return Me=0,a.geo.stream(t,Le),Me};var Me,we,_e,ke,Se,Ae,Ee,Te,Re,Ne,Pe,Ce,Oe=new pe,Le={sphere:function(){Me+=4*Nt},point:q,lineStart:q,lineEnd:q,polygonStart:function(){Oe.reset(),Le.lineStart=Ue},polygonEnd:function(){var t=2*Oe;Me+=t<0?4*Nt+t:t,Le.lineStart=Le.lineEnd=Le.point=q}};function Ue(){var t,n,e,r,o;function a(t,n){n=n*Lt/2+Nt/4;var a=(t*=Lt)-e,i=a>=0?1:-1,u=i*a,s=Math.cos(n),l=Math.sin(n),c=o*l,f=r*s+c*Math.cos(u),h=c*i*Math.sin(u);Oe.add(Math.atan2(h,f)),e=t,r=s,o=l}Le.point=function(i,u){Le.point=a,e=(t=i)*Lt,r=Math.cos(u=(n=u)*Lt/2+Nt/4),o=Math.sin(u)},Le.lineEnd=function(){a(t,n)}}function De(t){var n=t[0],e=t[1],r=Math.cos(e);return[r*Math.cos(n),r*Math.sin(n),Math.sin(e)]}function ze(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function qe(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function je(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function Fe(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function Be(t){var n=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}function Ie(t){return[Math.atan2(t[1],t[0]),jt(t[2])]}function Xe(t,n){return w(t[0]-n[0])<Tt&&w(t[1]-n[1])<Tt}a.geo.bounds=function(){var t,n,e,r,o,i,u,s,l,c,f,h={point:p,lineStart:m,lineEnd:g,polygonStart:function(){h.point=v,h.lineStart=y,h.lineEnd=b,l=0,Le.polygonStart()},polygonEnd:function(){Le.polygonEnd(),h.point=p,h.lineStart=m,h.lineEnd=g,Oe<0?(t=-(e=180),n=-(r=90)):l>Tt?r=90:l<-Tt&&(n=-90),f[0]=t,f[1]=e}};function p(o,a){c.push(f=[t=o,e=o]),a<n&&(n=a),a>r&&(r=a)}function d(a,i){var u=De([a*Lt,i*Lt]);if(s){var l=qe(s,u),c=qe([l[1],-l[0],0],l);Be(c),c=Ie(c);var f=a-o,h=f>0?1:-1,d=c[0]*Ut*h,m=w(f)>180;if(m^(h*o<d&&d<h*a))(g=c[1]*Ut)>r&&(r=g);else if(m^(h*o<(d=(d+360)%360-180)&&d<h*a)){var g;(g=-c[1]*Ut)<n&&(n=g)}else i<n&&(n=i),i>r&&(r=i);m?a<o?x(t,a)>x(t,e)&&(e=a):x(a,e)>x(t,e)&&(t=a):e>=t?(a<t&&(t=a),a>e&&(e=a)):a>o?x(t,a)>x(t,e)&&(e=a):x(a,e)>x(t,e)&&(t=a)}else p(a,i);s=u,o=a}function m(){h.point=d}function g(){f[0]=t,f[1]=e,h.point=p,s=null}function v(t,n){if(s){var e=t-o;l+=w(e)>180?e+(e>0?360:-360):e}else i=t,u=n;Le.point(t,n),d(t,n)}function y(){Le.lineStart()}function b(){v(i,u),Le.lineEnd(),w(l)>Tt&&(t=-(e=180)),f[0]=t,f[1]=e,s=null}function x(t,n){return(n-=t)<0?n+360:n}function M(t,n){return t[0]-n[0]}function _(t,n){return n[0]<=n[1]?n[0]<=t&&t<=n[1]:t<n[0]||n[1]<t}return function(o){if(r=e=-(t=n=1/0),c=[],a.geo.stream(o,h),l=c.length){c.sort(M);for(var i=1,u=[m=c[0]];i<l;++i)_((p=c[i])[0],m)||_(p[1],m)?(x(m[0],p[1])>x(m[0],m[1])&&(m[1]=p[1]),x(p[0],m[1])>x(m[0],m[1])&&(m[0]=p[0])):u.push(m=p);for(var s,l,p,d=-1/0,m=(i=0,u[l=u.length-1]);i<=l;m=p,++i)p=u[i],(s=x(m[1],p[0]))>d&&(d=s,t=p[0],e=m[1])}return c=f=null,t===1/0||n===1/0?[[NaN,NaN],[NaN,NaN]]:[[t,n],[e,r]]}}(),a.geo.centroid=function(t){we=_e=ke=Se=Ae=Ee=Te=Re=Ne=Pe=Ce=0,a.geo.stream(t,Ye);var n=Ne,e=Pe,r=Ce,o=n*n+e*e+r*r;return o<Rt&&(n=Ee,e=Te,r=Re,_e<Tt&&(n=ke,e=Se,r=Ae),(o=n*n+e*e+r*r)<Rt)?[NaN,NaN]:[Math.atan2(e,n)*Ut,jt(r/Math.sqrt(o))*Ut]};var Ye={sphere:q,point:Ve,lineStart:Ge,lineEnd:We,polygonStart:function(){Ye.lineStart=Ze},polygonEnd:function(){Ye.lineStart=Ge}};function Ve(t,n){t*=Lt;var e=Math.cos(n*=Lt);He(e*Math.cos(t),e*Math.sin(t),Math.sin(n))}function He(t,n,e){++we,ke+=(t-ke)/we,Se+=(n-Se)/we,Ae+=(e-Ae)/we}function Ge(){var t,n,e;function r(r,o){r*=Lt;var a=Math.cos(o*=Lt),i=a*Math.cos(r),u=a*Math.sin(r),s=Math.sin(o),l=Math.atan2(Math.sqrt((l=n*s-e*u)*l+(l=e*i-t*s)*l+(l=t*u-n*i)*l),t*i+n*u+e*s);_e+=l,Ee+=l*(t+(t=i)),Te+=l*(n+(n=u)),Re+=l*(e+(e=s)),He(t,n,e)}Ye.point=function(o,a){o*=Lt;var i=Math.cos(a*=Lt);t=i*Math.cos(o),n=i*Math.sin(o),e=Math.sin(a),Ye.point=r,He(t,n,e)}}function We(){Ye.point=Ve}function Ze(){var t,n,e,r,o;function a(t,n){t*=Lt;var a=Math.cos(n*=Lt),i=a*Math.cos(t),u=a*Math.sin(t),s=Math.sin(n),l=r*s-o*u,c=o*i-e*s,f=e*u-r*i,h=Math.sqrt(l*l+c*c+f*f),p=e*i+r*u+o*s,d=h&&-qt(p)/h,m=Math.atan2(h,p);Ne+=d*l,Pe+=d*c,Ce+=d*f,_e+=m,Ee+=m*(e+(e=i)),Te+=m*(r+(r=u)),Re+=m*(o+(o=s)),He(e,r,o)}Ye.point=function(i,u){t=i,n=u,Ye.point=a,i*=Lt;var s=Math.cos(u*=Lt);e=s*Math.cos(i),r=s*Math.sin(i),o=Math.sin(u),He(e,r,o)},Ye.lineEnd=function(){a(t,n),Ye.lineEnd=We,Ye.point=Ve}}function Je(t,n){function e(e,r){return e=t(e,r),n(e[0],e[1])}return t.invert&&n.invert&&(e.invert=function(e,r){return(e=n.invert(e,r))&&t.invert(e[0],e[1])}),e}function $e(){return!0}function Ke(t,n,e,r,o){var a=[],i=[];if(t.forEach((function(t){if(!((n=t.length-1)<=0)){var n,e=t[0],r=t[n];if(Xe(e,r)){o.lineStart();for(var u=0;u<n;++u)o.point((e=t[u])[0],e[1]);o.lineEnd()}else{var s=new tr(e,t,null,!0),l=new tr(e,null,s,!1);s.o=l,a.push(s),i.push(l),s=new tr(r,t,null,!1),l=new tr(r,null,s,!0),s.o=l,a.push(s),i.push(l)}}})),i.sort(n),Qe(a),Qe(i),a.length){for(var u=0,s=e,l=i.length;u<l;++u)i[u].e=s=!s;for(var c,f,h=a[0];;){for(var p=h,d=!0;p.v;)if((p=p.n)===h)return;c=p.z,o.lineStart();do{if(p.v=p.o.v=!0,p.e){if(d)for(u=0,l=c.length;u<l;++u)o.point((f=c[u])[0],f[1]);else r(p.x,p.n.x,1,o);p=p.n}else{if(d)for(u=(c=p.p.z).length-1;u>=0;--u)o.point((f=c[u])[0],f[1]);else r(p.x,p.p.x,-1,o);p=p.p}c=(p=p.o).z,d=!d}while(!p.v);o.lineEnd()}}}function Qe(t){if(n=t.length){for(var n,e,r=0,o=t[0];++r<n;)o.n=e=t[r],e.p=o,o=e;o.n=e=t[0],e.p=o}}function tr(t,n,e,r){this.x=t,this.z=n,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function nr(t,n,e,r){return function(o,i){var u,s=n(i),l=o.invert(r[0],r[1]),c={point:f,lineStart:p,lineEnd:d,polygonStart:function(){c.point=x,c.lineStart=M,c.lineEnd=w,u=[],m=[]},polygonEnd:function(){c.point=f,c.lineStart=p,c.lineEnd=d,u=a.merge(u);var t=function(t,n){var e=t[0],r=t[1],o=[Math.sin(e),-Math.cos(e),0],a=0,i=0;Oe.reset();for(var u=0,s=n.length;u<s;++u){var l=n[u],c=l.length;if(c)for(var f=l[0],h=f[0],p=f[1]/2+Nt/4,d=Math.sin(p),m=Math.cos(p),g=1;;){g===c&&(g=0);var v=(t=l[g])[0],y=t[1]/2+Nt/4,b=Math.sin(y),x=Math.cos(y),M=v-h,w=M>=0?1:-1,_=w*M,k=_>Nt,S=d*b;if(Oe.add(Math.atan2(S*w*Math.sin(_),m*x+S*Math.cos(_))),a+=k?M+w*Pt:M,k^h>=e^v>=e){var A=qe(De(f),De(t));Be(A);var E=qe(o,A);Be(E);var T=(k^M>=0?-1:1)*jt(E[2]);(r>T||r===T&&(A[0]||A[1]))&&(i+=k^M>=0?1:-1)}if(!g++)break;h=v,d=b,m=x,f=t}}return(a<-Tt||a<Tt&&Oe<-Tt)^1&i}(l,m);u.length?(b||(i.polygonStart(),b=!0),Ke(u,or,t,e,i)):t&&(b||(i.polygonStart(),b=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),b&&(i.polygonEnd(),b=!1),u=m=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function f(n,e){var r=o(n,e);t(n=r[0],e=r[1])&&i.point(n,e)}function h(t,n){var e=o(t,n);s.point(e[0],e[1])}function p(){c.point=h,s.lineStart()}function d(){c.point=f,s.lineEnd()}var m,g,v=rr(),y=n(v),b=!1;function x(t,n){g.push([t,n]);var e=o(t,n);y.point(e[0],e[1])}function M(){y.lineStart(),g=[]}function w(){x(g[0][0],g[0][1]),y.lineEnd();var t,n=y.clean(),e=v.buffer(),r=e.length;if(g.pop(),m.push(g),g=null,r)if(1&n){var o,a=-1;if((r=(t=e[0]).length-1)>0){for(b||(i.polygonStart(),b=!0),i.lineStart();++a<r;)i.point((o=t[a])[0],o[1]);i.lineEnd()}}else r>1&&2&n&&e.push(e.pop().concat(e.shift())),u.push(e.filter(er))}return c}}function er(t){return t.length>1}function rr(){var t,n=[];return{lineStart:function(){n.push(t=[])},point:function(n,e){t.push([n,e])},lineEnd:q,buffer:function(){var e=n;return n=[],t=null,e},rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))}}}function or(t,n){return((t=t.x)[0]<0?t[1]-Ot-Tt:Ot-t[1])-((n=n.x)[0]<0?n[1]-Ot-Tt:Ot-n[1])}var ar=nr($e,(function(t){var n,e=NaN,r=NaN,o=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(a,i){var u=a>0?Nt:-Nt,s=w(a-e);w(s-Nt)<Tt?(t.point(e,r=(r+i)/2>0?Ot:-Ot),t.point(o,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(a,r),n=0):o!==u&&s>=Nt&&(w(e-o)<Tt&&(e-=o*Tt),w(a-u)<Tt&&(a-=u*Tt),r=function(t,n,e,r){var o,a,i=Math.sin(t-e);return w(i)>Tt?Math.atan((Math.sin(n)*(a=Math.cos(r))*Math.sin(e)-Math.sin(r)*(o=Math.cos(n))*Math.sin(t))/(o*a*i)):(n+r)/2}(e,r,a,i),t.point(o,r),t.lineEnd(),t.lineStart(),t.point(u,r),n=0),t.point(e=a,r=i),o=u},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}}),(function(t,n,e,r){var o;if(null==t)o=e*Ot,r.point(-Nt,o),r.point(0,o),r.point(Nt,o),r.point(Nt,0),r.point(Nt,-o),r.point(0,-o),r.point(-Nt,-o),r.point(-Nt,0),r.point(-Nt,o);else if(w(t[0]-n[0])>Tt){var a=t[0]<n[0]?Nt:-Nt;o=e*a/2,r.point(-a,o),r.point(0,o),r.point(a,o)}else r.point(n[0],n[1])}),[-Nt,-Nt/2]);function ir(t){var n=Math.cos(t),e=n>0,r=w(n)>Tt;return nr(o,(function(t){var n,u,s,l,c;return{lineStart:function(){l=s=!1,c=1},point:function(f,h){var p,d=[f,h],m=o(f,h),g=e?m?0:i(f,h):m?i(f+(f<0?Nt:-Nt),h):0;if(!n&&(l=s=m)&&t.lineStart(),m!==s&&(p=a(n,d),(Xe(n,p)||Xe(d,p))&&(d[0]+=Tt,d[1]+=Tt,m=o(d[0],d[1]))),m!==s)c=0,m?(t.lineStart(),p=a(d,n),t.point(p[0],p[1])):(p=a(n,d),t.point(p[0],p[1]),t.lineEnd()),n=p;else if(r&&n&&e^m){var v;g&u||!(v=a(d,n,!0))||(c=0,e?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1])))}!m||n&&Xe(n,d)||t.point(d[0],d[1]),n=d,s=m,u=g},lineEnd:function(){s&&t.lineEnd(),n=null},clean:function(){return c|(l&&s)<<1}}}),Ir(t,6*Lt),e?[0,-t]:[-Nt,t-Nt]);function o(t,e){return Math.cos(t)*Math.cos(e)>n}function a(t,e,r){var o=[1,0,0],a=qe(De(t),De(e)),i=ze(a,a),u=a[0],s=i-u*u;if(!s)return!r&&t;var l=n*i/s,c=-n*u/s,f=qe(o,a),h=Fe(o,l);je(h,Fe(a,c));var p=f,d=ze(h,p),m=ze(p,p),g=d*d-m*(ze(h,h)-1);if(!(g<0)){var v=Math.sqrt(g),y=Fe(p,(-d-v)/m);if(je(y,h),y=Ie(y),!r)return y;var b,x=t[0],M=e[0],_=t[1],k=e[1];M<x&&(b=x,x=M,M=b);var S=M-x,A=w(S-Nt)<Tt;if(!A&&k<_&&(b=_,_=k,k=b),A||S<Tt?A?_+k>0^y[1]<(w(y[0]-x)<Tt?_:k):_<=y[1]&&y[1]<=k:S>Nt^(x<=y[0]&&y[0]<=M)){var E=Fe(p,(-d+v)/m);return je(E,h),[y,Ie(E)]}}}function i(n,r){var o=e?t:Nt-t,a=0;return n<-o?a|=1:n>o&&(a|=2),r<-o?a|=4:r>o&&(a|=8),a}}function ur(t,n,e,r){return function(o){var a,i=o.a,u=o.b,s=i.x,l=i.y,c=0,f=1,h=u.x-s,p=u.y-l;if(a=t-s,h||!(a>0)){if(a/=h,h<0){if(a<c)return;a<f&&(f=a)}else if(h>0){if(a>f)return;a>c&&(c=a)}if(a=e-s,h||!(a<0)){if(a/=h,h<0){if(a>f)return;a>c&&(c=a)}else if(h>0){if(a<c)return;a<f&&(f=a)}if(a=n-l,p||!(a>0)){if(a/=p,p<0){if(a<c)return;a<f&&(f=a)}else if(p>0){if(a>f)return;a>c&&(c=a)}if(a=r-l,p||!(a<0)){if(a/=p,p<0){if(a>f)return;a>c&&(c=a)}else if(p>0){if(a<c)return;a<f&&(f=a)}return c>0&&(o.a={x:s+c*h,y:l+c*p}),f<1&&(o.b={x:s+f*h,y:l+f*p}),o}}}}}}function sr(t,n,e,r){return function(s){var l,c,f,h,p,d,m,g,v,y,b,x=s,M=rr(),w=ur(t,n,e,r),_={point:A,lineStart:function(){_.point=E,c&&c.push(f=[]),y=!0,v=!1,m=g=NaN},lineEnd:function(){l&&(E(h,p),d&&v&&M.rejoin(),l.push(M.buffer())),_.point=A,v&&s.lineEnd()},polygonStart:function(){s=M,l=[],c=[],b=!0},polygonEnd:function(){s=x,l=a.merge(l);var n=function(t){for(var n=0,e=c.length,r=t[1],o=0;o<e;++o)for(var a,i=1,u=c[o],s=u.length,l=u[0];i<s;++i)a=u[i],l[1]<=r?a[1]>r&&zt(l,a,t)>0&&++n:a[1]<=r&&zt(l,a,t)<0&&--n,l=a;return 0!==n}([t,r]),e=b&&n,o=l.length;(e||o)&&(s.polygonStart(),e&&(s.lineStart(),k(null,null,1,s),s.lineEnd()),o&&Ke(l,i,n,k,s),s.polygonEnd()),l=c=f=null}};function k(a,i,s,l){var c=0,f=0;if(null==a||(c=o(a,s))!==(f=o(i,s))||u(a,i)<0^s>0)do{l.point(0===c||3===c?t:e,c>1?r:n)}while((c=(c+s+4)%4)!==f);else l.point(i[0],i[1])}function S(o,a){return t<=o&&o<=e&&n<=a&&a<=r}function A(t,n){S(t,n)&&s.point(t,n)}function E(t,n){var e=S(t=Math.max(-1e9,Math.min(1e9,t)),n=Math.max(-1e9,Math.min(1e9,n)));if(c&&f.push([t,n]),y)h=t,p=n,d=e,y=!1,e&&(s.lineStart(),s.point(t,n));else if(e&&v)s.point(t,n);else{var r={a:{x:m,y:g},b:{x:t,y:n}};w(r)?(v||(s.lineStart(),s.point(r.a.x,r.a.y)),s.point(r.b.x,r.b.y),e||s.lineEnd(),b=!1):e&&(s.lineStart(),s.point(t,n),b=!1)}m=t,g=n,v=e}return _};function o(r,o){return w(r[0]-t)<Tt?o>0?0:3:w(r[0]-e)<Tt?o>0?2:1:w(r[1]-n)<Tt?o>0?1:0:o>0?3:2}function i(t,n){return u(t.x,n.x)}function u(t,n){var e=o(t,1),r=o(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}}function lr(t){var n=0,e=Nt/3,r=Lr(t),o=r(n,e);return o.parallels=function(t){return arguments.length?r(n=t[0]*Nt/180,e=t[1]*Nt/180):[n/Nt*180,e/Nt*180]},o}function cr(t,n){var e=Math.sin(t),r=(e+Math.sin(n))/2,o=1+e*(2*r-e),a=Math.sqrt(o)/r;function i(t,n){var e=Math.sqrt(o-2*r*Math.sin(n))/r;return[e*Math.sin(t*=r),a-e*Math.cos(t)]}return i.invert=function(t,n){var e=a-n;return[Math.atan2(t,e)/r,jt((o-(t*t+e*e)*r*r)/(2*r))]},i}a.geo.clipExtent=function(){var t,n,e,r,o,a,i={stream:function(t){return o&&(o.valid=!1),(o=a(t)).valid=!0,o},extent:function(u){return arguments.length?(a=sr(t=+u[0][0],n=+u[0][1],e=+u[1][0],r=+u[1][1]),o&&(o.valid=!1,o=null),i):[[t,n],[e,r]]}};return i.extent([[0,0],[960,500]])},(a.geo.conicEqualArea=function(){return lr(cr)}).raw=cr,a.geo.albers=function(){return a.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},a.geo.albersUsa=function(){var t,n,e,r,o=a.geo.albers(),i=a.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),u=a.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),s={point:function(n,e){t=[n,e]}};function l(o){var a=o[0],i=o[1];return t=null,n(a,i),t||(e(a,i),t)||r(a,i),t}return l.invert=function(t){var n=o.scale(),e=o.translate(),r=(t[0]-e[0])/n,a=(t[1]-e[1])/n;return(a>=.12&&a<.234&&r>=-.425&&r<-.214?i:a>=.166&&a<.234&&r>=-.214&&r<-.115?u:o).invert(t)},l.stream=function(t){var n=o.stream(t),e=i.stream(t),r=u.stream(t);return{point:function(t,o){n.point(t,o),e.point(t,o),r.point(t,o)},sphere:function(){n.sphere(),e.sphere(),r.sphere()},lineStart:function(){n.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){n.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){n.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){n.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},l.precision=function(t){return arguments.length?(o.precision(t),i.precision(t),u.precision(t),l):o.precision()},l.scale=function(t){return arguments.length?(o.scale(t),i.scale(.35*t),u.scale(t),l.translate(o.translate())):o.scale()},l.translate=function(t){if(!arguments.length)return o.translate();var a=o.scale(),c=+t[0],f=+t[1];return n=o.translate(t).clipExtent([[c-.455*a,f-.238*a],[c+.455*a,f+.238*a]]).stream(s).point,e=i.translate([c-.307*a,f+.201*a]).clipExtent([[c-.425*a+Tt,f+.12*a+Tt],[c-.214*a-Tt,f+.234*a-Tt]]).stream(s).point,r=u.translate([c-.205*a,f+.212*a]).clipExtent([[c-.214*a+Tt,f+.166*a+Tt],[c-.115*a-Tt,f+.234*a-Tt]]).stream(s).point,l},l.scale(1070)};var fr,hr,pr,dr,mr,gr,vr={point:q,lineStart:q,lineEnd:q,polygonStart:function(){hr=0,vr.lineStart=yr},polygonEnd:function(){vr.lineStart=vr.lineEnd=vr.point=q,fr+=w(hr/2)}};function yr(){var t,n,e,r;function o(t,n){hr+=r*t-e*n,e=t,r=n}vr.point=function(a,i){vr.point=o,t=e=a,n=r=i},vr.lineEnd=function(){o(t,n)}}var br={point:function(t,n){t<pr&&(pr=t),t>mr&&(mr=t),n<dr&&(dr=n),n>gr&&(gr=n)},lineStart:q,lineEnd:q,polygonStart:q,polygonEnd:q};function xr(){var t=Mr(4.5),n=[],e={point:r,lineStart:function(){e.point=o},lineEnd:i,polygonStart:function(){e.lineEnd=u},polygonEnd:function(){e.lineEnd=i,e.point=r},pointRadius:function(n){return t=Mr(n),e},result:function(){if(n.length){var t=n.join("");return n=[],t}}};function r(e,r){n.push("M",e,",",r,t)}function o(t,r){n.push("M",t,",",r),e.point=a}function a(t,e){n.push("L",t,",",e)}function i(){e.point=r}function u(){n.push("Z")}return e}function Mr(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}var wr,_r={point:kr,lineStart:Sr,lineEnd:Ar,polygonStart:function(){_r.lineStart=Er},polygonEnd:function(){_r.point=kr,_r.lineStart=Sr,_r.lineEnd=Ar}};function kr(t,n){ke+=t,Se+=n,++Ae}function Sr(){var t,n;function e(e,r){var o=e-t,a=r-n,i=Math.sqrt(o*o+a*a);Ee+=i*(t+e)/2,Te+=i*(n+r)/2,Re+=i,kr(t=e,n=r)}_r.point=function(r,o){_r.point=e,kr(t=r,n=o)}}function Ar(){_r.point=kr}function Er(){var t,n,e,r;function o(t,n){var o=t-e,a=n-r,i=Math.sqrt(o*o+a*a);Ee+=i*(e+t)/2,Te+=i*(r+n)/2,Re+=i,Ne+=(i=r*t-e*n)*(e+t),Pe+=i*(r+n),Ce+=3*i,kr(e=t,r=n)}_r.point=function(a,i){_r.point=o,kr(t=e=a,n=r=i)},_r.lineEnd=function(){o(t,n)}}function Tr(t){var n=4.5,e={point:r,lineStart:function(){e.point=o},lineEnd:i,polygonStart:function(){e.lineEnd=u},polygonEnd:function(){e.lineEnd=i,e.point=r},pointRadius:function(t){return n=t,e},result:q};function r(e,r){t.moveTo(e+n,r),t.arc(e,r,n,0,Pt)}function o(n,r){t.moveTo(n,r),e.point=a}function a(n,e){t.lineTo(n,e)}function i(){e.point=r}function u(){t.closePath()}return e}function Rr(t){var n=.5,e=Math.cos(30*Lt),r=16;function o(t){return(r?i:a)(t)}function a(n){return Cr(n,(function(e,r){e=t(e,r),n.point(e[0],e[1])}))}function i(n){var e,o,a,i,s,l,c,f,h,p,d,m,g={point:v,lineStart:y,lineEnd:x,polygonStart:function(){n.polygonStart(),g.lineStart=M},polygonEnd:function(){n.polygonEnd(),g.lineStart=y}};function v(e,r){e=t(e,r),n.point(e[0],e[1])}function y(){f=NaN,g.point=b,n.lineStart()}function b(e,o){var a=De([e,o]),i=t(e,o);u(f,h,c,p,d,m,f=i[0],h=i[1],c=e,p=a[0],d=a[1],m=a[2],r,n),n.point(f,h)}function x(){g.point=v,n.lineEnd()}function M(){y(),g.point=w,g.lineEnd=_}function w(t,n){b(e=t,n),o=f,a=h,i=p,s=d,l=m,g.point=b}function _(){u(f,h,c,p,d,m,o,a,e,i,s,l,r,n),g.lineEnd=x,x()}return g}function u(r,o,a,i,s,l,c,f,h,p,d,m,g,v){var y=c-r,b=f-o,x=y*y+b*b;if(x>4*n&&g--){var M=i+p,_=s+d,k=l+m,S=Math.sqrt(M*M+_*_+k*k),A=Math.asin(k/=S),E=w(w(k)-1)<Tt||w(a-h)<Tt?(a+h)/2:Math.atan2(_,M),T=t(E,A),R=T[0],N=T[1],P=R-r,C=N-o,O=b*P-y*C;(O*O/x>n||w((y*P+b*C)/x-.5)>.3||i*p+s*d+l*m<e)&&(u(r,o,a,i,s,l,R,N,E,M/=S,_/=S,k,g,v),v.point(R,N),u(R,N,E,M,_,k,c,f,h,p,d,m,g,v))}}return o.precision=function(t){return arguments.length?(r=(n=t*t)>0&&16,o):Math.sqrt(n)},o}function Nr(t){var n=Rr((function(n,e){return t([n*Ut,e*Ut])}));return function(t){return Ur(n(t))}}function Pr(t){this.stream=t}function Cr(t,n){return{point:n,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function Or(t){return Lr((function(){return t}))()}function Lr(t){var n,e,r,o,i,u,s=Rr((function(t,e){return[(t=n(t,e))[0]*l+o,i-t[1]*l]})),l=150,c=480,f=250,h=0,p=0,d=0,m=0,g=0,v=ar,y=L,b=null,x=null;function M(t){return[(t=r(t[0]*Lt,t[1]*Lt))[0]*l+o,i-t[1]*l]}function w(t){return(t=r.invert((t[0]-o)/l,(i-t[1])/l))&&[t[0]*Ut,t[1]*Ut]}function _(){r=Je(e=qr(d,m,g),n);var t=n(h,p);return o=c-t[0]*l,i=f+t[1]*l,k()}function k(){return u&&(u.valid=!1,u=null),M}return M.stream=function(t){return u&&(u.valid=!1),(u=Ur(v(e,s(y(t))))).valid=!0,u},M.clipAngle=function(t){return arguments.length?(v=null==t?(b=t,ar):ir((b=+t)*Lt),k()):b},M.clipExtent=function(t){return arguments.length?(x=t,y=t?sr(t[0][0],t[0][1],t[1][0],t[1][1]):L,k()):x},M.scale=function(t){return arguments.length?(l=+t,_()):l},M.translate=function(t){return arguments.length?(c=+t[0],f=+t[1],_()):[c,f]},M.center=function(t){return arguments.length?(h=t[0]%360*Lt,p=t[1]%360*Lt,_()):[h*Ut,p*Ut]},M.rotate=function(t){return arguments.length?(d=t[0]%360*Lt,m=t[1]%360*Lt,g=t.length>2?t[2]%360*Lt:0,_()):[d*Ut,m*Ut,g*Ut]},a.rebind(M,s,"precision"),function(){return n=t.apply(this,arguments),M.invert=n.invert&&w,_()}}function Ur(t){return Cr(t,(function(n,e){t.point(n*Lt,e*Lt)}))}function Dr(t,n){return[t,n]}function zr(t,n){return[t>Nt?t-Pt:t<-Nt?t+Pt:t,n]}function qr(t,n,e){return t?n||e?Je(Fr(t),Br(n,e)):Fr(t):n||e?Br(n,e):zr}function jr(t){return function(n,e){return[(n+=t)>Nt?n-Pt:n<-Nt?n+Pt:n,e]}}function Fr(t){var n=jr(t);return n.invert=jr(-t),n}function Br(t,n){var e=Math.cos(t),r=Math.sin(t),o=Math.cos(n),a=Math.sin(n);function i(t,n){var i=Math.cos(n),u=Math.cos(t)*i,s=Math.sin(t)*i,l=Math.sin(n),c=l*e+u*r;return[Math.atan2(s*o-c*a,u*e-l*r),jt(c*o+s*a)]}return i.invert=function(t,n){var i=Math.cos(n),u=Math.cos(t)*i,s=Math.sin(t)*i,l=Math.sin(n),c=l*o-s*a;return[Math.atan2(s*o+l*a,u*e+c*r),jt(c*e-u*r)]},i}function Ir(t,n){var e=Math.cos(t),r=Math.sin(t);return function(o,a,i,u){var s=i*n;null!=o?(o=Xr(e,o),a=Xr(e,a),(i>0?o<a:o>a)&&(o+=i*Pt)):(o=t+i*Pt,a=t-.5*s);for(var l,c=o;i>0?c>a:c<a;c-=s)u.point((l=Ie([e,-r*Math.cos(c),-r*Math.sin(c)]))[0],l[1])}}function Xr(t,n){var e=De(n);e[0]-=t,Be(e);var r=qt(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-Tt)%(2*Math.PI)}function Yr(t,n,e){var r=a.range(t,n-Tt,e).concat(n);return function(t){return r.map((function(n){return[t,n]}))}}function Vr(t,n,e){var r=a.range(t,n-Tt,e).concat(n);return function(t){return r.map((function(n){return[n,t]}))}}function Hr(t){return t.source}function Gr(t){return t.target}a.geo.path=function(){var t,n,e,r,o,i=4.5;function u(t){return t&&("function"==typeof i&&r.pointRadius(+i.apply(this,arguments)),o&&o.valid||(o=e(r)),a.geo.stream(t,o)),r.result()}function s(){return o=null,u}return u.area=function(t){return fr=0,a.geo.stream(t,e(vr)),fr},u.centroid=function(t){return ke=Se=Ae=Ee=Te=Re=Ne=Pe=Ce=0,a.geo.stream(t,e(_r)),Ce?[Ne/Ce,Pe/Ce]:Re?[Ee/Re,Te/Re]:Ae?[ke/Ae,Se/Ae]:[NaN,NaN]},u.bounds=function(t){return mr=gr=-(pr=dr=1/0),a.geo.stream(t,e(br)),[[pr,dr],[mr,gr]]},u.projection=function(n){return arguments.length?(e=(t=n)?n.stream||Nr(n):L,s()):t},u.context=function(t){return arguments.length?(r=null==(n=t)?new xr:new Tr(t),"function"!=typeof i&&r.pointRadius(i),s()):n},u.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(r.pointRadius(+t),+t),u):i},u.projection(a.geo.albersUsa()).context(null)},a.geo.transform=function(t){return{stream:function(n){var e=new Pr(n);for(var r in t)e[r]=t[r];return e}}},Pr.prototype={point:function(t,n){this.stream.point(t,n)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},a.geo.projection=Or,a.geo.projectionMutator=Lr,(a.geo.equirectangular=function(){return Or(Dr)}).raw=Dr.invert=Dr,a.geo.rotation=function(t){function n(n){return(n=t(n[0]*Lt,n[1]*Lt))[0]*=Ut,n[1]*=Ut,n}return t=qr(t[0]%360*Lt,t[1]*Lt,t.length>2?t[2]*Lt:0),n.invert=function(n){return(n=t.invert(n[0]*Lt,n[1]*Lt))[0]*=Ut,n[1]*=Ut,n},n},zr.invert=Dr,a.geo.circle=function(){var t,n,e=[0,0],r=6;function o(){var t="function"==typeof e?e.apply(this,arguments):e,r=qr(-t[0]*Lt,-t[1]*Lt,0).invert,o=[];return n(null,null,1,{point:function(t,n){o.push(t=r(t,n)),t[0]*=Ut,t[1]*=Ut}}),{type:"Polygon",coordinates:[o]}}return o.origin=function(t){return arguments.length?(e=t,o):e},o.angle=function(e){return arguments.length?(n=Ir((t=+e)*Lt,r*Lt),o):t},o.precision=function(e){return arguments.length?(n=Ir(t*Lt,(r=+e)*Lt),o):r},o.angle(90)},a.geo.distance=function(t,n){var e,r=(n[0]-t[0])*Lt,o=t[1]*Lt,a=n[1]*Lt,i=Math.sin(r),u=Math.cos(r),s=Math.sin(o),l=Math.cos(o),c=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((e=f*i)*e+(e=l*c-s*f*u)*e),s*c+l*f*u)},a.geo.graticule=function(){var t,n,e,r,o,i,u,s,l,c,f,h,p=10,d=p,m=90,g=360,v=2.5;function y(){return{type:"MultiLineString",coordinates:b()}}function b(){return a.range(Math.ceil(r/m)*m,e,m).map(f).concat(a.range(Math.ceil(s/g)*g,u,g).map(h)).concat(a.range(Math.ceil(n/p)*p,t,p).filter((function(t){return w(t%m)>Tt})).map(l)).concat(a.range(Math.ceil(i/d)*d,o,d).filter((function(t){return w(t%g)>Tt})).map(c))}return y.lines=function(){return b().map((function(t){return{type:"LineString",coordinates:t}}))},y.outline=function(){return{type:"Polygon",coordinates:[f(r).concat(h(u).slice(1),f(e).reverse().slice(1),h(s).reverse().slice(1))]}},y.extent=function(t){return arguments.length?y.majorExtent(t).minorExtent(t):y.minorExtent()},y.majorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],s=+t[0][1],u=+t[1][1],r>e&&(t=r,r=e,e=t),s>u&&(t=s,s=u,u=t),y.precision(v)):[[r,s],[e,u]]},y.minorExtent=function(e){return arguments.length?(n=+e[0][0],t=+e[1][0],i=+e[0][1],o=+e[1][1],n>t&&(e=n,n=t,t=e),i>o&&(e=i,i=o,o=e),y.precision(v)):[[n,i],[t,o]]},y.step=function(t){return arguments.length?y.majorStep(t).minorStep(t):y.minorStep()},y.majorStep=function(t){return arguments.length?(m=+t[0],g=+t[1],y):[m,g]},y.minorStep=function(t){return arguments.length?(p=+t[0],d=+t[1],y):[p,d]},y.precision=function(a){return arguments.length?(v=+a,l=Yr(i,o,90),c=Vr(n,t,v),f=Yr(s,u,90),h=Vr(r,e,v),y):v},y.majorExtent([[-180,-90+Tt],[180,90-Tt]]).minorExtent([[-180,-80-Tt],[180,80+Tt]])},a.geo.greatArc=function(){var t,n,e=Hr,r=Gr;function o(){return{type:"LineString",coordinates:[t||e.apply(this,arguments),n||r.apply(this,arguments)]}}return o.distance=function(){return a.geo.distance(t||e.apply(this,arguments),n||r.apply(this,arguments))},o.source=function(n){return arguments.length?(e=n,t="function"==typeof n?null:n,o):e},o.target=function(t){return arguments.length?(r=t,n="function"==typeof t?null:t,o):r},o.precision=function(){return arguments.length?o:0},o},a.geo.interpolate=function(t,n){return e=t[0]*Lt,r=t[1]*Lt,o=n[0]*Lt,a=n[1]*Lt,i=Math.cos(r),u=Math.sin(r),s=Math.cos(a),l=Math.sin(a),c=i*Math.cos(e),f=i*Math.sin(e),h=s*Math.cos(o),p=s*Math.sin(o),d=2*Math.asin(Math.sqrt(Bt(a-r)+i*s*Bt(o-e))),m=1/Math.sin(d),(g=d?function(t){var n=Math.sin(t*=d)*m,e=Math.sin(d-t)*m,r=e*c+n*h,o=e*f+n*p,a=e*u+n*l;return[Math.atan2(o,r)*Ut,Math.atan2(a,Math.sqrt(r*r+o*o))*Ut]}:function(){return[e*Ut,r*Ut]}).distance=d,g;var e,r,o,a,i,u,s,l,c,f,h,p,d,m,g},a.geo.length=function(t){return wr=0,a.geo.stream(t,Wr),wr};var Wr={sphere:q,point:q,lineStart:function(){var t,n,e;function r(r,o){var a=Math.sin(o*=Lt),i=Math.cos(o),u=w((r*=Lt)-t),s=Math.cos(u);wr+=Math.atan2(Math.sqrt((u=i*Math.sin(u))*u+(u=e*a-n*i*s)*u),n*a+e*i*s),t=r,n=a,e=i}Wr.point=function(o,a){t=o*Lt,n=Math.sin(a*=Lt),e=Math.cos(a),Wr.point=r},Wr.lineEnd=function(){Wr.point=Wr.lineEnd=q}},lineEnd:q,polygonStart:q,polygonEnd:q};function Zr(t,n){function e(n,e){var r=Math.cos(n),o=Math.cos(e),a=t(r*o);return[a*o*Math.sin(n),a*Math.sin(e)]}return e.invert=function(t,e){var r=Math.sqrt(t*t+e*e),o=n(r),a=Math.sin(o),i=Math.cos(o);return[Math.atan2(t*a,r*i),Math.asin(r&&e*a/r)]},e}var Jr=Zr((function(t){return Math.sqrt(2/(1+t))}),(function(t){return 2*Math.asin(t/2)}));(a.geo.azimuthalEqualArea=function(){return Or(Jr)}).raw=Jr;var $r=Zr((function(t){var n=Math.acos(t);return n&&n/Math.sin(n)}),L);function Kr(t,n){var e=Math.cos(t),r=function(t){return Math.tan(Nt/4+t/2)},o=t===n?Math.sin(t):Math.log(e/Math.cos(n))/Math.log(r(n)/r(t)),a=e*Math.pow(r(t),o)/o;if(!o)return no;function i(t,n){a>0?n<-Ot+Tt&&(n=-Ot+Tt):n>Ot-Tt&&(n=Ot-Tt);var e=a/Math.pow(r(n),o);return[e*Math.sin(o*t),a-e*Math.cos(o*t)]}return i.invert=function(t,n){var e=a-n,r=Dt(o)*Math.sqrt(t*t+e*e);return[Math.atan2(t,e)/o,2*Math.atan(Math.pow(a/r,1/o))-Ot]},i}function Qr(t,n){var e=Math.cos(t),r=t===n?Math.sin(t):(e-Math.cos(n))/(n-t),o=e/r+t;if(w(r)<Tt)return Dr;function a(t,n){var e=o-n;return[e*Math.sin(r*t),o-e*Math.cos(r*t)]}return a.invert=function(t,n){var e=o-n;return[Math.atan2(t,e)/r,o-Dt(r)*Math.sqrt(t*t+e*e)]},a}(a.geo.azimuthalEquidistant=function(){return Or($r)}).raw=$r,(a.geo.conicConformal=function(){return lr(Kr)}).raw=Kr,(a.geo.conicEquidistant=function(){return lr(Qr)}).raw=Qr;var to=Zr((function(t){return 1/t}),Math.atan);function no(t,n){return[t,Math.log(Math.tan(Nt/4+n/2))]}function eo(t){var n,e=Or(t),r=e.scale,o=e.translate,a=e.clipExtent;return e.scale=function(){var t=r.apply(e,arguments);return t===e?n?e.clipExtent(null):e:t},e.translate=function(){var t=o.apply(e,arguments);return t===e?n?e.clipExtent(null):e:t},e.clipExtent=function(t){var i=a.apply(e,arguments);if(i===e){if(n=null==t){var u=Nt*r(),s=o();a([[s[0]-u,s[1]-u],[s[0]+u,s[1]+u]])}}else n&&(i=null);return i},e.clipExtent(null)}(a.geo.gnomonic=function(){return Or(to)}).raw=to,no.invert=function(t,n){return[t,2*Math.atan(Math.exp(n))-Ot]},(a.geo.mercator=function(){return eo(no)}).raw=no;var ro=Zr((function(){return 1}),Math.asin);(a.geo.orthographic=function(){return Or(ro)}).raw=ro;var oo=Zr((function(t){return 1/(1+t)}),(function(t){return 2*Math.atan(t)}));function ao(t,n){return[Math.log(Math.tan(Nt/4+n/2)),-t]}function io(t){return t[0]}function uo(t){return t[1]}function so(t){for(var n=t.length,e=[0,1],r=2,o=2;o<n;o++){for(;r>1&&zt(t[e[r-2]],t[e[r-1]],t[o])<=0;)--r;e[r++]=o}return e.slice(0,r)}function lo(t,n){return t[0]-n[0]||t[1]-n[1]}(a.geo.stereographic=function(){return Or(oo)}).raw=oo,ao.invert=function(t,n){return[-n,2*Math.atan(Math.exp(t))-Ot]},(a.geo.transverseMercator=function(){var t=eo(ao),n=t.center,e=t.rotate;return t.center=function(t){return t?n([-t[1],t[0]]):[(t=n())[1],-t[0]]},t.rotate=function(t){return t?e([t[0],t[1],t.length>2?t[2]+90:90]):[(t=e())[0],t[1],t[2]-90]},e([0,0,90])}).raw=ao,a.geom={},a.geom.hull=function(t){var n=io,e=uo;if(arguments.length)return r(t);function r(t){if(t.length<3)return[];var r,o=bn(n),a=bn(e),i=t.length,u=[],s=[];for(r=0;r<i;r++)u.push([+o.call(this,t[r],r),+a.call(this,t[r],r),r]);for(u.sort(lo),r=0;r<i;r++)s.push([u[r][0],-u[r][1]]);var l=so(u),c=so(s),f=c[0]===l[0],h=c[c.length-1]===l[l.length-1],p=[];for(r=l.length-1;r>=0;--r)p.push(t[u[l[r]][2]]);for(r=+f;r<c.length-h;++r)p.push(t[u[c[r]][2]]);return p}return r.x=function(t){return arguments.length?(n=t,r):n},r.y=function(t){return arguments.length?(e=t,r):e},r},a.geom.polygon=function(t){return V(t,co),t};var co=a.geom.polygon.prototype=[];function fo(t,n,e){return(e[0]-n[0])*(t[1]-n[1])<(e[1]-n[1])*(t[0]-n[0])}function ho(t,n,e,r){var o=t[0],a=e[0],i=n[0]-o,u=r[0]-a,s=t[1],l=e[1],c=n[1]-s,f=r[1]-l,h=(u*(s-l)-f*(o-a))/(f*i-u*c);return[o+h*i,s+h*c]}function po(t){var n=t[0],e=t[t.length-1];return!(n[0]-e[0]||n[1]-e[1])}co.area=function(){for(var t,n=-1,e=this.length,r=this[e-1],o=0;++n<e;)t=r,r=this[n],o+=t[1]*r[0]-t[0]*r[1];return.5*o},co.centroid=function(t){var n,e,r=-1,o=this.length,a=0,i=0,u=this[o-1];for(arguments.length||(t=-1/(6*this.area()));++r<o;)n=u,u=this[r],e=n[0]*u[1]-u[0]*n[1],a+=(n[0]+u[0])*e,i+=(n[1]+u[1])*e;return[a*t,i*t]},co.clip=function(t){for(var n,e,r,o,a,i,u=po(t),s=-1,l=this.length-po(this),c=this[l-1];++s<l;){for(n=t.slice(),t.length=0,o=this[s],a=n[(r=n.length-u)-1],e=-1;++e<r;)fo(i=n[e],c,o)?(fo(a,c,o)||t.push(ho(a,i,c,o)),t.push(i)):fo(a,c,o)&&t.push(ho(a,i,c,o)),a=i;u&&t.push(t[0]),c=o}return t};var mo,go,vo,yo,bo,xo=[],Mo=[];function wo(){Fo(this),this.edge=this.site=this.circle=null}function _o(t){var n=xo.pop()||new wo;return n.site=t,n}function ko(t){Oo(t),vo.remove(t),xo.push(t),Fo(t)}function So(t){var n=t.circle,e=n.x,r=n.cy,o={x:e,y:r},a=t.P,i=t.N,u=[t];ko(t);for(var s=a;s.circle&&w(e-s.circle.x)<Tt&&w(r-s.circle.cy)<Tt;)a=s.P,u.unshift(s),ko(s),s=a;u.unshift(s),Oo(s);for(var l=i;l.circle&&w(e-l.circle.x)<Tt&&w(r-l.circle.cy)<Tt;)i=l.N,u.push(l),ko(l),l=i;u.push(l),Oo(l);var c,f=u.length;for(c=1;c<f;++c)l=u[c],s=u[c-1],zo(l.edge,s.site,l.site,o);s=u[0],(l=u[f-1]).edge=Do(s.site,l.site,null,o),Co(s),Co(l)}function Ao(t){for(var n,e,r,o,a=t.x,i=t.y,u=vo._;u;)if((r=Eo(u,i)-a)>Tt)u=u.L;else{if(!((o=a-To(u,i))>Tt)){r>-Tt?(n=u.P,e=u):o>-Tt?(n=u,e=u.N):n=e=u;break}if(!u.R){n=u;break}u=u.R}var s=_o(t);if(vo.insert(n,s),n||e){if(n===e)return Oo(n),e=_o(n.site),vo.insert(s,e),s.edge=e.edge=Do(n.site,s.site),Co(n),void Co(e);if(e){Oo(n),Oo(e);var l=n.site,c=l.x,f=l.y,h=t.x-c,p=t.y-f,d=e.site,m=d.x-c,g=d.y-f,v=2*(h*g-p*m),y=h*h+p*p,b=m*m+g*g,x={x:(g*y-p*b)/v+c,y:(h*b-m*y)/v+f};zo(e.edge,l,d,x),s.edge=Do(l,t,null,x),e.edge=Do(t,d,null,x),Co(n),Co(e)}else s.edge=Do(n.site,s.site)}}function Eo(t,n){var e=t.site,r=e.x,o=e.y,a=o-n;if(!a)return r;var i=t.P;if(!i)return-1/0;var u=(e=i.site).x,s=e.y,l=s-n;if(!l)return u;var c=u-r,f=1/a-1/l,h=c/l;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*l)-s+l/2+o-a/2)))/f+r:(r+u)/2}function To(t,n){var e=t.N;if(e)return Eo(e,n);var r=t.site;return r.y===n?r.x:1/0}function Ro(t){this.site=t,this.edges=[]}function No(t,n){return n.angle-t.angle}function Po(){Fo(this),this.x=this.y=this.arc=this.site=this.cy=null}function Co(t){var n=t.P,e=t.N;if(n&&e){var r=n.site,o=t.site,a=e.site;if(r!==a){var i=o.x,u=o.y,s=r.x-i,l=r.y-u,c=a.x-i,f=2*(s*(g=a.y-u)-l*c);if(!(f>=-Rt)){var h=s*s+l*l,p=c*c+g*g,d=(g*h-l*p)/f,m=(s*p-c*h)/f,g=m+u,v=Mo.pop()||new Po;v.arc=t,v.site=o,v.x=d+i,v.y=g+Math.sqrt(d*d+m*m),v.cy=g,t.circle=v;for(var y=null,b=bo._;b;)if(v.y<b.y||v.y===b.y&&v.x<=b.x){if(!b.L){y=b.P;break}b=b.L}else{if(!b.R){y=b;break}b=b.R}bo.insert(y,v),y||(yo=v)}}}}function Oo(t){var n=t.circle;n&&(n.P||(yo=n.N),bo.remove(n),Mo.push(n),Fo(n),t.circle=null)}function Lo(t,n){var e=t.b;if(e)return!0;var r,o,a=t.a,i=n[0][0],u=n[1][0],s=n[0][1],l=n[1][1],c=t.l,f=t.r,h=c.x,p=c.y,d=f.x,m=f.y,g=(h+d)/2,v=(p+m)/2;if(m===p){if(g<i||g>=u)return;if(h>d){if(a){if(a.y>=l)return}else a={x:g,y:s};e={x:g,y:l}}else{if(a){if(a.y<s)return}else a={x:g,y:l};e={x:g,y:s}}}else if(o=v-(r=(h-d)/(m-p))*g,r<-1||r>1)if(h>d){if(a){if(a.y>=l)return}else a={x:(s-o)/r,y:s};e={x:(l-o)/r,y:l}}else{if(a){if(a.y<s)return}else a={x:(l-o)/r,y:l};e={x:(s-o)/r,y:s}}else if(p<m){if(a){if(a.x>=u)return}else a={x:i,y:r*i+o};e={x:u,y:r*u+o}}else{if(a){if(a.x<i)return}else a={x:u,y:r*u+o};e={x:i,y:r*i+o}}return t.a=a,t.b=e,!0}function Uo(t,n){this.l=t,this.r=n,this.a=this.b=null}function Do(t,n,e,r){var o=new Uo(t,n);return mo.push(o),e&&zo(o,t,n,e),r&&zo(o,n,t,r),go[t.i].edges.push(new qo(o,t,n)),go[n.i].edges.push(new qo(o,n,t)),o}function zo(t,n,e,r){t.a||t.b?t.l===e?t.b=r:t.a=r:(t.a=r,t.l=n,t.r=e)}function qo(t,n,e){var r=t.a,o=t.b;this.edge=t,this.site=n,this.angle=e?Math.atan2(e.y-n.y,e.x-n.x):t.l===n?Math.atan2(o.x-r.x,r.y-o.y):Math.atan2(r.x-o.x,o.y-r.y)}function jo(){this._=null}function Fo(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function Bo(t,n){var e=n,r=n.R,o=e.U;o?o.L===e?o.L=r:o.R=r:t._=r,r.U=o,e.U=r,e.R=r.L,e.R&&(e.R.U=e),r.L=e}function Io(t,n){var e=n,r=n.L,o=e.U;o?o.L===e?o.L=r:o.R=r:t._=r,r.U=o,e.U=r,e.L=r.R,e.L&&(e.L.U=e),r.R=e}function Xo(t){for(;t.L;)t=t.L;return t}function Yo(t,n){var e,r,o,a=t.sort(Vo).pop();for(mo=[],go=new Array(t.length),vo=new jo,bo=new jo;;)if(o=yo,a&&(!o||a.y<o.y||a.y===o.y&&a.x<o.x))a.x===e&&a.y===r||(go[a.i]=new Ro(a),Ao(a),e=a.x,r=a.y),a=t.pop();else{if(!o)break;So(o.arc)}n&&(function(t){for(var n,e=mo,r=ur(t[0][0],t[0][1],t[1][0],t[1][1]),o=e.length;o--;)(!Lo(n=e[o],t)||!r(n)||w(n.a.x-n.b.x)<Tt&&w(n.a.y-n.b.y)<Tt)&&(n.a=n.b=null,e.splice(o,1))}(n),function(t){for(var n,e,r,o,a,i,u,s,l,c,f=t[0][0],h=t[1][0],p=t[0][1],d=t[1][1],m=go,g=m.length;g--;)if((a=m[g])&&a.prepare())for(s=(u=a.edges).length,i=0;i<s;)r=(c=u[i].end()).x,o=c.y,n=(l=u[++i%s].start()).x,e=l.y,(w(r-n)>Tt||w(o-e)>Tt)&&(u.splice(i,0,new qo((v=a.site,y=c,b=w(r-f)<Tt&&d-o>Tt?{x:f,y:w(n-f)<Tt?e:d}:w(o-d)<Tt&&h-r>Tt?{x:w(e-d)<Tt?n:h,y:d}:w(r-h)<Tt&&o-p>Tt?{x:h,y:w(n-h)<Tt?e:p}:w(o-p)<Tt&&r-f>Tt?{x:w(e-p)<Tt?n:f,y:p}:null,x=void 0,(x=new Uo(v,null)).a=y,x.b=b,mo.push(x),x),a.site,null)),++s);var v,y,b,x}(n));var i={cells:go,edges:mo};return vo=bo=mo=go=null,i}function Vo(t,n){return n.y-t.y||n.x-t.x}Ro.prototype.prepare=function(){for(var t,n=this.edges,e=n.length;e--;)(t=n[e].edge).b&&t.a||n.splice(e,1);return n.sort(No),n.length},qo.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}},jo.prototype={insert:function(t,n){var e,r,o;if(t){if(n.P=t,n.N=t.N,t.N&&(t.N.P=n),t.N=n,t.R){for(t=t.R;t.L;)t=t.L;t.L=n}else t.R=n;e=t}else this._?(t=Xo(this._),n.P=null,n.N=t,t.P=t.L=n,e=t):(n.P=n.N=null,this._=n,e=null);for(n.L=n.R=null,n.U=e,n.C=!0,t=n;e&&e.C;)e===(r=e.U).L?(o=r.R)&&o.C?(e.C=o.C=!1,r.C=!0,t=r):(t===e.R&&(Bo(this,e),e=(t=e).U),e.C=!1,r.C=!0,Io(this,r)):(o=r.L)&&o.C?(e.C=o.C=!1,r.C=!0,t=r):(t===e.L&&(Io(this,e),e=(t=e).U),e.C=!1,r.C=!0,Bo(this,r)),e=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var n,e,r,o=t.U,a=t.L,i=t.R;if(e=a?i?Xo(i):a:i,o?o.L===t?o.L=e:o.R=e:this._=e,a&&i?(r=e.C,e.C=t.C,e.L=a,a.U=e,e!==i?(o=e.U,e.U=t.U,t=e.R,o.L=t,e.R=i,i.U=e):(e.U=o,o=e,t=e.R)):(r=t.C,t=e),t&&(t.U=o),!r)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===o.L){if((n=o.R).C&&(n.C=!1,o.C=!0,Bo(this,o),n=o.R),n.L&&n.L.C||n.R&&n.R.C){n.R&&n.R.C||(n.L.C=!1,n.C=!0,Io(this,n),n=o.R),n.C=o.C,o.C=n.R.C=!1,Bo(this,o),t=this._;break}}else if((n=o.L).C&&(n.C=!1,o.C=!0,Io(this,o),n=o.L),n.L&&n.L.C||n.R&&n.R.C){n.L&&n.L.C||(n.R.C=!1,n.C=!0,Bo(this,n),n=o.L),n.C=o.C,o.C=n.L.C=!1,Io(this,o),t=this._;break}n.C=!0,t=o,o=o.U}while(!t.C);t&&(t.C=!1)}}},a.geom.voronoi=function(t){var n=io,e=uo,r=n,o=e,a=Ho;if(t)return i(t);function i(t){var n=new Array(t.length),e=a[0][0],r=a[0][1],o=a[1][0],i=a[1][1];return Yo(u(t),a).cells.forEach((function(a,u){var s=a.edges,l=a.site;(n[u]=s.length?s.map((function(t){var n=t.start();return[n.x,n.y]})):l.x>=e&&l.x<=o&&l.y>=r&&l.y<=i?[[e,i],[o,i],[o,r],[e,r]]:[]).point=t[u]})),n}function u(t){return t.map((function(t,n){return{x:Math.round(r(t,n)/Tt)*Tt,y:Math.round(o(t,n)/Tt)*Tt,i:n}}))}return i.links=function(t){return Yo(u(t)).edges.filter((function(t){return t.l&&t.r})).map((function(n){return{source:t[n.l.i],target:t[n.r.i]}}))},i.triangles=function(t){var n=[];return Yo(u(t)).cells.forEach((function(e,r){for(var o,a=e.site,i=e.edges.sort(No),u=-1,s=i.length,l=i[s-1].edge,c=l.l===a?l.r:l.l;++u<s;)o=c,c=(l=i[u].edge).l===a?l.r:l.l,r<o.i&&r<c.i&&Go(a,o,c)<0&&n.push([t[r],t[o.i],t[c.i]])})),n},i.x=function(t){return arguments.length?(r=bn(n=t),i):n},i.y=function(t){return arguments.length?(o=bn(e=t),i):e},i.clipExtent=function(t){return arguments.length?(a=null==t?Ho:t,i):a===Ho?null:a},i.size=function(t){return arguments.length?i.clipExtent(t&&[[0,0],t]):a===Ho?null:a&&a[1]},i};var Ho=[[-1e6,-1e6],[1e6,1e6]];function Go(t,n,e){return(t.x-e.x)*(n.y-t.y)-(t.x-n.x)*(e.y-t.y)}function Wo(t){return t.x}function Zo(t){return t.y}function Jo(t,n,e,r,o,a){if(!t(n,e,r,o,a)){var i=.5*(e+o),u=.5*(r+a),s=n.nodes;s[0]&&Jo(t,s[0],e,r,i,u),s[1]&&Jo(t,s[1],i,r,o,u),s[2]&&Jo(t,s[2],e,u,i,a),s[3]&&Jo(t,s[3],i,u,o,a)}}function $o(t,n,e,r,o,a,i){var u,s=1/0;return function t(l,c,f,h,p){if(!(c>a||f>i||h<r||p<o)){if(d=l.point){var d,m=n-l.x,g=e-l.y,v=m*m+g*g;if(v<s){var y=Math.sqrt(s=v);r=n-y,o=e-y,a=n+y,i=e+y,u=d}}for(var b=l.nodes,x=.5*(c+h),M=.5*(f+p),w=(e>=M)<<1|n>=x,_=w+4;w<_;++w)if(l=b[3&w])switch(3&w){case 0:t(l,c,f,x,M);break;case 1:t(l,x,f,h,M);break;case 2:t(l,c,M,x,p);break;case 3:t(l,x,M,h,p)}}}(t,r,o,a,i),u}function Ko(t,n){t=a.rgb(t),n=a.rgb(n);var e=t.r,r=t.g,o=t.b,i=n.r-e,u=n.g-r,s=n.b-o;return function(t){return"#"+hn(Math.round(e+i*t))+hn(Math.round(r+u*t))+hn(Math.round(o+s*t))}}function Qo(t,n){var e,r={},o={};for(e in t)e in n?r[e]=oa(t[e],n[e]):o[e]=t[e];for(e in n)e in t||(o[e]=n[e]);return function(t){for(e in r)o[e]=r[e](t);return o}}function ta(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}function na(t,n){var e,r,o,a=ea.lastIndex=ra.lastIndex=0,i=-1,u=[],s=[];for(t+="",n+="";(e=ea.exec(t))&&(r=ra.exec(n));)(o=r.index)>a&&(o=n.slice(a,o),u[i]?u[i]+=o:u[++i]=o),(e=e[0])===(r=r[0])?u[i]?u[i]+=r:u[++i]=r:(u[++i]=null,s.push({i:i,x:ta(e,r)})),a=ra.lastIndex;return a<n.length&&(o=n.slice(a),u[i]?u[i]+=o:u[++i]=o),u.length<2?s[0]?(n=s[0].x,function(t){return n(t)+""}):function(){return n}:(n=s.length,function(t){for(var e,r=0;r<n;++r)u[(e=s[r]).i]=e.x(t);return u.join("")})}a.geom.delaunay=function(t){return a.geom.voronoi().triangles(t)},a.geom.quadtree=function(t,n,e,r,o){var a,i=io,u=uo;if(a=arguments.length)return i=Wo,u=Zo,3===a&&(o=e,r=n,e=n=0),s(t);function s(t){var s,l,c,f,h,p,d,m,g,v=bn(i),y=bn(u);if(null!=n)p=n,d=e,m=r,g=o;else if(m=g=-(p=d=1/0),l=[],c=[],h=t.length,a)for(f=0;f<h;++f)(s=t[f]).x<p&&(p=s.x),s.y<d&&(d=s.y),s.x>m&&(m=s.x),s.y>g&&(g=s.y),l.push(s.x),c.push(s.y);else for(f=0;f<h;++f){var b=+v(s=t[f],f),x=+y(s,f);b<p&&(p=b),x<d&&(d=x),b>m&&(m=b),x>g&&(g=x),l.push(b),c.push(x)}var M=m-p,_=g-d;function k(t,n,e,r,o,a,i,u){if(!isNaN(e)&&!isNaN(r))if(t.leaf){var s=t.x,l=t.y;if(null!=s)if(w(s-e)+w(l-r)<.01)S(t,n,e,r,o,a,i,u);else{var c=t.point;t.x=t.y=t.point=null,S(t,c,s,l,o,a,i,u),S(t,n,e,r,o,a,i,u)}else t.x=e,t.y=r,t.point=n}else S(t,n,e,r,o,a,i,u)}function S(t,n,e,r,o,a,i,u){var s=.5*(o+i),l=.5*(a+u),c=e>=s,f=r>=l,h=f<<1|c;t.leaf=!1,c?o=s:i=s,f?a=l:u=l,k(t=t.nodes[h]||(t.nodes[h]={leaf:!0,nodes:[],point:null,x:null,y:null}),n,e,r,o,a,i,u)}M>_?g=d+M:m=p+_;var A={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){k(A,t,+v(t,++f),+y(t,f),p,d,m,g)},visit:function(t){Jo(t,A,p,d,m,g)},find:function(t){return $o(A,t[0],t[1],p,d,m,g)}};if(f=-1,null==n){for(;++f<h;)k(A,t[f],l[f],c[f],p,d,m,g);--f}else t.forEach(A.add);return l=c=t=s=null,A}return s.x=function(t){return arguments.length?(i=t,s):i},s.y=function(t){return arguments.length?(u=t,s):u},s.extent=function(t){return arguments.length?(null==t?n=e=r=o=null:(n=+t[0][0],e=+t[0][1],r=+t[1][0],o=+t[1][1]),s):null==n?null:[[n,e],[r,o]]},s.size=function(t){return arguments.length?(null==t?n=e=r=o=null:(n=e=0,r=+t[0],o=+t[1]),s):null==n?null:[r-n,o-e]},s},a.interpolateRgb=Ko,a.interpolateObject=Qo,a.interpolateNumber=ta,a.interpolateString=na;var ea=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ra=new RegExp(ea.source,"g");function oa(t,n){for(var e,r=a.interpolators.length;--r>=0&&!(e=a.interpolators[r](t,n)););return e}function aa(t,n){var e,r=[],o=[],a=t.length,i=n.length,u=Math.min(t.length,n.length);for(e=0;e<u;++e)r.push(oa(t[e],n[e]));for(;e<a;++e)o[e]=t[e];for(;e<i;++e)o[e]=n[e];return function(t){for(e=0;e<u;++e)o[e]=r[e](t);return o}}a.interpolate=oa,a.interpolators=[function(t,n){var e=typeof n;return("string"===e?yn.has(n.toLowerCase())||/^(#|rgb\(|hsl\()/i.test(n)?Ko:na:n instanceof Ht?Ko:Array.isArray(n)?aa:"object"===e&&isNaN(n)?Qo:ta)(t,n)}],a.interpolateArray=aa;var ia=function(){return L},ua=a.map({linear:ia,poly:function(t){return function(n){return Math.pow(n,t)}},quad:function(){return ha},cubic:function(){return pa},sin:function(){return ma},exp:function(){return ga},circle:function(){return va},elastic:function(t,n){var e;return arguments.length<2&&(n=.45),arguments.length?e=n/Pt*Math.asin(1/t):(t=1,e=n/4),function(r){return 1+t*Math.pow(2,-10*r)*Math.sin((r-e)*Pt/n)}},back:function(t){return t||(t=1.70158),function(n){return n*n*((t+1)*n-t)}},bounce:function(){return ya}}),sa=a.map({in:L,out:ca,"in-out":fa,"out-in":function(t){return fa(ca(t))}});function la(t){return function(n){return n<=0?0:n>=1?1:t(n)}}function ca(t){return function(n){return 1-t(1-n)}}function fa(t){return function(n){return.5*(n<.5?t(2*n):2-t(2-2*n))}}function ha(t){return t*t}function pa(t){return t*t*t}function da(t){if(t<=0)return 0;if(t>=1)return 1;var n=t*t,e=n*t;return 4*(t<.5?e:3*(t-n)+e-.75)}function ma(t){return 1-Math.cos(t*Ot)}function ga(t){return Math.pow(2,10*(t-1))}function va(t){return 1-Math.sqrt(1-t*t)}function ya(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function ba(t,n){return n-=t,function(e){return Math.round(t+n*e)}}function xa(t){var n=[t.a,t.b],e=[t.c,t.d],r=wa(n),o=Ma(n,e),a=wa(function(t,n,e){return t[0]+=e*n[0],t[1]+=e*n[1],t}(e,n,-o))||0;n[0]*e[1]<e[0]*n[1]&&(n[0]*=-1,n[1]*=-1,r*=-1,o*=-1),this.rotate=(r?Math.atan2(n[1],n[0]):Math.atan2(-e[0],e[1]))*Ut,this.translate=[t.e,t.f],this.scale=[r,a],this.skew=a?Math.atan2(o,a)*Ut:0}function Ma(t,n){return t[0]*n[0]+t[1]*n[1]}function wa(t){var n=Math.sqrt(Ma(t,t));return n&&(t[0]/=n,t[1]/=n),n}a.ease=function(t){var n=t.indexOf("-"),e=n>=0?t.slice(0,n):t,r=n>=0?t.slice(n+1):"in";return e=ua.get(e)||ia,la((r=sa.get(r)||L)(e.apply(null,i.call(arguments,1))))},a.interpolateHcl=function(t,n){t=a.hcl(t),n=a.hcl(n);var e=t.h,r=t.c,o=t.l,i=n.h-e,u=n.c-r,s=n.l-o;return isNaN(u)&&(u=0,r=isNaN(r)?n.c:r),isNaN(i)?(i=0,e=isNaN(e)?n.h:e):i>180?i-=360:i<-180&&(i+=360),function(t){return Kt(e+i*t,r+u*t,o+s*t)+""}},a.interpolateHsl=function(t,n){t=a.hsl(t),n=a.hsl(n);var e=t.h,r=t.s,o=t.l,i=n.h-e,u=n.s-r,s=n.l-o;return isNaN(u)&&(u=0,r=isNaN(r)?n.s:r),isNaN(i)?(i=0,e=isNaN(e)?n.h:e):i>180?i-=360:i<-180&&(i+=360),function(t){return Zt(e+i*t,r+u*t,o+s*t)+""}},a.interpolateLab=function(t,n){t=a.lab(t),n=a.lab(n);var e=t.l,r=t.a,o=t.b,i=n.l-e,u=n.a-r,s=n.b-o;return function(t){return en(e+i*t,r+u*t,o+s*t)+""}},a.interpolateRound=ba,a.transform=function(t){var n=s.createElementNS(a.ns.prefix.svg,"g");return(a.transform=function(t){if(null!=t){n.setAttribute("transform",t);var e=n.transform.baseVal.consolidate()}return new xa(e?e.matrix:_a)})(t)},xa.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var _a={a:1,b:0,c:0,d:1,e:0,f:0};function ka(t){return t.length?t.pop()+",":""}function Sa(t,n){var e=[],r=[];return t=a.transform(t),n=a.transform(n),function(t,n,e,r){if(t[0]!==n[0]||t[1]!==n[1]){var o=e.push("translate(",null,",",null,")");r.push({i:o-4,x:ta(t[0],n[0])},{i:o-2,x:ta(t[1],n[1])})}else(n[0]||n[1])&&e.push("translate("+n+")")}(t.translate,n.translate,e,r),function(t,n,e,r){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),r.push({i:e.push(ka(e)+"rotate(",null,")")-2,x:ta(t,n)})):n&&e.push(ka(e)+"rotate("+n+")")}(t.rotate,n.rotate,e,r),function(t,n,e,r){t!==n?r.push({i:e.push(ka(e)+"skewX(",null,")")-2,x:ta(t,n)}):n&&e.push(ka(e)+"skewX("+n+")")}(t.skew,n.skew,e,r),function(t,n,e,r){if(t[0]!==n[0]||t[1]!==n[1]){var o=e.push(ka(e)+"scale(",null,",",null,")");r.push({i:o-4,x:ta(t[0],n[0])},{i:o-2,x:ta(t[1],n[1])})}else 1===n[0]&&1===n[1]||e.push(ka(e)+"scale("+n+")")}(t.scale,n.scale,e,r),t=n=null,function(t){for(var n,o=-1,a=r.length;++o<a;)e[(n=r[o]).i]=n.x(t);return e.join("")}}function Aa(t,n){return n=(n-=t=+t)||1/n,function(e){return(e-t)/n}}function Ea(t,n){return n=(n-=t=+t)||1/n,function(e){return Math.max(0,Math.min(1,(e-t)/n))}}function Ta(t){for(var n=t.source,e=t.target,r=function(t,n){if(t===n)return t;for(var e=Ra(t),r=Ra(n),o=e.pop(),a=r.pop(),i=null;o===a;)i=o,o=e.pop(),a=r.pop();return i}(n,e),o=[n];n!==r;)n=n.parent,o.push(n);for(var a=o.length;e!==r;)o.splice(a,0,e),e=e.parent;return o}function Ra(t){for(var n=[],e=t.parent;null!=e;)n.push(t),t=e,e=e.parent;return n.push(t),n}function Na(t){t.fixed|=2}function Pa(t){t.fixed&=-7}function Ca(t){t.fixed|=4,t.px=t.x,t.py=t.y}function Oa(t){t.fixed&=-5}a.interpolateTransform=Sa,a.layout={},a.layout.bundle=function(){return function(t){for(var n=[],e=-1,r=t.length;++e<r;)n.push(Ta(t[e]));return n}},a.layout.chord=function(){var t,n,e,r,o,i,u,s={},l=0;function c(){var s,c,h,p,d,m={},g=[],v=a.range(r),y=[];for(t=[],n=[],s=0,p=-1;++p<r;){for(c=0,d=-1;++d<r;)c+=e[p][d];g.push(c),y.push(a.range(r)),s+=c}for(o&&v.sort((function(t,n){return o(g[t],g[n])})),i&&y.forEach((function(t,n){t.sort((function(t,r){return i(e[n][t],e[n][r])}))})),s=(Pt-l*r)/s,c=0,p=-1;++p<r;){for(h=c,d=-1;++d<r;){var b=v[p],x=y[b][d],M=e[b][x],w=c,_=c+=M*s;m[b+"-"+x]={index:b,subindex:x,startAngle:w,endAngle:_,value:M}}n[b]={index:b,startAngle:h,endAngle:c,value:g[b]},c+=l}for(p=-1;++p<r;)for(d=p-1;++d<r;){var k=m[p+"-"+d],S=m[d+"-"+p];(k.value||S.value)&&t.push(k.value<S.value?{source:S,target:k}:{source:k,target:S})}u&&f()}function f(){t.sort((function(t,n){return u((t.source.value+t.target.value)/2,(n.source.value+n.target.value)/2)}))}return s.matrix=function(o){return arguments.length?(r=(e=o)&&e.length,t=n=null,s):e},s.padding=function(e){return arguments.length?(l=e,t=n=null,s):l},s.sortGroups=function(e){return arguments.length?(o=e,t=n=null,s):o},s.sortSubgroups=function(n){return arguments.length?(i=n,t=null,s):i},s.sortChords=function(n){return arguments.length?(u=n,t&&f(),s):u},s.chords=function(){return t||c(),t},s.groups=function(){return n||c(),n},s},a.layout.force=function(){var t,n,e,r,o,i,u={},s=a.dispatch("start","tick","end"),l=[1,1],c=.9,f=La,h=Ua,p=-30,d=Da,m=.1,g=.64,v=[],y=[];function b(t){return function(n,e,r,o){if(n.point!==t){var a=n.cx-t.x,i=n.cy-t.y,u=o-e,s=a*a+i*i;if(u*u/g<s){if(s<d){var l=n.charge/s;t.px-=a*l,t.py-=i*l}return!0}n.point&&s&&s<d&&(l=n.pointCharge/s,t.px-=a*l,t.py-=i*l)}return!n.charge}}function x(t){t.px=a.event.x,t.py=a.event.y,u.resume()}return u.tick=function(){if((e*=.99)<.005)return t=null,s.end({type:"end",alpha:e=0}),!0;var n,u,f,h,d,g,x,M,w,_=v.length,k=y.length;for(u=0;u<k;++u)h=(f=y[u]).source,(g=(M=(d=f.target).x-h.x)*M+(w=d.y-h.y)*w)&&(M*=g=e*o[u]*((g=Math.sqrt(g))-r[u])/g,w*=g,d.x-=M*(x=h.weight+d.weight?h.weight/(h.weight+d.weight):.5),d.y-=w*x,h.x+=M*(x=1-x),h.y+=w*x);if((x=e*m)&&(M=l[0]/2,w=l[1]/2,u=-1,x))for(;++u<_;)(f=v[u]).x+=(M-f.x)*x,f.y+=(w-f.y)*x;if(p)for(function t(n,e,r){var o=0,a=0;if(n.charge=0,!n.leaf)for(var i,u=n.nodes,s=u.length,l=-1;++l<s;)null!=(i=u[l])&&(t(i,e,r),n.charge+=i.charge,o+=i.charge*i.cx,a+=i.charge*i.cy);if(n.point){n.leaf||(n.point.x+=Math.random()-.5,n.point.y+=Math.random()-.5);var c=e*r[n.point.index];n.charge+=n.pointCharge=c,o+=c*n.point.x,a+=c*n.point.y}n.cx=o/n.charge,n.cy=a/n.charge}(n=a.geom.quadtree(v),e,i),u=-1;++u<_;)(f=v[u]).fixed||n.visit(b(f));for(u=-1;++u<_;)(f=v[u]).fixed?(f.x=f.px,f.y=f.py):(f.x-=(f.px-(f.px=f.x))*c,f.y-=(f.py-(f.py=f.y))*c);s.tick({type:"tick",alpha:e})},u.nodes=function(t){return arguments.length?(v=t,u):v},u.links=function(t){return arguments.length?(y=t,u):y},u.size=function(t){return arguments.length?(l=t,u):l},u.linkDistance=function(t){return arguments.length?(f="function"==typeof t?t:+t,u):f},u.distance=u.linkDistance,u.linkStrength=function(t){return arguments.length?(h="function"==typeof t?t:+t,u):h},u.friction=function(t){return arguments.length?(c=+t,u):c},u.charge=function(t){return arguments.length?(p="function"==typeof t?t:+t,u):p},u.chargeDistance=function(t){return arguments.length?(d=t*t,u):Math.sqrt(d)},u.gravity=function(t){return arguments.length?(m=+t,u):m},u.theta=function(t){return arguments.length?(g=t*t,u):Math.sqrt(g)},u.alpha=function(n){return arguments.length?(n=+n,e?n>0?e=n:(t.c=null,t.t=NaN,t=null,s.end({type:"end",alpha:e=0})):n>0&&(s.start({type:"start",alpha:e=n}),t=En(u.tick)),u):e},u.start=function(){var t,n,e,a=v.length,s=y.length,c=l[0],d=l[1];for(t=0;t<a;++t)(e=v[t]).index=t,e.weight=0;for(t=0;t<s;++t)"number"==typeof(e=y[t]).source&&(e.source=v[e.source]),"number"==typeof e.target&&(e.target=v[e.target]),++e.source.weight,++e.target.weight;for(t=0;t<a;++t)e=v[t],isNaN(e.x)&&(e.x=m("x",c)),isNaN(e.y)&&(e.y=m("y",d)),isNaN(e.px)&&(e.px=e.x),isNaN(e.py)&&(e.py=e.y);if(r=[],"function"==typeof f)for(t=0;t<s;++t)r[t]=+f.call(this,y[t],t);else for(t=0;t<s;++t)r[t]=f;if(o=[],"function"==typeof h)for(t=0;t<s;++t)o[t]=+h.call(this,y[t],t);else for(t=0;t<s;++t)o[t]=h;if(i=[],"function"==typeof p)for(t=0;t<a;++t)i[t]=+p.call(this,v[t],t);else for(t=0;t<a;++t)i[t]=p;function m(e,r){if(!n){for(n=new Array(a),l=0;l<a;++l)n[l]=[];for(l=0;l<s;++l){var o=y[l];n[o.source.index].push(o.target),n[o.target.index].push(o.source)}}for(var i,u=n[t],l=-1,c=u.length;++l<c;)if(!isNaN(i=u[l][e]))return i;return Math.random()*r}return u.resume()},u.resume=function(){return u.alpha(.1)},u.stop=function(){return u.alpha(0)},u.drag=function(){if(n||(n=a.behavior.drag().origin(L).on("dragstart.force",Na).on("drag.force",x).on("dragend.force",Pa)),!arguments.length)return n;this.on("mouseover.force",Ca).on("mouseout.force",Oa).call(n)},a.rebind(u,s,"on")};var La=20,Ua=1,Da=1/0;function za(t,n){return a.rebind(t,n,"sort","children","value"),t.nodes=t,t.links=Xa,t}function qa(t,n){for(var e=[t];null!=(t=e.pop());)if(n(t),(o=t.children)&&(r=o.length))for(var r,o;--r>=0;)e.push(o[r])}function ja(t,n){for(var e=[t],r=[];null!=(t=e.pop());)if(r.push(t),(a=t.children)&&(o=a.length))for(var o,a,i=-1;++i<o;)e.push(a[i]);for(;null!=(t=r.pop());)n(t)}function Fa(t){return t.children}function Ba(t){return t.value}function Ia(t,n){return n.value-t.value}function Xa(t){return a.merge(t.map((function(t){return(t.children||[]).map((function(n){return{source:t,target:n}}))})))}a.layout.hierarchy=function(){var t=Ia,n=Fa,e=Ba;function r(o){var a,i=[o],u=[];for(o.depth=0;null!=(a=i.pop());)if(u.push(a),(l=n.call(r,a,a.depth))&&(s=l.length)){for(var s,l,c;--s>=0;)i.push(c=l[s]),c.parent=a,c.depth=a.depth+1;e&&(a.value=0),a.children=l}else e&&(a.value=+e.call(r,a,a.depth)||0),delete a.children;return ja(o,(function(n){var r,o;t&&(r=n.children)&&r.sort(t),e&&(o=n.parent)&&(o.value+=n.value)})),u}return r.sort=function(n){return arguments.length?(t=n,r):t},r.children=function(t){return arguments.length?(n=t,r):n},r.value=function(t){return arguments.length?(e=t,r):e},r.revalue=function(t){return e&&(qa(t,(function(t){t.children&&(t.value=0)})),ja(t,(function(t){var n;t.children||(t.value=+e.call(r,t,t.depth)||0),(n=t.parent)&&(n.value+=t.value)}))),t},r},a.layout.partition=function(){var t=a.layout.hierarchy(),n=[1,1];function e(e,r){var o=t.call(this,e,r);return function t(n,e,r,o){var a=n.children;if(n.x=e,n.y=n.depth*o,n.dx=r,n.dy=o,a&&(i=a.length)){var i,u,s,l=-1;for(r=n.value?r/n.value:0;++l<i;)t(u=a[l],e,s=u.value*r,o),e+=s}}(o[0],0,n[0],n[1]/function t(n){var e=n.children,r=0;if(e&&(o=e.length))for(var o,a=-1;++a<o;)r=Math.max(r,t(e[a]));return 1+r}(o[0])),o}return e.size=function(t){return arguments.length?(n=t,e):n},za(e,t)},a.layout.pie=function(){var t=Number,n=Ya,e=0,r=Pt,o=0;function i(u){var s,l=u.length,c=u.map((function(n,e){return+t.call(i,n,e)})),f=+("function"==typeof e?e.apply(this,arguments):e),h=("function"==typeof r?r.apply(this,arguments):r)-f,p=Math.min(Math.abs(h)/l,+("function"==typeof o?o.apply(this,arguments):o)),d=p*(h<0?-1:1),m=a.sum(c),g=m?(h-l*d)/m:0,v=a.range(l),y=[];return null!=n&&v.sort(n===Ya?function(t,n){return c[n]-c[t]}:function(t,e){return n(u[t],u[e])}),v.forEach((function(t){y[t]={data:u[t],value:s=c[t],startAngle:f,endAngle:f+=s*g+d,padAngle:p}})),y}return i.value=function(n){return arguments.length?(t=n,i):t},i.sort=function(t){return arguments.length?(n=t,i):n},i.startAngle=function(t){return arguments.length?(e=t,i):e},i.endAngle=function(t){return arguments.length?(r=t,i):r},i.padAngle=function(t){return arguments.length?(o=t,i):o},i};var Ya={};function Va(t){return t.x}function Ha(t){return t.y}function Ga(t,n,e){t.y0=n,t.y=e}a.layout.stack=function(){var t=L,n=Ja,e=$a,r=Ga,o=Va,i=Ha;function u(s,l){if(!(p=s.length))return s;var c=s.map((function(n,e){return t.call(u,n,e)})),f=c.map((function(t){return t.map((function(t,n){return[o.call(u,t,n),i.call(u,t,n)]}))})),h=n.call(u,f,l);c=a.permute(c,h),f=a.permute(f,h);var p,d,m,g,v=e.call(u,f,l),y=c[0].length;for(m=0;m<y;++m)for(r.call(u,c[0][m],g=v[m],f[0][m][1]),d=1;d<p;++d)r.call(u,c[d][m],g+=f[d-1][m][1],f[d][m][1]);return s}return u.values=function(n){return arguments.length?(t=n,u):t},u.order=function(t){return arguments.length?(n="function"==typeof t?t:Wa.get(t)||Ja,u):n},u.offset=function(t){return arguments.length?(e="function"==typeof t?t:Za.get(t)||$a,u):e},u.x=function(t){return arguments.length?(o=t,u):o},u.y=function(t){return arguments.length?(i=t,u):i},u.out=function(t){return arguments.length?(r=t,u):r},u};var Wa=a.map({"inside-out":function(t){var n,e,r=t.length,o=t.map(Ka),i=t.map(Qa),u=a.range(r).sort((function(t,n){return o[t]-o[n]})),s=0,l=0,c=[],f=[];for(n=0;n<r;++n)e=u[n],s<l?(s+=i[e],c.push(e)):(l+=i[e],f.push(e));return f.reverse().concat(c)},reverse:function(t){return a.range(t.length).reverse()},default:Ja}),Za=a.map({silhouette:function(t){var n,e,r,o=t.length,a=t[0].length,i=[],u=0,s=[];for(e=0;e<a;++e){for(n=0,r=0;n<o;n++)r+=t[n][e][1];r>u&&(u=r),i.push(r)}for(e=0;e<a;++e)s[e]=(u-i[e])/2;return s},wiggle:function(t){var n,e,r,o,a,i,u,s,l,c=t.length,f=t[0],h=f.length,p=[];for(p[0]=s=l=0,e=1;e<h;++e){for(n=0,o=0;n<c;++n)o+=t[n][e][1];for(n=0,a=0,u=f[e][0]-f[e-1][0];n<c;++n){for(r=0,i=(t[n][e][1]-t[n][e-1][1])/(2*u);r<n;++r)i+=(t[r][e][1]-t[r][e-1][1])/u;a+=i*t[n][e][1]}p[e]=s-=o?a/o*u:0,s<l&&(l=s)}for(e=0;e<h;++e)p[e]-=l;return p},expand:function(t){var n,e,r,o=t.length,a=t[0].length,i=1/o,u=[];for(e=0;e<a;++e){for(n=0,r=0;n<o;n++)r+=t[n][e][1];if(r)for(n=0;n<o;n++)t[n][e][1]/=r;else for(n=0;n<o;n++)t[n][e][1]=i}for(e=0;e<a;++e)u[e]=0;return u},zero:$a});function Ja(t){return a.range(t.length)}function $a(t){for(var n=-1,e=t[0].length,r=[];++n<e;)r[n]=0;return r}function Ka(t){for(var n,e=1,r=0,o=t[0][1],a=t.length;e<a;++e)(n=t[e][1])>o&&(r=e,o=n);return r}function Qa(t){return t.reduce(ti,0)}function ti(t,n){return t+n[1]}function ni(t,n){return ei(t,Math.ceil(Math.log(n.length)/Math.LN2+1))}function ei(t,n){for(var e=-1,r=+t[0],o=(t[1]-r)/n,a=[];++e<=n;)a[e]=o*e+r;return a}function ri(t){return[a.min(t),a.max(t)]}function oi(t,n){return t.value-n.value}function ai(t,n){var e=t._pack_next;t._pack_next=n,n._pack_prev=t,n._pack_next=e,e._pack_prev=n}function ii(t,n){t._pack_next=n,n._pack_prev=t}function ui(t,n){var e=n.x-t.x,r=n.y-t.y,o=t.r+n.r;return.999*o*o>e*e+r*r}function si(t){if((n=t.children)&&(s=n.length)){var n,e,r,o,a,i,u,s,l=1/0,c=-1/0,f=1/0,h=-1/0;if(n.forEach(li),(e=n[0]).x=-e.r,e.y=0,b(e),s>1&&((r=n[1]).x=r.r,r.y=0,b(r),s>2))for(fi(e,r,o=n[2]),b(o),ai(e,o),e._pack_prev=o,ai(o,r),r=e._pack_next,a=3;a<s;a++){fi(e,r,o=n[a]);var p=0,d=1,m=1;for(i=r._pack_next;i!==r;i=i._pack_next,d++)if(ui(i,o)){p=1;break}if(1==p)for(u=e._pack_prev;u!==i._pack_prev&&!ui(u,o);u=u._pack_prev,m++);p?(d<m||d==m&&r.r<e.r?ii(e,r=i):ii(e=u,r),a--):(ai(e,o),r=o,b(o))}var g=(l+c)/2,v=(f+h)/2,y=0;for(a=0;a<s;a++)(o=n[a]).x-=g,o.y-=v,y=Math.max(y,o.r+Math.sqrt(o.x*o.x+o.y*o.y));t.r=y,n.forEach(ci)}function b(t){l=Math.min(t.x-t.r,l),c=Math.max(t.x+t.r,c),f=Math.min(t.y-t.r,f),h=Math.max(t.y+t.r,h)}}function li(t){t._pack_next=t._pack_prev=t}function ci(t){delete t._pack_next,delete t._pack_prev}function fi(t,n,e){var r=t.r+e.r,o=n.x-t.x,a=n.y-t.y;if(r&&(o||a)){var i=n.r+e.r,u=o*o+a*a,s=.5+((r*=r)-(i*=i))/(2*u),l=Math.sqrt(Math.max(0,2*i*(r+u)-(r-=u)*r-i*i))/(2*u);e.x=t.x+s*o+l*a,e.y=t.y+s*a-l*o}else e.x=t.x+r,e.y=t.y}function hi(t,n){return t.parent==n.parent?1:2}function pi(t){var n=t.children;return n.length?n[0]:t.t}function di(t){var n,e=t.children;return(n=e.length)?e[n-1]:t.t}function mi(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function gi(t,n,e){return t.a.parent===n.parent?t.a:e}function vi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function yi(t,n){var e=t.x+n[3],r=t.y+n[0],o=t.dx-n[1]-n[3],a=t.dy-n[0]-n[2];return o<0&&(e+=o/2,o=0),a<0&&(r+=a/2,a=0),{x:e,y:r,dx:o,dy:a}}function bi(t){var n=t[0],e=t[t.length-1];return n<e?[n,e]:[e,n]}function xi(t){return t.rangeExtent?t.rangeExtent():bi(t.range())}function Mi(t,n,e,r){var o=e(t[0],t[1]),a=r(n[0],n[1]);return function(t){return a(o(t))}}function wi(t,n){var e,r=0,o=t.length-1,a=t[r],i=t[o];return i<a&&(e=r,r=o,o=e,e=a,a=i,i=e),t[r]=n.floor(a),t[o]=n.ceil(i),t}function _i(t){return t?{floor:function(n){return Math.floor(n/t)*t},ceil:function(n){return Math.ceil(n/t)*t}}:ki}a.layout.histogram=function(){var t=!0,n=Number,e=ri,r=ni;function o(o,i){for(var u,s,l=[],c=o.map(n,this),f=e.call(this,c,i),h=r.call(this,f,c,i),p=(i=-1,c.length),d=h.length-1,m=t?1:1/p;++i<d;)(u=l[i]=[]).dx=h[i+1]-(u.x=h[i]),u.y=0;if(d>0)for(i=-1;++i<p;)(s=c[i])>=f[0]&&s<=f[1]&&((u=l[a.bisect(h,s,1,d)-1]).y+=m,u.push(o[i]));return l}return o.value=function(t){return arguments.length?(n=t,o):n},o.range=function(t){return arguments.length?(e=bn(t),o):e},o.bins=function(t){return arguments.length?(r="number"==typeof t?function(n){return ei(n,t)}:bn(t),o):r},o.frequency=function(n){return arguments.length?(t=!!n,o):t},o},a.layout.pack=function(){var t,n=a.layout.hierarchy().sort(oi),e=0,r=[1,1];function o(o,a){var i=n.call(this,o,a),u=i[0],s=r[0],l=r[1],c=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(u.x=u.y=0,ja(u,(function(t){t.r=+c(t.value)})),ja(u,si),e){var f=e*(t?1:Math.max(2*u.r/s,2*u.r/l))/2;ja(u,(function(t){t.r+=f})),ja(u,si),ja(u,(function(t){t.r-=f}))}return function t(n,e,r,o){var a=n.children;if(n.x=e+=o*n.x,n.y=r+=o*n.y,n.r*=o,a)for(var i=-1,u=a.length;++i<u;)t(a[i],e,r,o)}(u,s/2,l/2,t?1:1/Math.max(2*u.r/s,2*u.r/l)),i}return o.size=function(t){return arguments.length?(r=t,o):r},o.radius=function(n){return arguments.length?(t=null==n||"function"==typeof n?n:+n,o):t},o.padding=function(t){return arguments.length?(e=+t,o):e},za(o,n)},a.layout.tree=function(){var t=a.layout.hierarchy().sort(null).value(null),n=hi,e=[1,1],r=null;function o(o,a){var l=t.call(this,o,a),c=l[0],f=function(t){for(var n,e={A:null,children:[t]},r=[e];null!=(n=r.pop());)for(var o,a=n.children,i=0,u=a.length;i<u;++i)r.push((a[i]=o={_:a[i],parent:n,children:(o=a[i].children)&&o.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:i}).a=o);return e.children[0]}(c);if(ja(f,i),f.parent.m=-f.z,qa(f,u),r)qa(c,s);else{var h=c,p=c,d=c;qa(c,(function(t){t.x<h.x&&(h=t),t.x>p.x&&(p=t),t.depth>d.depth&&(d=t)}));var m=n(h,p)/2-h.x,g=e[0]/(p.x+n(p,h)/2+m),v=e[1]/(d.depth||1);qa(c,(function(t){t.x=(t.x+m)*g,t.y=t.depth*v}))}return l}function i(t){var e=t.children,r=t.parent.children,o=t.i?r[t.i-1]:null;if(e.length){!function(t){for(var n,e=0,r=0,o=t.children,a=o.length;--a>=0;)(n=o[a]).z+=e,n.m+=e,e+=n.s+(r+=n.c)}(t);var a=(e[0].z+e[e.length-1].z)/2;o?(t.z=o.z+n(t._,o._),t.m=t.z-a):t.z=a}else o&&(t.z=o.z+n(t._,o._));t.parent.A=function(t,e,r){if(e){for(var o,a=t,i=t,u=e,s=a.parent.children[0],l=a.m,c=i.m,f=u.m,h=s.m;u=di(u),a=pi(a),u&&a;)s=pi(s),(i=di(i)).a=t,(o=u.z+f-a.z-l+n(u._,a._))>0&&(mi(gi(u,t,r),t,o),l+=o,c+=o),f+=u.m,l+=a.m,h+=s.m,c+=i.m;u&&!di(i)&&(i.t=u,i.m+=f-c),a&&!pi(s)&&(s.t=a,s.m+=l-h,r=t)}return r}(t,o,t.parent.A||r[0])}function u(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=e[0],t.y=t.depth*e[1]}return o.separation=function(t){return arguments.length?(n=t,o):n},o.size=function(t){return arguments.length?(r=null==(e=t)?s:null,o):r?null:e},o.nodeSize=function(t){return arguments.length?(r=null==(e=t)?null:s,o):r?e:null},za(o,t)},a.layout.cluster=function(){var t=a.layout.hierarchy().sort(null).value(null),n=hi,e=[1,1],r=!1;function o(o,i){var u,s=t.call(this,o,i),l=s[0],c=0;ja(l,(function(t){var e=t.children;e&&e.length?(t.x=function(t){return t.reduce((function(t,n){return t+n.x}),0)/t.length}(e),t.y=function(t){return 1+a.max(t,(function(t){return t.y}))}(e)):(t.x=u?c+=n(t,u):0,t.y=0,u=t)}));var f=function t(n){var e=n.children;return e&&e.length?t(e[0]):n}(l),h=function t(n){var e,r=n.children;return r&&(e=r.length)?t(r[e-1]):n}(l),p=f.x-n(f,h)/2,d=h.x+n(h,f)/2;return ja(l,r?function(t){t.x=(t.x-l.x)*e[0],t.y=(l.y-t.y)*e[1]}:function(t){t.x=(t.x-p)/(d-p)*e[0],t.y=(1-(l.y?t.y/l.y:1))*e[1]}),s}return o.separation=function(t){return arguments.length?(n=t,o):n},o.size=function(t){return arguments.length?(r=null==(e=t),o):r?null:e},o.nodeSize=function(t){return arguments.length?(r=null!=(e=t),o):r?e:null},za(o,t)},a.layout.treemap=function(){var t,n=a.layout.hierarchy(),e=Math.round,r=[1,1],o=null,i=vi,u=!1,s="squarify",l=.5*(1+Math.sqrt(5));function c(t,n){for(var e,r,o=-1,a=t.length;++o<a;)r=(e=t[o]).value*(n<0?0:n),e.area=isNaN(r)||r<=0?0:r}function f(t){var n=t.children;if(n&&n.length){var e,r,o,a=i(t),u=[],l=n.slice(),h=1/0,m="slice"===s?a.dx:"dice"===s?a.dy:"slice-dice"===s?1&t.depth?a.dy:a.dx:Math.min(a.dx,a.dy);for(c(l,a.dx*a.dy/t.value),u.area=0;(o=l.length)>0;)u.push(e=l[o-1]),u.area+=e.area,"squarify"!==s||(r=p(u,m))<=h?(l.pop(),h=r):(u.area-=u.pop().area,d(u,m,a,!1),m=Math.min(a.dx,a.dy),u.length=u.area=0,h=1/0);u.length&&(d(u,m,a,!0),u.length=u.area=0),n.forEach(f)}}function h(t){var n=t.children;if(n&&n.length){var e,r=i(t),o=n.slice(),a=[];for(c(o,r.dx*r.dy/t.value),a.area=0;e=o.pop();)a.push(e),a.area+=e.area,null!=e.z&&(d(a,e.z?r.dx:r.dy,r,!o.length),a.length=a.area=0);n.forEach(h)}}function p(t,n){for(var e,r=t.area,o=0,a=1/0,i=-1,u=t.length;++i<u;)(e=t[i].area)&&(e<a&&(a=e),e>o&&(o=e));return n*=n,(r*=r)?Math.max(n*o*l/r,r/(n*a*l)):1/0}function d(t,n,r,o){var a,i=-1,u=t.length,s=r.x,l=r.y,c=n?e(t.area/n):0;if(n==r.dx){for((o||c>r.dy)&&(c=r.dy);++i<u;)(a=t[i]).x=s,a.y=l,a.dy=c,s+=a.dx=Math.min(r.x+r.dx-s,c?e(a.area/c):0);a.z=!0,a.dx+=r.x+r.dx-s,r.y+=c,r.dy-=c}else{for((o||c>r.dx)&&(c=r.dx);++i<u;)(a=t[i]).x=s,a.y=l,a.dx=c,l+=a.dy=Math.min(r.y+r.dy-l,c?e(a.area/c):0);a.z=!1,a.dy+=r.y+r.dy-l,r.x+=c,r.dx-=c}}function m(e){var o=t||n(e),a=o[0];return a.x=a.y=0,a.value?(a.dx=r[0],a.dy=r[1]):a.dx=a.dy=0,t&&n.revalue(a),c([a],a.dx*a.dy/a.value),(t?h:f)(a),u&&(t=o),o}return m.size=function(t){return arguments.length?(r=t,m):r},m.padding=function(t){if(!arguments.length)return o;function n(n){var e=t.call(m,n,n.depth);return null==e?vi(n):yi(n,"number"==typeof e?[e,e,e,e]:e)}function e(n){return yi(n,t)}var r;return i=null==(o=t)?vi:"function"==(r=typeof t)?n:"number"===r?(t=[t,t,t,t],e):e,m},m.round=function(t){return arguments.length?(e=t?Math.round:Number,m):e!=Number},m.sticky=function(n){return arguments.length?(u=n,t=null,m):u},m.ratio=function(t){return arguments.length?(l=t,m):l},m.mode=function(t){return arguments.length?(s=t+"",m):s},za(m,n)},a.random={normal:function(t,n){var e=arguments.length;return e<2&&(n=1),e<1&&(t=0),function(){var e,r,o;do{o=(e=2*Math.random()-1)*e+(r=2*Math.random()-1)*r}while(!o||o>1);return t+n*e*Math.sqrt(-2*Math.log(o)/o)}},logNormal:function(){var t=a.random.normal.apply(a,arguments);return function(){return Math.exp(t())}},bates:function(t){var n=a.random.irwinHall(t);return function(){return n()/t}},irwinHall:function(t){return function(){for(var n=0,e=0;e<t;e++)n+=Math.random();return n}}},a.scale={};var ki={floor:L,ceil:L};function Si(t,n,e,r){var o=[],i=[],u=0,s=Math.min(t.length,n.length)-1;for(t[s]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++u<=s;)o.push(e(t[u-1],t[u])),i.push(r(n[u-1],n[u]));return function(n){var e=a.bisect(t,n,1,s)-1;return i[e](o[e](n))}}function Ai(t,n){return a.rebind(t,n,"range","rangeRound","interpolate","clamp")}function Ei(t,n){return wi(t,_i(Ti(t,n)[2])),wi(t,_i(Ti(t,n)[2])),t}function Ti(t,n){null==n&&(n=10);var e=bi(t),r=e[1]-e[0],o=Math.pow(10,Math.floor(Math.log(r/n)/Math.LN10)),a=n/r*o;return a<=.15?o*=10:a<=.35?o*=5:a<=.75&&(o*=2),e[0]=Math.ceil(e[0]/o)*o,e[1]=Math.floor(e[1]/o)*o+.5*o,e[2]=o,e}function Ri(t,n){return a.range.apply(a,Ti(t,n))}function Ni(t,n,e){var r=Ti(t,n);if(e){var o=Ln.exec(e);if(o.shift(),"s"===o[8]){var i=a.formatPrefix(Math.max(w(r[0]),w(r[1])));return o[7]||(o[7]="."+Ci(i.scale(r[2]))),o[8]="f",e=a.format(o.join("")),function(t){return e(i.scale(t))+i.symbol}}o[7]||(o[7]="."+function(t,n){var e=Ci(n[2]);return t in Pi?Math.abs(e-Ci(Math.max(w(n[0]),w(n[1]))))+ +("e"!==t):e-2*("%"===t)}(o[8],r)),e=o.join("")}else e=",."+Ci(r[2])+"f";return a.format(e)}a.scale.linear=function(){return function t(n,e,r,o){var a,i;function u(){var t=Math.min(n.length,e.length)>2?Si:Mi,u=o?Ea:Aa;return a=t(n,e,u,r),i=t(e,n,u,oa),s}function s(t){return a(t)}return s.invert=function(t){return i(t)},s.domain=function(t){return arguments.length?(n=t.map(Number),u()):n},s.range=function(t){return arguments.length?(e=t,u()):e},s.rangeRound=function(t){return s.range(t).interpolate(ba)},s.clamp=function(t){return arguments.length?(o=t,u()):o},s.interpolate=function(t){return arguments.length?(r=t,u()):r},s.ticks=function(t){return Ri(n,t)},s.tickFormat=function(t,e){return Ni(n,t,e)},s.nice=function(t){return Ei(n,t),u()},s.copy=function(){return t(n,e,r,o)},u()}([0,1],[0,1],oa,!1)};var Pi={s:1,g:1,p:1,r:1,e:1};function Ci(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}a.scale.log=function(){return function t(n,e,r,o){function i(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function u(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function s(t){return n(i(t))}return s.invert=function(t){return u(n.invert(t))},s.domain=function(t){return arguments.length?(r=t[0]>=0,n.domain((o=t.map(Number)).map(i)),s):o},s.base=function(t){return arguments.length?(e=+t,n.domain(o.map(i)),s):e},s.nice=function(){var t=wi(o.map(i),r?Math:Li);return n.domain(t),o=t.map(u),s},s.ticks=function(){var t=bi(o),n=[],a=t[0],s=t[1],l=Math.floor(i(a)),c=Math.ceil(i(s)),f=e%1?2:e;if(isFinite(c-l)){if(r){for(;l<c;l++)for(var h=1;h<f;h++)n.push(u(l)*h);n.push(u(l))}else for(n.push(u(l));l++<c;)for(h=f-1;h>0;h--)n.push(u(l)*h);for(l=0;n[l]<a;l++);for(c=n.length;n[c-1]>s;c--);n=n.slice(l,c)}return n},s.tickFormat=function(t,n){if(!arguments.length)return Oi;arguments.length<2?n=Oi:"function"!=typeof n&&(n=a.format(n));var r=Math.max(1,e*t/s.ticks().length);return function(t){var o=t/u(Math.round(i(t)));return o*e<e-.5&&(o*=e),o<=r?n(t):""}},s.copy=function(){return t(n.copy(),e,r,o)},Ai(s,n)}(a.scale.linear().domain([0,1]),10,!0,[1,10])};var Oi=a.format(".0e"),Li={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};function Ui(t){return function(n){return n<0?-Math.pow(-n,t):Math.pow(n,t)}}a.scale.pow=function(){return function t(n,e,r){var o=Ui(e),a=Ui(1/e);function i(t){return n(o(t))}return i.invert=function(t){return a(n.invert(t))},i.domain=function(t){return arguments.length?(n.domain((r=t.map(Number)).map(o)),i):r},i.ticks=function(t){return Ri(r,t)},i.tickFormat=function(t,n){return Ni(r,t,n)},i.nice=function(t){return i.domain(Ei(r,t))},i.exponent=function(t){return arguments.length?(o=Ui(e=t),a=Ui(1/e),n.domain(r.map(o)),i):e},i.copy=function(){return t(n.copy(),e,r)},Ai(i,n)}(a.scale.linear(),1,[0,1])},a.scale.sqrt=function(){return a.scale.pow().exponent(.5)},a.scale.ordinal=function(){return function t(n,e){var r,o,i;function u(t){return o[((r.get(t)||("range"===e.t?r.set(t,n.push(t)):NaN))-1)%o.length]}function s(t,e){return a.range(n.length).map((function(n){return t+e*n}))}return u.domain=function(t){if(!arguments.length)return n;n=[],r=new S;for(var o,a=-1,i=t.length;++a<i;)r.has(o=t[a])||r.set(o,n.push(o));return u[e.t].apply(u,e.a)},u.range=function(t){return arguments.length?(o=t,i=0,e={t:"range",a:arguments},u):o},u.rangePoints=function(t,r){arguments.length<2&&(r=0);var a=t[0],l=t[1],c=n.length<2?(a=(a+l)/2,0):(l-a)/(n.length-1+r);return o=s(a+c*r/2,c),i=0,e={t:"rangePoints",a:arguments},u},u.rangeRoundPoints=function(t,r){arguments.length<2&&(r=0);var a=t[0],l=t[1],c=n.length<2?(a=l=Math.round((a+l)/2),0):(l-a)/(n.length-1+r)|0;return o=s(a+Math.round(c*r/2+(l-a-(n.length-1+r)*c)/2),c),i=0,e={t:"rangeRoundPoints",a:arguments},u},u.rangeBands=function(t,r,a){arguments.length<2&&(r=0),arguments.length<3&&(a=r);var l=t[1]<t[0],c=t[l-0],f=t[1-l],h=(f-c)/(n.length-r+2*a);return o=s(c+h*a,h),l&&o.reverse(),i=h*(1-r),e={t:"rangeBands",a:arguments},u},u.rangeRoundBands=function(t,r,a){arguments.length<2&&(r=0),arguments.length<3&&(a=r);var l=t[1]<t[0],c=t[l-0],f=t[1-l],h=Math.floor((f-c)/(n.length-r+2*a));return o=s(c+Math.round((f-c-(n.length-r)*h)/2),h),l&&o.reverse(),i=Math.round(h*(1-r)),e={t:"rangeRoundBands",a:arguments},u},u.rangeBand=function(){return i},u.rangeExtent=function(){return bi(e.a[0])},u.copy=function(){return t(n,e)},u.domain(n)}([],{t:"range",a:[[]]})},a.scale.category10=function(){return a.scale.ordinal().range(Di)},a.scale.category20=function(){return a.scale.ordinal().range(zi)},a.scale.category20b=function(){return a.scale.ordinal().range(qi)},a.scale.category20c=function(){return a.scale.ordinal().range(ji)};var Di=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(cn),zi=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(cn),qi=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(cn),ji=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(cn);function Fi(){return 0}a.scale.quantile=function(){return function t(n,e){var r;function o(){var t=0,o=e.length;for(r=[];++t<o;)r[t-1]=a.quantile(n,t/o);return i}function i(t){if(!isNaN(t=+t))return e[a.bisect(r,t)]}return i.domain=function(t){return arguments.length?(n=t.map(v).filter(y).sort(g),o()):n},i.range=function(t){return arguments.length?(e=t,o()):e},i.quantiles=function(){return r},i.invertExtent=function(t){return(t=e.indexOf(t))<0?[NaN,NaN]:[t>0?r[t-1]:n[0],t<r.length?r[t]:n[n.length-1]]},i.copy=function(){return t(n,e)},o()}([],[])},a.scale.quantize=function(){return function t(n,e,r){var o,a;function i(t){return r[Math.max(0,Math.min(a,Math.floor(o*(t-n))))]}function u(){return o=r.length/(e-n),a=r.length-1,i}return i.domain=function(t){return arguments.length?(n=+t[0],e=+t[t.length-1],u()):[n,e]},i.range=function(t){return arguments.length?(r=t,u()):r},i.invertExtent=function(t){return[t=(t=r.indexOf(t))<0?NaN:t/o+n,t+1/o]},i.copy=function(){return t(n,e,r)},u()}(0,1,[0,1])},a.scale.threshold=function(){return function t(n,e){function r(t){if(t<=t)return e[a.bisect(n,t)]}return r.domain=function(t){return arguments.length?(n=t,r):n},r.range=function(t){return arguments.length?(e=t,r):e},r.invertExtent=function(t){return t=e.indexOf(t),[n[t-1],n[t]]},r.copy=function(){return t(n,e)},r}([.5],[0,1])},a.scale.identity=function(){return function t(n){function e(t){return+t}return e.invert=e,e.domain=e.range=function(t){return arguments.length?(n=t.map(e),e):n},e.ticks=function(t){return Ri(n,t)},e.tickFormat=function(t,e){return Ni(n,t,e)},e.copy=function(){return t(n)},e}([0,1])},a.svg={},a.svg.arc=function(){var t=Ii,n=Xi,e=Fi,r=Bi,o=Yi,a=Vi,i=Hi;function u(){var u=Math.max(0,+t.apply(this,arguments)),l=Math.max(0,+n.apply(this,arguments)),c=o.apply(this,arguments)-Ot,f=a.apply(this,arguments)-Ot,h=Math.abs(f-c),p=c>f?0:1;if(l<u&&(d=l,l=u,u=d),h>=Ct)return s(l,p)+(u?s(u,1-p):"")+"Z";var d,m,g,v,y,b,x,M,w,_,k,S,A=0,E=0,T=[];if((v=(+i.apply(this,arguments)||0)/2)&&(g=r===Bi?Math.sqrt(u*u+l*l):+r.apply(this,arguments),p||(E*=-1),l&&(E=jt(g/l*Math.sin(v))),u&&(A=jt(g/u*Math.sin(v)))),l){y=l*Math.cos(c+E),b=l*Math.sin(c+E),x=l*Math.cos(f-E),M=l*Math.sin(f-E);var R=Math.abs(f-c-2*E)<=Nt?0:1;if(E&&Gi(y,b,x,M)===p^R){var N=(c+f)/2;y=l*Math.cos(N),b=l*Math.sin(N),x=M=null}}else y=b=0;if(u){w=u*Math.cos(f-A),_=u*Math.sin(f-A),k=u*Math.cos(c+A),S=u*Math.sin(c+A);var P=Math.abs(c-f+2*A)<=Nt?0:1;if(A&&Gi(w,_,k,S)===1-p^P){var C=(c+f)/2;w=u*Math.cos(C),_=u*Math.sin(C),k=S=null}}else w=_=0;if(h>Tt&&(d=Math.min(Math.abs(l-u)/2,+e.apply(this,arguments)))>.001){m=u<l^p?0:1;var O=d,L=d;if(h<Nt){var U=null==k?[w,_]:null==x?[y,b]:ho([y,b],[k,S],[x,M],[w,_]),D=y-U[0],z=b-U[1],q=x-U[0],j=M-U[1],F=1/Math.sin(Math.acos((D*q+z*j)/(Math.sqrt(D*D+z*z)*Math.sqrt(q*q+j*j)))/2),B=Math.sqrt(U[0]*U[0]+U[1]*U[1]);L=Math.min(d,(u-B)/(F-1)),O=Math.min(d,(l-B)/(F+1))}if(null!=x){var I=Wi(null==k?[w,_]:[k,S],[y,b],l,O,p),X=Wi([x,M],[w,_],l,O,p);d===O?T.push("M",I[0],"A",O,",",O," 0 0,",m," ",I[1],"A",l,",",l," 0 ",1-p^Gi(I[1][0],I[1][1],X[1][0],X[1][1]),",",p," ",X[1],"A",O,",",O," 0 0,",m," ",X[0]):T.push("M",I[0],"A",O,",",O," 0 1,",m," ",X[0])}else T.push("M",y,",",b);if(null!=k){var Y=Wi([y,b],[k,S],u,-L,p),V=Wi([w,_],null==x?[y,b]:[x,M],u,-L,p);d===L?T.push("L",V[0],"A",L,",",L," 0 0,",m," ",V[1],"A",u,",",u," 0 ",p^Gi(V[1][0],V[1][1],Y[1][0],Y[1][1]),",",1-p," ",Y[1],"A",L,",",L," 0 0,",m," ",Y[0]):T.push("L",V[0],"A",L,",",L," 0 0,",m," ",Y[0])}else T.push("L",w,",",_)}else T.push("M",y,",",b),null!=x&&T.push("A",l,",",l," 0 ",R,",",p," ",x,",",M),T.push("L",w,",",_),null!=k&&T.push("A",u,",",u," 0 ",P,",",1-p," ",k,",",S);return T.push("Z"),T.join("")}function s(t,n){return"M0,"+t+"A"+t+","+t+" 0 1,"+n+" 0,"+-t+"A"+t+","+t+" 0 1,"+n+" 0,"+t}return u.innerRadius=function(n){return arguments.length?(t=bn(n),u):t},u.outerRadius=function(t){return arguments.length?(n=bn(t),u):n},u.cornerRadius=function(t){return arguments.length?(e=bn(t),u):e},u.padRadius=function(t){return arguments.length?(r=t==Bi?Bi:bn(t),u):r},u.startAngle=function(t){return arguments.length?(o=bn(t),u):o},u.endAngle=function(t){return arguments.length?(a=bn(t),u):a},u.padAngle=function(t){return arguments.length?(i=bn(t),u):i},u.centroid=function(){var e=(+t.apply(this,arguments)+ +n.apply(this,arguments))/2,r=(+o.apply(this,arguments)+ +a.apply(this,arguments))/2-Ot;return[Math.cos(r)*e,Math.sin(r)*e]},u};var Bi="auto";function Ii(t){return t.innerRadius}function Xi(t){return t.outerRadius}function Yi(t){return t.startAngle}function Vi(t){return t.endAngle}function Hi(t){return t&&t.padAngle}function Gi(t,n,e,r){return(t-e)*n-(n-r)*t>0?0:1}function Wi(t,n,e,r,o){var a=t[0]-n[0],i=t[1]-n[1],u=(o?r:-r)/Math.sqrt(a*a+i*i),s=u*i,l=-u*a,c=t[0]+s,f=t[1]+l,h=n[0]+s,p=n[1]+l,d=(c+h)/2,m=(f+p)/2,g=h-c,v=p-f,y=g*g+v*v,b=e-r,x=c*p-h*f,M=(v<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*v-g*M)/y,_=(-x*g-v*M)/y,k=(x*v+g*M)/y,S=(-x*g+v*M)/y,A=w-d,E=_-m,T=k-d,R=S-m;return A*A+E*E>T*T+R*R&&(w=k,_=S),[[w-s,_-l],[w*e/b,_*e/b]]}function Zi(t){var n=io,e=uo,r=$e,o=$i,a=o.key,i=.7;function u(a){var u,s=[],l=[],c=-1,f=a.length,h=bn(n),p=bn(e);function d(){s.push("M",o(t(l),i))}for(;++c<f;)r.call(this,u=a[c],c)?l.push([+h.call(this,u,c),+p.call(this,u,c)]):l.length&&(d(),l=[]);return l.length&&d(),s.length?s.join(""):null}return u.x=function(t){return arguments.length?(n=t,u):n},u.y=function(t){return arguments.length?(e=t,u):e},u.defined=function(t){return arguments.length?(r=t,u):r},u.interpolate=function(t){return arguments.length?(a="function"==typeof t?o=t:(o=Ji.get(t)||$i).key,u):a},u.tension=function(t){return arguments.length?(i=t,u):i},u}a.svg.line=function(){return Zi(L)};var Ji=a.map({linear:$i,"linear-closed":Ki,step:function(t){for(var n=0,e=t.length,r=t[0],o=[r[0],",",r[1]];++n<e;)o.push("H",(r[0]+(r=t[n])[0])/2,"V",r[1]);return e>1&&o.push("H",r[0]),o.join("")},"step-before":Qi,"step-after":tu,basis:ru,"basis-open":function(t){if(t.length<4)return $i(t);for(var n,e=[],r=-1,o=t.length,a=[0],i=[0];++r<3;)n=t[r],a.push(n[0]),i.push(n[1]);for(e.push(ou(uu,a)+","+ou(uu,i)),--r;++r<o;)n=t[r],a.shift(),a.push(n[0]),i.shift(),i.push(n[1]),su(e,a,i);return e.join("")},"basis-closed":function(t){for(var n,e,r=-1,o=t.length,a=o+4,i=[],u=[];++r<4;)e=t[r%o],i.push(e[0]),u.push(e[1]);for(n=[ou(uu,i),",",ou(uu,u)],--r;++r<a;)e=t[r%o],i.shift(),i.push(e[0]),u.shift(),u.push(e[1]),su(n,i,u);return n.join("")},bundle:function(t,n){var e=t.length-1;if(e)for(var r,o,a=t[0][0],i=t[0][1],u=t[e][0]-a,s=t[e][1]-i,l=-1;++l<=e;)r=t[l],o=l/e,r[0]=n*r[0]+(1-n)*(a+o*u),r[1]=n*r[1]+(1-n)*(i+o*s);return ru(t)},cardinal:function(t,n){return t.length<3?$i(t):t[0]+nu(t,eu(t,n))},"cardinal-open":function(t,n){return t.length<4?$i(t):t[1]+nu(t.slice(1,-1),eu(t,n))},"cardinal-closed":function(t,n){return t.length<3?Ki(t):t[0]+nu((t.push(t[0]),t),eu([t[t.length-2]].concat(t,[t[1]]),n))},monotone:function(t){return t.length<3?$i(t):t[0]+nu(t,function(t){for(var n,e,r,o,a=[],i=function(t){for(var n=0,e=t.length-1,r=[],o=t[0],a=t[1],i=r[0]=lu(o,a);++n<e;)r[n]=(i+(i=lu(o=a,a=t[n+1])))/2;return r[n]=i,r}(t),u=-1,s=t.length-1;++u<s;)n=lu(t[u],t[u+1]),w(n)<Tt?i[u]=i[u+1]=0:(e=i[u]/n,r=i[u+1]/n,(o=e*e+r*r)>9&&(o=3*n/Math.sqrt(o),i[u]=o*e,i[u+1]=o*r));for(u=-1;++u<=s;)o=(t[Math.min(s,u+1)][0]-t[Math.max(0,u-1)][0])/(6*(1+i[u]*i[u])),a.push([o||0,i[u]*o||0]);return a}(t))}});function $i(t){return t.length>1?t.join("L"):t+"Z"}function Ki(t){return t.join("L")+"Z"}function Qi(t){for(var n=0,e=t.length,r=t[0],o=[r[0],",",r[1]];++n<e;)o.push("V",(r=t[n])[1],"H",r[0]);return o.join("")}function tu(t){for(var n=0,e=t.length,r=t[0],o=[r[0],",",r[1]];++n<e;)o.push("H",(r=t[n])[0],"V",r[1]);return o.join("")}function nu(t,n){if(n.length<1||t.length!=n.length&&t.length!=n.length+2)return $i(t);var e=t.length!=n.length,r="",o=t[0],a=t[1],i=n[0],u=i,s=1;if(e&&(r+="Q"+(a[0]-2*i[0]/3)+","+(a[1]-2*i[1]/3)+","+a[0]+","+a[1],o=t[1],s=2),n.length>1){u=n[1],a=t[s],s++,r+="C"+(o[0]+i[0])+","+(o[1]+i[1])+","+(a[0]-u[0])+","+(a[1]-u[1])+","+a[0]+","+a[1];for(var l=2;l<n.length;l++,s++)a=t[s],u=n[l],r+="S"+(a[0]-u[0])+","+(a[1]-u[1])+","+a[0]+","+a[1]}if(e){var c=t[s];r+="Q"+(a[0]+2*u[0]/3)+","+(a[1]+2*u[1]/3)+","+c[0]+","+c[1]}return r}function eu(t,n){for(var e,r=[],o=(1-n)/2,a=t[0],i=t[1],u=1,s=t.length;++u<s;)e=a,a=i,i=t[u],r.push([o*(i[0]-e[0]),o*(i[1]-e[1])]);return r}function ru(t){if(t.length<3)return $i(t);var n=1,e=t.length,r=t[0],o=r[0],a=r[1],i=[o,o,o,(r=t[1])[0]],u=[a,a,a,r[1]],s=[o,",",a,"L",ou(uu,i),",",ou(uu,u)];for(t.push(t[e-1]);++n<=e;)r=t[n],i.shift(),i.push(r[0]),u.shift(),u.push(r[1]),su(s,i,u);return t.pop(),s.push("L",r),s.join("")}function ou(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]*n[3]}Ji.forEach((function(t,n){n.key=t,n.closed=/-closed$/.test(t)}));var au=[0,2/3,1/3,0],iu=[0,1/3,2/3,0],uu=[0,1/6,2/3,1/6];function su(t,n,e){t.push("C",ou(au,n),",",ou(au,e),",",ou(iu,n),",",ou(iu,e),",",ou(uu,n),",",ou(uu,e))}function lu(t,n){return(n[1]-t[1])/(n[0]-t[0])}function cu(t){for(var n,e,r,o=-1,a=t.length;++o<a;)e=(n=t[o])[0],r=n[1]-Ot,n[0]=e*Math.cos(r),n[1]=e*Math.sin(r);return t}function fu(t){var n=io,e=io,r=0,o=uo,a=$e,i=$i,u=i.key,s=i,l="L",c=.7;function f(u){var f,h,p,d=[],m=[],g=[],v=-1,y=u.length,b=bn(n),x=bn(r),M=n===e?function(){return h}:bn(e),w=r===o?function(){return p}:bn(o);function _(){d.push("M",i(t(g),c),l,s(t(m.reverse()),c),"Z")}for(;++v<y;)a.call(this,f=u[v],v)?(m.push([h=+b.call(this,f,v),p=+x.call(this,f,v)]),g.push([+M.call(this,f,v),+w.call(this,f,v)])):m.length&&(_(),m=[],g=[]);return m.length&&_(),d.length?d.join(""):null}return f.x=function(t){return arguments.length?(n=e=t,f):e},f.x0=function(t){return arguments.length?(n=t,f):n},f.x1=function(t){return arguments.length?(e=t,f):e},f.y=function(t){return arguments.length?(r=o=t,f):o},f.y0=function(t){return arguments.length?(r=t,f):r},f.y1=function(t){return arguments.length?(o=t,f):o},f.defined=function(t){return arguments.length?(a=t,f):a},f.interpolate=function(t){return arguments.length?(u="function"==typeof t?i=t:(i=Ji.get(t)||$i).key,s=i.reverse||i,l=i.closed?"M":"L",f):u},f.tension=function(t){return arguments.length?(c=t,f):c},f}function hu(t){return t.radius}function pu(t){return[t.x,t.y]}function du(t){return function(){var n=t.apply(this,arguments),e=n[0],r=n[1]-Ot;return[e*Math.cos(r),e*Math.sin(r)]}}function mu(){return 64}function gu(){return"circle"}function vu(t){var n=Math.sqrt(t/Nt);return"M0,"+n+"A"+n+","+n+" 0 1,1 0,"+-n+"A"+n+","+n+" 0 1,1 0,"+n+"Z"}a.svg.line.radial=function(){var t=Zi(cu);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},Qi.reverse=tu,tu.reverse=Qi,a.svg.area=function(){return fu(L)},a.svg.area.radial=function(){var t=fu(cu);return t.radius=t.x,delete t.x,t.innerRadius=t.x0,delete t.x0,t.outerRadius=t.x1,delete t.x1,t.angle=t.y,delete t.y,t.startAngle=t.y0,delete t.y0,t.endAngle=t.y1,delete t.y1,t},a.svg.chord=function(){var t=Hr,n=Gr,e=hu,r=Yi,o=Vi;function a(e,r){var o=i(this,t,e,r),a=i(this,n,e,r);return"M"+o.p0+u(o.r,o.p1,o.a1-o.a0)+(function(t,n){return t.a0==n.a0&&t.a1==n.a1}(o,a)?s(o.r,o.p1,o.r,o.p0):s(o.r,o.p1,a.r,a.p0)+u(a.r,a.p1,a.a1-a.a0)+s(a.r,a.p1,o.r,o.p0))+"Z"}function i(t,n,a,i){var u=n.call(t,a,i),s=e.call(t,u,i),l=r.call(t,u,i)-Ot,c=o.call(t,u,i)-Ot;return{r:s,a0:l,a1:c,p0:[s*Math.cos(l),s*Math.sin(l)],p1:[s*Math.cos(c),s*Math.sin(c)]}}function u(t,n,e){return"A"+t+","+t+" 0 "+ +(e>Nt)+",1 "+n}function s(t,n,e,r){return"Q 0,0 "+r}return a.radius=function(t){return arguments.length?(e=bn(t),a):e},a.source=function(n){return arguments.length?(t=bn(n),a):t},a.target=function(t){return arguments.length?(n=bn(t),a):n},a.startAngle=function(t){return arguments.length?(r=bn(t),a):r},a.endAngle=function(t){return arguments.length?(o=bn(t),a):o},a},a.svg.diagonal=function(){var t=Hr,n=Gr,e=pu;function r(r,o){var a=t.call(this,r,o),i=n.call(this,r,o),u=(a.y+i.y)/2,s=[a,{x:a.x,y:u},{x:i.x,y:u},i];return"M"+(s=s.map(e))[0]+"C"+s[1]+" "+s[2]+" "+s[3]}return r.source=function(n){return arguments.length?(t=bn(n),r):t},r.target=function(t){return arguments.length?(n=bn(t),r):n},r.projection=function(t){return arguments.length?(e=t,r):e},r},a.svg.diagonal.radial=function(){var t=a.svg.diagonal(),n=pu,e=t.projection;return t.projection=function(t){return arguments.length?e(du(n=t)):n},t},a.svg.symbol=function(){var t=gu,n=mu;function e(e,r){return(yu.get(t.call(this,e,r))||vu)(n.call(this,e,r))}return e.type=function(n){return arguments.length?(t=bn(n),e):t},e.size=function(t){return arguments.length?(n=bn(t),e):n},e};var yu=a.map({circle:vu,cross:function(t){var n=Math.sqrt(t/5)/2;return"M"+-3*n+","+-n+"H"+-n+"V"+-3*n+"H"+n+"V"+-n+"H"+3*n+"V"+n+"H"+n+"V"+3*n+"H"+-n+"V"+n+"H"+-3*n+"Z"},diamond:function(t){var n=Math.sqrt(t/(2*xu)),e=n*xu;return"M0,"+-n+"L"+e+",0 0,"+n+" "+-e+",0Z"},square:function(t){var n=Math.sqrt(t)/2;return"M"+-n+","+-n+"L"+n+","+-n+" "+n+","+n+" "+-n+","+n+"Z"},"triangle-down":function(t){var n=Math.sqrt(t/bu),e=n*bu/2;return"M0,"+e+"L"+n+","+-e+" "+-n+","+-e+"Z"},"triangle-up":function(t){var n=Math.sqrt(t/bu),e=n*bu/2;return"M0,"+-e+"L"+n+","+e+" "+-n+","+e+"Z"}});a.svg.symbolTypes=yu.keys();var bu=Math.sqrt(3),xu=Math.tan(30*Lt);J.transition=function(t){for(var n,e,r=ku||++Eu,o=Nu(t),a=[],i=Su||{time:Date.now(),ease:da,delay:0,duration:250},u=-1,s=this.length;++u<s;){a.push(n=[]);for(var l=this[u],c=-1,f=l.length;++c<f;)(e=l[c])&&Pu(e,c,o,r,i),n.push(e)}return _u(a,o,r)},J.interrupt=function(t){return this.each(null==t?Mu:wu(Nu(t)))};var Mu=wu(Nu());function wu(t){return function(){var n,e,r;(n=this[t])&&(r=n[e=n.active])&&(r.timer.c=null,r.timer.t=NaN,--n.count?delete n[e]:delete this[t],n.active+=.5,r.event&&r.event.interrupt.call(this,this.__data__,r.index))}}function _u(t,n,e){return V(t,Au),t.namespace=n,t.id=e,t}var ku,Su,Au=[],Eu=0;function Tu(t,n,e,r){var o=t.id,a=t.namespace;return dt(t,"function"==typeof e?function(t,i,u){t[a][o].tween.set(n,r(e.call(t,t.__data__,i,u)))}:(e=r(e),function(t){t[a][o].tween.set(n,e)}))}function Ru(t){return null==t&&(t=""),function(){this.textContent=t}}function Nu(t){return null==t?"__transition__":"__transition_"+t+"__"}function Pu(t,n,e,r,o){var a,i,u,s,l,c=t[e]||(t[e]={active:0,count:0}),f=c[r];function h(e){var o=c.active,h=c[o];for(var d in h&&(h.timer.c=null,h.timer.t=NaN,--c.count,delete c[o],h.event&&h.event.interrupt.call(t,t.__data__,h.index)),c)if(+d<r){var m=c[d];m.timer.c=null,m.timer.t=NaN,--c.count,delete c[d]}i.c=p,En((function(){return i.c&&p(e||1)&&(i.c=null,i.t=NaN),1}),0,a),c.active=r,f.event&&f.event.start.call(t,t.__data__,n),l=[],f.tween.forEach((function(e,r){(r=r.call(t,t.__data__,n))&&l.push(r)})),s=f.ease,u=f.duration}function p(o){for(var a=o/u,i=s(a),h=l.length;h>0;)l[--h].call(t,i);if(a>=1)return f.event&&f.event.end.call(t,t.__data__,n),--c.count?delete c[r]:delete t[e],1}f||(a=o.time,i=En((function(t){var n=f.delay;if(i.t=n+a,n<=t)return h(t-n);i.c=h}),0,a),f=c[r]={tween:new S,time:a,timer:i,delay:o.delay,duration:o.duration,ease:o.ease,index:n},o=null,++c.count)}Au.call=J.call,Au.empty=J.empty,Au.node=J.node,Au.size=J.size,a.transition=function(t,n){return t&&t.transition?ku?t.transition(n):t:a.selection().transition(t)},a.transition.prototype=Au,Au.select=function(t){var n,e,r,o=this.id,a=this.namespace,i=[];t=$(t);for(var u=-1,s=this.length;++u<s;){i.push(n=[]);for(var l=this[u],c=-1,f=l.length;++c<f;)(r=l[c])&&(e=t.call(r,r.__data__,c,u))?("__data__"in r&&(e.__data__=r.__data__),Pu(e,c,a,o,r[a][o]),n.push(e)):n.push(null)}return _u(i,a,o)},Au.selectAll=function(t){var n,e,r,o,a,i=this.id,u=this.namespace,s=[];t=K(t);for(var l=-1,c=this.length;++l<c;)for(var f=this[l],h=-1,p=f.length;++h<p;)if(r=f[h]){a=r[u][i],e=t.call(r,r.__data__,h,l),s.push(n=[]);for(var d=-1,m=e.length;++d<m;)(o=e[d])&&Pu(o,d,u,i,a),n.push(o)}return _u(s,u,i)},Au.filter=function(t){var n,e,r=[];"function"!=typeof t&&(t=ht(t));for(var o=0,a=this.length;o<a;o++){r.push(n=[]);for(var i,u=0,s=(i=this[o]).length;u<s;u++)(e=i[u])&&t.call(e,e.__data__,u,o)&&n.push(e)}return _u(r,this.namespace,this.id)},Au.tween=function(t,n){var e=this.id,r=this.namespace;return arguments.length<2?this.node()[r][e].tween.get(t):dt(this,null==n?function(n){n[r][e].tween.remove(t)}:function(o){o[r][e].tween.set(t,n)})},Au.attr=function(t,n){if(arguments.length<2){for(n in t)this.attr(n,t[n]);return this}var e="transform"==t?Sa:oa,r=a.ns.qualify(t);function o(){this.removeAttribute(r)}function i(){this.removeAttributeNS(r.space,r.local)}function u(t){return null==t?o:(t+="",function(){var n,o=this.getAttribute(r);return o!==t&&(n=e(o,t),function(t){this.setAttribute(r,n(t))})})}function s(t){return null==t?i:(t+="",function(){var n,o=this.getAttributeNS(r.space,r.local);return o!==t&&(n=e(o,t),function(t){this.setAttributeNS(r.space,r.local,n(t))})})}return Tu(this,"attr."+t,n,r.local?s:u)},Au.attrTween=function(t,n){var e=a.ns.qualify(t);return this.tween("attr."+t,e.local?function(t,r){var o=n.call(this,t,r,this.getAttributeNS(e.space,e.local));return o&&function(t){this.setAttributeNS(e.space,e.local,o(t))}}:function(t,r){var o=n.call(this,t,r,this.getAttribute(e));return o&&function(t){this.setAttribute(e,o(t))}})},Au.style=function(t,n,e){var r=arguments.length;if(r<3){if("string"!=typeof t){for(e in r<2&&(n=""),t)this.style(e,t[e],n);return this}e=""}function o(){this.style.removeProperty(t)}function a(n){return null==n?o:(n+="",function(){var r,o=c(this).getComputedStyle(this,null).getPropertyValue(t);return o!==n&&(r=oa(o,n),function(n){this.style.setProperty(t,r(n),e)})})}return Tu(this,"style."+t,n,a)},Au.styleTween=function(t,n,e){function r(r,o){var a=n.call(this,r,o,c(this).getComputedStyle(this,null).getPropertyValue(t));return a&&function(n){this.style.setProperty(t,a(n),e)}}return arguments.length<3&&(e=""),this.tween("style."+t,r)},Au.text=function(t){return Tu(this,"text",t,Ru)},Au.remove=function(){var t=this.namespace;return this.each("end.transition",(function(){var n;this[t].count<2&&(n=this.parentNode)&&n.removeChild(this)}))},Au.ease=function(t){var n=this.id,e=this.namespace;return arguments.length<1?this.node()[e][n].ease:("function"!=typeof t&&(t=a.ease.apply(a,arguments)),dt(this,(function(r){r[e][n].ease=t})))},Au.delay=function(t){var n=this.id,e=this.namespace;return arguments.length<1?this.node()[e][n].delay:dt(this,"function"==typeof t?function(r,o,a){r[e][n].delay=+t.call(r,r.__data__,o,a)}:(t=+t,function(r){r[e][n].delay=t}))},Au.duration=function(t){var n=this.id,e=this.namespace;return arguments.length<1?this.node()[e][n].duration:dt(this,"function"==typeof t?function(r,o,a){r[e][n].duration=Math.max(1,t.call(r,r.__data__,o,a))}:(t=Math.max(1,t),function(r){r[e][n].duration=t}))},Au.each=function(t,n){var e=this.id,r=this.namespace;if(arguments.length<2){var o=Su,i=ku;try{ku=e,dt(this,(function(n,o,a){Su=n[r][e],t.call(n,n.__data__,o,a)}))}finally{Su=o,ku=i}}else dt(this,(function(o){var i=o[r][e];(i.event||(i.event=a.dispatch("start","end","interrupt"))).on(t,n)}));return this},Au.transition=function(){for(var t,n,e,r=this.id,o=++Eu,a=this.namespace,i=[],u=0,s=this.length;u<s;u++){i.push(t=[]);for(var l,c=0,f=(l=this[u]).length;c<f;c++)(n=l[c])&&Pu(n,c,a,o,{time:(e=n[a][r]).time,ease:e.ease,delay:e.delay+e.duration,duration:e.duration}),t.push(n)}return _u(i,a,o)},a.svg.axis=function(){var t,n=a.scale.linear(),e=Cu,r=6,o=6,i=3,s=[10],l=null;function c(u){u.each((function(){var u,c=a.select(this),f=this.__chart__||n,h=this.__chart__=n.copy(),p=null==l?h.ticks?h.ticks.apply(h,s):h.domain():l,d=null==t?h.tickFormat?h.tickFormat.apply(h,s):L:t,m=c.selectAll(".tick").data(p,h),g=m.enter().insert("g",".domain").attr("class","tick").style("opacity",Tt),v=a.transition(m.exit()).style("opacity",Tt).remove(),y=a.transition(m.order()).style("opacity",1),b=Math.max(r,0)+i,x=xi(h),M=c.selectAll(".domain").data([0]),w=(M.enter().append("path").attr("class","domain"),a.transition(M));g.append("line"),g.append("text");var _,k,S,A,E=g.select("line"),T=y.select("line"),R=m.select("text").text(d),N=g.select("text"),P=y.select("text"),C="top"===e||"left"===e?-1:1;if("bottom"===e||"top"===e?(u=Lu,_="x",S="y",k="x2",A="y2",R.attr("dy",C<0?"0em":".71em").style("text-anchor","middle"),w.attr("d","M"+x[0]+","+C*o+"V0H"+x[1]+"V"+C*o)):(u=Uu,_="y",S="x",k="y2",A="x2",R.attr("dy",".32em").style("text-anchor",C<0?"end":"start"),w.attr("d","M"+C*o+","+x[0]+"H0V"+x[1]+"H"+C*o)),E.attr(A,C*r),N.attr(S,C*b),T.attr(k,0).attr(A,C*r),P.attr(_,0).attr(S,C*b),h.rangeBand){var O=h,U=O.rangeBand()/2;f=h=function(t){return O(t)+U}}else f.rangeBand?f=h:v.call(u,h,f);g.call(u,f,h),y.call(u,h,h)}))}return c.scale=function(t){return arguments.length?(n=t,c):n},c.orient=function(t){return arguments.length?(e=t in Ou?t+"":Cu,c):e},c.ticks=function(){return arguments.length?(s=u(arguments),c):s},c.tickValues=function(t){return arguments.length?(l=t,c):l},c.tickFormat=function(n){return arguments.length?(t=n,c):t},c.tickSize=function(t){var n=arguments.length;return n?(r=+t,o=+arguments[n-1],c):r},c.innerTickSize=function(t){return arguments.length?(r=+t,c):r},c.outerTickSize=function(t){return arguments.length?(o=+t,c):o},c.tickPadding=function(t){return arguments.length?(i=+t,c):i},c.tickSubdivide=function(){return arguments.length&&c},c};var Cu="bottom",Ou={top:1,right:1,bottom:1,left:1};function Lu(t,n,e){t.attr("transform",(function(t){var r=n(t);return"translate("+(isFinite(r)?r:e(t))+",0)"}))}function Uu(t,n,e){t.attr("transform",(function(t){var r=n(t);return"translate(0,"+(isFinite(r)?r:e(t))+")"}))}a.svg.brush=function(){var t,n,e=X(h,"brushstart","brush","brushend"),r=null,o=null,i=[0,0],u=[0,0],s=!0,l=!0,f=zu[0];function h(t){t.each((function(){var t=a.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",g).on("touchstart.brush",g),n=t.selectAll(".background").data([0]);n.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),t.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var e=t.selectAll(".resize").data(f,L);e.exit().remove(),e.enter().append("g").attr("class",(function(t){return"resize "+t})).style("cursor",(function(t){return Du[t]})).append("rect").attr("x",(function(t){return/[ew]$/.test(t)?-3:null})).attr("y",(function(t){return/^[ns]/.test(t)?-3:null})).attr("width",6).attr("height",6).style("visibility","hidden"),e.style("display",h.empty()?"none":null);var i,u=a.transition(t),s=a.transition(n);r&&(i=xi(r),s.attr("x",i[0]).attr("width",i[1]-i[0]),d(u)),o&&(i=xi(o),s.attr("y",i[0]).attr("height",i[1]-i[0]),m(u)),p(u)}))}function p(t){t.selectAll(".resize").attr("transform",(function(t){return"translate("+i[+/e$/.test(t)]+","+u[+/^s/.test(t)]+")"}))}function d(t){t.select(".extent").attr("x",i[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",i[1]-i[0])}function m(t){t.select(".extent").attr("y",u[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",u[1]-u[0])}function g(){var f,g,v=this,y=a.select(a.event.target),b=e.of(v,arguments),x=a.select(v),M=y.datum(),w=!/^(n|s)$/.test(M)&&r,_=!/^(e|w)$/.test(M)&&o,k=y.classed("extent"),S=kt(v),A=a.mouse(v),E=a.select(c(v)).on("keydown.brush",N).on("keyup.brush",P);if(a.event.changedTouches?E.on("touchmove.brush",C).on("touchend.brush",L):E.on("mousemove.brush",C).on("mouseup.brush",L),x.interrupt().selectAll("*").interrupt(),k)A[0]=i[0]-A[0],A[1]=u[0]-A[1];else if(M){var T=+/w$/.test(M),R=+/^n/.test(M);g=[i[1-T]-A[0],u[1-R]-A[1]],A[0]=i[T],A[1]=u[R]}else a.event.altKey&&(f=A.slice());function N(){32==a.event.keyCode&&(k||(f=null,A[0]-=i[1],A[1]-=u[1],k=2),B())}function P(){32==a.event.keyCode&&2==k&&(A[0]+=i[1],A[1]+=u[1],k=0,B())}function C(){var t=a.mouse(v),n=!1;g&&(t[0]+=g[0],t[1]+=g[1]),k||(a.event.altKey?(f||(f=[(i[0]+i[1])/2,(u[0]+u[1])/2]),A[0]=i[+(t[0]<f[0])],A[1]=u[+(t[1]<f[1])]):f=null),w&&O(t,r,0)&&(d(x),n=!0),_&&O(t,o,1)&&(m(x),n=!0),n&&(p(x),b({type:"brush",mode:k?"move":"resize"}))}function O(e,r,o){var a,c,h=xi(r),p=h[0],d=h[1],m=A[o],g=o?u:i,v=g[1]-g[0];if(k&&(p-=m,d-=v+m),a=(o?l:s)?Math.max(p,Math.min(d,e[o])):e[o],k?c=(a+=m)+v:(f&&(m=Math.max(p,Math.min(d,2*f[o]-a))),m<a?(c=a,a=m):c=m),g[0]!=a||g[1]!=c)return o?n=null:t=null,g[0]=a,g[1]=c,!0}function L(){C(),x.style("pointer-events","all").selectAll(".resize").style("display",h.empty()?"none":null),a.select("body").style("cursor",null),E.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),S(),b({type:"brushend"})}x.style("pointer-events","none").selectAll(".resize").style("display",null),a.select("body").style("cursor",y.style("cursor")),b({type:"brushstart"}),C()}return h.event=function(r){r.each((function(){var r=e.of(this,arguments),o={x:i,y:u,i:t,j:n},s=this.__chart__||o;this.__chart__=o,ku?a.select(this).transition().each("start.brush",(function(){t=s.i,n=s.j,i=s.x,u=s.y,r({type:"brushstart"})})).tween("brush:brush",(function(){var e=aa(i,o.x),a=aa(u,o.y);return t=n=null,function(t){i=o.x=e(t),u=o.y=a(t),r({type:"brush",mode:"resize"})}})).each("end.brush",(function(){t=o.i,n=o.j,r({type:"brush",mode:"resize"}),r({type:"brushend"})})):(r({type:"brushstart"}),r({type:"brush",mode:"resize"}),r({type:"brushend"}))}))},h.x=function(t){return arguments.length?(f=zu[!(r=t)<<1|!o],h):r},h.y=function(t){return arguments.length?(f=zu[!r<<1|!(o=t)],h):o},h.clamp=function(t){return arguments.length?(r&&o?(s=!!t[0],l=!!t[1]):r?s=!!t:o&&(l=!!t),h):r&&o?[s,l]:r?s:o?l:null},h.extent=function(e){var a,s,l,c,f;return arguments.length?(r&&(a=e[0],s=e[1],o&&(a=a[0],s=s[0]),t=[a,s],r.invert&&(a=r(a),s=r(s)),s<a&&(f=a,a=s,s=f),a==i[0]&&s==i[1]||(i=[a,s])),o&&(l=e[0],c=e[1],r&&(l=l[1],c=c[1]),n=[l,c],o.invert&&(l=o(l),c=o(c)),c<l&&(f=l,l=c,c=f),l==u[0]&&c==u[1]||(u=[l,c])),h):(r&&(t?(a=t[0],s=t[1]):(a=i[0],s=i[1],r.invert&&(a=r.invert(a),s=r.invert(s)),s<a&&(f=a,a=s,s=f))),o&&(n?(l=n[0],c=n[1]):(l=u[0],c=u[1],o.invert&&(l=o.invert(l),c=o.invert(c)),c<l&&(f=l,l=c,c=f))),r&&o?[[a,l],[s,c]]:r?[a,s]:o&&[l,c])},h.clear=function(){return h.empty()||(i=[0,0],u=[0,0],t=n=null),h},h.empty=function(){return!!r&&i[0]==i[1]||!!o&&u[0]==u[1]},a.rebind(h,e,"on")};var Du={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},zu=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],qu=zn.format=he.timeFormat,ju=qu.utc,Fu=ju("%Y-%m-%dT%H:%M:%S.%LZ");function Bu(t){return t.toISOString()}function Iu(t,n,e){function r(n){return t(n)}function o(t,e){var r=(t[1]-t[0])/e,o=a.bisect(Yu,r);return o==Yu.length?[n.year,Ti(t.map((function(t){return t/31536e6})),e)[2]]:o?n[r/Yu[o-1]<Yu[o]/r?o-1:o]:[Gu,Ti(t,e)[2]]}return r.invert=function(n){return Xu(t.invert(n))},r.domain=function(n){return arguments.length?(t.domain(n),r):t.domain().map(Xu)},r.nice=function(t,n){var e=r.domain(),a=bi(e),i=null==t?o(a,10):"number"==typeof t&&o(a,t);function u(e){return!isNaN(e)&&!t.range(e,Xu(+e+1),n).length}return i&&(t=i[0],n=i[1]),r.domain(wi(e,n>1?{floor:function(n){for(;u(n=t.floor(n));)n=Xu(n-1);return n},ceil:function(n){for(;u(n=t.ceil(n));)n=Xu(+n+1);return n}}:t))},r.ticks=function(t,n){var e=bi(r.domain()),a=null==t?o(e,10):"number"==typeof t?o(e,t):!t.range&&[{range:t},n];return a&&(t=a[0],n=a[1]),t.range(e[0],Xu(+e[1]+1),n<1?1:n)},r.tickFormat=function(){return e},r.copy=function(){return Iu(t.copy(),n,e)},Ai(r,t)}function Xu(t){return new Date(t)}qu.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Bu:Fu,Bu.parse=function(t){var n=new Date(t);return isNaN(n)?null:n},Bu.toString=Fu.toString,zn.second=Bn((function(t){return new qn(1e3*Math.floor(t/1e3))}),(function(t,n){t.setTime(t.getTime()+1e3*Math.floor(n))}),(function(t){return t.getSeconds()})),zn.seconds=zn.second.range,zn.seconds.utc=zn.second.utc.range,zn.minute=Bn((function(t){return new qn(6e4*Math.floor(t/6e4))}),(function(t,n){t.setTime(t.getTime()+6e4*Math.floor(n))}),(function(t){return t.getMinutes()})),zn.minutes=zn.minute.range,zn.minutes.utc=zn.minute.utc.range,zn.hour=Bn((function(t){var n=t.getTimezoneOffset()/60;return new qn(36e5*(Math.floor(t/36e5-n)+n))}),(function(t,n){t.setTime(t.getTime()+36e5*Math.floor(n))}),(function(t){return t.getHours()})),zn.hours=zn.hour.range,zn.hours.utc=zn.hour.utc.range,zn.month=Bn((function(t){return(t=zn.day(t)).setDate(1),t}),(function(t,n){t.setMonth(t.getMonth()+n)}),(function(t){return t.getMonth()})),zn.months=zn.month.range,zn.months.utc=zn.month.utc.range;var Yu=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Vu=[[zn.second,1],[zn.second,5],[zn.second,15],[zn.second,30],[zn.minute,1],[zn.minute,5],[zn.minute,15],[zn.minute,30],[zn.hour,1],[zn.hour,3],[zn.hour,6],[zn.hour,12],[zn.day,1],[zn.day,2],[zn.week,1],[zn.month,1],[zn.month,3],[zn.year,1]],Hu=qu.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",$e]]),Gu={range:function(t,n,e){return a.range(Math.ceil(t/e)*e,+n,e).map(Xu)},floor:L,ceil:L};Vu.year=zn.year,zn.scale=function(){return Iu(a.scale.linear(),Vu,Hu)};var Wu=Vu.map((function(t){return[t[0].utc,t[1]]})),Zu=ju.multi([[".%L",function(t){return t.getUTCMilliseconds()}],[":%S",function(t){return t.getUTCSeconds()}],["%I:%M",function(t){return t.getUTCMinutes()}],["%I %p",function(t){return t.getUTCHours()}],["%a %d",function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],["%b %d",function(t){return 1!=t.getUTCDate()}],["%B",function(t){return t.getUTCMonth()}],["%Y",$e]]);function Ju(t){return JSON.parse(t.responseText)}function $u(t){var n=s.createRange();return n.selectNode(s.body),n.createContextualFragment(t.responseText)}Wu.year=zn.year.utc,zn.scale.utc=function(){return Iu(a.scale.linear(),Wu,Zu)},a.text=xn((function(t){return t.responseText})),a.json=function(t,n){return Mn(t,"application/json",Ju,n)},a.html=function(t,n){return Mn(t,"text/html",$u,n)},a.xml=xn((function(t){return t.responseXML})),this.d3=a,void 0===(o="function"==typeof(r=a)?r.call(n,e,n,t):r)||(t.exports=o)}()}])},t.exports=o()},function(t,n,e){"use strict";var r=e(26);function o(){}t.exports=function(){function t(t,n,e,o,a,i){if(i!==r){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function n(){return t}t.isRequired=t;var e={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:n,element:t,instanceOf:n,node:t,objectOf:n,oneOf:n,oneOfType:n,shape:n,exact:n};return e.checkPropTypes=o,e.PropTypes=e,e}},function(t,n,e){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,n,e){"use strict";var r=e(7),o=e(28),a=e(29),i=e(6),u=e(8),s=e(23),l=e(30);function c(t,n){return n=n.split("// __split__"),new o.Program(t,n[0],n[1])}t.exports=function(t,n,e){var f,h,p,d,m,g,v,y,b,x,M,w,_,k,S,A,E,T,R,N,P,C,O,L,U,D,z,q=this,j=null,F=null,B=null,I=null,X=null,Y=null,V=0,H=!1,G=!1;function W(t){p.viewport(0,0,e,e);var o=u.clone(t);o.zoom=1/f,o.translation.x=0,o.translation.y=0;for(var a=r.mat4.create(),i=0;i<3;i++){var s=r.vec3.random(r.vec3.create(),1);r.mat4.rotate(a,a,10*Math.random(),s)}o.rotation=r.mat4.multiply(r.mat4.create(),a,o.rotation),E.bind(),p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT);var l=u.getRect(o),c=r.mat4.create();r.mat4.ortho(c,l.left,l.right,l.bottom,l.top,0,f);var h=r.mat4.create();r.mat4.lookAt(h,[0,0,0],[0,0,-1],[0,1,0]);var d=r.mat4.create();r.mat4.translate(d,d,[0,0,-f/2]),r.mat4.multiply(d,d,o.rotation),P.setUniform("uProjection","Matrix4fv",!1,c),P.setUniform("uView","Matrix4fv",!1,h),P.setUniform("uModel","Matrix4fv",!1,d),P.setUniform("uBottomLeft","2fv",[l.left,l.bottom]),P.setUniform("uTopRight","2fv",[l.right,l.top]),P.setUniform("uAtomScale","1f",2.5*o.atomScale),P.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),P.setUniform("uRes","1f",e),P.setUniform("uDepth","1f",f),P.setUniform("uMode","1i",0),P.setUniform("uAtomShade","1f",t.atomShade),j.render(),t.bonds&&null!=F&&(C.setUniform("uProjection","Matrix4fv",!1,c),C.setUniform("uView","Matrix4fv",!1,h),C.setUniform("uModel","Matrix4fv",!1,d),C.setUniform("uRotation","Matrix4fv",!1,o.rotation),C.setUniform("uDepth","1f",f),C.setUniform("uBottomLeft","2fv",[l.left,l.bottom]),C.setUniform("uTopRight","2fv",[l.right,l.top]),C.setUniform("uRes","1f",e),C.setUniform("uBondRadius","1f",2.5*u.getBondRadius(t)),C.setUniform("uBondShade","1f",t.bondShade),C.setUniform("uAtomScale","1f",2.5*t.atomScale),C.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),C.setUniform("uMode","1i",0),F.render()),p.viewport(0,0,n,n);var y=u.getRect(t),x=u.getRect(o),M=r.mat4.invert(r.mat4.create(),a);T.bind(),p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT),O.setUniform("uSceneDepth","1i",g.index),O.setUniform("uSceneNormal","1i",m.index),O.setUniform("uRandRotDepth","1i",v.index),O.setUniform("uAccumulator","1i",b.index),O.setUniform("uSceneBottomLeft","2fv",[y.left,y.bottom]),O.setUniform("uSceneTopRight","2fv",[y.right,y.top]),O.setUniform("uRotBottomLeft","2fv",[x.left,x.bottom]),O.setUniform("uRotTopRight","2fv",[x.right,x.top]),O.setUniform("uRes","1f",n),O.setUniform("uDepth","1f",f),O.setUniform("uRot","Matrix4fv",!1,a),O.setUniform("uInvRot","Matrix4fv",!1,M),O.setUniform("uSampleCount","1i",V),B.render(),b.activate(),b.bind(),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGBA,0,0,n,n,0)}q.getAOProgress=function(){return V/1024},q.initialize=function(){t.width=t.height=n,(p=t.getContext("webgl")).enable(p.DEPTH_TEST),p.enable(p.CULL_FACE),p.clearColor(0,0,0,0),p.clearDepth(1),p.viewport(0,0,n,n),window.gl=p,o.getExtensions(p,["EXT_frag_depth","WEBGL_depth_texture"]),q.createTextures(),P=c(p,l.shaders.atom),C=c(p,l.shaders.bond),z=c(p,l.shaders["textured-quad"]),O=c(p,l.shaders.accumulator),L=c(p,l.shaders.ao),U=c(p,l.shaders.fxaa),D=c(p,l.shaders.dof);var e=[-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0],r=o.buildAttribs(p,{aPosition:3});r.aPosition.buffer.set(new Float32Array(e));var a=e.length/9;new o.Renderable(p,z,r,a),B=new o.Renderable(p,O,r,a),I=new o.Renderable(p,L,r,a),Y=new o.Renderable(p,U,r,a),X=new o.Renderable(p,D,r,a),0},q.createTextures=function(){y=new o.Texture(p,0,null,e,e),v=new o.Texture(p,1,null,e,e,{internalFormat:p.DEPTH_COMPONENT,format:p.DEPTH_COMPONENT,type:p.UNSIGNED_SHORT}),E=new o.Framebuffer(p,[y],v),d=new o.Texture(p,2,null,n,n),m=new o.Texture(p,3,null,n,n),g=new o.Texture(p,4,null,n,n,{internalFormat:p.DEPTH_COMPONENT,format:p.DEPTH_COMPONENT,type:p.UNSIGNED_SHORT}),S=new o.Framebuffer(p,[d],g),A=new o.Framebuffer(p,[m],g),b=new o.Texture(p,5,null,n,n),x=new o.Texture(p,6,null,n,n),T=new o.Framebuffer(p,[x]),k=new o.Texture(p,7,null,n,n),N=new o.Framebuffer(p,[k]),M=new o.Texture(p,8,null,n,n),w=new o.Texture(p,9,null,n,n),R=new o.Framebuffer(p,[w]),_=new o.Texture(p,10,null,n,n),new o.Framebuffer(p,[_])},q.setResolution=function(r,o){e=o,n=r,t.width=t.height=n,p.viewport(0,0,n,n),q.createTextures()},q.setSystem=function(t,n){function e(t){for(var n=[],e=0;e<36;e++)n.push.apply(n,t);return n}h=t;for(var r=o.buildAttribs(p,{aImposter:3,aPosition:3,aRadius:1,aColor:3}),u=[],s=[],l=[],c=[],f=0;f<h.atoms.length;f++){u.push.apply(u,a.position);var d=h.atoms[f];s.push.apply(s,e([d.x,d.y,d.z])),l.push.apply(l,e([i[d.symbol].radius]));var m=i[d.symbol].color;c.push.apply(c,e([m[0],m[1],m[2]]))}r.aImposter.buffer.set(new Float32Array(u)),r.aPosition.buffer.set(new Float32Array(s)),r.aRadius.buffer.set(new Float32Array(l)),r.aColor.buffer.set(new Float32Array(c));var g=u.length/9;if(j=new o.Renderable(p,P,r,g),n.bonds&&(F=null,h.bonds.length>0)){r=o.buildAttribs(p,{aImposter:3,aPosA:3,aPosB:3,aRadA:1,aRadB:1,aColA:3,aColB:3}),u=[];var v=[],y=[],b=[],x=[],M=[],w=[];for(f=0;f<h.bonds.length;f++){var _=h.bonds[f];if(_.cutoff>n.bondThreshold)break;u.push.apply(u,a.position),v.push.apply(v,e([_.posA.x,_.posA.y,_.posA.z])),y.push.apply(y,e([_.posB.x,_.posB.y,_.posB.z])),b.push.apply(b,e([_.radA])),x.push.apply(x,e([_.radB])),M.push.apply(M,e([_.colA.r,_.colA.g,_.colA.b])),w.push.apply(w,e([_.colB.r,_.colB.g,_.colB.b]))}r.aImposter.buffer.set(new Float32Array(u)),r.aPosA.buffer.set(new Float32Array(v)),r.aPosB.buffer.set(new Float32Array(y)),r.aRadA.buffer.set(new Float32Array(b)),r.aRadB.buffer.set(new Float32Array(x)),r.aColA.buffer.set(new Float32Array(M)),r.aColB.buffer.set(new Float32Array(w));g=u.length/9;F=new o.Renderable(p,C,r,g)}},q.reset=function(){V=0,H=!1,G=!1,b.reset(),x.reset()},q.render=function(t){if(void 0!==h&&null!=j){if(f=2*s.getRadius(h),H)if(G)for(var e=0;e<t.spf&&!(V>1024);e++)W(t),V++;else!function(t){G=!0,p.viewport(0,0,n,n),A.bind(),p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT);var e=u.getRect(t),o=r.mat4.create();r.mat4.ortho(o,e.left,e.right,e.bottom,e.top,0,f);var a=r.mat4.create();r.mat4.lookAt(a,[0,0,0],[0,0,-1],[0,1,0]);var i=r.mat4.create();r.mat4.translate(i,i,[0,0,-f/2]),r.mat4.multiply(i,i,t.rotation),P.setUniform("uProjection","Matrix4fv",!1,o),P.setUniform("uView","Matrix4fv",!1,a),P.setUniform("uModel","Matrix4fv",!1,i),P.setUniform("uBottomLeft","2fv",[e.left,e.bottom]),P.setUniform("uTopRight","2fv",[e.right,e.top]),P.setUniform("uAtomScale","1f",2.5*t.atomScale),P.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),P.setUniform("uRes","1f",n),P.setUniform("uDepth","1f",f),P.setUniform("uMode","1i",1),P.setUniform("uAtomShade","1f",t.atomShade),j.render(),t.bonds&&null!=F&&(A.bind(),C.setUniform("uProjection","Matrix4fv",!1,o),C.setUniform("uView","Matrix4fv",!1,a),C.setUniform("uModel","Matrix4fv",!1,i),C.setUniform("uRotation","Matrix4fv",!1,t.rotation),C.setUniform("uDepth","1f",f),C.setUniform("uBottomLeft","2fv",[e.left,e.bottom]),C.setUniform("uTopRight","2fv",[e.right,e.top]),C.setUniform("uRes","1f",n),C.setUniform("uBondRadius","1f",2.5*u.getBondRadius(t)),C.setUniform("uBondShade","1f",t.bondShade),C.setUniform("uAtomScale","1f",2.5*t.atomScale),C.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),C.setUniform("uMode","1i",1),F.render())}(t);else!function(t){H=!0,p.viewport(0,0,n,n),S.bind(),p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT);var e=u.getRect(t),o=r.mat4.create();r.mat4.ortho(o,e.left,e.right,e.bottom,e.top,0,f);var a=r.mat4.create();r.mat4.lookAt(a,[0,0,0],[0,0,-1],[0,1,0]);var i=r.mat4.create();r.mat4.translate(i,i,[0,0,-f/2]),r.mat4.multiply(i,i,t.rotation),P.setUniform("uProjection","Matrix4fv",!1,o),P.setUniform("uView","Matrix4fv",!1,a),P.setUniform("uModel","Matrix4fv",!1,i),P.setUniform("uBottomLeft","2fv",[e.left,e.bottom]),P.setUniform("uTopRight","2fv",[e.right,e.top]),P.setUniform("uAtomScale","1f",2.5*t.atomScale),P.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),P.setUniform("uRes","1f",n),P.setUniform("uDepth","1f",f),P.setUniform("uMode","1i",0),P.setUniform("uAtomShade","1f",t.atomShade),j.render(),t.bonds&&null!=F&&(S.bind(),C.setUniform("uProjection","Matrix4fv",!1,o),C.setUniform("uView","Matrix4fv",!1,a),C.setUniform("uModel","Matrix4fv",!1,i),C.setUniform("uRotation","Matrix4fv",!1,t.rotation),C.setUniform("uDepth","1f",f),C.setUniform("uBottomLeft","2fv",[e.left,e.bottom]),C.setUniform("uTopRight","2fv",[e.right,e.top]),C.setUniform("uRes","1f",n),C.setUniform("uBondRadius","1f",2.5*u.getBondRadius(t)),C.setUniform("uBondShade","1f",t.bondShade),C.setUniform("uAtomScale","1f",2.5*t.atomScale),C.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),C.setUniform("uMode","1i",0),F.render())}(t);!function(t){p.viewport(0,0,n,n),t.fxaa>0||t.dofStrength>0?N.bind():p.bindFramebuffer(p.FRAMEBUFFER,null);if(p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT),L.setUniform("uSceneColor","1i",d.index),L.setUniform("uSceneDepth","1i",g.index),L.setUniform("uAccumulatorOut","1i",x.index),L.setUniform("uRes","1f",n),L.setUniform("uAO","1f",2*t.ao),L.setUniform("uBrightness","1f",2*t.brightness),L.setUniform("uOutlineStrength","1f",t.outline),I.render(),t.fxaa>0){t.dofStrength>0?R.bind():p.bindFramebuffer(p.FRAMEBUFFER,null);for(var e=0;e<t.fxaa;e++)p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT),0==e?U.setUniform("uTexture","1i",k.index):U.setUniform("uTexture","1i",M.index),U.setUniform("uRes","1f",n),Y.render(),M.activate(),M.bind(),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGBA,0,0,n,n,0)}t.dofStrength>0&&(p.bindFramebuffer(p.FRAMEBUFFER,null),p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT),t.fxaa>0?D.setUniform("uColor","1i",M.index):D.setUniform("uColor","1i",k.index),D.setUniform("uDepth","1i",g.index),D.setUniform("uDOFPosition","1f",t.dofPosition),D.setUniform("uDOFStrength","1f",t.dofStrength),D.setUniform("uRes","1f",n),X.render())}(t)}},q.initialize()}},function(t,n){function e(t){var n=this;n.initialize=function(){n.buffer=t.createBuffer()},n.bind=function(){t.bindBuffer(t.ARRAY_BUFFER,n.buffer)},n.set=function(e){n.bind(),t.bufferData(t.ARRAY_BUFFER,e,t.STATIC_DRAW)},n.initialize()}t.exports.buildAttribs=function(t,n){var r={};for(var o in n)r[o]={buffer:new e(t),size:n[o]};return r},t.exports.getExtensions=function(t,n){for(var e={},r=0;r<n.length;r++){var o=t.getExtension(n[r]);if(null===o)throw"Extension "+n[r]+" not available.";e[n[r]]=o}return e},t.exports.Framebuffer=function(t,n,e,r){var o=this;o.initialize=function(){if(o.fb=t.createFramebuffer(),o.bind(),n.length>1){for(var a=[],i=0;i<n.length;i++)a.push(r["COLOR_ATTACHMENT"+i+"_WEBGL"]);r.drawBuffersWEBGL(a);for(i=0;i<n.length;i++)t.framebufferTexture2D(t.FRAMEBUFFER,r["COLOR_ATTACHMENT"+i+"_WEBGL"],t.TEXTURE_2D,n[i].texture,0)}else t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n[0].texture,0);void 0!==e&&t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,e.texture,0)},o.bind=function(){t.bindFramebuffer(t.FRAMEBUFFER,o.fb)},o.initialize()},t.exports.Texture=function(t,n,e,r,o,a){(a=a||{}).target=a.target||t.TEXTURE_2D,a.mag=a.mag||t.NEAREST,a.min=a.min||t.NEAREST,a.wraps=a.wraps||t.CLAMP_TO_EDGE,a.wrapt=a.wrapt||t.CLAMP_TO_EDGE,a.internalFormat=a.internalFormat||t.RGBA,a.format=a.format||t.RGBA,a.type=a.type||t.UNSIGNED_BYTE;var i=this;i.initialize=function(){i.index=n,i.activate(),i.texture=t.createTexture(),i.bind(),t.texParameteri(a.target,t.TEXTURE_MAG_FILTER,a.mag),t.texParameteri(a.target,t.TEXTURE_MIN_FILTER,a.min),t.texParameteri(a.target,t.TEXTURE_WRAP_S,a.wraps),t.texParameteri(a.target,t.TEXTURE_WRAP_T,a.wrapt),t.texImage2D(a.target,0,a.internalFormat,r,o,0,a.format,a.type,e)},i.bind=function(){t.bindTexture(a.target,i.texture)},i.activate=function(){t.activeTexture(t.TEXTURE0+i.index)},i.reset=function(){i.activate(),i.bind(),t.texImage2D(a.target,0,a.internalFormat,r,o,0,a.format,a.type,e)},i.initialize()},t.exports.GLBuffer=e,t.exports.Renderable=function(t,n,e,r){var o=this;o.primitiveCount=r,o.initialize=function(){},o.render=function(){for(name in n.use(),e){var a=e[name].buffer,i=e[name].size;try{var u=n.attribs[name].location}catch(t){throw console.log("Could not find location for",name),t}a.bind(),t.enableVertexAttribArray(u),t.vertexAttribPointer(u,i,t.FLOAT,!1,0,0)}for(name in t.drawArrays(t.TRIANGLES,0,3*r),o.buffers)t.disableVertexAttribArray(n.attributes[name].location)},o.initialize()},t.exports.InstancedRenderable=function(t,n,e,r,o){var a=this;a.initialize=function(){},a.render=function(){for(name in n.use(),e){var i=e[name].buffer,u=e[name].size;try{var s=n.attribs[name].location}catch(t){throw console.log("Could not find location for",name),t}i.bind(),t.enableVertexAttribArray(s),t.vertexAttribPointer(s,u,t.FLOAT,!1,0,0),o.vertexAttribDivisorANGLE(s,e[name].divisor)}for(name in o.drawArraysInstancedANGLE(t.TRIANGLES,0,36,r),a.buffers)t.disableVertexAttribArray(n.attributes[name].location)},a.initialize()},t.exports.Program=function(t,n,e){var r=this;r.initialize=function(){r.program=r.compileProgram(n,e),r.attribs=r.gatherAttribs(),r.uniforms=r.gatherUniforms()},r.use=function(){t.useProgram(r.program)},r.compileProgram=function(n,e){var o=r.compileShader(n,t.VERTEX_SHADER),a=r.compileShader(e,t.FRAGMENT_SHADER),i=t.createProgram();if(t.attachShader(i,o),t.attachShader(i,a),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS))throw console.log(t.getProgramInfoLog(i)),"Failed to compile program.";return i},r.compileShader=function(n,e){var r=t.createShader(e);if(t.shaderSource(r,n),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(r),a=parseInt(o.split(":")[2]),i=n.split("\n");for(var u in i){var s=parseInt(u);console.log(s+"  "+i[u]),u==a-1&&console.warn(o)}throw typeString=e==t.VERTEX_SHADER?"vertex":"fragment","Failed to compile "+typeString+" shader."}return r},r.setUniform=function(n,e,o){var a=Array.prototype.slice.call(arguments,2);r.use();try{var i=r.uniforms[n].location}catch(t){throw console.log(n),t}t["uniform"+e].apply(t,[i].concat(a))},r.gatherUniforms=function(){for(var n={},e=t.getProgramParameter(r.program,t.ACTIVE_UNIFORMS),o=0;o<e;o++){var a=t.getActiveUniform(r.program,o);n[a.name]={name:a.name,location:t.getUniformLocation(r.program,a.name),type:a.type,size:a.size}}return n},r.gatherAttribs=function(){for(var n={},e=t.getProgramParameter(r.program,t.ACTIVE_ATTRIBUTES),o=0;o<e;o++){var a=t.getActiveAttrib(r.program,o);n[a.name]={name:a.name,location:t.getAttribLocation(r.program,a.name),type:a.type,size:a.size}}return n},r.initialize()}},function(t,n){var e=-1;t.exports={position:[e,e,e,e,e,1,e,1,1,e,e,e,e,1,1,e,1,e,1,e,1,1,e,e,1,1,e,1,e,1,1,1,e,1,1,1,e,e,e,1,e,e,1,e,1,e,e,e,1,e,1,e,e,1,e,1,1,1,1,1,1,1,e,e,1,1,1,1,e,e,1,e,1,e,e,e,e,e,e,1,e,1,e,e,e,1,e,1,1,e,e,e,1,1,e,1,1,1,1,e,e,1,1,1,1,e,1,1],normal:[e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1]}},function(t,n,e){"use strict";var r={accumulator:"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uSceneDepth;\nuniform sampler2D uSceneNormal;\nuniform sampler2D uRandRotDepth;\nuniform sampler2D uAccumulator;\nuniform mat4 uRot;\nuniform mat4 uInvRot;\nuniform vec2 uSceneBottomLeft;\nuniform vec2 uSceneTopRight;\nuniform vec2 uRotBottomLeft;\nuniform vec2 uRotTopRight;\nuniform float uDepth;\nuniform float uRes;\nuniform int uSampleCount;\n\nvoid main() {\n\n    float dScene = texture2D(uSceneDepth, gl_FragCoord.xy/uRes).r;\n\n    vec3 r = vec3(uSceneBottomLeft + (gl_FragCoord.xy/uRes) * (uSceneTopRight - uSceneBottomLeft), 0.0);\n\n    r.z = -(dScene - 0.5) * uDepth;\n    r = vec3(uRot * vec4(r, 1));\n    float depth = -r.z/uDepth + 0.5;\n\n    vec2 p = (r.xy - uRotBottomLeft)/(uRotTopRight - uRotBottomLeft);\n\n    float dRandRot = texture2D(uRandRotDepth, p).r;\n\n    float ao = step(dRandRot, depth * 0.99);\n\n    vec3 normal = texture2D(uSceneNormal, gl_FragCoord.xy/uRes).rgb * 2.0 - 1.0;\n    vec3 dir = vec3(uInvRot * vec4(0, 0, 1, 0));\n    float mag = dot(dir, normal);\n    float sampled = step(0.0, mag);\n\n    ao *= sampled;\n\n    vec4 acc = texture2D(uAccumulator, gl_FragCoord.xy/uRes);\n\n    if (uSampleCount < 256) {\n        acc.r += ao/255.0;\n    } else if (uSampleCount < 512) {\n        acc.g += ao/255.0;\n    } else if (uSampleCount < 768) {\n        acc.b += ao/255.0;\n    } else {\n        acc.a += ao/255.0;\n    }\n        \n    gl_FragColor = acc;\n\n}\n",ao:"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uSceneColor;\nuniform sampler2D uSceneDepth;\nuniform sampler2D uAccumulatorOut;\nuniform float uRes;\nuniform float uAO;\nuniform float uBrightness;\nuniform float uOutlineStrength;\n\nvoid main() {\n    vec2 p = gl_FragCoord.xy/uRes;\n    vec4 sceneColor = texture2D(uSceneColor, p);\n    if (uOutlineStrength > 0.0) {\n        float depth = texture2D(uSceneDepth, p).r;\n        float r = 1.0/511.0;\n        float d0 = abs(texture2D(uSceneDepth, p + vec2(-r,  0)).r - depth);\n        float d1 = abs(texture2D(uSceneDepth, p + vec2( r,  0)).r - depth);\n        float d2 = abs(texture2D(uSceneDepth, p + vec2( 0, -r)).r - depth);\n        float d3 = abs(texture2D(uSceneDepth, p + vec2( 0,  r)).r - depth);\n        float d = max(d0, d1);\n        d = max(d, d2);\n        d = max(d, d3);\n        sceneColor.rgb *= pow(1.0 - d, uOutlineStrength * 32.0);\n        sceneColor.a = max(step(0.003, d), sceneColor.a);\n    }\n    vec4 dAccum = texture2D(uAccumulatorOut, p);\n    float shade = max(0.0, 1.0 - (dAccum.r + dAccum.g + dAccum.b + dAccum.a) * 0.25 * uAO);\n    shade = pow(shade, 2.0);\n    gl_FragColor = vec4(uBrightness * sceneColor.rgb * shade, sceneColor.a);\n}\n",atom:"#version 100\nprecision highp float;\n\nattribute vec3 aImposter;\nattribute vec3 aPosition;\nattribute float aRadius;\nattribute vec3 aColor;\n\nuniform mat4 uView;\nuniform mat4 uProjection;\nuniform mat4 uModel;\nuniform float uAtomScale;\nuniform float uRelativeAtomScale;\nuniform float uAtomShade;\n\nvarying vec3 vColor;\nvarying vec3 vPosition;\nvarying float vRadius;\n\nvoid main() {\n    vRadius = uAtomScale * (1.0 + (aRadius - 1.0) * uRelativeAtomScale);\n    gl_Position = uProjection * uView * uModel * vec4(vRadius * aImposter + aPosition, 1.0);\n    vColor = mix(aColor, vec3(1,1,1), uAtomShade);\n    vPosition = vec3(uModel * vec4(aPosition, 1));\n}\n\n\n// __split__\n\n\n#version 100\n#extension GL_EXT_frag_depth: enable\nprecision highp float;\n\nuniform vec2 uBottomLeft;\nuniform vec2 uTopRight;\nuniform float uRes;\nuniform float uDepth;\nuniform int uMode;\n\nvarying vec3 vPosition;\nvarying float vRadius;\nvarying vec3 vColor;\n\nvec2 res = vec2(uRes, uRes);\n\nfloat raySphereIntersect(vec3 r0, vec3 rd) {\n    float a = dot(rd, rd);\n    vec3 s0_r0 = r0 - vPosition;\n    float b = 2.0 * dot(rd, s0_r0);\n    float c = dot(s0_r0, s0_r0) - (vRadius * vRadius);\n    float disc = b*b - 4.0*a*c;\n    if (disc <= 0.0) {\n        return -1.0;\n    }\n    return (-b - sqrt(disc))/(2.0*a);\n}\n\nvoid main() {\n    vec3 r0 = vec3(uBottomLeft + (gl_FragCoord.xy/res) * (uTopRight - uBottomLeft), 0.0);\n    vec3 rd = vec3(0, 0, -1);\n    float t = raySphereIntersect(r0, rd);\n    if (t < 0.0) {\n        discard;\n    }\n    vec3 coord = r0 + rd * t;\n    vec3 normal = normalize(coord - vPosition);\n    if (uMode == 0) {\n        gl_FragColor = vec4(vColor, 1);\n    } else if (uMode == 1) {\n        gl_FragColor = vec4(normal * 0.5 + 0.5, 1.0);\n    }\n    gl_FragDepthEXT = -coord.z/uDepth;\n}\n",blur:"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uTexture;\nuniform float uRes;\nuniform int leftRight;\n\nvoid main() {\n    vec2 dir;\n    if (leftRight == 1) {\n        dir = vec2(1,0)/uRes;\n    } else {\n        dir = vec2(0,1)/uRes;\n    }\n    const int range = 16;\n    vec4 sample = vec4(0,0,0,0);\n    for (int i = -range; i <= range; i++) {\n        vec2 p = gl_FragCoord.xy/uRes + dir * float(i);\n        sample += texture2D(uTexture, p);\n    }\n    sample /= float(range) * 2.0 + 1.0;\n    gl_FragColor = sample;\n}\n",bond:"#version 100\nprecision highp float;\n\nattribute vec3 aImposter;\nattribute vec3 aPosA;\nattribute vec3 aPosB;\nattribute float aRadA;\nattribute float aRadB;\nattribute vec3 aColA;\nattribute vec3 aColB;\n\nuniform mat4 uView;\nuniform mat4 uProjection;\nuniform mat4 uModel;\nuniform mat4 uRotation;\nuniform float uBondRadius;\nuniform float uAtomScale;\nuniform float uRelativeAtomScale;\n\nvarying vec3 vNormal;\nvarying vec3 vPosA, vPosB;\nvarying float vRadA, vRadB;\nvarying vec3 vColA, vColB;\nvarying float vRadius;\n\nmat3 alignVector(vec3 a, vec3 b) {\n    vec3 v = cross(a, b);\n    float s = length(v);\n    float c = dot(a, b);\n    mat3 I = mat3(\n        1, 0, 0,\n        0, 1, 0,\n        0, 0, 1\n    );\n    mat3 vx = mat3(\n        0, v.z, -v.y,\n        -v.z, 0, v.x,\n        v.y, -v.x, 0\n    );\n    return I + vx + vx * vx * ((1.0 - c) / (s * s));\n}\n\nvoid main() {\n    vRadius = uBondRadius;\n    vec3 pos = vec3(aImposter);\n    // Scale the box in x and z to be bond-radius.\n    pos = pos * vec3(vRadius, 1, vRadius);\n    // Shift the origin-centered cube so that the bottom is at the origin.\n    pos = pos + vec3(0, 1, 0);\n    // Stretch the box in y so that it is the length of the bond.\n    pos = pos * vec3(1, length(aPosA - aPosB) * 0.5, 1);\n    // Find the rotation that aligns vec3(0, 1, 0) with vec3(uPosB - uPosA) and apply it.\n    vec3 a = normalize(vec3(-0.000001, 1.000001, 0.000001));\n    vec3 b = normalize(aPosB - aPosA);\n    mat3 R = alignVector(a, b);\n    pos = R * pos;\n    // Shift the cube so that the bottom is centered at the middle of atom A.\n    pos = pos + aPosA;\n\n    vec4 position = uModel * vec4(pos, 1);\n    gl_Position = uProjection * uView * position;\n    vPosA = aPosA;\n    vPosB = aPosB;\n    vRadA = uAtomScale * (1.0 + (aRadA - 1.0) * uRelativeAtomScale);\n    vRadB = uAtomScale * (1.0 + (aRadB - 1.0) * uRelativeAtomScale);\n    vColA = aColA;\n    vColB = aColB;\n}\n\n\n// __split__\n\n\n#version 100\n#extension GL_EXT_frag_depth: enable\nprecision highp float;\n\nuniform mat4 uRotation;\nuniform vec2 uBottomLeft;\nuniform vec2 uTopRight;\nuniform float uDepth;\nuniform float uRes;\nuniform float uBondShade;\nuniform int uMode;\n\nvarying vec3 vPosA, vPosB;\nvarying float vRadA, vRadB;\nvarying vec3 vColA, vColB;\nvarying float vRadius;\n\nmat3 alignVector(vec3 a, vec3 b) {\n    vec3 v = cross(a, b);\n    float s = length(v);\n    float c = dot(a, b);\n    mat3 I = mat3(\n        1, 0, 0,\n        0, 1, 0,\n        0, 0, 1\n    );\n    mat3 vx = mat3(\n        0, v.z, -v.y,\n        -v.z, 0, v.x,\n        v.y, -v.x, 0\n    );\n    return I + vx + vx * vx * ((1.0 - c) / (s * s));\n}\n\nvoid main() {\n\n    vec2 res = vec2(uRes, uRes);\n    vec3 r0 = vec3(uBottomLeft + (gl_FragCoord.xy/res) * (uTopRight - uBottomLeft), uDepth/2.0);\n    vec3 rd = vec3(0, 0, -1);\n\n    vec3 i = normalize(vPosB - vPosA);\n         i = vec3(uRotation * vec4(i, 0));\n    vec3 j = normalize(vec3(-0.000001, 1.000001, 0.000001));\n    mat3 R = alignVector(i, j);\n\n    vec3 r0p = r0 - vec3(uRotation * vec4(vPosA, 0));\n    r0p = R * r0p;\n    vec3 rdp = R * rd;\n\n    float a = dot(rdp.xz, rdp.xz);\n    float b = 2.0 * dot(rdp.xz, r0p.xz);\n    float c = dot(r0p.xz, r0p.xz) - vRadius*vRadius;\n    float disc = b*b - 4.0*a*c;\n    if (disc <= 0.0) {\n        discard;\n    }\n    float t = (-b - sqrt(disc))/(2.0*a);\n    if (t < 0.0) {\n        discard;\n    }\n\n    vec3 coord = r0p + rdp * t;\n    if (coord.y < 0.0 || coord.y > length(vPosA - vPosB)) {\n        discard;\n    }\n\n    vec3 color;\n    if (coord.y < vRadA + 0.5 * (length(vPosA - vPosB) - (vRadA + vRadB))) {\n        color = vColA;\n    } else {\n        color = vColB;\n    }\n\n    color = mix(color, vec3(1,1,1), uBondShade);\n\n    R = alignVector(j, i);\n    vec3 normal = normalize(R * vec3(coord.x, 0, coord.z));\n\n    coord = r0 + rd * t;\n    if (uMode == 0) {\n        gl_FragColor = vec4(color, 1);\n    } else if (uMode == 1) {\n        gl_FragColor = vec4(normal * 0.5 + 0.5, 1.0);\n    }\n    gl_FragDepthEXT = -(coord.z - uDepth/2.0)/uDepth;\n}\n",dof:"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uColor;\nuniform sampler2D uDepth;\nuniform float uRes;\nuniform float uDOFPosition;\nuniform float uDOFStrength;\nuniform int leftRight;\n\nvoid main() {\n\n    vec2 samples[64];\n    samples[0] = vec2(0.857612, 0.019885);\n    samples[1] = vec2(0.563809, -0.028071);\n    samples[2] = vec2(0.825599, -0.346856);\n    samples[3] = vec2(0.126584, -0.380959);\n    samples[4] = vec2(0.782948, 0.594322);\n    samples[5] = vec2(0.292148, -0.543265);\n    samples[6] = vec2(0.130700, 0.330220);\n    samples[7] = vec2(0.236088, 0.159604);\n    samples[8] = vec2(-0.305259, 0.810505);\n    samples[9] = vec2(0.269616, 0.923026);\n    samples[10] = vec2(0.484486, 0.371845);\n    samples[11] = vec2(-0.638057, 0.080447);\n    samples[12] = vec2(0.199629, 0.667280);\n    samples[13] = vec2(-0.861043, -0.370583);\n    samples[14] = vec2(-0.040652, -0.996174);\n    samples[15] = vec2(0.330458, -0.282111);\n    samples[16] = vec2(0.647795, -0.214354);\n    samples[17] = vec2(0.030422, -0.189908);\n    samples[18] = vec2(0.177430, -0.721124);\n    samples[19] = vec2(-0.461163, -0.327434);\n    samples[20] = vec2(-0.410012, -0.734504);\n    samples[21] = vec2(-0.616334, -0.626069);\n    samples[22] = vec2(0.590759, -0.726479);\n    samples[23] = vec2(-0.590794, 0.805365);\n    samples[24] = vec2(-0.924561, -0.163739);\n    samples[25] = vec2(-0.323028, 0.526960);\n    samples[26] = vec2(0.642128, 0.752577);\n    samples[27] = vec2(0.173625, -0.952386);\n    samples[28] = vec2(0.759014, 0.330311);\n    samples[29] = vec2(-0.360526, -0.032013);\n    samples[30] = vec2(-0.035320, 0.968156);\n    samples[31] = vec2(0.585478, -0.431068);\n    samples[32] = vec2(-0.244766, -0.906947);\n    samples[33] = vec2(-0.853096, 0.184615);\n    samples[34] = vec2(-0.089061, 0.104648);\n    samples[35] = vec2(-0.437613, 0.285308);\n    samples[36] = vec2(-0.654098, 0.379841);\n    samples[37] = vec2(-0.128663, 0.456572);\n    samples[38] = vec2(0.015980, -0.568170);\n    samples[39] = vec2(-0.043966, -0.771940);\n    samples[40] = vec2(0.346512, -0.071238);\n    samples[41] = vec2(-0.207921, -0.209121);\n    samples[42] = vec2(-0.624075, -0.189224);\n    samples[43] = vec2(-0.120618, 0.689339);\n    samples[44] = vec2(-0.664679, -0.410200);\n    samples[45] = vec2(0.371945, -0.880573);\n    samples[46] = vec2(-0.743251, 0.629998);\n    samples[47] = vec2(-0.191926, -0.413946);\n    samples[48] = vec2(0.449574, 0.833373);\n    samples[49] = vec2(0.299587, 0.449113);\n    samples[50] = vec2(-0.900432, 0.399319);\n    samples[51] = vec2(0.762613, -0.544796);\n    samples[52] = vec2(0.606462, 0.174233);\n    samples[53] = vec2(0.962185, -0.167019);\n    samples[54] = vec2(0.960990, 0.249552);\n    samples[55] = vec2(0.570397, 0.559146);\n    samples[56] = vec2(-0.537514, 0.555019);\n    samples[57] = vec2(0.108491, -0.003232);\n    samples[58] = vec2(-0.237693, -0.615428);\n    samples[59] = vec2(-0.217313, 0.261084);\n    samples[60] = vec2(-0.998966, 0.025692);\n    samples[61] = vec2(-0.418554, -0.527508);\n    samples[62] = vec2(-0.822629, -0.567797);\n    samples[63] = vec2(0.061945, 0.522105);\n\n    float invRes = 1.0/uRes;\n    vec2 coord = gl_FragCoord.xy * invRes;\n\n    float strength = uDOFStrength * uRes/768.0;\n\n    float depth = texture2D(uDepth, coord).r;\n    float range = uDOFPosition - depth;\n    float scale = abs(range);\n\n    vec4 sample = texture2D(uColor, coord);\n    float count = 1.0;\n    for(int i = 0; i < 64; i++) {\n        vec2 p = samples[i];\n        p = coord + scale * 64.0 * strength * p * invRes;\n        float d = texture2D(uDepth, p).r;\n        float r = uDOFPosition - d;\n        float s = abs(r);\n        sample += texture2D(uColor, p) * s;\n        count += s;\n    }\n\n    gl_FragColor = sample/count;\n}",fxaa:"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uTexture;\nuniform float uRes;\n\nvoid main() {\n    float FXAA_SPAN_MAX = 8.0;\n    float FXAA_REDUCE_MUL = 1.0/8.0;\n    float FXAA_REDUCE_MIN = 1.0/128.0;\n\n    vec2 texCoords = gl_FragCoord.xy/uRes;\n\n    vec4 rgbNW = texture2D(uTexture, texCoords + (vec2(-1.0, -1.0) / uRes));\n    vec4 rgbNE = texture2D(uTexture, texCoords + (vec2(1.0, -1.0) / uRes));\n    vec4 rgbSW = texture2D(uTexture, texCoords + (vec2(-1.0, 1.0) / uRes));\n    vec4 rgbSE = texture2D(uTexture, texCoords + (vec2(1.0, 1.0) / uRes));\n    vec4 rgbM  = texture2D(uTexture, texCoords);\n\n    vec4 luma = vec4(0.299, 0.587, 0.114, 1.0);\n    float lumaNW = dot(rgbNW, luma);\n    float lumaNE = dot(rgbNE, luma);\n    float lumaSW = dot(rgbSW, luma);\n    float lumaSE = dot(rgbSE, luma);\n    float lumaM  = dot(rgbM,  luma);\n\n    float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n    float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n    vec2 dir;\n    dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n    dir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n    float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n    float rcpDirMin = 1.0/(min(abs(dir.x), abs(dir.y)) + dirReduce);\n\n    dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) / uRes;\n\n    vec4 rgbA = (1.0/2.0) * \n        (texture2D(uTexture, texCoords.xy + dir * (1.0/3.0 - 0.5)) + \n         texture2D(uTexture, texCoords.xy + dir * (2.0/3.0 - 0.5)));\n    vec4 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * \n        (texture2D(uTexture, texCoords.xy + dir * (0.0/3.0 - 0.5)) +\n         texture2D(uTexture, texCoords.xy + dir * (3.0/3.0 - 0.5)));\n    float lumaB = dot(rgbB, luma);\n\n    if((lumaB < lumaMin) || (lumaB > lumaMax)){\n        gl_FragColor = rgbA;\n    } else {\n        gl_FragColor = rgbB;\n    }\n\n}","textured-quad":"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uTexture;\nuniform float uRes;\n\nvoid main() {\n    gl_FragColor = texture2D(uTexture, gl_FragCoord.xy/uRes);\n}\n"};t.exports={shaders:r}},function(t,n,e){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=e(8);t.exports=function(t){if(arguments.length>1)throw"Error: The Speck Interactions module has changed!";if(0===arguments.length||"object"!==r(t))throw"Error: Arguments not provided to interactions";var n=void 0===t.scrollZoom||t.scrollZoom,e=t.container,a=t.getRotation,i=t.setRotation,u=t.getTranslation,s=t.setTranslation,l=t.getZoom,c=t.setZoom,f=t.refreshView,h={buttonDown:!1,shiftDown:!1,lastX:0,lastY:0};function p(t){0===t.button&&(h={buttonDown:!0,shiftDown:h.shiftDown,lastX:t.clientX,lastY:t.clientY})}function d(t){if(0===t.button){if(!h.buttonDown)return;h.buttonDown=!1}}function m(t){h.shiftDown=t.shiftKey}function g(t){if(h.buttonDown&&0!==t.buttons){t.preventDefault();var n=t.clientX-h.lastX,e=t.clientY-h.lastY;if(0!==n||0!==e){if(h.lastX=t.clientX,h.lastY=t.clientY,h.shiftDown){var r=u(),c=.001/l();s({x:r.x-n*c,y:r.y+e*c})}else{var p={rotation:new Float32Array(a())};o.rotate(p,n,e),i(p.rotation)}f()}}}function v(t){t.preventDefault(),c(l()*(t.deltaY<0?1/.9:.9)),f()}function y(){e.removeEventListener("mousedown",p),window.removeEventListener("mouseup",d),window.removeEventListener("keydown",m),window.removeEventListener("keyup",m),window.removeEventListener("mousemove",g),e.removeEventListener("wheel",v)}return e.addEventListener("mousedown",p),window.addEventListener("mouseup",d),window.addEventListener("keydown",m),window.addEventListener("keyup",m),window.addEventListener("mousemove",g),n&&e.addEventListener("wheel",v),y}},function(t,n){t.exports={default:{atomScale:.6,relativeAtomScale:1,bondScale:.5,ao:.75,aoRes:256,brightness:.5,outline:0,spf:32,bonds:!1,bondThreshold:1.2,bondShade:.5,atomShade:.5,dofStrength:0,dofPosition:.5,fxaa:1},stickball:{atomScale:.24,relativeAtomScale:.64,bondScale:.5,bonds:!0,bondThreshold:1.2},toon:{ao:0,spf:0,brightness:.5,outline:1},licorice:{atomScale:.1,relativeAtomScale:0,bondScale:1,bonds:!0,bondThreshold:1.2}}},function(t,n,e){"use strict";e.r(n);var r=e(10),o=e(20),a=e(1),i=e.n(a),u=e(0),s=e.n(u),l=e(24),c=e(47);function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function h(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function d(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function m(t,n){return(m=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var g=function(t){function n(t){var e;return function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n),(e=function(t,n){return!n||"object"!==f(n)&&"function"!=typeof n?d(t):n}(this,p(n).call(this,t))).renderNewSequences=e.renderNewSequences.bind(d(e)),e.containerRef=i.a.createRef(),e}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&m(t,n)}(n,t),e=n,(r=[{key:"componentDidMount",value:function(){var t=this.props,n=t.height,e=t.width,r=t.nodeFillColor,o=t.colorScheme,a=t.customColors,i=t.allowPanningAndZooming;this._fornaContainer=new l.FornaContainer(this.containerRef.current,{initialSize:[e,n],allowPanningAndZooming:i}),this._fornaContainer.addCustomColors(a),this._fornaContainer.changeColorScheme(o),this.renderNewSequences(),void 0!==r&&this._fornaContainer.setOutlineColor(r)}},{key:"componentDidUpdate",value:function(){this.renderNewSequences()}},{key:"renderNewSequences",value:function(){var t=this,n=this.props.sequences;this._fornaContainer&&(this._fornaContainer.clearNodes(),n.forEach((function(n){var e=Object.assign({},n.options,{sequence:n.sequence,structure:n.structure});t._fornaContainer.addRNA(n.structure,e)})))}},{key:"shouldComponentUpdate",value:function(t){var n=this.props,e=n.sequences,r=n.colorScheme;return!c.a(e,t.sequences)||(this._fornaContainer.addCustomColors(t.customColors),this._fornaContainer.changeColorScheme(r),void 0!==t.nodeFillColor&&this._fornaContainer.setOutlineColor(t.nodeFillColor),!1)}},{key:"render",value:function(){return i.a.createElement("div",{id:this.props.id,ref:this.containerRef,style:{outline:"none"}})}}])&&h(e.prototype,r),o&&h(e,o),n}(a.Component);g.propTypes={id:s.a.string,height:s.a.number,width:s.a.number,sequences:s.a.arrayOf(s.a.exact({sequence:s.a.string.isRequired,structure:s.a.string.isRequired,options:s.a.exact({applyForce:s.a.bool,circularizeExternal:s.a.bool,labelInterval:s.a.number,name:s.a.string,avoidOthers:s.a.bool})})),nodeFillColor:s.a.string,colorScheme:s.a.oneOf(["sequence","structure","positions","custom"]),customColors:s.a.exact({domain:s.a.arrayOf(s.a.number),range:s.a.arrayOf(s.a.string),colorValues:s.a.objectOf(s.a.objectOf(s.a.oneOfType([s.a.string,s.a.number])))}),allowPanningAndZooming:s.a.bool,setProps:s.a.func},g.defaultProps={height:500,width:300,sequences:[],allowPanningAndZooming:!0,colorScheme:"sequence"};var v=e(11),y=e(12),b=e(13),x=e(14),M=e(15),w=e(16),_=e(17),k=e(18),S=e(19);e.d(n,"AlignmentChart",(function(){return r.a})),e.d(n,"Circos",(function(){return o.a})),e.d(n,"FornaContainer",(function(){return g})),e.d(n,"Ideogram",(function(){return v.a})),e.d(n,"Igv",(function(){return y.a})),e.d(n,"Molecule2dViewer",(function(){return b.a})),e.d(n,"Molecule3dViewer",(function(){return x.a})),e.d(n,"NeedlePlot",(function(){return M.a})),e.d(n,"NglMoleculeViewer",(function(){return w.a})),e.d(n,"OncoPrint",(function(){return _.a})),e.d(n,"SequenceViewer",(function(){return k.a})),e.d(n,"Speck",(function(){return S.a}))},,function(t,n){t.exports=window.ReactDOM},,,,,,,,,,,,function(t,n,e){"use strict";var r=e(9);function o(t){for(var n,e=[];!(n=t.next()).done;)e.push(n.value);return e}function a(t,n,e){for(var r=0,o=e.length;r<o;){if(t(n,e[r]))return!0;r+=1}return!1}var i=e(5);var u="function"==typeof Object.is?Object.is:function(t,n){return t===n?0!==t||1/t==1/n:t!=t&&n!=n},s=e(3),l=Object.prototype.toString,c=function(){return"[object Arguments]"===l.call(arguments)?function(t){return"[object Arguments]"===l.call(t)}:function(t){return Object(i.a)("callee",t)}}(),f=!{toString:null}.propertyIsEnumerable("toString"),h=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],p=function(){return arguments.propertyIsEnumerable("length")}(),d=function(t,n){for(var e=0;e<t.length;){if(t[e]===n)return!0;e+=1}return!1},m="function"!=typeof Object.keys||p?Object(s.a)((function(t){if(Object(t)!==t)return[];var n,e,r=[],o=p&&c(t);for(n in t)!Object(i.a)(n,t)||o&&"length"===n||(r[r.length]=n);if(f)for(e=h.length-1;e>=0;)n=h[e],Object(i.a)(n,t)&&!d(r,n)&&(r[r.length]=n),e-=1;return r})):Object(s.a)((function(t){return Object(t)!==t?[]:Object.keys(t)})),g=Object(s.a)((function(t){return null===t?"Null":void 0===t?"Undefined":Object.prototype.toString.call(t).slice(8,-1)}));function v(t,n,e,r){var i=o(t);function u(t,n){return y(t,n,e.slice(),r.slice())}return!a((function(t,n){return!a(u,n,t)}),o(n),i)}function y(t,n,e,r){if(u(t,n))return!0;var o,a,s=g(t);if(s!==g(n))return!1;if(null==t||null==n)return!1;if("function"==typeof t["fantasy-land/equals"]||"function"==typeof n["fantasy-land/equals"])return"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](n)&&"function"==typeof n["fantasy-land/equals"]&&n["fantasy-land/equals"](t);if("function"==typeof t.equals||"function"==typeof n.equals)return"function"==typeof t.equals&&t.equals(n)&&"function"==typeof n.equals&&n.equals(t);switch(s){case"Arguments":case"Array":case"Object":if("function"==typeof t.constructor&&"Promise"===(o=t.constructor,null==(a=String(o).match(/^function (\w*)/))?"":a[1]))return t===n;break;case"Boolean":case"Number":case"String":if(typeof t!=typeof n||!u(t.valueOf(),n.valueOf()))return!1;break;case"Date":if(!u(t.valueOf(),n.valueOf()))return!1;break;case"Error":return t.name===n.name&&t.message===n.message;case"RegExp":if(t.source!==n.source||t.global!==n.global||t.ignoreCase!==n.ignoreCase||t.multiline!==n.multiline||t.sticky!==n.sticky||t.unicode!==n.unicode)return!1}for(var l=e.length-1;l>=0;){if(e[l]===t)return r[l]===n;l-=1}switch(s){case"Map":return t.size===n.size&&v(t.entries(),n.entries(),e.concat([t]),r.concat([n]));case"Set":return t.size===n.size&&v(t.values(),n.values(),e.concat([t]),r.concat([n]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var c=m(t);if(c.length!==m(n).length)return!1;var f=e.concat([t]),h=r.concat([n]);for(l=c.length-1;l>=0;){var p=c[l];if(!Object(i.a)(p,n)||!y(n[p],t[p],f,h))return!1;l-=1}return!0}var b=Object(r.a)((function(t,n){return y(t,n,[],[])}));n.a=b}]);
\ No newline at end of file
diff --git a/dash_bio/metadata.json b/dash_bio/metadata.json
index 47de9e1c9..0c55fc4bb 100644
--- a/dash_bio/metadata.json
+++ b/dash_bio/metadata.json
@@ -1933,7 +1933,7 @@
         "required": false,
         "description": "The width (in px or as a number) of the container\nin which the molecules will be displayed.",
         "defaultValue": {
-          "value": "'500px'",
+          "value": "'600px'",
           "computed": false
         }
       },
@@ -1952,7 +1952,7 @@
         "required": false,
         "description": "The height (in px or as a number) of the container\nin which the molecules will be displayed.",
         "defaultValue": {
-          "value": "'500px'",
+          "value": "'600px'",
           "computed": false
         }
       },
@@ -2098,7 +2098,7 @@
           }
         },
         "required": false,
-        "description": "The data (in JSON format) that will be used to display the molecule\nfilename: name of the used pdb/cif file\next: file extensions (pdb or cif)\nselectedValue: pdbString\nchain: ALL if the whole molecule shoud be displayed, e.g. A for showing only chain A\naaRange: ALL if the whole molecule shoud be displayed, e.g. 1:50 for showing only 50 atoms\ncolor: chain color\nchosen.atoms: string of the chosen Atoms, e.g. 50,100,150\n              --> chosen eatoms changed to colored 'ball'\nchosen.residues: string of the chosen residues, e.g. 50,100,150\n                 --> C alpha of chosen residue changed to colored 'ball'\nconfig.input: content of the pdb file\nconfig.type: format of config.input\nuploaded: bool if file from local storage (false) or uploaded by user (true)\nresetView: bool if the selection did not change but the view should be resettet (true)",
+        "description": "The data (in JSON format) that will be used to display the molecule\nfilename: name of the used pdb/cif file\next: file extensions (pdb or cif)\nselectedValue: pdbString\nchain: ALL if the whole molecule shoud be displayed, e.g. A for showing only chain A\naaRange: ALL if the whole molecule should be displayed, e.g. 1:50 for showing only 50 atoms\ncolor: chain color\nchosen.atoms: string of the chosen Atoms, e.g. 50,100,150\n              --> chosen eatoms changed to colored 'ball'\nchosen.residues: string of the chosen residues, e.g. 50,100,150\n                 --> C alpha of chosen residue changed to colored 'ball'\nconfig.input: content of the pdb file\nconfig.type: format of config.input\nuploaded: bool if file from local storage (false) or uploaded by user (true)\nresetView: bool if the selection did not change but the view should be resettet (true)",
         "defaultValue": {
           "value": "[\n    {\n        filename: 'placeholder',\n        ext: '',\n        selectedValue: 'placeholder',\n        chain: 'ALL',\n        aaRange: 'ALL',\n        chosen: {\n            chosenAtoms: '',\n            chosenResidues: '',\n        },\n        color: 'red',\n        config: {\n            input: '',\n            type: 'text/plain',\n        },\n        uploaded: false,\n        resetView: false,\n    },\n]",
           "computed": false
diff --git a/dash_bio/package-info.json b/dash_bio/package-info.json
index bb51b0d95..37d811295 100644
--- a/dash_bio/package-info.json
+++ b/dash_bio/package-info.json
@@ -1,6 +1,6 @@
 {
   "name": "dash-bio",
-  "version": "0.6.0",
+  "version": "0.6.1",
   "description": "Dash components for bioinformatics",
   "repository": {
     "type": "git",
diff --git a/inst/deps/async-nglmoleculeviewer.js b/inst/deps/async-nglmoleculeviewer.js
index 382255e93..a3eb75b69 100644
--- a/inst/deps/async-nglmoleculeviewer.js
+++ b/inst/deps/async-nglmoleculeviewer.js
@@ -91,4 +91,4 @@ function Ds(t,e,i,r,n){this._listener=e,this._isOnce=i,this.context=r,this._sign
  * @param {Float32Array} points - points
  * @param {Function} metric - metric
  */
-function Pp(t,e){for(var i=t.length/3,r=0,n=new Uint32Array(i),o=0;o<i;++o)n[o]=o;var a=new Int32Array(4*i),s=0,c=0;var u=function e(i,o,u,h){i>r&&(r=i);var l=h-u;if(0===l)return-1;var p=4*s;if(s+=1,1===l)return a[p]=u,a[p+1]=-1,a[p+2]=-1,a[p+3]=o,p;var d,f,m,g,v,y=u+Math.floor(l/2);c=i%3;for(var b=u,x=h-1;x>b;){for(g=t[3*n[m=b+x>>1]+c],f=n[m],n[m]=n[x],n[x]=f,v=b,d=b;d<x;++d)t[3*n[d]+c]<g&&(f=n[v],n[v]=n[d],n[d]=f,++v);if(f=n[x],n[x]=n[v],n[v]=f,y===(m=v))break;y<m?x=m-1:b=m+1}return a[p]=y,a[p+1]=e(i+1,p,u,y),a[p+2]=e(i+1,p,y+1,h),a[p+3]=o,p}(0,-1,0,i);this.rootIndex=u,this.maxDepth=r,this.nearest=function(i,r,o){var s=new Mp((function(t){return-t[1]}));!function c(u){var h,l,p=function t(e){var i=a[e+3];return-1===i?0:t(i)+1}(u)%3,d=3*n[a[u]],f=[t[d+0],t[d+1],t[d+2]],m=e(i,f);function g(t,e){s.push([t,e]),s.size()>r&&s.pop()}var v=a[u+1],y=a[u+2];if(-1!==y||-1!==v){c(h=-1===y?v:-1===v?y:i[p]<=t[d+p]?v:y),(s.size()<r||m<s.peek()[1])&&m<=o&&g(u,m);for(var b=[],x=0;x<3;x+=1)b[x]=x===p?i[x]:t[d+x];var _=e(b,f);(s.size()<r||Math.abs(_)<s.peek()[1])&&Math.abs(_)<=o&&-1!==(l=h===v?y:v)&&c(l)}else(s.size()<r||m<s.peek()[1])&&m<=o&&g(u,m)}(u);for(var c=[],h=0,l=Math.min(s.size(),r);h<l;h+=1)c.push(s.content[h]);return c},this.indices=n,this.nodes=a,this.verify=function e(i,r){var o=1;if(void 0===i&&(i=u,r=0),-1===i)throw new Error("node is null");var s=r%3,c=a[i+1],h=a[i+2];if(-1!==c){if(t[3*n[a[c]]+s]>t[3*n[a[i]]+s])throw new Error("left child is > parent!");o+=e(c,r+1)}if(-1!==h){if(t[3*n[a[h]]+s]<t[3*n[a[i]]+s])throw new Error("right child is < parent!");o+=e(h,r+1)}return o}}function Tp(t,e){var i;gc&&mc.time("Kdtree build"),i=e?function(t,e){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return i*i+r*r+n*n}:function(t,e){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return Math.sqrt(i*i+r*r+n*n)};var r=new Float32Array(3*t.atomCount),n=new Uint32Array(t.atomCount),o=0;t.eachAtom((function(t){r[o+0]=t.x,r[o+1]=t.y,r[o+2]=t.z,n[o/3]=t.index,o+=3})),this.atomIndices=n,this.points=r,this.kdtree=new Pp(r,i),gc&&mc.timeEnd("Kdtree build")}Sp.prototype={constructor:Sp,getCenterIterator:function(t){var e=this.getPosition().center,i=e.length/3,r=0,n=-1,o=[new O,new O,new O,new O];return{size:i,next:function(){var t=this.get(n);return n+=1,t},get:function(n){n=Math.min(i-1,Math.max(0,n));var a=o[r%4],s=3*n;if(a.fromArray(e,s),t){var c,u,h,l=Math.min(t,n,i-n-1);for(u=1;u<=l;++u)c=3*u,h=(l+1-u)/(l+1),a.x+=h*e[s-c+0]+h*e[s+c+0],a.y+=h*e[s-c+1]+h*e[s+c+1],a.z+=h*e[s-c+2]+h*e[s+c+2];a.x/=l+1,a.y/=l+1,a.z/=l+1}return r+=1,a},reset:function(){r=0,n=-1}}},getColor:function(t){var e=this.polymer,i=e.structure,r=e.residueCount,n=e.residueIndexStart,o=new Float32Array(3*r),a=t||{};a.structure=i;for(var s=yc.getScheme(a),c=i.getResidueProxy(),u=i.getAtomProxy(),h=0;h<r;++h)c.index=n+h,u.index=c.traceAtomIndex,s.atomColorToArray(u,o,3*h);return{color:o}},getPicking:function(){for(var t=this.polymer,e=t.structure,i=t.residueCount,r=t.residueIndexStart,n=new Float32Array(i),o=e.getResidueProxy(),a=0;a<i;++a)o.index=r+a,n[a]=o.traceAtomIndex;return{picking:new $h(n,e)}},getSize:function(t,e){for(var i=this.polymer,r=i.structure,n=i.residueCount,o=i.residueIndexStart,a=new Float32Array(n),s=new Il(t,e),c=r.getResidueProxy(),u=r.getAtomProxy(),h=0;h<n;++h)c.index=o+h,u.index=c.traceAtomIndex,a[h]=s.atomRadius(u);return{size:a}},getPosition:function(){var t,e,i,r,n,o=this.polymer,a=o.structure,s=o.residueCount,c=s-3,u=new Float32Array(3*s),h=new Float32Array(3*s),l=new Float32Array(s),p=new Float32Array(s),d=new Float32Array(s),f=new Float32Array(s),m=new Float32Array(3*s),g=new O,v=new O,y=new O,b=new O,x=new O,_=new O,w=new O,S=new O,A=new O,M=new O,P=new O,T=new O(0,0,0),E="trace",C=a.getAtomProxy(),I=a.getAtomProxy(o.getAtomIndexByType(0,E)),R=a.getAtomProxy(o.getAtomIndexByType(1,E)),L=a.getAtomProxy(o.getAtomIndexByType(2,E));for(i=0;i<c;++i)C.index=I.index,I.index=R.index,R.index=L.index,L.index=o.getAtomIndexByType(i+3,E),e=3*i,g.subVectors(I,C),v.subVectors(R,I),y.subVectors(L,R),b.subVectors(g,v),x.subVectors(v,y),A.crossVectors(b,x).normalize(),A.toArray(h,e),i>0&&(l[i]=A.angleTo(M)),t=Math.cos(b.angleTo(x)),f[i]=180/Math.PI*Math.acos(t),r=b.length(),n=x.length(),p[i]=Math.sqrt(n*r)/Math.max(2,2*(1-t)),d[i]=Math.abs(v.dot(A)),_.copy(b).multiplyScalar(p[i]/r),w.copy(x).multiplyScalar(p[i]/n),_.subVectors(I,_),w.subVectors(R,w),_.toArray(u,e+3),w.toArray(u,e+6),P.subVectors(C,T),P.toArray(m,e),M.copy(A),T.copy(_);for(_.fromArray(u,3),w.fromArray(u,6),A.subVectors(_,w).normalize(),C.index=o.getAtomIndexByType(0,E),T.copy(C),S.copy(C),wh(S,A,_),S.toArray(u,0),P.subVectors(T,_),P.toArray(m,0),_.fromArray(u,3*s-6),w.fromArray(u,3*s-9),A.subVectors(_,w).normalize(),C.index=o.getAtomIndexByType(s-1,E),T.copy(C),S.copy(C),wh(S,A,_),S.toArray(u,3*s-3),i=s-3;i<s;++i)_.fromArray(u,3*i),C.index=o.getAtomIndexByType(i,E),T.copy(C),P.subVectors(T,_),P.toArray(m,3*i);var N=new Float32Array(s),D=new Float32Array(s),k=new Float32Array(s),F=new Float32Array(s);for(N[1]=p[0],D[1]=f[0],k[1]=p[0],i=2;i<s-2;++i)N[i]=.5*(p[i-2]+p[i-1]),D[i]=.5*(f[i-2]+f[i-1]),k[i]=.5*(d[i-2]+d[i-1]),_.fromArray(h,3*(i-2)),w.fromArray(h,3*(i-1)),F[i]=180/Math.PI*Math.acos(Math.cos(_.angleTo(w)));N[s-2]=p[s-4],D[s-2]=f[s-4],k[s-2]=d[s-4];var B=new Float32Array(3*s);for(uu(h,B,0,0,3),uu(h,B,0,3,3),i=2;i<s-2;++i)_.fromArray(h,3*(i-2)),w.fromArray(h,3*(i-1)),A.addVectors(w,_).multiplyScalar(.5).normalize(),A.toArray(B,3*i);return uu(h,B,3*s-12,3*s-6,3),uu(h,B,3*s-12,3*s-3,3),{center:u,axis:B,bending:F,radius:N,rise:k,twist:D,resdir:m}}},Ap.prototype={constructor:Ap,getAxis:function(t,e,i,r,n,o){t=t||30,e=e||2.5,i=void 0!==i&&i;var a=this.polymer,s=a.structure,c=a.residueCount,u=a.residueIndexStart,h=this.position,l=r||{};l.structure=s;for(var p,d,f=yc.getScheme(l),m=new Il(n,o),g=0,v=0,y=[],b=[],x=[],_=[],w=[],S=[],A=[],M=[],P=[],T=[],E=[],C=new O,I=new O,R=s.getResidueProxy(),L=s.getResidueProxy(),N=s.getAtomProxy(),D=new O,k=new O,F=!1,B=0;B<c;++B)if(R.index=u+B,D.fromArray(h.center,3*B),B===c-1?F=!0:(L.index=u+B+1,k.fromArray(h.center,3*B+3),i&&R.sstruc!==L.sstruc?F=!0:D.distanceTo(k)>e?F=!0:h.bending[B]>t&&(F=!0)),F){if(B-g<4){g=B,F=!1;continue}N.index=R.traceAtomIndex,T=h.axis.subarray(3*g+3,3*B),E=h.center.subarray(3*g,3*B+3),p=_h(T).normalize(),d=_h(E),C.fromArray(E),wh(C,p,d),I.fromArray(E,E.length-3),wh(I,p,d),p.subVectors(I,C),p.toArray(y,v),d.toArray(b,v),C.toArray(x,v),I.toArray(_,v),f.atomColorToArray(N,w,v),S.push(N.index),A.push(m.atomRadius(N)),M.push(u+g),P.push(u+B+1-g),v+=3,g=B,F=!1}var z=new Float32Array(S);return{axis:new Float32Array(y),center:new Float32Array(b),begin:new Float32Array(x),end:new Float32Array(_),color:new Float32Array(w),picking:new $h(z,s),size:new Float32Array(A),residueOffset:M,residueCount:P}}},Mp.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;i<e;i++)if(this.content[i]===t){var r=this.content.pop();return void(i!==e-1&&(this.content[i]=r,this.scoreFunction(r)<this.scoreFunction(t)?this.bubbleUp(i):this.sinkDown(i)))}throw new Error("Node not found.")},size:function(){return this.content.length},bubbleUp:function(t){for(var e=this.content[t];t>0;){var i=Math.floor((t+1)/2)-1,r=this.content[i];if(!(this.scoreFunction(e)<this.scoreFunction(r)))break;this.content[i]=e,this.content[t]=r,t=i}},sinkDown:function(t){for(var e,i=this.content.length,r=this.content[t],n=this.scoreFunction(r);;){var o=2*(t+1),a=o-1,s=null;if(a<i){var c=this.content[a];(e=this.scoreFunction(c))<n&&(s=a)}if(o<i){var u=this.content[o];this.scoreFunction(u)<(null===s?n:e)&&(s=o)}if(null===s)break;this.content[t]=this.content[s],this.content[s]=r,t=s}}},Tp.prototype={nearest:(vp=new Float32Array(3),function(t,e,i){t.toArray?t.toArray(vp):t.positionToArray&&t.positionToArray(vp);for(var r=this.kdtree.nearest(vp,e,i),n=this.kdtree.indices,o=this.kdtree.nodes,a=this.atomIndices,s=[],c=0,u=r.length;c<u;++c){var h=r[c],l=h[0],p=h[1];s.push({index:a[n[o[l]]],distance:p})}return s})};var Ep={" ":"X","!":"Y","#":"Z",$:"-X","%":"-Y","&":"-Z","'":"Y+1/2","(":"1/2+X",")":"1/2+Y","*":"1/2-X","+":"1/2+Z",",":"1/2-Y","-":"1/2-Z",".":"X+1/2","/":"Z+1/2",0:"-X+1/2",1:"-Y+1/2",2:"-Z+1/2",3:"1/4+X",4:"1/4-Y",5:"1/4+Z",6:"1/4-X",7:"1/4+Y",8:"3/4-Y",9:"3/4+Z",":":"3/4+Y",";":"3/4+X","<":"3/4-X","=":"1/4-Z",">":"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"},Cp={"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":" !#*,#.%&$'&!# ,- '&$%/$# !-*!/$%&.%()+$%+ ,-*!-)+(%&(!-*,#*+()&$)#*,- ,"};function Ip(t){var e="";return t.length>0&&(e=":"+ko(t).join(" OR :")),new nc(e)}var Rp=function(t){this.name=t||"",this.partList=[]},Lp={type:{}};Lp.type.get=function(){return"Assembly"},Rp.prototype.addPart=function(t,e){var i=new Op(t,e);return this.partList.push(i),i},Rp.prototype._getCount=function(t,e){var i=0;return this.partList.forEach((function(r){i+=r[e](t)})),i},Rp.prototype.getAtomCount=function(t){return this._getCount(t,"getAtomCount")},Rp.prototype.getResidueCount=function(t){return this._getCount(t,"getResidueCount")},Rp.prototype.getInstanceCount=function(){var t=0;return this.partList.forEach((function(e){t+=e.matrixList.length})),t},Rp.prototype.isIdentity=function(t){if(1!==this.partList.length)return!1;var e=this.partList[0];if(1!==e.matrixList.length)return!1;if(!(new N).equals(e.matrixList[0]))return!1;var i=[];return t.eachChain((function(t){i.push(t.chainname)})),i=ko(i),e.chainList.length===i.length},Rp.prototype.getBoundingBox=function(t){var e=new jt;return this.partList.forEach((function(i){var r=i.getBoundingBox(t);e.expandByPoint(r.min),e.expandByPoint(r.max)})),e},Rp.prototype.getCenter=function(t){return this.getBoundingBox(t).getCenter()},Rp.prototype.getSelection=function(){var t=[];return this.partList.forEach((function(e){t=t.concat(e.chainList)})),Ip(t)},Object.defineProperties(Rp.prototype,Lp);var Op=function(t,e){this.matrixList=t||[],this.chainList=e||[]},Np={type:{}};function Dp(t,e){if(e){gc&&mc.time("assignSecondaryStructure");var i=[];t.eachModel((function(t){t.eachChain((function(t){i.push(t.chainname)}))}));var r=i.slice().sort(),n=[];r.forEach((function(t){n.push(i.indexOf(t))}));var o=e.helices;(o=o.filter((function(t){return No(r,t[0])>=0}))).sort((function(t,e){var i=t[0],o=e[0],a=t[1],s=e[1];if(i===o)return a===s?0:a<s?-1:1;var c=No(r,i),u=No(r,o);return n[c]<n[u]?-1:1}));var a=t.residueStore;t.eachModel((function(t){var e=0,i=o.length;if(0!==i){var r=o[e],n=!1,s=!1;t.eachChain((function(t){var c=!1;if(t.chainname===r[0])for(var u=t.residueCount,h=t.residueOffset,l=h+u,p=h;p<l;++p)if(a.resno[p]===r[1]&&a.getInscode(p)===r[2]&&(n=!0),n&&(a.sstruc[p]=r[6],a.resno[p]===r[4]&&a.getInscode(p)===r[5]&&(n=!1,(e+=1)<i?(p=h-1,r=o[e],c=t.chainname!==r[0]):s=!0)),c||s)return}))}}));var s=e.sheets;(s=s.filter((function(t){return No(r,t[0])>=0}))).sort((function(t,e){var i=t[0],o=e[0];if(i===o)return 0;var a=No(r,i),s=No(r,o);return n[a]<n[s]?-1:1}));var c="e".charCodeAt(0);t.eachModel((function(t){var e=0,i=s.length;if(0!==i){var r=s[e],n=!1,o=!1;t.eachChain((function(t){var u=!1;if(t.chainname===r[0])for(var h=t.residueCount,l=t.residueOffset,p=l+h,d=l;d<p;++d)if(a.resno[d]===r[1]&&a.getInscode(d)===r[2]&&(n=!0),n&&(a.sstruc[d]=c,a.resno[d]===r[4]&&a.getInscode(d)===r[5]&&(n=!1,(e+=1)<i?(d=l-1,r=s[e],u=t.chainname!==r[0]):o=!0)),u||o)return}))}})),gc&&mc.timeEnd("assignSecondaryStructure")}}Np.type.get=function(){return"AssemblyPart"},Op.prototype._getCount=function(t,e){var i=0,r=this.chainList;return t.eachChain((function(t){(0===r.length||r.includes(t.chainname))&&(i+=t[e])})),this.matrixList.length*i},Op.prototype.getAtomCount=function(t){return this._getCount(t,"atomCount")},Op.prototype.getResidueCount=function(t){return this._getCount(t,"residueCount")},Op.prototype.getBoundingBox=function(t){var e=new jt,i=new jt,r=this.getSelection(),n=t.getBoundingBox(r);return this.matrixList.forEach((function(t){i.copy(n).applyMatrix4(t),e.expandByPoint(i.min),e.expandByPoint(i.max)})),e},Op.prototype.getSelection=function(){return Ip(this.chainList)},Op.prototype.getView=function(t){var e=this.getSelection();return e?t.getView(e):t},Op.prototype.getInstanceList=function(){for(var t=[],e=0,i=this.matrixList.length;e<i;++e)t.push({id:e+1,name:e,matrix:this.matrixList[e]});return t},Object.defineProperties(Op.prototype,Np);var kp,Fp,Bp,zp=(kp=function(t,e,i,r){for(var n=t.structure,o=t.residueIndexStart,a=n.getResidueProxy(),s=n.getResidueProxy(),c=n.getAtomProxy(),u=n.getAtomProxy(),h=Math.max(0,e-2);h<=e;++h)for(var l=2;l<5;++l)if(!(h+l>=t.residueCount)){a.index=o+h,s.index=o+h+l,c.index=a.traceAtomIndex,u.index=s.traceAtomIndex;var p=c.distanceTo(u);if(Math.abs(p-i[l-2])>r)return!1}return!0},Fp=function(t,e){return kp(t,e,[5.45,5.18,6.37],2.1)},Bp=function(t,e){return kp(t,e,[6.1,10.4,13],1.42)},function(t){gc&&mc.time("calculateSecondaryStructure"),t.eachPolymer((function(t){if(!(t.residueCount<4)){if(t.isCg())!function(t){for(var e=t.residueStore,i=t.residueIndexStart,r=new Ap(t).position,n=new O,o=new O,a=0,s=t.residueCount;a<s;++a){n.fromArray(r.center,3*a),o.fromArray(r.center,3*a+3);var c=n.distanceTo(o);c<2&&c>1&&r.bending[a]<20&&(e.sstruc[i+a]="h".charCodeAt(0),e.sstruc[i+a+1]="h".charCodeAt(0))}}(t);else{if(!t.isProtein())return;!function(t){for(var e=t.residueStore,i=t.residueIndexStart,r=0,n=t.residueCount;r<n;++r){var o="c";Fp(t,r)?o="h":Bp(t,r)&&(o="s"),e.sstruc[i+r]=o.charCodeAt(0)}}(t)}var e,i=0;t.eachResidue((function(t){t.sstruc===e?i+=1:(1===i&&(t.index-=1,t.sstruc="c"),i=1,e=t.sstruc)}))}})),gc&&mc.timeEnd("calculateSecondaryStructure")});function Up(t){gc&&mc.time("calculateChainnames");var e=!0;if(t.eachChain((function(t){t.chainname&&(e=!1)})),e){var i="ABCDEFGHIJKLMNOPQRSTUVWXYZ",r=i.length,n=t.modelStore,o=t.chainStore,a=t.residueStore,s=function(t){for(var e=t,n=0,o=i[e%r];e>=r;)e=Math.floor(e/r),o+=i[e%r],n+=1;return n>=5&&mc.warn("chainname overflow"),o},c=t.getAtomProxy(),u=t.getAtomProxy(),h=0,l=0,p=0,d=0,f=[];1===a.count?f.push({mIndex:0,chainname:"A",rStart:0,rCount:1}):t.eachResidueN(2,(function(t,e){var i=!1,r=t.backboneType,n=e.backboneType;d=t.index,t.modelIndex!==e.modelIndex?i=!0:t.moleculeType!==e.moleculeType?i=!0:0!==r&&r===n&&(c.index=t.backboneEndAtomIndex,u.index=e.backboneStartAtomIndex,c.connectedTo(u)||(i=!0)),i||e.index!==a.count-1||(i=!0,d=e.index),i&&(f.push({mIndex:l,chainname:s(h),rStart:p,rCount:d-p+1}),h+=1,t.modelIndex!==e.modelIndex&&(h=0,l+=1),e.index===a.count-1&&d!==e.index&&f.push({mIndex:l,chainname:s(h),rStart:a.count-1,rCount:1}),p=e.index,d=e.index)})),o.count=0,f.forEach((function(t){!function(t,e,i,r){for(var s=o.count,c=0;c<r;++c)a.chainIndex[i+c]=s;o.growIfFull(),o.modelIndex[s]=t,o.setChainname(s,e),o.setChainid(s,e),o.residueOffset[s]=i,o.residueCount[s]=r,o.count+=1,n.chainCount[t]+=1}(t.mIndex,t.chainname,t.rStart,t.rCount)}));var m=0;t.eachModel((function(t){n.chainOffset[t.index]=m,n.chainCount[t.index]-=1,m+=n.chainCount[t.index]}))}gc&&mc.timeEnd("calculateChainnames")}function jp(t){gc&&mc.time("calculateBonds"),Gp(t),Vp(t),gc&&mc.timeEnd("calculateBonds")}function Gp(t,e){gc&&mc.time("calculateBondsWithin");var i=t.bondStore,r=t.rungBondStore,n=t.getAtomSet(!1),o=t.getAtomProxy(),a=t.getAtomProxy(),s=t.getBondProxy(),c=e?null:function(t){gc&&mc.time("calculateAtomBondMap");var e=[];return t.eachBond((function(t){var i=t.atomIndex1,r=t.atomIndex2;void 0===e[i]&&(e[i]=[]),e[i][r]=t.index})),gc&&mc.timeEnd("calculateAtomBondMap"),e}(t);t.eachResidue((function(t){if(!e){var u=t.atomCount,h=t.atomOffset;if(u>500)return void mc.warn("more than 500 atoms, skip residue for auto-bonding",t.qualifiedName());for(var l=t.getBonds(),p=l.atomIndices1,d=l.atomIndices2,f=l.bondOrders,m=p.length,g=0;g<m;++g){var v=p[g]+h,y=d[g]+h,b=c[v];if(void 0!==b&&void 0!==(b=b[y]))s.index=b,f[t.residueType.getBondIndex(v,y)]=s.bondOrder;else o.index=v,a.index=y,i.addBond(o,a,f[g])}}var x=t.residueType.traceAtomIndex,_=t.residueType.rungEndAtomIndex;-1!==x&&-1!==_&&(o.index=t.traceAtomIndex,a.index=t.rungEndAtomIndex,r.addBond(o,a),n.set(o.index),n.set(a.index))})),t.atomSetDict.rung=n,gc&&mc.timeEnd("calculateBondsWithin")}function Vp(t,e){gc&&mc.time("calculateBondsBetween");var i=t.bondStore,r=t.backboneBondStore,n=t.getAtomSet(!1),o=t.getAtomProxy(),a=t.getAtomProxy();function s(t,s){var c=t.backboneType,u=s.backboneType;0!==c&&c===u&&(o.index=t.backboneEndAtomIndex,a.index=s.backboneStartAtomIndex,o.connectedTo(a)&&(e||i.addBond(o,a,1),o.index=t.traceAtomIndex,a.index=s.traceAtomIndex,r.addBond(o,a),n.set(o.index),n.set(a.index)))}0===r.count&&r.resize(t.residueStore.count),t.eachResidueN(2,s);var c=t.getResidueProxy(),u=t.getResidueProxy();t.eachChain((function(t){0!==t.residueCount&&(c.index=t.residueOffset,u.index=t.residueOffset+t.residueCount-1,s(u,c))})),t.atomSetDict.backbone=n,gc&&mc.timeEnd("calculateBondsBetween")}function $p(t){if(t.unitcell){gc&&mc.time("buildUnitcellAssembly");var e=t.unitcell,i=t.center.clone().applyMatrix4(e.cartToFrac),r=function(t){var e=Cp[t],i={};if(void 0===e)return console.warn("getSymmetryOperations: spacegroup '"+t+"' not found in symop library"),i;for(var r=[],n=0,o=e.length;n<o;n+=3){for(var a=[],s=0;s<3;++s)a.push(Ep[e[n+s]]);r.push(a)}var c=/^[1-9]$/;return r.forEach((function(t){var e=0,r=(new N).set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1),n=r.elements;i[t]=r,t.forEach((function(t){for(var i=!1,r=!1,o=0,a=t.length;o<a;++o){var s=t[o];if("-"===s)i=!0;else if("+"===s)i=!1;else if("/"===s)r=!0;else if("X"===s)n[0+e]=i?-1:1;else if("Y"===s)n[4+e]=i?-1:1;else if("Z"===s)n[8+e]=i?-1:1;else if(c.test(s)){var u=parseInt(s);r?n[12+e]/=u:n[12+e]=u}else mc.warn('getSymmetryOperations: unknown token "'+s+'"')}e+=1}))})),i}(e.spacegroup),n=new O,o=new O,a=new O;i.x>1&&(n.x-=1),i.x<0&&(n.x+=1),i.y>1&&(n.y-=1),i.y<0&&(n.y+=1),i.z>1&&(n.z-=1),i.z<0&&(n.z+=1);var s,c=new Rp("UNITCELL"),u=m();if(t.biomolDict.NCS){s=[new N].concat(t.biomolDict.NCS.partList[0].matrixList);var h=[];u.forEach((function(t){s.forEach((function(e){h.push(t.clone().multiply(e))}))})),c.addPart(h)}else c.addPart(u);var l=new O,p=new Rp("SUPERCELL"),d=Array.prototype.concat.call(m(l.set(1,0,0)),m(l.set(0,1,0)),m(l.set(0,0,1)),m(l.set(-1,0,0)),m(l.set(0,-1,0)),m(l.set(0,0,-1)),m(l.set(1,1,0)),m(l.set(1,0,1)),m(l.set(0,1,1)),m(l.set(-1,-1,0)),m(l.set(-1,0,-1)),m(l.set(0,-1,-1)),m(l.set(1,-1,-1)),m(l.set(1,1,-1)),m(l.set(1,-1,1)),m(l.set(-1,1,1)),m(l.set(-1,-1,1)),m(l.set(-1,1,-1)),m(l.set(0,1,-1)),m(l.set(0,-1,1)),m(l.set(1,0,-1)),m(l.set(-1,0,1)),m(l.set(1,-1,0)),m(l.set(-1,1,0)),m(),m(l.set(1,1,1)),m(l.set(-1,-1,-1)));if(t.biomolDict.NCS){var f=[];d.forEach((function(t){s.forEach((function(e){f.push(t.clone().multiply(e))}))})),p.addPart(f)}else p.addPart(d);t.biomolDict.UNITCELL=c,t.biomolDict.SUPERCELL=p,gc&&mc.timeEnd("buildUnitcellAssembly")}function m(t){var s=[];return Object.keys(r).forEach((function(c){var u=r[c].clone();o.copy(i).applyMatrix4(u),a.setFromMatrixPosition(u),a.sub(n),o.x>1&&(a.x-=1),o.x<0&&(a.x+=1),o.y>1&&(a.y-=1),o.y<0&&(a.y+=1),o.z>1&&(a.z-=1),o.z<0&&(a.z+=1),t&&a.add(t),u.setPosition(a),u.multiplyMatrices(e.fracToCart,u),u.multiply(e.cartToFrac),s.push(u)})),s}}var Hp=["H","C","O","N","S","P"],Wp=["NA","CL","FE"];function Xp(t){var e=t.trim().toUpperCase();parseInt(e.charAt(0))&&(e=e.substr(1)),parseInt(e.charAt(0))&&(e=e.substr(1));var i=e.length;if(0===i)return"";if(1===i)return e;if(2===i){if(-1!==Wp.indexOf(e))return e;if(-1!==Hp.indexOf(e[0]))return e[0]}return i>=3&&-1!==Hp.indexOf(e[0])?e[0]:""}function qp(t){var e=t.bondHash,i=e.countArray,r=e.offsetArray,n=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=r[e],p=0,d=i[e];p<d;++p){o.index=n[l+p];var f=o.atomIndex1,m=o.atomIndex2;if(f>m){var g=m;m=f,f=g}var v=f+"|"+m;void 0===h[v]&&(h[v]=!0,s.push(f-a),c.push(m-a),u.push(o.bondOrder))}})),e.bonds={atomIndices1:s,atomIndices2:c,bondOrders:u}}}))}var Yp=function(t,e,i){this.structure=t,i=i||Xp(e),this.atomname=e,this.element=i,this.vdw=ml[i],this.covalent=gl[i]};var Zp=function(t){this.structure=t,this.dict={},this.list=[]};Zp.prototype.add=function(t,e){var i=function(t,e){return t+"|"+e}(t=t.toUpperCase(),e=e?e.toUpperCase():Xp(t)),r=this.dict[i];if(void 0===r){var n=new Yp(this.structure,t,e);r=this.list.length,this.dict[i]=r,this.list.push(n)}return r},Zp.prototype.get=function(t){return this.list[t]};var Kp=function(t,e,i,r,n,o){this.structure=t,this.resname=e,this.atomTypeIdList=i,this.hetero=r?1:0,this.chemCompType=n,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=Cl[this.backboneType],s=Cl[this.backboneStartType],c=Cl[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 p=this.getAtomIndexByName(s.backboneStart);this.backboneStartAtomIndex=void 0!==p?p:-1;var d,f=this.getAtomIndexByName(c.backboneEnd);this.backboneEndAtomIndex=void 0!==f?f:-1,d=Sl.includes(e)?this.getAtomIndexByName("N1"):this.getAtomIndexByName("N3"),this.rungEndAtomIndex=void 0!==d?d:-1,this.bondReferenceAtomIndices=[]};Kp.prototype.getBackboneIndexList=function(){var t,e=[];switch(this.moleculeType){case 3:t=Tl;break;case 4:case 5:t=El;break;default:return e}for(var i=this.structure.atomMap,r=this.atomTypeIdList,n=0,o=this.atomCount;n<o;++n){var a=i.get(r[n]);t.includes(a.atomname)&&e.push(n)}return e},Kp.prototype.getMoleculeType=function(){return this.isProtein()?3:this.isRna()?4:this.isDna()?5:this.isWater()?1:this.isIon()?2:this.isSaccharide()?6:0},Kp.prototype.getBackboneType=function(t){return this.hasProteinBackbone(t)?1:this.hasRnaBackbone(t)?2:this.hasDnaBackbone(t)?3:this.hasCgProteinBackbone(t)?4:this.hasCgRnaBackbone(t)?5:this.hasCgDnaBackbone(t)?6:0},Kp.prototype.isProtein=function(){return this.chemCompType?sl.includes(this.chemCompType):this.hasAtomWithName("CA","C","N")||xl.includes(this.resname)},Kp.prototype.isCg=function(){var t=this.backboneType;return 4===t||5===t||6===t},Kp.prototype.isNucleic=function(){return this.isRna()||this.isDna()},Kp.prototype.isRna=function(){return this.chemCompType?cl.includes(this.chemCompType):this.hasAtomWithName(["P","O3'","O3*"],["C4'","C4*"],["O2'","O2*","F2'","F2*"])||_l.includes(this.resname)&&this.hasAtomWithName(["O2'","O2*","F2'","F2*"])},Kp.prototype.isDna=function(){return this.chemCompType?ul.includes(this.chemCompType):this.hasAtomWithName(["P","O3'","O3*"],["C3'","C3*"])&&!this.hasAtomWithName(["O2'","O2*","F2'","F2*"])||wl.includes(this.resname)},Kp.prototype.isHetero=function(){return 1===this.hetero},Kp.prototype.isIon=function(){return Ml.includes(this.resname)},Kp.prototype.isWater=function(){return Al.includes(this.resname)},Kp.prototype.isSaccharide=function(){return this.chemCompType?hl.includes(this.chemCompType):Pl.includes(this.resname)},Kp.prototype.hasBackboneAtoms=function(t,e){var i=Cl[e];return-1===t?this.hasAtomWithName(i.trace,i.backboneEnd,i.direction1,i.direction2):0===t?this.hasAtomWithName(i.trace,i.direction1,i.direction2):1===t?this.hasAtomWithName(i.trace,i.backboneStart,i.direction1,i.direction2):this.hasAtomWithName(i.trace,i.backboneStart,i.backboneEnd,i.direction1,i.direction2)},Kp.prototype.hasProteinBackbone=function(t){return this.isProtein()&&this.hasBackboneAtoms(t,1)},Kp.prototype.hasRnaBackbone=function(t){return this.isRna()&&this.hasBackboneAtoms(t,2)},Kp.prototype.hasDnaBackbone=function(t){return this.isDna()&&this.hasBackboneAtoms(t,3)},Kp.prototype.hasCgProteinBackbone=function(t){return this.isProtein()&&this.hasBackboneAtoms(t,4)},Kp.prototype.hasCgRnaBackbone=function(t){return this.isRna()&&this.hasBackboneAtoms(t,5)},Kp.prototype.hasCgDnaBackbone=function(t){return this.isDna()&&this.hasBackboneAtoms(t,6)},Kp.prototype.hasBackbone=function(t){return this.hasProteinBackbone(t)||this.hasRnaBackbone(t)||this.hasDnaBackbone(t)||this.hasCgProteinBackbone(t)||this.hasCgRnaBackbone(t)||this.hasCgDnaBackbone(t)},Kp.prototype.getAtomIndexByName=function(t){var e=this.atomCount,i=this.structure.atomMap,r=this.atomTypeIdList;if(Array.isArray(t))for(var n=0;n<e;++n){var o=r[n];if(t.includes(i.get(o).atomname))return n}else for(var a=0;a<e;++a){var s=r[a];if(t===i.get(s).atomname)return a}},Kp.prototype.hasAtomWithName=function(){for(var t=arguments,e=this,i=arguments.length,r=0;r<i;++r)if(void 0!==t[r]&&void 0===e.getAtomIndexByName(t[r]))return!1;return!0},Kp.prototype.getBonds=function(t){return void 0===this.bonds&&(this.bonds=function(t){var e=t.structure,i=e.getAtomProxy(),r=e.getAtomProxy(),n=t.atomCount,o=t.atomOffset,a=o+n-1;if(!(n>500)){var s,c,u=[],h=[],l=[];if(n>50){var p=new Tp(t,!0),d=t.isCg()?1.2:2.3;for(s=o;s<a;++s){i.index=s;var f=i.covalent+d+.3,m=p.nearest(i,1/0,f*f),g=m.length;for(c=0;c<g;++c)r.index=m[c].index,i.index<r.index&&i.connectedTo(r)&&(u.push(i.index-o),h.push(r.index-o),l.push(1))}}else for(s=o;s<a;++s)for(i.index=s,c=s+1;c<=a;++c)r.index=c,i.connectedTo(r)&&(u.push(s-o),h.push(c-o),l.push(1));return{atomIndices1:u,atomIndices2:h,bondOrders:l}}gc&&mc.warn("more than 500 atoms, skip residue for auto-bonding",t.qualifiedName())}(t)),this.bonds},Kp.prototype.getRings=function(){return void 0===this.rings&&this.calculateRings(),this.rings},Kp.prototype.getBondGraph=function(){return void 0===this.bondGraph&&this.calculateBondGraph(),this.bondGraph},Kp.prototype.calculateBondGraph=function(){for(var t=this.bondGraph={},e=this.getBonds(),i=e.atomIndices1.length,r=e.atomIndices1,n=e.atomIndices2,o=0;o<i;++o){var a=r[o],s=n[o];(t[a]=t[a]||[]).push(s),(t[s]=t[s]||[]).push(a)}},Kp.prototype.calculateRings=function(){var t=this.getBondGraph(),e=new Int8Array(this.atomCount),i=new Int8Array(this.atomCount),r=[],n=[];function o(a,s,c){if(e[a])throw new Error("DFS revisited atom");e[a]=1,n.push(a);for(var u=s.length,h=0;h<u;++h){var l=s[h];if(0===e[l])t[l]&&t[l].length>=2?o(l,t[l],a):e[l]=2;else if(1===e[l]&&c&&c!==l){var p=[l];i[l]=1,r.push(p);for(var d=n.length-1;d>=0;--d){var f=n[d];if(f===l)break;p.push(f),i[f]=1}}}e[a]=2,n.pop()}for(var a=0;a<this.atomCount;++a)if(!e[a]){var s=t[a];!s||s.length<2?e[a]=2:(n.length=0,o(a,s))}this.rings={flags:i,rings:r}},Kp.prototype.assignBondReferenceAtomIndices=function(){var t=this.getBondGraph(),e=this.getRings(),i=e.flags,r=e.rings,n=this.bonds.atomIndices1,o=this.bonds.atomIndices2,a=this.bonds.bondOrders,s=this.bondReferenceAtomIndices,c=this.bonds.atomIndices1.length;s.length=0;for(var u=0;u<c;++u)if(!(a[u]<=1)){var h=n[u],l=o[u];if(i[h]&&i[l]){for(var p=0;p<r.length&&void 0===s[u];++p)for(var d=r[p],f=null,m=!1,g=0;g<d.length;++g){var v=d[g];if(v===h||v===l?m=!0:f=v,m&&null!==f){s[u]=f;break}}if(void 0!==s[u])continue}if(t[h].length>1)for(var y=0;y<t[h].length;++y){var b=t[h][y];if(b!==l){s[u]=b;break}}else if(t[l].length>1)for(var x=0;x<t[l].length;++x){var _=t[l][x];if(_!==h){s[u]=_;break}}else;}},Kp.prototype.getBondIndex=function(t,e){for(var i=this.bonds,r=i.atomIndices1,n=i.atomIndices2,o=r.indexOf(t),a=n.indexOf(e),s=a;-1!==o;){for(;-1!==a;){if(o===a)return o;a=n.indexOf(e,a+1)}o=r.indexOf(t,o+1),a=s}},Kp.prototype.getBondReferenceAtomIndex=function(t,e){var i=this.getBondIndex(t,e);if(void 0!==i)return 0===this.bondReferenceAtomIndices.length&&this.assignBondReferenceAtomIndices(),this.bondReferenceAtomIndices[i]};var Qp=function(t){this.structure=t,this.dict={},this.list=[]};Qp.prototype.add=function(t,e,i,r,n){var o=function(t,e,i,r){return t+"|"+e.join(",")+"|"+(i?1:0)+"|"+(r||"")}(t=t.toUpperCase(),e,i,r),a=this.dict[o];if(void 0===a){var s=new Kp(this.structure,t,e,i,r,n);a=this.list.length,this.dict[o]=a,this.list.push(s)}return a},Qp.prototype.get=function(t){return this.list[t]};var Jp=function(t,e){this.structure=t,this.bondStore=t.bondStore,this.index=e,this._v12=new O,this._v13=new O,this._ap1=this.structure.getAtomProxy(),this._ap2=this.structure.getAtomProxy(),this._ap3=this.structure.getAtomProxy()},td={atom1:{},atom2:{},atomIndex1:{},atomIndex2:{},bondOrder:{}};td.atom1.get=function(){return this.structure.getAtomProxy(this.atomIndex1)},td.atom2.get=function(){return this.structure.getAtomProxy(this.atomIndex2)},td.atomIndex1.get=function(){return this.bondStore.atomIndex1[this.index]},td.atomIndex1.set=function(t){this.bondStore.atomIndex1[this.index]=t},td.atomIndex2.get=function(){return this.bondStore.atomIndex2[this.index]},td.atomIndex2.set=function(t){this.bondStore.atomIndex2[this.index]=t},td.bondOrder.get=function(){return this.bondStore.bondOrder[this.index]},td.bondOrder.set=function(t){this.bondStore.bondOrder[this.index]=t},Jp.prototype.getReferenceAtomIndex=function(){var t=this._ap1,e=this._ap2;if(t.index=this.atomIndex1,e.index=this.atomIndex2,t.residueIndex===e.residueIndex){var i=t.index-t.residueAtomOffset,r=e.index-e.residueAtomOffset,n=t.residueType.getBondReferenceAtomIndex(i,r);if(void 0!==n)return n+t.residueAtomOffset;console.warn("No reference atom found",t.index,e.index)}},Jp.prototype.calculateShiftDir=function(t){t||(t=new O);var e=this._ap1,i=this._ap2,r=this._ap3,n=this._v12,o=this._v13;e.index=this.atomIndex1,i.index=this.atomIndex2;var a=this.getReferenceAtomIndex();n.subVectors(e,i).normalize(),void 0!==a?(r.index=a,o.subVectors(e,r)):o.copy(e),o.normalize();var s=n.dot(o);return 1-Math.abs(s)<1e-5&&(o.set(1,0,0),s=n.dot(o),1-Math.abs(s)<1e-5&&(o.set(0,1,0),s=n.dot(o))),t.copy(o.sub(n.multiplyScalar(s))).normalize()},Jp.prototype.qualifiedName=function(){return this.atomIndex1+"="+this.atomIndex2},Jp.prototype.clone=function(){return new this.constructor(this.structure,this.index)},Jp.prototype.toObject=function(){return{atomIndex1:this.atomIndex1,atomIndex2:this.atomIndex2,bondOrder:this.bondOrder}},Object.defineProperties(Jp.prototype,td);var ed=function(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},id={bondHash:{},entity:{},entityIndex:{},modelIndex:{},chainIndex:{},residue:{},residueIndex:{},sstruc:{},inscode:{},resno:{},chainname:{},chainid:{},residueType:{},atomType:{},residueAtomOffset:{},resname:{},hetero:{},atomname:{},element:{},vdw:{},covalent:{},x:{},y:{},z:{},serial:{},bfactor:{},occupancy:{},altloc:{}};id.bondHash.get=function(){return this.structure.bondHash},id.entity.get=function(){return this.structure.entityList[this.entityIndex]},id.entityIndex.get=function(){return this.chainStore.entityIndex[this.chainIndex]},id.modelIndex.get=function(){return this.chainStore.modelIndex[this.chainIndex]},id.chainIndex.get=function(){return this.residueStore.chainIndex[this.residueIndex]},id.residue.get=function(){return console.warn("residue - might be expensive"),this.structure.getResidueProxy(this.residueIndex)},id.residueIndex.get=function(){return this.atomStore.residueIndex[this.index]},id.residueIndex.set=function(t){this.atomStore.residueIndex[this.index]=t},id.sstruc.get=function(){return this.residueStore.getSstruc(this.residueIndex)},id.inscode.get=function(){return this.residueStore.getInscode(this.residueIndex)},id.resno.get=function(){return this.residueStore.resno[this.residueIndex]},id.chainname.get=function(){return this.chainStore.getChainname(this.chainIndex)},id.chainid.get=function(){return this.chainStore.getChainid(this.chainIndex)},id.residueType.get=function(){return this.residueMap.get(this.residueStore.residueTypeId[this.residueIndex])},id.atomType.get=function(){return this.atomMap.get(this.atomStore.atomTypeId[this.index])},id.residueAtomOffset.get=function(){return this.residueStore.atomOffset[this.residueIndex]},id.resname.get=function(){return this.residueType.resname},id.hetero.get=function(){return this.residueType.hetero},id.atomname.get=function(){return this.atomType.atomname},id.element.get=function(){return this.atomType.element},id.vdw.get=function(){return this.atomType.vdw},id.covalent.get=function(){return this.atomType.covalent},id.x.get=function(){return this.atomStore.x[this.index]},id.x.set=function(t){this.atomStore.x[this.index]=t},id.y.get=function(){return this.atomStore.y[this.index]},id.y.set=function(t){this.atomStore.y[this.index]=t},id.z.get=function(){return this.atomStore.z[this.index]},id.z.set=function(t){this.atomStore.z[this.index]=t},id.serial.get=function(){return this.atomStore.serial[this.index]},id.serial.set=function(t){this.atomStore.serial[this.index]=t},id.bfactor.get=function(){return this.atomStore.bfactor[this.index]},id.bfactor.set=function(t){this.atomStore.bfactor[this.index]=t},id.occupancy.get=function(){return this.atomStore.occupancy[this.index]},id.occupancy.set=function(t){this.atomStore.occupancy[this.index]=t},id.altloc.get=function(){return this.atomStore.getAltloc(this.index)},id.altloc.set=function(t){this.atomStore.setAltloc(this.index,t)},ed.prototype.eachBond=function(t,e){e=e||this.structure._bp;for(var i=this.index,r=this.bondHash,n=r.indexArray,o=r.countArray[i],a=r.offsetArray[i],s=0;s<o;++s)e.index=n[a+s],t(e)},ed.prototype.eachBondedAtom=function(t,e){e=e||this.structure._ap;var i=this.index;this.eachBond((function(r){i!==r.atomIndex1?e.index=r.atomIndex1:e.index=r.atomIndex2,t(e)}))},ed.prototype.isBackbone=function(){var t=this.residueType.backboneIndexList;if(t.length>0){var e=this.residueStore.atomOffset[this.residueIndex];return t.includes(this.index-e)}return!1},ed.prototype.isPolymer=function(){if(this.structure.entityList.length>0)return this.entity.isPolymer();var t=this.residueType.moleculeType;return 3===t||4===t||5===t},ed.prototype.isSidechain=function(){return this.isPolymer()&&!this.isBackbone()},ed.prototype.isCg=function(){var t=this.residueType.backboneType;return 4===t||5===t||6===t},ed.prototype.isHetero=function(){return 1===this.residueType.hetero},ed.prototype.isProtein=function(){return 3===this.residueType.moleculeType},ed.prototype.isNucleic=function(){var t=this.residueType.moleculeType;return 4===t||5===t},ed.prototype.isRna=function(){return 4===this.residueType.moleculeType},ed.prototype.isDna=function(){return 5===this.residueType.moleculeType},ed.prototype.isWater=function(){return 1===this.residueType.moleculeType},ed.prototype.isIon=function(){return 2===this.residueType.moleculeType},ed.prototype.isSaccharide=function(){return 6===this.residueType.moleculeType},ed.prototype.isHelix=function(){return pl.includes(this.sstruc)},ed.prototype.isSheet=function(){return dl.includes(this.sstruc)},ed.prototype.isTurn=function(){return fl.includes(this.sstruc)&&this.isProtein()},ed.prototype.isBonded=function(){return 0!==this.bondHash.countArray[this.index]},ed.prototype.isRing=function(){return 1===this.residueType.getRings().flags[this.index-this.residueAtomOffset]},ed.prototype.distanceTo=function(t){var e=this.atomStore,i=t.atomStore,r=this.index,n=t.index,o=e.x[r]-i.x[n],a=e.y[r]-i.y[n],s=e.z[r]-i.z[n],c=o*o+a*a+s*s;return Math.sqrt(c)},ed.prototype.connectedTo=function(t){var e=this.atomStore,i=t.atomStore,r=this.index,n=t.index;if(e.altloc&&i.altloc){var o=e.altloc[r],a=i.altloc[n];if(0!==o&&0!==a&&32!==o&&32!==a&&o!==a)return!1}var s=e.x[r]-i.x[n],c=e.y[r]-i.y[n],u=e.z[r]-i.z[n],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,p=l+.3,d=l-.5;return h<p*p&&h>d*d},ed.prototype.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},ed.prototype.positionToArray=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.index,r=this.atomStore;return t[e+0]=r.x[i],t[e+1]=r.y[i],t[e+2]=r.z[i],t},ed.prototype.positionToVector3=function(t){return void 0===t&&(t=new O),t.x=this.x,t.y=this.y,t.z=this.z,t},ed.prototype.positionFromVector3=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},ed.prototype.getResidueBonds=function(t){var e,i,r,n,o=this.residueAtomOffset,a=this.index-this.residueAtomOffset,s=this.residueType.getBonds(),c=s.atomIndices1,u=s.atomIndices2;for(t||(n=[]),e=c.indexOf(a);-1!==e;){if(r=u[e]+o,t)return r;n.push(r),e=c.indexOf(a,e+1)}for(i=u.indexOf(a);-1!==i;){if(r=c[i]+o,t)return r;n.push(r),i=u.indexOf(a,i+1)}return n},ed.prototype.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},ed.prototype.clone=function(){return new this.constructor(this.structure,this.index)},ed.prototype.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}},Object.defineProperties(ed.prototype,id);var rd=function(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},nd={entity:{},entityIndex:{},chain:{},chainIndex:{},atomOffset:{},atomCount:{},atomEnd:{},modelIndex:{},chainname:{},chainid:{},resno:{},sstruc:{},inscode:{},residueType:{},resname:{},hetero:{},moleculeType:{},backboneType:{},backboneStartType:{},backboneEndType:{},traceAtomIndex:{},direction1AtomIndex:{},direction2AtomIndex:{},backboneStartAtomIndex:{},backboneEndAtomIndex:{},rungEndAtomIndex:{}};nd.entity.get=function(){return this.structure.entityList[this.entityIndex]},nd.entityIndex.get=function(){return this.chainStore.entityIndex[this.chainIndex]},nd.chain.get=function(){return this.structure.getChainProxy(this.chainIndex)},nd.chainIndex.get=function(){return this.residueStore.chainIndex[this.index]},nd.chainIndex.set=function(t){this.residueStore.chainIndex[this.index]=t},nd.atomOffset.get=function(){return this.residueStore.atomOffset[this.index]},nd.atomOffset.set=function(t){this.residueStore.atomOffset[this.index]=t},nd.atomCount.get=function(){return this.residueStore.atomCount[this.index]},nd.atomCount.set=function(t){this.residueStore.atomCount[this.index]=t},nd.atomEnd.get=function(){return this.atomOffset+this.atomCount-1},nd.modelIndex.get=function(){return this.chainStore.modelIndex[this.chainIndex]},nd.chainname.get=function(){return this.chainStore.getChainname(this.chainIndex)},nd.chainid.get=function(){return this.chainStore.getChainid(this.chainIndex)},nd.resno.get=function(){return this.residueStore.resno[this.index]},nd.resno.set=function(t){this.residueStore.resno[this.index]=t},nd.sstruc.get=function(){return this.residueStore.getSstruc(this.index)},nd.sstruc.set=function(t){this.residueStore.setSstruc(this.index,t)},nd.inscode.get=function(){return this.residueStore.getInscode(this.index)},nd.inscode.set=function(t){this.residueStore.getInscode(this.index,t)},nd.residueType.get=function(){return this.residueMap.get(this.residueStore.residueTypeId[this.index])},nd.resname.get=function(){return this.residueType.resname},nd.hetero.get=function(){return this.residueType.hetero},nd.moleculeType.get=function(){return this.residueType.moleculeType},nd.backboneType.get=function(){return this.residueType.backboneType},nd.backboneStartType.get=function(){return this.residueType.backboneStartType},nd.backboneEndType.get=function(){return this.residueType.backboneEndType},nd.traceAtomIndex.get=function(){return this.residueType.traceAtomIndex+this.atomOffset},nd.direction1AtomIndex.get=function(){return this.residueType.direction1AtomIndex+this.atomOffset},nd.direction2AtomIndex.get=function(){return this.residueType.direction2AtomIndex+this.atomOffset},nd.backboneStartAtomIndex.get=function(){return this.residueType.backboneStartAtomIndex+this.atomOffset},nd.backboneEndAtomIndex.get=function(){return this.residueType.backboneEndAtomIndex+this.atomOffset},nd.rungEndAtomIndex.get=function(){return this.residueType.rungEndAtomIndex+this.atomOffset},rd.prototype.eachAtom=function(t,e){var i,r=this.atomCount,n=this.atomOffset,o=this.structure._ap,a=n+r;if(e&&e.atomOnlyTest){var s=e.atomOnlyTest;for(i=n;i<a;++i)o.index=i,s(o)&&t(o)}else for(i=n;i<a;++i)o.index=i,t(o)},rd.prototype.isProtein=function(){return 3===this.residueType.moleculeType},rd.prototype.isNucleic=function(){var t=this.residueType.moleculeType;return 4===t||5===t},rd.prototype.isRna=function(){return 4===this.residueType.moleculeType},rd.prototype.isDna=function(){return 5===this.residueType.moleculeType},rd.prototype.isCg=function(){var t=this.residueType.backboneType;return 4===t||5===t||6===t},rd.prototype.isPolymer=function(){if(this.structure.entityList.length>0)return this.entity.isPolymer();var t=this.residueType.moleculeType;return 3===t||4===t||5===t},rd.prototype.isHetero=function(){return 1===this.residueType.hetero},rd.prototype.isWater=function(){return 1===this.residueType.moleculeType},rd.prototype.isIon=function(){return 2===this.residueType.moleculeType},rd.prototype.isSaccharide=function(){return 6===this.residueType.moleculeType},rd.prototype.isHelix=function(){return pl.includes(this.sstruc)},rd.prototype.isSheet=function(){return dl.includes(this.sstruc)},rd.prototype.isTurn=function(){return fl.includes(this.sstruc)&&this.isProtein()},rd.prototype.getAtomType=function(t){return this.atomMap.get(this.atomStore.atomTypeId[t])},rd.prototype.getResname1=function(){return bl[this.resname.toUpperCase()]||"X"},rd.prototype.getBackboneType=function(t){switch(t){case-1:return this.residueType.backboneStartType;case 1:return this.residueType.backboneEndType;default:return this.residueType.backboneType}},rd.prototype.getAtomIndexByName=function(t){var e=this.residueType.getAtomIndexByName(t);return void 0!==e&&(e+=this.atomOffset),e},rd.prototype.getAtomByName=function(t){return this.residueType.getAtomByName(t)},rd.prototype.hasAtomWithName=function(t){return this.residueType.hasAtomWithName(t)},rd.prototype.getAtomnameList=function(){console.warn("getAtomnameList - might be expensive");for(var t=this.atomCount,e=this.atomOffset,i=new Array(t),r=0;r<t;++r)i[r]=this.getAtomType(e+r).atomname;return i},rd.prototype.connectedTo=function(t){var e=this.structure.getAtomProxy(this.backboneEndAtomIndex),i=this.structure.getAtomProxy(t.backboneStartAtomIndex);return!(!e||!i)&&e.connectedTo(i)},rd.prototype.getNextConnectedResidue=function(){var t=this.chainStore.residueOffset[this.chainIndex],e=this.chainStore.residueCount[this.chainIndex],i=this.index+1;if(i<t+e){var r=this.structure.getResidueProxy(i);if(this.connectedTo(r))return r}else if(i===t+e){var n=this.structure.getResidueProxy(t);if(this.connectedTo(n))return n}},rd.prototype.getPreviousConnectedResidue=function(){var t=this.chainStore.residueOffset[this.chainIndex],e=this.index-1;if(e>=t){var i=this.structure.getResidueProxy(e);if(i.connectedTo(this))return i}else if(e===t-1){var r=this.chainStore.residueCount[this.chainIndex],n=this.structure.getResidueProxy(t+r-1);if(n.connectedTo(this))return n}},rd.prototype.getBonds=function(){return this.residueType.getBonds(this)},rd.prototype.getRings=function(){return this.residueType.getRings()},rd.prototype.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},rd.prototype.clone=function(){return new this.constructor(this.structure,this.index)},rd.prototype.toObject=function(){return{index:this.index,chainIndex:this.chainIndex,atomOffset:this.atomOffset,atomCount:this.atomCount,resno:this.resno,resname:this.resname,sstruc:this.sstruc}},Object.defineProperties(rd.prototype,nd);var od=function(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 r=this.structure.getResidueProxy(this.residueIndexStart),n=this.structure.getResidueProxy(this.residueIndexEnd);this.isPrevConnected=void 0!==r.getPreviousConnectedResidue();var o=n.getNextConnectedResidue();this.isNextConnected=void 0!==o,this.isNextNextConnected=this.isNextConnected&&void 0!==o.getNextConnectedResidue(),this.isCyclic=n.connectedTo(r),this.__residueProxy=this.structure.getResidueProxy()},ad={chainIndex:{},modelIndex:{},chainname:{}};ad.chainIndex.get=function(){return this.residueStore.chainIndex[this.residueIndexStart]},ad.modelIndex.get=function(){return this.chainStore.modelIndex[this.chainIndex]},ad.chainname.get=function(){return this.chainStore.getChainname(this.chainIndex)},od.prototype.isProtein=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isProtein()},od.prototype.isCg=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isCg()},od.prototype.isNucleic=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isNucleic()},od.prototype.getMoleculeType=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.moleculeType},od.prototype.getBackboneType=function(t){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.getBackboneType(t)},od.prototype.getAtomIndexByType=function(t,e){this.isCyclic?-1===t?t=this.residueCount-1:t===this.residueCount&&(t=0):(-1!==t||this.isPrevConnected||(t+=1),t!==this.residueCount||this.isNextNextConnected||(t-=1));var i,r=this.__residueProxy;switch(r.index=this.residueIndexStart+t,e){case"trace":i=r.traceAtomIndex;break;case"direction1":i=r.direction1AtomIndex;break;case"direction2":i=r.direction2AtomIndex;break;default:var n=r.getAtomByName(e);i=n?n.index:void 0}return i},od.prototype.eachAtom=function(t,e){this.eachResidue((function(i){i.eachAtom(t,e)}),e)},od.prototype.eachAtomN=function(t,e,i){var r,n=this.residueCount,o=new Array(t);for(r=0;r<t;++r)o[r]=this.structure.getAtomProxy(this.getAtomIndexByType(r,i));e.apply(this,o);for(var a=t;a<n;++a){for(r=1;r<t;++r)o[r-1].index=o[r].index;o[t-1].index=this.getAtomIndexByType(a,i),e.apply(this,o)}},od.prototype.eachAtomN2=function(t,e,i){var r=this.atomOffset,n=this.atomCount,o=r+n;if(!(n<t)){for(var a=new Array(t),s=0;s<t;++s)a[s]=this.structure.getAtomProxy();var c=this.structure.atomSetCache["__"+i];void 0===c&&(mc.warn("no precomputed atomSet for: "+i),c=this.structure.getAtomSet(!1),this.eachResidue((function(t){var e=t.getAtomByName(i);c.set(e.index)})));var u=0;c.forEach((function(i){if(i>=r&&i<o){for(var n=1;n<t;++n)a[n-1].index=a[n].index;a[t-1].index=i,(u+=1)>=t&&e.apply(this,a)}}))}},od.prototype.eachResidue=function(t){for(var e=this.structure.getResidueProxy(),i=this.residueCount,r=this.residueIndexStart,n=0;n<i;++n)e.index=r+n,t(e)},od.prototype.qualifiedName=function(){var t=this.structure.getResidueProxy(this.residueIndexStart),e=this.structure.getResidueProxy(this.residueIndexEnd);return t.qualifiedName()+" - "+e.qualifiedName()},Object.defineProperties(od.prototype,ad);var sd=function(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.index=e},cd={entity:{},model:{},entityIndex:{},modelIndex:{},residueOffset:{},residueCount:{},residueEnd:{},atomOffset:{},atomEnd:{},atomCount:{},chainname:{},chainid:{}};cd.entity.get=function(){return this.structure.entityList[this.entityIndex]},cd.model.get=function(){return this.structure.getModelProxy(this.modelIndex)},cd.entityIndex.get=function(){return this.chainStore.entityIndex[this.index]},cd.entityIndex.set=function(t){this.chainStore.entityIndex[this.index]=t},cd.modelIndex.get=function(){return this.chainStore.modelIndex[this.index]},cd.modelIndex.set=function(t){this.chainStore.modelIndex[this.index]=t},cd.residueOffset.get=function(){return this.chainStore.residueOffset[this.index]},cd.residueOffset.set=function(t){this.chainStore.residueOffset[this.index]=t},cd.residueCount.get=function(){return this.chainStore.residueCount[this.index]},cd.residueCount.set=function(t){this.chainStore.residueCount[this.index]=t},cd.residueEnd.get=function(){return this.residueOffset+this.residueCount-1},cd.atomOffset.get=function(){return this.residueStore.atomOffset[this.residueOffset]},cd.atomEnd.get=function(){return this.residueStore.atomOffset[this.residueEnd]+this.residueStore.atomCount[this.residueEnd]-1},cd.atomCount.get=function(){return 0===this.residueCount?0:this.atomEnd-this.atomOffset+1},cd.chainname.get=function(){return this.chainStore.getChainname(this.index)},cd.chainname.set=function(t){this.chainStore.setChainname(this.index,t)},cd.chainid.get=function(){return this.chainStore.getChainid(this.index)},cd.chainid.set=function(t){this.chainStore.setChainid(this.index,t)},sd.prototype.eachAtom=function(t,e){this.eachResidue((function(i){i.eachAtom(t,e)}),e)},sd.prototype.eachResidue=function(t,e){var i,r=this.residueCount,n=this.residueOffset,o=this.structure._rp,a=n+r;if(e&&e.test){var s=e.residueOnlyTest;if(s)for(i=n;i<a;++i)o.index=i,s(o)&&t(o,e);else for(i=n;i<a;++i)o.index=i,t(o,e)}else for(i=n;i<a;++i)o.index=i,t(o)},sd.prototype.eachResidueN=function(t,e){var i,r=this.residueCount,n=this.residueOffset,o=n+r;if(!(r<t)){var a=new Array(t);for(i=0;i<t;++i)a[i]=this.structure.getResidueProxy(n+i);e.apply(this,a);for(var s=n+t;s<o;++s){for(i=0;i<t;++i)a[i].index+=1;e.apply(this,a)}}},sd.prototype.eachPolymer=function(t,e){for(var i,r,n=e?e.residueOnlyTest:void 0,o=this.model.structure,a=this.residueCount,s=this.residueOffset,c=s+a,u=this.structure.getResidueProxy(),h=this.structure.getResidueProxy(s),l=this.structure.getAtomProxy(),p=this.structure.getAtomProxy(),d=!0,f=s+1;f<c;++f){u.index=h.index,h.index=f,d&&(i=u.index,d=!1),r=h.index;var m=d?u.backboneEndType:u.backboneType,g=h.backboneType;0!==m&&m===g?(l.index=u.backboneEndAtomIndex,p.index=h.backboneStartAtomIndex,l&&p&&l.connectedTo(p)&&(!n||n(u)&&n(h))||(u.index-i>1&&t(new od(o,i,u.index)),i=r)):(0!==m&&u.index-i>1&&t(new od(o,i,u.index)),i=r)}r-i>1&&this.structure.getResidueProxy(i).backboneStartType&&t(new od(o,i,r))},sd.prototype.qualifiedName=function(){return":"+this.chainname+"/"+this.modelIndex},sd.prototype.clone=function(){return new this.constructor(this.structure,this.index)},sd.prototype.toObject=function(){return{index:this.index,residueOffset:this.residueOffset,residueCount:this.residueCount,chainname:this.chainname}},Object.defineProperties(sd.prototype,cd);var ud=function(t,e){this.structure=t,this.modelStore=t.modelStore,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.index=e},hd={chainOffset:{},chainCount:{},residueOffset:{},atomOffset:{},chainEnd:{},residueEnd:{},atomEnd:{},residueCount:{},atomCount:{}};hd.chainOffset.get=function(){return this.modelStore.chainOffset[this.index]},hd.chainOffset.set=function(t){this.modelStore.chainOffset[this.index]=t},hd.chainCount.get=function(){return this.modelStore.chainCount[this.index]},hd.chainCount.set=function(t){this.modelStore.chainCount[this.index]=t},hd.residueOffset.get=function(){return this.chainStore.residueOffset[this.chainOffset]},hd.atomOffset.get=function(){return this.residueStore.atomOffset[this.residueOffset]},hd.chainEnd.get=function(){return this.chainOffset+this.chainCount-1},hd.residueEnd.get=function(){return this.chainStore.residueOffset[this.chainEnd]+this.chainStore.residueCount[this.chainEnd]-1},hd.atomEnd.get=function(){return this.residueStore.atomOffset[this.residueEnd]+this.residueStore.atomCount[this.residueEnd]-1},hd.residueCount.get=function(){return 0===this.chainCount?0:this.residueEnd-this.residueOffset+1},hd.atomCount.get=function(){return 0===this.residueCount?0:this.atomEnd-this.atomOffset+1},ud.prototype.eachAtom=function(t,e){this.eachChain((function(i){i.eachAtom(t,e)}),e)},ud.prototype.eachResidue=function(t,e){this.eachChain((function(i){i.eachResidue(t,e)}),e)},ud.prototype.eachPolymer=function(t,e){if(e&&e.chainOnlyTest){var i=e.chainOnlyTest;this.eachChain((function(r){i(r)&&r.eachPolymer(t,e)}))}else this.eachChain((function(i){i.eachPolymer(t,e)}))},ud.prototype.eachChain=function(t,e){var i,r=this.chainCount,n=this.chainOffset,o=this.structure._cp,a=n+r;if(e&&e.test){var s=e.chainOnlyTest;if(s)for(i=n;i<a;++i)o.index=i,s(o)&&t(o,e);else for(i=n;i<a;++i)o.index=i,t(o,e)}else for(i=n;i<a;++i)o.index=i,t(o)},ud.prototype.qualifiedName=function(){return"/"+this.index},ud.prototype.clone=function(){return new this.constructor(this.structure,this.index)},ud.prototype.toObject=function(){return{index:this.index,chainOffset:this.chainOffset,chainCount:this.chainCount}},Object.defineProperties(ud.prototype,hd);var ld=function(t,e){this.signals={refreshed:new Fs},this.init(t,e)},pd={type:{}};function dd(t,e){var i=[],r=!1;if(e){for(var n=0,o=e.length;n<o;++n)i.push(e[n]);a()}function a(){var e=i.shift();void 0!==e?(r=!0,setTimeout((function(){!function(e){t(e,a)}(e)}))):r=!1}this.push=function(t){i.push(t),r||a()},this.kill=function(){i.length=0},this.length=function(){return i.length}}ld.prototype.init=function(t,e){this.name=t,this.path=e,this.title="",this.id="",this.header={},this.extraData={},this.atomSetCache=void 0,this.atomSetDict={},this.biomolDict={},this.entityList=[],this.unitcell=void 0,this.frames=[],this.boxes=[],this.validation=void 0,this.bondStore=new yp(0),this.backboneBondStore=new yp(0),this.rungBondStore=new yp(0),this.atomStore=new bp(0),this.residueStore=new xp(0),this.chainStore=new _p(0),this.modelStore=new wp(0),this.atomMap=new Zp(this),this.residueMap=new Qp(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()},pd.type.get=function(){return"Structure"},ld.prototype.finalizeAtoms=function(){this.atomSet=this.getAtomSet(),this.atomCount=this.atomStore.count,this.boundingBox=this.getBoundingBox(),this.center=this.boundingBox.getCenter(),this.spatialHash=new Kl(this.atomStore,this.boundingBox)},ld.prototype.finalizeBonds=function(){for(var t in this.bondSet=this.getBondSet(),this.bondCount=this.bondStore.count,this.bondHash=new mp(this.bondStore,this.atomStore.count),this.atomSetCache={},this.atomSetDict.rung||(this.atomSetDict.rung=this.getAtomSet(!1)),this.atomSetDict)this.atomSetCache["__"+t]=this.atomSetDict[t].clone()},ld.prototype.getBondProxy=function(t){return new Jp(this,t)},ld.prototype.getAtomProxy=function(t){return new ed(this,t)},ld.prototype.getResidueProxy=function(t){return new rd(this,t)},ld.prototype.getChainProxy=function(t){return new sd(this,t)},ld.prototype.getModelProxy=function(t){return new ud(this,t)},ld.prototype.getBondSet=function(){var t=this.bondStore.count,e=new al(t),i=this.atomSet;if(i)for(var r=this.getBondProxy(),n=0;n<t;++n)r.index=n,i.isSet(r.atomIndex1,r.atomIndex2)&&e.set(r.index);else e.setAll();return e},ld.prototype.getBackboneBondSet=function(){var t=this.backboneBondStore.count,e=new al(t),i=this.atomSetCache.__backbone;if(i){var r=this.getBondProxy();r.bondStore=this.backboneBondStore;for(var n=0;n<t;++n)r.index=n,i.isSet(r.atomIndex1,r.atomIndex2)&&e.set(r.index)}else e.set_all(!0);return e},ld.prototype.getRungBondSet=function(){var t=this.rungBondStore.count,e=new al(t),i=this.atomSetCache.__rung;if(i){var r=this.getBondProxy();r.bondStore=this.rungBondStore;for(var n=0;n<t;++n)r.index=n,i.isSet(r.atomIndex1,r.atomIndex2)&&e.set(r.index)}else e.set_all(!0);return e},ld.prototype.getAtomSet=function(t){var e,i=this.atomStore.count;if(t instanceof al)e=t;else if(t&&t.test){var r=t.string;r in this.atomSetCache?e=this.atomSetCache[r]:(e=new al(i),this.eachAtom((function(t){e.set(t.index)}),t),this.atomSetCache[r]=e)}else e=!1===t?new al(i):new al(i,!0);return e},ld.prototype.getAtomSetWithinSelection=function(t,e){var i=this.spatialHash,r=this.getAtomSet(!1),n=this.getAtomProxy();return this.getAtomSet(t).forEach((function(t){n.index=t,i.within(n.x,n.y,n.z,e).forEach((function(t){r.set(t)}))})),r},ld.prototype.getAtomSetWithinPoint=function(t,e){var i=t,r=this.getAtomSet(!1);return this.spatialHash.within(i.x,i.y,i.z,e).forEach((function(t){r.set(t)})),r},ld.prototype.getAtomSetWithinVolume=function(t,e,i,r,n){for(var o=new dp(t,i,r,n),a=o.getDataPosition(),s=a.length,c=o.matrix.getMaxScaleOnAxis(),u=this.getAtomSet(!1),h=0;h<s;h+=3)this.spatialHash.within(a[h],a[h+1],a[h+2],c).forEach((function(t){u.set(t)}));return u},ld.prototype.getAtomSetWithinGroup=function(t){var e=this.atomStore.residueIndex,i=this.getAtomSet(!1),r=this.getResidueProxy();return this.getAtomSet(t).forEach((function(t){r.index=e[t];for(var n=r.atomOffset;n<=r.atomEnd;++n)i.set(n)})),i},ld.prototype.getSelection=function(){return!1},ld.prototype.getStructure=function(){return this},ld.prototype.eachEntity=function(t,e){this.entityList.forEach((function(i){void 0!==e&&i.getEntityType()!==e||t(i)}))},ld.prototype.eachBond=function(t,e){var i,r=this.getBondProxy();if(e&&e.test&&(i=this.getBondSet(e),this.bondSet&&i.intersection(this.bondSet)),i)i.forEach((function(e){r.index=e,t(r)}));else for(var n=this.bondStore.count,o=0;o<n;++o)r.index=o,t(r)},ld.prototype.eachAtom=function(t,e){if(e&&e.test)this.eachModel((function(i){i.eachAtom(t,e)}),e);else for(var i=this.atomStore.count,r=this.getAtomProxy(),n=0;n<i;++n)r.index=n,t(r)},ld.prototype.eachResidue=function(t,e){var i;if(e&&e.test){var r=this.modelStore.count,n=this.getModelProxy(),o=e.modelOnlyTest;if(o)for(i=0;i<r;++i)n.index=i,o(n)&&n.eachResidue(t,e);else for(i=0;i<r;++i)n.index=i,n.eachResidue(t,e)}else{var a=this.residueStore.count,s=this.getResidueProxy();for(i=0;i<a;++i)s.index=i,t(s)}},ld.prototype.eachResidueN=function(t,e){var i,r,n=this.residueStore.count;if(!(n<t)){var o=new Array(t);for(i=0;i<t;++i)o[i]=this.getResidueProxy(i);for(e.apply(this,o),r=t;r<n;++r){for(i=0;i<t;++i)o[i].index+=1;e.apply(this,o)}}},ld.prototype.eachPolymer=function(t,e){if(e&&e.modelOnlyTest){var i=e.modelOnlyTest;this.eachModel((function(r){i(r)&&r.eachPolymer(t,e)}))}else this.eachModel((function(i){i.eachPolymer(t,e)}))},ld.prototype.eachChain=function(t,e){if(e&&e.test)this.eachModel((function(i){i.eachChain(t,e)}));else for(var i=this.chainStore.count,r=this.getChainProxy(),n=0;n<i;++n)r.index=n,t(r)},ld.prototype.eachModel=function(t,e){var i,r=this.modelStore.count,n=this.getModelProxy();if(e&&e.test){var o=e.modelOnlyTest;if(o)for(i=0;i<r;++i)n.index=i,o(n)&&t(n,e);else for(i=0;i<r;++i)n.index=i,t(n,e)}else for(i=0;i<r;++i)n.index=i,t(n)},ld.prototype.getAtomData=function(t){var e=Object.assign({},t);e.colorParams&&(e.colorParams.structure=this.getStructure());var i,r,n,o,a,s,c,u=e.what,h=Eo(e.atomSet,this.atomSet),l={},p=this.getAtomProxy(),d=h.getSize();return u&&!u.position||(n=new Float32Array(3*d),l.position=n),u&&!u.color||(o=new Float32Array(3*d),l.color=o,r=yc.getScheme(e.colorParams)),u&&!u.picking||(a=new Float32Array(d),l.picking=new $h(a,this.getStructure())),u&&!u.radius||(s=new Float32Array(d),l.radius=s,i=new Il(e.radiusParams.radius,e.radiusParams.scale)),u&&!u.index||(c=new Float32Array(d),l.index=c),h.forEach((function(t,e){var u=3*e;p.index=t,n&&p.positionToArray(n,u),o&&r.atomColorToArray(p,o,u),a&&(a[e]=t),s&&(s[e]=i.atomRadius(p)),c&&(c[e]=t)})),l},ld.prototype.getBondData=function(t){var e=Object.assign({},t);e.colorParams&&(e.colorParams.structure=this.getStructure());var i,r,n,o,a,s,c,u,h,l=e.what,p=Eo(e.bondSet,this.bondSet),d=Eo(e.multipleBond,"off"),f="off"!==d,m="offset"===d,g=Eo(e.bondScale,.4),v=Eo(e.bondSpacing,1),y={},b=this.getBondProxy();e.bondStore&&(b.bondStore=e.bondStore);var x,_=this.getAtomProxy(),w=this.getAtomProxy();if(f){var S=b.bondStore.bondOrder;x=0,p.forEach((function(t){x+=S[t]}))}else x=p.getSize();l&&!l.position||(n=new Float32Array(3*x),o=new Float32Array(3*x),y.position1=n,y.position2=o),l&&!l.color||(a=new Float32Array(3*x),s=new Float32Array(3*x),y.color=a,y.color2=s,r=yc.getScheme(e.colorParams)),l&&!l.picking||(c=new Float32Array(x),y.picking=new Wh(c,this.getStructure(),e.bondStore)),(!l||l.radius||f&&l.position)&&(i=new Il(e.radiusParams.radius,e.radiusParams.scale)),l&&!l.radius||(u=new Float32Array(x),y.radius=u,e.radius2&&(h=new Float32Array(x),y.radius2=h));var A,M,P,T,E,C,I,R=0,L=new O,N=new O,D=new O;return p.forEach((function(t){if(M=3*R,b.index=t,_.index=b.atomIndex1,w.index=b.atomIndex2,T=b.bondOrder,n&&(f&&T>1?(E=i.atomRadius(_),C=E*g/(.5*T),b.calculateShiftDir(D),m?(I=2*v*E,D.multiplyScalar(I),D.negate(),N.subVectors(w,_).multiplyScalar(Math.max(.1,I/1.88)),_.positionToArray(n,M),w.positionToArray(o,M),T>=2&&(L.addVectors(_,D).add(N).toArray(n,M+3),L.addVectors(w,D).sub(N).toArray(o,M+3),T>=3&&(L.subVectors(_,D).add(N).toArray(n,M+6),L.subVectors(w,D).sub(N).toArray(o,M+6)))):(I=(v-g)*E,D.multiplyScalar(I),2===T?(L.addVectors(_,D).toArray(n,M),L.subVectors(_,D).toArray(n,M+3),L.addVectors(w,D).toArray(o,M),L.subVectors(w,D).toArray(o,M+3)):3===T?(_.positionToArray(n,M),L.addVectors(_,D).toArray(n,M+3),L.subVectors(_,D).toArray(n,M+6),w.positionToArray(o,M),L.addVectors(w,D).toArray(o,M+3),L.subVectors(w,D).toArray(o,M+6)):(_.positionToArray(n,M),w.positionToArray(o,M)))):(_.positionToArray(n,M),w.positionToArray(o,M))),a&&(r.bondColorToArray(b,1,a,M),r.bondColorToArray(b,0,s,M),f&&T>1))for(A=1;A<T;++A)hu(a,M,P=3*A+M,3),hu(s,M,P,3);if(c&&(c[R]=t,f&&T>1))for(A=1;A<T;++A)c[R+A]=t;if(u&&(u[R]=i.atomRadius(_),f&&T>1))for(C=u[R]*g/(m?1:.5*T),A=m?1:0;A<T;++A)u[R+A]=C;if(h&&(h[R]=i.atomRadius(w),f&&T>1))for(C=h[R]*g/(m?1:.5*T),A=m?1:0;A<T;++A)h[R+A]=C;R+=f?T:1})),y},ld.prototype.getBackboneAtomData=function(t){return t=Object.assign({atomSet:this.atomSetCache.__backbone},t),this.getAtomData(t)},ld.prototype.getBackboneBondData=function(t){return t=Object.assign({bondSet:this.getBackboneBondSet(),bondStore:this.backboneBondStore},t),this.getBondData(t)},ld.prototype.getRungAtomData=function(t){return t=Object.assign({atomSet:this.atomSetCache.__rung},t),this.getAtomData(t)},ld.prototype.getRungBondData=function(t){return t=Object.assign({bondSet:this.getRungBondSet(),bondStore:this.rungBondStore},t),this.getBondData(t)},ld.prototype.getBoundingBox=function(t,e){gc&&mc.time("getBoundingBox"),e=e||new jt;var i=1/0,r=1/0,n=1/0,o=-1/0,a=-1/0,s=-1/0;return this.eachAtom((function(t){var e=t.x,c=t.y,u=t.z;e<i&&(i=e),c<r&&(r=c),u<n&&(n=u),e>o&&(o=e),c>a&&(a=c),u>s&&(s=u)}),t),e.min.set(i,r,n),e.max.set(o,a,s),gc&&mc.timeEnd("getBoundingBox"),e},ld.prototype.getPrincipalAxes=function(t){gc&&mc.time("getPrincipalAxes");var e=0,i=new Rl(3,this.atomCount),r=i.data;return this.eachAtom((function(t){r[e+0]=t.x,r[e+1]=t.y,r[e+2]=t.z,e+=3}),t),gc&&mc.timeEnd("getPrincipalAxes"),new Zl(i)},ld.prototype.atomCenter=function(t){return t?this.getBoundingBox(t).getCenter():this.center.clone()},ld.prototype.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},ld.prototype.getAtomIndices=function(t){var e;if(t&&t.string)e=[],this.eachAtom((function(t){e.push(t.index)}),t);else{e=this.getAtomData({what:{index:!0}}).index}return e},ld.prototype.getChainnameCount=function(t){var e=new Set;return this.eachChain((function(t){t.residueCount&&e.add(t.chainname)}),t),e.size},ld.prototype.updatePosition=function(t){var e=0;this.eachAtom((function(i){i.positionFromArray(t,e),e+=3}))},ld.prototype.refreshPosition=function(){this.getBoundingBox(void 0,this.boundingBox),this.boundingBox.getCenter(this.center),this.spatialHash=new Kl(this.atomStore,this.boundingBox)},ld.prototype.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},Object.defineProperties(ld.prototype,pd);var fd=function(t,e){var i;"function"==typeof t.eachAtom?i=t.atomCount:t instanceof Float32Array&&(i=t.length/3);var r=new Rl(3,i),n=new Rl(3,i);this.coords1t=new Rl(i,3),this.coords2t=new Rl(i,3),this.A=new Rl(3,3),this.W=new Rl(1,3),this.U=new Rl(3,3),this.V=new Rl(3,3),this.VH=new Rl(3,3),this.R=new Rl(3,3),this.tmp=new Rl(3,3),this.c=new Rl(3,3),this.c.data.set([1,0,0,0,1,0,0,0,-1]),this.prepCoords(t,r),this.prepCoords(e,n),this._superpose(r,n)};fd.prototype._superpose=function(t,e){var i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S;this.mean1=Dl(t),this.mean2=Dl(e),kl(t,this.mean1),kl(e,this.mean2),Ll(this.coords1t,t),Ll(this.coords2t,e),Ol(this.A,this.coords2t,this.coords1t),zl(this.A,this.W,this.U,this.V),i=this.V,r=this.VH,n=i.data,o=r.data,a=n[4],s=n[8],c=n[5],u=n[7],h=n[0],l=h*a,p=h*c,d=n[3],f=n[1],m=d*f,g=n[2],v=d*g,y=n[6],_=1/(l*s-p*u-m*s+v*u+(b=y*f)*c-(x=y*g)*a),o[0]=(a*s-c*u)*_,o[1]=-(f*s-g*u)*_,o[2]=-(-f*c+g*a)*_,o[3]=-(d*s-c*y)*_,o[4]=(h*s-x)*_,o[5]=-(p-v)*_,o[6]=-(-d*u+a*y)*_,o[7]=-(h*u-b)*_,o[8]=(l-m)*_,Nl(this.R,this.U,this.VH),w=this.R,(S=w.data)[0]*S[4]*S[8]-S[0]*S[5]*S[7]-S[3]*S[1]*S[8]+S[3]*S[2]*S[7]+S[6]*S[1]*S[5]-S[6]*S[2]*S[4]<0&&(gc&&mc.log("R not a right handed system"),Nl(this.tmp,this.c,this.VH),Nl(this.R,this.U,this.tmp))},fd.prototype.prepCoords=function(t,e){var i=0,r=e.data;"function"==typeof t.eachAtom?t.eachAtom((function(t){r[i+0]=t.x,r[i+1]=t.y,r[i+2]=t.z,i+=3})):t instanceof Float32Array?r.set(t):mc.warn("prepCoords: input type unknown")},fd.prototype.transform=function(t){var e;"function"==typeof t.eachAtom?e=t.atomCount:t instanceof Float32Array&&(e=t.length/3);var i=new Rl(3,e),r=new Rl(e,3);this.prepCoords(t,i),kl(i,this.mean1),Ol(r,this.R,i),Ll(i,r),function(t,e){var i,r,n=0,o=t.rows,a=t.cols,s=t.data;for(i=0;i<o;++i)for(r=0;r<a;++r,++n)s[n]+=e[r]}(i,this.mean2);var n=0,o=i.data;"function"==typeof t.eachAtom?t.eachAtom((function(t){t.x=o[n+0],t.y=o[n+1],t.z=o[n+2],n+=3})):t instanceof Float32Array?t.set(o.subarray(0,3*e)):mc.warn("transform: input type unknown")};var md=function(t,e){this.signals={startedRunning:new Fs,haltedRunning:new Fs};var i=Object.assign({},e);t.signals.playerChanged.add((function(t){t!==this&&this.pause()}),this);var r=Eo(t.numframes,1);this.traj=t,this.start=Eo(i.start,0),this.end=Math.min(Eo(i.end,r-1),r-1),this.step=Eo(i.step,Math.ceil((r+1)/100)),this.timeout=Eo(i.timeout,50),this.interpolateType=Eo(i.interpolateType,""),this.interpolateStep=Eo(i.interpolateStep,5),this.mode=Eo(i.mode,"loop"),this.direction=Eo(i.direction,"forward"),this._stopFlag=!1,this._running=!1,t.signals.gotNumframes.add((function(t){this.end=Math.min(Eo(i.end,t-1),t-1)}),this)};md.prototype._animate=function(){var t,e,i,r;(this._running=!0,this.traj.inProgress||this._stopFlag||(((t="forward"===this.direction?this.traj.currentFrame+this.step:this.traj.currentFrame-this.step)>=this.end||t<this.start)&&("once"===this.mode?(this.pause(),t="forward"===this.direction?this.end:this.start):t="forward"===this.direction?this.start:this.end),this.interpolateType||this.traj.setFrame(t)),this._stopFlag)?this._running=!1:!this.traj.inProgress&&this.interpolateType?("forward"===this.direction?(e=Math.max(this.start,t-this.step),i=Math.max(this.start,t-2*this.step),r=Math.max(this.start,t-3*this.step)):(e=Math.min(this.end,t+this.step),i=Math.min(this.end,t+2*this.step),r=Math.min(this.end,t+3*this.step)),this._interpolate(t,e,i,r,1/this.interpolateStep,0)):setTimeout(this._animate.bind(this),this.timeout)},md.prototype._interpolate=function(t,e,i,r,n,o){if((o+=n)<=1){var a=Math.round(this.timeout*n);this.traj.setFrameInterpolated(t,e,i,r,o,this.interpolateType,function(){setTimeout(function(){this._interpolate(t,e,i,r,n,o)}.bind(this),a)}.bind(this))}else setTimeout(this._animate.bind(this),0)},md.prototype.toggle=function(){this._running?this.pause():this.play()},md.prototype.play=function(){if(!this._running){this.traj.player!==this&&this.traj.setPlayer(this);var t=this.traj.currentFrame,e=Math.ceil(t/this.step)*this.step;"forward"===this.direction&&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()}},md.prototype.pause=function(){this._running&&(this._stopFlag=!0,this.signals.haltedRunning.dispatch())},md.prototype.stop=function(){this.traj.setFrame(this.start),this.pause()};var gd=function(t,e,i){this.signals={gotNumframes:new Fs,frameChanged:new Fs,selectionChanged:new Fs,playerChanged:new Fs};var r=i||{};r.centerPbc=Eo(r.centerPbc,!0),r.removePbc=Eo(r.removePbc,!0),r.superpose=Eo(r.superpose,!0),this.setParameters(r),this.name=t.replace(/^.*[\\/]/,""),this.selection=new nc(Eo(r.sele,"backbone and not hydrogen")),this.selection.signals.stringChanged.add((function(){this.makeIndices(),this.resetCache()}),this),this.setStructure(e),this.setPlayer(new md(this)),this.trajPath=t,this.numframes=void 0,this.getNumframes()};function vd(t){return"front"===t?0:"back"===t?1:2}gd.prototype.setStructure=function(t){this.structure=t,this.atomCount=t.atomCount,this.makeAtomIndices(),this.saveInitialStructure(),this.backboneIndices=this.getIndices(new nc("backbone and not hydrogen")),this.makeIndices(),this.frameCache=[],this.boxCache=[],this.pathCache=[],this.frameCacheSize=0,this.currentFrame=-1},gd.prototype.saveInitialStructure=function(){var t=0,e=new Float32Array(3*this.atomCount);this.structure.eachAtom((function(i){e[t+0]=i.x,e[t+1]=i.y,e[t+2]=i.z,t+=3})),this.initialStructure=e},gd.prototype.setSelection=function(t){return this.selection.setString(t),this},gd.prototype.getIndices=function(t){var e;if(t&&t.test){var i=0,r=t.test;e=[],this.structure.eachAtom((function(t){r(t)&&e.push(i),i+=1}))}else e=this.structure.getAtomIndices(this.selection);return e},gd.prototype.makeIndices=function(){var t,e;this.indices=this.getIndices(this.selection);var i=3*this.indices.length;this.coords1=new Float32Array(i),this.coords2=new Float32Array(i);var r=this.initialStructure,n=this.coords2;for(t=0;t<i;t+=3)e=3*this.indices[t/3],n[t+0]=r[e+0],n[t+1]=r[e+1],n[t+2]=r[e+2]},gd.prototype.makeAtomIndices=function(){mc.error("Trajectory.makeAtomIndices not implemented")},gd.prototype.getNumframes=function(){mc.error("Trajectory.loadFrame not implemented")},gd.prototype.resetCache=function(){return this.frameCache=[],this.boxCache=[],this.pathCache=[],this.frameCacheSize=0,this.setFrame(this.currentFrame),this},gd.prototype.setParameters=function(t){var e=t,i=!1;void 0!==e.centerPbc&&e.centerPbc!==this.centerPbc&&(this.centerPbc=e.centerPbc,i=!0),void 0!==e.removePbc&&e.removePbc!==this.removePbc&&(this.removePbc=e.removePbc,i=!0),void 0!==e.superpose&&e.superpose!==this.superpose&&(this.superpose=e.superpose,i=!0),i&&this.resetCache()},gd.prototype.setFrame=function(t,e){return void 0===t?this:(this.inProgress=!0,-1===(t=parseInt(t))||this.frameCache[t]?this.updateStructure(t,e):this.loadFrame(t,function(){this.updateStructure(t,e)}.bind(this)),this)},gd.prototype.interpolate=function(t,e,i,r,n,o,a){var s,c=this.frameCache,u=c[t],h=c[e],l=c[i],p=c[r],d=u.length,f=new Float32Array(d);if("spline"===o)for(s=0;s<d;s+=3)f[s+0]=Is(p[s+0],l[s+0],h[s+0],u[s+0],n,1),f[s+1]=Is(p[s+1],l[s+1],h[s+1],u[s+1],n,1),f[s+2]=Is(p[s+2],l[s+2],h[s+2],u[s+2],n,1);else for(s=0;s<d;s+=3)f[s+0]=Cs(h[s+0],u[s+0],n),f[s+1]=Cs(h[s+1],u[s+1],n),f[s+2]=Cs(h[s+2],u[s+2],n);this.structure.updatePosition(f),this.currentFrame=t,this.signals.frameChanged.dispatch(t),"function"==typeof a&&a()},gd.prototype.setFrameInterpolated=function(t,e,i,r,n,o,a){if(void 0===t)return this;var s=this.frameCache,c=[];return s[r]||c.push(r),s[i]||c.push(i),s[e]||c.push(e),s[t]||c.push(t),c.length?this.loadFrame(c,function(){this.interpolate(t,e,i,r,n,o,a)}.bind(this)):this.interpolate(t,e,i,r,n,o,a),this},gd.prototype.loadFrame=function(t,e){if(Array.isArray(t)){var i,r=function(t,r){this._loadFrame(t,r),0===i.length()&&"function"==typeof e&&e()}.bind(this);i=new dd(r,t)}else this._loadFrame(t,e)},gd.prototype._loadFrame=function(t,e){mc.error("Trajectory._loadFrame not implemented",t,e)},gd.prototype.updateStructure=function(t,e){this._disposed||(-1===t?this.structure.updatePosition(this.initialStructure):this.structure.updatePosition(this.frameCache[t]),this.structure.trajectory={name:this.trajPath,frame:t},"function"==typeof e&&e(),this.currentFrame=t,this.inProgress=!1,this.signals.frameChanged.dispatch(t))},gd.prototype.getCircularMean=function(t,e,i){return[ru(e,i[0],3,0,t),ru(e,i[1],3,1,t),ru(e,i[2],3,2,t)]},gd.prototype.doSuperpose=function(t){var e,i,r=3*this.indices.length,n=this.coords1,o=this.coords2;for(e=0;e<r;e+=3)i=3*this.indices[e/3],n[e+0]=t[i+0],n[e+1]=t[i+1],n[e+2]=t[i+2];new fd(n,o).transform(t)},gd.prototype.process=function(t,e,i,r){if(this.setNumframes(r),e){if(this.backboneIndices.length>0&&this.centerPbc){var n=[e[0],e[4],e[8]];!function(t,e,i){if(0!==i[0]&&0!==i[8]&&0!==i[4]){var r,n=t.length,o=i[0],a=i[1],s=i[2],c=-e[0]+o+o/2,u=-e[1]+a+a/2,h=-e[2]+s+s/2;for(r=0;r<n;r+=3)t[r+0]=(t[r+0]+c)%o,t[r+1]=(t[r+1]+u)%a,t[r+2]=(t[r+2]+h)%s}}(i,this.getCircularMean(this.backboneIndices,i,n),n)}this.removePbc&&function(t,e){if(0!==e[0]&&0!==e[8]&&0!==e[4]){var i,r,n,o,a=t.length;for(i=3;i<a;i+=3)for(r=0;r<3;++r)if(o=t[i+r]-t[i-3+r],Math.abs(o)>.9*e[3*r+r])if(o>0)for(n=0;n<3;++n)t[i+n]-=e[3*r+n];else for(n=0;n<3;++n)t[i+n]+=e[3*r+n]}}(i,e)}this.indices.length>0&&this.superpose&&this.doSuperpose(i),this.frameCache[t]=i,this.boxCache[t]=e,this.frameCacheSize+=1},gd.prototype.setNumframes=function(t){t!==this.numframes&&(this.numframes=t,this.signals.gotNumframes.dispatch(t))},gd.prototype.dispose=function(){this.frameCache=[],this._disposed=!0,this.player&&this.player.stop()},gd.prototype.setPlayer=function(t){this.player=t,this.signals.playerChanged.dispatch(t)},gd.prototype.getPath=function(t,e){mc.error("Trajectory.getPath not implemented",t,e)},wc.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 )\n#include unpack_color\nattribute float primitiveId;\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 = unpackColor( primitiveId );\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}"),wc.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 )\nif( opacity < 0.7 )\ndiscard;\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}");var yd={f:1,v2:2,v3:3,c:3};function bd(t,e){t.matrix.copy(e),t.matrix.decompose(t.position,t.quaternion,t.scale),t.matrixWorldNeedsUpdate=!0}var xd=function(t,e){var i=t||{},r=e||{};this.opaqueBack=Eo(r.opaqueBack,!1),this.dullInterior=Eo(r.dullInterior,!1),this.side=Eo(r.side,"double"),this.opacity=Eo(r.opacity,1),this.depthWrite=Eo(r.depthWrite,!0),this.clipNear=Eo(r.clipNear,0),this.clipRadius=Eo(r.clipRadius,0),this.clipCenter=Eo(r.clipCenter,new O),this.flatShaded=Eo(r.flatShaded,!1),this.background=Eo(r.background,!1),this.linewidth=Eo(r.linewidth,1),this.wireframe=Eo(r.wireframe,!1),this.wireframeLinewidth=Eo(r.wireframeLinewidth,1),this.roughness=Eo(r.roughness,.4),this.metalness=Eo(r.metalness,0),this.diffuse=Eo(r.diffuse,16777215),this.forceTransparent=Eo(r.forceTransparent,!1),this.disablePicking=Eo(r.disablePicking,!1),this.geometry=new _e,this.indexVersion=0,this.wireframeIndexVersion=-1,this.uniforms=Mt.merge([At.common,{fogColor:{value:null},fogNear:{value:0},fogFar:{value:0},opacity:{value:this.opacity},nearClip:{value:0},clipRadius:{value:this.clipRadius},clipCenter:{value:this.clipCenter}},{emissive:{value:new St(0)},roughness:{value:this.roughness},metalness:{value:this.metalness}},At.ambient,At.lights]),this.uniforms.diffuse.value.set(this.diffuse),this.pickingUniforms={nearClip:{value:0},objectId:{value:0},opacity:{value:this.opacity}},this.group=new Ci,this.wireframeGroup=new Ci,this.pickingGroup=new Ci,this.matrix=Eo(r.matrix,new N);var n=i.position||i.position1;this._positionDataSize=n?n.length/3:0,this.addAttributes({position:{type:"v3",value:i.position},color:{type:"c",value:i.color},primitiveId:{type:"f",value:i.primitiveId}}),i.index&&this.initIndex(i.index),this.picking=i.picking,this.makeWireframeGeometry()},_d={parameters:{},matrix:{},transparent:{},size:{},attributeSize:{},pickable:{},dynamic:{},vertexShader:{},fragmentShader:{}};_d.parameters.get=function(){return{opaqueBack:{updateShader:!0},dullInterior:{updateShader:!0},side:{updateShader:!0,property:!0},opacity:{uniform:!0},depthWrite:{property:!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},matrix:{}}},_d.matrix.set=function(t){this.setMatrix(t)},_d.matrix.get=function(){return this.group.matrix.clone()},_d.transparent.get=function(){return this.opacity<1||this.forceTransparent},_d.size.get=function(){return this._positionDataSize},_d.attributeSize.get=function(){return this.size},_d.pickable.get=function(){return!!this.picking&&!this.disablePicking},_d.dynamic.get=function(){return!0},_d.vertexShader.get=function(){},_d.fragmentShader.get=function(){},xd.prototype.setMatrix=function(t){bd(this.group,t),bd(this.wireframeGroup,t),bd(this.pickingGroup,t)},xd.prototype.initIndex=function(t){this.geometry.setIndex(new me(t,1)),this.geometry.getIndex().setDynamic(this.dynamic)},xd.prototype.makeMaterial=function(){var t=vd(this.side),e=new zt({uniforms:this.uniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:this.transparent,depthWrite:this.depthWrite,lights:!0,fog:!0,side:t,linewidth:this.linewidth});e.vertexColors=2,e.extensions.derivatives=this.flatShaded,e.extensions.fragDepth=this.isImpostor,e.clipNear=this.clipNear;var i=new zt({uniforms:this.uniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:this.transparent,depthWrite:this.depthWrite,lights:!1,fog:!0,side:t,linewidth:this.linewidth});i.vertexColors=2,i.clipNear=this.clipNear;var r=new zt({uniforms:this.pickingUniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:!1,depthWrite:this.depthWrite,lights:!1,fog:!1,side:t,linewidth:this.linewidth,blending:0});r.vertexColors=2,r.extensions.fragDepth=this.isImpostor,r.clipNear=this.clipNear,this.material=e,this.wireframeMaterial=i,this.pickingMaterial=r,this.updateShader()},xd.prototype.makeWireframeGeometry=function(){this.makeWireframeIndex();var t=this.geometry,e=this.wireframeIndex,i=new _e;i.attributes=t.attributes,e&&(i.setIndex(new me(e,1).setDynamic(this.dynamic)),i.setDrawRange(0,this.wireframeIndexCount)),this.wireframeGeometry=i},xd.prototype.makeWireframeIndex=function(){var t=[];function e(e,i){if(e>i){var r=e;e=i,i=r}var n=t[e];return void 0===n?(t[e]=[i],!0):!n.includes(i)&&(n.push(i),!0)}var i=this.geometry,r=i.index;if(this.wireframe)if(r){var n,o=r.array,a=o.length;if(i.drawRange.count!==1/0&&(a=i.drawRange.count),this.wireframeIndex&&this.wireframeIndex.length>2*a)n=this.wireframeIndex;else n=zo(2*a,i.attributes.position.count);var s=0;t.length=0;for(var c=0;c<a;c+=3){var u=o[c+0],h=o[c+1],l=o[c+2];e(u,h)&&(n[s+0]=u,n[s+1]=h,s+=2),e(h,l)&&(n[s+0]=h,n[s+1]=l,s+=2),e(l,u)&&(n[s+0]=l,n[s+1]=u,s+=2)}this.wireframeIndex=n,this.wireframeIndexCount=s,this.wireframeIndexVersion=this.indexVersion}else{var p,d=i.attributes.position.count;p=this.wireframeIndex&&this.wireframeIndex.length>2*d?this.wireframeIndex:zo(2*d,d);for(var f=0,m=0;f<d;f+=3)p[m+0]=f,p[m+1]=f+1,p[m+2]=f+1,p[m+3]=f+2,p[m+4]=f+2,p[m+5]=f,m+=6;this.wireframeIndex=p,this.wireframeIndexCount=2*d,this.wireframeIndexVersion=this.indexVersion}else this.wireframeIndex=new Uint16Array(0),this.wireframeIndexCount=0},xd.prototype.updateWireframeIndex=function(){if(this.wireframeGeometry.setDrawRange(0,1/0),this.wireframeIndexVersion<this.indexVersion&&this.makeWireframeIndex(),this.wireframeIndex.length>this.wireframeGeometry.index.array.length)this.wireframeGeometry.setIndex(new me(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)},xd.prototype.getRenderOrder=function(){var t=0;return this.isText?t=1:this.transparent&&(t=this.isSurface?3:2),t},xd.prototype._getMesh=function(t){this.material||this.makeMaterial();var e,i=this.geometry,r=this[t];return this.isLine?e=new Mi(i,r):this.isPoint?(e=new Ei(i,r),this.sortParticles&&(e.sortParticles=!0)):e=new Ie(i,r),e.frustumCulled=!1,e.renderOrder=this.getRenderOrder(),e},xd.prototype.getMesh=function(){return this._getMesh("material")},xd.prototype.getWireframeMesh=function(){var t;return this.material||this.makeMaterial(),this.wireframeGeometry||this.makeWireframeGeometry(),(t=new Mi(this.wireframeGeometry,this.wireframeMaterial)).frustumCulled=!1,t.renderOrder=this.getRenderOrder(),t},xd.prototype.getPickingMesh=function(){return this._getMesh("pickingMaterial")},xd.prototype.getShader=function(t,e){return qc(t,this.getDefines(e))},xd.prototype.getVertexShader=function(t){return this.getShader(this.vertexShader,t)},xd.prototype.getFragmentShader=function(t){return this.getShader(this.fragmentShader,t)},xd.prototype.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},xd.prototype.getParameters=function(){var t={};for(var e in this.parameters)t[e]=this[e];return t},xd.prototype.addUniforms=function(t){this.uniforms=Mt.merge([this.uniforms,t]),this.pickingUniforms=Mt.merge([this.pickingUniforms,t])},xd.prototype.addAttributes=function(t){for(var e in t){var i=void 0,r=t[e],n=this.attributeSize*yd[r.type];r.value?(n!==r.value.length&&mc.error("attribute value has wrong length",e),i=r.value):i=Bo("float32",n),this.geometry.addAttribute(e,new me(i,yd[r.type]).setDynamic(this.dynamic))}},xd.prototype.updateRenderOrder=function(){var t=this.getRenderOrder();function e(e){e.renderOrder=t}this.group.children.forEach(e),this.pickingGroup&&this.pickingGroup.children.forEach(e)},xd.prototype.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},xd.prototype.setParameters=function(t){if(t){var e=t,i=this.parameters,r={},n={},o=!1,a=!1;for(var s in e){var c=e[s];void 0!==c&&(void 0!==i[s]&&(this[s]=c,i[s].property&&(!0!==i[s].property?r[i[s].property]=c:r[s]=c),i[s].uniform&&(!0!==i[s].uniform?n[i[s].uniform]=c:n[s]=c),i[s].updateShader&&(o=!0),i[s].updateVisibility&&(a=!0),this.dynamic&&"wireframe"===s&&!0===c&&this.updateWireframeIndex(),"flatShaded"===s&&(this.material.extensions.derivatives=this.flatShaded),"forceTransparent"===s&&(r.transparent=this.transparent)))}this.setProperties(r),this.setUniforms(n),o&&this.updateShader(),a&&this.setVisibility(this.visible)}},xd.prototype.setAttributes=function(t){var e=this.geometry,i=e.attributes;for(var r in t)if("picking"!==r){var n=t[r],o=n.length;if("index"===r){var a=e.getIndex();e.setDrawRange(0,1/0),o>a.array.length?e.setIndex(new me(n,1).setDynamic(this.dynamic)):(a.set(n),a.needsUpdate=o>0,a.updateRange.count=o,e.setDrawRange(0,o)),this.indexVersion++,this.wireframe&&this.updateWireframeIndex()}else{var s=i[r];o>s.array.length?e.addAttribute(r,new me(n,s.itemSize).setDynamic(this.dynamic)):(i[r].set(n),i[r].needsUpdate=o>0,i[r].updateRange.count=o)}}},xd.prototype.setUniforms=function(t){if(t){var e=this.material.uniforms,i=this.wireframeMaterial.uniforms,r=this.pickingMaterial.uniforms;for(var n in t)"opacity"===n&&this.setProperties({transparent:this.transparent}),void 0!==e[n]&&(e[n].value.isVector3?e[n].value.copy(t[n]):e[n].value.set?e[n].value.set(t[n]):e[n].value=t[n]),void 0!==i[n]&&(i[n].value.isVector3?i[n].value.copy(t[n]):i[n].value.set?i[n].value.set(t[n]):i[n].value=t[n]),void 0!==r[n]&&(r[n].value.isVector3?r[n].value.copy(t[n]):r[n].value.set?r[n].value.set(t[n]):r[n].value=t[n])}},xd.prototype.setProperties=function(t){if(t){var e=this.material,i=this.wireframeMaterial,r=this.pickingMaterial;for(var n in t){var o=t[n];"transparent"===n?this.updateRenderOrder():"side"===n&&(o=vd(o)),void 0!==e[n]&&(e[n]=o),void 0!==i[n]&&(i[n]=o),void 0!==r[n]&&(r[n]=o)}e.needsUpdate=!0,i.needsUpdate=!0,r.needsUpdate=!0}},xd.prototype.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))},xd.prototype.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()},Object.defineProperties(xd.prototype,_d);var wd=function(t){function e(e,i){var r=e||{};!r.primitiveId&&r.position&&(r.primitiveId=su(r.position.length/3)),t.call(this,r,i),this.addAttributes({normal:{type:"v3",value:r.normal}}),void 0===r.normal&&this.geometry.computeVertexNormals()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={vertexShader:{},fragmentShader:{}};return i.vertexShader.get=function(){return"Mesh.vert"},i.fragmentShader.get=function(){return"Mesh.frag"},Object.defineProperties(e.prototype,i),e}(xd),Sd=new N,Ad=new Vt,Md=function(t){function e(e,i,r){var n,o=e||{},a=i||{},s=r.attributes.position.array,c=r.attributes.normal.array,u=r.index?r.index.array:void 0,h=o.position.length/3,l=s.length/3,p=h*l,d=new Float32Array(3*p),f=new Float32Array(3*p),m=new Float32Array(3*p);u&&(n=zo(h*u.length,p)),t.call(this,{position:d,color:m,index:n,normal:f,primitiveId:o.primitiveId||cu(h,l),picking:o.picking},a),this.setAttributes(o),this.geoPosition=s,this.geoNormal=c,this.geoIndex=u,this.positionCount=h,this.geoPositionCount=l,this.transformedGeoPosition=new Float32Array(3*l),this.transformedGeoNormal=new Float32Array(3*l),this.meshPosition=d,this.meshColor=m,this.meshIndex=n,this.meshNormal=f,this.meshIndex=n,this.makeIndex()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={updateNormals:{}};return e.prototype.applyPositionTransform=function(){},e.prototype.setAttributes=function(t,e){var i,r,n,o,a,s,c,u,h,l=this.geometry.attributes,p=this.updateNormals;t.position&&(i=t.position,n=this.geoPosition,c=this.meshPosition,a=this.transformedGeoPosition,l.position.needsUpdate=!0,(p||e)&&(o=this.geoNormal,h=this.meshNormal,s=this.transformedGeoNormal,l.normal.needsUpdate=!0)),t.color&&(r=t.color,u=this.meshColor,l.color.needsUpdate=!0);for(var d=this.positionCount,f=this.geoPositionCount,m=0;m<d;++m){var g=void 0,v=void 0,y=m*f*3,b=3*m;if(i&&(a.set(n),Sd.makeTranslation(i[b],i[b+1],i[b+2]),this.applyPositionTransform(Sd,m,b),Ah(Sd.elements,a),c.set(a,y),p?(s.set(o),Ad.getNormalMatrix(Sd),Mh(Ad.elements,s),h.set(s,y)):e&&h.set(o,y)),r)for(g=0;g<f;++g)u[v=y+3*g]=r[b],u[v+1]=r[b+1],u[v+2]=r[b+2]}},e.prototype.makeIndex=function(){var t=this.geoIndex,e=this.meshIndex;if(t)for(var i=this.positionCount,r=this.geoPositionCount,n=3*(t.length/3),o=0;o<i;++o){var a=o*n,s=a+n;e.set(t,a);for(var c=a;c<s;++c)e[c]+=o*r}},i.updateNormals.get=function(){return!1},Object.defineProperties(e.prototype,i),e}(wd),Pd=new O,Td=function(t){function e(e,i){var r=i||{},n=new Gi(1,Eo(r.sphereDetail,1));t.call(this,e,r,n),this.setAttributes(e,!0)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.applyPositionTransform=function(t,e){var i=this._radius[e];Pd.set(i,i,i),t.scale(Pd)},e.prototype.setAttributes=function(e,i){e.radius&&(this._radius=e.radius),t.prototype.setAttributes.call(this,e,i)},e}(Md);wc.add("shader/SphereImpostor.vert","uniform mat4 projectionMatrixInverse;\nuniform float nearClip;\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\nattribute vec2 mapping;\nattribute float radius;\n#ifdef PICKING\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#endif\n#include matrix_scale\nconst mat4 D = mat4(\n1.0, 0.0, 0.0, 0.0,\n0.0, 1.0, 0.0, 0.0,\n0.0, 0.0, 1.0, 0.0,\n0.0, 0.0, 0.0, -1.0\n);\nmat4 transpose( in mat4 inMatrix ) {\nvec4 i0 = inMatrix[0];\nvec4 i1 = inMatrix[1];\nvec4 i2 = inMatrix[2];\nvec4 i3 = inMatrix[3];\nmat4 outMatrix = mat4(\nvec4(i0.x, i1.x, i2.x, i3.x),\nvec4(i0.y, i1.y, i2.y, i3.y),\nvec4(i0.z, i1.z, i2.z, i3.z),\nvec4(i0.w, i1.w, i2.w, i3.w)\n);\nreturn outMatrix;\n}\nvoid ComputePointSizeAndPositionInClipCoordSphere(){\nvec2 xbc;\nvec2 ybc;\nmat4 T = mat4(\nradius, 0.0, 0.0, 0.0,\n0.0, radius, 0.0, 0.0,\n0.0, 0.0, radius, 0.0,\nposition.x, position.y, position.z, 1.0\n);\nmat4 R = transpose( projectionMatrix * modelViewMatrix * T );\nfloat A = dot( R[ 3 ], D * R[ 3 ] );\nfloat B = -2.0 * dot( R[ 0 ], D * R[ 3 ] );\nfloat C = dot( R[ 0 ], D * R[ 0 ] );\nxbc[ 0 ] = ( -B - sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nxbc[ 1 ] = ( -B + sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nfloat sx = abs( xbc[ 0 ] - xbc[ 1 ] ) * 0.5;\nA = dot( R[ 3 ], D * R[ 3 ] );\nB = -2.0 * dot( R[ 1 ], D * R[ 3 ] );\nC = dot( R[ 1 ], D * R[ 1 ] );\nybc[ 0 ] = ( -B - sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nybc[ 1 ] = ( -B + sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nfloat sy = abs( ybc[ 0 ] - ybc[ 1 ] ) * 0.5;\ngl_Position.xy = vec2( 0.5 * ( xbc.x + xbc.y ), 0.5 * ( ybc.x + ybc.y ) );\ngl_Position.xy -= mapping * vec2( sx, sy );\ngl_Position.xy *= gl_Position.w;\n}\nvoid main(void){\n#ifdef PICKING\nvPickingColor = unpackColor( primitiveId );\n#else\n#include color_vertex\n#endif\nvRadius = radius * matrixScale( modelViewMatrix );\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nmvPosition.z -= vRadius;\ngl_Position = projectionMatrix * vec4( mvPosition.xyz, 1.0 );\nComputePointSizeAndPositionInClipCoordSphere();\nvRadiusSq = vRadius * vRadius;\nvec4 vPoint4 = projectionMatrixInverse * gl_Position;\nvPoint = vPoint4.xyz / vPoint4.w;\nvPointViewPosition = -mvPosition.xyz / mvPosition.w;\n}"),wc.add("shader/SphereImpostor.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 mat4 projectionMatrix;\nuniform float ortho;\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n#ifdef PICKING\nuniform float objectId;\nvarying vec3 vPickingColor;\n#else\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\nbool flag2 = false;\nbool interior = false;\nvec3 cameraPos;\nvec3 cameraNormal;\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}\nfloat calcClip( vec3 cameraPos ){\nreturn dot( vec4( cameraPos, 1.0 ), vec4( 0.0, 0.0, 1.0, nearClip - 0.5 ) );\n}\nbool Impostor( out vec3 cameraPos, out vec3 cameraNormal ){\nvec3 cameraSpherePos = -vPointViewPosition;\ncameraSpherePos.z += vRadius;\nvec3 rayOrigin = mix( vec3( 0.0, 0.0, 0.0 ), vPoint, ortho );\nvec3 rayDirection = mix( normalize( vPoint ), vec3( 0.0, 0.0, 1.0 ), ortho );\nvec3 cameraSphereDir = mix( cameraSpherePos, rayOrigin - cameraSpherePos, ortho );\nfloat B = dot( rayDirection, cameraSphereDir );\nfloat det = B * B + vRadiusSq - dot( cameraSphereDir, cameraSphereDir );\nif( det < 0.0 ){\ndiscard;\nreturn false;\n}else{\nfloat sqrtDet = sqrt( det );\nfloat posT = mix( B + sqrtDet, B + sqrtDet, ortho );\nfloat negT = mix( B - sqrtDet, sqrtDet - B, ortho );\ncameraPos = rayDirection * negT + rayOrigin;\n#ifdef NEAR_CLIP\nif( calcDepth( cameraPos ) <= 0.0 ){\ncameraPos = rayDirection * posT + rayOrigin;\ninterior = true;\nreturn false;\n}else if( calcClip( cameraPos ) > 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}");var Ed=function(t){function e(e,i){t.call(this,e,i),this.index=zo(this.indexSize,this.attributeSize),this.makeIndex(),this.initIndex(this.index,1),this.addAttributes({mapping:{type:this.mappingType,value:null}}),this.setAttributes({primitiveId:su(this.size)})}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={attributeSize:{},indexSize:{},mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return i.attributeSize.get=function(){return this.size*this.mappingSize},i.indexSize.get=function(){return this.size*this.mappingIndicesSize},i.mapping.get=function(){},i.mappingIndices.get=function(){},i.mappingIndicesSize.get=function(){},i.mappingType.get=function(){},i.mappingSize.get=function(){},i.mappingItemSize.get=function(){},e.prototype.addAttributes=function(e){var i={};for(var r in e){var n=e[r];i[r]={type:n.type,value:null}}t.prototype.addAttributes.call(this,i)},e.prototype.getAttributeIndex=function(t){return 3*t*this.mappingSize},e.prototype.setAttributes=function(t){t&&!t.position&&t.position1&&t.position2&&(t.position=nu(t.position1,t.position2));var e,i,r,n,o,a,s,c=this.size,u=this.mappingSize,h=this.geometry.attributes;for(var l in t)if("index"!==l&&"picking"!==l){i=t[l],r=(e=h[l]).itemSize,n=e.array;for(var p=0;p<c;++p){a=(o=p*r)*u;for(var d=0;d<u;++d){s=a+r*d;for(var f=0;f<r;++f)n[s+f]=i[o+f]}}e.needsUpdate=!0}},e.prototype.makeMapping=function(){for(var t=this.size,e=this.mapping,i=this.mappingSize,r=this.mappingItemSize,n=this.geometry.attributes.mapping.array,o=0;o<t;o++)n.set(e,o*r*i)},e.prototype.makeIndex=function(){for(var t,e,i=this.size,r=this.mappingSize,n=this.mappingIndices,o=this.mappingIndicesSize,a=this.index,s=0;s<i;s++){t=s*o,e=s*r,a.set(n,t);for(var c=0;c<o;++c)a[t+c]+=e}},Object.defineProperties(e.prototype,i),e}(xd),Cd=new Float32Array([-1,1,-1,-1,1,1,1,-1]),Id=new Uint16Array([0,1,2,1,3,2]),Rd=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return i.mapping.get=function(){return Cd},i.mappingIndices.get=function(){return Id},i.mappingIndicesSize.get=function(){return 6},i.mappingType.get=function(){return"v2"},i.mappingSize.get=function(){return 4},i.mappingItemSize.get=function(){return 2},Object.defineProperties(e.prototype,i),e}(Ed),Ld=function(t){function e(e,i){t.call(this,e,i),this.addUniforms({projectionMatrixInverse:{value:new N},ortho:{value:0}}),this.addAttributes({radius:{type:"f",value:null}}),this.setAttributes(e),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isImpostor:{},vertexShader:{},fragmentShader:{}};return i.isImpostor.get=function(){return!0},i.vertexShader.get=function(){return"SphereImpostor.vert"},i.fragmentShader.get=function(){return"SphereImpostor.frag"},Object.defineProperties(e.prototype,i),e}(Rd),Od=function(t,e){return!dc||e&&e.disableImpostor?new Td(t,e):new Ld(t,e)},Nd=new O,Dd=new O,kd=new O,Fd=new O(0,0,0),Bd=function(t){function e(e,i){var r=i||{},n=new Gi(1,Eo(r.sphereDetail,2));t.call(this,e,r,n),this.setAttributes(e,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,i){Dd.fromArray(this._majorAxis,i),kd.fromArray(this._minorAxis,i),t.lookAt(Fd,Dd,kd),Nd.set(this._radius[e],kd.length(),Dd.length()),t.scale(Nd)},e.prototype.setAttributes=function(e,i){e.radius&&(this._radius=e.radius),e.majorAxis&&(this._majorAxis=e.majorAxis),e.minorAxis&&(this._minorAxis=e.minorAxis),t.prototype.setAttributes.call(this,e,i)},i.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,i),e}(Md),zd=function(t,e){return new Bd(t,e)},Ud=new O,jd=new O,Gd=new O,Vd=new O(0,1,0),$d=function(t){function e(e,i){var r=e||{},n=i||{},o=Eo(n.radialSegments,10),a=Eo(n.openEnded,!0),s=(new N).makeRotationX(Math.PI/2),c=new pr(1,1,1,o,1,a);c.applyMatrix(s);var u=r.position1.length,h=r.radius.length,l=c.attributes.position.array.length/3,p=u/3,d=new Float32Array(2*p*l);cu(p,l,0,d),cu(p,l,p*l,d);var f=new Float32Array(2*u),m=new Float32Array(2*u);t.call(this,{position:f,color:m,primitiveId:d,picking:r.picking},n,c),this.__center=new Float32Array(u),this._position=f,this._color=m,this._from=new Float32Array(2*u),this._to=new Float32Array(2*u),this._radius=new Float32Array(2*h),this.setAttributes(r,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,i){jd.fromArray(this._from,i),Gd.fromArray(this._to,i),t.lookAt(jd,Gd,Vd);var r=this._radius[e];Ud.set(r,r,jd.distanceTo(Gd)),t.scale(Ud)},e.prototype.setAttributes=function(e,i){var r={};e.position1&&e.position2&&(nu(e.position1,e.position2,this.__center),nu(e.position1,this.__center,this._position),nu(this.__center,e.position2,this._position,e.position1.length),this._from.set(e.position1),this._from.set(this.__center,e.position1.length),this._to.set(this.__center),this._to.set(e.position2,this.__center.length),r.position=this._position),e.color&&e.color2&&(this._color.set(e.color),this._color.set(e.color2,e.color.length),r.color=this._color),e.radius&&(this._radius.set(e.radius),this._radius.set(e.radius,e.radius.length),r.radius=this._radius),t.prototype.setAttributes.call(this,r,i)},i.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,i),e}(Md);wc.add("shader/CylinderImpostor.vert","\nattribute vec3 mapping;\nattribute vec3 position1;\nattribute vec3 position2;\nattribute float radius;\nvarying vec3 axis;\nvarying vec4 base_radius;\nvarying vec4 end_b;\nvarying vec3 U;\nvarying vec3 V;\nvarying vec4 w;\n#ifdef PICKING\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\nattribute vec3 color2;\nvarying vec3 vColor1;\nvarying vec3 vColor2;\n#endif\nuniform mat4 modelViewMatrixInverse;\nuniform float ortho;\n#include matrix_scale\nvoid main(){\n#ifdef PICKING\nvPickingColor = unpackColor( primitiveId );\n#else\nvColor1 = color;\nvColor2 = color2;\n#endif\nbase_radius.w = radius * matrixScale( modelViewMatrix );\nvec3 center = position;\nvec3 dir = normalize( position2 - position1 );\nfloat ext = length( position2 - position1 ) / 2.0;\nvec3 cam_dir;\nif( ortho == 0.0 ){\ncam_dir = ( modelViewMatrixInverse * vec4( 0, 0, 0, 1 ) ).xyz - center;\n}else{\ncam_dir = ( modelViewMatrixInverse * vec4( 0, 0, 1, 0 ) ).xyz;\n}\ncam_dir = normalize( cam_dir );\nvec3 ldir;\nfloat b = dot( cam_dir, dir );\nend_b.w = b;\nif( b < 0.0 )\nldir = -ext * dir;\nelse\nldir = ext * dir;\nvec3 left = normalize( cross( cam_dir, ldir ) );\nleft = radius * left;\nvec3 up = radius * normalize( cross( left, ldir ) );\naxis = normalize( normalMatrix * ldir );\nU = normalize( normalMatrix * up );\nV = normalize( normalMatrix * left );\nvec4 base4 = modelViewMatrix * vec4( center - ldir, 1.0 );\nbase_radius.xyz = base4.xyz / base4.w;\nvec4 top_position = modelViewMatrix * vec4( center + ldir, 1.0 );\nvec4 end4 = top_position;\nend_b.xyz = end4.xyz / end4.w;\nw = modelViewMatrix * vec4(\ncenter + mapping.x*ldir + mapping.y*left + mapping.z*up, 1.0\n);\ngl_Position = projectionMatrix * w;\ngl_Position.z = 0.99;\n}"),wc.add("shader/CylinderImpostor.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 mat4 projectionMatrix;\nuniform float ortho;\nvarying vec3 axis;\nvarying vec4 base_radius;\nvarying vec4 end_b;\nvarying vec3 U;\nvarying vec3 V;\nvarying vec4 w;\n#ifdef PICKING\nuniform float objectId;\nvarying vec3 vPickingColor;\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 distSq3( vec3 v3a, vec3 v3b ){\nreturn (\n( v3a.x - v3b.x ) * ( v3a.x - v3b.x ) +\n( v3a.y - v3b.y ) * ( v3a.y - v3b.y ) +\n( v3a.z - v3b.z ) * ( v3a.z - v3b.z )\n);\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}\nfloat calcClip( vec3 cameraPos ){\nreturn dot( vec4( cameraPos, 1.0 ), vec4( 0.0, 0.0, 1.0, nearClip - 0.5 ) );\n}\nvoid main(){\nvec3 point = w.xyz / w.w;\nvec3 base = base_radius.xyz;\nfloat vRadius = base_radius.w;\nvec3 end = end_b.xyz;\nfloat b = end_b.w;\nvec3 end_cyl = end;\nvec3 surface_point = point;\nvec3 ray_target = surface_point;\nvec3 ray_origin = vec3(0.0);\nvec3 ray_direction = mix(normalize(ray_origin - ray_target), vec3(0.0, 0.0, 1.0), ortho);\nmat3 basis = mat3( U, V, axis );\nvec3 diff = ray_target - 0.5 * (base + end_cyl);\nvec3 P = diff * basis;\nfloat dz = dot( axis, ray_direction );\nfloat radius2 = vRadius*vRadius;\nvec3 D = vec3(dot(U, ray_direction),\ndot(V, ray_direction),\ndz);\nfloat a0 = P.x*P.x + P.y*P.y - radius2;\nfloat a1 = P.x*D.x + P.y*D.y;\nfloat a2 = D.x*D.x + D.y*D.y;\nfloat d = a1*a1 - a0*a2;\nif (d < 0.0)\ndiscard;\nfloat dist = (-a1 + sqrt(d)) / a2;\nvec3 new_point = ray_target + dist * ray_direction;\nvec3 tmp_point = new_point - base;\nvec3 _normal = normalize( tmp_point - axis * dot(tmp_point, axis) );\nray_origin = mix( ray_origin, surface_point, ortho );\nfloat front_cap_test = dot( tmp_point, axis );\nfloat end_cap_test = dot((new_point - end_cyl), axis);\n#ifndef CAP\nvec3 new_point2 = ray_target + ( (-a1 - sqrt(d)) / a2 ) * ray_direction;\nvec3 tmp_point2 = new_point2 - base;\n#endif\nif (front_cap_test < 0.0)\n{\nfloat dNV = dot(-axis, ray_direction);\nif (dNV < 0.0)\ndiscard;\nfloat near = dot(-axis, (base)) / dNV;\nvec3 front_point = ray_direction * near + ray_origin;\nif (dot(front_point - base, front_point-base) > 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\ngl_FragColor = vec4( vPickingColor, objectId );\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}");var Hd=new Float32Array([-1,1,-1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,1]),Wd=new Uint16Array([0,1,2,1,4,2,2,4,3,4,5,3]),Xd=function(t){function e(e,i){t.call(this,e,i);var r=i||{};this.openEnded=Eo(r.openEnded,!1),this.addUniforms({modelViewMatrixInverse:{value:new N},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(e),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={parameters:{},isImpostor:{},vertexShader:{},fragmentShader:{}};return i.parameters.get=function(){return Object.assign.call(this,{openEnded:{updateShader:!0}},t.prototype.parameters)},e.prototype.getDefines=function(e){var i=t.prototype.getDefines.call(this,e);return this.openEnded||(i.CAP=1),i},i.isImpostor.get=function(){return!0},i.vertexShader.get=function(){return"CylinderImpostor.vert"},i.fragmentShader.get=function(){return"CylinderImpostor.frag"},Object.defineProperties(e.prototype,i),e}(function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return i.mapping.get=function(){return Hd},i.mappingIndices.get=function(){return Wd},i.mappingIndicesSize.get=function(){return 12},i.mappingType.get=function(){return"v3"},i.mappingSize.get=function(){return 6},i.mappingItemSize.get=function(){return 3},Object.defineProperties(e.prototype,i),e}(Ed)),qd=function(t,e){return!dc||e&&e.disableImpostor?new $d(t,e):new Xd(t,e)},Yd=new O,Zd=new O,Kd=new O,Qd=new O(0,1,0),Jd=function(t){function e(e,i){var r=i||{},n=Eo(r.radialSegments,60),o=Eo(r.openEnded,!1),a=(new N).makeRotationX(-Math.PI/2),s=new fr(1,1,n,1,o);s.applyMatrix(a);var c=e.position1.length,u=e.radius.length,h=new Float32Array(c);t.call(this,{position:h,color:e.color,picking:e.picking},r,s),this._position=h,this._from=new Float32Array(c),this._to=new Float32Array(c),this._radius=new Float32Array(u),this.setAttributes(e,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,i){Zd.fromArray(this._from,i),Kd.fromArray(this._to,i),t.lookAt(Zd,Kd,Qd);var r=this._radius[e];Yd.set(r,r,Zd.distanceTo(Kd)),t.scale(Yd)},e.prototype.setAttributes=function(e,i){var r={};e.position1&&e.position2&&(nu(e.position1,e.position2,this._position),this._from.set(e.position1),this._to.set(e.position2),r.position=this._position),e.color&&(r.color=e.color),e.radius&&this._radius.set(e.radius),t.prototype.setAttributes.call(this,r,i)},i.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,i),e}(Md),tf=function(t,e){return new Jd(t,e)},ef=function(t){this.geometryList=t,this.boundingBox=null};ef.prototype.computeBoundingBox=function(){var t=this;this.boundingBox?this.boundingBox.empty():this.boundingBox=new jt,this.geometryList.forEach((function(e){e.boundingBox||e.computeBoundingBox(),t.boundingBox.union(e.boundingBox)}))};var rf=function(t,e){var i=t||{},r=e||{};this.aspectRatio=Eo(r.aspectRatio,1.5),this.wireframe=Eo(r.wireframe,!1),this.splitPosition=new Float32Array(i.position1.length),this.cylinderRadius=new Float32Array(i.radius.length);var n=this.makeAttributes(i),o={radialSegments:Eo(r.radialSegments,50),openEnded:Eo(r.openEnded,!1),disableImpostor:Eo(r.disableImpostor,!1)};this.cylinderBuffer=new qd(n.cylinder,o),this.coneBuffer=new tf(n.cone,o),this.geometry=new ef([this.cylinderBuffer.geometry,this.coneBuffer.geometry]),this.group=new Ci,this.wireframeGroup=new Ci,this.pickingGroup=new Ci,this.matrix=Eo(r.matrix,new N),this.picking=i.picking},nf={matrix:{},pickable:{}};nf.matrix.set=function(t){xd.prototype.setMatrix.call(this,t)},nf.matrix.get=function(){return this.group.matrix.clone()},nf.pickable.get=function(){return!!this.picking},rf.prototype.makeAttributes=function(t){var e,i,r=this.splitPosition,n=this.cylinderRadius,o=this.aspectRatio,a={},s={};if(t.radius){for(e=0,i=n.length;e<i;++e)n[e]=t.radius[e]/o;a.radius=n,s.radius=t.radius}if(t.position1&&t.position2){var c=new O,u=new O,h=new O,l=new O;for(e=0,i=r.length;e<i;e+=3){c.fromArray(t.position1,e),u.fromArray(t.position2,e),h.subVectors(c,u);var p=h.length(),d=n[e/3]*o*2,f=Math.min(p,d);h.setLength(f),l.copy(u).add(h),l.toArray(r,e)}a.position1=t.position1,a.position2=r,s.position1=r,s.position2=t.position2}return t.color&&(a.color=t.color,a.color2=t.color,s.color=t.color),{cylinder:a,cone:s}},rf.prototype.getMesh=function(t){return(new Ci).add(this.cylinderBuffer.getMesh(t),this.coneBuffer.getMesh(t))},rf.prototype.getWireframeMesh=function(){return(new Ci).add(this.cylinderBuffer.getWireframeMesh(),this.coneBuffer.getWireframeMesh())},rf.prototype.getPickingMesh=function(){return(new Ci).add(this.cylinderBuffer.getPickingMesh(),this.coneBuffer.getPickingMesh())},rf.prototype.setAttributes=function(t){var e=this.makeAttributes(t);this.cylinderBuffer.setAttributes(e.cylinder),this.coneBuffer.setAttributes(e.cone)},rf.prototype.setParameters=function(t){(t=Object.assign({},t))&&void 0!==t.matrix&&(this.matrix=t.matrix),delete t.matrix,t&&void 0!==t.wireframe&&(this.wireframe=t.wireframe,this.setVisibility(this.visible)),this.cylinderBuffer.setParameters(t),this.coneBuffer.setParameters(t)},rf.prototype.setVisibility=function(){xd.prototype.setVisibility.apply(this,arguments)},rf.prototype.dispose=function(){this.cylinderBuffer.dispose(),this.coneBuffer.dispose()},Object.defineProperties(rf.prototype,nf),wc.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;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvarying vec3 vViewPosition;\n#endif\nvarying vec2 texCoord;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#endif\nattribute vec2 mapping;\nattribute vec2 inputTexCoord;\nattribute float inputSize;\n#include matrix_scale\n#include common\nvoid main(void){\n#if defined( PICKING )\nvPickingColor = unpackColor( primitiveId );\n#else\n#include color_vertex\n#endif\ntexCoord = inputTexCoord;\nfloat scale = matrixScale( modelViewMatrix );\nfloat _zOffset = zOffset * scale;\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 * scale;\ncameraCornerPos.x += xOffset * scale;\ncameraCornerPos.y += yOffset * scale;\nif( !ortho ){\ncameraCornerPos.xyz += normalize( -cameraCornerPos.xyz ) * _zOffset;\n}\ngl_Position = projectionMatrix * cameraCornerPos;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvViewPosition = -cameraCornerPos.xyz;\n#endif\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n#include radiusclip_vertex\n}"),wc.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#if defined( PICKING )\nuniform float objectId;\nvarying vec3 vPickingColor;\nconst vec3 vColor = vec3( 0.0 );\n#else\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#endif\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#if defined( PICKING )\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}");var of={};var af=function(t){var e=Object.assign({},t);if(this.font=Eo(e.font,["sans-serif"]),this.size=Eo(e.size,36),this.style=Eo(e.style,"normal"),this.variant=Eo(e.variant,"normal"),this.weight=Eo(e.weight,"normal"),this.outline=Eo(e.outline,0),this.width=Eo(e.width,2048),this.height=Eo(e.height,2048),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 Ri(this.canvas2),this.texture.flipY=!1,this.texture.needsUpdate=!0};af.prototype.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 r=i.getContext("2d");r.font=this.style+" "+this.variant+" "+this.weight+" "+this.size+"px "+this.font,r.fillStyle="#FF0000",r.textAlign="left",r.textBaseline="bottom",r.lineJoin="round";for(var n=[],o=3*this.outline,a=0;a<o;++a){var s=("00"+Math.max(0,8*-a+128-8*!a).toString(16)).slice(-2);n.push("#"+s+s+s)}var c=new Uint8Array(e*t*2);this.canvas=i,this.context=r,this.lineHeight=t,this.maxWidth=e,this.colors=n,this.scratch=c,this.data=new Uint8Array(this.width*this.height*4),this.canvas2=document.createElement("canvas"),this.canvas2.width=this.width,this.canvas2.height=this.height,this.context2=this.canvas2.getContext("2d")},af.prototype.map=function(t){return void 0===this.mapped[t]&&(this.draw(t),this.currentX+this.scratchW>this.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]},af.prototype.get=function(t){return this.mapped[t]||this.placeholder},af.prototype.draw=function(t){var e,i,r,n,o,a=this.lineHeight,s=this.outline,c=this.context,u=this.scratch,h=this.maxWidth,l=this.colors,p=s,d=a-this.outline,f=c.measureText(t),m=Math.min(h,Math.ceil(f.width+2*p+1));if(c.clearRect(0,0,m,a),0===this.outline)for(c.fillText(t,p,d),r=3,e=0,i=(o=(n=c.getImageData(0,0,m,a)).data).length/4;e<i;++e)u[e]=o[r],r+=4;else{for(c.globalCompositeOperation="source-over",e=s+1;e>0;--e)r=e>1?2*e-2:e,c.strokeStyle=l[r-1],c.lineWidth=r,c.strokeText(t,p,d);c.globalCompositeOperation="multiply",c.fillStyle="#FF00FF",c.fillText(t,p,d),o=(n=c.getImageData(0,0,m,a)).data,r=0;var g=this.gamma;for(e=0,i=o.length/4;e<i;++e){var v=o[r],y=v?o[r+1]/v:1;.5===g&&(y=Math.sqrt(y));var b=256-v,x=b+(v-b)*(y=Math.min(1,Math.max(0,y)));u[e]=Math.max(0,Math.min(255,x+2)),o[r+3]=u[e],r+=4}}c.putImageData(n,0,0),this.scratchW=m,this.scratchH=a},af.prototype.populate=function(){this.placeholder=this.map(String.fromCharCode(65533));for(var t=0;t<127;++t)this.map(String.fromCharCode(t));for(var e=128;e<255;++e)this.map(String.fromCharCode(e));for(var i=880;i<1023;++i)this.map(String.fromCharCode(i));for(var r=1024;r<1279;++r)this.map(String.fromCharCode(r));this.map(String.fromCharCode(8491))};var sf=function(t){function e(e,i){var r=e||{},n=i||{};n.forceTransparent=!0;for(var o=r.position.length/3,a=0,s=0;s<o;++s)a+=r.text[s].length;var c=a;n.showBackground&&(c+=o),t.call(this,{position:new Float32Array(3*c),color:new Float32Array(3*c),picking:new Qh},n),this.fontFamily=Eo(n.fontFamily,"sans-serif"),this.fontStyle=Eo(n.fontStyle,"normal"),this.fontWeight=Eo(n.fontWeight,"bold"),this.fontSize=Eo(n.fontSize,48),this.sdf=Eo(n.sdf,"Chrome"===hc),this.xOffset=Eo(n.xOffset,0),this.yOffset=Eo(n.yOffset,0),this.zOffset=Eo(n.zOffset,.5),this.attachment=Eo(n.attachment,"bottom-left"),this.showBorder=Eo(n.showBorder,!1),this.borderColor=Eo(n.borderColor,"lightgrey"),this.borderWidth=Eo(n.borderWidth,.15),this.showBackground=Eo(n.showBackground,!1),this.backgroundColor=Eo(n.backgroundColor,"lightgrey"),this.backgroundMargin=Eo(n.backgroundMargin,.5),this.backgroundOpacity=Eo(n.backgroundOpacity,1),this.text=r.text,this.positionCount=o,this.addUniforms({fontTexture:{value:null},xOffset:{value:this.xOffset},yOffset:{value:this.yOffset},zOffset:{value:this.zOffset},ortho:{value:!1},showBorder:{value:this.showBorder},borderColor:{value:new St(this.borderColor)},borderWidth:{value:this.borderWidth},backgroundColor:{value:new St(this.backgroundColor)},backgroundOpacity:{value:this.backgroundOpacity}}),this.addAttributes({inputTexCoord:{type:"v2",value:null},inputSize:{type:"f",value:null}}),this.setAttributes(e),this.makeTexture(),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={parameters:{},wireframe:{},isText:{},vertexShader:{},fragmentShader:{}};return i.parameters.get=function(){return Object.assign.call(this,{fontFamily:{uniform:!0},fontStyle:{uniform:!0},fontWeight:{uniform:!0},fontSize:{uniform:!0},sdf:{updateShader:!0,uniform:!0},xOffset:{uniform:!0},yOffset:{uniform:!0},zOffset:{uniform:!0},showBorder:{uniform:!0},borderColor:{uniform:!0},borderWidth:{uniform:!0},backgroundColor:{uniform:!0},backgroundOpacity:{uniform:!0}},t.prototype.parameters,{flatShaded:void 0})},e.prototype.makeMaterial=function(){t.prototype.makeMaterial.call(this);var e=this.texture,i=this.material;i.extensions.derivatives=!0,i.lights=!1,i.uniforms.fontTexture.value=e,i.needsUpdate=!0;var r=this.wireframeMaterial;r.extensions.derivatives=!0,r.lights=!1,r.uniforms.fontTexture.value=e,r.needsUpdate=!0;var n=this.pickingMaterial;n.extensions.derivatives=!0,n.lights=!1,n.uniforms.fontTexture.value=e,n.needsUpdate=!0},e.prototype.setAttributes=function(t){var e,i,r,n,o,a,s=this.text,c=this.geometry.attributes;t.position&&(e=t.position,n=c.position.array,c.position.needsUpdate=!0),t.size&&(i=t.size,o=c.inputSize.array,c.inputSize.needsUpdate=!0),t.color&&(r=t.color,a=c.color.array,c.color.needsUpdate=!0);for(var u,h,l,p,d=this.positionCount,f=0,m=0;m<d;++m)for(h=3*m,p=s[m].length,this.showBackground&&(p+=1),l=0;l<p;++l,++f)for(var g=0;g<4;g++)u=4*f*3+3*g,e&&(n[u]=e[h],n[u+1]=e[h+1],n[u+2]=e[h+2]),i&&(o[4*f+g]=i[m]),r&&(a[u]=r[h],a[u+1]=r[h+1],a[u+2]=r[h+2])},e.prototype.makeTexture=function(){var t,e;this.textAtlas=(t={font:[this.fontFamily],style:this.fontStyle,weight:this.fontWeight,size:this.fontSize,outline:this.sdf?5:0},e=JSON.stringify(t),void 0===of[e]&&(of[e]=new af(t)),of[e]),this.texture=this.textAtlas.texture},e.prototype.makeMapping=function(){for(var t,e,i,r,n,o,a,s,c=this.textAtlas,u=this.text,h=this.attachment,l=c.lineHeight*this.backgroundMargin*.1-10,p=this.geometry.attributes.inputTexCoord.array,d=this.geometry.attributes.mapping.array,f=this.positionCount,m=0,g=0;g<f;++g){for(r=0,o=(i=u[g]).length,n=0;n<o;++n)r+=(t=c.get(i[n])).w-2*c.outline;for(s=h.startsWith("top")?c.lineHeight/1.25:h.startsWith("middle")?c.lineHeight/2.5:0,a=h.endsWith("right")?r:h.endsWith("center")?r/2:0,a+=c.outline,s+=c.outline,this.showBackground&&(d[(e=2*m*4)+0]=-c.lineHeight/6-a-l,d[e+1]=c.lineHeight-s+l,d[e+2]=-c.lineHeight/6-a-l,d[e+3]=0-s-l,d[e+4]=r+c.lineHeight/6-a+2*c.outline+l,d[e+5]=c.lineHeight-s+l,d[e+6]=r+c.lineHeight/6-a+2*c.outline+l,d[e+7]=0-s-l,p[e+0]=10,p[e+2]=10,p[e+4]=10,p[e+6]=10,m+=1),r=0,n=0;n<o;++n,++m){t=c.get(i[n]),d[(e=2*m*4)+0]=r-a,d[e+1]=t.h-s,d[e+2]=r-a,d[e+3]=0-s,d[e+4]=r+t.w-a,d[e+5]=t.h-s,d[e+6]=r+t.w-a,d[e+7]=0-s;var v=c.width,y=c.height,b=[t.x/v,t.y/y,t.x/v,(t.y+t.h)/y,(t.x+t.w)/v,t.y/y,(t.x+t.w)/v,(t.y+t.h)/y];p.set(b,e),r+=t.w-2*c.outline}}this.geometry.attributes.inputTexCoord.needsUpdate=!0,this.geometry.attributes.mapping.needsUpdate=!0},e.prototype.getDefines=function(e){var i=t.prototype.getDefines.call(this,e);return this.sdf&&(i.SDF=1),i},e.prototype.setUniforms=function(e){!e||void 0===e.fontFamily&&void 0===e.fontStyle&&void 0===e.fontWeight&&void 0===e.fontSize&&void 0===e.sdf||(this.makeTexture(),this.makeMapping(),this.texture.needsUpdate=!0,e.fontTexture=this.texture),t.prototype.setUniforms.call(this,e)},i.wireframe.set=function(t){},i.wireframe.get=function(){return!1},i.isText.get=function(){return!0},i.vertexShader.get=function(){return"SDFFont.vert"},i.fragmentShader.get=function(){return"SDFFont.frag"},Object.defineProperties(e.prototype,i),e}(Rd);function cf(t,e){void 0!==t.toArray?t=t.toArray():void 0!==t.x?t=[t.x,t.y,t.z]:void 0!==t.r&&(t=[t.r,t.g,t.b]),e.push.apply(e,t)}var uf=new O,hf=new jt,lf=function(t,e){this.name=Eo(t,"shape");var i=e||{};this.aspectRatio=Eo(i.aspectRatio,1.5),this.sphereDetail=Eo(i.sphereDetail,2),this.radialSegments=Eo(i.radialSegments,50),this.disableImpostor=Eo(i.disableImpostor,!1),this.openEnded=Eo(i.openEnded,!1),this.labelParams=Eo(i.labelParams,{}),this.boundingBox=new jt,this.bufferList=[],this.meshCount=0,this.spherePosition=[],this.sphereColor=[],this.sphereRadius=[],this.sphereName=[],this.ellipsoidPosition=[],this.ellipsoidColor=[],this.ellipsoidRadius=[],this.ellipsoidMajorAxis=[],this.ellipsoidMinorAxis=[],this.ellipsoidName=[],this.cylinderPosition1=[],this.cylinderPosition2=[],this.cylinderColor=[],this.cylinderRadius=[],this.cylinderName=[],this.conePosition1=[],this.conePosition2=[],this.coneColor=[],this.coneRadius=[],this.coneName=[],this.arrowPosition1=[],this.arrowPosition2=[],this.arrowColor=[],this.arrowRadius=[],this.arrowName=[],this.labelPosition=[],this.labelColor=[],this.labelSize=[],this.labelText=[]},pf={center:{},type:{}};lf.prototype.addBuffer=function(t){this.bufferList.push(t);var e=t.geometry;return e.boundingBox||e.computeBoundingBox(),this.boundingBox.union(e.boundingBox),this},lf.prototype.addMesh=function(t,e,i,r,n){t=$o(t),e=$o(e),Array.isArray(i)&&(i=zo(i,t.length)),r&&(r=$o(r));var o={position:t,color:e,index:i,normal:r},a=new Jh(this,Object.assign({serial:this.meshCount,name:n},o)),s=new wd(Object.assign({picking:a},o));return this.bufferList.push(s),hf.setFromArray(t),this.boundingBox.union(hf),this.meshCount+=1,this},lf.prototype.addSphere=function(t,e,i,r){return cf(t,this.spherePosition),cf(e,this.sphereColor),this.sphereRadius.push(i),this.sphereName.push(r),this.boundingBox.expandByPoint(uf.fromArray(t)),this},lf.prototype.addEllipsoid=function(t,e,i,r,n,o){return cf(t,this.ellipsoidPosition),cf(e,this.ellipsoidColor),this.ellipsoidRadius.push(i),cf(r,this.ellipsoidMajorAxis),cf(n,this.ellipsoidMinorAxis),this.ellipsoidName.push(o),this.boundingBox.expandByPoint(uf.fromArray(t)),this},lf.prototype.addCylinder=function(t,e,i,r,n){return cf(t,this.cylinderPosition1),cf(e,this.cylinderPosition2),cf(i,this.cylinderColor),this.cylinderRadius.push(r),this.cylinderName.push(n),this.boundingBox.expandByPoint(uf.fromArray(t)),this.boundingBox.expandByPoint(uf.fromArray(e)),this},lf.prototype.addCone=function(t,e,i,r,n){return cf(t,this.conePosition1),cf(e,this.conePosition2),cf(i,this.coneColor),this.coneRadius.push(r),this.coneName.push(n),this.boundingBox.expandByPoint(uf.fromArray(t)),this.boundingBox.expandByPoint(uf.fromArray(e)),this},lf.prototype.addArrow=function(t,e,i,r,n){return cf(t,this.arrowPosition1),cf(e,this.arrowPosition2),cf(i,this.arrowColor),this.arrowRadius.push(r),this.arrowName.push(n),this.boundingBox.expandByPoint(uf.fromArray(t)),this.boundingBox.expandByPoint(uf.fromArray(e)),this},lf.prototype.addLabel=function(t,e,i,r){return cf(t,this.labelPosition),cf(e,this.labelColor),this.labelSize.push(i),this.labelText.push(r),this.boundingBox.expandByPoint(uf.fromArray(t)),this},lf.prototype.getBufferList=function(){var t=[];if(this.spherePosition.length){var e=new Od({position:new Float32Array(this.spherePosition),color:new Float32Array(this.sphereColor),radius:new Float32Array(this.sphereRadius),picking:new tl(this)},{sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor});t.push(e)}if(this.ellipsoidPosition.length){var i=new zd({position:new Float32Array(this.ellipsoidPosition),color:new Float32Array(this.ellipsoidColor),radius:new Float32Array(this.ellipsoidRadius),majorAxis:new Float32Array(this.ellipsoidMajorAxis),minorAxis:new Float32Array(this.ellipsoidMinorAxis),picking:new Kh(this)},{sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor});t.push(i)}if(this.cylinderPosition1.length){var r=new qd({position1:new Float32Array(this.cylinderPosition1),position2:new Float32Array(this.cylinderPosition2),color:new Float32Array(this.cylinderColor),color2:new Float32Array(this.cylinderColor),radius:new Float32Array(this.cylinderRadius),picking:new Gh(this)},{radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,openEnded:this.openEnded});t.push(r)}if(this.conePosition1.length){var n=new tf({position1:new Float32Array(this.conePosition1),position2:new Float32Array(this.conePosition2),color:new Float32Array(this.coneColor),radius:new Float32Array(this.coneRadius),picking:new qh(this)},{radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,openEnded:this.openEnded});t.push(n)}if(this.arrowPosition1.length){var o=new rf({position1:new Float32Array(this.arrowPosition1),position2:new Float32Array(this.arrowPosition2),color:new Float32Array(this.arrowColor),radius:new Float32Array(this.arrowRadius),picking:new Vh(this)},{aspectRatio:this.aspectRatio,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,openEnded:this.openEnded});t.push(o)}if(this.labelPosition.length){var a=new sf({position:new Float32Array(this.labelPosition),color:new Float32Array(this.labelColor),size:new Float32Array(this.labelSize),text:this.labelText},this.labelParams);t.push(a)}return this.bufferList.concat(t)},lf.prototype.dispose=function(){this.bufferList.forEach((function(t){t.dispose()})),this.bufferList.length=0,this.spherePosition.length=0,this.sphereColor.length=0,this.sphereRadius.length=0,this.sphereName.length=0,this.ellipsoidPosition.length=0,this.ellipsoidColor.length=0,this.ellipsoidRadius.length=0,this.ellipsoidMajorAxis.length=0,this.ellipsoidMinorAxis.length=0,this.ellipsoidName.length=0,this.cylinderPosition1.length=0,this.cylinderPosition2.length=0,this.cylinderColor.length=0,this.cylinderRadius.length=0,this.cylinderName.length=0,this.conePosition1.length=0,this.conePosition2.length=0,this.coneColor.length=0,this.coneRadius.length=0,this.coneName.length=0,this.arrowPosition1.length=0,this.arrowPosition2.length=0,this.arrowColor.length=0,this.arrowRadius.length=0,this.arrowName.length=0,this.labelPosition.length=0,this.labelColor.length=0,this.labelSize.length=0,this.labelText.length=0},pf.center.get=function(){return this._center||(this._center=this.boundingBox.getCenter()),this._center},pf.type.get=function(){return"Shape"},Object.defineProperties(lf.prototype,pf);var df=function(t,e,i){this.type="",this.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},depthWrite:{type:"boolean",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:{}},colorScale:{type:"select",update:"color",options:yc.getScales()},colorReverse:{type:"boolean",update:"color"},colorValue:{type:"color",update:"color"},colorDomain:{type:"hidden",update:"color"},colorMode:{type:"select",update:"color",options:yc.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},matrix:{type:"hidden",buffer:!0},disablePicking:{type:"boolean",rebuild:!0}},this.viewer=e,this.tasks=new $c,this.queue=new dd(this.make.bind(this)),this.bufferList=[],this.parameters.colorScheme&&(this.parameters.colorScheme.options=yc.getSchemes())};df.prototype.init=function(t){var e=t||{};this.clipNear=Eo(e.clipNear,0),this.clipRadius=Eo(e.clipRadius,0),this.clipCenter=Eo(e.clipCenter,new O),this.flatShaded=Eo(e.flatShaded,!1),this.side=Eo(e.side,"double"),this.opacity=Eo(e.opacity,1),this.depthWrite=Eo(e.depthWrite,!0),this.wireframe=Eo(e.wireframe,!1),this.linewidth=Eo(e.linewidth,2),this.setColor(e.color,e),this.colorScheme=Eo(e.colorScheme,"uniform"),this.colorScale=Eo(e.colorScale,""),this.colorReverse=Eo(e.colorReverse,!1),this.colorValue=Eo(e.colorValue,9474192),this.colorDomain=Eo(e.colorDomain,void 0),this.colorMode=Eo(e.colorMode,"hcl"),this.visible=Eo(e.visible,!0),this.quality=Eo(e.quality,void 0),this.roughness=Eo(e.roughness,.4),this.metalness=Eo(e.metalness,0),this.diffuse=Eo(e.diffuse,16777215),this.lazy=Eo(e.lazy,!1),this.lazyProps={build:!1,bufferParams:{},what:{}},this.matrix=Eo(e.matrix,new N),this.disablePicking=Eo(e.disablePicking,!1);var i=this.parameters;!0===i.sphereDetail&&(i.sphereDetail={type:"integer",max:3,min:0,rebuild:"impostor"}),!0===i.radialSegments&&(i.radialSegments={type:"integer",max:25,min:5,rebuild:"impostor"}),!0===i.openEnded&&(i.openEnded={type:"boolean",rebuild:"impostor",buffer:!0}),!0===i.disableImpostor&&(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=Eo(e.sphereDetail,1)),i.radialSegments&&(this.radialSegments=Eo(e.radialSegments,10))),i.openEnded&&(this.openEnded=Eo(e.openEnded,!0)),i.disableImpostor&&(this.disableImpostor=Eo(e.disableImpostor,!1))},df.prototype.getColorParams=function(t){return Object.assign({scheme:this.colorScheme,scale:this.colorScale,reverse:this.colorReverse,value:this.colorValue,domain:this.colorDomain,mode:this.colorMode},t)},df.prototype.getBufferParams=function(t){return Object.assign({clipNear:this.clipNear,clipRadius:this.clipRadius,clipCenter:this.clipCenter,flatShaded:this.flatShaded,opacity:this.opacity,depthWrite:this.depthWrite,side:this.side,wireframe:this.wireframe,linewidth:this.linewidth,roughness:this.roughness,metalness:this.metalness,diffuse:this.diffuse,matrix:this.matrix,disablePicking:this.disablePicking},t)},df.prototype.setColor=function(t,e){return Object.keys(yc.getSchemes()).includes(t)?e?e.colorScheme=t:this.setParameters({colorScheme:t}):void 0!==t&&(t=new St(t).getHex(),e?(e.colorScheme="uniform",e.colorValue=t):this.setParameters({colorScheme:"uniform",colorValue:t})),this},df.prototype.create=function(){},df.prototype.update=function(){this.build()},df.prototype.build=function(t){if(!this.lazy||this.visible){if(!this.prepare)return this.tasks.increment(),void this.make();this.queue.length()>0?(this.tasks.change(1-this.queue.length()),this.queue.kill()):this.tasks.increment(),this.queue.push(t||!1)}else this.lazyProps.build=!0},df.prototype.make=function(t,e){gc&&mc.time("Representation.make "+this.type);var i=function(){t?(this.update(t),this.viewer.requestRender(),this.tasks.decrement(),e&&e()):(this.clear(),this.create(),this.manualAttach||this.disposed||(gc&&mc.time("Representation.attach "+this.type),this.attach(function(){gc&&mc.timeEnd("Representation.attach "+this.type),this.tasks.decrement(),e&&e()}.bind(this)))),gc&&mc.timeEnd("Representation.make "+this.type)}.bind(this);this.prepare?this.prepare(i):i()},df.prototype.attach=function(t){this.setVisibility(this.visible),t()},df.prototype.setVisibility=function(t,e){if(this.visible=t,this.visible){var i=this.lazyProps,r=i.bufferParams,n=i.what;if(i.build)return i.build=!1,void this.build();(Object.keys(r).length||Object.keys(n).length)&&(i.bufferParams={},i.what={},this.updateParameters(r,n))}return this.bufferList.forEach((function(e){e.setVisibility(t)})),e||this.viewer.requestRender(),this},df.prototype.setParameters=function(t,e,i){var r=t||{},n=this.parameters;e=e||{},i=i||!1;var o={};for(var a in r)void 0!==r[a]&&void 0!==n[a]&&(n[a].int&&(r[a]=parseInt(r[a])),n[a].float&&(r[a]=parseFloat(r[a])),(r[a]!==this[a]||r[a].equals&&!r[a].equals(this[a]))&&(this[a].set?this[a].set(r[a]):this[a]=r[a],n[a].buffer&&(!0===n[a].buffer?o[a]=r[a]:o[n[a].buffer]=r[a]),n[a].update&&(e[n[a].update]=!0),!n[a].rebuild||"impostor"===n[a].rebuild&&dc&&!this.disableImpostor||(i=!0)));return i?this.build():this.updateParameters(o,e),this},df.prototype.updateParameters=function(t,e){if(this.lazy&&!this.visible)return 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),this.viewer.requestRender()},df.prototype.getParameters=function(){var t=this,e={lazy:this.lazy,visible:this.visible,quality:this.quality};return Object.keys(this.parameters).forEach((function(i){null!==t.parameters[i]&&(e[i]=t[i])})),e},df.prototype.clear=function(){var t=this;this.bufferList.forEach((function(e){t.viewer.remove(e),e.dispose()})),this.bufferList.length=0,this.viewer.requestRender()},df.prototype.dispose=function(){this.disposed=!0,this.queue.kill(),this.tasks.dispose(),this.clear()};var ff=function(t){function e(e,i,r){Array.isArray(e)||(e=[e]),t.call(this,e,i,r),this.type="buffer",this.parameters=Object.assign({},this.parameters,{colorScheme:null,colorScale:null,colorValue:null,colorDomain:null,colorMode:null}),this.buffer=e,this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){t.prototype.init.call(this,e),this.build()},e.prototype.create=function(){this.bufferList.push.apply(this.bufferList,this.buffer)},e.prototype.attach=function(t){var e=this;this.bufferList.forEach((function(t){e.viewer.add(t),t.setParameters(e.getBufferParams())})),this.setVisibility(this.visible),t()},e}(df),mf=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isSurface:{}};return i.isSurface.get=function(){return!0},Object.defineProperties(e.prototype,i),e}(wd);function gf(t){t.visible=!0}function vf(t){t.visible=!1}var yf=function(t){this.size=t.size,this.side=t.side,this.wireframe=t.wireframe,this.visible=t.visible,this.geometry=t.geometry,this.picking=t.picking,this.background=t.background,this.disablePicking=t.disablePicking,this.group=new Ci,this.wireframeGroup=new Ci,this.pickingGroup=new Ci,this.matrix=t.matrix,this.frontMeshes=[],this.backMeshes=[];var e=t,i=new t.constructor;e.makeMaterial(),i.makeMaterial(),i.picking=t.picking,i.geometry=t.geometry,i.wireframeGeometry=t.wireframeGeometry,i.setParameters(t.getParameters()),i.updateShader(),e.setParameters({side:"front"}),i.setParameters({side:"back",opacity:i.opacity}),this.buffer=t,this.frontBuffer=e,this.backBuffer=i},bf={matrix:{},pickable:{}};bf.matrix.set=function(t){xd.prototype.setMatrix.call(this,t)},bf.matrix.get=function(){return this.group.matrix.clone()},bf.pickable.get=function(){return!!this.picking&&!this.disablePicking},yf.prototype.getMesh=function(t){var e,i;return t?(i=this.backBuffer.getPickingMesh(),e=this.frontBuffer.getPickingMesh()):(i=this.backBuffer.getMesh(),e=this.frontBuffer.getMesh()),this.frontMeshes.push(e),this.backMeshes.push(i),this.setParameters({side:this.side}),(new Ci).add(i,e)},yf.prototype.getWireframeMesh=function(){return this.buffer.getWireframeMesh()},yf.prototype.getPickingMesh=function(){return this.getMesh(!0)},yf.prototype.setAttributes=function(t){this.buffer.setAttributes(t)},yf.prototype.setParameters=function(t){"front"===(t=Object.assign({},t)).side?(this.frontMeshes.forEach(gf),this.backMeshes.forEach(vf)):"back"===t.side?(this.frontMeshes.forEach(vf),this.backMeshes.forEach(gf)):"double"===t.side&&(this.frontMeshes.forEach(gf),this.backMeshes.forEach(gf)),void 0!==t.matrix&&(this.matrix=t.matrix),delete t.matrix,void 0!==t.side&&(this.side=t.side),delete t.side,this.frontBuffer.setParameters(t),void 0!==t.wireframe&&(this.wireframe=t.wireframe,this.setVisibility(this.visible)),delete t.wireframe,this.backBuffer.setParameters(t)},yf.prototype.dispose=function(){this.frontBuffer.dispose(),this.backBuffer.dispose()},Object.defineProperties(yf.prototype,bf),yf.prototype.setVisibility=xd.prototype.setVisibility,wc.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}"),wc.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}");var xf=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isLine:{},vertexShader:{},fragmentShader:{}};return i.isLine.get=function(){return!0},i.vertexShader.get=function(){return"Line.vert"},i.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,i),e}(xd),_f=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="surface",this.parameters=Object.assign({isolevelType:{type:"select",options:{value:"value",sigma:"sigma"}},isolevel:{type:"number",precision:2,max:1e3,min:-1e3},negateIsolevel:{type:"boolean"},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},colorVolume:{type:"hidden"},contour:{type:"boolean",rebuild:!0},useWorker:{type:"boolean",rebuild:!0},wrap:{type:"boolean",rebuild:!0}},this.parameters),e instanceof lp?(this.surface=void 0,this.volume=e):(this.surface=e,this.volume=void 0),this.boxCenter=new O,this.__boxCenter=new O,this.box=new jt,this.__box=new jt,this._position=new O,this.setBox=function(){this._position.copy(i.translationGroup.position).negate(),this._position.equals(this.boxCenter)||this.setParameters({boxCenter:this._position})},this.viewer.signals.ticked.add(this.setBox,this),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"uniform"),i.colorValue=Eo(i.colorValue,14540253),this.isolevelType=Eo(i.isolevelType,"sigma"),this.isolevel=Eo(i.isolevel,2),this.negateIsolevel=Eo(i.negateIsolevel,!1),this.smooth=Eo(i.smooth,0),this.background=Eo(i.background,!1),this.opaqueBack=Eo(i.opaqueBack,!0),this.boxSize=Eo(i.boxSize,0),this.colorVolume=Eo(i.colorVolume,void 0),this.contour=Eo(i.contour,!1),this.useWorker=Eo(i.useWorker,!0),this.wrap=Eo(i.wrap,!1),t.prototype.init.call(this,i),this.build()},e.prototype.attach=function(t){var e=this;this.bufferList.forEach((function(t){e.viewer.add(t)})),this.setVisibility(this.visible),t()},e.prototype.prepare=function(t){var e,i=this;if(this.volume)if(e="sigma"===this.isolevelType?this.volume.getValueForSigma(this.isolevel):this.isolevel,this.negateIsolevel&&(e*=-1),!this.surface||this.__isolevel!==e||this.__smooth!==this.smooth||this.__contour!==this.contour||this.__wrap!==this.wrap||this.__boxSize!==this.boxSize||this.boxSize>0&&!this.__boxCenter.equals(this.boxCenter)){this.__isolevel=e,this.__smooth=this.smooth,this.__contour=this.contour,this.__wrap=this.wrap,this.__boxSize=this.boxSize,this.__boxCenter.copy(this.boxCenter),this.__box.copy(this.box);var r=function(e){i.surface=e,t()};this.useWorker?this.volume.getSurfaceWorker(e,this.smooth,this.boxCenter,this.boxSize,this.contour,this.wrap,r):r(this.volume.getSurface(e,this.smooth,this.boxCenter,this.boxSize,this.contour,this.wrap))}else t();else t()},e.prototype.create=function(){var t,e={position:this.surface.getPosition(),color:this.surface.getColor(this.getColorParams()),index:this.surface.getIndex()};if(this.contour)t=new xf(e,this.getBufferParams({wireframe:!1}));else{e.normal=this.surface.getNormal(),e.picking=this.surface.getPicking();var i=new mf(e,this.getBufferParams({background:this.background,opaqueBack:this.opaqueBack,dullInterior:!1}));t=new yf(i)}this.bufferList.push(t)},e.prototype.update=function(t){if(0!==this.bufferList.length){var e={};(t=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)}))}},e.prototype.setParameters=function(e,i,r){return e&&void 0!==e.isolevelType&&this.volume&&("value"===this.isolevelType&&"sigma"===e.isolevelType?this.isolevel=this.volume.getSigmaForValue(this.isolevel):"sigma"===this.isolevelType&&"value"===e.isolevelType&&(this.isolevel=this.volume.getValueForSigma(this.isolevel)),this.isolevelType=e.isolevelType),e&&e.boxCenter&&(this.boxCenter.copy(e.boxCenter),delete e.boxCenter),e&&e.wireframe&&(e.contour||void 0===e.contour&&this.contour)&&(e.wireframe=!1),t.prototype.setParameters.call(this,e,i,r),this.volume&&this.volume.getBox(this.boxCenter,this.boxSize,this.box),e&&void 0!==e.colorVolume&&(i.color=!0),this.surface&&(void 0!==e.isolevel||void 0!==e.negateIsolevel||void 0!==e.smooth||void 0!==e.wrap||void 0!==e.boxSize||this.boxSize>0&&!this.__box.equals(this.box))&&this.build({position:!0,color:!0,index:!0,normal:!this.contour}),this},e.prototype.getColorParams=function(){var e=t.prototype.getColorParams.call(this);return e.volume=this.colorVolume,e},e.prototype.dispose=function(){this.viewer.signals.ticked.remove(this.setBox,this),t.prototype.dispose.call(this)},e}(df);wc.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#if defined( PICKING )\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#endif\n#include common\nvoid main(){\n#if defined( PICKING )\nvPickingColor = unpackColor( primitiveId );\n#else\n#include color_vertex\n#endif\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}"),wc.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#if defined( PICKING )\nuniform float objectId;\nvarying vec3 vPickingColor;\n#else\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#endif\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\n#if defined( PICKING )\n#ifdef USE_MAP\nif( texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) ).a < 0.5 )\ndiscard;\n#endif\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\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#endif\n}");var wf=function(t){function e(e,i){var r=e||{},n=i||{};r.primitiveId||(r.primitiveId=su(r.position.length/3)),t.call(this,r,n),this.pointSize=Eo(n.pointSize,1),this.sizeAttenuation=Eo(n.sizeAttenuation,!0),this.sortParticles=Eo(n.sortParticles,!1),this.alphaTest=Eo(n.alphaTest,.5),this.useTexture=Eo(n.useTexture,!1),this.forceTransparent=Eo(n.forceTransparent,!1),this.edgeBleach=Eo(n.edgeBleach,0),this.addUniforms({size:{value:this.pointSize},canvasHeight:{value:1},pixelRatio:{value:1},map:{value:null}})}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={parameters:{},isPoint:{},vertexShader:{},fragmentShader:{}};return i.parameters.get=function(){return Object.assign.call(this,{pointSize:{uniform:"size"},sizeAttenuation:{updateShader:!0},sortParticles:{},alphaTest:{updateShader:!0},useTexture:{updateShader:!0},forceTransparent:{},edgeBleach:{uniform:!0}},t.prototype.parameters)},e.prototype.makeMaterial=function(){t.prototype.makeMaterial.call(this),this.makeTexture();var e=this.material,i=this.wireframeMaterial,r=this.pickingMaterial;e.uniforms.map.value=this.tex,e.needsUpdate=!0,i.uniforms.map.value=this.tex,i.needsUpdate=!0,r.uniforms.map.value=this.tex,r.needsUpdate=!0},e.prototype.makeTexture=function(){this.tex&&this.tex.dispose(),this.tex=function(t){for(var e,i,r=t||{},n=Eo(r.width,256),o=Eo(r.height,256),a=[n/2,o/2],s=Math.min(n/2,o/2),c=Eo(r.delta,1/(s+1))*s,u=0,h=0,l=new Uint8Array(n*o*4),p=0,d=l.length;p<d;p+=4){var f=1-Rs(s-c,s,(e=void 0,i=void 0,e=a[0]-u,i=a[1]-h,Math.sqrt(e*e+i*i)));l[p]=255*f,l[p+1]=255*f,l[p+2]=255*f,l[p+3]=255*f,++u===n&&(u=0,h++)}var m=new D(l,n,o);return m.needsUpdate=!0,m}({delta:this.edgeBleach})},e.prototype.getDefines=function(e){var i=t.prototype.getDefines.call(this,e);return this.sizeAttenuation&&(i.USE_SIZEATTENUATION=1),this.useTexture&&(i.USE_MAP=1),this.alphaTest>0&&this.alphaTest<=1&&(i.ALPHATEST=this.alphaTest.toPrecision(2)),i},e.prototype.setUniforms=function(e){e&&void 0!==e.edgeBleach&&(this.makeTexture(),e.map=this.tex),t.prototype.setUniforms.call(this,e)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.tex&&this.tex.dispose()},i.isPoint.get=function(){return!0},i.vertexShader.get=function(){return"Point.vert"},i.fragmentShader.get=function(){return"Point.frag"},Object.defineProperties(e.prototype,i),e}(xd),Sf=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="dot",this.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}},this.parameters,{colorScheme:{type:"select",update:"color",options:{"":"",value:"value",uniform:"uniform",random:"random"}}}),e instanceof lp?(this.surface=void 0,this.volume=new dp(e)):(this.surface=e,this.volume=void 0),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"uniform"),i.colorValue=Eo(i.colorValue,14540253),this.thresholdType=Eo(i.thresholdType,"sigma"),this.thresholdMin=Eo(i.thresholdMin,2),this.thresholdMax=Eo(i.thresholdMax,1/0),this.thresholdOut=Eo(i.thresholdOut,!1),this.dotType=Eo(i.dotType,"point"),this.radius=Eo(i.radius,.1),this.scale=Eo(i.scale,1),this.pointSize=Eo(i.pointSize,1),this.sizeAttenuation=Eo(i.sizeAttenuation,!0),this.sortParticles=Eo(i.sortParticles,!1),this.useTexture=Eo(i.useTexture,!1),this.alphaTest=Eo(i.alphaTest,.5),this.forceTransparent=Eo(i.forceTransparent,!1),this.edgeBleach=Eo(i.edgeBleach,0),t.prototype.init.call(this,i),this.build()},e.prototype.attach=function(t){var e=this;this.bufferList.forEach((function(t){e.viewer.add(t)})),this.setVisibility(this.visible),t()},e.prototype.create=function(){var t={};if(this.volume){var e,i,r=this.volume;"sigma"===this.thresholdType?(e=r.getValueForSigma(this.thresholdMin),i=r.getValueForSigma(this.thresholdMax)):(e=this.thresholdMin,i=this.thresholdMax),r.setFilter(e,i,this.thresholdOut),t.position=r.getDataPosition(),t.color=r.getDataColor(this.getColorParams()),"sphere"===this.dotType&&(t.radius=r.getDataSize(this.radius,this.scale),t.picking=r.getDataPicking())}else{var n=this.surface;t.position=n.getPosition(),t.color=n.getColor(this.getColorParams()),"sphere"===this.dotType&&(t.radius=n.getSize(this.radius,this.scale),t.picking=n.getPicking())}"sphere"===this.dotType?this.dotBuffer=new Od(t,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!1})):this.dotBuffer=new wf(t,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)},e.prototype.update=function(t){if(0!==this.bufferList.length){var e={};(t=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)}},e.prototype.setParameters=function(e,i,r){return i=i||{},e&&void 0!==e.thresholdType&&this.volume instanceof lp&&("value"===this.thresholdType&&"sigma"===e.thresholdType?(this.thresholdMin=this.volume.getSigmaForValue(this.thresholdMin),this.thresholdMax=this.volume.getSigmaForValue(this.thresholdMax)):"sigma"===this.thresholdType&&"value"===e.thresholdType&&(this.thresholdMin=this.volume.getValueForSigma(this.thresholdMin),this.thresholdMax=this.volume.getValueForSigma(this.thresholdMax)),this.thresholdType=e.thresholdType),e&&void 0!==e.radiusType&&("radius"===e.radiusType?this.radius=.1:this.radius=e.radiusType,i.radius=!0,"sphere"!==this.dotType||dc&&!this.disableImpostor||(r=!0)),e&&void 0!==e.radius&&(i.radius=!0,"sphere"!==this.dotType||dc&&!this.disableImpostor||(r=!0)),e&&void 0!==e.scale&&(i.scale=!0,"sphere"!==this.dotType||dc&&!this.disableImpostor||(r=!0)),t.prototype.setParameters.call(this,e,i,r),this},e}(df);wc.add("shader/Image.vert","uniform float clipRadius;\nuniform vec3 clipCenter;\nvarying vec2 vUv;\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\nvoid main() {\n#include begin_vertex\n#include project_vertex\nvUv = uv;\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}"),wc.add("shader/Image.frag","uniform sampler2D map;\nuniform float opacity;\nuniform vec2 mapSize;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec2 vUv;\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\n#if defined( PICKING )\nuniform sampler2D pickingMap;\nuniform float objectId;\n#else\n#include fog_pars_fragment\n#endif\n#if defined( CUBIC_INTERPOLATION )\n#if defined( CATMULROM_FILTER ) || defined( MITCHELL_FILTER )\n#if defined( CATMULROM_FILTER )\nconst float B = 0.0;\nconst float C = 0.5;\n#elif defined( MITCHELL_FILTER )\nconst float B = 0.333;\nconst float C = 0.333;\n#endif\nfloat filter( float x ){\nfloat f = x;\nif( f < 0.0 ){\nf = -f;\n}\nif( f < 1.0 ){\nreturn ( ( 12.0 - 9.0 * B - 6.0 * C ) * ( f * f * f ) +\n( -18.0 + 12.0 * B + 6.0 *C ) * ( f * f ) +\n( 6.0 - 2.0 * B ) ) / 6.0;\n}else if( f >= 1.0 && f < 2.0 ){\nreturn ( ( -B - 6.0 * C ) * ( f * f * f )\n+ ( 6.0 * B + 30.0 * C ) * ( f *f ) +\n( - ( 12.0 * B ) - 48.0 * C ) * f +\n8.0 * B + 24.0 * C ) / 6.0;\n}else{\nreturn 0.0;\n}\n}\n#elif defined( BSPLINE_FILTER )\nfloat filter( float x ){\nfloat f = x;\nif( f < 0.0 ){\nf = -f;\n}\nif( f >= 0.0 && f <= 1.0 ){\nreturn ( 2.0 / 3.0 ) + ( 0.5 ) * ( f * f * f ) - ( f * f );\n}else if( f > 1.0 && f <= 2.0 ){\nreturn 1.0 / 6.0 * pow( ( 2.0 - f ), 3.0 );\n}\nreturn 1.0;\n}\n#else\nfloat filter( float x ){\nreturn 1.0;\n}\n#endif\nvec4 biCubic( sampler2D tex, vec2 texCoord ){\nvec2 texelSize = 1.0 / mapSize;\ntexCoord -= texelSize / 2.0;\nvec4 nSum = vec4( 0.0 );\nfloat nDenom = 0.0;\nvec2 cell = fract( texCoord * mapSize );\nfor( float m = -1.0; m <= 2.0; ++m ){\nfor( float n = -1.0; n <= 2.0; ++n ){\nvec4 vecData = texture2D(\ntex, texCoord + texelSize * vec2( m, n )\n);\nfloat c = filter( m - cell.x ) * filter( -n + cell.y );\nnSum += vecData * c;\nnDenom += c;\n}\n}\nreturn nSum / nDenom;\n}\n#endif\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\n#if defined( CUBIC_INTERPOLATION )\ngl_FragColor = biCubic( map, vUv );\n#else\ngl_FragColor = texture2D( map, vUv );\n#endif\n#if defined( PICKING )\nif( gl_FragColor.a < 0.7 )\ndiscard;\ngl_FragColor = vec4( texture2D( pickingMap, vUv ).xyz, objectId );\n#else\nif( gl_FragColor.a < 0.01 )\ndiscard;\ngl_FragColor.a *= opacity;\n#include fog_fragment\n#endif\n}");var Af=new Uint16Array([0,1,2,1,3,2]),Mf=new Float32Array([0,1,0,0,1,1,1,0]),Pf=function(t){function e(e,i){var r=e||{},n=i||{};t.call(this,{position:r.position,index:Af,picking:r.picking},n),this.forceTransparent=!0,this.filter=Eo(n.filter,"nearest");var o=new D(r.imageData,r.width,r.height);o.flipY=!0,this.tex=o;for(var a=r.imageData.length,s=new Uint8Array(a),c=0;c<a;c+=4){var u=c/4;s[c]=u>>16&255,s[c+1]=u>>8&255,s[c+2]=255&u}var h=new D(s,r.width,r.height);h.flipY=!0,h.minFilter=1003,h.magFilter=1003,this.pickingTex=h,this.addUniforms({map:{value:o},pickingMap:{value:h},mapSize:{value:new _(r.width,r.height)}}),this.geometry.addAttribute("uv",new me(Mf,2))}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={parameters:{},vertexShader:{},fragmentShader:{}};return i.parameters.get=function(){return Object.assign.call(this,{filter:{updateShader:!0,uniform:!0}},t.prototype.parameters)},e.prototype.getDefines=function(e){var i=t.prototype.getDefines.call(this,e);return this.filter.startsWith("cubic")&&(i.CUBIC_INTERPOLATION=1,this.filter.endsWith("bspline")?i.BSPLINE_FILTER=1:this.filter.endsWith("catmulrom")?i.CATMULROM_FILTER=1:this.filter.endsWith("mitchell")&&(i.MITCHELL_FILTER=1)),i},e.prototype.updateTexture=function(){var t=this.tex;this.filter.startsWith("cubic")?(t.minFilter=1003,t.magFilter=1003):"linear"===this.filter?(t.minFilter=1006,t.magFilter=1006):(t.minFilter=1003,t.magFilter=1003),t.needsUpdate=!0,this.pickingTex.needsUpdate=!0},e.prototype.makeMaterial=function(){t.prototype.makeMaterial.call(this),this.updateTexture();var e=this.material;e.uniforms.map.value=this.tex,e.blending=1,e.needsUpdate=!0;var i=this.wireframeMaterial;i.uniforms.map.value=this.tex,i.blending=1,i.needsUpdate=!0;var r=this.pickingMaterial;r.uniforms.map.value=this.tex,r.uniforms.pickingMap.value=this.pickingTex,r.blending=1,r.needsUpdate=!0},e.prototype.setUniforms=function(e){e&&void 0!==e.filter&&(this.updateTexture(),e.map=this.tex),t.prototype.setUniforms.call(this,e)},i.vertexShader.get=function(){return"Image.vert"},i.fragmentShader.get=function(){return"Image.frag"},Object.defineProperties(e.prototype,i),e}(xd),Tf=function(t,e){var i=e||{};this.dimension=Eo(i.dimension,"x"),this.positionType=Eo(i.positionType,"percent"),this.position=Eo(i.position,30),this.thresholdType=Eo(i.thresholdType,"sigma"),this.thresholdMin=Eo(i.thresholdMin,-1/0),this.thresholdMax=Eo(i.thresholdMax,1/0),this.normalize=Eo(i.normalize,!1),this.volume=t};Tf.prototype.getPositionFromCoordinate=function(t){var e,i=this.dimension,r=this.volume,n=r.matrix,o=(new O).setFromMatrixPosition(n)[i],a=(new O).setFromMatrixScale(n)[i];return e="x"===i?r.nx:"y"===i?r.ny:r.nz,Math.round(((t-o)/(e/100)+1)/a)},Tf.prototype.getData=function(t){t=t||{};var e,i=this.volume,r=i.data,n=i.matrix;function o(t){return Math.round(t/100*(e-1))}function a(t,e,r,n){return 3*(r*i.ny*i.nx+e*i.nx+t)+n}e="coordinate"===this.positionType?this.getPositionFromCoordinate(this.position):this.position;var s,c,u,h,l,p=new Float32Array(12),d=new O,f=0,m=0,g=0,v=i.nx,y=i.ny,b=i.nz;function x(t,e,i,r){d.set(t,e,i).applyMatrix4(n).toArray(p,r)}"x"===this.dimension?(u=o(i.nx),h=i.ny-1,l=i.nz-1,s=i.nz,c=i.ny,v=(f=u)+1,x(u,0,0,0),x(u,h,0,3),x(u,0,l,6),x(u,h,l,9)):"y"===this.dimension?(u=i.nx-1,h=o(i.ny),l=i.nz-1,s=i.nz,c=i.nx,y=(m=h)+1,x(0,h,0,0),x(u,h,0,3),x(0,h,l,6),x(u,h,l,9)):"z"===this.dimension&&(u=i.nx-1,h=i.ny-1,l=o(i.nz),s=i.nx,c=i.ny,b=(g=l)+1,x(0,0,l,0),x(0,h,l,3),x(u,0,l,6),x(u,h,l,9));var _,w,S=0,A=0,M=new Uint8Array(s*c*4),P=new Float32Array(s*c);"sigma"===this.thresholdType?(_=i.getValueForSigma(this.thresholdMin),w=i.getValueForSigma(this.thresholdMax)):(_=this.thresholdMin,w=this.thresholdMax);var T=Object.assign({},t.colorParams,{volume:i});this.normalize&&(T.domain=[0,1]);var E,C,I,R=yc.getScheme(T),L=new Float32Array(3),N=R.getScale();if(this.normalize){E=1/0,C=-1/0;for(var D=m;D<y;++D)for(var k=f;k<v;++k)for(var F=g;F<b;++F){var B=r[a(k,D,F,0)/3];B<E&&(E=B),B>C&&(C=B)}I=C-E}for(var z=m;z<y;++z)for(var U=f;U<v;++U)for(var j=g;j<b;++j){var G=a(U,z,j,0)/3,V=r[G];this.normalize&&(V=(V-E)/I),R.colorToArray(N(V),L),M[S]=Math.round(255*L[0]),M[S+1]=Math.round(255*L[1]),M[S+2]=Math.round(255*L[2]),M[S+3]=V>_&&V<w?255:0,P[A]=G,++A,S+=4}var $=new nl(P,i);return{position:p,imageData:M,width:s,height:c,picking:$}};var Ef=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="slice",this.parameters=Object.assign({filter:{type:"select",buffer:!0,options:{nearest:"nearest",linear:"linear","cubic-bspline":"cubic-bspline","cubic-catmulrom":"cubic-catmulrom","cubic-mitchell":"cubic-mitchell"}},positionType:{type:"select",rebuild:!0,options:{percent:"percent",coordinate:"coordinate"}},position:{type:"range",step:.1,max:100,min:1,rebuild:!0},dimension:{type:"select",rebuild:!0,options:{x:"x",y:"y",z:"z"}},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},normalize:{type:"boolean",rebuild:!0}},this.parameters,{flatShaded:null,side:null,wireframe:null,linewidth:null,colorScheme:null,roughness:null,metalness:null,diffuse:null}),this.volume=e,this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=this.volume,r=e||{};r.colorDomain=Eo(r.colorDomain,[i.min,i.max]),r.colorScheme=Eo(r.colorScheme,"value"),r.colorScale=Eo(r.colorScale,"Spectral"),this.colorScheme="value",this.dimension=Eo(r.dimension,"x"),this.filter=Eo(r.filter,"cubic-bspline"),this.positionType=Eo(r.positionType,"percent"),this.position=Eo(r.position,30),this.thresholdType=Eo(r.thresholdType,"sigma"),this.thresholdMin=Eo(r.thresholdMin,-1/0),this.thresholdMax=Eo(r.thresholdMax,1/0),this.normalize=Eo(r.normalize,!1),t.prototype.init.call(this,r),this.build()},e.prototype.attach=function(t){var e=this;this.bufferList.forEach((function(t){e.viewer.add(t)})),this.setVisibility(this.visible),t()},e.prototype.create=function(){var t=new Tf(this.volume,{positionType:this.positionType,position:this.position,dimension:this.dimension,thresholdType:this.thresholdType,thresholdMin:this.thresholdMin,thresholdMax:this.thresholdMax,normalize:this.normalize}),e=new Pf(t.getData({colorParams:this.getColorParams()}),this.getBufferParams({filter:this.filter}));this.bufferList.push(e)},e}(df),Cf=function(t){function e(e,i,r){var n=r||{};if(t.call(this,e,i,n),this.type="structure",this.parameters=Object.assign({radiusType:{type:"select",options:Il.types},radius:{type:"number",precision:3,max:10,min:.001},scale:{type:"number",precision:3,max:10,min:.001},assembly:null,defaultAssembly:{type:"hidden"}},this.parameters),this.selection=new nc(n.sele),this.dataList=[],this.structure=e,this.structureView=this.structure.getView(this.selection),e.biomolDict){var o={default:"default","":e.unitcell?"AU":"FULL"};Object.keys(e.biomolDict).forEach((function(t){o[t]=t})),this.parameters.assembly={type:"select",options:o,rebuild:!0}}else this.parameters.assembly=null}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={defaultScale:{}};return i.defaultScale.get=function(){return{vdw:1,covalent:1,bfactor:.01,sstruc:1}},e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"element"),this.radius=Eo(i.radius,"vdw"),this.scale=Eo(i.scale,1),this.assembly=Eo(i.assembly,"default"),this.defaultAssembly=Eo(i.defaultAssembly,""),"auto"===i.quality&&(i.quality=this.getQuality()),t.prototype.init.call(this,i),this.selection.signals.stringChanged.add((function(){this.build()}),this),this.build()},e.prototype.getAssembly=function(){var t="default"===this.assembly?this.defaultAssembly:this.assembly;return this.structure.biomolDict[t]},e.prototype.getQuality=function(){var t,e=this.structureView,i=this.getAssembly();return t=i?i.getAtomCount(e):e.atomCount,lc&&(t*=4),e.atomStore.count/e.residueStore.count<2&&(t*=10),t<15e3?"high":t<8e4?"medium":"low"},e.prototype.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 r=this.createData(i,e);r&&(r.sview=i,r.instanceList=t.getInstanceList(),this.dataList.push(r))}}),this);else{var e=this.createData(this.structureView,0);e&&(e.sview=this.structureView,this.dataList.push(e))}}},e.prototype.createData=function(){console.error("createData not implemented")},e.prototype.update=function(t){!this.lazy||this.visible?this.dataList.forEach((function(e){e.bufferList.length>0&&this.updateData(t,e)}),this):Object.assign(this.lazyProps.what,t)},e.prototype.updateData=function(){this.build()},e.prototype.getColorParams=function(){var e=t.prototype.getColorParams.call(this);return e.structure=this.structure,e},e.prototype.getAtomParams=function(t,e){return Object.assign({what:t,colorParams:this.getColorParams(),radiusParams:{radius:this.radius,scale:this.scale}},e)},e.prototype.getBondParams=function(t,e){return Object.assign({what:t,colorParams:this.getColorParams(),radiusParams:{radius:this.radius,scale:this.scale}},e)},e.prototype.setSelection=function(t,e){return this.selection.setString(t,e),this},e.prototype.setParameters=function(e,i,r){return i=i||{},e&&void 0!==e.radiusType&&("size"===e.radiusType?this.radius=1:this.radius=e.radiusType,delete e.radiusType,i.radius=!0,dc&&!this.disableImpostor||(r=!0)),e&&void 0!==e.radius&&(i.radius=!0,dc&&!this.disableImpostor||(r=!0)),e&&void 0!==e.scale&&(i.radius=!0,dc&&!this.disableImpostor||(r=!0)),e&&void 0!==e.defaultAssembly&&(r=!0),t.prototype.setParameters.call(this,e,i,r),this},e.prototype.getParameters=function(){return Object.assign(t.prototype.getParameters.call(this),{sele:this.selection?this.selection.string:void 0,defaultAssembly:this.defaultAssembly})},e.prototype.attach=function(t){var e=this.viewer,i=this.bufferList;this.dataList.forEach((function(t){t.bufferList.forEach((function(r){i.push(r),e.add(r,t.instanceList)}))})),this.setVisibility(this.visible),t()},e.prototype.clear=function(){this.dataList.length=0,t.prototype.clear.call(this)},e.prototype.dispose=function(){this.structureView.dispose(),delete this.structure,delete this.structureView,t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,i),e}(df),If=function(t){function e(e,i){var r=4*(e.position1.length/3);t.call(this,{position:new Float32Array(3*r),color:new Float32Array(3*r)},i),this.setAttributes(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isLine:{},vertexShader:{},fragmentShader:{}};return e.prototype.setAttributes=function(t){var e,i,r,n,o,a,s=this.geometry.attributes;t.position1&&t.position2&&(e=t.position1,i=t.position2,o=s.position.array,s.position.needsUpdate=!0),t.color&&t.color2&&(r=t.color,n=t.color2,a=s.color.array,s.color.needsUpdate=!0);for(var c,u,h,l,p,d,f,m,g,v,y,b=this.size,x=0;x<b;x++)u=3*x,c=4*x*3,e&&i&&(d=e[u],f=e[u+1],m=e[u+2],h=(d+(g=i[u]))/2,l=(f+(v=i[u+1]))/2,p=(m+(y=i[u+2]))/2,o[c]=d,o[c+1]=f,o[c+2]=m,o[c+3]=h,o[c+4]=l,o[c+5]=p,o[c+6]=h,o[c+7]=l,o[c+8]=p,o[c+9]=g,o[c+10]=v,o[c+11]=y),r&&n&&(a[c]=a[c+3]=r[u],a[c+1]=a[c+4]=r[u+1],a[c+2]=a[c+5]=r[u+2],a[c+6]=a[c+9]=n[u],a[c+7]=a[c+10]=n[u+1],a[c+8]=a[c+11]=n[u+2])},i.isLine.get=function(){return!0},i.vertexShader.get=function(){return"Line.vert"},i.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,i),e}(xd),Rf=function(t){function e(e,i,r){t.call(this,e.structure,i,r),this.type="trajectory",this.parameters=Object.assign({drawLine:{type:"boolean",rebuild:!0},drawCylinder:{type:"boolean",rebuild:!0},drawPoint:{type:"boolean",rebuild:!0},drawSphere:{type:"boolean",rebuild:!0},linewidth:{type:"integer",max:20,min:1,rebuild:!0},pointSize:{type:"integer",max:20,min:1,rebuild:!0},sizeAttenuation:{type:"boolean",rebuild:!0},sort:{type:"boolean",rebuild:!0}},this.parameters),this.manualAttach=!0,this.trajectory=e,this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"uniform"),i.colorValue=Eo(i.colorValue,14540253),this.drawLine=Eo(i.drawLine,!0),this.drawCylinder=Eo(i.drawCylinder,!1),this.drawPoint=Eo(i.drawPoint,!1),this.drawSphere=Eo(i.drawSphere,!1),this.pointSize=Eo(i.pointSize,1),this.sizeAttenuation=Eo(i.sizeAttenuation,!1),this.sort=Eo(i.sort,!0),t.prototype.init.call(this,i)},e.prototype.attach=function(t){var e=this;this.bufferList.forEach((function(t){e.viewer.add(t)})),this.setVisibility(this.visible),t()},e.prototype.prepare=function(t){t()},e.prototype.create=function(){if(0!==this.atomSet.atomCount){var t=this,e=this.atomSet.atoms[0].index;this.trajectory.getPath(e,(function(e){var i=e.length/3,r=new St(t.colorValue);if(t.drawSphere){var n=new Od({position:e,color:au(i,r.r,r.g,r.b),radius:ou(i,.2)},t.getBufferParams({sphereDetail:t.sphereDetail,dullInterior:!0,disableImpostor:t.disableImpostor}));t.bufferList.push(n)}if(t.drawCylinder){var o=new qd({position1:e.subarray(0,-3),position2:e.subarray(3),color:au(i-1,r.r,r.g,r.b),color2:au(i-1,r.r,r.g,r.b),radius:ou(i,.05)},t.getBufferParams({openEnded:!1,radialSegments:t.radialSegments,disableImpostor:t.disableImpostor,dullInterior:!0}));t.bufferList.push(o)}if(t.drawPoint){var a=new wf({position:e,color:au(i,r.r,r.g,r.b)},t.getBufferParams({pointSize:t.pointSize,sizeAttenuation:t.sizeAttenuation,sort:t.sort}));t.bufferList.push(a)}if(t.drawLine){var s=new If({position1:e.subarray(0,-3),position2:e.subarray(3),color:au(i-1,r.r,r.g,r.b),color2:au(i-1,r.r,r.g,r.b)},t.getBufferParams());t.bufferList.push(s)}t.attach()}))}},e}(Cf);function Lf(t){mc.error("makeRepresentation: representation type "+t+" unknown")}var Of=0,Nf=new N,Df=new O,kf=function(t,e){Object.defineProperty(this,"id",{value:Of++});var i=e||{};this.name=i.name,this.uuid=Ps(),this.visible=void 0===i.visible||i.visible,this.signals={representationAdded:new Fs,representationRemoved:new Fs,visibilityChanged:new Fs,matrixChanged:new Fs,statusChanged:new Fs,nameChanged:new Fs,disposed:new Fs},this.stage=t,this.viewer=t.viewer,this.reprList=[],this.annotationList=[],this.matrix=new N,this.position=new O,this.quaternion=new L,this.scale=new O(1,1,1),this.transform=new N,this.controls=new bh(this)},Ff={type:{}};Ff.type.get=function(){return"component"},kf.prototype.setPosition=function(t){return Array.isArray(t)?this.position.fromArray(t):this.position.copy(t),this.updateMatrix(),this},kf.prototype.setRotation=function(t){if(Array.isArray(t))if(3===t.length){var e=(new qt).fromArray(t);this.quaternion.setFromEuler(e)}else this.quaternion.fromArray(t);else t instanceof qt?this.quaternion.setFromEuler(t):this.quaternion.copy(t);return this.updateMatrix(),this},kf.prototype.setScale=function(t){return this.scale.set(t,t,t),this.updateMatrix(),this},kf.prototype.setTransform=function(t){return this.transform.copy(t),this.updateMatrix(),this},kf.prototype.updateMatrix=function(){var t=this,e=this.getCenterUntransformed(Df);this.matrix.makeTranslation(-e.x,-e.y,-e.z),Nf.makeRotationFromQuaternion(this.quaternion),this.matrix.premultiply(Nf),Nf.makeScale(this.scale.x,this.scale.y,this.scale.z),this.matrix.premultiply(Nf);var i=this.position;Nf.makeTranslation(i.x+e.x,i.y+e.y,i.z+e.z),this.matrix.premultiply(Nf),this.matrix.premultiply(this.transform),this.reprList.forEach((function(e){e.setParameters({matrix:t.matrix})})),this.stage.viewer.updateBoundingBox(),this.signals.matrixChanged.dispatch(this.matrix)},kf.prototype.addAnnotation=function(t,e,i){var r=new mh(this,t,e,i);return this.annotationList.push(r),r},kf.prototype.removeAnnotation=function(t){var e=this.annotationList.indexOf(t);-1!==e&&(this.annotationList.splice(e,1),t.dispose())},kf.prototype.removeAllAnnotations=function(){this.annotationList.forEach((function(t){t.dispose()})),this.annotationList.length=0},kf.prototype.addRepresentation=function(t,e,i){var r=i||{},n=this.stage.getParameters();r.matrix=this.matrix.clone(),r.quality=r.quality||n.quality,r.disableImpostor=Eo(r.disableImpostor,!n.impostor),r.useWorker=Eo(r.useWorker,n.workerDefault),r.visible=Eo(r.visible,!0);var o=Object.assign({},r,{visible:this.visible&&r.visible}),a=function(t,e,i,r){var n;if(gc&&mc.time("makeRepresentation "+t),e instanceof ld){if(!(n=xc.get(t)))return void Lf(t)}else if(e instanceof cp)if("surface"===t)n=_f;else{if("dot"!==t)return void Lf(t);n=Sf}else if(e instanceof lp)if("surface"===t)n=_f;else if("dot"===t)n=Sf;else{if("slice"!==t)return void Lf(t);n=Ef}else if(e instanceof gd)n=Rf;else if(e instanceof lf)n=ff,e=e.getBufferList();else{if("buffer"!==t)return void mc.error("makeRepresentation: object "+e+" unknown");n=ff}var o=new n(e,i,r);return gc&&mc.timeEnd("makeRepresentation "+t),o}(t,e,this.viewer,o),s=this.__getRepresentationComponent(a,r);return this.reprList.push(s),this.signals.representationAdded.dispatch(s),s},kf.prototype.addBufferRepresentation=function(t,e){return kf.prototype.addRepresentation.call(this,"buffer",t,e)},kf.prototype.hasRepresentation=function(t){return-1!==this.reprList.indexOf(t)},kf.prototype.removeRepresentation=function(t){var e=this.reprList.indexOf(t);-1!==e&&(this.reprList.splice(e,1),t.dispose(),this.signals.representationRemoved.dispatch(t))},kf.prototype.updateRepresentations=function(t){this.reprList.forEach((function(e){e.update(t)})),this.stage.viewer.requestRender()},kf.prototype.removeAllRepresentations=function(){this.reprList.slice(0).forEach((function(t){t.dispose()}))},kf.prototype.dispose=function(){this.removeAllAnnotations(),this.removeAllRepresentations(),delete this.annotationList,delete this.reprList,this.signals.disposed.dispatch()},kf.prototype.setVisibility=function(t){return this.visible=t,this.eachRepresentation((function(t){t.updateVisibility()})),this.annotationList.forEach((function(t){t.updateVisibility()})),this.signals.visibilityChanged.dispatch(t),this},kf.prototype.setStatus=function(t){return this.status=t,this.signals.statusChanged.dispatch(t),this},kf.prototype.setName=function(t){return this.name=t,this.signals.nameChanged.dispatch(t),this},kf.prototype.getBox=function(){return(t=this).getBoxUntransformed.apply(t,arguments).clone().applyMatrix4(this.matrix);var t},kf.prototype.getCenter=function(){return(t=this).getCenterUntransformed.apply(t,arguments).clone().applyMatrix4(this.matrix);var t},kf.prototype.getZoom=function(){return this.stage.getZoomForBox((t=this).getBox.apply(t,arguments));var t},kf.prototype.getBoxUntransformed=function(){},kf.prototype.getCenterUntransformed=function(){return this.getBoxUntransformed().getCenter()},kf.prototype.autoView=function(t){this.stage.animationControls.zoomMove(this.getCenter(),this.getZoom(),Eo(t,0))},kf.prototype.eachRepresentation=function(t){this.reprList.forEach(t)},Object.defineProperties(kf.prototype,Ff),kf.prototype.__getRepresentationComponent=function(t,e){return new Bf(this.stage,t,e,this)};var Bf=function(t){function e(e,i,r,n){var o=r||{};o.name=Eo(o.name,i.type),t.call(this,e,o),this.signals=Object.assign(this.signals,{parametersChanged:new Fs}),this.parent=n,this.setRepresentation(i)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"representation"},e.prototype.getType=function(){return this.repr.type},e.prototype.setRepresentation=function(t){this.disposeRepresentation(),this.repr=t,this.stage.tasks.listen(this.repr.tasks),this.updateVisibility()},e.prototype.addRepresentation=function(){},e.prototype.removeRepresentation=function(){},e.prototype.hasRepresentation=function(){},e.prototype.disposeRepresentation=function(){this.repr&&(this.stage.tasks.unlisten(this.repr.tasks),this.repr.dispose())},e.prototype.dispose=function(){this.parent&&this.parent.hasRepresentation(this)?this.parent.removeRepresentation(this):(this.disposeRepresentation(),this.signals.disposed.dispatch())},e.prototype.setVisibility=function(t){return this.visible=t,this.updateVisibility(),this.signals.visibilityChanged.dispatch(this.visible),this},e.prototype.getVisibility=function(){return this.parent?this.parent.visible&&this.visible:this.visible},e.prototype.toggleVisibility=function(){return this.setVisibility(!this.visible)},e.prototype.updateVisibility=function(){this.repr.setVisibility(this.getVisibility())},e.prototype.update=function(t){return this.repr.update(t),this},e.prototype.build=function(t){return this.repr.build(t),this},e.prototype.setSelection=function(t){return this.repr.setSelection(t),this},e.prototype.setParameters=function(t){return this.repr.setParameters(t),this.signals.parametersChanged.dispatch(this.repr.getParameters()),this},e.prototype.getParameters=function(){return this.repr.getParameters()},e.prototype.setColor=function(t){return this.repr.setColor(t),this},e.prototype.getCenter=function(){},e.prototype.getZoom=function(){},e.prototype.getBox=function(){},Object.defineProperties(e.prototype,i),e}(kf),zf=function(t){this.list=t||[];for(var e=this.list.length,i=0;i<e;++i){this.list[i].signals.disposed.add(this._remove,this)}};zf.prototype._remove=function(t){var e=this.list.indexOf(t);-1!==e&&this.list.splice(e,1)},zf.prototype._invoke=function(t,e){for(var i=this.list.length,r=0;r<i;++r){var n=this.list[r],o=n[t];"function"==typeof o&&o.apply(n,e)}return this},zf.prototype.setVisibility=function(t){return this._invoke("setVisibility",[t])},zf.prototype.setSelection=function(t){return this._invoke("setSelection",[t])},zf.prototype.dispose=function(){return this._invoke("dispose")};var Uf=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.addRepresentation=function(t,e){return this._invoke("addRepresentation",[t,e])},e.prototype.autoView=function(t){return this._invoke("autoView",[t])},e}(zf),jf=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setParameters=function(t){return this._invoke("setParameters",[t])},e.prototype.setColor=function(t){return this._invoke("setColor",[t])},e}(zf);function Gf(t,e){return t instanceof RegExp?null!==e.name.match(t):e.name===t}var Vf=new O,$f=function(t,e){if(this.signals={parametersChanged:new Fs,fullscreenChanged:new Fs,componentAdded:new Fs,componentRemoved:new Fs,clicked:new Fs,hovered:new Fs},this.tasks=new $c,this.compList=[],this.defaultFileParams={},this.viewer=new wu(t),this.viewer.renderer){this.tooltip=document.createElement("div"),Object.assign(this.tooltip.style,{display:"none",position:"fixed",zIndex:2+(parseInt(this.viewer.container.style.zIndex)||0),pointerEvents:"none",backgroundColor:"rgba( 0, 0, 0, 0.6 )",color:"lightgrey",padding:"8px",fontFamily:"sans-serif"}),document.body.appendChild(this.tooltip),this.mouseObserver=new Au(this.viewer.renderer.domElement),this.viewerControls=new Wu(this),this.trackballControls=new Ou(this),this.pickingControls=new Fu(this),this.animationControls=new oh(this),this.mouseControls=new hh(this),this.pickingBehavior=new lh(this),this.mouseBehavior=new ph(this),this.animationBehavior=new dh(this),this.keyBehavior=new fh(this),this.spinAnimation=this.animationControls.spin([0,1,0],.005),this.spinAnimation.pause(!0),this.rockAnimation=this.animationControls.rock([0,1,0],.005),this.rockAnimation.pause(!0);var i=Object.assign({impostor:!0,quality:"medium",workerDefault:!0,sampleLevel:0,backgroundColor:"black",rotateSpeed:2,zoomSpeed:1.2,panSpeed:1,clipNear:0,clipFar:100,clipDist:10,fogNear:50,fogFar:100,cameraFov:40,cameraType:"perspective",lightColor:14540253,lightIntensity:1,ambientColor:14540253,ambientIntensity:.2,hoverTimeout:0,tooltip:!0,mousePreset:"default"},e);this.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"},workerDefault:{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:-1},tooltip:{type:"boolean"},mousePreset:{type:"select",options:{default:"default",pymol:"pymol",coot:"coot"}}},this.setParameters(i),this.viewer.animate()}};$f.prototype.setParameters=function(t){var e=Object.assign({},t),i=this.parameters,r=this.viewer,n=this.trackballControls;for(var o in e)void 0!==e[o]&&i[o]&&(i[o].int&&(e[o]=parseInt(e[o])),i[o].float&&(e[o]=parseFloat(e[o])),i[o].value=e[o]);return void 0!==e.quality&&this.setQuality(e.quality),void 0!==e.impostor&&this.setImpostor(e.impostor),void 0!==e.rotateSpeed&&(n.rotateSpeed=e.rotateSpeed),void 0!==e.zoomSpeed&&(n.zoomSpeed=e.zoomSpeed),void 0!==e.panSpeed&&(n.panSpeed=e.panSpeed),void 0!==e.mousePreset&&this.mouseControls.preset(e.mousePreset),this.mouseObserver.setParameters({hoverTimeout:e.hoverTimeout}),r.setClip(e.clipNear,e.clipFar,e.clipDist),r.setFog(void 0,e.fogNear,e.fogFar),r.setCamera(e.cameraType,e.cameraFov),r.setSampling(e.sampleLevel),r.setBackground(e.backgroundColor),r.setLight(e.lightColor,e.lightIntensity,e.ambientColor,e.ambientIntensity),this.signals.parametersChanged.dispatch(this.getParameters()),this},$f.prototype.getParameters=function(){var t={};for(var e in this.parameters)t[e]=this.parameters[e].value;return t},$f.prototype.defaultFileRepresentation=function(t){if("structure"===t.type){var e,i,r;t.setSelection("/0");var n=t.structure;if(n.biomolDict.BU1){var o=n.biomolDict.BU1;e=o.getAtomCount(n),i=o.getResidueCount(n),r=o.getInstanceCount(),t.setDefaultAssembly("BU1")}else e=n.getModelProxy(0).atomCount,i=n.getModelProxy(0).residueCount,r=1;var a=e;lc&&(a*=4);var s=n.atomStore.count/n.residueStore.count<2;s&&(a*=10);var c="chainname",u="RdYlBu",h=!1;if(1===n.getChainnameCount("polymer and /0")&&(c="residueindex",u="spectral",h=!0),gc&&console.log(a,e,r,s),i/r<4)t.addRepresentation("ball+stick",{colorScheme:"element",scale:2,aspectRatio:1.5,bondScale:.3,bondSpacing:.75,quality:"auto"});else if(r>5&&a>15e3||a>7e5){var l=Math.min(1.5,Math.max(.1,2e3/(a/r)));s&&(l=Math.min(l,.15)),t.addRepresentation("surface",{sele:"polymer",surfaceType:"sas",probeRadius:1.4,scaleFactor:l,colorScheme:c,colorScale:u,colorReverse:h,useWorker:!1})}else a>25e4?t.addRepresentation("backbone",{lineOnly:!0,colorScheme:c,colorScale:u,colorReverse:h}):a>1e5?t.addRepresentation("backbone",{quality:"low",disableImpostor:!0,colorScheme:c,colorScale:u,colorReverse:h,scale:2}):a>8e4?t.addRepresentation("backbone",{colorScheme:c,colorScale:u,colorReverse:h,scale:2}):(t.addRepresentation("cartoon",{colorScheme:c,colorScale:u,colorReverse:h,scale:.7,aspectRatio:5,quality:"auto"}),a<5e4&&t.addRepresentation("base",{colorScheme:c,colorScale:u,colorReverse:h,quality:"auto"}),t.addRepresentation("ball+stick",{sele:"ligand",colorScheme:"element",scale:2,aspectRatio:1.5,bondScale:.3,bondSpacing:.75,quality:"auto"}));t.structure.frames.length&&t.addTrajectory()}else"surface"!==t.type&&"volume"!==t.type||t.addRepresentation("surface");this.tasks.onZeroOnce(this.autoView,this)},$f.prototype.loadFile=function(t,e){var i=Object.assign({},this.defaultFileParams,e),r=new kf(this,i);r.name=Lo(t).name,this.addComponent(r);var n=this.tasks;n.increment();var o=function(t){return this.removeComponent(r),"script"===(r=this.addComponentFromObject(t,i)).type?r.run():i.defaultRepresentation&&this.defaultFileRepresentation(r),n.decrement(),r}.bind(this);return("dcd"===Eo(i.ext,Lo(t).ext)?Promise.reject(new Error("loadFile: ext 'dcd' must be loaded into a structure component")):Bc(t,i)).then(o,(function(t){throw r.setStatus(t),n.decrement(),t}))},$f.prototype.addComponent=function(t){t?(this.compList.push(t),this.signals.componentAdded.dispatch(t)):mc.warn("Stage.addComponent: no component given")},$f.prototype.addComponentFromObject=function(t,e){var i=Ac.get(t.type);if(i){var r=new i(this,t,e);return this.addComponent(r),r}mc.warn("no component for object type",t.type)},$f.prototype.removeComponent=function(t){var e=this.compList.indexOf(t);-1!==e&&(this.compList.splice(e,1),t.dispose(),this.signals.componentRemoved.dispatch(t))},$f.prototype.removeAllComponents=function(t){this.compList.slice().forEach((function(e){t&&e.type!==t||this.removeComponent(e)}),this)},$f.prototype.handleResize=function(){this.viewer.handleResize()},$f.prototype.setSize=function(t,e){var i=this.viewer.container;i!==document.body&&(void 0!==t&&(i.style.width=t),void 0!==e&&(i.style.height=e),this.handleResize())},$f.prototype.toggleFullscreen=function(t){if(document.fullscreenEnabled||document.mozFullScreenEnabled||document.webkitFullscreenEnabled||document.msFullscreenEnabled){var e=this;t=t||this.viewer.container,this.lastFullscreenElement=t,i()?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=window.screen.width+"px",t.style.height=window.screen.height+"px",t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen(),document.addEventListener("fullscreenchange",r),document.addEventListener("mozfullscreenchange",r),document.addEventListener("webkitfullscreenchange",r),document.addEventListener("MSFullscreenChange",r),this.handleResize(),this.signals.fullscreenChanged.dispatch(!0),setTimeout((function(){e.handleResize()}),100))}else mc.log("fullscreen mode (currently) not possible");function i(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement}function r(){if(!i()&&e.lastFullscreenElement){var t=e.lastFullscreenElement;t.style.width=t.dataset.normalWidth,t.style.height=t.dataset.normalHeight,document.removeEventListener("fullscreenchange",r),document.removeEventListener("mozfullscreenchange",r),document.removeEventListener("webkitfullscreenchange",r),document.removeEventListener("MSFullscreenChange",r),e.handleResize(),e.signals.fullscreenChanged.dispatch(!1)}}},$f.prototype.setSpin=function(t){t?(this.spinAnimation.resume(!0),this.rockAnimation.pause(!0)):this.spinAnimation.pause(!0)},$f.prototype.setRock=function(t){t?(this.rockAnimation.resume(!0),this.spinAnimation.pause(!0)):this.rockAnimation.pause(!0)},$f.prototype.toggleSpin=function(){this.setSpin(this.spinAnimation.paused)},$f.prototype.toggleRock=function(){this.setRock(this.rockAnimation.paused)},$f.prototype.setFocus=function(t){var e=Ts(t/2,0,49.9),i=100-e,r=(i-e)/2;this.setParameters({clipNear:e,clipFar:i,fogNear:Es(i-r),fogFar:Es(i+r)})},$f.prototype.getZoomForBox=function(t){var e=t.getSize(Vf),i=Math.max(e.x,e.y,e.z),r=Math.min(e.x,e.y,e.z),n=i+Math.sqrt(r),o=Qo(this.viewer.perspectiveCamera.fov),a=this.viewer.width,s=this.viewer.height,c=s<a?1:a/s;return n=Math.abs(.5*n/c/Math.sin(o/2)),-(n+=this.parameters.clipDist.value)},$f.prototype.getBox=function(){return this.viewer.boundingBox},$f.prototype.getZoom=function(){return this.getZoomForBox(this.getBox())},$f.prototype.getCenter=function(t){return this.getBox().getCenter(t)},$f.prototype.autoView=function(t){this.animationControls.zoomMove(this.getCenter(),this.getZoom(),Eo(t,0))},$f.prototype.makeImage=function(t){var e=this.viewer,i=this.tasks;return new Promise((function(r,n){i.onZeroOnce((function(){i.increment(),e.makeImage(t).then((function(t){i.decrement(),r(t)})).catch((function(t){i.decrement(),n(t)}))}))}))},$f.prototype.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 r=i.getParameters();r.disableImpostor=!t,i.build(r)}}))},$f.prototype.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(r){if("script"!==r.type){var n=r.getParameters();if(!e.includes(r.getType())){if(!i.includes(r.getType()))return;if(!n.disableImpostor)return void(r.repr.quality=t)}n.quality=t,r.build(n)}}))},$f.prototype.eachComponent=function(t,e){this.compList.slice().forEach((function(i,r){e&&i.type!==e||t(i,r)}))},$f.prototype.eachRepresentation=function(t,e){this.eachComponent((function(e){e.reprList.slice().forEach((function(i){t(i,e)}))}),e)},$f.prototype.getComponentsByName=function(t,e){var i=[];return this.eachComponent((function(e){(void 0===t||Gf(t,e))&&i.push(e)}),e),new Uf(i)},$f.prototype.getComponentsByObject=function(t){var e=[];return this.eachComponent((function(i){i[i.type]===t&&e.push(i)})),new Uf(e)},$f.prototype.getRepresentationsByName=function(t,e){var i,r;"object"!=typeof t||t instanceof RegExp?(i=void 0,r=t):(i=t.comp,r=t.repr);var n=[];return this.eachRepresentation((function(t,e){(void 0===i||Gf(i,e))&&(void 0===r||Gf(r,t))&&n.push(t)}),e),new jf(n)},$f.prototype.getAnythingByName=function(t){var e=this.getComponentsByName(t).list,i=this.getRepresentationsByName(t).list;return new zf(e.concat(i))},$f.prototype.dispose=function(){this.tasks.dispose()};var Hf=[[4,0,-2,-1,-2,0,-2,-1,-1,-1,-1,-2,-1,-1,-1,1,0,0,-3,-2],[0,9,-3,-4,-2,-3,-3,-1,-3,-1,-1,-3,-3,-3,-3,-1,-1,-1,-2,-2],[-2,-3,6,2,-3,-1,-1,-3,-1,-4,-3,1,-1,0,-2,0,-1,-3,-4,-3],[-1,-4,2,5,-3,-2,0,-3,1,-3,-2,0,-1,2,0,0,-1,-2,-3,-2],[-2,-2,-3,-3,6,-3,-1,0,-3,0,0,-3,-4,-3,-3,-2,-2,-1,1,3],[0,-3,-1,-2,-3,6,-2,-4,-2,-4,-3,0,-2,-2,-2,0,-2,-3,-2,-3],[-2,-3,-1,0,-1,-2,8,-3,-1,-3,-2,1,-2,0,0,-1,-2,-3,-2,2],[-1,-1,-3,-3,0,-4,-3,4,-3,2,1,-3,-3,-3,-3,-2,-1,3,-3,-1],[-1,-3,-1,1,-3,-2,-1,-3,5,-2,-1,0,-1,1,2,0,-1,-2,-3,-2],[-1,-1,-4,-3,0,-4,-3,2,-2,4,2,-3,-3,-2,-2,-2,-1,1,-2,-1],[-1,-1,-3,-2,0,-3,-2,1,-1,2,5,-2,-2,0,-1,-1,-1,1,-1,-1],[-2,-3,1,0,-3,0,1,-3,0,-3,-2,6,-2,0,0,1,0,-3,-4,-2],[-1,-3,-1,-1,-4,-2,-2,-3,-1,-3,-2,-2,7,-1,-2,-1,-1,-2,-4,-3],[-1,-3,0,2,-3,-2,0,-3,1,-2,0,0,-1,5,1,0,-1,-2,-2,-1],[-1,-3,-2,0,-3,-2,0,-3,2,-2,-1,0,-2,1,5,-1,-1,-3,-3,-2],[1,-1,0,0,-2,0,-1,-2,0,-2,-1,1,-1,0,-1,4,1,-2,-3,-2],[0,-1,-1,-1,-2,-2,-2,-1,-1,-1,-1,0,-1,-1,-1,1,5,0,-2,-2],[0,-1,-3,-2,-1,-3,-3,3,-2,1,1,-3,-2,-2,-3,-2,0,4,-3,-1],[-3,-2,-4,-3,1,-2,-2,-3,-3,-2,-1,-4,-4,-2,-3,-3,-2,-3,11,2],[-2,-2,-3,-2,3,-3,2,-1,-2,-1,-1,-2,-3,-1,-2,-2,-2,-1,2,7]];function Wf(t,e){var i,r=0,n={};return e.forEach((function(e){i=0;var o={};e.forEach((function(e){o[t[i++]]=e})),n[t[r++]]=o})),n}var Xf={blosum62:Wf("ARNDCQEGHILKMFPSTWYVBZ?",[[4,-1,-2,-2,0,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-3,-2,0,-2,-1,0],[-1,5,0,-2,-3,1,0,-2,0,-3,-2,2,-1,-3,-2,-1,-1,-3,-2,-3,-1,0,-1],[-2,0,6,1,-3,0,0,0,1,-3,-3,0,-2,-3,-2,1,0,-4,-2,-3,3,0,-1],[-2,-2,1,6,-3,0,2,-1,-1,-3,-4,-1,-3,-3,-1,0,-1,-4,-3,-3,4,1,-1],[0,-3,-3,-3,9,-3,-4,-3,-3,-1,-1,-3,-1,-2,-3,-1,-1,-2,-2,-1,-3,-3,-2],[-1,1,0,0,-3,5,2,-2,0,-3,-2,1,0,-3,-1,0,-1,-2,-1,-2,0,3,-1],[-1,0,0,2,-4,2,5,-2,0,-3,-3,1,-2,-3,-1,0,-1,-3,-2,-2,1,4,-1],[0,-2,0,-1,-3,-2,-2,6,-2,-4,-4,-2,-3,-3,-2,0,-2,-2,-3,-3,-1,-2,-1],[-2,0,1,-1,-3,0,0,-2,8,-3,-3,-1,-2,-1,-2,-1,-2,-2,2,-3,0,0,-1],[-1,-3,-3,-3,-1,-3,-3,-4,-3,4,2,-3,1,0,-3,-2,-1,-3,-1,3,-3,-3,-1],[-1,-2,-3,-4,-1,-2,-3,-4,-3,2,4,-2,2,0,-3,-2,-1,-2,-1,1,-4,-3,-1],[-1,2,0,-1,-3,1,1,-2,-1,-3,-2,5,-1,-3,-1,0,-1,-3,-2,-2,0,1,-1],[-1,-1,-2,-3,-1,0,-2,-3,-2,1,2,-1,5,0,-2,-1,-1,-1,-1,1,-3,-1,-1],[-2,-3,-3,-3,-2,-3,-3,-3,-1,0,0,-3,0,6,-4,-2,-2,1,3,-1,-3,-3,-1],[-1,-2,-2,-1,-3,-1,-1,-2,-2,-3,-3,-1,-2,-4,7,-1,-1,-4,-3,-2,-2,-1,-2],[1,-1,1,0,-1,0,0,0,-1,-2,-2,0,-1,-2,-1,4,1,-3,-2,-2,0,0,0],[0,-1,0,-1,-1,-1,-1,-2,-2,-1,-1,-1,-1,-2,-1,1,5,-2,-2,0,-1,-1,0],[-3,-3,-4,-4,-2,-2,-3,-2,-2,-3,-2,-3,-1,1,-4,-3,-2,11,2,-3,-4,-3,-2],[-2,-2,-2,-3,-2,-1,-2,-3,2,-1,-1,-2,-1,3,-3,-2,-2,2,7,-1,-3,-2,-1],[0,-3,-3,-3,-1,-2,-2,-3,-3,3,1,-2,1,-1,-2,-2,0,-3,-1,4,-3,-2,-1],[-2,-1,3,4,-3,0,1,-1,0,-3,-4,0,-3,-3,-2,0,-1,-4,-3,-3,4,1,-1],[-1,0,0,1,-3,3,4,-2,0,-3,-3,1,-1,-3,-1,0,-1,-3,-2,-2,1,4,-1],[0,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,0,0,-2,-1,-1,-1,-1,-1]]),blosum62x:Wf("ACDEFGHIKLMNPQRSTVWY",Hf)},qf=function(t,e,i,r,n){this.seq1=t,this.seq2=e,this.gapPenalty=i||-10,this.gapExtensionPenalty=r||-1,this.substMatrix=n||"blosum62",this.substMatrix&&(this.substMatrix=Xf[this.substMatrix])};qf.prototype.initMatrices=function(){var t,e;for(this.n=this.seq1.length,this.m=this.seq2.length,this.score=void 0,this.ali="",this.S=[],this.V=[],this.H=[],t=0;t<=this.n;++t)for(this.S[t]=[],this.V[t]=[],this.H[t]=[],e=0;e<=this.m;++e)this.S[t][e]=0,this.V[t][e]=0,this.H[t][e]=0;for(t=0;t<=this.n;++t)this.S[t][0]=this.gap(0),this.H[t][0]=-1/0;for(e=0;e<=this.m;++e)this.S[0][e]=this.gap(0),this.V[0][e]=-1/0;this.S[0][0]=0},qf.prototype.gap=function(t){return this.gapPenalty+t*this.gapExtensionPenalty},qf.prototype.makeScoreFn=function(){var t,e,i=this.seq1,r=this.seq2,n=this.substMatrix;return n?function(o,a){t=i[o],e=r[a];try{return n[t][e]}catch(t){return-4}}:(mc.warn("Alignment: no subst matrix"),function(n,o){return t=i[n],e=r[o],t===e?5:-3})},qf.prototype.calc=function(){gc&&mc.time("Alignment.calc"),this.initMatrices();var t,e,i,r,n,o,a,s=this.gap(0),c=this.makeScoreFn(),u=this.gapExtensionPenalty,h=this.V,l=this.H,p=this.S,d=this.n,f=this.m;for(o=1;o<=d;++o)for(e=p[o-1],t=h[o-1],i=h[o],r=l[o],n=p[o],a=1;a<=f;++a)i[a]=Math.max(e[a]+s,t[a]+u),r[a]=Math.max(n[a-1]+s,r[a-1]+u),n[a]=Math.max(e[a-1]+c(o-1,a-1),i[a],r[a]);gc&&mc.timeEnd("Alignment.calc"),gc&&mc.log(this.S,this.V,this.H)},qf.prototype.trace=function(){gc&&mc.time("Alignment.trace"),this.ali1="",this.ali2="";var t,e=this.makeScoreFn(),i=this.n,r=this.m;for(this.S[i][r]>=this.V[i][r]?(t="S",this.score=this.S[i][r]):this.V[i][r]>=this.H[i][r]?(t="V",this.score=this.V[i][r]):(t="H",this.score=this.H[i][r]),gc&&mc.log("Alignment: SCORE",this.score),gc&&mc.log("Alignment: S, V, H",this.S[i][r],this.V[i][r],this.H[i][r]);i>0&&r>0;)"S"===t?this.S[i][r]===this.S[i-1][r-1]+e(i-1,r-1)?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2=this.seq2[r-1]+this.ali2,--i,--r,t="S"):this.S[i][r]===this.V[i][r]?t="V":this.S[i][r]===this.H[i][r]?t="H":(--i,--r):"V"===t?this.V[i][r]===this.V[i-1][r]+this.gapExtensionPenalty?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i,t="V"):this.V[i][r]===this.S[i-1][r]+this.gap(0)?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i,t="S"):--i:"H"===t?this.H[i][r]===this.H[i][r-1]+this.gapExtensionPenalty?(this.ali1="-"+this.ali1,this.ali2=this.seq2[r-1]+this.ali2,--r,t="H"):this.H[i][r]===this.S[i][r-1]+this.gap(0)?(this.ali1="-"+this.ali1,this.ali2=this.seq2[r-1]+this.ali2,--r,t="S"):--r:mc.error("Alignment: no matrix");for(;i>0;)this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i;for(;r>0;)this.ali1="-"+this.ali1,this.ali2=this.seq2[r-1]+this.ali2,--r;gc&&mc.timeEnd("Alignment.trace"),gc&&mc.log([this.ali1,this.ali2])};var Yf=function(t){function e(e){var i=this;t.call(this,e),e.scale||(this.scale="rainbow",this.reverse=Eo(e.reverse,!0)),this.scalePerModel={},this.structure.eachModel((function(t){i.domain=[t.atomOffset,t.atomEnd],i.scalePerModel[t.index]=i.getScale()}))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){return this.scalePerModel[t.modelIndex](t.index)},e}(Ns);yc.add("atomindex",Yf);var Zf=function(t){function e(e){if(t.call(this,e),e.scale||(this.scale="OrRd"),!e.domain){var i,r=1/0,n=-1/0;e.sele&&(i=new nc(e.sele)),this.structure.eachAtom((function(t){var e=t.bfactor;r=Math.min(r,e),n=Math.max(n,e)}),i),this.domain=[r,n]}this.bfactorScale=this.getScale()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){return this.bfactorScale(t.bfactor)},e}(Ns);yc.add("bfactor",Zf);var Kf=function(t){function e(e){t.call(this,e),e.scale||(this.scale="Spectral");var i={},r={};this.structure.eachModel(function(t){var e=0,n={};t.eachChain((function(t){void 0===n[t.chainid]&&(n[t.chainid]=e,e+=1)})),this.domain=[0,e-1],i[t.index]=n,r[t.index]=this.getScale()}.bind(this)),this.atomColor=function(t){var e=i[t.modelIndex];return r[t.modelIndex](e[t.chainid])}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("chainid",Kf);var Qf=function(t){function e(e){if(t.call(this,e),e.scale||(this.scale="Spectral"),e.domain){var i=this.getScale();this.atomColor=function(t){return i(t.chainIndex)}}else{var r={};this.structure.eachModel(function(t){this.domain=[t.chainOffset,t.chainEnd],r[t.index]=this.getScale()}.bind(this)),this.atomColor=function(t){return r[t.modelIndex](t.chainIndex)}}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("chainindex",Qf);var Jf=function(t){function e(e){t.call(this,e),e.scale||(this.scale="Spectral");var i={},r={};this.structure.eachModel(function(t){var e=0,n={};t.eachChain((function(t){void 0===n[t.chainname]&&(n[t.chainname]=e,e+=1)})),this.domain=[0,e-1],i[t.index]=n,r[t.index]=this.getScale()}.bind(this)),this.atomColor=function(t){var e=i[t.modelIndex];return r[t.modelIndex](e[t.chainname])}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("chainname",Jf);var tm=function(t){function e(e){t.call(this,e),e.scale||(this.scale="RdYlBu"),this.rsrzScale=this.getScale({domain:[2,0]}),this.rsccScale=this.getScale({domain:[.678,1]});var i=e.structure.validation||{};this.rsrzDict=i.rsrzDict||{},this.rsccDict=i.rsccDict||{}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.resno;t.inscode&&(e+="^"+t.inscode),t.chainname&&(e+=":"+t.chainname),e+="/"+t.modelIndex;var i=this.rsrzDict[e];if(void 0!==i)return this.rsrzScale(i);var r=this.rsccDict[e];return void 0!==r?this.rsccScale(r):9474192},e}(Ns);yc.add("densityfit",tm);var em={ARG:{CD:.1,CZ:.5,NE:-.1},ASN:{CG:.55,OD1:-.55},ASP:{CB:-.16,CG:.36,OD1:-.6,OD2:-.6},CYS:{CB:.19,SG:-.19},GLN:{CD:.55,OE1:-.55},GLU:{CD:.36,CG:-.16,OE1:-.6,OE2:-.6},HIS:{CB:.1,CD2:.2,CE1:.45,CG:.15,ND1:.05,NE2:.05},LYS:{CE:.25,NZ:.75},MET:{CE:.06,CG:.06,SD:-.12},PTR:{C:.55,CA:.1,CZ:.25,N:-.35,O:-.55,O1P:-.85,O2P:-.85,O3P:-.85,OG1:-1.1,P:1.4},SEP:{C:.55,CA:.1,CB:.25,N:-.35,O:-.55,O1P:-.85,O2P:-.85,O3P:-.85,OG1:-1.1,P:1.4},SER:{CB:.25,OG:-.25},THR:{CB:.25,OG1:-.25},TPO:{C:.55,CA:.1,CB:.25,N:-.35,O:-.55,OG1:-1.1,O1P:-.85,O2P:-.85,O3P:-.85,P:1.4},TRP:{CD1:.06,CD2:.1,CE2:-.04,CE3:-.03,CG:-.03,NE1:-.06},TYR:{CZ:.25,OH:-.25},backbone:{C:.55,O:-.55,N:-.35,CA:.1}};var im=function(t){function e(e){t.call(this,e),e.scale||(this.scale="rwb"),e.domain||(this.domain=[-.5,0,.5]);var i=this.getScale();var r=this.structure,n=new Float32Array(r.atomCount),o=[],a=[];r.eachAtom((function(t){var e;if(n[t.index]=((e=t).isProtein()&&(em[e.resname]&&em[e.resname][e.atomname]||em.backbone[e.atomname])||0)*t.occupancy,"N"===t.atomname){var i=function(t,e){e=e||new O;var i=!1,r=!1,n=!1;return e.set(2*t.x,2*t.y,2*t.z),t.eachBondedAtom((function(t){if(!i)return"H"===t.atomname?(e.set(t),void(i=!0)):void(r||"CA"!==t.atomname?n||"C"!==t.atomname||(n=!0,e.sub(t)):(e.sub(t),r=!0))})),i?e:r&&n?(e.normalize(),e.multiplyScalar(1.04),e.add(t),e):void 0}(t);void 0!==i&&(o.push(i),a.push(.25*t.occupancy))}}));var s=this.structure.getBoundingBox();s.expandByScalar(1.04);var c=function(t){for(var e=t.length,i=new Float32Array(e),r=new Float32Array(e),n=new Float32Array(e),o=0;o<t.length;o++){var a=t[o];i[o]=a.x,r[o]=a.y,n[o]=a.z}return{x:i,y:r,z:n,count:e}}(o),u=new Kl(c,s),h=new Kl(this.structure.atomStore,s),l=this.atomProxy,p=new O;this.positionColor=function(t){for(var e=0,r=h.within(t.x,t.y,t.z,12),o=0;o<r.length;o++){var s=r[o],d=n[s];if(0!==d){l.index=s,p.x=t.x-l.x,p.y=t.y-l.y,p.z=t.z-l.z;var f=p.lengthSq();f<144&&(e+=d/f)}}for(var m=u.within(t.x,t.y,t.z,12),g=0;g<m.length;g++){var v=m[g];p.x=t.x-c.x[v],p.y=t.y-c.y[v],p.z=t.z-c.z[v];var y=p.lengthSq();y<144&&(e+=a[v]/y)}return i(e)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("electrostatic",im);var rm={H:16777215,HE:14286847,LI:13402367,BE:12779264,B:16758197,C:9474192,N:3166456,O:16715021,F:9494608,NE:11789301,NA:11230450,MG:9109248,AL:12560038,SI:1578e4,P:16744448,S:16777008,CL:2093087,AR:8442339,K:9388244,CA:4062976,SC:15132390,TI:12567239,V:10921643,CR:9083335,MN:10255047,FE:14706227,CO:15765664,NI:5296208,CU:13140019,ZN:8224944,GA:12750735,GE:6721423,AS:12419299,SE:16752896,BR:10889513,KR:6076625,RB:7351984,SR:65280,Y:9764863,ZR:9756896,NB:7586505,MO:5551541,TC:3907230,RU:2396047,RH:687500,PD:27013,AG:12632256,CD:16767375,IN:10909043,SN:6717568,SB:10380213,TE:13924864,I:9699476,XE:9699476,CS:5707663,BA:51456,LA:7394559,CE:16777159,PR:14286791,ND:13107143,PM:10747847,SM:9437127,EU:6422471,GD:4587463,TB:3211207,DY:2097095,HO:65436,ER:58997,TM:54354,YB:48952,LU:43812,HF:5096191,TA:5089023,W:2200790,RE:2522539,OS:2516630,IR:1528967,PT:13684960,AU:16765219,HG:12105936,TL:10900557,PB:5724513,BI:10375093,PO:11230208,AT:7688005,RN:4358806,FR:4325478,RA:32e3,AC:7384058,TH:47871,PA:41471,U:36863,NP:33023,PU:27647,AM:5528818,CM:7888099,BK:9064419,CF:10565332,ES:11739092,FM:11739066,MD:11734438,NO:12389767,LR:13041766,RF:13369433,DB:13697103,SG:14221381,BH:14680120,HS:15073326,MT:15400998,DS:16777215,RG:16777215,CN:16777215,UUT:16777215,FL:16777215,UUP:16777215,LV:16777215,UUH:16777215,D:16777152,T:16777120},nm=function(t){function e(e){var i=e||{};i.value=Eo(i.value,rm.C),t.call(this,i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.element;return"C"===e?this.value:rm[e]||16777215},e}(Ns);yc.add("element",nm);var om=function(t){function e(e){t.call(this,e),e.scale||(this.scale="Spectral"),e.domain||(this.domain=[0,this.structure.entityList.length-1]);var i=this.getScale();this.atomColor=function(t){return i(t.entityIndex)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("entityindex",om);var am=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.entity;switch(e?e.entityType:void 0){case 1:return 8374655;case 2:return 16629894;case 3:return 12496596;case 4:return 3697840;default:return 16777113}},e}(Ns);yc.add("entitytype",am);var sm=function(t){function e(e){t.call(this,e);var i=e.structure.validation||{};this.geoAtomDict=i.geoAtomDict||{},this.geoDict=i.geoDict||{}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e,i=t.resno;t.inscode&&(i+="^"+t.inscode),t.chainname&&(i+=":"+t.chainname),i+="/"+t.modelIndex;var r,n=this.geoAtomDict[i];if(void 0!==n){var o=n[t.atomname]||0;r=o,e=16843009*((r=(858993459&(r-=r>>1&1431655765))+(r>>2&858993459))+(r>>4)&252645135)>>24}else e=this.geoDict[i]||0;return 0===e?2188972:1===e?16703627:2===e?16018755:e>=3?10813478:9474192},e}(Ns);yc.add("geoquality",sm);var cm=function(t){function e(e){var i;t.call(this,e),e.scale||(this.scale="RdYlGn");var r={};for(i in vl)r[i]=vl[i][0];if(!e.domain){var n,o=1/0,a=-1/0;for(i in r)n=r[i],o=Math.min(o,n),a=Math.max(a,n);this.domain=[o,0,a]}var s=this.getScale();this.atomColor=function(t){return s(r[t.resname]||yl)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("hydrophobicity",cm);var um=function(t){function e(e){t.call(this,e),e.scale||(this.scale="rainbow"),e.domain||(this.domain=[0,this.structure.modelStore.count]);var i=this.getScale();this.atomColor=function(t){return i(t.modelIndex)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("modelindex",um);var hm=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){switch(t.residueType.moleculeType){case 1:return 3697840;case 2:return 15729279;case 3:return 12496596;case 4:return 16629894;case 5:return 12540695;case 6:return 8374655;default:return 16777113}},e}(Ns);yc.add("moleculetype",hm);var lm=function(t){function e(e){t.call(this,e),e.scale||(this.scale="PuBu"),e.domain||(this.domain=[0,1]);var i=this.getScale();this.atomColor=function(t){return i(t.occupancy)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);function pm(){return 16777215*Math.random()}yc.add("occupancy",lm);var dm=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(){return pm()},e.prototype.volumeColor=function(){return pm()},e.prototype.positionColor=function(){return pm()},e}(Ns);yc.add("random",dm);var fm=function(t){function e(e){var i=this;if(t.call(this,e),e.scale||(this.scale="rainbow",this.reverse=Eo(e.reverse,!0)),e.domain){var r=this.getScale();this.atomColor=function(t){return r(t.residueIndex)}}else{var n={};this.structure.eachChain((function(t){i.domain=[t.residueOffset,t.residueEnd],n[t.index]=i.getScale()})),this.atomColor=function(t){return n[t.chainIndex](t.residueIndex)}}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("residueindex",fm);var mm={ALA:9240460,ARG:124,ASN:16743536,ASP:10485826,CYS:16777072,GLN:16731212,GLU:6684672,GLY:16777215,HIS:7368959,ILE:19456,LEU:4546117,LYS:4671416,MET:12099650,PHE:5459026,PRO:5395026,SER:16740418,THR:12078080,TRP:5195264,TYR:9203788,VAL:16747775,ASX:16711935,GLX:16711935,ASH:16711935,GLH:16711935,A:10526975,G:16740464,I:8454143,C:16747595,T:10551200,U:16744576,DA:10526975,DG:16740464,DI:8454143,DC:16747595,DT:10551200,DU:16744576},gm=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){return mm[t.resname]||16711935},e}(Ns);yc.add("resname",gm);var vm=16711808,ym=10485888,bm=6291584,xm=16762880,_m=6324479,wm=16777215,Sm=11403518,Am=16580962,Mm=10921722,Pm=function(t){function e(e){t.call(this,e),this.rp=this.structure.getResidueProxy()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.sstruc,i=this.rp;return"h"===e?vm:"g"===e?ym:"i"===e?bm:"e"===e||"b"===e?xm:"t"===e?_m:(i.index=t.residueIndex,i.isDna()?Sm:i.isRna()?Am:i.isSaccharide()?Mm:i.isProtein()||"s"===e||"l"===e?wm:8421504)},e}(Ns);yc.add("sstruc",Pm);var Tm=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(){return this.value},e.prototype.bondColor=function(){return this.value},e.prototype.valueColor=function(){return this.value},e.prototype.volumeColor=function(){return this.value},e}(Ns);yc.add("uniform",Tm);var Em=function(t){function e(e){t.call(this,e),this.valueScale=this.getScale()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.volumeColor=function(t){return this.valueScale(this.volume.data[t])},e}(Ns);yc.add("value",Em);var Cm=function(t){function e(e){t.call(this,e);var i=this.volume;if(i&&i.inverseMatrix){var r=this.getScale(),n=i.inverseMatrix,o=i.data,a=i.nx,s=i.ny,c=a*s,u=new O;this.positionColor=function(t){u.copy(t),u.applyMatrix4(n);var e=Math.floor(u.x),i=Math.floor(u.y),h=Math.floor(u.z),l=(h*s+i)*a+e,p=l+1,d=l+a,f=l+c,m=d+1,g=f+1,v=d+c,y=v+1,b=o[l],x=o[p],_=o[d],w=o[f],S=o[m],A=o[g],M=o[v],P=o[y],T=u.x-e,E=u.y-i,C=u.z-h,I=Cs(b,x,T),R=Cs(w,A,T),L=Cs(_,S,T),O=Cs(M,P,T),N=Cs(I,L,E),D=Cs(R,O,E),k=Cs(N,D,C);return r(k)}}else{var h=this.value;this.positionColor=function(){return h}}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.positionColor=function(){},e}(Ns);yc.add("volume",Cm);var Im=function(t){function e(e,i,r){var n=this,o=r||{};o.name=Eo(o.name,i.name),t.call(this,e,o),this.script=i,this.status="loaded",this.script.signals.nameChanged.add((function(t){n.setName(t)}))}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"script"},e.prototype.addRepresentation=function(){},e.prototype.removeRepresentation=function(){},e.prototype.run=function(){var t=this;this.setStatus("running"),this.script.call(this.stage).then((function(){t.setStatus("finished")})),this.setStatus("called")},e.prototype.dispose=function(){this.signals.disposed.dispatch()},e.prototype.setVisibility=function(){},e.prototype.getCenter=function(){},e.prototype.getZoom=function(){},e.prototype.getBox=function(){},Object.defineProperties(e.prototype,i),e}(kf);Ac.add("script",Im);var Rm=function(t){function e(e,i,r){var n=r||{};n.name=Eo(n.name,i.name),t.call(this,e,n),this.shape=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"shape"},e.prototype.addRepresentation=function(e,i){return t.prototype.addRepresentation.call(this,e,this.shape,i)},e.prototype.getBoxUntransformed=function(){return this.shape.boundingBox},e.prototype.getCenterUntransformed=function(){return this.shape.center},e.prototype.dispose=function(){this.shape.dispose(),t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,i),e}(kf);Ac.add("shape",Rm);var Lm=function(t){function e(e,i,r,n){var o=this,a=r||{};a.name=Eo(a.name,i.name),t.call(this,e,a),this.signals=Object.assign(this.signals,{frameChanged:new Fs,playerChanged:new Fs,gotNumframes:new Fs,parametersChanged:new Fs}),this.trajectory=i,this.parent=n,this.status="loaded",this.defaultStep=Eo(a.defaultStep,void 0),this.defaultTimeout=Eo(a.defaultTimeout,50),this.defaultInterpolateType=Eo(a.defaultInterpolateType,""),this.defaultInterpolateStep=Eo(a.defaultInterpolateStep,5),this.defaultMode=Eo(a.defaultMode,"loop"),this.defaultDirection=Eo(a.defaultDirection,"forward"),i.signals.frameChanged.add((function(t){o.signals.frameChanged.dispatch(t)})),i.signals.playerChanged.add((function(t){o.signals.playerChanged.dispatch(t)})),i.signals.gotNumframes.add((function(t){o.signals.gotNumframes.dispatch(t)})),void 0!==a.initialFrame&&this.setFrame(a.initialFrame)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"trajectory"},e.prototype.addRepresentation=function(e,i){return t.prototype.addRepresentation.call(this,e,this.trajectory,i)},e.prototype.setFrame=function(t){this.trajectory.setFrame(t)},e.prototype.setParameters=function(t){this.trajectory.setParameters(t),this.signals.parametersChanged.dispatch(t)},e.prototype.dispose=function(){this.trajectory.dispose(),t.prototype.dispose.call(this)},e.prototype.getCenter=function(){},Object.defineProperties(e.prototype,i),e}(kf),Om=function(t){function e(e,i,r){t.call(this,"",i,r),this.name=e.name,this.path=e.path,this.frames=e.coordinates,this.boxes=e.boxes,this.getNumframes()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"frames"},e.prototype.makeAtomIndices=function(){"StructureView"===this.structure.type?this.atomIndices=this.structure.getAtomIndices():this.atomIndices=null},e.prototype._loadFrame=function(t,e){var i,r=this.frames[t];if(this.atomIndices){var n=this.atomIndices,o=n.length;i=new Float32Array(3*o);for(var a=0;a<o;++a){var s=3*a,c=3*n[a];i[s+0]=r[c+0],i[s+1]=r[c+1],i[s+2]=r[c+2]}}else i=new Float32Array(r);var u=this.boxes[t],h=this.frames.length;this.process(t,u,i,h),"function"==typeof e&&e()},e.prototype.getNumframes=function(){this.frames&&this.setNumframes(this.frames.length)},e.prototype.getPath=function(t,e){var i,r,n,o=this.numframes,a=3*t,s=new Float32Array(3*o);for(i=0;i<o;++i)r=3*i,n=this.frames[i],s[r+0]=n[a+0],s[r+1]=n[a+1],s[r+2]=n[a+2];e(s)},Object.defineProperties(e.prototype,i),e}(gd),Nm=function(t){function e(e,i,r){t.call(this,"",i,r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"structure"},e.prototype.makeAtomIndices=function(){this.structure.atomSet.getSize()<this.structure.atomStore.count?this.atomIndices=this.structure.getAtomIndices():this.atomIndices=null},e.prototype._loadFrame=function(t,e){var i,r=this.structure,n=r.frames[t];if(this.atomIndices){var o=this.atomIndices,a=o.length;i=new Float32Array(3*a);for(var s=0;s<a;++s){var c=3*s,u=3*o[s];i[c+0]=n[u+0],i[c+1]=n[u+1],i[c+2]=n[u+2]}}else i=new Float32Array(n);var h=r.boxes[t],l=r.frames.length;this.process(t,h,i,l),"function"==typeof e&&e()},e.prototype.getNumframes=function(){this.setNumframes(this.structure.frames.length)},e.prototype.getPath=function(t,e){var i,r,n,o=this.numframes,a=3*t,s=new Float32Array(3*o);for(i=0;i<o;++i)r=3*i,n=this.structure.frames[i],s[r+0]=n[a+0],s[r+1]=n[a+1],s[r+2]=n[a+2];e(s)},Object.defineProperties(e.prototype,i),e}(gd),Dm=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"remote"},e.prototype.makeAtomIndices=function(){var t=[];if("StructureView"===this.structure.type){var e,i,r=this.structure.getAtomIndices(),n=r[0],o=r[0],a=r.length;for(e=1;e<a;++e)o+1<(i=r[e])&&(t.push([n,o+1]),n=i),o=i;t.push([n,o+1])}else t.push([0,this.atomCount]);this.atomIndices=t},e.prototype._loadFrame=function(t,e){var i=new window.XMLHttpRequest,r=bc.trajectory,n=r.getFrameUrl(this.trajPath,t),o=r.getFrameParams(this.trajPath,this.atomIndices);i.open("POST",n,!0),i.responseType="arraybuffer",i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.addEventListener("load",function(){var r=i.response;if(r){var o=new Int32Array(r,0,1)[0],a=new Float32Array(r,8,9),s=new Float32Array(r,44);this.process(t,a,s,o),"function"==typeof e&&e()}else mc.error("empty arrayBuffer for '"+n+"'")}.bind(this),!1),i.send(o)},e.prototype.getNumframes=function(){var t=new window.XMLHttpRequest,e=bc.trajectory.getNumframesUrl(this.trajPath);t.open("GET",e,!0),t.addEventListener("load",function(){this.setNumframes(parseInt(t.response))}.bind(this),!1),t.send(null)},e.prototype.getPath=function(t,e){if(this.pathCache[t])e(this.pathCache[t]);else{mc.time("loadPath");var i=new window.XMLHttpRequest,r=bc.trajectory.getPathUrl(this.trajPath,t);i.open("POST",r,!0),i.responseType="arraybuffer",i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.addEventListener("load",function(){mc.timeEnd("loadPath");var n=i.response;if(n){var o=new Float32Array(n);this.pathCache[t]=o,e(o)}else mc.error("empty arrayBuffer for '"+r+"'")}.bind(this),!1),i.send("")}},Object.defineProperties(e.prototype,i),e}(gd);ld.prototype.getView=function(t){return new km(this,t)};var km=function(t){function e(e,i){t.call(this),this.structure=e,this.selection=i,this.center=new O,this.boundingBox=new jt,this._bp=this.getBondProxy(),this._ap=this.getAtomProxy(),this._rp=this.getResidueProxy(),this._cp=this.getChainProxy(),this.selection&&this.selection.signals.stringChanged.add(this.refresh,this),this.structure.signals.refreshed.add(this.refresh,this),this.refresh()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},name:{},path:{},title:{},id:{},atomSetDict:{},biomolDict:{},entityList:{},unitcell:{},frames:{},boxes:{},validation:{},bondStore:{},backboneBondStore:{},rungBondStore:{},atomStore:{},residueStore:{},chainStore:{},modelStore:{},atomMap:{},residueMap:{},bondHash:{},spatialHash:{}};return e.prototype.init=function(){},i.type.get=function(){return"StructureView"},i.name.get=function(){return this.structure.name},i.path.get=function(){return this.structure.path},i.title.get=function(){return this.structure.title},i.id.get=function(){return this.structure.id},i.atomSetDict.get=function(){return this.structure.atomSetDict},i.biomolDict.get=function(){return this.structure.biomolDict},i.entityList.get=function(){return this.structure.entityList},i.unitcell.get=function(){return this.structure.unitcell},i.frames.get=function(){return this.structure.frames},i.boxes.get=function(){return this.structure.boxes},i.validation.get=function(){return this.structure.validation},i.bondStore.get=function(){return this.structure.bondStore},i.backboneBondStore.get=function(){return this.structure.backboneBondStore},i.rungBondStore.get=function(){return this.structure.rungBondStore},i.atomStore.get=function(){return this.structure.atomStore},i.residueStore.get=function(){return this.structure.residueStore},i.chainStore.get=function(){return this.structure.chainStore},i.modelStore.get=function(){return this.structure.modelStore},i.atomMap.get=function(){return this.structure.atomMap},i.residueMap.get=function(){return this.structure.residueMap},i.bondHash.get=function(){return this.structure.bondHash},i.spatialHash.get=function(){return this.structure.spatialHash},e.prototype.refresh=function(){for(var t in gc&&mc.time("StructureView.refresh"),this.atomSetCache={},this.atomSet=this.getAtomSet(this.selection,!0),this.structure.atomSet&&(this.atomSet=this.atomSet.intersection(this.structure.atomSet)),this.bondSet=this.getBondSet(),this.atomSetDict){var e=this.atomSetDict[t];this.atomSetCache["__"+t]=e.makeIntersection(this.atomSet)}this.atomCount=this.atomSet.getSize(),this.bondCount=this.bondSet.getSize(),this.boundingBox=this.getBoundingBox(),this.center=this.boundingBox.getCenter(),gc&&mc.timeEnd("StructureView.refresh"),this.signals.refreshed.dispatch()},e.prototype.setSelection=function(t){this.selection=t,this.refresh()},e.prototype.getSelection=function(t){var e=[];t&&t.string&&e.push(t.string);var i=this.structure.getSelection();i&&i.string&&e.push(i.string),this.selection&&this.selection.string&&e.push(this.selection.string);var r="";return e.length>0&&(r="( "+e.join(" ) AND ( ")+" )"),new nc(r)},e.prototype.getStructure=function(){return this.structure.getStructure()},e.prototype.eachBond=function(t,e){this.structure.eachBond(t,this.getSelection(e))},e.prototype.eachAtom=function(t,e){var i=this.getAtomProxy(),r=this.getAtomSet(e),n=this.atomStore.count;if(r.getSize()<n)r.forEach((function(e){i.index=e,t(i)}));else for(var o=0;o<n;++o)i.index=o,t(i)},e.prototype.eachResidue=function(t,e){this.structure.eachResidue(t,this.getSelection(e))},e.prototype.eachResidueN=function(){console.error("StructureView.eachResidueN() not implemented")},e.prototype.eachChain=function(t,e){this.structure.eachChain(t,this.getSelection(e))},e.prototype.eachModel=function(t,e){this.structure.eachModel(t,this.getSelection(e))},e.prototype.getAtomSet=function(t,e){var i=this.structure.getAtomSet(t);return!e&&this.atomSet&&(i=i.makeIntersection(this.atomSet)),i},e.prototype.getAtomIndices=function(t){return this.structure.getAtomIndices(this.getSelection(t))},e.prototype.refreshPosition=function(){return this.structure.refreshPosition()},e.prototype.dispose=function(){this.selection&&this.selection.signals.stringChanged.remove(this.refresh,this),this.structure.signals.refreshed.remove(this.refresh,this),delete this.structure,delete this.atomSet,delete this.bondSet,delete this.atomCount,delete this.bondCount},Object.defineProperties(e.prototype,i),e}(ld),Fm=function(t){function e(e,i,r){var n=r||{};n.name=Eo(n.name,i.name),t.call(this,e,n),this.signals=Object.assign(this.signals,{trajectoryAdded:new Fs,trajectoryRemoved:new Fs,defaultAssemblyChanged:new Fs}),this.structure=i,this.trajList=[],this.initSelection(n.sele),this.setDefaultAssembly(n.assembly||"")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"structure"},e.prototype.initSelection=function(t){var e=this;this.selection=new nc(t),this.structureView=new km(this.structure,this.selection),this.selection.signals.stringChanged.add((function(){e.structureView.setSelection(e.selection),e.rebuildRepresentations(),e.rebuildTrajectories()}))},e.prototype.setSelection=function(t){return this.selection.setString(t),this},e.prototype.setDefaultAssembly=function(t){var e=this;this.defaultAssembly=t,this.reprList.forEach((function(t){t.setParameters({defaultAssembly:e.defaultAssembly})})),this.signals.defaultAssemblyChanged.dispatch(t)},e.prototype.rebuildRepresentations=function(){this.reprList.forEach((function(t){t.build()}))},e.prototype.rebuildTrajectories=function(){var t=this;this.trajList.slice().forEach((function(e){e.trajectory.setStructure(t.structureView)}))},e.prototype.addRepresentation=function(e,i){var r=i||{};return r.defaultAssembly=this.defaultAssembly,t.prototype.addRepresentation.call(this,e,this.structureView,r)},e.prototype.addTrajectory=function(t,e){var i=this,r=function(t,e,i){return t&&"Frames"===t.type?new Om(t,e,i):!t&&e.frames?new Nm(t,e,i):new Dm(t,e,i)}(t,this.structureView,e);r.signals.frameChanged.add((function(){i.updateRepresentations({position:!0})}));var n=new Lm(this.stage,r,e,this);return this.trajList.push(n),this.signals.trajectoryAdded.dispatch(n),n},e.prototype.removeTrajectory=function(t){var e=this.trajList.indexOf(t);-1!==e&&this.trajList.splice(e,1),t.dispose(),this.signals.trajectoryRemoved.dispatch(t)},e.prototype.dispose=function(){this.trajList.slice().forEach((function(t){t.dispose()})),this.trajList.length=0,this.structure.dispose(),t.prototype.dispose.call(this)},e.prototype.autoView=function(t,e){Number.isInteger(t)&&(e=t,t=void 0),this.stage.animationControls.zoomMove(this.getCenter(t),this.getZoom(t),Eo(e,0))},e.prototype.getBoxUntransformed=function(t){return t?this.structureView.getBoundingBox(new nc(t)):this.structureView.boundingBox},e.prototype.getCenterUntransformed=function(t){return t&&"string"==typeof t?this.structure.atomCenter(new nc(t)):this.structure.center},e.prototype.superpose=function(t,e,i,r){return function(t,e,i,r,n){var o,a,s,c,u;if(i=Eo(i,!1),r=Eo(r,""),n=Eo(n,""),i){var h=t,l=e;r&&n&&(h=t.getView(new nc(r)),l=e.getView(new nc(n)));var p,d,f,m,g,v=h.getSequence(),y=l.getSequence(),b=new qf(v.join(""),y.join(""));b.calc(),b.trace(),o=0,a=0,s=b.ali1.length;var x=[],_=[];for(p=0;p<s;++p)m=b.ali1[p],g=b.ali2[p],d=0,f=0,"-"===m?_[a]=!1:(_[a]=!0,d=1),"-"===g?x[o]=!1:(x[o]=!0,f=1),o+=d,a+=f;var w=[],S=[],A=h.getAtomProxy(),M=l.getAtomProxy();o=0,h.eachResidue((function(t){void 0!==t.traceAtomIndex&&t.traceAtomIndex===t.getAtomIndexByName("CA")&&(x[o]&&(A.index=t.getAtomIndexByName("CA"),w.push(A.x,A.y,A.z)),o+=1)})),o=0,l.eachResidue((function(t){void 0!==t.traceAtomIndex&&t.traceAtomIndex===t.getAtomIndexByName("CA")&&(_[o]&&(M.index=t.getAtomIndexByName("CA"),S.push(M.x,M.y,M.z)),o+=1)})),c=new Float32Array(w),u=new Float32Array(S)}else{c=t.getView(new nc(r+" and .CA")),u=e.getView(new nc(n+" and .CA"))}new fd(c,u).transform(t),t.refreshPosition()}(this.structureView,t.structureView,e,i,r),this.updateRepresentations({position:!0}),this},e.prototype.setVisibility=function(e){return t.prototype.setVisibility.call(this,e),this.trajList.forEach((function(t){t.setVisibility(e)})),this},Object.defineProperties(e.prototype,i),e}(kf);Ac.add("structure",Fm),Ac.add("structureview",Fm);var Bm=function(t){function e(e,i,r){var n=r||{};n.name=Eo(n.name,i.name),t.call(this,e,n),this.surface=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"surface"},e.prototype.addRepresentation=function(e,i){return t.prototype.addRepresentation.call(this,e,this.surface,i)},e.prototype.getBoxUntransformed=function(){return this.surface.boundingBox},e.prototype.getCenterUntransformed=function(){return this.surface.center},e.prototype.dispose=function(){this.surface.dispose(),t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,i),e}(kf);Ac.add("surface",Bm);var zm=function(t){function e(e,i,r){var n=r||{};n.name=Eo(n.name,i.name),t.call(this,e,n),this.volume=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"volume"},e.prototype.addRepresentation=function(e,i){return t.prototype.addRepresentation.call(this,e,this.volume,i)},e.prototype.getBoxUntransformed=function(){return this.volume.boundingBox},e.prototype.getCenterUntransformed=function(){return this.volume.center},e.prototype.dispose=function(){this.volume.dispose(),t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,i),e}(kf);Ac.add("volume",zm);var Um=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="axes",this.parameters=Object.assign({radius:{type:"number",precision:3,max:10,min:.001},sphereDetail:!0,radialSegments:!0,disableImpostor:!0,showAxes:{type:"boolean",rebuild:!0},showBox:{type:"boolean",rebuild:!0}},this.parameters,{assembly:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.radius=Eo(i.radius,.5),i.colorValue=Eo(i.colorValue,"lightgreen"),this.showAxes=Eo(i.showAxes,!0),this.showBox=Eo(i.showBox,!1),t.prototype.init.call(this,i)},e.prototype.getPrincipalAxes=function(){var t,e=this.getAssembly();return e&&(t=e.partList[0].getSelection()),this.structureView.getPrincipalAxes(t)},e.prototype.getAxesData=function(t){var e=this.getPrincipalAxes(t),i=new St(this.colorValue),r=0,n=0;this.showAxes&&(r+=6,n+=3),this.showBox&&(r+=8,n+=12);var o=new Float32Array(3*r),a=au(r,i.r,i.g,i.b),s=ou(r,this.radius),c=new Float32Array(3*n),u=new Float32Array(3*n),h=au(n,i.r,i.g,i.b),l=ou(n,this.radius),p=0;if(this.showAxes){var d=function(t,e){t.toArray(o,2*p),e.toArray(o,2*p+3),t.toArray(c,p),e.toArray(u,p),p+=3};d(e.begA,e.endA),d(e.begB,e.endB),d(e.begC,e.endC)}if(this.showBox){var f=new O,m=e.getProjectedScaleForAtoms(t),g=m.d1a,v=m.d2a,y=m.d3a,b=m.d1b,x=m.d2b,_=m.d3b;console.log(g,v,y,b,x,_);var w=2*p,S=function(t,i,r){f.copy(e.center).addScaledVector(e.normVecA,t).addScaledVector(e.normVecB,i).addScaledVector(e.normVecC,r),f.toArray(o,w),w+=3};S(g,v,y),S(g,v,_),S(g,x,_),S(g,x,y),S(b,x,_),S(b,x,y),S(b,v,y),S(b,v,_);var A=p,M=function(t,e){f.fromArray(o,2*p+3*t).toArray(c,A),f.fromArray(o,2*p+3*e).toArray(u,A),A+=3};M(0,1),M(0,3),M(0,6),M(1,2),M(1,7),M(2,3),M(2,4),M(3,5),M(4,5),M(4,7),M(5,6),M(6,7)}var P=new Hh(e);return{vertex:{position:o,color:a,radius:s,picking:P},edge:{position1:c,position2:u,color:h,color2:h,radius:l,picking:P}}},e.prototype.create=function(){var t=this.getAxesData(this.structureView);this.sphereBuffer=new Od(t.vertex,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0})),this.cylinderBuffer=new qd(t.edge,this.getBufferParams({openEnded:!0,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bufferList:[this.sphereBuffer,this.cylinderBuffer]})},e.prototype.updateData=function(t,e){var i=this.getAxesData(e.sview),r={},n={};t&&!t.position||(r.position=i.vertex.position,n.position1=i.edge.position1,n.position2=i.edge.position2),t&&!t.color||(r.color=i.vertex.color,n.color=i.edge.color,n.color2=i.edge.color),t&&!t.radius||(r.radius=i.vertex.radius,n.radius=i.edge.radius),this.sphereBuffer.setAttributes(r),this.cylinderBuffer.setAttributes(n)},e}(Cf);xc.add("axes",Um);var jm=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="ball+stick",this.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}},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.radius=Eo(i.radius,.15),this.aspectRatio=Eo(i.aspectRatio,2),this.lineOnly=Eo(i.lineOnly,!1),this.cylinderOnly=Eo(i.cylinderOnly,!1),this.multipleBond=Eo(i.multipleBond,"off"),this.bondSpacing=Eo(i.bondSpacing,1),this.bondScale=Eo(i.bondScale,.4),t.prototype.init.call(this,i)},e.prototype.getAtomParams=function(e,i){return i=Object.assign({radiusParams:{radius:this.radius,scale:this.scale*this.aspectRatio}},i),t.prototype.getAtomParams.call(this,e,i)},e.prototype.getAtomData=function(t,e,i){return t.getAtomData(this.getAtomParams(e,i))},e.prototype.getBondParams=function(e,i){return i=Object.assign({multipleBond:this.multipleBond,bondSpacing:this.bondSpacing,bondScale:this.bondScale},i),t.prototype.getBondParams.call(this,e,i)},e.prototype.getBondData=function(t,e,i){return t.getBondData(this.getBondParams(e,i))},e.prototype.createData=function(t){var e=this.getBondData(t),i=[];if(this.lineOnly)this.lineBuffer=new If(e,this.getBufferParams()),i.push(this.lineBuffer);else{var r=new qd(e,this.getBufferParams({openEnded:this.openEnded,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}));if(i.push(r),!this.cylinderOnly){var n=new Od(this.getAtomData(t),this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0}));i.push(n)}}return{bufferList:i}},e.prototype.updateData=function(t,e){"off"!==this.multipleBond&&t&&t.radius&&(t.position=!0);var i=this.getBondData(e.sview,t);if(this.lineOnly){var r={};t&&!t.position||(r.position1=i.position1,r.position2=i.position2),t&&!t.color||(r.color=i.color,r.color2=i.color2),e.bufferList[0].setAttributes(r)}else{var n={};if(t&&!t.position||(n.position1=i.position1,n.position2=i.position2),t&&!t.color||(n.color=i.color,n.color2=i.color2),t&&!t.radius||(n.radius=i.radius),e.bufferList[0].setAttributes(n),!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)}}},e.prototype.setParameters=function(e){var i=!1,r={};return e&&(e.aspectRatio||e.bondSpacing||e.bondScale)&&(r.radius=!0,dc&&!this.disableImpostor||(i=!0)),t.prototype.setParameters.call(this,e,r,i),this},e}(Cf);xc.add("ball+stick",jm);var Gm=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="backbone",this.parameters=Object.assign({},this.parameters,{multipleBond:null,bondSpacing:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.aspectRatio=Eo(i.aspectRatio,1),i.radius=Eo(i.radius,.25),t.prototype.init.call(this,i)},e.prototype.getAtomData=function(t,e,i){return t.getBackboneAtomData(this.getAtomParams(e,i))},e.prototype.getBondData=function(t,e,i){return t.getBackboneBondData(this.getBondParams(e,i))},e}(jm);xc.add("backbone",Gm);var Vm=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="base",this.parameters=Object.assign({},this.parameters,{multipleBond:null,bondSpacing:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.aspectRatio=Eo(i.aspectRatio,1),i.radius=Eo(i.radius,.3),t.prototype.init.call(this,i)},e.prototype.getAtomData=function(t,e,i){return t.getRungAtomData(this.getAtomParams(e,i))},e.prototype.getBondData=function(t,e,i){var r=this.getBondParams(e,i);return r.colorParams.rung=!0,t.getRungBondData(r)},e}(jm);function $m(t,e){var i=1/t,r=new O,n=new O;function o(t,i,r,n,o,a,s){a[s+0]=Is(t.x,i.x,r.x,n.x,o,e),a[s+1]=Is(t.y,i.y,r.y,n.y,o,e),a[s+2]=Is(t.z,i.z,r.z,n.z,o,e)}function a(t,i,r,n,o,a){a.x=Is(t.x,i.x,r.x,n.x,o,e),a.y=Is(t.y,i.y,r.y,n.y,o,e),a.z=Is(t.z,i.z,r.z,n.z,o,e)}function s(e,r,n,a,s,c){for(var u=0;u<t;++u){o(e,r,n,a,i*u,s,c+3*u)}}function c(e,o,s,c,u,h){for(var l=0;l<t;++l){var p=i*l,d=p-1e-4,f=p+1e-4,m=h+3*l;d<0&&(d=0),f>1&&(f=1),a(e,o,s,c,d,r),a(e,o,s,c,f,n),n.sub(r).normalize(),n.toArray(u,m)}}function u(e,i,r,n,o){for(var a=i.next(),s=i.next(),c=i.next(),u=i.size,h=u-1,l=n||0,p=0;p<h;++p)e(a,a=s,s=c,c=i.next(),r,l),l+=3*t;o&&(e(i.get(u-2),a=i.get(u-1),s=i.get(0),c=i.get(1),r,l),l+=3*t)}this.getPosition=function(e,i,r,n){e.reset(),u(s,e,i,r,n);var o=e.size-1,a=o*t*3;n&&(a+=3*t);var c=e.get(n?0:o);i[a]=c.x,i[a+1]=c.y,i[a+2]=c.z},this.getTangent=function(e,i,r,n){e.reset(),u(c,e,i,r,n);var o=(e.size-1)*t*3;n&&(o+=3*t),uu(i,i,o-3,o,3)};var h=new O,l=new O,p=new O,d=new O,f=Math.ceil(t/2);function m(e,o,s,c,u,m,g,v,y,b,x,_,w){for(var S=0;S<t;++S){var A=_+3*S;w&&(A+=3*f);var M=i*S;a(e,o,s,c,M,r),a(u,m,g,v,M,n),h.subVectors(n,r).normalize(),l.fromArray(y,A),d.crossVectors(h,l).normalize(),d.toArray(x,A),p.crossVectors(l,d).normalize(),p.toArray(b,A)}}function g(e,i,r,n,o){for(var a=0;a<t;++a){var s=o+3*a;e.copy(p),l.fromArray(i,s),d.crossVectors(e,l).normalize(),d.toArray(n,s),p.crossVectors(l,d).normalize(),p.toArray(r,s)}}function v(e,i,r,n,o){var a;for(a=0;a<f;++a)r(e,n,o+3*a);for(a=f;a<t;++a)r(i,n,o+3*a)}function y(e,i,r,n,o){var a;for(a=0;a<f;++a)n[o+a]=r(e);for(a=f;a<t;++a)n[o+a]=r(i)}function b(e,i,r,n,o){for(var a=r(e),s=r(i),c=0;c<t;++c){var u=c/t;n[o+c]=(1-u)*a+u*s}}this.getNormal=function(e,i,r,n,o,a){p.set(0,0,1);for(var s=e-1,c=o||0,u=0;u<s;++u)g(h,i,r,n,c),c+=3*t;a&&(g(h,i,r,n,c),c+=3*t),d.toArray(n,c),p.toArray(r,c)},this.getNormalDir=function(e,i,r,n,o,a,s,c){e.reset(),i.reset();var u=new O,h=new O,l=new O,g=new O,v=new O,y=(new O).copy(e.next()),b=(new O).copy(e.next()),x=(new O).copy(e.next()),_=new O,w=(new O).copy(i.next()),S=(new O).copy(i.next()),A=(new O).copy(i.next());p.set(0,0,1);for(var M=e.size,P=M-1,T=a||0,E=0;E<P;++E)v.copy(y),y.copy(b),b.copy(x),x.copy(e.next()),_.copy(w),w.copy(S),S.copy(A),A.copy(i.next()),0===E?(u.subVectors(_,v),h.subVectors(w,y),u.dot(h)<0&&(h.multiplyScalar(-1),w.addVectors(y,h)),l.subVectors(S,b),h.dot(l)<0&&(l.multiplyScalar(-1),S.addVectors(b,l))):l.copy(g),g.subVectors(A,x),l.dot(g)<0&&(g.multiplyScalar(-1),A.addVectors(x,g)),m(v,y,b,x,_,w,S,A,r,n,o,T,c),T+=3*t;if(s&&(v.copy(e.get(M-2)),y.copy(e.get(M-1)),b.copy(e.get(0)),x.copy(e.get(1)),_.copy(i.get(M-2)),w.copy(i.get(M-1)),S.copy(i.get(0)),A.copy(i.get(1)),l.copy(g),g.subVectors(A,x),l.dot(g)<0&&(g.multiplyScalar(-1),A.addVectors(x,g)),m(v,y,b,x,_,w,S,A,r,n,o,T,c),T+=3*t),c){d.fromArray(o,3*f),p.fromArray(n,3*f);for(var C=0;C<f;++C)d.toArray(o,3*C),p.toArray(n,3*C)}else d.toArray(o,T),p.toArray(n,T)},this.getColor=function(e,i,r,n,o){e.reset(),e.next();for(var a=e.next(),s=e.size,c=s-1,u=n||0,h=0;h<c;++h)v(a,a=e.next(),i,r,u),u+=3*t;o&&(v(e.get(s-1),a=e.get(0),i,r,u),u+=3*t),r[u]=r[u-3],r[u+1]=r[u-2],r[u+2]=r[u-1]},this.getPicking=function(e,i,r,n,o){e.reset(),e.next();for(var a=e.next(),s=e.size,c=s-1,u=n||0,h=0;h<c;++h)y(a,a=e.next(),i,r,u),u+=t;o&&(y(e.get(s-1),a=e.get(0),i,r,u),u+=t),r[u]=r[u-1]},this.getSize=function(e,i,r,n,o){e.reset(),e.next();for(var a=e.next(),s=e.size,c=s-1,u=n||0,h=0;h<c;++h)b(a,a=e.next(),i,r,u),u+=t;o&&(b(e.get(s-1),a=e.get(0),i,r,u),u+=t),r[u]=r[u-1]}}function Hm(t,e){this.polymer=t,this.size=t.residueCount;var i=e||{};this.directional=i.directional||!1,this.positionIterator=i.positionIterator||!1,this.subdiv=i.subdiv||1,this.smoothSheet=i.smoothSheet||!1,isNaN(i.tension)?this.tension=this.polymer.isNucleic()?.5:.9:this.tension=i.tension||.5,this.interpolator=new $m(this.subdiv,this.tension)}xc.add("base",Vm),Hm.prototype={constructor:Hm,getAtomIterator:function(t,e){var i=this.polymer,r=i.structure,n=i.residueCount,o=0,a=-1,s=[r.getAtomProxy(),r.getAtomProxy(),r.getAtomProxy(),r.getAtomProxy()],c=[new O,new O,new O,new O];var u=r.getAtomProxy(),h=r.getAtomProxy();return{size:n,next:function(){var t=this.get(a);return a+=1,t},get:function(r){var a=s[o%4];if(a.index=i.getAtomIndexByType(r,t),e&&r>0&&r<n&&"e"===a.sstruc){var l=c[o%4];return u.index=i.getAtomIndexByType(r+1,t),h.index=i.getAtomIndexByType(r-1,t),l.addVectors(u,h).add(a).add(a).multiplyScalar(.25),o+=1,l}return o+=1,a},reset:function(){o=0,a=-1}}},getSubdividedColor:function(t){var e=this.subdiv,i=this.polymer,r=(i.residueCount-1)*e*3+3;i.isCyclic&&(r+=3*e);var n=new Float32Array(r),o=this.getAtomIterator("trace"),a=t||{};a.structure=i.structure;var s=yc.getScheme(a);return this.interpolator.getColor(o,(function(t,e,i){s.atomColorToArray(t,e,i)}),n,0,i.isCyclic),{color:n}},getSubdividedPicking:function(){var t=this.subdiv,e=this.polymer,i=(e.residueCount-1)*t+1;e.isCyclic&&(i+=t);var r=e.structure,n=this.getAtomIterator("trace"),o=new Float32Array(i);return this.interpolator.getPicking(n,(function(t){return t.index}),o,0,e.isCyclic),{picking:new $h(o,r)}},getSubdividedPosition:function(){return{position:this.getPosition()}},getSubdividedOrientation:function(){var t=this.getTangent(),e=this.getNormals(t);return{tangent:t,normal:e.normal,binormal:e.binormal}},getSubdividedSize:function(t,e){var i=this.subdiv,r=this.polymer,n=(r.residueCount-1)*i+1;r.isCyclic&&(n+=i);var o=new Float32Array(n),a=this.getAtomIterator("trace"),s=new Il(t,e);return this.interpolator.getSize(a,(function(t){return s.atomRadius(t)}),o,0,r.isCyclic),{size:o}},getPosition:function(){var t=this.subdiv,e=this.polymer,i=(e.residueCount-1)*t*3+3;e.isCyclic&&(i+=3*t);var r=new Float32Array(i),n=this.positionIterator||this.getAtomIterator("trace",this.smoothSheet);return this.interpolator.getPosition(n,r,0,e.isCyclic),r},getTangent:function(){var t=this.subdiv,e=this.polymer,i=(this.size-1)*t*3+3;e.isCyclic&&(i+=3*t);var r=new Float32Array(i),n=this.positionIterator||this.getAtomIterator("trace",this.smoothSheet);return this.interpolator.getTangent(n,r,0,e.isCyclic),r},getNormals:function(t){var e=this.subdiv,i=this.polymer,r=i.isProtein(),n=this.size,o=(n-1)*e*3+3;i.isCyclic&&(o+=3*e);var a=new Float32Array(o),s=new Float32Array(o);if(this.directional&&!this.polymer.isCg()){var c=this.getAtomIterator("direction1"),u=this.getAtomIterator("direction2");this.interpolator.getNormalDir(c,u,t,a,s,0,i.isCyclic,r)}else this.interpolator.getNormal(n,t,a,s,0,i.isCyclic,r);return{normal:a,binormal:s}}};var Wm=new O,Xm=new O,qm=function(t){function e(e,i){var r=e||{},n=i||{},o=Eo(n.radialSegments,4),a=Eo(n.capped,!1),s=a?o:0,c=a?o-2:0,u=r.position.length/3,h=u*o*3+2*s*3,l=2*(u-1)*o*3+2*c*3,p=new Float32Array(h),d=new Float32Array(h),f=new Float32Array(h),m=zo(l,h/3);t.call(this,{position:p,color:d,index:m,normal:f,picking:r.picking},n),this.aspectRatio=Eo(n.aspectRatio,1),this.radialSegments=o,this.capped=a,this.capVertices=s,this.capTriangles=c,this.size2=u,r.primitiveId=su(u),this.setAttributes(r),this.meshIndex=m,this.makeIndex()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setAttributes=function(t){var e,i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,P,T,E,C,I,R,L,O,N,D=this.aspectRatio,k=this.size2,F=k-1,B=this.radialSegments,z=this.geometry.attributes;t.position&&(e=t.position,i=t.normal,r=t.binormal,n=t.tangent,a=t.size,c=z.position.array,h=z.normal.array,z.position.needsUpdate=!0,z.normal.needsUpdate=!0),t.color&&(o=t.color,u=z.color.array,z.color.needsUpdate=!0),t.primitiveId&&(s=t.primitiveId,l=z.primitiveId.array,z.primitiveId.needsUpdate=!0);var U=[],j=[],G=[],V=[],$=[],H=[];if(e)for(d=0;d<B;++d)y=d/B*2*Math.PI,U[d]=D*Math.cos(y),j[d]=Math.sin(y),G[d]=D*Math.cos(y-.01),V[d]=Math.sin(y-.01),$[d]=D*Math.cos(y+.01),H[d]=Math.sin(y+.01);for(p=0;p<k;++p)for(m=(f=3*p)*B,e&&(Wm.set(n[f],n[f+1],n[f+2]),P=i[f],T=i[f+1],E=i[f+2],C=r[f],I=r[f+1],R=r[f+2],L=e[f],O=e[f+1],N=e[f+2],M=a[p]),d=0;d<B;++d)g=m+3*d,e&&(b=-M*U[d],x=M*j[d],_=-M*G[d],w=M*V[d],S=-M*$[d],A=M*H[d],c[g]=L+b*P+x*C,c[g+1]=O+b*T+x*I,c[g+2]=N+b*E+x*R,Xm.set(S*P+A*C-(_*P+w*C),S*T+A*I-(_*T+w*I),S*E+A*R-(_*E+w*R)).cross(Wm),h[g]=Xm.x,h[g+1]=Xm.y,h[g+2]=Xm.z),o&&(u[g]=o[f],u[g+1]=o[f+1],u[g+2]=o[f+2]),s&&(l[p*B+d]=s[p]);for(f=0,m=3*k*B,d=0;d<B;++d)g=f+3*d,v=m+3*d,e&&(c[v]=c[g],c[v+1]=c[g+1],c[v+2]=c[g+2],h[v]=n[f],h[v+1]=n[f+1],h[v+2]=n[f+2]),o&&(u[v]=u[g],u[v+1]=u[g+1],u[v+2]=u[g+2]),s&&(l[k*B+d]=l[0+d]);for(f=3*(k-1)*B,m=3*(k+1)*B,d=0;d<B;++d)g=f+3*d,v=m+3*d,e&&(c[v]=c[g],c[v+1]=c[g+1],c[v+2]=c[g+2],h[v]=n[3*F],h[v+1]=n[3*F+1],h[v+2]=n[3*F+2]),o&&(u[v]=u[g],u[v+1]=u[g+1],u[v+2]=u[g+2]),s&&(l[(k+1)*B+d]=l[(k-1)*B+d])},e.prototype.makeIndex=function(){var t,e,i,r,n,o,a=this.meshIndex,s=this.size2,c=s-1,u=this.capTriangles,h=this.radialSegments,l=this.radialSegments+1;for(t=0;t<c;++t)for(e=t*h*3*2,i=t*h,r=(t+1)*h,o=0;o<h;++o)a[n=e+3*o*2]=i+o,a[n+1]=i+(o+1)%h,a[n+2]=r+o,a[n+3]=r+o,a[n+4]=i+(o+1)%h,a[n+5]=r+(o+1)%h;var p=[0];for(o=1;o<l/2;++o)p.push(o),h-o!==o&&p.push(h-o);for(n=c*h*3*2,e=s*h,o=0;o<p.length-2;++o)o%2==0?(a[n+3*o+0]=e+p[o+0],a[n+3*o+1]=e+p[o+1],a[n+3*o+2]=e+p[o+2]):(a[n+3*o+0]=e+p[o+2],a[n+3*o+1]=e+p[o+1],a[n+3*o+2]=e+p[o+0]);for(n=c*h*3*2+3*u,e=s*h+h,o=0;o<p.length-2;++o)o%2==0?(a[n+3*o+0]=e+p[o+0],a[n+3*o+1]=e+p[o+1],a[n+3*o+2]=e+p[o+2]):(a[n+3*o+0]=e+p[o+2],a[n+3*o+1]=e+p[o+1],a[n+3*o+2]=e+p[o+0])},e}(wd),Ym=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="cartoon",this.parameters=Object.assign({aspectRatio:{type:"number",precision:1,max:10,min:1},subdiv:{type:"integer",max:50,min:1,rebuild:!0},radialSegments:{type:"integer",max:50,min:1,rebuild:!0},tension:{type:"number",precision:1,max:1,min:.1},capped:{type:"boolean",rebuild:!0},smoothSheet:{type:"boolean",rebuild:!0}},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"chainname"),i.colorScale=Eo(i.colorScale,"RdYlBu"),i.radius=Eo(i.radius,"sstruc"),i.scale=Eo(i.scale,.7),this.aspectRatio=Eo(i.aspectRatio,5),this.tension=Eo(i.tension,NaN),this.capped=Eo(i.capped,!0),this.smoothSheet=Eo(i.smoothSheet,!1),"low"===i.quality?(this.subdiv=3,this.radialSegments=6):"medium"===i.quality?this.subdiv=6:"high"===i.quality?this.subdiv=12:this.subdiv=Eo(i.subdiv,6),t.prototype.init.call(this,i)},e.prototype.getSplineParams=function(t){return Object.assign({subdiv:this.subdiv,tension:this.tension,directional:1!==this.aspectRatio,smoothSheet:this.smoothSheet},t)},e.prototype.getSpline=function(t){return new Hm(t,this.getSplineParams())},e.prototype.getScale=function(t){return t.isCg()?this.scale*this.aspectRatio:this.scale},e.prototype.getAspectRatio=function(t){return t.isCg()?1:this.aspectRatio},e.prototype.createData=function(t){var e=this,i=[],r=[];return this.structure.eachPolymer((function(t){if(!(t.residueCount<4)){r.push(t);var n=e.getSpline(t),o=n.getSubdividedPosition(),a=n.getSubdividedOrientation(),s=n.getSubdividedColor(e.getColorParams()),c=n.getSubdividedPicking(),u=n.getSubdividedSize(e.radius,e.getScale(t));i.push(new qm(Object.assign({},o,a,s,c,u),e.getBufferParams({radialSegments:e.radialSegments,aspectRatio:e.getAspectRatio(t),capped:e.capped,dullInterior:!0})))}}),t.getSelection()),{bufferList:i,polymerList:r}},e.prototype.updateData=function(t,e){gc&&mc.time(this.type+" repr update"),t=t||{};for(var i=0,r=e.polymerList.length;i<r;++i){var n={},o=e.polymerList[i],a=this.getSpline(o);if(e.bufferList[i].aspectRatio=this.getAspectRatio(o),t.position||t.radius){var s=a.getSubdividedPosition(),c=a.getSubdividedOrientation(),u=a.getSubdividedSize(this.radius,this.getScale(o));n.position=s.position,n.normal=c.normal,n.binormal=c.binormal,n.tangent=c.tangent,n.size=u.size}if(t.color){var h=a.getSubdividedColor(this.getColorParams());n.color=h.color}if(t.picking){var l=a.getSubdividedPicking();n.picking=l.picking}e.bufferList[i].setAttributes(n)}gc&&mc.timeEnd(this.type+" repr update")},e.prototype.setParameters=function(e){var i={};return e&&e.aspectRatio&&(i.radius=!0),e&&e.tension&&(i.position=!0),t.prototype.setParameters.call(this,e,i,!1),this},e}(Cf);xc.add("cartoon",Ym);var Zm=function(t,e){this.sview1=t,this.sview2=e,this.kdtree2=new Tp(e)};function Km(t,e,i){e=e||3.5,i=i||40;for(var r=new nc("( 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 )"),n=new nc("( 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(r),a=t.getView(n),s=new Zm(o,a).within(e),c=s.bondStore,u=t.getAtomProxy(),h=t.getAtomProxy(),l=t.getAtomProxy(),p=t.getAtomProxy(),d=t.getResidueProxy(),f=t.getResidueProxy(),m=new O,g=new O,v=function(t,e,r,n){var o,a;t.atomname===r?(o=t,a=e):(o=e,a=t),d.index=o.residueIndex;var s=d.getAtomIndexByName(n);return m.subVectors(s,o),g.subVectors(s,a),Jo(m.angleTo(g))<i},y=0,b=c.count;y<b;++y)if(u.index=c.atomIndex1[y],h.index=c.atomIndex2[y],"O"===u.atomname&&"N"===h.atomname||"N"===u.atomname&&"O"===h.atomname)s.bondSet.clear(y);else if("N"===u.atomname||"N"===h.atomname){var x,_;if("N"===u.atomname?(x=u,_=h):(x=h,_=u),d.index=x.residueIndex,l.index=d.getAtomIndexByName("CA"),void 0===l.index)continue;var w=d.getPreviousConnectedResidue(f);if(void 0===w)continue;if(p.index=w.getAtomIndexByName("C"),void 0===p.index)continue;m.subVectors(x,p),g.subVectors(x,l),m.add(g).multiplyScalar(.5),g.subVectors(_,x),Jo(m.angleTo(g))>i&&s.bondSet.clear(y)}else("OH"===u.atomname&&"TYR"===u.resname||"OH"===h.atomname&&"TYR"===h.resname)&&(v(u,h,"OH","CZ")||s.bondSet.clear(y));return{atomSet:s.atomSet,bondSet:s.bondSet,bondStore:s.bondStore}}function Qm(t,e,i){e=e||3.5,i=i||40;for(var r=new nc("( PROTEIN and .N )"),n=new nc("( PROTEIN and .O )"),o=t.getView(r),a=t.getView(n),s=new Zm(o,a).within(e),c=s.bondStore,u=t.getAtomProxy(),h=t.getAtomProxy(),l=t.getAtomProxy(),p=t.getAtomProxy(),d=t.getResidueProxy(),f=t.getResidueProxy(),m=new O,g=new O,v=0,y=c.count;v<y;++v){var b,x;if(u.index=c.atomIndex1[v],h.index=c.atomIndex2[v],"N"===u.atomname?(b=u,x=h):(b=h,x=u),d.index=b.residueIndex,l.index=d.getAtomIndexByName("CA"),void 0!==l.index){var _=d.getPreviousConnectedResidue(f);void 0!==_&&(p.index=_.getAtomIndexByName("C"),void 0!==p.index&&(m.subVectors(b,p),g.subVectors(b,l),m.add(g).multiplyScalar(.5),g.subVectors(x,b),Jo(m.angleTo(g))>i&&s.bondSet.clear(v)))}}return{atomSet:s.atomSet,bondSet:s.bondSet,bondStore:s.bondStore}}Zm.prototype.within=function(t,e){mc.time("Contact within");var i=this.kdtree2,r=this.sview1.getAtomProxy(),n=this.sview1.getAtomSet(!1),o=new yp;this.sview1.eachAtom((function(a){for(var s=!1,c=i.nearest(a,1/0,t),u=0,h=c.length;u<h;++u){var l=c[u];r.index=l.index,a.residueIndex!==r.residueIndex&&(!e||l.distance>e)&&(s=!0,n.set(r.index),o.addBond(a,r,1))}s&&n.set(a.index)}));var a=new al(o.count,!0);return mc.timeEnd("Contact within"),{atomSet:n,bondSet:a,bondStore:o}};var Jm=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="contact",this.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},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.radius=Eo(i.radius,.25),this.contactType=Eo(i.contactType,"polarBackbone"),this.maxDistance=Eo(i.maxDistance,3.5),this.maxAngle=Eo(i.maxAngle,40),t.prototype.init.call(this,i)},e.prototype.getContactData=function(t){return{polar:Km,polarBackbone:Qm}[this.contactType](t,this.maxDistance,this.maxAngle)},e.prototype.getBondData=function(t,e,i){var r=t.getBondData(this.getBondParams(e,i));return r.picking&&(r.picking=new Xh(r.picking.array,r.picking.structure,i.bondStore)),r},e.prototype.createData=function(t){var e=this.getContactData(t);return{bufferList:[new qd(this.getBondData(t,void 0,{bondSet:e.bondSet,bondStore:e.bondStore}),this.getBufferParams({openEnded:!1,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}))],bondSet:e.bondSet,bondStore:e.bondStore}},e.prototype.updateData=function(t,e){if(!t||t.position){var i=this.getContactData(e.sview);e.bondSet=i.bondSet,e.bondStore=i.bondStore}var r={bondSet:e.bondSet,bondStore:e.bondStore},n=this.getBondData(e.sview,t,r),o={};t&&!t.position||(o.position=nu(n.position1,n.position2),o.position1=n.position1,o.position2=n.position2),t&&!t.color||(o.color=n.color,o.color2=n.color2),t&&!t.radius||(o.radius=n.radius),e.bufferList[0].setAttributes(o)},e}(Cf);xc.add("contact",Jm);var tg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="distance",this.parameters=Object.assign({labelSize:{type:"number",precision:3,max:10,min:.001},labelColor:{type:"color"},labelVisible:{type:"boolean"},labelZOffset:{type:"number",precision:1,max:20,min:-20,buffer:"zOffset"},labelUnit:{type:"select",rebuild:!0,options:{"":"",angstrom:"angstrom",nm:"nm"}},atomPair:{type:"hidden",rebuild:!0},radialSegments:!0,disableImpostor:!0},this.parameters,{flatShaded:null,assembly:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.radius=Eo(i.radius,.15),this.fontFamily=Eo(i.fontFamily,"sans-serif"),this.fontStyle=Eo(i.fontStyle,"normal"),this.fontWeight=Eo(i.fontWeight,"bold"),this.sdf=Eo(i.sdf,"Firefox"!==hc),this.labelSize=Eo(i.labelSize,2),this.labelColor=Eo(i.labelColor,16777215),this.labelVisible=Eo(i.labelVisible,!0),this.labelZOffset=Eo(i.labelZOffset,.5),this.labelUnit=Eo(i.labelUnit,""),this.atomPair=Eo(i.atomPair,[]),t.prototype.init.call(this,i)},e.prototype.getDistanceData=function(t,e){var i=e.length,r=new Array(i),n=new Float32Array(3*i),o=new nc,a=new nc,s=new yp,c=t.getAtomProxy(),u=t.getAtomProxy(),h=0;e.forEach((function(e,i){var l=e[0],p=e[1];if(Number.isInteger(l)&&Number.isInteger(p))c.index=l,u.index=p;else{o.setString(l),a.setString(p);var d=t.getAtomIndices(o),f=t.getAtomIndices(a);if(!d.length||!f.length)return void(h+=1);c.index=d[0],u.index=f[0]}s.addBond(c,u,1),i-=h;var m=c.distanceTo(u);switch(this.labelUnit){case"angstrom":r[i]=m.toFixed(2)+" "+String.fromCharCode(8491);break;case"nm":r[i]=(m/10).toFixed(2)+" nm";break;default:r[i]=m.toFixed(2)}var g=3*i;n[g+0]=(c.x+u.x)/2,n[g+1]=(c.y+u.y)/2,n[g+2]=(c.z+u.z)/2}),this),h>0&&(i-=h,n=n.subarray(0,3*i));var l=new al(s.count,!0);return{text:r,position:n,bondSet:l,bondStore:s}},e.prototype.getBondData=function(t,e,i){var r=t.getBondData(this.getBondParams(e,i));return r.picking&&(r.picking=new Zh(r.picking.array,r.picking.structure,i.bondStore)),r},e.prototype.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 St(this.labelColor);this.textBuffer=new sf({position:e.position,size:ou(t,this.labelSize),color:au(t,i.r,i.g,i.b),text: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 r={bondSet:e.bondSet,bondStore:e.bondStore},n=this.getBondData(this.structureView,void 0,r);this.cylinderBuffer=new qd(n,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]})}}},e.prototype.update=function(e){e.position?this.build():t.prototype.update.call(this,e)},e.prototype.updateData=function(t,e){var i={bondSet:e.bondSet,bondStore:e.bondStore},r=this.getBondData(e.sview,t,i),n={},o={},a=this.atomPair.length;if(t.labelSize&&(o.size=ou(a,this.labelSize)),t.labelColor){var s=new St(this.labelColor);o.color=au(a,s.r,s.g,s.b)}t.color&&(n.color=r.color,n.color2=r.color2),(t.radius||t.scale)&&(n.radius=r.radius),this.textBuffer.setAttributes(o),this.cylinderBuffer.setAttributes(n)},e.prototype.setVisibility=function(e,i){return t.prototype.setVisibility.call(this,e,!0),this.textBuffer&&this.textBuffer.setVisibility(this.labelVisible&&this.visible),i||this.viewer.requestRender(),this},e.prototype.setParameters=function(e){var i={};return e&&e.labelSize&&(i.labelSize=!0),e&&(e.labelColor||0===e.labelColor)&&(i.labelColor=!0),t.prototype.setParameters.call(this,e,i,!1),e&&void 0!==e.labelVisible&&this.setVisibility(this.visible),this},e}(Cf);xc.add("distance",tg);var eg=function(t){function e(e,i){var r=i||{},n=2*(e.position.length/3),o=new St(Eo(r.color,"grey")),a=new Float32Array(3*n),s=au(n,o.r,o.g,o.b);t.call(this,{position:a,color:s},r),this.scale=Eo(r.scale,1),this.setAttributes(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isLine:{},vertexShader:{},fragmentShader:{}};return e.prototype.setAttributes=function(t){var e,i,r,n=this.geometry.attributes;t.position&&t.vector&&(e=t.position,i=t.vector,r=n.position.array,n.position.needsUpdate=!0);var o,a,s=this.size/2,c=this.scale;if(t.position&&t.vector)for(var u=0;u<s;u++)a=3*u,r[(o=2*u*3)+0]=e[a+0],r[o+1]=e[a+1],r[o+2]=e[a+2],r[o+3]=e[a+0]+i[a+0]*c,r[o+4]=e[a+1]+i[a+1]*c,r[o+5]=e[a+2]+i[a+2]*c},i.isLine.get=function(){return!0},i.vertexShader.get=function(){return"Line.vert"},i.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,i),e}(xd),ig=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="helixorient",this.parameters=Object.assign({sphereDetail:!0,disableImpostor:!0},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"sstruc"),i.radius=Eo(i.radius,.15),i.scale=Eo(i.scale,1),t.prototype.init.call(this,i)},e.prototype.createData=function(t){var e=this,i=[],r=[];return this.structure.eachPolymer((function(t){if(!(t.residueCount<4)){r.push(t);var n=new Sp(t),o=n.getPosition(),a=n.getColor(e.getColorParams()),s=n.getSize(e.radius,e.scale),c=n.getPicking();i.push(new Od({position:o.center,color:a.color,radius:s.size,picking:c.picking},e.getBufferParams({sphereDetail:e.sphereDetail,disableImpostor:e.disableImpostor,dullInterior:!0})),new eg({position:o.center,vector:o.axis},e.getBufferParams({color:"skyblue",scale:1})),new eg({position:o.center,vector:o.resdir},e.getBufferParams({color:"lightgreen",scale:1})))}}),t.getSelection()),{bufferList:i,polymerList:r}},e.prototype.updateData=function(t,e){gc&&mc.time(this.type+" repr update"),t=t||{};for(var i=0,r=e.polymerList.length;i<r;++i){var n=3*i,o={},a=new Sp(e.polymerList[i]);if(t.position){var s=a.getPosition();o.position=s.center,e.bufferList[n+1].setAttributes({position:s.center,vector:s.axis}),e.bufferList[n+2].setAttributes({position:s.center,vector:s.resdir})}e.bufferList[n].setAttributes(o)}gc&&mc.timeEnd(this.type+" repr update")},e}(Cf);xc.add("helixorient",ig);var rg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="licorice",this.parameters=Object.assign({},this.parameters,{aspectRatio:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.aspectRatio=1,t.prototype.init.call(this,i)},e}(jm);xc.add("licorice",rg),wc.add("shader/HyperballStickImpostor.vert","\nattribute vec3 mapping;\nattribute float radius;\nattribute float radius2;\nattribute vec3 position1;\nattribute vec3 position2;\nvarying mat4 matrix_near;\nvarying vec4 prime1;\nvarying vec4 prime2;\nvarying float vRadius;\nvarying float vRadius2;\n#ifdef PICKING\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\nattribute vec3 color2;\nvarying vec3 vColor1;\nvarying vec3 vColor2;\n#endif\nuniform float shrink;\nuniform mat4 modelViewProjectionMatrix;\nuniform mat4 modelViewProjectionMatrixInverse;\nvoid main(){\nvRadius = radius;\nvRadius2 = radius2;\nvec4 spaceposition;\nvec3 position_atom1;\nvec3 position_atom2;\nvec4 vertex_position;\n#ifdef PICKING\nvPickingColor = unpackColor( primitiveId );\n#else\nvColor1 = color;\nvColor2 = color2;\n#endif\nfloat radius1 = radius;\nposition_atom1 = position1;\nposition_atom2 = position2;\nfloat distance = distance( position_atom1, position_atom2 );\nspaceposition.z = mapping.z * distance;\nif (radius1 > 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}"),wc.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;\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\ngl_FragColor = vec4( vPickingColor, objectId );\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}");var ng=new Float32Array([-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,-1,1,-1,1,1,-1,1,1,1,-1,1,1]),og=new Uint16Array([0,1,2,0,2,3,1,5,6,1,6,2,4,6,5,4,7,6,0,7,4,0,3,7,0,5,1,0,4,5,3,2,6,3,6,7]),ag=function(t){function e(e,i){t.call(this,e,i);var r=e||{},n=Eo((i||{}).shrink,.14);this.addUniforms({modelViewProjectionMatrix:{value:new N},modelViewProjectionMatrixInverse:{value:new N},modelViewMatrixInverseTranspose:{value:new N},shrink:{value:n}}),this.addAttributes({position1:{type:"v3",value:null},position2:{type:"v3",value:null},color2:{type:"c",value:null},radius:{type:"f",value:null},radius2:{type:"f",value:null}}),this.setAttributes(r),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={parameters:{},isImpostor:{},vertexShader:{},fragmentShader:{}};return i.parameters.get=function(){return Object.assign.call(this,{shrink:{uniform:!0}},t.prototype.parameters)},i.isImpostor.get=function(){return!0},i.vertexShader.get=function(){return"HyperballStickImpostor.vert"},i.fragmentShader.get=function(){return"HyperballStickImpostor.frag"},Object.defineProperties(e.prototype,i),e}(function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return i.mapping.get=function(){return ng},i.mappingIndices.get=function(){return og},i.mappingIndicesSize.get=function(){return 36},i.mappingType.get=function(){return"v3"},i.mappingSize.get=function(){return 8},i.mappingItemSize.get=function(){return 3},Object.defineProperties(e.prototype,i),e}(Ed)),sg=function(t,e){return!dc||e&&e.disableImpostor?(t.radius=function(t,e){for(var i=t.length,r=new Float32Array(i),n=0;n<i;n++)r[n]=Math.min(t[n],e[n]);return r}(t.radius1,t.radius2),new $d(t,e)):new ag(t,e)},cg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="hyperball",this.parameters=Object.assign({shrink:{type:"number",precision:3,max:1,min:.001,buffer:!0}},this.parameters,{multipleBond:null,bondSpacing:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.scale=Eo(i.scale,.2),i.radius=Eo(i.radius,"vdw"),this.shrink=Eo(i.shrink,.12),t.prototype.init.call(this,i)},e.prototype.getBondParams=function(e,i){return e&&!e.radius||(i=Object.assign({radius2:!0},i)),t.prototype.getBondParams.call(this,e,i)},e.prototype.createData=function(t){var e=new Od(t.getAtomData(this.getAtomParams()),this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0}));return this.__center=new Float32Array(3*t.bondCount),{bufferList:[e,new sg(t.getBondData(this.getBondParams()),this.getBufferParams({shrink:this.shrink,radialSegments:this.radialSegments,dullInterior:!0}))]}},e.prototype.updateData=function(t,e){var i=e.sview.getAtomData(this.getAtomParams()),r=e.sview.getBondData(this.getBondParams()),n={},o={};if(!t||t.position){n.position=i.position;var a=r.position1,s=r.position2;o.position=nu(a,s,this.__center),o.position1=a,o.position2=s}t&&!t.color||(n.color=i.color,o.color=r.color,o.color2=r.color2),t&&!t.radius||(n.radius=i.radius,o.radius=r.radius,o.radius2=r.radius2),e.bufferList[0].setAttributes(n),e.bufferList[1].setAttributes(o)},e}(rg);function ug(t,e){this.type=t,this.text=e||{}}xc.add("hyperball",cg),ug.prototype={constructor:ug,atomLabel:function(t){var e;switch(this.type){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 i=t.resname.toUpperCase();e=(bl[i]||i)+t.resno;break;case"text":e=this.text[t.index];break;default:e=t.qualifiedName()}return void 0===e?"":e}},ug.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"};var hg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="label",this.parameters=Object.assign({labelType:{type:"select",options:ug.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}},this.parameters,{side:null,flatShaded:null,wireframe:null,linewidth:null,roughness:null,metalness:null,diffuse:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};this.labelType=Eo(i.labelType,"res"),this.labelText=Eo(i.labelText,{}),this.fontFamily=Eo(i.fontFamily,"sans-serif"),this.fontStyle=Eo(i.fontStyle,"normal"),this.fontWeight=Eo(i.fontWeight,"bold"),this.sdf=Eo(i.sdf,"Chrome"===hc),this.xOffset=Eo(i.xOffset,0),this.yOffset=Eo(i.yOffset,0),this.zOffset=Eo(i.zOffset,.5),this.attachment=Eo(i.attachment,"bottom-left"),this.showBorder=Eo(i.showBorder,!1),this.borderColor=Eo(i.borderColor,"lightgrey"),this.borderWidth=Eo(i.borderWidth,.15),this.showBackground=Eo(i.showBackground,!1),this.backgroundColor=Eo(i.backgroundColor,"lightgrey"),this.backgroundMargin=Eo(i.backgroundMargin,.5),this.backgroundOpacity=Eo(i.backgroundOpacity,1),t.prototype.init.call(this,i)},e.prototype.createData=function(t){var e=t.getAtomData(this.getAtomParams({position:!0,color:!0,radius:!0})),i=[],r=new ug(this.labelType,this.labelText);return t.eachAtom((function(t){i.push(r.atomLabel(t))})),{bufferList:[new sf({position:e.position,size:e.radius,color:e.color,text:i},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}))]}},e.prototype.updateData=function(t,e){var i=e.sview.getAtomData(this.getAtomParams(t)),r={};t&&!t.position||(r.position=i.position),t&&!t.radius||(r.size=i.radius),t&&!t.color||(r.color=i.color),e.bufferList[0].setAttributes(r)},e}(Cf);xc.add("label",hg);var lg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="line",this.parameters=Object.assign({multipleBond:{type:"select",rebuild:!0,options:{off:"off",symmetric:"symmetric",offset:"offset"}},bondSpacing:{type:"number",precision:2,max:2,min:.5}},this.parameters,{flatShaded:null,side:null,wireframe:null,roughness:null,metalness:null,diffuse:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};this.multipleBond=Eo(i.multipleBond,"off"),this.bondSpacing=Eo(i.bondSpacing,1),t.prototype.init.call(this,i)},e.prototype.getBondParams=function(e,i){return i=Object.assign({multipleBond:this.multipleBond,bondSpacing:this.bondSpacing,radiusParams:{radius:.1,scale:1}},i),t.prototype.getBondParams.call(this,e,i)},e.prototype.createData=function(t){var e=t.getBondData(this.getBondParams({position:!0,color:!0}));return{bufferList:[new If(e,this.getBufferParams())]}},e.prototype.updateData=function(t,e){var i=e.sview.getBondData(this.getBondParams(t)),r={};t&&!t.position||(r.position1=i.position1,r.position2=i.position2),t&&!t.color||(r.color=i.color,r.color2=i.color2),e.bufferList[0].setAttributes(r)},e.prototype.setParameters=function(e){var i={};return e&&e.bondSpacing&&(i.position=!0),t.prototype.setParameters.call(this,e,i,!1),this},e}(Cf);function pg(t,e,i,r,n){var o,a=new(r=r||Int32Array)(t*e*i*(n=n||1));function s(t,r,o){return((t*e+r)*i+o)*n}this.data=a,this.index=s,this.set=function(t,e,i){var r=arguments,c=s(t,e,i);for(o=0;o<n;++o)a[c+o]=r[3+o]},this.toArray=function(t,e,i,r,c){var u=s(t,e,i);for(void 0===r&&(r=[]),void 0===c&&(c=0),o=0;o<n;++o)r[c+o]=a[u+o]},this.fromArray=function(t,e,i,r,c){var u=s(t,e,i);for(void 0===c&&(c=0),o=0;o<n;++o)a[u+o]=r[c+o]},this.copy=function(t){this.data.set(t.data)},this.clone=function(){return new pg(t,e,i,r,n).copy(this)}}function dg(t,e,i){var r=ap(e),n=Sh(t);0===t.length&&(n[0].set([0,0,0]),n[1].set([0,0,0]));var o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x=n[0],_=n[1];function w(t,e,i,n,w){o=e||1.4,a=i||2,g=w||!0;var S=0;for(var M in r)S=Math.max(S,M);var P=sp(x,_,S,a,t?o:0);c=P.dim[0],u=P.dim[1],h=P.dim[2],l=P.matrix,p=P.tran,a=P.scaleFactor,d={},f={},A(t),m=o*a,s=n||o/a,v=new Uint8Array(c*u*h),t&&(y=new Float64Array(c*u*h)),g&&(b=new Int32Array(c*u*h))}var S=[new Int32Array([1,0,0]),new Int32Array([-1,0,0]),new Int32Array([0,1,0]),new Int32Array([0,-1,0]),new Int32Array([0,0,1]),new Int32Array([0,0,-1]),new Int32Array([1,1,0]),new Int32Array([1,-1,0]),new Int32Array([-1,1,0]),new Int32Array([-1,-1,0]),new Int32Array([1,0,1]),new Int32Array([1,0,-1]),new Int32Array([-1,0,1]),new Int32Array([-1,0,-1]),new Int32Array([0,1,1]),new Int32Array([0,1,-1]),new Int32Array([0,-1,1]),new Int32Array([0,-1,-1]),new Int32Array([1,1,1]),new Int32Array([1,1,-1]),new Int32Array([1,-1,1]),new Int32Array([-1,1,1]),new Int32Array([1,-1,-1]),new Int32Array([-1,-1,1]),new Int32Array([-1,1,-1]),new Int32Array([-1,-1,-1])];function A(t){var e,i,n,s,c,u,h,l,p,m;for(var g in r)if(e=r[g],!d[g]){for(u=(h=t?(e+o)*a+.5:e*a+.5)*h,l=Math.floor(h)+1,p=new Int32Array(l*l),m=0,i=0;i<l;++i)for(n=0;n<l;++n)(s=i*i+n*n)>u?p[m]=-1:(c=Math.sqrt(u-s),p[m]=Math.floor(c)),++m;f[g]=l,d[g]=p}}function M(i){var r,n,o,s,l,m,y,x,_,w,S,A,M,P,T,E,C,I,R=3*i,L=i;r=Math.floor(.5+a*(t[R]+p[0])),n=Math.floor(.5+a*(t[R+1]+p[1])),o=Math.floor(.5+a*(t[R+2]+p[2]));var O,N=e[L],D=d[N],k=0,F=u*h,B=f[N];for(w=0;w<B;++w)for(S=0;S<B;++S){if(-1!==(O=D[k]))for(E=-1;E<2;++E)for(C=-1;C<2;++C)for(I=-1;I<2;++I)if(0!==E&&0!==C&&0!==I)for(y=E*w,_=I*S,A=0;A<=O;++A)if(P=n+(x=A*C),T=o+_,!((M=r+y)<0||P<0||T<0||M>=c||P>=u||T>=h)){var z=M*F+P*h+T;if(g)if(1&v[z]){if(1&v[z]){var U=b[z];U!==R&&y*y+x*x+_*_<(s=r+y-Math.floor(.5+a*(t[U]+p[0])))*s+(l=n+x-Math.floor(.5+a*(t[U+1]+p[1])))*l+(m=o+_-Math.floor(.5+a*(t[U+2]+p[2])))*m&&(b[z]=i)}}else v[z]|=1,b[z]=i;else v[z]|=1}k++}}function P(e){var i,r;for(console.time("EDTSurface fillvoxels"),i=0,r=v.length;i<r;++i)v[i]=0,e&&(y[i]=-1),g&&(b[i]=-1);for(i=0,r=t.length/3;i<r;++i)M(i);for(i=0,r=v.length;i<r;++i)1&v[i]&&(v[i]|=2);console.timeEnd("EDTSurface fillvoxels")}function T(i){var r,n,o,s,l,m,y,x,_,w,S,A,M,P,T,E,C,I,R,L=3*i,O=i,N=0;r=Math.floor(.5+a*(t[L]+p[0])),n=Math.floor(.5+a*(t[L+1]+p[1])),o=Math.floor(.5+a*(t[L+2]+p[2]));var D=e[O],k=u*h;for(M=0,R=f[D];M<R;++M)for(P=0;P<R;++P){if(-1!==d[D][N])for(E=-1;E<2;++E)for(C=-1;C<2;++C)for(I=-1;I<2;++I)if(0!==E&&0!==C&&0!==I)for(y=E*M,_=I*P,T=0;T<=d[D][N];++T)if(S=n+(x=T*C),A=o+_,!((w=r+y)<0||S<0||A<0||w>=c||S>=u||A>=h)){var F=w*k+S*h+A;if(2&v[F]){if(g){var B=b[F];y*y+x*x+_*_<(s=Math.floor(.5+a*(t[B]+p[0])))*s+(l=Math.floor(.5+a*(t[B+1]+p[1])))*l+(m=Math.floor(.5+a*(t[B+2]+p[2])))*m&&(b[F]=i)}}else v[F]|=2,g&&(b[F]=i)}N++}}function E(){var t,e,i,r;console.time("EDTSurface fastdistancemap");var n,o=new pg(c,u,h,Uint16Array,3),a=u*h,l=m*m,p=0;for(t=0;t<c;++t)for(e=0;e<u;++e)for(i=0;i<h;++i)v[n=t*a+e*h+i]&=-3,1&v[n]&&4&v[n]&&(o.set(t,e,i,t,e,i),y[n]=0,v[n]|=2,p+=1);var d=new Int32Array(3*p),f=0,x=new Int32Array(3*p),_=0;for(t=0;t<c;++t)for(e=0;e<u;++e)for(i=0;i<h;++i)4&v[n=t*a+e*h+i]&&(d[f]=t,d[f+1]=e,d[f+2]=i,f+=3,v[n]&=-5);do{for(_=C(d,o,f,x),f=0,t=0,r=_;t<r;t+=3)n=a*x[t]+h*x[t+1]+x[t+2],v[n]&=-5,y[n]<=1.0404*l&&(d[f]=x[t],d[f+1]=x[t+1],d[f+2]=x[t+2],f+=3)}while(f>0);var w,S=s*s,A=new Uint16Array(3);for(t=0;t<c;++t)for(e=0;e<u;++e)for(i=0;i<h;++i)v[n=t*a+e*h+i]&=-5,1&v[n]&&(2&v[n]&&!(2&v[n]&&y[n]>=S)||(v[n]|=4,g&&2&v[n]&&(o.toArray(t,e,i,A),w=A[0]*a+A[1]*h+A[2],b[n]=b[w])));console.timeEnd("EDTSurface fastdistancemap")}function C(t,e,i,r){var n,o,a,s,l,p,d,f,m,g,b,x,_=new Uint16Array(3),w=0;if(0===i)return w;var A=-1,M=-1,P=-1,T=u*h;for(d=0,m=i;d<m;d+=3)for(n=t[d],o=t[d+1],a=t[d+2],e.toArray(n,o,a,_),f=0;f<6;++f)A=n+(x=S[f])[0],M=o+x[1],P=a+x[2],A<c&&A>-1&&M<u&&M>-1&&P<h&&P>-1&&(1&v[b=A*T+h*M+P]&&!(2&v[b])?(e.fromArray(A,M,P,_),g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p,y[b]=g,v[b]|=2,v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3):1&v[b]&&2&v[b]&&(g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p)<y[b]&&(e.fromArray(A,M,P,_),y[b]=g,4&v[b]||(v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3)));for(d=0,m=i;d<m;d+=3)for(n=t[d],o=t[d+1],a=t[d+2],e.toArray(n,o,a,_),f=6;f<18;f++)A=n+(x=S[f])[0],M=o+x[1],P=a+x[2],A<c&&A>-1&&M<u&&M>-1&&P<h&&P>-1&&(1&v[b=A*T+h*M+P]&&!(2&v[b])?(e.fromArray(A,M,P,_),g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p,y[b]=g,v[b]|=2,v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3):1&v[b]&&2&v[b]&&(g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p)<y[b]&&(e.fromArray(A,M,P,_),y[b]=g,4&v[b]||(v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3)));for(d=0,m=i;d<m;d+=3)for(n=t[d],o=t[d+1],a=t[d+2],e.toArray(n,o,a,_),f=18;f<26;f++)A=n+(x=S[f])[0],M=o+x[1],P=a+x[2],A<c&&A>-1&&M<u&&M>-1&&P<h&&P>-1&&(1&v[b=A*T+h*M+P]&&!(2&v[b])?(e.fromArray(A,M,P,_),g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p,y[b]=g,v[b]|=2,v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3):1&v[b]&&2&v[b]&&(g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p)<y[b]&&(e.fromArray(A,M,P,_),y[b]=g,4&v[b]||(v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3)));return w}this.getVolume=function(e,r,n,o,a){console.time("EDTSurface.getVolume");var s="vws"!==e;w(s,r,n,o,a),P(s),function(){var t,e,i,r=u*h;for(t=0;t<c;++t)for(e=0;e<h;++e)for(i=0;i<u;++i){var n=t*r+i*h+e;if(1&v[n])for(var o=0;o<26;){var a=t+S[o][0],s=e+S[o][2],l=i+S[o][1];if(a>-1&&a<c&&l>-1&&l<u&&s>-1&&s<h&&!(1&v[a*r+l*h+s])){v[n]|=4;break}o++}}}(),"ms"!==e&&"ses"!==e||E(),"ses"===e&&(A(!1),function(){var e,i;for(e=0,i=v.length;e<i;++e)v[e]&=-3;for(e=0,i=t.length/3;e<i;++e)T(e)}()),function(t){var e,i=v.length;if("vws"===t)for(e=0;e<i;++e)v[e]&=-5,v[e]=2&v[e]?1:0;else if("ms"===t)for(e=0;e<i;++e)v[e]&=-3,4&v[e]&&(v[e]|=2),v[e]&=-5,v[e]=2&v[e]?1:0;else if("ses"===t)for(e=0;e<i;++e)4&v[e]&&2&v[e]?v[e]&=-5:4&v[e]&&!(2&v[e])&&(v[e]|=2),v[e]=2&v[e]?1:0;else if("sas"===t)for(e=0;e<i;++e)v[e]&=-5,v[e]=2&v[e]?1:0}(e);for(var l=0,p=b.length;l<p;++l)b[l]=i[b[l]];return console.timeEnd("EDTSurface.getVolume"),{data:v,nx:h,ny:u,nz:c,atomindex:b}},this.getSurface=function(t,e,i,r,n,o,a){var s=this.getVolume(t,e,i,r,n);return new hp(s.data,s.nx,s.ny,s.nz,s.atomindex).getSurface(1,o,void 0,l,a)}}function fg(t,e,i,r,n,o,a){var s=t.length,c=n[0],u=n[1],h=n[2],l=o[0],p=o[1],d=o[2];function f(t,e){return Math.floor((t-e)/a)}for(var m=f(l,c)+1,g=f(p,u)+1,v=f(d,h)+1,y=m*g*v,b=g*v,x=function(t,e,i){return(f(t,c)*g+f(e,u))*v+f(i,h)},_=[],w=0;w<s;w++){var S=x(t[w],e[w],i[w]);void 0===_[S]?_[S]=[w]:_[S].push(w)}var A=new Uint32Array(y),M=new Uint16Array(y),P=new Uint32Array(s),T=0,E=0;for(w=0;w<y;w++){var C=A[w]=T,I=_[w];if(void 0!==I)for(var R=0;R<I.length;R++)P[T]=I[R],T++;var L=T-C;M[w]=L,L>E&&(E=L)}this.neighbourListLength=27*E+1,this.withinRadii=function(n,o,a,s,l){for(var p=0,d=f(n,c),y=f(o,u),x=f(a,h),_=Math.max(0,d-1),w=Math.max(0,y-1),S=Math.max(0,x-1),T=Math.min(m,d+1),E=Math.min(g,y+1),C=Math.min(v,x+1),I=_;I<=T;++I)for(var R=I*b,L=w;L<=E;++L)for(var O=L*v,N=S;N<=C;++N)for(var D=R+O+N,k=A[D],F=k+M[D],B=k;B<F;B++){var z=P[B],U=t[z]-n,j=e[z]-o,G=i[z]-a,V=r[z]+s;U*U+j*j+G*G<=V*V&&(l[p++]=P[B])}l[p]=-1}}function mg(t,e,i){for(var r=e.length,n=new Float32Array(r),o=new Float32Array(r),a=new Float32Array(r),s=0;s<r;s++){var c=3*s;n[s]=t[c],o[s]=t[c+1],a[s]=t[c+2]}var u=Sh(t);0===t.length&&(u[0].set([0,0,0]),u[1].set([0,0,0]));var h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,P,T,E,C=u[0],I=u[1],R=-1,L=new Float32Array([0,0,0]),O=new Float32Array([0,0,0]),N=new Float32Array([0,0,0]);function D(t,i,s,c){d=Eo(t,1.4),f=Eo(i,2),m=Eo(s,!0),g=Eo(c,30),h=new Float32Array(r),l=new Float32Array(r);for(var u=0;u<h.length;++u){var L=e[u]+d;h[u]=L,l[u]=L*L}p=0;for(var O=0;O<h.length;++O)h[O]>p&&(p=h[O]);var N;N=sp(C,I,p,f,0),f=N.scaleFactor,v=N.dim,y=N.matrix,E=Math.min(5,2+Math.floor(d*f)),b=ou(v[0]*v[1]*v[2],-1001),x=new Int32Array(b.length),_=new Float32Array(v[0]),w=new Float32Array(v[1]),S=new Float32Array(v[2]),k(_,C[0],1/f),k(w,C[1],1/f),k(S,C[2],1/f),function(){var t=0,e=2*Math.PI/g;M=new Float32Array(g),A=new Float32Array(g);for(var i=0;i<g;i++)M[i]=Math.cos(t),A[i]=Math.sin(t),t+=e}(),P=new fg(n,o,a,h,C,I,2.01*p),T=new Int32Array(P.neighbourListLength),R=-1}function k(t,e,i){for(var r=0;r<t.length;r++)t[r]=e+i*r}function F(t,e,i,r,n){var o;if(-1!==R){if((o=R)!==r&&o!==n&&B(o,t,e,i))return o;R=-1}var a=0;for(o=T[a];o>=0;){if(o!==r&&o!==n&&B(o,t,e,i))return R=o,o;o=T[++a]}return R=-1,-1}function B(e,i,r,n){var o=3*e,a=l[e],s=t[o]-i,c=t[o+1]-r,u=t[o+2]-n;return s*s+c*c+u*u<a}function z(){for(var t=0;t<r;t++){var e=n[t],i=o[t],s=a[t],c=h[t],u=l[t];P.withinRadii(e,i,s,c,T);for(var p=Math.ceil(c*f),d=Math.floor(f*(e-C[0])),g=Math.floor(f*(i-C[1])),y=Math.floor(f*(s-C[2])),A=Math.max(0,d-p),M=Math.max(0,g-p),E=Math.max(0,y-p),I=Math.min(v[0],d+p+2),R=Math.min(v[1],g+p+2),L=Math.min(v[2],y+p+2),O=A;O<I;O++)for(var N=_[O]-e,D=v[1]*v[2]*O,k=M;k<R;k++)for(var B=w[k]-i,z=N*N+B*B,U=D+v[2]*k,j=E;j<L;j++){var G=S[j]-s,V=z+G*G;if(V<u){var $=j+U;b[$]<0&&(b[$]=-b[$]);var H=Math.sqrt(V),W=c/H,X=N*W,q=B*W,Y=G*W;if(-1===F(X+=e,q+=i,Y+=s,t,-1)){var Z=c-H;Z<b[$]&&(b[$]=Z,m&&(x[$]=t))}}}}}function U(t,e){var i=h[t],r=h[e],s=L[0]=n[e]-n[t],c=L[1]=o[e]-o[t],u=L[2]=a[e]-a[t],l=s*s+c*c+u*u,p=Math.sqrt(l),d=i*((i*i+p*p-r*r)/(2*i*p));Nh(L,L),function(t,e){t[0]=t[1]=t[2]=1,0!==e[0]?t[0]=(e[1]+e[2])/-e[0]:0!==e[1]?t[1]=(e[0]+e[2])/-e[1]:0!==e[2]&&(t[2]=(e[0]+e[1])/-e[2])}(O,L),Nh(O,O),Eh(N,L,O),Nh(N,N);var y=Math.sqrt(i*i-d*d);Oh(O,O,y),Oh(N,N,y),Oh(L,L,d),L[0]+=n[t],L[1]+=o[t],L[2]+=a[t],R=-1;for(var P=E,T=0;T<g;T++){var I=M[T],D=A[T],k=L[0]+I*O[0]+D*N[0],B=L[1]+I*O[1]+D*N[1],z=L[2]+I*O[2]+D*N[2];if(-1===F(k,B,z,t,e))for(var U=Math.floor(f*(k-C[0])),j=Math.floor(f*(B-C[1])),G=Math.floor(f*(z-C[2])),V=Math.max(0,U-P),$=Math.max(0,j-P),H=Math.max(0,G-P),W=Math.min(v[0],U+P+2),X=Math.min(v[1],j+P+2),q=Math.min(v[2],G+P+2),Y=V;Y<W;Y++){s=k-_[Y];for(var Z=v[1]*v[2]*Y,K=$;K<X;K++)for(var Q=s*s+(c=B-w[K])*c,J=Z+v[2]*K,tt=H;tt<q;tt++){l=Q+(u=z-S[tt])*u;var et=tt+J,it=b[et];it>0&&l<it*it&&(b[et]=Math.sqrt(l),m&&(x[et]=t))}}}}function j(t,e,s){console.time("AVSurface.getVolume"),console.time("AVSurface.init"),D(t,e,s),console.timeEnd("AVSurface.init"),console.time("AVSurface.projectPoints"),z(),console.timeEnd("AVSurface.projectPoints"),console.time("AVSurface.projectTorii"),function(){for(var t=0;t<r;t++){P.withinRadii(n[t],o[t],a[t],h[t],T);for(var e=0,i=T[e];i>=0;)t<i&&U(t,i),i=T[++e]}}(),console.timeEnd("AVSurface.projectTorii"),function(){for(var t=0;t<b.length;t++)b[t]<0&&(b[t]=0)}(),function(){for(var t=0;t<x.length;t++)x[t]=i[x[t]]}(),console.timeEnd("AVSurface.getVolume")}this.getSurface=function(t,e,i,r,n,o,a){return j(e,i,n),new hp(b,v[2],v[1],v[0],x).getSurface(e,!1,void 0,y,a)}}xc.add("line",lg),dg.__deps=[sp,ap,hp,Sh,pg],mg.__deps=[sp,hp,ou,Sh,Oh,Eh,Nh,fg,Eo],vc.add("molsurf",(function(t,e){var i=t.data.args,r=t.data.params;if(i&&r){var n=new("av"===r.type?mg:dg)(i.coordList,i.radiusList,i.indexList).getSurface(r.type,r.probeRadius,r.scaleFactor,r.cutoff,!0,r.smooth,r.contour),o=[n.position.buffer,n.index.buffer];n.normal&&o.push(n.normal.buffer),n.atomindex&&o.push(n.atomindex.buffer),e({sd:n,p:r},o)}}),[dg,mg]);var gg=function(t){this.structure=t};gg.prototype._getAtomData=function(){return this.structure.getAtomData({what:{position:!0,radius:!0,index:!0},radiusParams:{radius:"vdw",scale:1}})},gg.prototype._makeSurface=function(t,e){var i=new cp(e.name,"",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},gg.prototype.getSurface=function(t){var e=t||{},i=this._getAtomData(),r=i.position,n=i.radius,o=i.index,a=new("av"===e.type?mg:dg)(r,n,o).getSurface(e.type,e.probeRadius,e.scaleFactor,e.cutoff,!0,e.smooth,e.contour);return this._makeSurface(a,e)},gg.prototype.getSurfaceWorker=function(t,e){var i=this,r=Object.assign({},t);if(window.Worker){void 0===this.worker&&(this.worker=new Ql("molsurf"));var n=this._getAtomData(),o=n.position,a=n.radius,s=n.index,c={args:{coordList:o,radiusList:a,indexList:s},params:r},u=[o.buffer,a.buffer,s.buffer];this.worker.post(c,u,(function(t){e(i._makeSurface(t.data.sd,r))}),(function(t){console.warn("MolecularSurface.getSurfaceWorker error - trying without worker",t),i.worker.terminate(),i.worker=void 0;var n=i.getSurface(r);e(n)}))}else{var h=this.getSurface(r);e(h)}},gg.prototype.dispose=function(){this.worker&&this.worker.terminate()};var vg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="surface",this.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},contour:{type:"boolean",rebuild:!0},background:{type:"boolean",rebuild:!0},opaqueBack:{type:"boolean",buffer:!0},filterSele:{type:"text",rebuild:!0},colorVolume:{type:"hidden"},useWorker:{type:"boolean",rebuild:!0}},this.parameters,{radiusType:null,radius:null,scale:null}),this.__infoList=[],this.structure.signals.refreshed.add((function(){this.__forceNewMolsurf=!0}),this),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"uniform"),i.colorValue=Eo(i.colorValue,14540253),i.disablePicking=Eo(i.disablePicking,!0),this.surfaceType=Eo(i.surfaceType,"ms"),this.probeRadius=Eo(i.probeRadius,1.4),this.smooth=Eo(i.smooth,2),this.scaleFactor=Eo(i.scaleFactor,2),this.cutoff=Eo(i.cutoff,0),this.contour=Eo(i.contour,!1),this.background=Eo(i.background,!1),this.opaqueBack=Eo(i.opaqueBack,!0),this.filterSele=Eo(i.filterSele,""),this.colorVolume=Eo(i.colorVolume,void 0),this.useWorker=Eo(i.useWorker,!0),t.prototype.init.call(this,e)},e.prototype.prepareData=function(t,e,i){var r=this.__infoList[e];if(r||(r={},this.__infoList[e]=r),r.molsurf&&r.sele===t.selection.string)i(e);else{if(this.filterSele){var n=t.structure.getView(new nc(this.filterSele)),o=n.boundingBox.getSize(),a=Math.max(o.x,o.y,o.z),s=t.getAtomSetWithinPoint(n.center,a/2+6);t=t.getView(new nc(t.getAtomSetWithinSelection(s,3).toSeleString()))}r.sele=t.selection.string,r.molsurf=new gg(t);var c=this.getSurfaceParams(),u=function(t){r.surface=t,i(e)};this.useWorker?r.molsurf.getSurfaceWorker(c,u):u(r.molsurf.getSurface(c))}},e.prototype.prepare=function(t){var e=this;if((this.__forceNewMolsurf||this.__sele!==this.selection.string||this.__surfaceParams!==JSON.stringify(this.getSurfaceParams()))&&(this.__infoList.forEach((function(t){t.molsurf.dispose()})),this.__infoList.length=0),0!==this.structureView.atomCount){var i=function(){this.__sele=this.selection.string,this.__surfaceParams=JSON.stringify(this.getSurfaceParams()),this.__forceNewMolsurf=!1,t()}.bind(this),r="default"===this.assembly?this.defaultAssembly:this.assembly,n=this.structure.biomolDict[r];n?n.partList.forEach((function(t,r){var o=t.getView(e.structureView);e.prepareData(o,r,(function(t){t===n.partList.length-1&&i()}))})):this.prepareData(this.structureView,0,i)}else t()},e.prototype.createData=function(t,e){var i=this.__infoList[e],r=i.surface,n={position:r.getPosition(),color:r.getColor(this.getColorParams()),index:r.getFilteredIndex(this.filterSele,t)},o=[];if(r.contour){var a=new xf(n,this.getBufferParams({wireframe:!1}));o.push(a)}else{n.normal=r.getNormal(),n.picking=r.getPicking(t.getStructure());var s=new mf(n,this.getBufferParams({background:this.background,opaqueBack:this.opaqueBack,dullInterior:!1})),c=new yf(s);o.push(c)}return{bufferList:o,info:i}},e.prototype.updateData=function(t,e){var i={};if(t.position)return 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)),e.bufferList[0].setAttributes(i)},e.prototype.setParameters=function(e,i,r){return i=i||{},e&&e.filterSele&&(i.index=!0),e&&void 0!==e.colorVolume&&(i.color=!0),e&&e.wireframe&&(e.contour||void 0===e.contour&&this.contour)&&(e.wireframe=!1),t.prototype.setParameters.call(this,e,i,r),this},e.prototype.getSurfaceParams=function(t){return Object.assign({type:this.surfaceType,probeRadius:this.probeRadius,scaleFactor:this.scaleFactor,smooth:this.smooth&&!this.contour,cutoff:this.cutoff,contour:this.contour,useWorker:this.useWorker},t)},e.prototype.getColorParams=function(){var e=t.prototype.getColorParams.call(this);return e.volume=this.colorVolume,e},e.prototype.clear=function(){t.prototype.clear.call(this)},e.prototype.dispose=function(){this.__infoList.forEach((function(t){t.molsurf.dispose()})),this.__infoList.length=0,t.prototype.dispose.call(this)},e}(Cf);xc.add("surface",vg);var yg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="point",this.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}},this.parameters,{flatShaded:null,wireframe:null,linewidth:null,roughness:null,metalness:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};this.pointSize=Eo(i.pointSize,1),this.sizeAttenuation=Eo(i.sizeAttenuation,!0),this.sortParticles=Eo(i.sortParticles,!1),this.useTexture=Eo(i.useTexture,!1),this.alphaTest=Eo(i.alphaTest,.5),this.forceTransparent=Eo(i.forceTransparent,!1),this.edgeBleach=Eo(i.edgeBleach,0),t.prototype.init.call(this,i)},e.prototype.createData=function(t){var e=t.getAtomData(this.getAtomParams({position:!0,color:!0,picking:!0}));return{bufferList:[new wf(e,this.getBufferParams({pointSize:this.pointSize,sizeAttenuation:this.sizeAttenuation,sortParticles:this.sortParticles,useTexture:this.useTexture,alphaTest:this.alphaTest,forceTransparent:this.forceTransparent,edgeBleach:this.edgeBleach}))]}},e.prototype.updateData=function(t,e){var i=e.sview.getAtomData(this.getAtomParams(t)),r={};t&&!t.position||(r.position=i.position),t&&!t.color||(r.color=i.color),e.bufferList[0].setAttributes(r)},e}(Cf);xc.add("point",yg),wc.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\n#include unpack_color\nattribute float primitiveId;\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 = unpackColor( primitiveId );\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}");var bg=new Uint16Array([0,1,2,1,3,2]),xg=function(t){function e(e,i){var r=e||{},n=r.position.length/3-1,o=4*n,a=3*o,s=new Float32Array(a),c=new Float32Array(a),u=new Float32Array(a),h=zo(a,a/3);t.call(this,{position:s,color:c,index:h,normal:u,picking:r.picking},i),this.addAttributes({dir:{type:"v3",value:new Float32Array(a)}}),this.addAttributes({size:{type:"f",value:new Float32Array(o)}}),r.primitiveId=su(n),this.setAttributes(r),this.meshIndex=h,this.makeIndex()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={vertexShader:{}};return e.prototype.setAttributes=function(t){var e,i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x=this.size/4,_=this.geometry.attributes;t.position&&(e=t.position,s=_.position.array,_.position.needsUpdate=!0),t.normal&&(i=t.normal,c=_.normal.array,_.normal.needsUpdate=!0),t.size&&(r=t.size,u=_.size.array,_.size.needsUpdate=!0),t.dir&&(n=t.dir,h=_.dir.array,_.dir.needsUpdate=!0),t.color&&(o=t.color,l=_.color.array,_.color.needsUpdate=!0),t.primitiveId&&(a=t.primitiveId,p=_.primitiveId.array,_.primitiveId.needsUpdate=!0);var w=r?r[0]:null;for(d=0;d<x;++d){for(y=3*d,m=3*d*4,v=4*d,e&&(s[m]=s[m+3]=e[y],s[m+1]=s[m+4]=e[y+1],s[m+2]=s[m+5]=e[y+2],s[m+6]=s[m+9]=e[y+3],s[m+7]=s[m+10]=e[y+4],s[m+8]=s[m+11]=e[y+5]),i&&(c[m]=c[m+3]=-i[y],c[m+1]=c[m+4]=-i[y+1],c[m+2]=c[m+5]=-i[y+2],c[m+6]=c[m+9]=-i[y+3],c[m+7]=c[m+10]=-i[y+4],c[m+8]=c[m+11]=-i[y+5]),f=0;f<4;++f)g=m+3*f,o&&(l[g]=o[y],l[g+1]=o[y+1],l[g+2]=o[y+2]),a&&(p[v+f]=a[d]);r&&(b=r[d],w!==r[d]?(u[v]=w,u[v+1]=w,u[v+2]=b,u[v+3]=b):(u[v]=b,u[v+1]=b,u[v+2]=b,u[v+3]=b),w=b),n&&(h[m]=n[y],h[m+1]=n[y+1],h[m+2]=n[y+2],h[m+3]=-n[y],h[m+4]=-n[y+1],h[m+5]=-n[y+2],h[m+6]=n[y+3],h[m+7]=n[y+4],h[m+8]=n[y+5],h[m+9]=-n[y+3],h[m+10]=-n[y+4],h[m+11]=-n[y+5])}},e.prototype.makeIndex=function(){var t,e,i,r,n=this.meshIndex,o=n.length/4/3;for(e=0;e<o;++e)for(i=6*e,r=4*e,n.set(bg,i),t=0;t<6;++t)n[i+t]+=r},i.vertexShader.get=function(){return"Ribbon.vert"},Object.defineProperties(e.prototype,i),e}(wd),_g=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="ribbon",this.parameters=Object.assign({subdiv:{type:"integer",max:50,min:1,rebuild:!0},tension:{type:"number",precision:1,max:1,min:.1},smoothSheet:{type:"boolean",rebuild:!0}},this.parameters,{side:null,wireframe:null,linewidth:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"chainname"),i.colorScale=Eo(i.colorScale,"RdYlBu"),i.radius=Eo(i.radius,"sstruc"),i.scale=Eo(i.scale,4),"low"===i.quality?this.subdiv=3:"medium"===i.quality?this.subdiv=6:"high"===i.quality?this.subdiv=12:this.subdiv=Eo(i.subdiv,6),this.tension=Eo(i.tension,NaN),this.smoothSheet=Eo(i.smoothSheet,!1),t.prototype.init.call(this,i)},e.prototype.getSplineParams=function(t){return Object.assign({subdiv:this.subdiv,tension:this.tension,directional:!0,smoothSheet:this.smoothSheet},t)},e.prototype.createData=function(t){var e=this,i=[],r=[];return this.structure.eachPolymer((function(t){if(!(t.residueCount<4)){r.push(t);var n=new Hm(t,e.getSplineParams()),o=n.getSubdividedPosition(),a=n.getSubdividedOrientation(),s=n.getSubdividedColor(e.getColorParams()),c=n.getSubdividedPicking(),u=n.getSubdividedSize(e.radius,e.scale);i.push(new xg({position:o.position,normal:a.binormal,dir:a.normal,color:s.color,size:u.size,picking:c.picking},e.getBufferParams()))}}),t.getSelection()),{bufferList:i,polymerList:r}},e.prototype.updateData=function(t,e){t=t||{};var i=0,r=e.polymerList.length;for(i=0;i<r;++i){var n={},o=new Hm(e.polymerList[i],this.getSplineParams());if(t.position){var a=o.getSubdividedPosition(),s=o.getSubdividedOrientation();n.position=a.position,n.normal=s.binormal,n.dir=s.normal}if(t.radius||t.scale){var c=o.getSubdividedSize(this.radius,this.scale);n.size=c.size}if(t.color){var u=o.getSubdividedColor(this.getColorParams());n.color=u.color}e.bufferList[i].setAttributes(n)}},e.prototype.setParameters=function(e){var i={};return e&&e.tension&&(i.position=!0),t.prototype.setParameters.call(this,e,i,!1),this},e}(Cf);xc.add("ribbon",_g);var wg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="rocket",this.parameters=Object.assign({localAngle:{type:"integer",max:180,min:0,rebuild:!0},centerDist:{type:"number",precision:1,max:10,min:0,rebuild:!0},ssBorder:{type:"boolean",rebuild:!0},radialSegments:!0,openEnded:!0,disableImpostor:!0},this.parameters),this.helixbundleList=[],this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"sstruc"),i.radius=Eo(i.radius,1.5),i.scale=Eo(i.scale,1),i.openEnded=Eo(i.openEnded,!1),this.localAngle=Eo(i.localAngle,30),this.centerDist=Eo(i.centerDist,2.5),this.ssBorder=Eo(i.ssBorder,!1),t.prototype.init.call(this,i)},e.prototype.createData=function(t){var e=this,i=0,r=[],n=[];this.structure.eachPolymer((function(t){if(!(t.residueCount<4||t.isNucleic())){var o=new Ap(t),a=o.getAxis(e.localAngle,e.centerDist,e.ssBorder,e.getColorParams(),e.radius,e.scale);i+=a.size.length,r.push(a),n.push(o)}}),t.getSelection());var o={begin:new Float32Array(3*i),end:new Float32Array(3*i),size:new Float32Array(i),color:new Float32Array(3*i),picking:new Float32Array(i)},a=0;return r.forEach((function(t){o.begin.set(t.begin,3*a),o.end.set(t.end,3*a),o.size.set(t.size,a),o.color.set(t.color,3*a),o.picking.set(t.picking.array,a),a+=t.size.length})),i&&(o.picking=new $h(o.picking,t.getStructure())),{bufferList:[new qd({position1:o.begin,position2:o.end,color:o.color,color2:o.color,radius:o.size,picking:o.picking},this.getBufferParams({openEnded:this.openEnded,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}))],axisList:r,helixbundleList:n,axisData:o}},e.prototype.updateData=function(t,e){var i=this;if((t=t||{}).position)this.build();else{var r={};if(t.color||t.radius){var n=0;e.helixbundleList.forEach((function(r){var o=r.getAxis(i.localAngle,i.centerDist,i.ssBorder,i.getColorParams(),i.radius,i.scale);t.color&&e.axisData.color.set(o.color,3*n),(t.radius||t.scale)&&e.axisData.size.set(o.size,n),n+=o.size.length})),t.color&&(r.color=e.axisData.color,r.color2=e.axisData.color),(t.radius||t.scale)&&(r.radius=e.axisData.size)}e.bufferList[0].setAttributes(r)}},e}(Cf);xc.add("rocket",wg);var Sg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="rope",this.parameters=Object.assign({smooth:{type:"integer",max:15,min:0,rebuild:!0}},this.parameters,{aspectRatio:null,smoothSheet:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.aspectRatio=1,i.tension=Eo(i.tension,.5),i.scale=Eo(i.scale,5),i.smoothSheet=!1,this.smooth=Eo(i.smooth,2),t.prototype.init.call(this,i)},e.prototype.getSpline=function(t){var e=new Sp(t);return new Hm(t,this.getSplineParams({directional:!1,positionIterator:e.getCenterIterator(this.smooth)}))},e}(Ym);xc.add("rope",Sg);var Ag=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="spacefill",this.parameters=Object.assign({sphereDetail:!0,disableImpostor:!0},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};t.prototype.init.call(this,i)},e.prototype.createData=function(t){return{bufferList:[new Od(t.getAtomData(this.getAtomParams()),this.getBufferParams({sphereDetail:this.sphereDetail,dullInterior:!0,disableImpostor:this.disableImpostor}))]}},e.prototype.updateData=function(t,e){var i=e.sview.getAtomData(this.getAtomParams(t)),r={};t&&!t.position||(r.position=i.position),t&&!t.color||(r.color=i.color),t&&!t.radius||(r.radius=i.radius),e.bufferList[0].setAttributes(r)},e}(Cf);xc.add("spacefill",Ag);var Mg=function(t){function e(e,i){var r=i||{},n=(e||{}).position.length/3-1,o=new Float32Array(3*n*2),a=new Float32Array(3*n*2);t.call(this,{position:o,color:a},r),this.setAttributes(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isLine:{},vertexShader:{},fragmentShader:{}};return e.prototype.setAttributes=function(t){var e,i,r,n,o=this.geometry.attributes;if(t.position&&(e=t.position,r=o.position.array,o.position.needsUpdate=!0),t.color&&(i=t.color,n=o.color.array,o.color.needsUpdate=!0),e||i)for(var a,s,c=this.size-1,u=0;u<c;++u)a=3*u,s=3*u*2,e&&(r[s]=e[a],r[s+1]=e[a+1],r[s+2]=e[a+2],r[s+3]=e[a+3],r[s+4]=e[a+4],r[s+5]=e[a+5]),i&&(n[s]=i[a],n[s+1]=i[a+1],n[s+2]=i[a+2],n[s+3]=i[a+3],n[s+4]=i[a+4],n[s+5]=i[a+5]);else mc.warn("TraceBuffer.prototype.setAttributes no data")},i.isLine.get=function(){return!0},i.vertexShader.get=function(){return"Line.vert"},i.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,i),e}(xd),Pg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="trace",this.parameters=Object.assign({subdiv:{type:"integer",max:50,min:1,rebuild:!0},tension:{type:"number",precision:1,max:1,min:.1},smoothSheet:{type:"boolean",rebuild:!0}},this.parameters,{flatShaded:null,side:null,wireframe:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"chainname"),i.colorScale=Eo(i.colorScale,"RdYlBu"),"low"===i.quality?this.subdiv=3:"medium"===i.quality?this.subdiv=6:"high"===i.quality?this.subdiv=12:this.subdiv=Eo(i.subdiv,6),this.tension=Eo(i.tension,NaN),this.smoothSheet=Eo(i.smoothSheet,!1),t.prototype.init.call(this,i)},e.prototype.getSplineParams=function(t){return Object.assign({subdiv:this.subdiv,tension:this.tension,directional:!1,smoothSheet:this.smoothSheet},t)},e.prototype.createData=function(t){var e=this,i=[],r=[];return this.structure.eachPolymer((function(t){if(!(t.residueCount<4)){r.push(t);var n=new Hm(t,e.getSplineParams()),o=n.getSubdividedPosition(),a=n.getSubdividedColor(e.getColorParams());i.push(new Mg(Object.assign({},o,a),e.getBufferParams()))}}),t.getSelection()),{bufferList:i,polymerList:r}},e.prototype.updateData=function(t,e){t=t||{};var i=0,r=e.polymerList.length;for(i=0;i<r;++i){var n={},o=new Hm(e.polymerList[i],this.getSplineParams());if(t.position){var a=o.getSubdividedPosition();n.position=a.position}if(t.color){var s=o.getSubdividedColor(this.getColorParams());n.color=s.color}e.bufferList[i].setAttributes(n)}},e.prototype.setParameters=function(e){var i={};return e&&e.tension&&(i.position=!0),t.prototype.setParameters.call(this,e,i,!1),this},e}(Cf);xc.add("trace",Pg);var Tg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="tube",this.parameters=Object.assign({},this.parameters,{aspectRatio:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.aspectRatio=1,i.scale=Eo(i.scale,2),"low"===i.quality&&(this.radialSegments=5),t.prototype.init.call(this,i)},e.prototype.getSplineParams=function(){return t.prototype.getSplineParams.call(this,{directional:!1})},e}(Ym);xc.add("tube",Tg);var Eg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="unitcell",this.parameters=Object.assign({radius:{type:"number",precision:3,max:10,min:.001},sphereDetail:!0,radialSegments:!0,disableImpostor:!0},this.parameters,{assembly:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{},r=.5;this.structure.unitcell&&(r=Math.cbrt(this.structure.unitcell.volume)/200),i.radius=Eo(i.radius,r),i.colorValue=Eo(i.colorValue,"orange"),t.prototype.init.call(this,i)},e.prototype.getUnitcellData=function(t){return t.unitcell.getData(t)},e.prototype.create=function(){var t=this.structureView.getStructure();if(t.unitcell){var e=this.getUnitcellData(t);this.sphereBuffer=new Od(e.vertex,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0})),this.cylinderBuffer=new qd(e.edge,this.getBufferParams({openEnded:!0,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bufferList:[this.sphereBuffer,this.cylinderBuffer]})}},e.prototype.updateData=function(t,e){var i=e.sview.getStructure(),r=this.getUnitcellData(i),n={},o={};t&&!t.position||(n.position=r.vertexPosition,o.position1=r.edgePosition1,o.position2=r.edgePosition2),t&&!t.color||(n.color=r.vertexColor,o.color=r.edgeColor,o.color2=r.edgeColor),t&&!t.radius||(n.radius=r.vertexRadius,o.radius=r.edgeRadius),this.sphereBuffer.setAttributes(n),this.cylinderBuffer.setAttributes(o)},e}(Cf);xc.add("unitcell",Eg);var Cg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="validation",this.parameters=Object.assign({},this.parameters,{radiusType:null,radius:null,scale:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorValue=Eo(i.colorValue,"#f0027f"),t.prototype.init.call(this,i)},e.prototype.createData=function(t){if(t.validation){var e=t.validation.getClashData({structure:t,color:this.colorValue});return{bufferList:[new qd(e,this.getBufferParams({openEnded:!1}))]}}},e}(Cf);xc.add("validation",Cg);var Ig=function(t,e){var i=e||{};this.streamer=t,this.name=Eo(i.name,""),this.path=Eo(i.path,"")},Rg={type:{},__objName:{}};function Lg(t){var e,i,r=null,n=null,o=null,a=null,s=null,c=null,u=t.atomStore,h=t.residueStore,l=t.chainStore,p=t.modelStore,d=t.residueMap,f=-1,m=-1,g=-1,v=-1;function y(t){for(var r=h.atomCount[t],n=h.atomOffset[t],o=new Array(r),a=0;a<r;++a)o[a]=u.atomTypeId[n+a];h.residueTypeId[t]=d.add(e,o,i)}this.addAtom=function(t,d,b,x,_,w,S,A){var M=!1,P=!1,T=!1;r!==t?(M=!0,P=!0,T=!0,v+=1,g+=1,m+=1):n!==b?(P=!0,T=!0,g+=1,m+=1):a===_&&o===x&&s===A||(T=!0,m+=1),f+=1,M&&(p.growIfFull(),p.chainOffset[v]=g,p.chainCount[v]=0,p.count+=1,l.modelIndex[g]=v),P&&(l.growIfFull(),l.setChainname(g,d),l.setChainid(g,b),l.residueOffset[g]=m,l.residueCount[g]=0,l.count+=1,l.modelIndex[g]=v,p.chainCount[v]+=1,h.chainIndex[m]=g),T&&(e=o,i=c,m>0&&y(m-1),h.growIfFull(),h.resno[m]=_,void 0!==S&&(h.sstruc[m]=S.charCodeAt(0)),void 0!==A&&(h.inscode[m]=A.charCodeAt(0)),h.atomOffset[m]=f,h.atomCount[m]=0,h.count+=1,h.chainIndex[m]=g,l.residueCount[g]+=1),u.count+=1,u.residueIndex[f]=m,h.atomCount[m]+=1,r=t,n=b,o=x,a=_,s=A,c=w},this.finalize=function(){e=o,i=c,m>-1&&y(m)}}Rg.type.get=function(){return""},Rg.__objName.get=function(){return""},Ig.prototype.parse=function(){var t=this;return this.streamer.read().then((function(){return t._beforeParse(),t._parse(),t._afterParse(),t[t.__objName]}))},Ig.prototype._parse=function(){},Ig.prototype._beforeParse=function(){},Ig.prototype._afterParse=function(){gc&&mc.log(this[this.__objName])},Object.defineProperties(Ig.prototype,Rg);var Og=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.firstModelOnly=Eo(r.firstModelOnly,!1),this.asTrajectory=Eo(r.asTrajectory,!1),this.cAlphaOnly=Eo(r.cAlphaOnly,!1),this.structure=new ld(this.name,this.path),this.structureBuilder=new Lg(this.structure)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"structure"},i.__objName.get=function(){return"structure"},Object.defineProperties(e.prototype,i),e}(Ig);var Ng=function(t,e,i,r,n){this.structure=t,this.index=e,this.description=i||"",this.entityType=function(t){switch(t=t.toLowerCase()){case"polymer":return 1;case"non-polymer":return 2;case"macrolide":return 3;case"water":return 4;default:return 0}}(r||""),this.chainIndexList=n||[],n.forEach((function(i){t.chainStore.entityIndex[i]=e}))},Dg={type:{}};Dg.type.get=function(){return"Entity"},Ng.prototype.getEntityType=function(){return this.entityType},Ng.prototype.isPolymer=function(){return 1===this.entityType},Ng.prototype.isNonPolymer=function(){return 2===this.entityType},Ng.prototype.isMacrolide=function(){return 3===this.entityType},Ng.prototype.isWater=function(){return 4===this.entityType},Ng.prototype.eachChain=function(t){var e=this.structure.getChainProxy();this.chainIndexList.forEach((function(i){e.index=i,t(e)}))},Object.defineProperties(Ng.prototype,Dg);var kg=function(t){var e=t||{};this.a=e.a||1,this.b=e.b||1,this.c=e.c||1,this.alpha=e.alpha||90,this.beta=e.beta||90,this.gamma=e.gamma||90,this.spacegroup=e.spacegroup||"P 1",this.cartToFrac=e.cartToFrac||e.scale,this.fracToCart=new N;var i=Qo(this.alpha),r=Qo(this.beta),n=Qo(this.gamma),o=Math.cos(i),a=Math.cos(r),s=Math.cos(n),c=Math.sin(r),u=Math.sin(n);if(this.volume=this.a*this.b*this.c*Math.sqrt(1-o*o-a*a-s*s+2*o*a*s),void 0===this.cartToFrac){var h=this.a*this.b*u/this.volume,l=(a*s-o)/(c*u);this.fracToCart.set(this.a,0,0,0,this.b*s,this.b*u,0,0,this.c*a,-this.c*c*l,1/h,0,0,0,0,1).transpose(),this.cartToFrac=(new N).getInverse(this.fracToCart)}else this.fracToCart.getInverse(this.cartToFrac)};kg.prototype.getPosition=function(t){var e=new Float32Array(24),i=t.unitcell,r=t.center.clone().applyMatrix4(i.cartToFrac).floor().multiplyScalar(2).addScalar(1),n=new O,o=0;function a(t,a,s){n.set(t,a,s).multiply(r).applyMatrix4(i.fracToCart).toArray(e,o),o+=3}return a(0,0,0),a(1,0,0),a(0,1,0),a(0,0,1),a(1,1,0),a(1,0,1),a(0,1,1),a(1,1,1),e},kg.prototype.getCenter=function(t){return function(t,e){var i=t.length;e=e||new O;for(var r=0;r<i;r+=3)e.x+=t[r],e.y+=t[r+1],e.z+=t[r+2];return e.divideScalar(i/3),e}(this.getPosition(t))},kg.prototype.getData=function(t,e){var i=e||{},r=Eo(i.colorValue,"orange"),n=Eo(i.radius,Math.cbrt(this.volume)/200),o=new St(r),a=new O,s=this.getPosition(t),c=au(8,o.r,o.g,o.b),u=ou(8,n),h=new Float32Array(36),l=new Float32Array(36),p=au(12,o.r,o.g,o.b),d=ou(12,n),f=0;function m(t,e){a.fromArray(s,3*t).toArray(h,f),a.fromArray(s,3*e).toArray(l,f),f+=3}m(0,1),m(0,2),m(0,3),m(1,4),m(1,5),m(2,6),m(3,5),m(4,7),m(5,7),m(2,4),m(7,6),m(3,6);var g=new il(this,t);return{vertex:{position:s,color:c,radius:u,picking:g},edge:{position1:h,position2:l,color:p,color2:p,radius:d,picking:g}}};var Fg={1:"h",2:"h",3:"i",4:"h",5:"g",6:"h",7:"h",8:"h",9:"h",10:"h","":"h"},Bg=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.hex=Eo(r.hex,!1)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"pdb"},e.prototype._parse=function(){gc&&mc.time("PdbParser._parse "+this.name);var t=!1,e=this.streamer.peekLines(1)[0],i=e.substr(62,4),r=e.substr(72,4);i===r&&r.trim()&&(t=!0);var n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,P,T,E,C,I,R,L,O,D,k,F="pqr"===this.type,B=/\s+/,z=this.structure,U=this.structureBuilder,j=this.hex,G=10,V=10,$=this.firstModelOnly,H=this.asTrajectory,W=this.cAlphaOnly,X=z.frames,q=z.boxes,Y=!1,Z=z.biomolDict,K={},Q={},J={},tt=[],et=["MOL_ID","MOLECULE","CHAIN","FRAGMENT","SYNONYM","EC","ENGINEERED","MUTATION","OTHER_DETAILS"],it={},rt={},nt={helices:[],sheets:[]},ot=nt.helices,at=nt.sheets,st=z.atomMap,ct=z.atomStore;ct.resize(Math.round(this.streamer.data.length/80));var ut=z.getAtomProxy(),ht=z.getAtomProxy(),lt=0,pt=0,dt=!0;this.streamer.eachChunkOfLines((function(e){!function(e,i,r){for(var nt=e;nt<i;++nt)if(u=r[nt],"ATOM  "===(h=u.substr(0,6))||"HETATM"===h){if(dt&&(H?(Y?(n=new Float32Array(3*ct.count),X.push(n)):n=[],o=0):$||(K={}),I=(C=1).toString(),R=!0,dt=!1),$&&pt>0)continue;var ft=void 0,mt=void 0,gt=void 0,vt=void 0,yt=void 0;if(F){if(yt=10===(vt=u.split(B)).length?1:0,v=vt[2],W&&"CA"!==v)continue;ft=parseFloat(vt[6-yt]),mt=parseFloat(vt[7-yt]),gt=parseFloat(vt[8-yt])}else{if(v=u.substr(12,4).trim(),W&&"CA"!==v)continue;ft=parseFloat(u.substr(30,8)),mt=parseFloat(u.substr(38,8)),gt=parseFloat(u.substr(46,8))}if(H){var bt=3*o;if(n[bt+0]=ft,n[bt+1]=mt,n[bt+2]=gt,o+=1,Y)continue}var xt=void 0;F?(l=parseInt(vt[1]),xt="",y="H"===u[0]?1:0,p=yt?"":vt[4],d=parseInt(vt[5-yt]),g="",f=vt[3],b=parseFloat(vt[9-yt]),x="",m=0):(l=parseInt(u.substr(6,5),G),j&&99999===l&&(G=16),y="H"===u[0]?1:0,p=u[21].trim(),d=parseInt(u.substr(22,4),V)||1,j&&9999===d&&(V=16),g=u[26].trim(),f=u.substr(17,4).trim()||"MOL",b=parseFloat(u.substr(60,6)),x=u[16].trim(),m=parseFloat(u.substr(54,6)),t||(xt=u.substr(76,2).trim(),p||(p=u.substr(72,4).trim()))),ct.growIfFull(),ct.atomTypeId[lt]=st.add(v,xt),ct.x[lt]=ft,ct.y[lt]=mt,ct.z[lt]=gt,ct.serial[lt]=l,ct.bfactor[lt]=isNaN(b)?0:b,ct.altloc[lt]=x.charCodeAt(0),ct.occupancy[lt]=isNaN(m)?0:m,y?L===p&&D===f&&(Al.includes(f)||O===d&&k===g)||(I=(C+=1).toString(),O=d,D=f,k=g):R||L===p||(I=(C+=1).toString()),U.addAtom(pt,p,I,f,d,y,void 0,g),K[l]=lt,lt+=1,R=!1,L=p}else if("CONECT"===h){var _t=K[parseInt(u.substr(6,5))],wt=[11,16,21,26],St={};if(void 0===_t)continue;for(var At=0;At<4;++At){var Mt=parseInt(u.substr(wt[At],5));if(!Number.isNaN(Mt)&&void 0!==(Mt=K[Mt]))if(_t<Mt?(ut.index=_t,ht.index=Mt):(ut.index=Mt,ht.index=_t),void 0!==St[Mt])z.bondStore.bondOrder[St[Mt]]+=1;else{var Pt=ut.index+"|"+ht.index;void 0===J[Pt]&&(J[Pt]=!0,St[Mt]=z.bondStore.count,z.bondStore.addBond(ut,ht,1))}}}else if("HELIX "===h){_=u[19].trim(),w=parseInt(u.substr(21,4)),S=u[25].trim(),A=u[31].trim(),M=parseInt(u.substr(33,4)),P=u[37].trim();var Tt=parseInt(u.substr(39,1));Tt=(Fg[Tt]||Fg[""]).charCodeAt(0),ot.push([_,w,S,A,M,P,Tt])}else if("SHEET "===h)_=u[21].trim(),w=parseInt(u.substr(22,4)),S=u[26].trim(),A=u[32].trim(),M=parseInt(u.substr(33,4)),P=u[37].trim(),at.push([_,w,S,A,M,P]);else if("HETNAM"===h)rt[u.substr(11,3)]=u.substr(15).trim();else if("COMPND"===h){var Et=u.substr(10,70).trim(),Ct=Et.indexOf(":"),It=Et.substring(0,Ct),Rt=void 0;et.includes(It)?(E=It,Rt=Et.substring(Ct+2)):Rt=Et,Rt=Rt.replace(/;$/,""),"MOL_ID"===E?(T={chainList:[],name:""},tt.push(T)):"MOLECULE"===E?(T.name&&(T.name+=" "),T.name+=Rt):"CHAIN"===E&&Array.prototype.push.apply(T.chainList,Rt.split(/\s*,\s*/))}else if(u.startsWith("TER")){var Lt=z.getChainProxy(z.chainStore.count-1);it[Lt.chainname]=Lt.index,I=(C+=1).toString(),R=!0}else if("REMARK"===h&&"350"===u.substr(7,3)){if("BIOMOLECULE:"===u.substr(11,12)){var Ot=u.substr(23).trim();/^(0|[1-9][0-9]*)$/.test(Ot)&&(Ot="BU"+Ot),a=new Rp(Ot),Z[Ot]=a}else if("BIOMT"===u.substr(13,5)){var Nt=u.split(/\s+/),Dt=parseInt(u[18])-1;0===Dt&&(c=new N,s.matrixList.push(c));var kt=c.elements;kt[0+Dt]=parseFloat(Nt[4]),kt[4+Dt]=parseFloat(Nt[5]),kt[8+Dt]=parseFloat(Nt[6]),kt[12+Dt]=parseFloat(Nt[7])}else if("APPLY THE FOLLOWING TO CHAINS:"===u.substr(11,30)||"                   AND CHAINS:"===u.substr(11,30)){"APPLY"===u.substr(11,5)&&(s=a.addPart());for(var Ft=u.substr(41,30).split(","),Bt=0,zt=Ft.length;Bt<zt;++Bt){var Ut=Ft[Bt].trim();Ut&&s.chainList.push(Ut)}}}else if("HEADER"===h)z.id=u.substr(62,4);else if("TITLE "===h)z.title+=(z.title?" ":"")+u.substr(10,70).trim();else if("MODEL "===h)dt=!0;else if("ENDMDL"===h||u.startsWith("END")){if(dt)continue;H&&!Y&&(X.push(new Float32Array(n)),Y=!0),pt+=1,dt=!0}else if("MTRIX"===u.substr(0,5)){if("1"===u[59])continue;var jt=u.split(/\s+/),Gt=jt[1].trim();if("1"===u[5]&&"1"===Gt){a=new Rp("NCS"),Z.NCS=a,s=a.addPart()}var Vt=parseInt(u[5])-1;0===Vt&&(c=new N,s.matrixList.push(c));var $t=c.elements;$t[0+Vt]=parseFloat(jt[2]),$t[4+Vt]=parseFloat(jt[3]),$t[8+Vt]=parseFloat(jt[4]),$t[12+Vt]=parseFloat(jt[5])}else if("ORIGX"===u.substr(0,5)){Q.origx||(Q.origx=new N);var Ht=u.split(/\s+/),Wt=parseInt(u[5])-1,Xt=Q.origx.elements;Xt[0+Wt]=parseFloat(Ht[1]),Xt[4+Wt]=parseFloat(Ht[2]),Xt[8+Wt]=parseFloat(Ht[3]),Xt[12+Wt]=parseFloat(Ht[4])}else if("SCALE"===u.substr(0,5)){Q.scale||(Q.scale=new N);var qt=u.split(/\s+/),Yt=parseInt(u[5])-1,Zt=Q.scale.elements;Zt[0+Yt]=parseFloat(qt[1]),Zt[4+Yt]=parseFloat(qt[2]),Zt[8+Yt]=parseFloat(qt[3]),Zt[12+Yt]=parseFloat(qt[4])}else if("CRYST1"===h){var Kt=parseFloat(u.substr(6,9)),Qt=parseFloat(u.substr(15,9)),Jt=parseFloat(u.substr(24,9)),te=parseFloat(u.substr(33,7)),ee=parseFloat(u.substr(40,7)),ie=parseFloat(u.substr(47,7)),re=u.substr(55,11).trim(),ne=new Float32Array(9);ne[0]=Kt,ne[4]=Qt,ne[8]=Jt,q.push(ne),0===pt&&(Q.a=Kt,Q.b=Qt,Q.c=Jt,Q.alpha=te,Q.beta=ee,Q.gamma=ie,Q.spacegroup=re)}}(0,e.length,e)}));var ft=tt.length;if(tt.length){z.eachChain((function(t){t.entityIndex=ft})),tt.forEach((function(t,e){var i=t.chainList.map((function(t){return it[t]}));z.entityList.push(new Ng(z,e,t.name,"polymer",i))}));var mt=tt.length,gt=z.getResidueProxy(),vt={};z.eachChain((function(t){t.entityIndex===ft&&(gt.index=t.residueOffset,vt[gt.resname]||(vt[gt.resname]=[]),vt[gt.resname].push(t.index))})),Object.keys(vt).forEach((function(t){var e=vt[t],i="non-polymer",r=rt[t]||t;Al.includes(t)&&(r="water",i="water"),z.entityList.push(new Ng(z,mt,r,i,e)),mt+=1}))}void 0!==Q.a?z.unitcell=new kg(Q):z.unitcell=void 0,(ot.length||at.length)&&Dp(z,nt),U.finalize(),z.finalizeAtoms(),t||Up(z),jp(z),z.finalizeBonds(),ot.length||at.length||zp(z),$p(z),gc&&mc.timeEnd("PdbParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("pdb",Bg),_c.add("pdb1",Bg),_c.add("ent",Bg);var zg=/\s+/,Ug=/'((?:(?!'\s).)*)'|"((?:(?!"\s).)*)"|(\S+)/g,jg=/"/g,Gg=/^['"]+|['"]+$/g;function Vg(t){return!t||t[0]!==t[t.length-1]||"'"!==t[0]&&'"'!==t[0]?t:t.substring(1,t.length-1)}function $g(t,e){Array.isArray(t[e])||Object.keys(t).forEach((function(e){t[e]=[t[e]]}))}function Hg(t){return"?"!==t}function Wg(t,e){return Hg(t)?t:e}function Xg(t){switch(t.toLowerCase()){case"?":case"sing":return 1;case"doub":return 2;case"trip":return 3;case"quad":return 4}return 0}var qg=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"cif"},e.prototype._parse=function(){mc.time("CifParser._parse "+this.name);var t,e,i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_=this.structure,w=this.structureBuilder,S=this.firstModelOnly,A=this.asTrajectory,M=this.cAlphaOnly,P=_.frames,T={},E={},C={},I=!1,R=null,L=!1,D=!1,k=!1,F=[],B=null,z=null,U=null,j=null,G=[],V=_.atomMap,$=_.atomStore;$.resize(this.streamer.data.length/100);var H,W=0,X=0;if(this.streamer.eachChunkOfLines((function(O){!function(O,N,q){for(var Y=O;Y<N;++Y)if(i=q[Y],((r=i.trim())||I||D)&&"#"!==r[0])if("data_"===r.substring(0,5))T.data=r.substring(5).trim();else if(";"===r[0])I?(D?(B===F.length&&(B=0),F[B].push(R),B+=1):!1===U?T[z]=R:T[z][U]=R,I=!1,R=null):(I=!0,R=r.substring(1));else if("loop_"===r)D=!0,k=!0,F.length=0,G.length=0,B=0;else if("_"===r[0]){var Z,K,Q;if(D&&!k&&(D=!1),D)K=(Z=r.split("."))[0].substring(1),Q=Z[1],1===Z.length?(Q=!1,T[K]||(T[K]=[]),F.push(T[K])):(T[K]||(T[K]={}),T[K][Q]?gc&&mc.warn(K,Q,"already exists"):(T[K][Q]=[],F.push(T[K][Q]),G.push(Q))),z=K,U=Q,j=!0;else{var J=r.match(Ug),tt=J[0],et=J[1];K=(Z=tt.split("."))[0].substring(1),Q=Z[1],1===Z.length?(Q=!1,T[K]=et):(T[K]||(T[K]={}),T[K][Q]?gc&&mc.warn(K,Q,"already exists"):T[K][Q]=et),et||(L=!0),z=K,U=Q}}else if(I)R+=i;else if(D){if(!r)continue;if("atom_site"===z){var it=r.split(zg);j&&(n=G.indexOf("auth_asym_id"),o=G.indexOf("auth_seq_id"),a=G.indexOf("label_atom_id"),s=G.indexOf("label_comp_id"),c=G.indexOf("label_asym_id"),u=G.indexOf("label_entity_id"),h=G.indexOf("label_alt_id"),g=G.indexOf("Cartn_x"),v=G.indexOf("Cartn_y"),y=G.indexOf("Cartn_z"),p=G.indexOf("id"),d=G.indexOf("type_symbol"),l=G.indexOf("group_PDB"),b=G.indexOf("B_iso_or_equiv"),f=G.indexOf("pdbx_PDB_model_num"),m=G.indexOf("pdbx_PDB_ins_code"),x=G.indexOf("occupancy"),j=!1,H=parseInt(it[f]),A&&(t=[],e=0));var rt=parseInt(it[f]);if(H!==rt&&(A&&(0===X&&P.push(new Float32Array(t)),t=new Float32Array(3*$.count),P.push(t),e=0),X+=1),H=rt,S&&X>0)continue;var nt=it[a].replace(jg,"");if(M&&"CA"!==nt)continue;var ot=parseFloat(it[g]),at=parseFloat(it[v]),st=parseFloat(it[y]);if(A){var ct=3*e;if(t[ct+0]=ot,t[ct+1]=at,t[ct+2]=st,e+=1,X>0)continue}var ut=it[s],ht=parseInt(it[o]),lt=it[m];lt="?"===lt?"":lt;var pt=it[n],dt=it[c],ft="H"===it[l][0]?1:0,mt=it[d],gt=parseFloat(it[b]),vt=parseFloat(it[x]),yt=it[h];if(yt="."===yt?"":yt,$.growIfFull(),$.atomTypeId[W]=V.add(nt,mt),$.x[W]=ot,$.y[W]=at,$.z[W]=st,$.serial[W]=parseInt(it[p]),$.bfactor[W]=isNaN(gt)?0:gt,$.occupancy[W]=isNaN(vt)?0:vt,$.altloc[W]=yt.charCodeAt(0),w.addAtom(X,pt,dt,ut,ht,ft,void 0,lt),gc){var bt=E[dt];void 0!==bt&&bt!==pt&&gc&&mc.warn(bt,pt)}E[dt]=pt;var xt=it[u];C[xt]||(C[xt]=new Set),C[xt].add(_.chainStore.count-1),W+=1}else{var _t=r.match(Ug),wt=_t.length;B===F.length&&(B=0);for(var St=0;St<wt;++St)F[B+St].push(_t[St]);B+=wt}k=!1}else if("'"===r[0]&&"'"===r[r.length-1]){var At=r.substring(1,r.length-1);!1===U?T[z]=At:T[z][U]=At}else L?!1===U?T[z]=r:T[z][U]=r:gc&&mc.log("CifParser._parse: unknown state",r);else I=!1,D=!1,L=!1,F.length=0,B=null,z=null,U=null,j=null,G.length=0}(0,O.length,O)})),T.chem_comp&&T.chem_comp_atom)!function(t,e,i){var r,n,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(Gg,"")),s.id&&(e.id=s.id.trim().replace(Gg,"")));var h={};if(c){var l,p,d,f;for(n=c.comp_id.length,r=0;r<n;++r)o.growIfFull(),l=c.atom_id[r].replace(jg,""),p=c.type_symbol[r],h[l]=r,o.atomTypeId[r]=a.add(l,p),o.x[r]=c.model_Cartn_x[r],o.y[r]=c.model_Cartn_y[r],o.z[r]=c.model_Cartn_z[r],o.serial[r]=r,d=c.pdbx_component_comp_id[r],f=c.pdbx_residue_numbering?c.pdbx_residue_numbering[r]:1,i.addAtom(0,"","",d,f,1);for(r=0;r<n;++r){var m=r+n;o.growIfFull(),l=c.atom_id[r].replace(jg,""),p=c.type_symbol[r],o.atomTypeId[m]=a.add(l,p),o.x[m]=c.pdbx_model_Cartn_x_ideal[r],o.y[m]=c.pdbx_model_Cartn_y_ideal[r],o.z[m]=c.pdbx_model_Cartn_z_ideal[r],o.serial[m]=m,d=c.pdbx_component_comp_id[r],f=c.pdbx_residue_numbering?c.pdbx_residue_numbering[r]:1,i.addAtom(1,"","",d,f,1)}}if(c&&u){var g,v,y;n=u.comp_id.length;var b=c.comp_id.length,x=e.getAtomProxy(),_=e.getAtomProxy();for(r=0;r<n;++r)g=u.atom_id_1[r].replace(jg,""),v=u.atom_id_2[r].replace(jg,""),y=Xg(u.value_order[r]),x.index=h[g],_.index=h[v],e.bondStore.growIfFull(),e.bondStore.addBond(x,_,y),x.index+=b,_.index+=b,e.bondStore.growIfFull(),e.bondStore.addBond(x,_,y)}}(T,_,w),w.finalize(),_.finalizeAtoms(),_.finalizeBonds(),qp(_);else if(T.atom_site_type_symbol&&T.atom_site_label&&T.atom_site_fract_x)!function(t,e,i){var r=e.atomStore,n=e.atomMap;t.data&&(e.id=t.data,e.name=t.data),e.unitcell=new kg({a:parseFloat(t.cell_length_a),b:parseFloat(t.cell_length_b),c:parseFloat(t.cell_length_c),alpha:parseFloat(t.cell_angle_alpha),beta:parseFloat(t.cell_angle_beta),gamma:parseFloat(t.cell_angle_gamma),spacegroup:Vg(t.symmetry_space_group_name_H)});for(var o=new O,a=new O,s=t.atom_site_type_symbol.length,c=0;c<s;++c){r.growIfFull();var u=t.atom_site_label[c],h=t.atom_site_type_symbol[c];r.atomTypeId[c]=n.add(u,h),o.set(t.atom_site_fract_x[c],t.atom_site_fract_y[c],t.atom_site_fract_z[c]),o.applyMatrix4(e.unitcell.fracToCart),a.add(o),r.x[c]=o.x,r.y[c]=o.y,r.z[c]=o.z,t.atom_site_occupancy&&(r.occupancy[c]=parseFloat(t.atom_site_occupancy[c])),r.serial[c]=c,i.addAtom(0,"","","HET",1,1)}a.divideScalar(s),e.center=a,$p(e);var l=new O,p=new O,d=e.biomolDict.SUPERCELL.partList[0].matrixList,f=s;function m(t){return n.get(r.atomTypeId[t]).covalent}for(var g=new N,v=function(t){var e=m(t);o.set(r.x[t],r.y[t],r.z[t]),d.forEach((function(n){if(!g.equals(n)){l.copy(o),l.applyMatrix4(n);for(var a=0;a<s;++a){p.set(r.x[a],r.y[a],r.z[a]);var c=l.distanceToSquared(p),u=m(a)+e,h=u+.3,d=u-.5;if(c<h*h&&c>d*d)return r.growIfFull(),r.atomTypeId[f]=r.atomTypeId[t],r.x[f]=l.x,r.y[f]=l.y,r.z[f]=l.z,r.occupancy[f]=r.occupancy[t],r.serial[f]=f,r.altloc[f]="A".charCodeAt(0),i.addAtom(0,"","","HET",1,1),void(f+=1)}}}))},y=0;y<s;++y)v(y)}(T,_,w),w.finalize(),_.finalizeAtoms(),jp(_),_.finalizeBonds();else{var q=function(t,e,i){var r,n,o,a,s=[],c=[],u=t.struct_conf;if(u)for($g(u,"id"),r=0,n=u.beg_auth_seq_id.length;r<n;++r){var h=parseInt(u.pdbx_PDB_helix_class[r]);Number.isNaN(h)||(o=u.pdbx_beg_PDB_ins_code[r],a=u.pdbx_end_PDB_ins_code[r],s.push([i[u.beg_label_asym_id[r]],parseInt(u.beg_auth_seq_id[r]),Wg(o,""),i[u.end_label_asym_id[r]],parseInt(u.end_auth_seq_id[r]),Wg(a,""),(Fg[h]||Fg[""]).charCodeAt(0)]))}var l=t.struct_sheet_range;if(l)for($g(l,"id"),r=0,n=l.beg_auth_seq_id.length;r<n;++r)o=l.pdbx_beg_PDB_ins_code[r],a=l.pdbx_end_PDB_ins_code[r],c.push([i[l.beg_label_asym_id[r]],parseInt(l.beg_auth_seq_id[r]),Wg(o,""),i[l.end_label_asym_id[r]],parseInt(l.end_auth_seq_id[r]),Wg(a,"")]);return!(!u&&!l)&&{helices:s,sheets:c}}(T,0,E);if(function(t,e,i){var r={},n=e.biomolDict;if(t.pdbx_struct_oper_list){var o=t.pdbx_struct_oper_list;$g(o,"id"),o.id.forEach((function(t,e){var i=new N,n=i.elements;n[0]=parseFloat(o["matrix[1][1]"][e]),n[1]=parseFloat(o["matrix[1][2]"][e]),n[2]=parseFloat(o["matrix[1][3]"][e]),n[4]=parseFloat(o["matrix[2][1]"][e]),n[5]=parseFloat(o["matrix[2][2]"][e]),n[6]=parseFloat(o["matrix[2][3]"][e]),n[8]=parseFloat(o["matrix[3][1]"][e]),n[9]=parseFloat(o["matrix[3][2]"][e]),n[10]=parseFloat(o["matrix[3][3]"][e]),n[3]=parseFloat(o["vector[1]"][e]),n[7]=parseFloat(o["vector[2]"][e]),n[11]=parseFloat(o["vector[3]"][e]),i.transpose(),r[t]=i}))}if(t.pdbx_struct_assembly_gen){var a=t.pdbx_struct_assembly_gen;$g(a,"assembly_id");var s=function(t){var e={};return t.replace(/[()']/g,"").split(",").forEach((function(t){if(t.includes("-"))for(var i=t.split("-"),n=parseInt(i[0]),o=parseInt(i[1]);n<=o;++n)e[n]=r[n];else e[t]=r[t]})),e};a.assembly_id.forEach((function(t,e){var r={},o=a.oper_expression[e].replace(/['"]\(|['"]/g,"");if(o.includes(")(")||o.indexOf("(")>0){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 N;i.multiplyMatrices(c[t],u[e]),r[t+"x"+e]=i}))}))}else r=s(o);var h=[];for(var l in r)h.push(r[l]);var p=t;/^(0|[1-9][0-9]*)$/.test(p)&&(p="BU"+p);for(var d=a.asym_id_list[e].split(","),f=0,m=d.length;f<m;++f)d[f]=i[d[f]];void 0===n[p]&&(n[p]=new Rp(p)),n[p].addPart(h,d)}))}if(t.struct_ncs_oper){var c=t.struct_ncs_oper;$g(c,"id");n.NCS=new Rp("NCS");var u=n.NCS.addPart();c.id.forEach((function(t,e){if("given"!==c.code[e]){var i=new N,r=i.elements;r[0]=parseFloat(c["matrix[1][1]"][e]),r[1]=parseFloat(c["matrix[1][2]"][e]),r[2]=parseFloat(c["matrix[1][3]"][e]),r[4]=parseFloat(c["matrix[2][1]"][e]),r[5]=parseFloat(c["matrix[2][2]"][e]),r[6]=parseFloat(c["matrix[2][3]"][e]),r[8]=parseFloat(c["matrix[3][1]"][e]),r[9]=parseFloat(c["matrix[3][2]"][e]),r[10]=parseFloat(c["matrix[3][3]"][e]),r[3]=parseFloat(c["vector[1]"][e]),r[7]=parseFloat(c["vector[2]"][e]),r[11]=parseFloat(c["vector[3]"][e]),i.transpose(),u.matrixList.push(i)}})),0===u.matrixList.length&&delete n.NCS}var h={};if(t.cell){var l=t.cell,p=parseFloat(l.length_a),d=parseFloat(l.length_b),f=parseFloat(l.length_c),m=new Float32Array(9);m[0]=p,m[4]=d,m[8]=f,e.boxes.push(m),h.a=p,h.b=d,h.c=f,h.alpha=parseFloat(l.angle_alpha),h.beta=parseFloat(l.angle_beta),h.gamma=parseFloat(l.angle_gamma)}t.symmetry&&(h.spacegroup=Vg(t.symmetry["space_group_name_H-M"]));var g=new N;if(t.database_PDB_matrix){var v=t.database_PDB_matrix,y=g.elements;y[0]=parseFloat(v["origx[1][1]"]),y[1]=parseFloat(v["origx[1][2]"]),y[2]=parseFloat(v["origx[1][3]"]),y[4]=parseFloat(v["origx[2][1]"]),y[5]=parseFloat(v["origx[2][2]"]),y[6]=parseFloat(v["origx[2][3]"]),y[8]=parseFloat(v["origx[3][1]"]),y[9]=parseFloat(v["origx[3][2]"]),y[10]=parseFloat(v["origx[3][3]"]),y[3]=parseFloat(v["origx_vector[1]"]),y[7]=parseFloat(v["origx_vector[2]"]),y[11]=parseFloat(v["origx_vector[3]"]),g.transpose(),h.origx=g}var b=new N;if(t.atom_sites){var x=t.atom_sites,_=b.elements;_[0]=parseFloat(x["fract_transf_matrix[1][1]"]),_[1]=parseFloat(x["fract_transf_matrix[1][2]"]),_[2]=parseFloat(x["fract_transf_matrix[1][3]"]),_[4]=parseFloat(x["fract_transf_matrix[2][1]"]),_[5]=parseFloat(x["fract_transf_matrix[2][2]"]),_[6]=parseFloat(x["fract_transf_matrix[2][3]"]),_[8]=parseFloat(x["fract_transf_matrix[3][1]"]),_[9]=parseFloat(x["fract_transf_matrix[3][2]"]),_[10]=parseFloat(x["fract_transf_matrix[3][3]"]),_[3]=parseFloat(x["fract_transf_vector[1]"]),_[7]=parseFloat(x["fract_transf_vector[2]"]),_[11]=parseFloat(x["fract_transf_vector[3]"]),b.transpose(),h.scale=b}void 0!==h.a?e.unitcell=new kg(h):e.unitcell=void 0}(T,_,E),function(t,e,i){var r=t.struct_conn;if(r){$g(r,"id");for(var n=/"/g,o=e.getAtomProxy(),a=e.getAtomProxy(),s={},c=0,u=r.id.length;c<u;++c){var h=r.conn_type_id[c];if("hydrog"!==h&&"mismat"!==h&&"saltbr"!==h&&("1_555"===r.ptnr1_symmetry[c]&&"1_555"===r.ptnr2_symmetry[c])){var l=r.pdbx_ptnr1_PDB_ins_code[c],p=r.pdbx_ptnr1_label_alt_id[c],d=r.ptnr1_auth_seq_id[c]+(Hg(l)?"^"+l:"")+":"+i[r.ptnr1_label_asym_id[c]]+"."+r.ptnr1_label_atom_id[c].replace(n,"")+(Hg(p)?"%"+p:""),f=s[d];if(!f){var m=new nc(d);if(m.selection.error){gc&&mc.warn("invalid selection for connection",d);continue}f=e.getAtomIndices(m),s[d]=f}var g=r.pdbx_ptnr2_PDB_ins_code[c],v=r.pdbx_ptnr2_label_alt_id[c],y=r.ptnr2_auth_seq_id[c]+(Hg(g)?"^"+g:"")+":"+i[r.ptnr2_label_asym_id[c]]+"."+r.ptnr2_label_atom_id[c].replace(n,"")+(Hg(v)?"%"+v:""),b=s[y];if(!b){var x=new nc(y);if(x.selection.error){gc&&mc.warn("invalid selection for connection",y);continue}b=e.getAtomIndices(x),s[y]=b}var _=f.length,w=b.length;if(_>w){var S=_;_=w,w=S;var A=f;f=b,b=A}if(0!==_&&0!==w)for(var M=0;M<w;++M)o.index=f[M%_],a.index=b[M],o&&a?e.bondStore.addBond(o,a,Xg(r.pdbx_value_order[c])):mc.log("atoms for connection not found");else gc&&mc.warn("no atoms found for",d,y)}}}}(T,_,E),function(t,e,i){if(t.entity){$g(t.entity,"id");for(var r=t.entity,n=r.id.length,o=0;o<n;++o){var a=r.pdbx_description[o],s=r.type[o],c=Array.from(i[r.id[o]]);e.entityList[o]=new Ng(e,o,a,s,c)}}}(T,_,C),T.struct&&T.struct.title&&(_.title=T.struct.title.trim().replace(Gg,"")),T.entry&&T.entry.id&&(_.id=T.entry.id.trim().replace(Gg,"")),T.database_PDB_rev){if(T.database_PDB_rev.date){$g(T.database_PDB_rev,"date");var Y=T.database_PDB_rev.date.filter(Hg);Y.length&&(_.header.releaseDate=Y[Y.length-1])}if(T.database_PDB_rev.date_original){$g(T.database_PDB_rev,"date_original");var Z=T.database_PDB_rev.date_original.filter(Hg);Z.length&&(_.header.depositionDate=Z[Z.length-1])}}T.reflns&&T.reflns.d_resolution_high?Hg(T.reflns.d_resolution_high)&&(_.header.resolution=parseFloat(T.reflns.d_resolution_high)):T.refine&&T.refine.ls_d_res_high&&Hg(T.refine.ls_d_res_high)&&(_.header.resolution=parseFloat(T.refine.ls_d_res_high)),T.refine&&T.refine.ls_R_factor_R_free&&Hg(T.refine.ls_R_factor_R_free)&&(_.header.rFree=parseFloat(T.refine.ls_R_factor_R_free)),T.refine&&T.refine.ls_R_factor_R_work&&Hg(T.refine.ls_R_factor_R_work)&&(_.header.rWork=parseFloat(T.refine.ls_R_factor_R_work)),T.exptl&&T.exptl.method&&($g(T.exptl,"method"),_.header.experimentalMethods=T.exptl.method.map((function(t){return t.replace(Gg,"")}))),w.finalize(),_.finalizeAtoms(),jp(_),_.finalizeBonds(),q?Dp(_,q):zp(_),$p(_),_.extraData.cif=T}gc&&mc.timeEnd("CifParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("cif",qg),_c.add("mcif",qg),_c.add("mmcif",qg);var Yg=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"gro"},e.prototype._parse=function(){gc&&mc.time("GroParser._parse "+this.name);var t,e,i=this.structure,r=this.structureBuilder,n=this.firstModelOnly,o=this.asTrajectory,a=this.cAlphaOnly,s=i.frames,c=i.boxes,u=this.streamer.peekLines(3);i.title=u[0].trim();var h,l,p,d,f=5+(u[2].length-u[2].lastIndexOf(".")-1),m=20+f,g=20+2*f,v=parseInt(u[1]),y=v+3,b=i.atomMap,x=i.atomStore;x.resize(v);var _=0,w=0,S=0;this.streamer.eachChunkOfLines((function(i){!function(i,u,A){for(var M=i;M<u;++M){var P=++S-1,T=A[M];if(T)if(P%y==0)o&&(t=new Float32Array(3*v),s.push(t),e=0);else if(P%y==1);else if(P%y==y-1){var E=T.trim().split(/\s+/),C=new Float32Array(9);if(C[0]=10*parseFloat(E[0]),C[4]=10*parseFloat(E[1]),C[8]=10*parseFloat(E[2]),c.push(C),n)return!0;w+=1}else{if(h=T.substr(10,5).trim(),a&&"CA"!==h)continue;var I=10*parseFloat(T.substr(20,f)),R=10*parseFloat(T.substr(m,f)),L=10*parseFloat(T.substr(g,f));if(o){var O=3*e;if(t[O+0]=I,t[O+1]=R,t[O+2]=L,e+=1,P>y)continue}l=T.substr(5,5).trim(),p=parseInt(T.substr(0,5)),d=parseInt(T.substr(15,5)),x.growIfFull(),x.atomTypeId[_]=b.add(h),x.x[_]=I,x.y[_]=R,x.z[_]=L,x.serial[_]=d,r.addAtom(w,"","",l,p,0,"l"),_+=1}}}(0,i.length,i)})),r.finalize(),i.finalizeAtoms(),Up(i),jp(i),i.finalizeBonds(),zp(i),gc&&mc.timeEnd("GroParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("gro",Yg);var Zg=["mmtfVersion","mmtfProducer","unitCell","spaceGroup","structureId","title","depositionDate","releaseDate","experimentalMethods","resolution","rFree","rWork","bioAssemblyList","ncsOperatorList","entityList","groupList","numBonds","numAtoms","numGroups","numChains","numModels","groupsPerChain","chainsPerModel"].concat(["xCoordList","yCoordList","zCoordList","groupIdList","groupTypeList","chainIdList","bFactorList","atomIdList","altLocList","occupancyList","secStructList","insCodeList","sequenceIndexList","chainNameList","bondAtomList","bondOrderList"]);function Kg(t,e,i){return e?new t(e.buffer,e.byteOffset,e.byteLength/(i||1)):void 0}function Qg(t){return Kg(DataView,t)}function Jg(t){return Kg(Int8Array,t)}function tv(t){return Kg(Int32Array,t,4)}function ev(t,e){var i=t.length/2;e||(e=new Int16Array(i));for(var r=0,n=0;r<i;++r,n+=2)e[r]=t[n]<<8^t[n+1]<<0;return e}function iv(t,e){var i=t.length/4;e||(e=new Int32Array(i));for(var r=0,n=0;r<i;++r,n+=4)e[r]=t[n]<<24^t[n+1]<<16^t[n+2]<<8^t[n+3]<<0;return e}function rv(t,e,i){var r=t.length,n=1/e;i||(i=new Float32Array(r));for(var o=0;o<r;++o)i[o]=t[o]*n;return i}function nv(t,e){var i,r;if(!e){var n=0;for(i=0,r=t.length;i<r;i+=2)n+=t[i+1];e=new t.constructor(n)}var o=0;for(i=0,r=t.length;i<r;i+=2)for(var a=t[i],s=t[i+1],c=0;c<s;++c)e[o]=a,++o;return e}function ov(t,e){var i=t.length;e||(e=new t.constructor(i)),i&&(e[0]=t[0]);for(var r=1;r<i;++r)e[r]=t[r]+e[r-1];return e}function av(t,e){var i,r,n=t instanceof Int8Array?127:32767,o=-n-1,a=t.length;if(!e){var s=0;for(i=0;i<a;++i)t[i]<n&&t[i]>o&&++s;e=new Int32Array(s)}for(i=0,r=0;i<a;){for(var c=0;t[i]===n||t[i]===o;)c+=t[i],++i;c+=t[i],++i,e[r]=c,++r}return e}function sv(t,e,i){return rv(av(t,tv(i)),e,i)}function cv(t,e,i){var r=av(t,tv(i));return function(t,e,i){return rv(ov(t,tv(i)),e,i)}(r,e,Kg(Float32Array,r,4))}function uv(t,e,i,r){switch(t){case 1:return function(t,e){var i=t.length;e||(e=new Float32Array(i/4));for(var r=Qg(e),n=Qg(t),o=0,a=0,s=i/4;o<s;++o,a+=4)r.setFloat32(a,n.getFloat32(a),!0);return e}(e);case 2:return Jg(e);case 3:return ev(e);case 4:return iv(e);case 5:return Kg(Uint8Array,e);case 6:return nv(iv(e),new Uint8Array(i));case 7:return nv(iv(e));case 8:return ov(nv(iv(e)),n);case 9:return function(t,e,i){return rv(nv(t,tv(i)),e,i)}(iv(e),iv(r)[0]);case 10:return cv(ev(e),iv(r)[0]);case 11:return rv(ev(e),iv(r)[0]);case 12:return sv(ev(e),iv(r)[0]);case 13:return sv(Jg(e),iv(r)[0]);case 14:return av(ev(e));case 15:return av(Jg(e))}var n}function hv(t,e){var i=(e=e||{}).ignoreFields,r={};return Zg.forEach((function(e){var n=!!i&&-1!==i.indexOf(e),o=t[e];n||void 0===o||(o instanceof Uint8Array?r[e]=uv.apply(null,function(t){var e=Qg(t),i=e.getInt32(0),r=e.getInt32(4),n=t.subarray(8,12);return[i,t=t.subarray(12),r,n]}(o)):r[e]=o)})),r}var lv={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)},pv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"mmtf"},e.prototype._parse=function(){var t,e,i,r,n;gc&&mc.time("MmtfParser._parse "+this.name);var o,a,s,c,u,h,l=this.structure,p=hv(function(t){var e=0,i=new DataView(t.buffer);function r(t){for(var e={},i=0;i<t;i++){e[s()]=s()}return e}function n(i){var r=t.subarray(e,e+i);return e+=i,r}function o(i){var r=t.subarray(e,e+i);e+=i;if(i>65535){for(var n=[],o=0;o<r.length;o+=65535)n.push(String.fromCharCode.apply(null,r.subarray(o,o+65535)));return n.join("")}return String.fromCharCode.apply(null,r)}function a(t){for(var e=new Array(t),i=0;i<t;i++)e[i]=s();return e}function s(){var s,c,u=t[e];if(0==(128&u))return e++,u;if(128==(240&u))return e++,r(c=15&u);if(144==(240&u))return e++,a(c=15&u);if(160==(224&u))return e++,o(c=31&u);if(224==(224&u))return s=i.getInt8(e),e++,s;switch(u){case 192:return e++,null;case 194:return e++,!1;case 195:return e++,!0;case 196:return c=i.getUint8(e+1),e+=2,n(c);case 197:return c=i.getUint16(e+1),e+=3,n(c);case 198:return c=i.getUint32(e+1),e+=5,n(c);case 202:return s=i.getFloat32(e+1),e+=5,s;case 203:return s=i.getFloat64(e+1),e+=9,s;case 204:return s=t[e+1],e+=2,s;case 205:return s=i.getUint16(e+1),e+=3,s;case 206:return s=i.getUint32(e+1),e+=5,s;case 208:return s=i.getInt8(e+1),e+=2,s;case 209:return s=i.getInt16(e+1),e+=3,s;case 210:return s=i.getInt32(e+1),e+=5,s;case 217:return c=i.getUint8(e+1),e+=2,o(c);case 218:return c=i.getUint16(e+1),e+=3,o(c);case 219:return c=i.getUint32(e+1),e+=5,o(c);case 220:return c=i.getUint16(e+1),e+=3,a(c);case 221:return c=i.getUint32(e+1),e+=5,a(c);case 222:return c=i.getUint16(e+1),e+=3,r(c);case 223:return c=i.getUint32(e+1),e+=5,r(c)}throw new Error("Unknown type 0x"+u.toString(16))}return s()}(this.streamer.data));if(["depositionDate","releaseDate","resolution","rFree","rWork","experimentalMethods"].forEach((function(t){void 0!==p[t]&&(l.header[t]=p[t])})),l.id=p.structureId,l.title=p.title,this.firstModelOnly||this.asTrajectory){for(u=1,s=0,t=0,e=c=p.chainsPerModel[0];t<e;++t)s+=p.groupsPerChain[t];for(a=0,t=0,e=s;t<e;++t)a+=(n=p.groupList[p.groupTypeList[t]]).atomNameList.length;o=p.numBonds,h=[c]}else o=p.numBonds,a=p.numAtoms,s=p.numGroups,c=p.numChains,u=p.numModels,h=p.chainsPerModel;if(o+=s,this.asTrajectory)for(t=0,e=p.numModels;t<e;++t){var d=new Float32Array(3*a),f=a*t;for(i=0;i<a;++i){var m=3*i,g=i+f;d[m]=p.xCoordList[g],d[m+1]=p.yCoordList[g],d[m+2]=p.zCoordList[g]}l.frames.push(d)}var v=new Uint32Array(o),y=new Uint32Array(o),b=new Uint8Array(o),x=new Uint32Array(a),_=new Uint32Array(s),w=new Uint32Array(s),S=new Uint16Array(s),A=new Uint16Array(c),M=new Uint32Array(c),P=new Uint32Array(c),T=new Uint32Array(u),E=new Uint32Array(u),C=0;for(t=0,e=u;t<e;++t){var I=h[t];for(T[t]=C,E[t]=I,i=0;i<I;++i)A[i+C]=t;C+=I}var R=p.groupsPerChain,L=0;for(t=0,e=c;t<e;++t){var O=R[t];for(M[t]=L,P[t]=O,i=0;i<O;++i)_[i+L]=t;L+=O}var D=0,k=0;for(t=0,e=s;t<e;++t){var F=(n=p.groupList[p.groupTypeList[t]]).atomNameList.length,B=n.bondAtomList,z=n.bondOrderList;for(i=0,r=z.length;i<r;++i)v[k]=D+B[2*i],y[k]=D+B[2*i+1],b[k]=z[i],k+=1;for(w[t]=D,S[t]=F,i=0;i<F;++i)x[D]=t,D+=1}var U=p.bondAtomList;if(U)for(p.bondOrderList&&b.set(p.bondOrderList,k),t=0,e=U.length;t<e;t+=2){var j=U[t],G=U[t+1];j<a&&G<a&&(v[k]=j,y[k]=G,k+=1)}l.bondStore.length=b.length,l.bondStore.count=k,l.bondStore.atomIndex1=v,l.bondStore.atomIndex2=y,l.bondStore.bondOrder=b,l.atomStore.length=a,l.atomStore.count=a,l.atomStore.residueIndex=x,l.atomStore.atomTypeId=new Uint16Array(a),l.atomStore.x=p.xCoordList.subarray(0,a),l.atomStore.y=p.yCoordList.subarray(0,a),l.atomStore.z=p.zCoordList.subarray(0,a),l.atomStore.serial=p.atomIdList.subarray(0,a),l.atomStore.bfactor=p.bFactorList.subarray(0,a),l.atomStore.altloc=p.altLocList.subarray(0,a),l.atomStore.occupancy=p.occupancyList.subarray(0,a),l.residueStore.length=s,l.residueStore.count=s,l.residueStore.chainIndex=_,l.residueStore.residueTypeId=p.groupTypeList,l.residueStore.atomOffset=w,l.residueStore.atomCount=S,l.residueStore.resno=p.groupIdList.subarray(0,s),l.residueStore.sstruc=p.secStructList.subarray(0,s),l.residueStore.inscode=p.insCodeList.subarray(0,s),l.chainStore.length=c,l.chainStore.count=c,l.chainStore.entityIndex=new Uint16Array(c),l.chainStore.modelIndex=A,l.chainStore.residueOffset=M,l.chainStore.residueCount=P,l.chainStore.chainname=p.chainNameList.subarray(0,4*c),l.chainStore.chainid=p.chainIdList.subarray(0,4*c),l.modelStore.length=u,l.modelStore.count=u,l.modelStore.chainOffset=T,l.modelStore.chainCount=E;var V={};for(t=0,e=p.groupList.length;t<e;++t){var $=p.groupList[t],H=[];for(i=0,r=$.atomNameList.length;i<r;++i){var W=$.elementList[i].toUpperCase(),X=$.atomNameList[i];H.push(l.atomMap.add(X,W))}var q=$.chemCompType.toUpperCase(),Y=ll.includes(q),Z=$.bondOrderList.length,K=new Array(Z),Q=new Array(Z);for(i=0;i<Z;++i)K[i]=$.bondAtomList[2*i],Q[i]=$.bondAtomList[2*i+1];var J={atomIndices1:K,atomIndices2:Q,bondOrders:$.bondOrderList};V[t]=l.residueMap.add($.groupName,H,Y,q,J)}for(t=0,e=s;t<e;++t)l.residueStore.residueTypeId[t]=V[l.residueStore.residueTypeId[t]];for(t=0,e=l.atomStore.count;t<e;++t){var tt=l.atomStore.residueIndex[t],et=l.residueMap.list[l.residueStore.residueTypeId[tt]],it=l.residueStore.atomOffset[tt];l.atomStore.atomTypeId[t]=et.atomTypeIdList[t-it]}if(p.secStructList){var rt=p.secStructList.length;for(t=0,e=l.residueStore.count;t<e;++t){var nt=lv[l.residueStore.sstruc[t%rt]];void 0!==nt&&(l.residueStore.sstruc[t]=nt)}}if(p.entityList&&p.entityList.forEach((function(t,e){l.entityList[e]=new Ng(l,e,t.description,t.type,t.chainIndexList)})),p.bioAssemblyList&&p.bioAssemblyList.forEach((function(t,e){var i=e+1,r=new Rp(i);l.biomolDict["BU"+i]=r;var n={};t.transformList.forEach((function(t){var e=(new N).fromArray(t.matrix).transpose(),i=t.chainIndexList.map((function(t){for(var e="",i=0;i<4;++i){var r=p.chainNameList[4*t+i];if(!r)break;e+=String.fromCharCode(r)}return e})),o=n[i];o?o.matrixList.push(e):n[i]=r.addPart([e],i)}))})),p.ncsOperatorList){var ot=new Rp("NCS"),at=ot.addPart();p.ncsOperatorList.forEach((function(t){var e=(new N).fromArray(t).transpose();at.matrixList.push(e)})),at.matrixList.length>0&&(l.biomolDict.NCS=ot)}var st=p.unitCell;st&&Array.isArray(st)&&st[0]?l.unitcell=new kg({a:st[0],b:st[1],c:st[2],alpha:st[3],beta:st[4],gamma:st[5],spacegroup:p.spaceGroup}):l.unitcell=void 0,Vp(l,!0),Gp(l,!0),l.finalizeAtoms(),l.finalizeBonds(),$p(l),gc&&mc.timeEnd("MmtfParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("mmtf",pv);var dv=/\s+/,fv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"mol2"},e.prototype._parse=function(){gc&&mc.time("Mol2Parser._parse "+this.name);var t,e,i=this.structure,r=this.structureBuilder,n=this.firstModelOnly,o=this.asTrajectory,a=i.frames,s=!1,c=i.atomMap,u=i.atomStore;u.resize(Math.round(this.streamer.data.length/60));var h=0,l=0,p=0,d=-1,f=0,m=0,g=i.getAtomProxy(),v=i.getAtomProxy(),y={1:1,2:2,3:3,am:1,ar:1,du:1,un:1,nc:0};this.streamer.eachChunkOfLines((function(b){!function(b,x,_){for(var w,S=b;S<x;++S){var A=_[S].trim();if(""!==A&&"#"!==A[0])if("@"===A[0])"@<TRIPOS>MOLECULE"===A?(m=1,l=0,++d):"@<TRIPOS>ATOM"===A?(m=2,p=u.count,o&&(e=0,t=new Float32Array(3*f),a.push(t),d>0&&(s=!0))):m="@<TRIPOS>BOND"===A?3:0;else if(1===m)0===l?(i.title=A,i.id=A):1===l&&(w=A.split(dv),f=parseInt(w[0])),++l;else if(2===m){if(w=A.split(dv),n&&d>0)continue;var M=parseFloat(w[2]),P=parseFloat(w[3]),T=parseFloat(w[4]);if(o){var E=3*e;if(t[E+0]=M,t[E+1]=P,t[E+2]=T,e+=1,s)continue}var C=w[0],I=w[1],R=w[5].split(".")[0],L=w[6]?parseInt(w[6]):1,O=w[7]?w[7]:"",N=w[8]?parseFloat(w[8]):0;u.growIfFull(),u.atomTypeId[h]=c.add(I,R),u.x[h]=M,u.y[h]=P,u.z[h]=T,u.serial[h]=C,u.bfactor[h]=N,r.addAtom(d,"","",O,L,1),h+=1}else if(3===m){if(n&&d>0)continue;if(o&&d>0)continue;w=A.split(dv),g.index=parseInt(w[1])-1+p,v.index=parseInt(w[2])-1+p;var D=y[w[3]];i.bondStore.addBond(g,v,D)}}}(0,b.length,b)})),r.finalize(),i.finalizeAtoms(),Up(i),Gp(i,!0),Vp(i,!0),i.finalizeBonds(),qp(i),zp(i),gc&&mc.timeEnd("Mol2Parser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("mol2",fv);var mv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"pqr"},Object.defineProperties(e.prototype,i),e}(Bg);_c.add("pqr",mv);var gv=/\s+/,vv=/(^\*|REMARK)*/,yv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"psf"},e.prototype._parse=function(){gc&&mc.time("PsfParser._parse "+this.name);var t,e,i,r,n=this.structure,o=this.structureBuilder,a=n.atomMap,s=n.atomStore,c=[],u=0,h=0;this.streamer.eachChunkOfLines((function(n){!function(n,l,p){for(var d=n;d<l;++d){var f=p[d].trim();if(f)if(2===t){var m=f.split(gv),g=parseInt(m[0]),v=parseInt(m[2]),y=m[3],b=m[4];s.growIfFull(),s.atomTypeId[u]=a.add(b),s.serial[u]=g,o.addAtom(0,"","",y,v,1),u+=1}else if(3===t)for(var x=f.split(gv),_=0,w=x.length;_<w;_+=2)e[h]=parseInt(x[_])-1,i[h]=parseInt(x[_+1])-1,r[h]=1,h+=1;else if(1===t)c.push(f.replace(vv,"").trim());else if(4===t);else if(5===t);else if(6===t);else if(f.includes("!NATOM")){t=2;var S=parseInt(f.split(gv)[0]);s.resize(S)}else if(f.includes("!NBOND")){t=3;var A=parseInt(f.split(gv)[0]);e=new Uint32Array(A),i=new Uint32Array(A),r=new Uint8Array(A)}else f.includes("!NTITLE")?t=1:f.includes("!NTHETA")?t=4:f.includes("!NPHI")?t=5:f.includes("!NIMPHI")&&(t=6);else t=void 0}}(0,n.length,n)})),n.title=c.join(" "),n.bondStore.length=r.length,n.bondStore.count=h,n.bondStore.atomIndex1=e,n.bondStore.atomIndex2=i,n.bondStore.bondOrder=r,o.finalize(),n.finalizeAtoms(),Up(n),n.finalizeBonds(),qp(n),gc&&mc.timeEnd("PsfParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("psf",yv);var bv=/> <(.+)>/,xv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"sdf"},e.prototype._parse=function(){gc&&mc.time("SdfParser._parse "+this.name);var t=this.structure,e=this.structureBuilder,i=this.firstModelOnly,r=this.asTrajectory,n=this.streamer.peekLines(2);t.id=n[0].trim(),t.title=n[1].trim();var o,a,s=t.frames,c=!1,u=t.atomMap,h=t.atomStore;h.resize(Math.round(this.streamer.data.length/50));var l,p,d,f,m,g,v,y=t.getAtomProxy(),b=t.getAtomProxy(),x=0,_=0,w=0,S=0,A=[],M=!1,P={};t.extraData.sdf=A,this.streamer.eachChunkOfLines((function(n){!function(n,T,E){for(var C=n;C<T;++C){var I=E[C];if("$$$$"===I.substr(0,4))_=-1,++w,S=h.count,A.push(P),P={},M=!1;else if(3===_)p=parseInt(I.substr(0,3)),d=parseInt(I.substr(3,3)),v=(g=m=(f=4)+p)+d,r&&(a=0,o=new Float32Array(3*p),s.push(o),w>0&&(c=!0));else if(_>=f&&_<m){if(i&&w>0)continue;var R=parseFloat(I.substr(0,10)),L=parseFloat(I.substr(10,10)),O=parseFloat(I.substr(20,10));if(r){var N=3*a;if(o[N+0]=R,o[N+1]=L,o[N+2]=O,a+=1,c)continue}var D=I.substr(31,3).trim(),k=D+(x+1);h.growIfFull(),h.atomTypeId[x]=u.add(k,D),h.x[x]=R,h.y[x]=L,h.z[x]=O,h.serial[x]=x,e.addAtom(w,"","","HET",1,1),x+=1}else if(_>=g&&_<v){if(i&&w>0)continue;if(r&&w>0)continue;y.index=parseInt(I.substr(0,3))-1+S,b.index=parseInt(I.substr(3,3))-1+S;var F=parseInt(I.substr(6,3));t.bondStore.addBond(y,b,F)}else(l=I.match(bv))?(M=l[1],P[M]=[]):!1!==M&&I&&P[M].push(I);++_}}(0,n.length,n)})),e.finalize(),t.finalizeAtoms(),t.finalizeBonds(),qp(t),gc&&mc.timeEnd("SdfParser._parse "+this.name)},e.prototype._postProcess=function(){qp(this.structure)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("sdf",xv),_c.add("sd",xv);var _v=function(t,e){this.name=t,this.path=e,this.coordinates=[],this.boxes=[]},wv={type:{}};wv.type.get=function(){return"Frames"},Object.defineProperties(_v.prototype,wv);var Sv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"dcd"},e.prototype._parse=function(){gc&&mc.time("DcdParser._parse "+this.name);var t=this.streamer.data;t instanceof Uint8Array&&(t=t.buffer);var e,i,r=new DataView(t),n=this.frames,o=n.coordinates,a=n.boxes,s={},c=0,u=new Int32Array(t,0,23),h=u[0]!==r.getInt32(0);if(84!==u[0])for(i=t.byteLength,e=0;e<i;e+=4)r.setFloat32(e,r.getFloat32(e),!0);84!==u[0]&&mc.error("dcd bad format, header block start"),"CORD"!==String.fromCharCode(r.getUint8(4),r.getUint8(5),r.getUint8(6),r.getUint8(7))&&mc.error("dcd bad format, format string");var l=!1,p=!1,d=!1;0!==u[22]&&(l=!0,0!==u[12]&&(p=!0),1===u[13]&&(d=!0)),s.NSET=u[2],s.ISTART=u[3],s.NSAVC=u[4],s.NAMNF=u[10],s.DELTA=l?r.getFloat32(44,h):r.getFloat64(44,h),84!==u[22]&&mc.error("dcd bad format, header block end"),c=c+84+8;var f=r.getInt32(c,h),m=c+1;if((f-4)%80!=0&&mc.error("dcd bad format, title block start"),s.TITLE=Fo(new Uint8Array(t,m,f)),r.getInt32(m+f+4-1,h)!==f&&mc.error("dcd bad format, title block end"),c=c+f+8,4!==r.getInt32(c,h)&&mc.error("dcd bad format, natom block start"),s.NATOM=r.getInt32(c+4,h),4!==r.getInt32(c+8,h)&&mc.error("dcd bad format, natom block end"),c=c+4+8,s.NAMNF>0)mc.error("dcd format with fixed atoms unsupported, aborting");else{var g=s.NATOM,v=4*g;for(e=0,i=s.NSET;e<i;++e){if(p){c+=4;var y=new Float32Array(9);y[0]=r.getFloat64(c,h),y[4]=r.getFloat64(c+16,h),y[8]=r.getFloat64(c+40,h),a.push(y),c+=48,c+=4}for(var b=new Float32Array(3*g),x=0;x<3;++x){r.getInt32(c,h)!==v&&mc.error("dcd bad format, coord block start",e,x),c+=4;for(var _=new Float32Array(t,c,g),w=0;w<g;++w)b[3*w+x]=_[w];c+=v,r.getInt32(c,h)!==v&&mc.error("dcd bad format, coord block end",e,x),c+=4}if(o.push(b),d)c+=4+r.getInt32(c,h)+4}gc&&mc.timeEnd("DcdParser._parse "+this.name)}},Object.defineProperties(e.prototype,i),e}(function(t){function e(e,i){t.call(this,e,i),this.frames=new _v(this.name,this.path)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"trajectory"},i.__objName.get=function(){return"frames"},Object.defineProperties(e.prototype,i),e}(Ig));_c.add("dcd",Sv);var Av=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.volume=new lp(this.name,this.path),this.voxelSize=Eo(r.voxelSize,1)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"volume"},i.__objName.get=function(){return"volume"},e.prototype._afterParse=function(){this.volume.setMatrix(this.getMatrix())},e.prototype.getMatrix=function(){return new N},Object.defineProperties(e.prototype,i),e}(Ig),Mv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"cube"},e.prototype._parse=function(){gc&&mc.time("CubeParser._parse "+this.name);var t=this.volume,e=this.streamer.peekLines(6),i={},r=/\s+/,n=.529177210859*this.voxelSize;function o(t,i){var n=e[t].trim().split(r)[i];return parseFloat(n)}i.atomCount=Math.abs(o(2,0)),i.originX=.529177210859*o(2,1),i.originY=.529177210859*o(2,2),i.originZ=.529177210859*o(2,3),i.NVX=o(3,0),i.NVY=o(4,0),i.NVZ=o(5,0),i.basisX=new O(o(3,1),o(3,2),o(3,3)).multiplyScalar(n),i.basisY=new O(o(4,1),o(4,2),o(4,3)).multiplyScalar(n),i.basisZ=new O(o(5,1),o(5,2),o(5,3)).multiplyScalar(n);var a=new Float32Array(i.NVX*i.NVY*i.NVZ),s=0,c=0,u=o(2,0)>0?0:1;this.streamer.eachChunkOfLines((function(t){!function(t,e,n){for(var o=t;o<e;++o){var h=n[o].trim();if(""!==h&&c>=i.atomCount+6+u)for(var l=0,p=(h=h.split(r)).length;l<p;++l)1!==h.length&&(a[s]=parseFloat(h[l]),++s);++c}}(0,t.length,t)})),t.header=i,t.setData(a,i.NVZ,i.NVY,i.NVX),gc&&mc.timeEnd("CubeParser._parse "+this.name)},e.prototype.getMatrix=function(){var t=this.volume.header,e=new N;return e.multiply((new N).makeTranslation(t.originX,t.originY,t.originZ)),e.multiply((new N).makeBasis(t.basisZ,t.basisY,t.basisX)),e},Object.defineProperties(e.prototype,i),e}(Av);_c.add("cub",Mv),_c.add("cube",Mv);var Pv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"dsn6"},e.prototype._parse=function(){gc&&mc.time("Dsn6Parser._parse "+this.name);var t=this.streamer.data;t instanceof Uint8Array&&(t=t.buffer);var e,i,r=this.volume,n={},o=new Int16Array(t),a=new Uint8Array(t),s=String.fromCharCode.apply(null,a.subarray(0,512));if(s.startsWith(":-)"))n.xStart=parseInt(s.substr(10,5)),n.yStart=parseInt(s.substr(15,5)),n.zStart=parseInt(s.substr(20,5)),n.xExtent=parseInt(s.substr(32,5)),n.yExtent=parseInt(s.substr(38,5)),n.zExtent=parseInt(s.substr(42,5)),n.xRate=parseInt(s.substr(52,5)),n.yRate=parseInt(s.substr(58,5)),n.zRate=parseInt(s.substr(62,5)),n.xlen=parseFloat(s.substr(73,10))*this.voxelSize,n.ylen=parseFloat(s.substr(83,10))*this.voxelSize,n.zlen=parseFloat(s.substr(93,10))*this.voxelSize,n.alpha=parseFloat(s.substr(103,10)),n.beta=parseFloat(s.substr(113,10)),n.gamma=parseFloat(s.substr(123,10)),e=parseFloat(s.substr(138,12))/100,i=parseInt(s.substr(155,8));else{if(100!==o[18])for(var c=0,u=o.length;c<u;++c){var h=o[c];o[c]=(255&h)<<8|h>>8&255}n.xStart=o[0],n.yStart=o[1],n.zStart=o[2],n.xExtent=o[3],n.yExtent=o[4],n.zExtent=o[5],n.xRate=o[6],n.yRate=o[7],n.zRate=o[8];var l=1/o[17],p=l*this.voxelSize;n.xlen=o[9]*p,n.ylen=o[10]*p,n.zlen=o[11]*p,n.alpha=o[12]*l,n.beta=o[13]*l,n.gamma=o[14]*l,e=o[15]/100,i=o[16]}r.header=n,mc.log(n,e,i);for(var d=new Float32Array(n.xExtent*n.yExtent*n.zExtent),f=512,m=Math.ceil(n.xExtent/8),g=Math.ceil(n.yExtent/8),v=Math.ceil(n.zExtent/8),y=0;y<v;++y)for(var b=0;b<g;++b)for(var x=0;x<m;++x)for(var _=0;_<8;++_)for(var w=8*y+_,S=0;S<8;++S)for(var A=8*b+S,M=0;M<8;++M){var P=8*x+M;if(!(P<n.xExtent&&A<n.yExtent&&w<n.zExtent)){f+=8-M;break}d[(P*n.yExtent+A)*n.zExtent+w]=(a[f]-i)/e,++f}r.setData(d,n.zExtent,n.yExtent,n.xExtent),gc&&mc.timeEnd("Dsn6Parser._parse "+this.name)},e.prototype.getMatrix=function(){var t=this.volume.header,e=[t.xlen,0,0],i=[t.ylen*Math.cos(Math.PI/180*t.gamma),t.ylen*Math.sin(Math.PI/180*t.gamma),0],r=[t.zlen*Math.cos(Math.PI/180*t.beta),t.zlen*(Math.cos(Math.PI/180*t.alpha)-Math.cos(Math.PI/180*t.gamma)*Math.cos(Math.PI/180*t.beta))/Math.sin(Math.PI/180*t.gamma),0];r[2]=Math.sqrt(t.zlen*t.zlen*Math.sin(Math.PI/180*t.beta)*Math.sin(Math.PI/180*t.beta)-r[1]*r[1]);var n=[0,e,i,r],o=[0,t.xRate,t.yRate,t.zRate],a=[0,1,2,3],s=new N;return s.set(n[a[1]][0]/o[a[1]],n[a[2]][0]/o[a[2]],n[a[3]][0]/o[a[3]],0,n[a[1]][1]/o[a[1]],n[a[2]][1]/o[a[2]],n[a[3]][1]/o[a[3]],0,n[a[1]][2]/o[a[1]],n[a[2]][2]/o[a[2]],n[a[3]][2]/o[a[3]],0,0,0,0,1),s.multiply((new N).makeRotationY(Qo(90))),s.multiply((new N).makeTranslation(-t.zStart,t.yStart,t.xStart)),s.multiply((new N).makeScale(-1,1,1)),s},Object.defineProperties(e.prototype,i),e}(Av);_c.add("dsn6",Pv),_c.add("brix",Pv);var Tv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"dx"},e.prototype._parse=function(){gc&&mc.time("DxParser._parse "+this.name);var t=this.volume,e=this.streamer.peekLines(30),i=this.parseHeaderLines(e),r=this.volume.header,n=i.dataLineStart,o=/\s+/,a=r.nx*r.ny*r.nz,s=new Float32Array(a),c=0,u=0;this.streamer.eachChunkOfLines((function(t){!function(t,e,i){for(var r=t;r<e;++r){if(c<a&&u>n){var h=i[r].trim();if(""!==h)for(var l=h.split(o),p=0,d=l.length;p<d;++p)s[c]=parseFloat(l[p]),++c}++u}}(0,t.length,t)})),t.setData(s,r.nz,r.ny,r.nx),gc&&mc.timeEnd("DxParser._parse "+this.name)},e.prototype.parseHeaderLines=function(t){for(var e={},i=/\s+/,r=t.length,n=0,o=0,a=0,s=0;s<r;++s){var c,u=t[s];if(u.startsWith("object 1"))c=u.split(i),e.nx=parseInt(c[5]),e.ny=parseInt(c[6]),e.nz=parseInt(c[7]);else if(u.startsWith("origin"))c=u.split(i),e.xmin=parseFloat(c[1]),e.ymin=parseFloat(c[2]),e.zmin=parseFloat(c[3]);else if(u.startsWith("delta"))c=u.split(i),0===a?e.hx=parseFloat(c[1])*this.voxelSize:1===a?e.hy=parseFloat(c[2])*this.voxelSize:2===a&&(e.hz=parseFloat(c[3])*this.voxelSize),a+=1;else if(u.startsWith("object 3")){n=s,o+=u.length+1;break}o+=u.length+1}return this.volume.header=e,{dataLineStart:n,headerByteCount:o}},e.prototype.getMatrix=function(){var t=this.volume.header,e=new N;return e.multiply((new N).makeRotationY(Qo(90))),e.multiply((new N).makeTranslation(-t.zmin,t.ymin,t.xmin)),e.multiply((new N).makeScale(-t.hz,t.hy,t.hx)),e},Object.defineProperties(e.prototype,i),e}(Av);_c.add("dx",Tv);var Ev=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"dxbin"},e.prototype._parse=function(){gc&&mc.time("DxbinParser._parse "+this.name);var t=this.streamer.data;t instanceof Uint8Array&&(t=t.buffer);for(var e=function(t,e,i){e=void 0!==e?e:10485760,i=void 0!==i?i:"\n";for(var r="",n=[],o=0;o<t.length;o+=e){var a=Fo(t.subarray(o,o+e)),s=a.lastIndexOf(i);if(-1===s)r+=a;else{var c=r+a.substr(0,s);n=n.concat(c.split(i)),r=s===a.length-i.length?"":a.substr(s+i.length)}}return""!==r&&n.push(r),n}(new Uint8Array(t,0,1e3)),i=this.parseHeaderLines(e),r=this.volume.header,n=i.headerByteCount,o=r.nx*r.ny*r.nz,a=new DataView(t),s=new Float32Array(o),c=0;c<o;++c)s[c]=a.getFloat64(8*c+n,!0);this.volume.setData(s,r.nz,r.ny,r.nx),gc&&mc.timeEnd("DxbinParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Tv);_c.add("dxbin",Ev);var Cv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"mrc"},e.prototype._parse=function(){gc&&mc.time("MrcParser._parse "+this.name);var t=this.streamer.data;t instanceof Uint8Array&&(t=t.buffer);var e,i=this.volume,r={},n=new Int32Array(t,0,56),o=new Float32Array(t,0,56),a=new DataView(t);if(r.MAP=String.fromCharCode(a.getUint8(208),a.getUint8(209),a.getUint8(210),a.getUint8(211)),r.MACHST=[a.getUint8(212),a.getUint8(213)],17===r.MACHST[0]&&17===r.MACHST[1])for(var s=t.byteLength,c=0;c<s;c+=4)a.setFloat32(c,a.getFloat32(c),!0);if(r.NX=n[0],r.NY=n[1],r.NZ=n[2],r.MODE=n[3],r.NXSTART=n[4],r.NYSTART=n[5],r.NZSTART=n[6],r.MX=n[7],r.MY=n[8],r.MZ=n[9],r.xlen=o[10]*this.voxelSize,r.ylen=o[11]*this.voxelSize,r.zlen=o[12]*this.voxelSize,r.alpha=o[13],r.beta=o[14],r.gamma=o[15],r.MAPC=n[16],r.MAPR=n[17],r.MAPS=n[18],r.DMIN=o[19],r.DMAX=o[20],r.DMEAN=o[21],r.ISPG=n[22],r.NSYMBT=n[23],r.LSKFLG=n[24],r.originX=o[49],r.originY=o[50],r.originZ=o[51],r.ARMS=o[54],i.header=r,2===r.MODE)e=new Float32Array(t,1024+r.NSYMBT,r.NX*r.NY*r.NZ);else if(0===r.MODE){if(e=new Float32Array(new Int8Array(t,1024+r.NSYMBT,r.NX*r.NY*r.NZ)),-128===n[39]&&127===n[40])for(var u=(r.DMAX-r.DMIN)/255,h=.5*(r.DMIN+r.DMAX+u),l=0,p=e.length;l<p;++l)e[l]=u*e[l]+h}else mc.error("MrcParser unknown mode",r.MODE);i.setData(e,r.NX,r.NY,r.NZ),gc&&mc.timeEnd("MrcParser._parse "+this.name)},e.prototype.getMatrix=function(){var t=this.volume.header,e=[t.xlen,0,0],i=[t.ylen*Math.cos(Math.PI/180*t.gamma),t.ylen*Math.sin(Math.PI/180*t.gamma),0],r=[t.zlen*Math.cos(Math.PI/180*t.beta),t.zlen*(Math.cos(Math.PI/180*t.alpha)-Math.cos(Math.PI/180*t.gamma)*Math.cos(Math.PI/180*t.beta))/Math.sin(Math.PI/180*t.gamma),0];r[2]=Math.sqrt(t.zlen*t.zlen*Math.sin(Math.PI/180*t.beta)*Math.sin(Math.PI/180*t.beta)-r[1]*r[1]);var n=[0,e,i,r],o=[0,t.MX,t.MY,t.MZ],a=[0,t.MAPC,t.MAPR,t.MAPS],s=new N;return s.set(n[a[1]][0]/o[a[1]],n[a[2]][0]/o[a[2]],n[a[3]][0]/o[a[3]],0,n[a[1]][1]/o[a[1]],n[a[2]][1]/o[a[2]],n[a[3]][1]/o[a[3]],0,n[a[1]][2]/o[a[1]],n[a[2]][2]/o[a[2]],n[a[3]][2]/o[a[3]],0,0,0,0,1),s.setPosition(new O(t.originX,t.originY,t.originZ)),s.multiply((new N).makeTranslation(t.NXSTART,t.NYSTART,t.NZSTART)),s},Object.defineProperties(e.prototype,i),e}(Av);_c.add("mrc",Cv),_c.add("ccp4",Cv),_c.add("map",Cv);var Iv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"xplor"},e.prototype._parse=function(){gc&&mc.time("XplorParser._parse "+this.name);var t,e=this.volume,i=this.streamer.peekLines(8),r={},n=/\s+/;function o(t){return t.trim().split(n).map(parseFloat)}var a=(t=i[2].startsWith("REMARKS")?parseInt(i[1].substring(0,8))+2:5)+3,s=o(i[t]);r.NA=s[0],r.AMIN=s[1],r.AMAX=s[2],r.NB=s[3],r.BMIN=s[4],r.BMAX=s[5],r.NC=s[6],r.CMIN=s[7],r.CMAX=s[8];var c=o(i[t+1]);r.a=c[0]*this.voxelSize,r.b=c[1]*this.voxelSize,r.c=c[2]*this.voxelSize,r.alpha=c[3],r.beta=c[4],r.gamma=c[5];var u=r.AMAX-r.AMIN+1,h=r.BMAX-r.BMIN+1,l=r.CMAX-r.CMIN+1,p=u*h*l,d=new Float32Array(p),f=0,m=0,g=1+u*h/6;this.streamer.eachChunkOfLines((function(t){!function(t,e,i){for(var r=t;r<e;++r){var n=i[r];if(m>=a&&(m-a)%g!=0&&f<p)for(var o=0;o<6;++o)d[f]=parseFloat(n.substr(12*o,12)),++f;++m}}(0,t.length,t)})),e.header=r,e.setData(d,u,h,l),gc&&mc.timeEnd("XplorParser._parse "+this.name)},e.prototype.getMatrix=function(){var t=this.volume.header,e=[t.a,0,0],i=[t.b*Math.cos(Math.PI/180*t.gamma),t.b*Math.sin(Math.PI/180*t.gamma),0],r=[t.c*Math.cos(Math.PI/180*t.beta),t.c*(Math.cos(Math.PI/180*t.alpha)-Math.cos(Math.PI/180*t.gamma)*Math.cos(Math.PI/180*t.beta))/Math.sin(Math.PI/180*t.gamma),0];r[2]=Math.sqrt(t.c*t.c*Math.sin(Math.PI/180*t.beta)*Math.sin(Math.PI/180*t.beta)-r[1]*r[1]);var n=[0,e,i,r],o=[0,t.NA,t.NB,t.NC],a=[0,1,2,3],s=new N;return s.set(n[a[1]][0]/o[a[1]],n[a[2]][0]/o[a[2]],n[a[3]][0]/o[a[3]],0,n[a[1]][1]/o[a[1]],n[a[2]][1]/o[a[2]],n[a[3]][1]/o[a[3]],0,n[a[1]][2]/o[a[1]],n[a[2]][2]/o[a[2]],n[a[3]][2]/o[a[3]],0,0,0,0,1),s.multiply((new N).makeTranslation(t.AMIN,t.BMIN,t.CMIN)),s},Object.defineProperties(e.prototype,i),e}(Av);_c.add("xplor",Iv),_c.add("cns",Iv);var Rv=function(t){function e(e,i){t.call(this,e,i),this.loader=this.getLoader(),this.surface=new cp(this.name,this.path)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"surface"},i.__objName.get=function(){return"surface"},e.prototype._parse=function(){var t=this.loader.parse(this.streamer.asText());this.surface.fromGeometry(t)},Object.defineProperties(e.prototype,i),e}(Ig);function Lv(){this.regexp={vertex_pattern:/^v\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)/,normal_pattern:/^vn\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)/,uv_pattern:/^vt\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)/,face_vertex:/^f\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)(?:\s+(-?\d+))?/,face_vertex_uv:/^f\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+))?/,face_vertex_uv_normal:/^f\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+)\/(-?\d+))?/,face_vertex_normal:/^f\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)(?:\s+(-?\d+)\/\/(-?\d+))?/,object_pattern:/^[og]\s*(.+)?/,smoothing_pattern:/^s\s+(\d+|on|off)/,material_library_pattern:/^mtllib /,material_use_pattern:/^usemtl /}}Lv.prototype={constructor:Lv,setPath:function(t){this.path=t},_createParserState:function(){var t={objects:[],object:{},vertices:[],normals:[],startObject:function(t,e){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=t,void(this.object.fromDeclaration=!1!==e);this.object={name:t||"",geometry:{vertices:[],normals:[]},fromDeclaration:!1!==e},this.objects.push(this.object)},parseVertexIndex:function(t,e){var i=parseInt(t,10);return 3*(i>=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 r=this.vertices,n=this.object.geometry.vertices;n.push(r[t+0]),n.push(r[t+1]),n.push(r[t+2]),n.push(r[e+0]),n.push(r[e+1]),n.push(r[e+2]),n.push(r[i+0]),n.push(r[i+1]),n.push(r[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 r=this.normals,n=this.object.geometry.normals;n.push(r[t+0]),n.push(r[t+1]),n.push(r[t+2]),n.push(r[e+0]),n.push(r[e+1]),n.push(r[e+2]),n.push(r[i+0]),n.push(r[i+1]),n.push(r[i+2])},addFace:function(t,e,i,r,n,o,a,s){var c,u=this.vertices.length,h=this.parseVertexIndex(t,u),l=this.parseVertexIndex(e,u),p=this.parseVertexIndex(i,u);if(void 0===r?this.addVertex(h,l,p):(c=this.parseVertexIndex(r,u),this.addVertex(h,l,c),this.addVertex(l,p,c)),void 0!==n){var d=this.normals.length;h=this.parseNormalIndex(n,d),l=n===o?h:this.parseNormalIndex(o,d),p=n===a?h:this.parseNormalIndex(a,d),void 0===r?this.addNormal(h,l,p):(c=this.parseNormalIndex(s,d),this.addNormal(h,l,c),this.addNormal(l,p,c))}},addLineGeometry:function(t){this.object.geometry.type="Line";for(var e=this.vertices.length,i=0,r=t.length;i<r;i++)this.addVertexLine(this.parseVertexIndex(t[i],e))}};return t.startObject("",!1),t},parse:function(t){var e,i,r=this._createParserState();-1!==t.indexOf("\r\n")&&(t=t.replace(/\r\n/g,"\n")),-1!==t.indexOf("\\\n")&&(t=t.replace(/\\\n/g,""));var n=t.split("\n"),o="",a="",s="",c=[],u="function"==typeof"".trimLeft;for(e=0,i=n.length;e<i;e++)if(o=n[e],0!==(o=u?o.trimLeft():o.trim()).length&&"#"!==(a=o.charAt(0)))if("v"===a){if(" "===(s=o.charAt(1))&&null!==(c=this.regexp.vertex_pattern.exec(o)))r.vertices.push(parseFloat(c[1]),parseFloat(c[2]),parseFloat(c[3]));else if("n"===s&&null!==(c=this.regexp.normal_pattern.exec(o)))r.normals.push(parseFloat(c[1]),parseFloat(c[2]),parseFloat(c[3]));else if("t"!==s||null===(c=this.regexp.uv_pattern.exec(o)))throw new Error("Unexpected vertex/normal/uv line: '"+o+"'")}else if("f"===a)if(null!==(c=this.regexp.face_vertex_uv_normal.exec(o)))r.addFace(c[1],c[4],c[7],c[10],c[3],c[6],c[9],c[12]);else if(null!==(c=this.regexp.face_vertex_uv.exec(o)));else if(null!==(c=this.regexp.face_vertex_normal.exec(o)))r.addFace(c[1],c[3],c[5],c[7],c[2],c[4],c[6],c[8]);else{if(null===(c=this.regexp.face_vertex.exec(o)))throw new Error("Unexpected face line: '"+o+"'");r.addFace(c[1],c[2],c[3],c[4])}else if("l"===a){var h=o.substring(1).trim().split(" "),l=[],p=[];if(-1===o.indexOf("/"))l=h;else for(var d=0,f=h.length;d<f;d++){var m=h[d].split("/");""!==m[0]&&l.push(m[0]),""!==m[1]&&p.push(m[1])}r.addLineGeometry(l,p)}else if(null!==(c=this.regexp.object_pattern.exec(o))){var g=c[0].substr(1).trim();r.startObject(g)}else if(this.regexp.material_use_pattern.test(o));else if(this.regexp.material_library_pattern.test(o));else if(null===(c=this.regexp.smoothing_pattern.exec(o))){if("\0"===o)continue;throw new Error("Unexpected line: '"+o+"'")}var v=[];for(e=0,i=r.objects.length;e<i;e++){var y=r.objects[e].geometry;if(0!==y.vertices.length){var b=new _e;b.addAttribute("position",new me(new Float32Array(y.vertices),3)),y.normals.length>0?b.addAttribute("normal",new me(new Float32Array(y.normals),3)):b.computeVertexNormals(),v.push(b)}}return v}};var Ov=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"obj"},e.prototype.getLoader=function(){return new Lv},Object.defineProperties(e.prototype,i),e}(Rv);function Nv(){this.propertyNameMapping={}}_c.add("obj",Ov),Nv.prototype={constructor:Nv,setPropertyNameMapping:function(t){this.propertyNameMapping=t},bin2str:function(t){for(var e=new Uint8Array(t),i="",r=0;r<t.byteLength;r++)i+=String.fromCharCode(e[r]);return i},isASCII:function(t){return"ascii"===this.parseHeader(this.bin2str(t)).format},parse:function(t){return t instanceof ArrayBuffer?this.isASCII(t)?this.parseASCII(this.bin2str(t)):this.parseBinary(t):this.parseASCII(t)},parseHeader:function(t){var e="",i=0,r=/ply([\s\S]*)end_header\s/.exec(t);null!==r&&(e=r[1],i=r[0].length);var n,o,a,s,c,u,h={comments:[],elements:[],headerLength:i},l=e.split("\n");for(var p=0;p<l.length;p++){var d=l[p];if(""!==(d=d.trim()))switch(o=(a=d.split(/\s+/)).shift(),d=a.join(" "),o){case"format":h.format=a[0],h.version=a[1];break;case"comment":h.comments.push(d);break;case"element":void 0!==n&&h.elements.push(n),(n={}).name=a[0],n.count=parseInt(a[1]),n.properties=[];break;case"property":n.properties.push((s=a,c=this.propertyNameMapping,u=void 0,"list"===(u={type:s[0]}).type?(u.name=s[3],u.countType=s[1],u.itemType=s[2]):u.name=s[1],u.name in c&&(u.name=c[u.name]),u));break;default:console.log("unhandled",o,a)}}return void 0!==n&&h.elements.push(n),h},parseASCIINumber:function(t,e){switch(e){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(t);case"float":case"double":case"float32":case"float64":return parseFloat(t)}},parseASCIIElement:function(t,e){for(var i=e.split(/\s+/),r={},n=0;n<t.length;n++)if("list"===t[n].type){for(var o=[],a=this.parseASCIINumber(i.shift(),t[n].countType),s=0;s<a;s++)o.push(this.parseASCIINumber(i.shift(),t[n].itemType));r[t[n].name]=o}else r[t[n].name]=this.parseASCIINumber(i.shift(),t[n].type);return r},parseASCII:function(t){var e,i=new fe,r=this.parseHeader(t),n="";null!==(e=/end_header\s([\s\S]*)$/.exec(t))&&(n=e[1]);var o=n.split("\n"),a=0,s=0;i.useColor=!1;for(var c=0;c<o.length;c++){var u=o[c];if(""!==(u=u.trim())){s>=r.elements[a].count&&(a++,s=0);var h=this.parseASCIIElement(r.elements[a].properties,u);this.handleElement(i,r.elements[a].name,h),s++}}return this.postProcess(i)},postProcess:function(t){if(t.useColor){for(var e=0;e<t.faces.length;e++)t.faces[e].vertexColors=[t.colors[t.faces[e].a],t.colors[t.faces[e].b],t.colors[t.faces[e].c]];t.elementsNeedUpdate=!0}return t.computeBoundingSphere(),t},handleElement:function(t,e,i){if("vertex"===e){if(t.vertices.push(new O(i.x,i.y,i.z)),"red"in i&&"green"in i&&"blue"in i){t.useColor=!0;var r=new St;r.setRGB(i.red/255,i.green/255,i.blue/255),t.colors.push(r)}}else if("face"===e){var n=i.vertex_indices;3===n.length?t.faces.push(new re(n[0],n[1],n[2])):4===n.length&&t.faces.push(new re(n[0],n[1],n[3]),new re(n[1],n[2],n[3]))}},binaryRead:function(t,e,i,r){switch(i){case"int8":case"char":return[t.getInt8(e),1];case"uint8":case"uchar":return[t.getUint8(e),1];case"int16":case"short":return[t.getInt16(e,r),2];case"uint16":case"ushort":return[t.getUint16(e,r),2];case"int32":case"int":return[t.getInt32(e,r),4];case"uint32":case"uint":return[t.getUint32(e,r),4];case"float32":case"float":return[t.getFloat32(e,r),4];case"float64":case"double":return[t.getFloat64(e,r),8]}},binaryReadElement:function(t,e,i,r){for(var n,o={},a=0,s=0;s<i.length;s++)if("list"===i[s].type){var c=[],u=(n=this.binaryRead(t,e+a,i[s].countType,r))[0];a+=n[1];for(var h=0;h<u;h++)n=this.binaryRead(t,e+a,i[s].itemType,r),c.push(n[0]),a+=n[1];o[i[s].name]=c}else n=this.binaryRead(t,e+a,i[s].type,r),o[i[s].name]=n[0],a+=n[1];return[o,a]},parseBinary:function(t){for(var e,i=new fe,r=this.parseHeader(this.bin2str(t)),n="binary_little_endian"===r.format,o=new DataView(t,r.headerLength),a=0,s=0;s<r.elements.length;s++)for(var c=0;c<r.elements[s].count;c++){a+=(e=this.binaryReadElement(o,a,r.elements[s].properties,n))[1];var u=e[0];this.handleElement(i,r.elements[s].name,u)}return this.postProcess(i)}};var Dv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"ply"},e.prototype.getLoader=function(){return new Nv},Object.defineProperties(e.prototype,i),e}(Rv);_c.add("ply",Dv);var kv=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.delimiter=Eo(r.delimiter,","),this.comment=Eo(r.comment,"#"),this.columnNames=Eo(r.columnNames,!1),this.table={name:this.name,path:this.path,columnNames:[],data:[]}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"csv"},i.__objName.get=function(){return"table"},e.prototype._parse=function(){var t=this,e=this.table.data,i=new RegExp("\\s*"+this.delimiter+"\\s*"),r=0;this.streamer.eachChunkOfLines((function(n){for(var o=n.length,a=0;a<o;++a){var s=n[a].trim();if(!s.startsWith(t.comment)){var c=s.split(i);0===r?t.table.columnNames=c:s&&e.push(c),++r}}}))},Object.defineProperties(e.prototype,i),e}(Ig);_c.add("csv",kv);var Fv=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.string=Eo(r.string,!1),this.json={name:this.name,path:this.path,data:{}}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"json"},i.__objName.get=function(){return"json"},e.prototype._parse=function(){this.streamer.isBinary()||this.string?this.json.data=JSON.parse(this.streamer.asText()):this.json.data=this.streamer.data},Object.defineProperties(e.prototype,i),e}(Ig);_c.add("json",Fv);var Bv=function(t){function e(e,i){t.call(this,e,i),this.text={name:this.name,path:this.path,data:""}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"text"},i.__objName.get=function(){return"text"},e.prototype._parse=function(){this.text.data=this.streamer.asText()},Object.defineProperties(e.prototype,i),e}(Ig);_c.add("txt",Bv),_c.add("text",Bv);var zv=/^['"]|['"]$/g,Uv=/^<([\w-:.]+)\s*/,jv=/^([^<]*)/,Gv=/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/;function Vv(t){return t=t.trim().replace(/<!--[\s\S]*?-->/g,""),{declaration:e(),root:i()};function e(){if(n(/^<\?xml\s*/)){for(var t={attributes:{}};!o()&&!a("?>");){var e=r();if(!e)return t;t.attributes[e.name]=e.value}return n(/\?>\s*/),t}}function i(){var t=n(Uv);if(t){for(var e,s={name:t[1],attributes:{},children:[]};!(o()||a(">")||a("?>")||a("/>"));){var c=r();if(!c)return s;s.attributes[c.name]=c.value}if(n(/^\s*\/>\s*/))return s;for(n(/\??>\s*/),s.content=function(){var t=n(jv);if(t)return t[1];return""}();e=i();)s.children.push(e);return n(/^<\/[\w-:.]+>\s*/),s}}function r(){var t,e=n(Gv);if(e)return{name:e[1],value:(t=e[2],t.replace(zv,""))}}function n(e){var i=t.match(e);if(i)return t=t.slice(i[0].length),i}function o(){return 0===t.length}function a(e){return 0===t.indexOf(e)}}var $v=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.useDomParser=Eo(r.useDomParser,!1),this.xml={name:this.name,path:this.path,data:{}}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"xml"},i.__objName.get=function(){return"xml"},e.prototype.__xmlParser=function(t){return Vv(t)},e.prototype.__domParser=function(t){return(new window.DOMParser).parseFromString(t,"text/xml")},e.prototype._parse=function(){gc&&mc.time("XmlParser._parse "+this.name),this.useDomParser?this.streamer.data instanceof window.Document?this.xml.data=this.streamer.data:this.xml.data=this.__domParser(this.streamer.asText()):this.xml.data=this.__xmlParser(this.streamer.asText()),gc&&mc.timeEnd("XmlParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Ig);function Hv(t,e,i){var r=t.icode.value,n=t.chain.value,o=t.altcode.value,a=t.resnum.value;return r.trim()&&(a+="^"+r),n.trim()&&(a+=":"+n),e&&(a+="."+e),i&&o.trim()&&(a+="%"+o),a+="/"+(parseInt(t.model.value)-1)}function Wv(t,e,i){void 0===t[e]?t[e]=i:t[e]|=i}function Xv(t,e){return void 0!==t&&t.value===e}function qv(t,e,i){for(var r=0,n=e.getElementsByTagName("clash"),o=0,a=n.length;o<a;++o)if(t[n[o].attributes.cid.value]){r+=1;break}return e.getElementsByTagName("angle-outlier").length>0&&(r+=1),e.getElementsByTagName("bond-outlier").length>0&&(r+=1),e.getElementsByTagName("plane-outlier").length>0&&(r+=1),Xv(i.rota,"OUTLIER")&&(r+=1),Xv(i.rama,"OUTLIER")&&(r+=1),Xv(i.RNApucker,"outlier")&&(r+=1),r}_c.add("xml",$v);var Yv=function(t,e){this.name=t,this.path=e,this.rsrzDict={},this.rsccDict={},this.clashDict={},this.clashArray=[],this.geoDict={},this.geoAtomDict={},this.atomDict={},this.clashSele="NONE"},Zv={type:{}};Zv.type.get=function(){return"validation"},Yv.prototype.fromXml=function(t){gc&&mc.time("Validation.fromXml");var e=this.rsrzDict,i=this.rsccDict,r=this.clashDict,n=this.clashArray,o=this.geoDict,a=this.geoAtomDict,s=this.atomDict,c=t.getElementsByTagName("ModelledSubgroup"),u={},h=[];gc&&mc.time("Validation.fromXml#clashDict");for(var l=0,p=c.length;l<p;++l){var d=c[l],f=d.attributes,m=Hv(f);void 0!==f.rsrz&&(e[m]=parseFloat(f.rsrz.value)),void 0!==f.rscc&&(i[m]=parseFloat(f.rscc.value)),f.sele=m;for(var g=d.getElementsByTagName("clash"),v=0,y=g.length;v<y;++v){var b=g[v].attributes,x=b.atom.value;if("H"!==Xp(x)){var _=b.cid.value,w=Hv(f,x,!0);if(s[w]=!0,void 0===u[_])u[_]={sele1:w,res1:m};else{var S=u[_];S.res1!==m&&(S.sele2=w,S.res2=m,h.push(S.res1,m),r[_]=S,n.push(S))}}}}gc&&mc.timeEnd("Validation.fromXml#clashDict");for(var A=0,M=c.length;A<M;++A){var P=c[A],T=P.attributes,E=T.sele;if("."!==T.seq.value){var C=qv(r,P,T);C>0&&(o[E]=C)}else{var I=P.getElementsByTagName("clash"),R=P.getElementsByTagName("mog-bond-outlier"),L=P.getElementsByTagName("mog-angle-outlier");if(R.length>0||L.length>0||I.length>0){var O={};a[E]=O;for(var N=0,D=I.length;N<D;++N){var k=I[N].attributes;r[k.cid.value]&&Wv(O,k.atom.value,1)}for(var F=0,B=R.length;F<B;++F){R[F].attributes.atoms.value.split(",").forEach((function(t){Wv(O,t,2)}))}for(var z=0,U=L.length;z<U;++z){L[z].attributes.atoms.value.split(",").forEach((function(t){Wv(O,t,4)}))}}}}this.clashSele=h.length?h.join(" OR "):"NONE",gc&&mc.timeEnd("Validation.fromXml")},Yv.prototype.getClashData=function(t){gc&&mc.time("Validation.getClashData");var e=t||{},i=e.structure,r=i.atomSet,n=new St(Eo(e.color,"#f0027f")),o=i.getAtomProxy(),a=i.getAtomProxy(),s=new O,c=new O,u=new O,h=this.clashArray,l=h.length,p=new Float32Array(3*l),d=new Float32Array(3*l),f=au(l,n.r,n.g,n.b),m=new Float32Array(l),g=new Float32Array(l);gc&&mc.time("Validation.getClashData#atomDict");var v=this.atomDict;i.eachAtom((function(t){var e=function(t){var e=t.inscode,i=t.chainname,r=t.atomname,n=t.altloc,o=t.resno;return e&&(o+="^"+e),i&&(o+=":"+i),r&&(o+="."+r),n&&(o+="%"+n),o+="/"+t.modelIndex}(t);!0===v[e]&&(v[e]=t.index)})),gc&&mc.timeEnd("Validation.getClashData#atomDict");var y=0;return h.forEach((function(t,e){if(o.index=v[t.sele1],a.index=v[t.sele2],void 0!==o.index&&void 0!==a.index&&r.isSet(o.index,a.index)){s.subVectors(a,o).setLength(o.vdw),c.copy(o).add(s),s.subVectors(o,a).setLength(a.vdw),u.copy(a).add(s);var i=o.distanceTo(a)/2,n=Math.sqrt(o.vdw*o.vdw-i*i),h=Math.sqrt(a.vdw*a.vdw-i*i);c.toArray(p,3*y),u.toArray(d,3*y),m[y]=(n+h)/2,g[y]=e,++y}})),gc&&mc.timeEnd("Validation.getClashData"),{position1:p.subarray(0,3*y),position2:d.subarray(0,3*y),color:f.subarray(0,3*y),color2:f.subarray(0,3*y),radius:m.subarray(0,y),picking:new Yh(g.subarray(0,y),this,i)}},Object.defineProperties(Yv.prototype,Zv);var Kv=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.useDomParser=!0,this.validation=new Yv(this.name,this.path)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={__objName:{}};return i.__objName.get=function(){return"validation"},e.prototype._parse=function(){t.prototype._parse.call(this),gc&&mc.time("ValidationParser._parse "+this.name),this.validation.fromXml(this.xml.data),gc&&mc.timeEnd("ValidationParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}($v);function Qv(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)}function Jv(t,e,i,r,n){if(e.subarray&&t.subarray)t.set(e.subarray(i,i+r),n);else for(var o=0;o<r;o++)t[n+o]=e[i+o]}function ty(t,e,i,r){for(var n=65535&t|0,o=t>>>16&65535|0,a=0;0!==i;){i-=a=i>2e3?2e3:i;do{o=o+(n=n+e[r++]|0)|0}while(--a);n%=65521,o%=65521}return n|o<<16|0}_c.add("validation",Kv);var ey=function(){for(var t,e=[],i=0;i<256;i++){t=i;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}();function iy(t,e,i,r){var n=ey,o=r+i;t^=-1;for(var a=r;a<o;a++)t=t>>>8^n[255&(t^e[a])];return-1^t}function ry(t,e){var i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,P;i=t.state,r=t.next_in,M=t.input,n=r+(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,p=i.window,d=i.hold,f=i.bits,m=i.lencode,g=i.distcode,v=(1<<i.lenbits)-1,y=(1<<i.distbits)-1;t:do{f<15&&(d+=M[r++]<<f,f+=8,d+=M[r++]<<f,f+=8),b=m[d&v];e:for(;;){if(d>>>=x=b>>>24,f-=x,0===(x=b>>>16&255))P[o++]=65535&b;else{if(!(16&x)){if(0==(64&x)){b=m[(65535&b)+(d&(1<<x)-1)];continue e}if(32&x){i.mode=12;break t}t.msg="invalid literal/length code",i.mode=30;break t}_=65535&b,(x&=15)&&(f<x&&(d+=M[r++]<<f,f+=8),_+=d&(1<<x)-1,d>>>=x,f-=x),f<15&&(d+=M[r++]<<f,f+=8,d+=M[r++]<<f,f+=8),b=g[d&y];i:for(;;){if(d>>>=x=b>>>24,f-=x,!(16&(x=b>>>16&255))){if(0==(64&x)){b=g[(65535&b)+(d&(1<<x)-1)];continue i}t.msg="invalid distance code",i.mode=30;break t}if(w=65535&b,f<(x&=15)&&(d+=M[r++]<<f,(f+=8)<x&&(d+=M[r++]<<f,f+=8)),(w+=d&(1<<x)-1)>c){t.msg="invalid distance too far back",i.mode=30;break t}if(d>>>=x,f-=x,w>(x=o-a)){if((x=w-x)>h&&i.sane){t.msg="invalid distance too far back",i.mode=30;break t}if(S=0,A=p,0===l){if(S+=u-x,x<_){_-=x;do{P[o++]=p[S++]}while(--x);S=o-w,A=P}}else if(l<x){if(S+=u+l-x,(x-=l)<_){_-=x;do{P[o++]=p[S++]}while(--x);if(S=0,l<_){_-=x=l;do{P[o++]=p[S++]}while(--x);S=o-w,A=P}}}else if(S+=l-x,x<_){_-=x;do{P[o++]=p[S++]}while(--x);S=o-w,A=P}for(;_>2;)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(r<n&&o<s);r-=_=f>>3,d&=(1<<(f-=_<<3))-1,t.next_in=r,t.next_out=o,t.avail_in=r<n?n-r+5:5-(r-n),t.avail_out=o<s?s-o+257:257-(o-s),i.hold=d,i.bits=f}var 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],oy=[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],ay=[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],sy=[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];function cy(t,e,i,r,n,o,a,s){var c,u,h,l,p,d,f,m,g,v=s.bits,y=0,b=0,x=0,_=0,w=0,S=0,A=0,M=0,P=0,T=0,E=null,C=0,I=new Uint16Array(16),R=new Uint16Array(16),L=null,O=0;for(y=0;y<=15;y++)I[y]=0;for(b=0;b<r;b++)I[e[i+b]]++;for(w=v,_=15;_>=1&&0===I[_];_--);if(w>_&&(w=_),0===_)return n[o++]=20971520,n[o++]=20971520,s.bits=1,0;for(x=1;x<_&&0===I[x];x++);for(w<x&&(w=x),M=1,y=1;y<=15;y++)if(M<<=1,(M-=I[y])<0)return-1;if(M>0&&(0===t||1!==_))return-1;for(R[1]=0,y=1;y<15;y++)R[y+1]=R[y]+I[y];for(b=0;b<r;b++)0!==e[i+b]&&(a[R[e[i+b]]++]=b);if(0===t?(E=L=a,d=19):1===t?(E=ny,C-=257,L=oy,O-=257,d=256):(E=ay,L=sy,d=-1),T=0,b=0,y=x,p=o,S=w,A=0,h=-1,l=(P=1<<w)-1,1===t&&P>852||2===t&&P>592)return 1;for(;;){f=y-A,a[b]<d?(m=0,g=a[b]):a[b]>d?(m=L[O+a[b]],g=E[C+a[b]]):(m=96,g=0),c=1<<y-A,x=u=1<<S;do{n[p+(T>>A)+(u-=c)]=f<<24|m<<16|g|0}while(0!==u);for(c=1<<y-1;T&c;)c>>=1;if(0!==c?(T&=c-1,T+=c):T=0,b++,0==--I[y]){if(y===_)break;y=e[i+a[b]]}if(y>w&&(T&l)!==h){for(0===A&&(A=w),p+=x,M=1<<(S=y-A);S+A<_&&!((M-=I[S+A])<=0);)S++,M<<=1;if(P+=1<<S,1===t&&P>852||2===t&&P>592)return 1;n[h=T&l]=w<<24|S<<16|p-o|0}}return 0!==T&&(n[p+T]=y-A<<24|64<<16|0),s.bits=w,0}function uy(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function hy(){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 ly(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,function(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=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,0):-2}(t)):-2}function py(t,e){var i,r;return t?(r=new hy,t.state=r,r.window=null,0!==(i=function(t,e){var i,r;return t&&t.state?(r=t.state,e<0?(i=0,e=-e):(i=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?-2:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=i,r.wbits=e,ly(t))):-2}(t,e))&&(t.state=null),i):-2}var dy,fy,my=!0;function gy(t){if(my){var e;for(dy=new Int32Array(512),fy=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(cy(1,t.lens,0,288,dy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;cy(2,t.lens,0,32,fy,0,t.work,{bits:5}),my=!1}t.lencode=dy,t.lenbits=9,t.distcode=fy,t.distbits=5}function vy(t,e,i,r){var n,o=t.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),r>=o.wsize?(Jv(o.window,e,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((n=o.wsize-o.wnext)>r&&(n=r),Jv(o.window,e,i-r,n,o.wnext),(r-=n)?(Jv(o.window,e,i-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=n))),0}function yy(t,e){var i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,P=0,T=new Uint8Array(4),E=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return-2;12===(i=t.state).mode&&(i.mode=13),a=t.next_out,n=t.output,c=t.avail_out,o=t.next_in,r=t.input,s=t.avail_in,u=i.hold,h=i.bits,l=s,p=c,S=0;t:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;h<16;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(2&i.wrap&&35615===u){i.check=0,T[0]=255&u,T[1]=u>>>8&255,i.check=iy(i.check,T,2,0),u=0,h=0,i.mode=2;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=30;break}if(8!=(15&u)){t.msg="unknown compression method",i.mode=30;break}if(h-=4,w=8+(15&(u>>>=4)),0===i.wbits)i.wbits=w;else if(w>i.wbits){t.msg="invalid window size",i.mode=30;break}i.dmax=1<<w,t.adler=i.check=1,i.mode=512&u?10:12,u=0,h=0;break;case 2:for(;h<16;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(i.flags=u,8!=(255&i.flags)){t.msg="unknown compression method",i.mode=30;break}if(57344&i.flags){t.msg="unknown header flags set",i.mode=30;break}i.head&&(i.head.text=u>>8&1),512&i.flags&&(T[0]=255&u,T[1]=u>>>8&255,i.check=iy(i.check,T,2,0)),u=0,h=0,i.mode=3;case 3:for(;h<32;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.head&&(i.head.time=u),512&i.flags&&(T[0]=255&u,T[1]=u>>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,i.check=iy(i.check,T,4,0)),u=0,h=0,i.mode=4;case 4:for(;h<16;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.head&&(i.head.xflags=255&u,i.head.os=u>>8),512&i.flags&&(T[0]=255&u,T[1]=u>>>8&255,i.check=iy(i.check,T,2,0)),u=0,h=0,i.mode=5;case 5:if(1024&i.flags){for(;h<16;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.length=u,i.head&&(i.head.extra_len=u),512&i.flags&&(T[0]=255&u,T[1]=u>>>8&255,i.check=iy(i.check,T,2,0)),u=0,h=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&((d=i.length)>s&&(d=s),d&&(i.head&&(w=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),Jv(i.head.extra,r,o,d,w)),512&i.flags&&(i.check=iy(i.check,r,d,o)),s-=d,o+=d,i.length-=d),i.length))break t;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===s)break t;d=0;do{w=r[o+d++],i.head&&w&&i.length<65536&&(i.head.name+=String.fromCharCode(w))}while(w&&d<s);if(512&i.flags&&(i.check=iy(i.check,r,d,o)),s-=d,o+=d,w)break t}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===s)break t;d=0;do{w=r[o+d++],i.head&&w&&i.length<65536&&(i.head.comment+=String.fromCharCode(w))}while(w&&d<s);if(512&i.flags&&(i.check=iy(i.check,r,d,o)),s-=d,o+=d,w)break t}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;h<16;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(u!==(65535&i.check)){t.msg="header crc mismatch",i.mode=30;break}u=0,h=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=12;break;case 10:for(;h<32;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}t.adler=i.check=uy(u),u=0,h=0,i.mode=11;case 11:if(0===i.havedict)return t.next_out=a,t.avail_out=c,t.next_in=o,t.avail_in=s,i.hold=u,i.bits=h,2;t.adler=i.check=1,i.mode=12;case 12:if(5===e||6===e)break t;case 13:if(i.last){u>>>=7&h,h-=7&h,i.mode=27;break}for(;h<3;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}switch(i.last=1&u,h-=1,3&(u>>>=1)){case 0:i.mode=14;break;case 1:if(gy(i),i.mode=20,6===e){u>>>=2,h-=2;break t}break;case 2:i.mode=17;break;case 3:t.msg="invalid block type",i.mode=30}u>>>=2,h-=2;break;case 14:for(u>>>=7&h,h-=7&h;h<32;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if((65535&u)!=(u>>>16^65535)){t.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&u,u=0,h=0,i.mode=15,6===e)break t;case 15:i.mode=16;case 16:if(d=i.length){if(d>s&&(d=s),d>c&&(d=c),0===d)break t;Jv(n,r,o,d,a),s-=d,o+=d,c-=d,a+=d,i.length-=d;break}i.mode=12;break;case 17:for(;h<14;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(i.nlen=257+(31&u),u>>>=5,h-=5,i.ndist=1+(31&u),u>>>=5,h-=5,i.ncode=4+(15&u),u>>>=4,h-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=30;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;h<3;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.lens[E[i.have++]]=7&u,u>>>=3,h-=3}for(;i.have<19;)i.lens[E[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,A={bits:i.lenbits},S=cy(0,i.lens,0,19,i.lencode,0,i.work,A),i.lenbits=A.bits,S){t.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;v=(P=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,y=65535&P,!((g=P>>>24)<=h);){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(y<16)u>>>=g,h-=g,i.lens[i.have++]=y;else{if(16===y){for(M=g+2;h<M;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(u>>>=g,h-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=30;break}w=i.lens[i.have-1],d=3+(3&u),u>>>=2,h-=2}else if(17===y){for(M=g+3;h<M;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}h-=g,w=0,d=3+(7&(u>>>=g)),u>>>=3,h-=3}else{for(M=g+7;h<M;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}h-=g,w=0,d=11+(127&(u>>>=g)),u>>>=7,h-=7}if(i.have+d>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=30;break}for(;d--;)i.lens[i.have++]=w}}if(30===i.mode)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,A={bits:i.lenbits},S=cy(1,i.lens,0,i.nlen,i.lencode,0,i.work,A),i.lenbits=A.bits,S){t.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,A={bits:i.distbits},S=cy(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,A),i.distbits=A.bits,S){t.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===e)break t;case 20:i.mode=21;case 21: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,ry(t,p),a=t.next_out,n=t.output,c=t.avail_out,o=t.next_in,r=t.input,s=t.avail_in,u=i.hold,h=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;v=(P=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,y=65535&P,!((g=P>>>24)<=h);){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(v&&0==(240&v)){for(b=g,x=v,_=y;v=(P=i.lencode[_+((u&(1<<b+x)-1)>>b)])>>>16&255,y=65535&P,!(b+(g=P>>>24)<=h);){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}u>>>=b,h-=b,i.back+=b}if(u>>>=g,h-=g,i.back+=g,i.length=y,0===v){i.mode=26;break}if(32&v){i.back=-1,i.mode=12;break}if(64&v){t.msg="invalid literal/length code",i.mode=30;break}i.extra=15&v,i.mode=22;case 22:if(i.extra){for(M=i.extra;h<M;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.length+=u&(1<<i.extra)-1,u>>>=i.extra,h-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;v=(P=i.distcode[u&(1<<i.distbits)-1])>>>16&255,y=65535&P,!((g=P>>>24)<=h);){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(0==(240&v)){for(b=g,x=v,_=y;v=(P=i.distcode[_+((u&(1<<b+x)-1)>>b)])>>>16&255,y=65535&P,!(b+(g=P>>>24)<=h);){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}u>>>=b,h-=b,i.back+=b}if(u>>>=g,h-=g,i.back+=g,64&v){t.msg="invalid distance code",i.mode=30;break}i.offset=y,i.extra=15&v,i.mode=24;case 24:if(i.extra){for(M=i.extra;h<M;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.offset+=u&(1<<i.extra)-1,u>>>=i.extra,h-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===c)break t;if(d=p-c,i.offset>d){if((d=i.offset-d)>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=30;break}d>i.wnext?(d-=i.wnext,f=i.wsize-d):f=i.wnext-d,d>i.length&&(d=i.length),m=i.window}else m=n,f=a-i.offset,d=i.length;d>c&&(d=c),c-=d,i.length-=d;do{n[a++]=m[f++]}while(--d);0===i.length&&(i.mode=21);break;case 26:if(0===c)break t;n[a++]=i.length,c--,i.mode=21;break;case 27:if(i.wrap){for(;h<32;){if(0===s)break t;s--,u|=r[o++]<<h,h+=8}if(p-=c,t.total_out+=p,i.total+=p,p&&(t.adler=i.check=i.flags?iy(i.check,n,p,a-p):ty(i.check,n,p,a-p)),p=c,(i.flags?u:uy(u))!==i.check){t.msg="incorrect data check",i.mode=30;break}u=0,h=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;h<32;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(u!==(4294967295&i.total)){t.msg="incorrect length check",i.mode=30;break}u=0,h=0}i.mode=29;case 29:S=1;break t;case 30:S=-3;break t;case 31:return-4;case 32:default:return-2}return t.next_out=a,t.avail_out=c,t.next_in=o,t.avail_in=s,i.hold=u,i.bits=h,(i.wsize||p!==t.avail_out&&i.mode<30&&(i.mode<27||4!==e))&&vy(t,t.output,t.next_out,p-t.avail_out)?(i.mode=31,-4):(l-=t.avail_in,p-=t.avail_out,t.total_in+=l,t.total_out+=p,i.total+=p,i.wrap&&p&&(t.adler=i.check=i.flags?iy(i.check,n,p,t.next_out-p):ty(i.check,n,p,t.next_out-p)),t.data_type=i.bits+(i.last?64:0)+(12===i.mode?128:0)+(20===i.mode||15===i.mode?256:0),(0===l&&0===p||4===e)&&0===S&&(S=-5),S)}function by(t,e){var i,r=e.length;return t&&t.state?0!==(i=t.state).wrap&&11!==i.mode?-2:11===i.mode&&ty(1,e,r,0)!==i.check?-3:vy(t,e,r,r)?(i.mode=31,-4):(i.havedict=1,0):-2}var xy=!0,_y=!0;try{String.fromCharCode.apply(null,[0])}catch(t){xy=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){_y=!1}for(var wy=new Uint8Array(256),Sy=0;Sy<256;Sy++)wy[Sy]=Sy>=252?6:Sy>=248?5:Sy>=240?4:Sy>=224?3:Sy>=192?2:1;function Ay(t){var e,i,r,n,o,a=t.length,s=0;for(n=0;n<a;n++)55296==(64512&(i=t.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=t.charCodeAt(n+1)))&&(i=65536+(i-55296<<10)+(r-56320),n++),s+=i<128?1:i<2048?2:i<65536?3:4;for(e=new Uint8Array(s),o=0,n=0;o<s;n++)55296==(64512&(i=t.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=t.charCodeAt(n+1)))&&(i=65536+(i-55296<<10)+(r-56320),n++),i<128?e[o++]=i:i<2048?(e[o++]=192|i>>>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 My(t,e){var i,r,n,o,a=e||t.length,s=new Array(2*a);for(r=0,i=0;i<a;)if((n=t[i++])<128)s[r++]=n;else if((o=wy[n])>4)s[r++]=65533,i+=o-1;else{for(n&=2===o?31:3===o?15:7;o>1&&i<a;)n=n<<6|63&t[i++],o--;o>1?s[r++]=65533:n<65536?s[r++]=n:(n-=65536,s[r++]=55296|n>>10&1023,s[r++]=56320|1023&n)}return function(t,e){if(e<65537&&(t.subarray&&_y||!t.subarray&&xy))return String.fromCharCode.apply(null,Qv(t,e));for(var i="",r=0;r<e;r++)i+=String.fromCharCode(t[r]);return i}(s,r)}function Py(t,e){var i;for((e=e||t.length)>t.length&&(e=t.length),i=e-1;i>=0&&128==(192&t[i]);)i--;return i<0?e:0===i?e:i+wy[t[i]]>e?i:e}wy[254]=wy[254]=1;var Ty={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"};function Ey(){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 Cy(){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}var Iy=Object.prototype.toString;function Ry(t){if(!(this instanceof Ry))return new Ry(t);this.options=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}}return t}({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 Ey,this.strm.avail_out=0;var i,r,n,o=py(this.strm,e.windowBits);if(0!==o)throw new Error(Ty[o]);this.header=new Cy,i=this.strm,r=this.header,i&&i.state&&(0==(2&(n=i.state).wrap)||(n.head=r,r.done=!1))}Ry.prototype.push=function(t,e){var i,r,n,o,a,s,c=this.strm,u=this.options.chunkSize,h=this.options.dictionary,l=!1;if(this.ended)return!1;r=e===~~e?e:!0===e?4:0,"string"==typeof t?c.input=function(t){for(var e=new Uint8Array(t.length),i=0,r=e.length;i<r;i++)e[i]=t.charCodeAt(i);return e}(t):"[object ArrayBuffer]"===Iy.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),2===(i=yy(c,0))&&h&&(s="string"==typeof h?Ay(h):"[object ArrayBuffer]"===Iy.call(h)?new Uint8Array(h):h,i=by(this.strm,s)),-5===i&&!0===l&&(i=0,l=!1),1!==i&&0!==i)return this.onEnd(i),this.ended=!0,!1;c.next_out&&(0!==c.avail_out&&1!==i&&(0!==c.avail_in||4!==r&&2!==r)||("string"===this.options.to?(n=Py(c.output,c.next_out),o=c.next_out-n,a=My(c.output,n),c.next_out=o,c.avail_out=u-o,o&&Jv(c.output,c.output,n,o,0),this.onData(a)):this.onData(Qv(c.output,c.next_out)))),0===c.avail_in&&0===c.avail_out&&(l=!0)}while((c.avail_in>0||0===c.avail_out)&&1!==i);return 1===i&&(r=4),4===r?(i=function(t){if(!t||!t.state)return-2;var e=t.state;return e.window&&(e.window=null),t.state=null,0}(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==r||(this.onEnd(0),c.avail_out=0,!0)},Ry.prototype.onData=function(t){this.chunks.push(t)},Ry.prototype.onEnd=function(t){0===t&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=function(t){var e,i,r,n,o,a;for(r=0,e=0,i=t.length;e<i;e++)r+=t[e].length;for(a=new Uint8Array(r),n=0,e=0,i=t.length;e<i;e++)o=t[e],a.set(o,n),n+=o.length;return a}(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},Sc.add("gz",(function(t){var e;t instanceof ArrayBuffer&&(t=new Uint8Array(t));try{e=function(t,e){var i=new Ry(e);if(i.push(t,!0),i.err)throw i.msg;return i.result}(t)}catch(i){e=t}return e}));var Ly="//mmtf.rcsb.org/v1.0/full/";bc.add("rcsb",new function(){this.getUrl=function(t){var e,i=Lo(t),r=i.name.substr(0,4);return!["pdb","cif"].includes(i.ext)||!1!==i.compressed&&"gz"!==i.compressed?"mmtf"===i.ext?e=i.base.endsWith(".bb")?"//mmtf.rcsb.org/v1.0/reduced/"+r:Ly+r:i.ext?(mc.warn("unsupported ext",i.ext),e=Ly+r):e=Ly+r:e="//files.rcsb.org/download/"+i.path,Co()+e},this.getExt=function(t){var e=Lo(t);if("mmtf"===e.ext||!e.ext)return"mmtf"}});var Oy="//pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/";function Ny(){this.getUrl=function(t){return t}}bc.add("pubchem",new function(){this.getUrl=function(t){var e,i=Lo(t),r=i.name;return i.ext&&"sdf"!==i.ext?(mc.warn("unsupported ext",i.ext),e=Oy+r+"/SDF?record_type=3d"):e=Oy+r+"/SDF?record_type=3d",Co()+e},this.getExt=function(t){var e=Lo(t);if(!e.ext||"sdf"===e.ext)return"sdf"}}),bc.add("ftp",new Ny),bc.add("http",new Ny),bc.add("https",new Ny);"undefined"==typeof window||window.Promise||(window.Promise=p)}).call(this,i(155).setImmediate)},155:function(t,e,i){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(n.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new o(n.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},i(156),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,i(48))},156:function(t,e,i){(function(t,e){!function(t,i){"use strict";if(!t.setImmediate){var r,n,o,a,s,c=1,u={},h=!1,l=t.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(t);p=p&&p.setTimeout?p:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick((function(){f(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,i=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=i,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){f(t.data)},r=function(t){o.port2.postMessage(t)}):l&&"onreadystatechange"in l.createElement("script")?(n=l.documentElement,r=function(t){var e=l.createElement("script");e.onreadystatechange=function(){f(t),e.onreadystatechange=null,n.removeChild(e),e=null},n.appendChild(e)}):r=function(t){setTimeout(f,0,t)}:(a="setImmediate$"+Math.random()+"$",s=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(a)&&f(+e.data.slice(a.length))},t.addEventListener?t.addEventListener("message",s,!1):t.attachEvent("onmessage",s),r=function(e){t.postMessage(a+e,"*")}),p.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),i=0;i<e.length;i++)e[i]=arguments[i+1];var n={callback:t,args:e};return u[c]=n,r(c),c++},p.clearImmediate=d}function d(t){delete u[t]}function f(t){if(h)setTimeout(f,0,t);else{var e=u[t];if(e){h=!0;try{!function(t){var e=t.callback,i=t.args;switch(i.length){case 0:e();break;case 1:e(i[0]);break;case 2:e(i[0],i[1]);break;case 3:e(i[0],i[1],i[2]);break;default:e.apply(void 0,i)}}(e)}finally{d(t),h=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,i(48),i(56))},157:function(t,e,i){"use strict";var r=i(158);t.exports=function(t){var e=typeof t;if("string"===e){var i=t;if(0===(t=+t)&&r(i))return!1}else if("number"!==e)return!1;return t-t<1}},158:function(t,e,i){"use strict";t.exports=function(t){for(var e,i=t.length,r=0;r<i;r++)if(((e=t.charCodeAt(r))<9||e>13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(e<8192||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}},42:function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return y}));var r=i(1),n=i.n(r),o=i(16),a=i(154),s=i(47),c=i(157),u=i.n(c);function h(t){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e<t.length;e++)i[e]=t[e];return i}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function p(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function d(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function f(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function m(t,e){return!e||"object"!==h(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function g(t){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function v(t,e){return(v=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var y=function(t){function e(t){var i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(i=m(this,g(e).call(this,t))).state={stage:null,orientationMatrix:null,structuresList:[]},i}var i,r,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&v(t,e)}(e,t),i=e,(r=[{key:"componentDidMount",value:function(){var t=this.props,e=t.id,i=t.stageParameters,r=t.width,n=t.height,o=function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?p(Object(i),!0).forEach((function(e){d(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):p(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({},i),s=new a.b(e,o),c=s.viewerControls.getOrientation(),h=u()(r)?r+"px":r,l=u()(n)?n+"px":n;s.setSize(h,l),this.setState({stage:s,orientationMatrix:c})}},{key:"shouldComponentUpdate",value:function(t,e){var i=this.props,r=i.stageParameters,n=i.data,o=i.downloadImage,a=i.molStyles;if(null!==n&&null!==t.data){if(void 0!==e.data)return!0;var c=t.data[0].selectedValue,u=n[0].selectedValue;if(c!==u)return!0;var h=n[0].resetView;if(c===u&&!0===h)return!0;if(!0===n[0].uploaded)return!0}return!Object(s.a)(t.molStyles,a)||!Object(s.a)(t.stageParameters,r)||t.downloadImage!==o}},{key:"componentDidUpdate",value:function(){var t=this.props,e=t.data,i=t.stageParameters,r=t.downloadImage,n=t.sideByside,o=this.state,a=o.stage,s=o.structuresList;a.setParameters(i),(void 0===r||!1===r&&"placeholder"!==e[0].selectedValue)&&(a.eachComponent((function(t){t.removeAllRepresentations()})),this.processDataFromBackend(e,s,n)),!0===r&&this.generateImage(),this.props.setProps({downloadImage:!1})}},{key:"highlightAtoms",value:function(t,e,i,r,n){""!==r&&(t.sele=e+" and @"+r,i.addRepresentation("ball+stick",t)),""!==n&&(t.sele=e+".CA and ("+n.replace(/,/g," or ")+")",i.addRepresentation("ball+stick",t))}},{key:"addMolStyle",value:function(t,e,i,r){var n=this.props.molStyles,o=l(n.representations),a=i.atoms,s=i.residues,c={sele:e,showBox:o.includes("axes+box")};":"!==e&&(c.color=r),o.forEach((function(e){var i=e;"axes+box"===i&&(i="axes"),t.addRepresentation(i,c)})),""===a&&""===s||(c.radius=n.chosenAtomsRadius,c.color=n.chosenAtomsColor,this.highlightAtoms(c,e,t,a,s))}},{key:"showStructure",value:function(t,e,i,r,n,o,s){var c=this.state,u=c.stage,h=c.orientationMatrix,l=t,p=":";if(u.viewerControls.orient(h),"ALL"===e)this.addMolStyle(t,p,r,n);else{if(p+=e,"ALL"!==i&&(p+="/0 and "+i),!0===s){var d=new a.a(p),f=t.structure.getView(d),m=(l=u.addComponentFromObject(f)).getCenter(),g=f.getPrincipalAxes();l.setRotation(g.getRotationQuaternion()),l.setPosition([0-m.x-o,0-m.y,0-m.z])}this.addMolStyle(l,p,r,n)}u.autoView()}},{key:"processDataFromBackend",value:function(t,e){for(var i=this.props.molStyles,r=this.state.stage,n=0;n<t.length;n++){var o=t[n].filename,a=n*i.molSpacingXaxis,s=i.sideByside;e.includes(o)?this.showStructure(r.getComponentsByName(o).list[0],t[n].chain,t[n].aaRange,t[n].chosen,t[n].color,a,s):this.loadData(t[n],a,s)}}},{key:"loadData",value:function(t,e,i){var r=this,n=this.state.stage,o=new Blob([t.config.input],{type:t.config.type});n.loadFile(o,{ext:t.ext,defaultRepresentation:!1}).then((function(n){n.name=t.filename,r.showStructure(n,t.chain,t.aaRange,t.chosen,t.color,e,i),r.setState((function(e){return{structuresList:e.structuresList.concat([t.filename])}}))}))}},{key:"generateImage",value:function(){var t=this.props.imageParameters;this.state.stage.makeImage({factor:1,antialias:t.antialias,trim:t.trim,transparent:t.transparent}).then((function(e){Object(a.c)(e,t.defaultFilename+".png")}))}},{key:"render",value:function(){var t=this.props.id;return n.a.createElement("div",{id:t})}}])&&f(i.prototype,r),o&&f(i,o),e}(r.Component);y.defaultProps=o.b,y.propTypes=o.c}}]);
\ No newline at end of file
+function Pp(t,e){for(var i=t.length/3,r=0,n=new Uint32Array(i),o=0;o<i;++o)n[o]=o;var a=new Int32Array(4*i),s=0,c=0;var u=function e(i,o,u,h){i>r&&(r=i);var l=h-u;if(0===l)return-1;var p=4*s;if(s+=1,1===l)return a[p]=u,a[p+1]=-1,a[p+2]=-1,a[p+3]=o,p;var d,f,m,g,v,y=u+Math.floor(l/2);c=i%3;for(var b=u,x=h-1;x>b;){for(g=t[3*n[m=b+x>>1]+c],f=n[m],n[m]=n[x],n[x]=f,v=b,d=b;d<x;++d)t[3*n[d]+c]<g&&(f=n[v],n[v]=n[d],n[d]=f,++v);if(f=n[x],n[x]=n[v],n[v]=f,y===(m=v))break;y<m?x=m-1:b=m+1}return a[p]=y,a[p+1]=e(i+1,p,u,y),a[p+2]=e(i+1,p,y+1,h),a[p+3]=o,p}(0,-1,0,i);this.rootIndex=u,this.maxDepth=r,this.nearest=function(i,r,o){var s=new Mp((function(t){return-t[1]}));!function c(u){var h,l,p=function t(e){var i=a[e+3];return-1===i?0:t(i)+1}(u)%3,d=3*n[a[u]],f=[t[d+0],t[d+1],t[d+2]],m=e(i,f);function g(t,e){s.push([t,e]),s.size()>r&&s.pop()}var v=a[u+1],y=a[u+2];if(-1!==y||-1!==v){c(h=-1===y?v:-1===v?y:i[p]<=t[d+p]?v:y),(s.size()<r||m<s.peek()[1])&&m<=o&&g(u,m);for(var b=[],x=0;x<3;x+=1)b[x]=x===p?i[x]:t[d+x];var _=e(b,f);(s.size()<r||Math.abs(_)<s.peek()[1])&&Math.abs(_)<=o&&-1!==(l=h===v?y:v)&&c(l)}else(s.size()<r||m<s.peek()[1])&&m<=o&&g(u,m)}(u);for(var c=[],h=0,l=Math.min(s.size(),r);h<l;h+=1)c.push(s.content[h]);return c},this.indices=n,this.nodes=a,this.verify=function e(i,r){var o=1;if(void 0===i&&(i=u,r=0),-1===i)throw new Error("node is null");var s=r%3,c=a[i+1],h=a[i+2];if(-1!==c){if(t[3*n[a[c]]+s]>t[3*n[a[i]]+s])throw new Error("left child is > parent!");o+=e(c,r+1)}if(-1!==h){if(t[3*n[a[h]]+s]<t[3*n[a[i]]+s])throw new Error("right child is < parent!");o+=e(h,r+1)}return o}}function Tp(t,e){var i;gc&&mc.time("Kdtree build"),i=e?function(t,e){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return i*i+r*r+n*n}:function(t,e){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return Math.sqrt(i*i+r*r+n*n)};var r=new Float32Array(3*t.atomCount),n=new Uint32Array(t.atomCount),o=0;t.eachAtom((function(t){r[o+0]=t.x,r[o+1]=t.y,r[o+2]=t.z,n[o/3]=t.index,o+=3})),this.atomIndices=n,this.points=r,this.kdtree=new Pp(r,i),gc&&mc.timeEnd("Kdtree build")}Sp.prototype={constructor:Sp,getCenterIterator:function(t){var e=this.getPosition().center,i=e.length/3,r=0,n=-1,o=[new O,new O,new O,new O];return{size:i,next:function(){var t=this.get(n);return n+=1,t},get:function(n){n=Math.min(i-1,Math.max(0,n));var a=o[r%4],s=3*n;if(a.fromArray(e,s),t){var c,u,h,l=Math.min(t,n,i-n-1);for(u=1;u<=l;++u)c=3*u,h=(l+1-u)/(l+1),a.x+=h*e[s-c+0]+h*e[s+c+0],a.y+=h*e[s-c+1]+h*e[s+c+1],a.z+=h*e[s-c+2]+h*e[s+c+2];a.x/=l+1,a.y/=l+1,a.z/=l+1}return r+=1,a},reset:function(){r=0,n=-1}}},getColor:function(t){var e=this.polymer,i=e.structure,r=e.residueCount,n=e.residueIndexStart,o=new Float32Array(3*r),a=t||{};a.structure=i;for(var s=yc.getScheme(a),c=i.getResidueProxy(),u=i.getAtomProxy(),h=0;h<r;++h)c.index=n+h,u.index=c.traceAtomIndex,s.atomColorToArray(u,o,3*h);return{color:o}},getPicking:function(){for(var t=this.polymer,e=t.structure,i=t.residueCount,r=t.residueIndexStart,n=new Float32Array(i),o=e.getResidueProxy(),a=0;a<i;++a)o.index=r+a,n[a]=o.traceAtomIndex;return{picking:new $h(n,e)}},getSize:function(t,e){for(var i=this.polymer,r=i.structure,n=i.residueCount,o=i.residueIndexStart,a=new Float32Array(n),s=new Il(t,e),c=r.getResidueProxy(),u=r.getAtomProxy(),h=0;h<n;++h)c.index=o+h,u.index=c.traceAtomIndex,a[h]=s.atomRadius(u);return{size:a}},getPosition:function(){var t,e,i,r,n,o=this.polymer,a=o.structure,s=o.residueCount,c=s-3,u=new Float32Array(3*s),h=new Float32Array(3*s),l=new Float32Array(s),p=new Float32Array(s),d=new Float32Array(s),f=new Float32Array(s),m=new Float32Array(3*s),g=new O,v=new O,y=new O,b=new O,x=new O,_=new O,w=new O,S=new O,A=new O,M=new O,P=new O,T=new O(0,0,0),E="trace",C=a.getAtomProxy(),I=a.getAtomProxy(o.getAtomIndexByType(0,E)),R=a.getAtomProxy(o.getAtomIndexByType(1,E)),L=a.getAtomProxy(o.getAtomIndexByType(2,E));for(i=0;i<c;++i)C.index=I.index,I.index=R.index,R.index=L.index,L.index=o.getAtomIndexByType(i+3,E),e=3*i,g.subVectors(I,C),v.subVectors(R,I),y.subVectors(L,R),b.subVectors(g,v),x.subVectors(v,y),A.crossVectors(b,x).normalize(),A.toArray(h,e),i>0&&(l[i]=A.angleTo(M)),t=Math.cos(b.angleTo(x)),f[i]=180/Math.PI*Math.acos(t),r=b.length(),n=x.length(),p[i]=Math.sqrt(n*r)/Math.max(2,2*(1-t)),d[i]=Math.abs(v.dot(A)),_.copy(b).multiplyScalar(p[i]/r),w.copy(x).multiplyScalar(p[i]/n),_.subVectors(I,_),w.subVectors(R,w),_.toArray(u,e+3),w.toArray(u,e+6),P.subVectors(C,T),P.toArray(m,e),M.copy(A),T.copy(_);for(_.fromArray(u,3),w.fromArray(u,6),A.subVectors(_,w).normalize(),C.index=o.getAtomIndexByType(0,E),T.copy(C),S.copy(C),wh(S,A,_),S.toArray(u,0),P.subVectors(T,_),P.toArray(m,0),_.fromArray(u,3*s-6),w.fromArray(u,3*s-9),A.subVectors(_,w).normalize(),C.index=o.getAtomIndexByType(s-1,E),T.copy(C),S.copy(C),wh(S,A,_),S.toArray(u,3*s-3),i=s-3;i<s;++i)_.fromArray(u,3*i),C.index=o.getAtomIndexByType(i,E),T.copy(C),P.subVectors(T,_),P.toArray(m,3*i);var N=new Float32Array(s),D=new Float32Array(s),k=new Float32Array(s),F=new Float32Array(s);for(N[1]=p[0],D[1]=f[0],k[1]=p[0],i=2;i<s-2;++i)N[i]=.5*(p[i-2]+p[i-1]),D[i]=.5*(f[i-2]+f[i-1]),k[i]=.5*(d[i-2]+d[i-1]),_.fromArray(h,3*(i-2)),w.fromArray(h,3*(i-1)),F[i]=180/Math.PI*Math.acos(Math.cos(_.angleTo(w)));N[s-2]=p[s-4],D[s-2]=f[s-4],k[s-2]=d[s-4];var B=new Float32Array(3*s);for(uu(h,B,0,0,3),uu(h,B,0,3,3),i=2;i<s-2;++i)_.fromArray(h,3*(i-2)),w.fromArray(h,3*(i-1)),A.addVectors(w,_).multiplyScalar(.5).normalize(),A.toArray(B,3*i);return uu(h,B,3*s-12,3*s-6,3),uu(h,B,3*s-12,3*s-3,3),{center:u,axis:B,bending:F,radius:N,rise:k,twist:D,resdir:m}}},Ap.prototype={constructor:Ap,getAxis:function(t,e,i,r,n,o){t=t||30,e=e||2.5,i=void 0!==i&&i;var a=this.polymer,s=a.structure,c=a.residueCount,u=a.residueIndexStart,h=this.position,l=r||{};l.structure=s;for(var p,d,f=yc.getScheme(l),m=new Il(n,o),g=0,v=0,y=[],b=[],x=[],_=[],w=[],S=[],A=[],M=[],P=[],T=[],E=[],C=new O,I=new O,R=s.getResidueProxy(),L=s.getResidueProxy(),N=s.getAtomProxy(),D=new O,k=new O,F=!1,B=0;B<c;++B)if(R.index=u+B,D.fromArray(h.center,3*B),B===c-1?F=!0:(L.index=u+B+1,k.fromArray(h.center,3*B+3),i&&R.sstruc!==L.sstruc?F=!0:D.distanceTo(k)>e?F=!0:h.bending[B]>t&&(F=!0)),F){if(B-g<4){g=B,F=!1;continue}N.index=R.traceAtomIndex,T=h.axis.subarray(3*g+3,3*B),E=h.center.subarray(3*g,3*B+3),p=_h(T).normalize(),d=_h(E),C.fromArray(E),wh(C,p,d),I.fromArray(E,E.length-3),wh(I,p,d),p.subVectors(I,C),p.toArray(y,v),d.toArray(b,v),C.toArray(x,v),I.toArray(_,v),f.atomColorToArray(N,w,v),S.push(N.index),A.push(m.atomRadius(N)),M.push(u+g),P.push(u+B+1-g),v+=3,g=B,F=!1}var z=new Float32Array(S);return{axis:new Float32Array(y),center:new Float32Array(b),begin:new Float32Array(x),end:new Float32Array(_),color:new Float32Array(w),picking:new $h(z,s),size:new Float32Array(A),residueOffset:M,residueCount:P}}},Mp.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;i<e;i++)if(this.content[i]===t){var r=this.content.pop();return void(i!==e-1&&(this.content[i]=r,this.scoreFunction(r)<this.scoreFunction(t)?this.bubbleUp(i):this.sinkDown(i)))}throw new Error("Node not found.")},size:function(){return this.content.length},bubbleUp:function(t){for(var e=this.content[t];t>0;){var i=Math.floor((t+1)/2)-1,r=this.content[i];if(!(this.scoreFunction(e)<this.scoreFunction(r)))break;this.content[i]=e,this.content[t]=r,t=i}},sinkDown:function(t){for(var e,i=this.content.length,r=this.content[t],n=this.scoreFunction(r);;){var o=2*(t+1),a=o-1,s=null;if(a<i){var c=this.content[a];(e=this.scoreFunction(c))<n&&(s=a)}if(o<i){var u=this.content[o];this.scoreFunction(u)<(null===s?n:e)&&(s=o)}if(null===s)break;this.content[t]=this.content[s],this.content[s]=r,t=s}}},Tp.prototype={nearest:(vp=new Float32Array(3),function(t,e,i){t.toArray?t.toArray(vp):t.positionToArray&&t.positionToArray(vp);for(var r=this.kdtree.nearest(vp,e,i),n=this.kdtree.indices,o=this.kdtree.nodes,a=this.atomIndices,s=[],c=0,u=r.length;c<u;++c){var h=r[c],l=h[0],p=h[1];s.push({index:a[n[o[l]]],distance:p})}return s})};var Ep={" ":"X","!":"Y","#":"Z",$:"-X","%":"-Y","&":"-Z","'":"Y+1/2","(":"1/2+X",")":"1/2+Y","*":"1/2-X","+":"1/2+Z",",":"1/2-Y","-":"1/2-Z",".":"X+1/2","/":"Z+1/2",0:"-X+1/2",1:"-Y+1/2",2:"-Z+1/2",3:"1/4+X",4:"1/4-Y",5:"1/4+Z",6:"1/4-X",7:"1/4+Y",8:"3/4-Y",9:"3/4+Z",":":"3/4+Y",";":"3/4+X","<":"3/4-X","=":"1/4-Z",">":"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"},Cp={"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":" !#*,#.%&$'&!# ,- '&$%/$# !-*!/$%&.%()+$%+ ,-*!-)+(%&(!-*,#*+()&$)#*,- ,"};function Ip(t){var e="";return t.length>0&&(e=":"+ko(t).join(" OR :")),new nc(e)}var Rp=function(t){this.name=t||"",this.partList=[]},Lp={type:{}};Lp.type.get=function(){return"Assembly"},Rp.prototype.addPart=function(t,e){var i=new Op(t,e);return this.partList.push(i),i},Rp.prototype._getCount=function(t,e){var i=0;return this.partList.forEach((function(r){i+=r[e](t)})),i},Rp.prototype.getAtomCount=function(t){return this._getCount(t,"getAtomCount")},Rp.prototype.getResidueCount=function(t){return this._getCount(t,"getResidueCount")},Rp.prototype.getInstanceCount=function(){var t=0;return this.partList.forEach((function(e){t+=e.matrixList.length})),t},Rp.prototype.isIdentity=function(t){if(1!==this.partList.length)return!1;var e=this.partList[0];if(1!==e.matrixList.length)return!1;if(!(new N).equals(e.matrixList[0]))return!1;var i=[];return t.eachChain((function(t){i.push(t.chainname)})),i=ko(i),e.chainList.length===i.length},Rp.prototype.getBoundingBox=function(t){var e=new jt;return this.partList.forEach((function(i){var r=i.getBoundingBox(t);e.expandByPoint(r.min),e.expandByPoint(r.max)})),e},Rp.prototype.getCenter=function(t){return this.getBoundingBox(t).getCenter()},Rp.prototype.getSelection=function(){var t=[];return this.partList.forEach((function(e){t=t.concat(e.chainList)})),Ip(t)},Object.defineProperties(Rp.prototype,Lp);var Op=function(t,e){this.matrixList=t||[],this.chainList=e||[]},Np={type:{}};function Dp(t,e){if(e){gc&&mc.time("assignSecondaryStructure");var i=[];t.eachModel((function(t){t.eachChain((function(t){i.push(t.chainname)}))}));var r=i.slice().sort(),n=[];r.forEach((function(t){n.push(i.indexOf(t))}));var o=e.helices;(o=o.filter((function(t){return No(r,t[0])>=0}))).sort((function(t,e){var i=t[0],o=e[0],a=t[1],s=e[1];if(i===o)return a===s?0:a<s?-1:1;var c=No(r,i),u=No(r,o);return n[c]<n[u]?-1:1}));var a=t.residueStore;t.eachModel((function(t){var e=0,i=o.length;if(0!==i){var r=o[e],n=!1,s=!1;t.eachChain((function(t){var c=!1;if(t.chainname===r[0])for(var u=t.residueCount,h=t.residueOffset,l=h+u,p=h;p<l;++p)if(a.resno[p]===r[1]&&a.getInscode(p)===r[2]&&(n=!0),n&&(a.sstruc[p]=r[6],a.resno[p]===r[4]&&a.getInscode(p)===r[5]&&(n=!1,(e+=1)<i?(p=h-1,r=o[e],c=t.chainname!==r[0]):s=!0)),c||s)return}))}}));var s=e.sheets;(s=s.filter((function(t){return No(r,t[0])>=0}))).sort((function(t,e){var i=t[0],o=e[0];if(i===o)return 0;var a=No(r,i),s=No(r,o);return n[a]<n[s]?-1:1}));var c="e".charCodeAt(0);t.eachModel((function(t){var e=0,i=s.length;if(0!==i){var r=s[e],n=!1,o=!1;t.eachChain((function(t){var u=!1;if(t.chainname===r[0])for(var h=t.residueCount,l=t.residueOffset,p=l+h,d=l;d<p;++d)if(a.resno[d]===r[1]&&a.getInscode(d)===r[2]&&(n=!0),n&&(a.sstruc[d]=c,a.resno[d]===r[4]&&a.getInscode(d)===r[5]&&(n=!1,(e+=1)<i?(d=l-1,r=s[e],u=t.chainname!==r[0]):o=!0)),u||o)return}))}})),gc&&mc.timeEnd("assignSecondaryStructure")}}Np.type.get=function(){return"AssemblyPart"},Op.prototype._getCount=function(t,e){var i=0,r=this.chainList;return t.eachChain((function(t){(0===r.length||r.includes(t.chainname))&&(i+=t[e])})),this.matrixList.length*i},Op.prototype.getAtomCount=function(t){return this._getCount(t,"atomCount")},Op.prototype.getResidueCount=function(t){return this._getCount(t,"residueCount")},Op.prototype.getBoundingBox=function(t){var e=new jt,i=new jt,r=this.getSelection(),n=t.getBoundingBox(r);return this.matrixList.forEach((function(t){i.copy(n).applyMatrix4(t),e.expandByPoint(i.min),e.expandByPoint(i.max)})),e},Op.prototype.getSelection=function(){return Ip(this.chainList)},Op.prototype.getView=function(t){var e=this.getSelection();return e?t.getView(e):t},Op.prototype.getInstanceList=function(){for(var t=[],e=0,i=this.matrixList.length;e<i;++e)t.push({id:e+1,name:e,matrix:this.matrixList[e]});return t},Object.defineProperties(Op.prototype,Np);var kp,Fp,Bp,zp=(kp=function(t,e,i,r){for(var n=t.structure,o=t.residueIndexStart,a=n.getResidueProxy(),s=n.getResidueProxy(),c=n.getAtomProxy(),u=n.getAtomProxy(),h=Math.max(0,e-2);h<=e;++h)for(var l=2;l<5;++l)if(!(h+l>=t.residueCount)){a.index=o+h,s.index=o+h+l,c.index=a.traceAtomIndex,u.index=s.traceAtomIndex;var p=c.distanceTo(u);if(Math.abs(p-i[l-2])>r)return!1}return!0},Fp=function(t,e){return kp(t,e,[5.45,5.18,6.37],2.1)},Bp=function(t,e){return kp(t,e,[6.1,10.4,13],1.42)},function(t){gc&&mc.time("calculateSecondaryStructure"),t.eachPolymer((function(t){if(!(t.residueCount<4)){if(t.isCg())!function(t){for(var e=t.residueStore,i=t.residueIndexStart,r=new Ap(t).position,n=new O,o=new O,a=0,s=t.residueCount;a<s;++a){n.fromArray(r.center,3*a),o.fromArray(r.center,3*a+3);var c=n.distanceTo(o);c<2&&c>1&&r.bending[a]<20&&(e.sstruc[i+a]="h".charCodeAt(0),e.sstruc[i+a+1]="h".charCodeAt(0))}}(t);else{if(!t.isProtein())return;!function(t){for(var e=t.residueStore,i=t.residueIndexStart,r=0,n=t.residueCount;r<n;++r){var o="c";Fp(t,r)?o="h":Bp(t,r)&&(o="s"),e.sstruc[i+r]=o.charCodeAt(0)}}(t)}var e,i=0;t.eachResidue((function(t){t.sstruc===e?i+=1:(1===i&&(t.index-=1,t.sstruc="c"),i=1,e=t.sstruc)}))}})),gc&&mc.timeEnd("calculateSecondaryStructure")});function Up(t){gc&&mc.time("calculateChainnames");var e=!0;if(t.eachChain((function(t){t.chainname&&(e=!1)})),e){var i="ABCDEFGHIJKLMNOPQRSTUVWXYZ",r=i.length,n=t.modelStore,o=t.chainStore,a=t.residueStore,s=function(t){for(var e=t,n=0,o=i[e%r];e>=r;)e=Math.floor(e/r),o+=i[e%r],n+=1;return n>=5&&mc.warn("chainname overflow"),o},c=t.getAtomProxy(),u=t.getAtomProxy(),h=0,l=0,p=0,d=0,f=[];1===a.count?f.push({mIndex:0,chainname:"A",rStart:0,rCount:1}):t.eachResidueN(2,(function(t,e){var i=!1,r=t.backboneType,n=e.backboneType;d=t.index,t.modelIndex!==e.modelIndex?i=!0:t.moleculeType!==e.moleculeType?i=!0:0!==r&&r===n&&(c.index=t.backboneEndAtomIndex,u.index=e.backboneStartAtomIndex,c.connectedTo(u)||(i=!0)),i||e.index!==a.count-1||(i=!0,d=e.index),i&&(f.push({mIndex:l,chainname:s(h),rStart:p,rCount:d-p+1}),h+=1,t.modelIndex!==e.modelIndex&&(h=0,l+=1),e.index===a.count-1&&d!==e.index&&f.push({mIndex:l,chainname:s(h),rStart:a.count-1,rCount:1}),p=e.index,d=e.index)})),o.count=0,f.forEach((function(t){!function(t,e,i,r){for(var s=o.count,c=0;c<r;++c)a.chainIndex[i+c]=s;o.growIfFull(),o.modelIndex[s]=t,o.setChainname(s,e),o.setChainid(s,e),o.residueOffset[s]=i,o.residueCount[s]=r,o.count+=1,n.chainCount[t]+=1}(t.mIndex,t.chainname,t.rStart,t.rCount)}));var m=0;t.eachModel((function(t){n.chainOffset[t.index]=m,n.chainCount[t.index]-=1,m+=n.chainCount[t.index]}))}gc&&mc.timeEnd("calculateChainnames")}function jp(t){gc&&mc.time("calculateBonds"),Gp(t),Vp(t),gc&&mc.timeEnd("calculateBonds")}function Gp(t,e){gc&&mc.time("calculateBondsWithin");var i=t.bondStore,r=t.rungBondStore,n=t.getAtomSet(!1),o=t.getAtomProxy(),a=t.getAtomProxy(),s=t.getBondProxy(),c=e?null:function(t){gc&&mc.time("calculateAtomBondMap");var e=[];return t.eachBond((function(t){var i=t.atomIndex1,r=t.atomIndex2;void 0===e[i]&&(e[i]=[]),e[i][r]=t.index})),gc&&mc.timeEnd("calculateAtomBondMap"),e}(t);t.eachResidue((function(t){if(!e){var u=t.atomCount,h=t.atomOffset;if(u>500)return void mc.warn("more than 500 atoms, skip residue for auto-bonding",t.qualifiedName());for(var l=t.getBonds(),p=l.atomIndices1,d=l.atomIndices2,f=l.bondOrders,m=p.length,g=0;g<m;++g){var v=p[g]+h,y=d[g]+h,b=c[v];if(void 0!==b&&void 0!==(b=b[y]))s.index=b,f[t.residueType.getBondIndex(v,y)]=s.bondOrder;else o.index=v,a.index=y,i.addBond(o,a,f[g])}}var x=t.residueType.traceAtomIndex,_=t.residueType.rungEndAtomIndex;-1!==x&&-1!==_&&(o.index=t.traceAtomIndex,a.index=t.rungEndAtomIndex,r.addBond(o,a),n.set(o.index),n.set(a.index))})),t.atomSetDict.rung=n,gc&&mc.timeEnd("calculateBondsWithin")}function Vp(t,e){gc&&mc.time("calculateBondsBetween");var i=t.bondStore,r=t.backboneBondStore,n=t.getAtomSet(!1),o=t.getAtomProxy(),a=t.getAtomProxy();function s(t,s){var c=t.backboneType,u=s.backboneType;0!==c&&c===u&&(o.index=t.backboneEndAtomIndex,a.index=s.backboneStartAtomIndex,o.connectedTo(a)&&(e||i.addBond(o,a,1),o.index=t.traceAtomIndex,a.index=s.traceAtomIndex,r.addBond(o,a),n.set(o.index),n.set(a.index)))}0===r.count&&r.resize(t.residueStore.count),t.eachResidueN(2,s);var c=t.getResidueProxy(),u=t.getResidueProxy();t.eachChain((function(t){0!==t.residueCount&&(c.index=t.residueOffset,u.index=t.residueOffset+t.residueCount-1,s(u,c))})),t.atomSetDict.backbone=n,gc&&mc.timeEnd("calculateBondsBetween")}function $p(t){if(t.unitcell){gc&&mc.time("buildUnitcellAssembly");var e=t.unitcell,i=t.center.clone().applyMatrix4(e.cartToFrac),r=function(t){var e=Cp[t],i={};if(void 0===e)return console.warn("getSymmetryOperations: spacegroup '"+t+"' not found in symop library"),i;for(var r=[],n=0,o=e.length;n<o;n+=3){for(var a=[],s=0;s<3;++s)a.push(Ep[e[n+s]]);r.push(a)}var c=/^[1-9]$/;return r.forEach((function(t){var e=0,r=(new N).set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1),n=r.elements;i[t]=r,t.forEach((function(t){for(var i=!1,r=!1,o=0,a=t.length;o<a;++o){var s=t[o];if("-"===s)i=!0;else if("+"===s)i=!1;else if("/"===s)r=!0;else if("X"===s)n[0+e]=i?-1:1;else if("Y"===s)n[4+e]=i?-1:1;else if("Z"===s)n[8+e]=i?-1:1;else if(c.test(s)){var u=parseInt(s);r?n[12+e]/=u:n[12+e]=u}else mc.warn('getSymmetryOperations: unknown token "'+s+'"')}e+=1}))})),i}(e.spacegroup),n=new O,o=new O,a=new O;i.x>1&&(n.x-=1),i.x<0&&(n.x+=1),i.y>1&&(n.y-=1),i.y<0&&(n.y+=1),i.z>1&&(n.z-=1),i.z<0&&(n.z+=1);var s,c=new Rp("UNITCELL"),u=m();if(t.biomolDict.NCS){s=[new N].concat(t.biomolDict.NCS.partList[0].matrixList);var h=[];u.forEach((function(t){s.forEach((function(e){h.push(t.clone().multiply(e))}))})),c.addPart(h)}else c.addPart(u);var l=new O,p=new Rp("SUPERCELL"),d=Array.prototype.concat.call(m(l.set(1,0,0)),m(l.set(0,1,0)),m(l.set(0,0,1)),m(l.set(-1,0,0)),m(l.set(0,-1,0)),m(l.set(0,0,-1)),m(l.set(1,1,0)),m(l.set(1,0,1)),m(l.set(0,1,1)),m(l.set(-1,-1,0)),m(l.set(-1,0,-1)),m(l.set(0,-1,-1)),m(l.set(1,-1,-1)),m(l.set(1,1,-1)),m(l.set(1,-1,1)),m(l.set(-1,1,1)),m(l.set(-1,-1,1)),m(l.set(-1,1,-1)),m(l.set(0,1,-1)),m(l.set(0,-1,1)),m(l.set(1,0,-1)),m(l.set(-1,0,1)),m(l.set(1,-1,0)),m(l.set(-1,1,0)),m(),m(l.set(1,1,1)),m(l.set(-1,-1,-1)));if(t.biomolDict.NCS){var f=[];d.forEach((function(t){s.forEach((function(e){f.push(t.clone().multiply(e))}))})),p.addPart(f)}else p.addPart(d);t.biomolDict.UNITCELL=c,t.biomolDict.SUPERCELL=p,gc&&mc.timeEnd("buildUnitcellAssembly")}function m(t){var s=[];return Object.keys(r).forEach((function(c){var u=r[c].clone();o.copy(i).applyMatrix4(u),a.setFromMatrixPosition(u),a.sub(n),o.x>1&&(a.x-=1),o.x<0&&(a.x+=1),o.y>1&&(a.y-=1),o.y<0&&(a.y+=1),o.z>1&&(a.z-=1),o.z<0&&(a.z+=1),t&&a.add(t),u.setPosition(a),u.multiplyMatrices(e.fracToCart,u),u.multiply(e.cartToFrac),s.push(u)})),s}}var Hp=["H","C","O","N","S","P"],Wp=["NA","CL","FE"];function Xp(t){var e=t.trim().toUpperCase();parseInt(e.charAt(0))&&(e=e.substr(1)),parseInt(e.charAt(0))&&(e=e.substr(1));var i=e.length;if(0===i)return"";if(1===i)return e;if(2===i){if(-1!==Wp.indexOf(e))return e;if(-1!==Hp.indexOf(e[0]))return e[0]}return i>=3&&-1!==Hp.indexOf(e[0])?e[0]:""}function qp(t){var e=t.bondHash,i=e.countArray,r=e.offsetArray,n=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=r[e],p=0,d=i[e];p<d;++p){o.index=n[l+p];var f=o.atomIndex1,m=o.atomIndex2;if(f>m){var g=m;m=f,f=g}var v=f+"|"+m;void 0===h[v]&&(h[v]=!0,s.push(f-a),c.push(m-a),u.push(o.bondOrder))}})),e.bonds={atomIndices1:s,atomIndices2:c,bondOrders:u}}}))}var Yp=function(t,e,i){this.structure=t,i=i||Xp(e),this.atomname=e,this.element=i,this.vdw=ml[i],this.covalent=gl[i]};var Zp=function(t){this.structure=t,this.dict={},this.list=[]};Zp.prototype.add=function(t,e){var i=function(t,e){return t+"|"+e}(t=t.toUpperCase(),e=e?e.toUpperCase():Xp(t)),r=this.dict[i];if(void 0===r){var n=new Yp(this.structure,t,e);r=this.list.length,this.dict[i]=r,this.list.push(n)}return r},Zp.prototype.get=function(t){return this.list[t]};var Kp=function(t,e,i,r,n,o){this.structure=t,this.resname=e,this.atomTypeIdList=i,this.hetero=r?1:0,this.chemCompType=n,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=Cl[this.backboneType],s=Cl[this.backboneStartType],c=Cl[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 p=this.getAtomIndexByName(s.backboneStart);this.backboneStartAtomIndex=void 0!==p?p:-1;var d,f=this.getAtomIndexByName(c.backboneEnd);this.backboneEndAtomIndex=void 0!==f?f:-1,d=Sl.includes(e)?this.getAtomIndexByName("N1"):this.getAtomIndexByName("N3"),this.rungEndAtomIndex=void 0!==d?d:-1,this.bondReferenceAtomIndices=[]};Kp.prototype.getBackboneIndexList=function(){var t,e=[];switch(this.moleculeType){case 3:t=Tl;break;case 4:case 5:t=El;break;default:return e}for(var i=this.structure.atomMap,r=this.atomTypeIdList,n=0,o=this.atomCount;n<o;++n){var a=i.get(r[n]);t.includes(a.atomname)&&e.push(n)}return e},Kp.prototype.getMoleculeType=function(){return this.isProtein()?3:this.isRna()?4:this.isDna()?5:this.isWater()?1:this.isIon()?2:this.isSaccharide()?6:0},Kp.prototype.getBackboneType=function(t){return this.hasProteinBackbone(t)?1:this.hasRnaBackbone(t)?2:this.hasDnaBackbone(t)?3:this.hasCgProteinBackbone(t)?4:this.hasCgRnaBackbone(t)?5:this.hasCgDnaBackbone(t)?6:0},Kp.prototype.isProtein=function(){return this.chemCompType?sl.includes(this.chemCompType):this.hasAtomWithName("CA","C","N")||xl.includes(this.resname)},Kp.prototype.isCg=function(){var t=this.backboneType;return 4===t||5===t||6===t},Kp.prototype.isNucleic=function(){return this.isRna()||this.isDna()},Kp.prototype.isRna=function(){return this.chemCompType?cl.includes(this.chemCompType):this.hasAtomWithName(["P","O3'","O3*"],["C4'","C4*"],["O2'","O2*","F2'","F2*"])||_l.includes(this.resname)&&this.hasAtomWithName(["O2'","O2*","F2'","F2*"])},Kp.prototype.isDna=function(){return this.chemCompType?ul.includes(this.chemCompType):this.hasAtomWithName(["P","O3'","O3*"],["C3'","C3*"])&&!this.hasAtomWithName(["O2'","O2*","F2'","F2*"])||wl.includes(this.resname)},Kp.prototype.isHetero=function(){return 1===this.hetero},Kp.prototype.isIon=function(){return Ml.includes(this.resname)},Kp.prototype.isWater=function(){return Al.includes(this.resname)},Kp.prototype.isSaccharide=function(){return this.chemCompType?hl.includes(this.chemCompType):Pl.includes(this.resname)},Kp.prototype.hasBackboneAtoms=function(t,e){var i=Cl[e];return-1===t?this.hasAtomWithName(i.trace,i.backboneEnd,i.direction1,i.direction2):0===t?this.hasAtomWithName(i.trace,i.direction1,i.direction2):1===t?this.hasAtomWithName(i.trace,i.backboneStart,i.direction1,i.direction2):this.hasAtomWithName(i.trace,i.backboneStart,i.backboneEnd,i.direction1,i.direction2)},Kp.prototype.hasProteinBackbone=function(t){return this.isProtein()&&this.hasBackboneAtoms(t,1)},Kp.prototype.hasRnaBackbone=function(t){return this.isRna()&&this.hasBackboneAtoms(t,2)},Kp.prototype.hasDnaBackbone=function(t){return this.isDna()&&this.hasBackboneAtoms(t,3)},Kp.prototype.hasCgProteinBackbone=function(t){return this.isProtein()&&this.hasBackboneAtoms(t,4)},Kp.prototype.hasCgRnaBackbone=function(t){return this.isRna()&&this.hasBackboneAtoms(t,5)},Kp.prototype.hasCgDnaBackbone=function(t){return this.isDna()&&this.hasBackboneAtoms(t,6)},Kp.prototype.hasBackbone=function(t){return this.hasProteinBackbone(t)||this.hasRnaBackbone(t)||this.hasDnaBackbone(t)||this.hasCgProteinBackbone(t)||this.hasCgRnaBackbone(t)||this.hasCgDnaBackbone(t)},Kp.prototype.getAtomIndexByName=function(t){var e=this.atomCount,i=this.structure.atomMap,r=this.atomTypeIdList;if(Array.isArray(t))for(var n=0;n<e;++n){var o=r[n];if(t.includes(i.get(o).atomname))return n}else for(var a=0;a<e;++a){var s=r[a];if(t===i.get(s).atomname)return a}},Kp.prototype.hasAtomWithName=function(){for(var t=arguments,e=this,i=arguments.length,r=0;r<i;++r)if(void 0!==t[r]&&void 0===e.getAtomIndexByName(t[r]))return!1;return!0},Kp.prototype.getBonds=function(t){return void 0===this.bonds&&(this.bonds=function(t){var e=t.structure,i=e.getAtomProxy(),r=e.getAtomProxy(),n=t.atomCount,o=t.atomOffset,a=o+n-1;if(!(n>500)){var s,c,u=[],h=[],l=[];if(n>50){var p=new Tp(t,!0),d=t.isCg()?1.2:2.3;for(s=o;s<a;++s){i.index=s;var f=i.covalent+d+.3,m=p.nearest(i,1/0,f*f),g=m.length;for(c=0;c<g;++c)r.index=m[c].index,i.index<r.index&&i.connectedTo(r)&&(u.push(i.index-o),h.push(r.index-o),l.push(1))}}else for(s=o;s<a;++s)for(i.index=s,c=s+1;c<=a;++c)r.index=c,i.connectedTo(r)&&(u.push(s-o),h.push(c-o),l.push(1));return{atomIndices1:u,atomIndices2:h,bondOrders:l}}gc&&mc.warn("more than 500 atoms, skip residue for auto-bonding",t.qualifiedName())}(t)),this.bonds},Kp.prototype.getRings=function(){return void 0===this.rings&&this.calculateRings(),this.rings},Kp.prototype.getBondGraph=function(){return void 0===this.bondGraph&&this.calculateBondGraph(),this.bondGraph},Kp.prototype.calculateBondGraph=function(){for(var t=this.bondGraph={},e=this.getBonds(),i=e.atomIndices1.length,r=e.atomIndices1,n=e.atomIndices2,o=0;o<i;++o){var a=r[o],s=n[o];(t[a]=t[a]||[]).push(s),(t[s]=t[s]||[]).push(a)}},Kp.prototype.calculateRings=function(){var t=this.getBondGraph(),e=new Int8Array(this.atomCount),i=new Int8Array(this.atomCount),r=[],n=[];function o(a,s,c){if(e[a])throw new Error("DFS revisited atom");e[a]=1,n.push(a);for(var u=s.length,h=0;h<u;++h){var l=s[h];if(0===e[l])t[l]&&t[l].length>=2?o(l,t[l],a):e[l]=2;else if(1===e[l]&&c&&c!==l){var p=[l];i[l]=1,r.push(p);for(var d=n.length-1;d>=0;--d){var f=n[d];if(f===l)break;p.push(f),i[f]=1}}}e[a]=2,n.pop()}for(var a=0;a<this.atomCount;++a)if(!e[a]){var s=t[a];!s||s.length<2?e[a]=2:(n.length=0,o(a,s))}this.rings={flags:i,rings:r}},Kp.prototype.assignBondReferenceAtomIndices=function(){var t=this.getBondGraph(),e=this.getRings(),i=e.flags,r=e.rings,n=this.bonds.atomIndices1,o=this.bonds.atomIndices2,a=this.bonds.bondOrders,s=this.bondReferenceAtomIndices,c=this.bonds.atomIndices1.length;s.length=0;for(var u=0;u<c;++u)if(!(a[u]<=1)){var h=n[u],l=o[u];if(i[h]&&i[l]){for(var p=0;p<r.length&&void 0===s[u];++p)for(var d=r[p],f=null,m=!1,g=0;g<d.length;++g){var v=d[g];if(v===h||v===l?m=!0:f=v,m&&null!==f){s[u]=f;break}}if(void 0!==s[u])continue}if(t[h].length>1)for(var y=0;y<t[h].length;++y){var b=t[h][y];if(b!==l){s[u]=b;break}}else if(t[l].length>1)for(var x=0;x<t[l].length;++x){var _=t[l][x];if(_!==h){s[u]=_;break}}else;}},Kp.prototype.getBondIndex=function(t,e){for(var i=this.bonds,r=i.atomIndices1,n=i.atomIndices2,o=r.indexOf(t),a=n.indexOf(e),s=a;-1!==o;){for(;-1!==a;){if(o===a)return o;a=n.indexOf(e,a+1)}o=r.indexOf(t,o+1),a=s}},Kp.prototype.getBondReferenceAtomIndex=function(t,e){var i=this.getBondIndex(t,e);if(void 0!==i)return 0===this.bondReferenceAtomIndices.length&&this.assignBondReferenceAtomIndices(),this.bondReferenceAtomIndices[i]};var Qp=function(t){this.structure=t,this.dict={},this.list=[]};Qp.prototype.add=function(t,e,i,r,n){var o=function(t,e,i,r){return t+"|"+e.join(",")+"|"+(i?1:0)+"|"+(r||"")}(t=t.toUpperCase(),e,i,r),a=this.dict[o];if(void 0===a){var s=new Kp(this.structure,t,e,i,r,n);a=this.list.length,this.dict[o]=a,this.list.push(s)}return a},Qp.prototype.get=function(t){return this.list[t]};var Jp=function(t,e){this.structure=t,this.bondStore=t.bondStore,this.index=e,this._v12=new O,this._v13=new O,this._ap1=this.structure.getAtomProxy(),this._ap2=this.structure.getAtomProxy(),this._ap3=this.structure.getAtomProxy()},td={atom1:{},atom2:{},atomIndex1:{},atomIndex2:{},bondOrder:{}};td.atom1.get=function(){return this.structure.getAtomProxy(this.atomIndex1)},td.atom2.get=function(){return this.structure.getAtomProxy(this.atomIndex2)},td.atomIndex1.get=function(){return this.bondStore.atomIndex1[this.index]},td.atomIndex1.set=function(t){this.bondStore.atomIndex1[this.index]=t},td.atomIndex2.get=function(){return this.bondStore.atomIndex2[this.index]},td.atomIndex2.set=function(t){this.bondStore.atomIndex2[this.index]=t},td.bondOrder.get=function(){return this.bondStore.bondOrder[this.index]},td.bondOrder.set=function(t){this.bondStore.bondOrder[this.index]=t},Jp.prototype.getReferenceAtomIndex=function(){var t=this._ap1,e=this._ap2;if(t.index=this.atomIndex1,e.index=this.atomIndex2,t.residueIndex===e.residueIndex){var i=t.index-t.residueAtomOffset,r=e.index-e.residueAtomOffset,n=t.residueType.getBondReferenceAtomIndex(i,r);if(void 0!==n)return n+t.residueAtomOffset;console.warn("No reference atom found",t.index,e.index)}},Jp.prototype.calculateShiftDir=function(t){t||(t=new O);var e=this._ap1,i=this._ap2,r=this._ap3,n=this._v12,o=this._v13;e.index=this.atomIndex1,i.index=this.atomIndex2;var a=this.getReferenceAtomIndex();n.subVectors(e,i).normalize(),void 0!==a?(r.index=a,o.subVectors(e,r)):o.copy(e),o.normalize();var s=n.dot(o);return 1-Math.abs(s)<1e-5&&(o.set(1,0,0),s=n.dot(o),1-Math.abs(s)<1e-5&&(o.set(0,1,0),s=n.dot(o))),t.copy(o.sub(n.multiplyScalar(s))).normalize()},Jp.prototype.qualifiedName=function(){return this.atomIndex1+"="+this.atomIndex2},Jp.prototype.clone=function(){return new this.constructor(this.structure,this.index)},Jp.prototype.toObject=function(){return{atomIndex1:this.atomIndex1,atomIndex2:this.atomIndex2,bondOrder:this.bondOrder}},Object.defineProperties(Jp.prototype,td);var ed=function(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},id={bondHash:{},entity:{},entityIndex:{},modelIndex:{},chainIndex:{},residue:{},residueIndex:{},sstruc:{},inscode:{},resno:{},chainname:{},chainid:{},residueType:{},atomType:{},residueAtomOffset:{},resname:{},hetero:{},atomname:{},element:{},vdw:{},covalent:{},x:{},y:{},z:{},serial:{},bfactor:{},occupancy:{},altloc:{}};id.bondHash.get=function(){return this.structure.bondHash},id.entity.get=function(){return this.structure.entityList[this.entityIndex]},id.entityIndex.get=function(){return this.chainStore.entityIndex[this.chainIndex]},id.modelIndex.get=function(){return this.chainStore.modelIndex[this.chainIndex]},id.chainIndex.get=function(){return this.residueStore.chainIndex[this.residueIndex]},id.residue.get=function(){return console.warn("residue - might be expensive"),this.structure.getResidueProxy(this.residueIndex)},id.residueIndex.get=function(){return this.atomStore.residueIndex[this.index]},id.residueIndex.set=function(t){this.atomStore.residueIndex[this.index]=t},id.sstruc.get=function(){return this.residueStore.getSstruc(this.residueIndex)},id.inscode.get=function(){return this.residueStore.getInscode(this.residueIndex)},id.resno.get=function(){return this.residueStore.resno[this.residueIndex]},id.chainname.get=function(){return this.chainStore.getChainname(this.chainIndex)},id.chainid.get=function(){return this.chainStore.getChainid(this.chainIndex)},id.residueType.get=function(){return this.residueMap.get(this.residueStore.residueTypeId[this.residueIndex])},id.atomType.get=function(){return this.atomMap.get(this.atomStore.atomTypeId[this.index])},id.residueAtomOffset.get=function(){return this.residueStore.atomOffset[this.residueIndex]},id.resname.get=function(){return this.residueType.resname},id.hetero.get=function(){return this.residueType.hetero},id.atomname.get=function(){return this.atomType.atomname},id.element.get=function(){return this.atomType.element},id.vdw.get=function(){return this.atomType.vdw},id.covalent.get=function(){return this.atomType.covalent},id.x.get=function(){return this.atomStore.x[this.index]},id.x.set=function(t){this.atomStore.x[this.index]=t},id.y.get=function(){return this.atomStore.y[this.index]},id.y.set=function(t){this.atomStore.y[this.index]=t},id.z.get=function(){return this.atomStore.z[this.index]},id.z.set=function(t){this.atomStore.z[this.index]=t},id.serial.get=function(){return this.atomStore.serial[this.index]},id.serial.set=function(t){this.atomStore.serial[this.index]=t},id.bfactor.get=function(){return this.atomStore.bfactor[this.index]},id.bfactor.set=function(t){this.atomStore.bfactor[this.index]=t},id.occupancy.get=function(){return this.atomStore.occupancy[this.index]},id.occupancy.set=function(t){this.atomStore.occupancy[this.index]=t},id.altloc.get=function(){return this.atomStore.getAltloc(this.index)},id.altloc.set=function(t){this.atomStore.setAltloc(this.index,t)},ed.prototype.eachBond=function(t,e){e=e||this.structure._bp;for(var i=this.index,r=this.bondHash,n=r.indexArray,o=r.countArray[i],a=r.offsetArray[i],s=0;s<o;++s)e.index=n[a+s],t(e)},ed.prototype.eachBondedAtom=function(t,e){e=e||this.structure._ap;var i=this.index;this.eachBond((function(r){i!==r.atomIndex1?e.index=r.atomIndex1:e.index=r.atomIndex2,t(e)}))},ed.prototype.isBackbone=function(){var t=this.residueType.backboneIndexList;if(t.length>0){var e=this.residueStore.atomOffset[this.residueIndex];return t.includes(this.index-e)}return!1},ed.prototype.isPolymer=function(){if(this.structure.entityList.length>0)return this.entity.isPolymer();var t=this.residueType.moleculeType;return 3===t||4===t||5===t},ed.prototype.isSidechain=function(){return this.isPolymer()&&!this.isBackbone()},ed.prototype.isCg=function(){var t=this.residueType.backboneType;return 4===t||5===t||6===t},ed.prototype.isHetero=function(){return 1===this.residueType.hetero},ed.prototype.isProtein=function(){return 3===this.residueType.moleculeType},ed.prototype.isNucleic=function(){var t=this.residueType.moleculeType;return 4===t||5===t},ed.prototype.isRna=function(){return 4===this.residueType.moleculeType},ed.prototype.isDna=function(){return 5===this.residueType.moleculeType},ed.prototype.isWater=function(){return 1===this.residueType.moleculeType},ed.prototype.isIon=function(){return 2===this.residueType.moleculeType},ed.prototype.isSaccharide=function(){return 6===this.residueType.moleculeType},ed.prototype.isHelix=function(){return pl.includes(this.sstruc)},ed.prototype.isSheet=function(){return dl.includes(this.sstruc)},ed.prototype.isTurn=function(){return fl.includes(this.sstruc)&&this.isProtein()},ed.prototype.isBonded=function(){return 0!==this.bondHash.countArray[this.index]},ed.prototype.isRing=function(){return 1===this.residueType.getRings().flags[this.index-this.residueAtomOffset]},ed.prototype.distanceTo=function(t){var e=this.atomStore,i=t.atomStore,r=this.index,n=t.index,o=e.x[r]-i.x[n],a=e.y[r]-i.y[n],s=e.z[r]-i.z[n],c=o*o+a*a+s*s;return Math.sqrt(c)},ed.prototype.connectedTo=function(t){var e=this.atomStore,i=t.atomStore,r=this.index,n=t.index;if(e.altloc&&i.altloc){var o=e.altloc[r],a=i.altloc[n];if(0!==o&&0!==a&&32!==o&&32!==a&&o!==a)return!1}var s=e.x[r]-i.x[n],c=e.y[r]-i.y[n],u=e.z[r]-i.z[n],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,p=l+.3,d=l-.5;return h<p*p&&h>d*d},ed.prototype.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},ed.prototype.positionToArray=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.index,r=this.atomStore;return t[e+0]=r.x[i],t[e+1]=r.y[i],t[e+2]=r.z[i],t},ed.prototype.positionToVector3=function(t){return void 0===t&&(t=new O),t.x=this.x,t.y=this.y,t.z=this.z,t},ed.prototype.positionFromVector3=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},ed.prototype.getResidueBonds=function(t){var e,i,r,n,o=this.residueAtomOffset,a=this.index-this.residueAtomOffset,s=this.residueType.getBonds(),c=s.atomIndices1,u=s.atomIndices2;for(t||(n=[]),e=c.indexOf(a);-1!==e;){if(r=u[e]+o,t)return r;n.push(r),e=c.indexOf(a,e+1)}for(i=u.indexOf(a);-1!==i;){if(r=c[i]+o,t)return r;n.push(r),i=u.indexOf(a,i+1)}return n},ed.prototype.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},ed.prototype.clone=function(){return new this.constructor(this.structure,this.index)},ed.prototype.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}},Object.defineProperties(ed.prototype,id);var rd=function(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},nd={entity:{},entityIndex:{},chain:{},chainIndex:{},atomOffset:{},atomCount:{},atomEnd:{},modelIndex:{},chainname:{},chainid:{},resno:{},sstruc:{},inscode:{},residueType:{},resname:{},hetero:{},moleculeType:{},backboneType:{},backboneStartType:{},backboneEndType:{},traceAtomIndex:{},direction1AtomIndex:{},direction2AtomIndex:{},backboneStartAtomIndex:{},backboneEndAtomIndex:{},rungEndAtomIndex:{}};nd.entity.get=function(){return this.structure.entityList[this.entityIndex]},nd.entityIndex.get=function(){return this.chainStore.entityIndex[this.chainIndex]},nd.chain.get=function(){return this.structure.getChainProxy(this.chainIndex)},nd.chainIndex.get=function(){return this.residueStore.chainIndex[this.index]},nd.chainIndex.set=function(t){this.residueStore.chainIndex[this.index]=t},nd.atomOffset.get=function(){return this.residueStore.atomOffset[this.index]},nd.atomOffset.set=function(t){this.residueStore.atomOffset[this.index]=t},nd.atomCount.get=function(){return this.residueStore.atomCount[this.index]},nd.atomCount.set=function(t){this.residueStore.atomCount[this.index]=t},nd.atomEnd.get=function(){return this.atomOffset+this.atomCount-1},nd.modelIndex.get=function(){return this.chainStore.modelIndex[this.chainIndex]},nd.chainname.get=function(){return this.chainStore.getChainname(this.chainIndex)},nd.chainid.get=function(){return this.chainStore.getChainid(this.chainIndex)},nd.resno.get=function(){return this.residueStore.resno[this.index]},nd.resno.set=function(t){this.residueStore.resno[this.index]=t},nd.sstruc.get=function(){return this.residueStore.getSstruc(this.index)},nd.sstruc.set=function(t){this.residueStore.setSstruc(this.index,t)},nd.inscode.get=function(){return this.residueStore.getInscode(this.index)},nd.inscode.set=function(t){this.residueStore.getInscode(this.index,t)},nd.residueType.get=function(){return this.residueMap.get(this.residueStore.residueTypeId[this.index])},nd.resname.get=function(){return this.residueType.resname},nd.hetero.get=function(){return this.residueType.hetero},nd.moleculeType.get=function(){return this.residueType.moleculeType},nd.backboneType.get=function(){return this.residueType.backboneType},nd.backboneStartType.get=function(){return this.residueType.backboneStartType},nd.backboneEndType.get=function(){return this.residueType.backboneEndType},nd.traceAtomIndex.get=function(){return this.residueType.traceAtomIndex+this.atomOffset},nd.direction1AtomIndex.get=function(){return this.residueType.direction1AtomIndex+this.atomOffset},nd.direction2AtomIndex.get=function(){return this.residueType.direction2AtomIndex+this.atomOffset},nd.backboneStartAtomIndex.get=function(){return this.residueType.backboneStartAtomIndex+this.atomOffset},nd.backboneEndAtomIndex.get=function(){return this.residueType.backboneEndAtomIndex+this.atomOffset},nd.rungEndAtomIndex.get=function(){return this.residueType.rungEndAtomIndex+this.atomOffset},rd.prototype.eachAtom=function(t,e){var i,r=this.atomCount,n=this.atomOffset,o=this.structure._ap,a=n+r;if(e&&e.atomOnlyTest){var s=e.atomOnlyTest;for(i=n;i<a;++i)o.index=i,s(o)&&t(o)}else for(i=n;i<a;++i)o.index=i,t(o)},rd.prototype.isProtein=function(){return 3===this.residueType.moleculeType},rd.prototype.isNucleic=function(){var t=this.residueType.moleculeType;return 4===t||5===t},rd.prototype.isRna=function(){return 4===this.residueType.moleculeType},rd.prototype.isDna=function(){return 5===this.residueType.moleculeType},rd.prototype.isCg=function(){var t=this.residueType.backboneType;return 4===t||5===t||6===t},rd.prototype.isPolymer=function(){if(this.structure.entityList.length>0)return this.entity.isPolymer();var t=this.residueType.moleculeType;return 3===t||4===t||5===t},rd.prototype.isHetero=function(){return 1===this.residueType.hetero},rd.prototype.isWater=function(){return 1===this.residueType.moleculeType},rd.prototype.isIon=function(){return 2===this.residueType.moleculeType},rd.prototype.isSaccharide=function(){return 6===this.residueType.moleculeType},rd.prototype.isHelix=function(){return pl.includes(this.sstruc)},rd.prototype.isSheet=function(){return dl.includes(this.sstruc)},rd.prototype.isTurn=function(){return fl.includes(this.sstruc)&&this.isProtein()},rd.prototype.getAtomType=function(t){return this.atomMap.get(this.atomStore.atomTypeId[t])},rd.prototype.getResname1=function(){return bl[this.resname.toUpperCase()]||"X"},rd.prototype.getBackboneType=function(t){switch(t){case-1:return this.residueType.backboneStartType;case 1:return this.residueType.backboneEndType;default:return this.residueType.backboneType}},rd.prototype.getAtomIndexByName=function(t){var e=this.residueType.getAtomIndexByName(t);return void 0!==e&&(e+=this.atomOffset),e},rd.prototype.getAtomByName=function(t){return this.residueType.getAtomByName(t)},rd.prototype.hasAtomWithName=function(t){return this.residueType.hasAtomWithName(t)},rd.prototype.getAtomnameList=function(){console.warn("getAtomnameList - might be expensive");for(var t=this.atomCount,e=this.atomOffset,i=new Array(t),r=0;r<t;++r)i[r]=this.getAtomType(e+r).atomname;return i},rd.prototype.connectedTo=function(t){var e=this.structure.getAtomProxy(this.backboneEndAtomIndex),i=this.structure.getAtomProxy(t.backboneStartAtomIndex);return!(!e||!i)&&e.connectedTo(i)},rd.prototype.getNextConnectedResidue=function(){var t=this.chainStore.residueOffset[this.chainIndex],e=this.chainStore.residueCount[this.chainIndex],i=this.index+1;if(i<t+e){var r=this.structure.getResidueProxy(i);if(this.connectedTo(r))return r}else if(i===t+e){var n=this.structure.getResidueProxy(t);if(this.connectedTo(n))return n}},rd.prototype.getPreviousConnectedResidue=function(){var t=this.chainStore.residueOffset[this.chainIndex],e=this.index-1;if(e>=t){var i=this.structure.getResidueProxy(e);if(i.connectedTo(this))return i}else if(e===t-1){var r=this.chainStore.residueCount[this.chainIndex],n=this.structure.getResidueProxy(t+r-1);if(n.connectedTo(this))return n}},rd.prototype.getBonds=function(){return this.residueType.getBonds(this)},rd.prototype.getRings=function(){return this.residueType.getRings()},rd.prototype.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},rd.prototype.clone=function(){return new this.constructor(this.structure,this.index)},rd.prototype.toObject=function(){return{index:this.index,chainIndex:this.chainIndex,atomOffset:this.atomOffset,atomCount:this.atomCount,resno:this.resno,resname:this.resname,sstruc:this.sstruc}},Object.defineProperties(rd.prototype,nd);var od=function(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 r=this.structure.getResidueProxy(this.residueIndexStart),n=this.structure.getResidueProxy(this.residueIndexEnd);this.isPrevConnected=void 0!==r.getPreviousConnectedResidue();var o=n.getNextConnectedResidue();this.isNextConnected=void 0!==o,this.isNextNextConnected=this.isNextConnected&&void 0!==o.getNextConnectedResidue(),this.isCyclic=n.connectedTo(r),this.__residueProxy=this.structure.getResidueProxy()},ad={chainIndex:{},modelIndex:{},chainname:{}};ad.chainIndex.get=function(){return this.residueStore.chainIndex[this.residueIndexStart]},ad.modelIndex.get=function(){return this.chainStore.modelIndex[this.chainIndex]},ad.chainname.get=function(){return this.chainStore.getChainname(this.chainIndex)},od.prototype.isProtein=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isProtein()},od.prototype.isCg=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isCg()},od.prototype.isNucleic=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.isNucleic()},od.prototype.getMoleculeType=function(){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.moleculeType},od.prototype.getBackboneType=function(t){return this.__residueProxy.index=this.residueIndexStart,this.__residueProxy.getBackboneType(t)},od.prototype.getAtomIndexByType=function(t,e){this.isCyclic?-1===t?t=this.residueCount-1:t===this.residueCount&&(t=0):(-1!==t||this.isPrevConnected||(t+=1),t!==this.residueCount||this.isNextNextConnected||(t-=1));var i,r=this.__residueProxy;switch(r.index=this.residueIndexStart+t,e){case"trace":i=r.traceAtomIndex;break;case"direction1":i=r.direction1AtomIndex;break;case"direction2":i=r.direction2AtomIndex;break;default:var n=r.getAtomByName(e);i=n?n.index:void 0}return i},od.prototype.eachAtom=function(t,e){this.eachResidue((function(i){i.eachAtom(t,e)}),e)},od.prototype.eachAtomN=function(t,e,i){var r,n=this.residueCount,o=new Array(t);for(r=0;r<t;++r)o[r]=this.structure.getAtomProxy(this.getAtomIndexByType(r,i));e.apply(this,o);for(var a=t;a<n;++a){for(r=1;r<t;++r)o[r-1].index=o[r].index;o[t-1].index=this.getAtomIndexByType(a,i),e.apply(this,o)}},od.prototype.eachAtomN2=function(t,e,i){var r=this.atomOffset,n=this.atomCount,o=r+n;if(!(n<t)){for(var a=new Array(t),s=0;s<t;++s)a[s]=this.structure.getAtomProxy();var c=this.structure.atomSetCache["__"+i];void 0===c&&(mc.warn("no precomputed atomSet for: "+i),c=this.structure.getAtomSet(!1),this.eachResidue((function(t){var e=t.getAtomByName(i);c.set(e.index)})));var u=0;c.forEach((function(i){if(i>=r&&i<o){for(var n=1;n<t;++n)a[n-1].index=a[n].index;a[t-1].index=i,(u+=1)>=t&&e.apply(this,a)}}))}},od.prototype.eachResidue=function(t){for(var e=this.structure.getResidueProxy(),i=this.residueCount,r=this.residueIndexStart,n=0;n<i;++n)e.index=r+n,t(e)},od.prototype.qualifiedName=function(){var t=this.structure.getResidueProxy(this.residueIndexStart),e=this.structure.getResidueProxy(this.residueIndexEnd);return t.qualifiedName()+" - "+e.qualifiedName()},Object.defineProperties(od.prototype,ad);var sd=function(t,e){this.structure=t,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.index=e},cd={entity:{},model:{},entityIndex:{},modelIndex:{},residueOffset:{},residueCount:{},residueEnd:{},atomOffset:{},atomEnd:{},atomCount:{},chainname:{},chainid:{}};cd.entity.get=function(){return this.structure.entityList[this.entityIndex]},cd.model.get=function(){return this.structure.getModelProxy(this.modelIndex)},cd.entityIndex.get=function(){return this.chainStore.entityIndex[this.index]},cd.entityIndex.set=function(t){this.chainStore.entityIndex[this.index]=t},cd.modelIndex.get=function(){return this.chainStore.modelIndex[this.index]},cd.modelIndex.set=function(t){this.chainStore.modelIndex[this.index]=t},cd.residueOffset.get=function(){return this.chainStore.residueOffset[this.index]},cd.residueOffset.set=function(t){this.chainStore.residueOffset[this.index]=t},cd.residueCount.get=function(){return this.chainStore.residueCount[this.index]},cd.residueCount.set=function(t){this.chainStore.residueCount[this.index]=t},cd.residueEnd.get=function(){return this.residueOffset+this.residueCount-1},cd.atomOffset.get=function(){return this.residueStore.atomOffset[this.residueOffset]},cd.atomEnd.get=function(){return this.residueStore.atomOffset[this.residueEnd]+this.residueStore.atomCount[this.residueEnd]-1},cd.atomCount.get=function(){return 0===this.residueCount?0:this.atomEnd-this.atomOffset+1},cd.chainname.get=function(){return this.chainStore.getChainname(this.index)},cd.chainname.set=function(t){this.chainStore.setChainname(this.index,t)},cd.chainid.get=function(){return this.chainStore.getChainid(this.index)},cd.chainid.set=function(t){this.chainStore.setChainid(this.index,t)},sd.prototype.eachAtom=function(t,e){this.eachResidue((function(i){i.eachAtom(t,e)}),e)},sd.prototype.eachResidue=function(t,e){var i,r=this.residueCount,n=this.residueOffset,o=this.structure._rp,a=n+r;if(e&&e.test){var s=e.residueOnlyTest;if(s)for(i=n;i<a;++i)o.index=i,s(o)&&t(o,e);else for(i=n;i<a;++i)o.index=i,t(o,e)}else for(i=n;i<a;++i)o.index=i,t(o)},sd.prototype.eachResidueN=function(t,e){var i,r=this.residueCount,n=this.residueOffset,o=n+r;if(!(r<t)){var a=new Array(t);for(i=0;i<t;++i)a[i]=this.structure.getResidueProxy(n+i);e.apply(this,a);for(var s=n+t;s<o;++s){for(i=0;i<t;++i)a[i].index+=1;e.apply(this,a)}}},sd.prototype.eachPolymer=function(t,e){for(var i,r,n=e?e.residueOnlyTest:void 0,o=this.model.structure,a=this.residueCount,s=this.residueOffset,c=s+a,u=this.structure.getResidueProxy(),h=this.structure.getResidueProxy(s),l=this.structure.getAtomProxy(),p=this.structure.getAtomProxy(),d=!0,f=s+1;f<c;++f){u.index=h.index,h.index=f,d&&(i=u.index,d=!1),r=h.index;var m=d?u.backboneEndType:u.backboneType,g=h.backboneType;0!==m&&m===g?(l.index=u.backboneEndAtomIndex,p.index=h.backboneStartAtomIndex,l&&p&&l.connectedTo(p)&&(!n||n(u)&&n(h))||(u.index-i>1&&t(new od(o,i,u.index)),i=r)):(0!==m&&u.index-i>1&&t(new od(o,i,u.index)),i=r)}r-i>1&&this.structure.getResidueProxy(i).backboneStartType&&t(new od(o,i,r))},sd.prototype.qualifiedName=function(){return":"+this.chainname+"/"+this.modelIndex},sd.prototype.clone=function(){return new this.constructor(this.structure,this.index)},sd.prototype.toObject=function(){return{index:this.index,residueOffset:this.residueOffset,residueCount:this.residueCount,chainname:this.chainname}},Object.defineProperties(sd.prototype,cd);var ud=function(t,e){this.structure=t,this.modelStore=t.modelStore,this.chainStore=t.chainStore,this.residueStore=t.residueStore,this.index=e},hd={chainOffset:{},chainCount:{},residueOffset:{},atomOffset:{},chainEnd:{},residueEnd:{},atomEnd:{},residueCount:{},atomCount:{}};hd.chainOffset.get=function(){return this.modelStore.chainOffset[this.index]},hd.chainOffset.set=function(t){this.modelStore.chainOffset[this.index]=t},hd.chainCount.get=function(){return this.modelStore.chainCount[this.index]},hd.chainCount.set=function(t){this.modelStore.chainCount[this.index]=t},hd.residueOffset.get=function(){return this.chainStore.residueOffset[this.chainOffset]},hd.atomOffset.get=function(){return this.residueStore.atomOffset[this.residueOffset]},hd.chainEnd.get=function(){return this.chainOffset+this.chainCount-1},hd.residueEnd.get=function(){return this.chainStore.residueOffset[this.chainEnd]+this.chainStore.residueCount[this.chainEnd]-1},hd.atomEnd.get=function(){return this.residueStore.atomOffset[this.residueEnd]+this.residueStore.atomCount[this.residueEnd]-1},hd.residueCount.get=function(){return 0===this.chainCount?0:this.residueEnd-this.residueOffset+1},hd.atomCount.get=function(){return 0===this.residueCount?0:this.atomEnd-this.atomOffset+1},ud.prototype.eachAtom=function(t,e){this.eachChain((function(i){i.eachAtom(t,e)}),e)},ud.prototype.eachResidue=function(t,e){this.eachChain((function(i){i.eachResidue(t,e)}),e)},ud.prototype.eachPolymer=function(t,e){if(e&&e.chainOnlyTest){var i=e.chainOnlyTest;this.eachChain((function(r){i(r)&&r.eachPolymer(t,e)}))}else this.eachChain((function(i){i.eachPolymer(t,e)}))},ud.prototype.eachChain=function(t,e){var i,r=this.chainCount,n=this.chainOffset,o=this.structure._cp,a=n+r;if(e&&e.test){var s=e.chainOnlyTest;if(s)for(i=n;i<a;++i)o.index=i,s(o)&&t(o,e);else for(i=n;i<a;++i)o.index=i,t(o,e)}else for(i=n;i<a;++i)o.index=i,t(o)},ud.prototype.qualifiedName=function(){return"/"+this.index},ud.prototype.clone=function(){return new this.constructor(this.structure,this.index)},ud.prototype.toObject=function(){return{index:this.index,chainOffset:this.chainOffset,chainCount:this.chainCount}},Object.defineProperties(ud.prototype,hd);var ld=function(t,e){this.signals={refreshed:new Fs},this.init(t,e)},pd={type:{}};function dd(t,e){var i=[],r=!1;if(e){for(var n=0,o=e.length;n<o;++n)i.push(e[n]);a()}function a(){var e=i.shift();void 0!==e?(r=!0,setTimeout((function(){!function(e){t(e,a)}(e)}))):r=!1}this.push=function(t){i.push(t),r||a()},this.kill=function(){i.length=0},this.length=function(){return i.length}}ld.prototype.init=function(t,e){this.name=t,this.path=e,this.title="",this.id="",this.header={},this.extraData={},this.atomSetCache=void 0,this.atomSetDict={},this.biomolDict={},this.entityList=[],this.unitcell=void 0,this.frames=[],this.boxes=[],this.validation=void 0,this.bondStore=new yp(0),this.backboneBondStore=new yp(0),this.rungBondStore=new yp(0),this.atomStore=new bp(0),this.residueStore=new xp(0),this.chainStore=new _p(0),this.modelStore=new wp(0),this.atomMap=new Zp(this),this.residueMap=new Qp(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()},pd.type.get=function(){return"Structure"},ld.prototype.finalizeAtoms=function(){this.atomSet=this.getAtomSet(),this.atomCount=this.atomStore.count,this.boundingBox=this.getBoundingBox(),this.center=this.boundingBox.getCenter(),this.spatialHash=new Kl(this.atomStore,this.boundingBox)},ld.prototype.finalizeBonds=function(){for(var t in this.bondSet=this.getBondSet(),this.bondCount=this.bondStore.count,this.bondHash=new mp(this.bondStore,this.atomStore.count),this.atomSetCache={},this.atomSetDict.rung||(this.atomSetDict.rung=this.getAtomSet(!1)),this.atomSetDict)this.atomSetCache["__"+t]=this.atomSetDict[t].clone()},ld.prototype.getBondProxy=function(t){return new Jp(this,t)},ld.prototype.getAtomProxy=function(t){return new ed(this,t)},ld.prototype.getResidueProxy=function(t){return new rd(this,t)},ld.prototype.getChainProxy=function(t){return new sd(this,t)},ld.prototype.getModelProxy=function(t){return new ud(this,t)},ld.prototype.getBondSet=function(){var t=this.bondStore.count,e=new al(t),i=this.atomSet;if(i)for(var r=this.getBondProxy(),n=0;n<t;++n)r.index=n,i.isSet(r.atomIndex1,r.atomIndex2)&&e.set(r.index);else e.setAll();return e},ld.prototype.getBackboneBondSet=function(){var t=this.backboneBondStore.count,e=new al(t),i=this.atomSetCache.__backbone;if(i){var r=this.getBondProxy();r.bondStore=this.backboneBondStore;for(var n=0;n<t;++n)r.index=n,i.isSet(r.atomIndex1,r.atomIndex2)&&e.set(r.index)}else e.set_all(!0);return e},ld.prototype.getRungBondSet=function(){var t=this.rungBondStore.count,e=new al(t),i=this.atomSetCache.__rung;if(i){var r=this.getBondProxy();r.bondStore=this.rungBondStore;for(var n=0;n<t;++n)r.index=n,i.isSet(r.atomIndex1,r.atomIndex2)&&e.set(r.index)}else e.set_all(!0);return e},ld.prototype.getAtomSet=function(t){var e,i=this.atomStore.count;if(t instanceof al)e=t;else if(t&&t.test){var r=t.string;r in this.atomSetCache?e=this.atomSetCache[r]:(e=new al(i),this.eachAtom((function(t){e.set(t.index)}),t),this.atomSetCache[r]=e)}else e=!1===t?new al(i):new al(i,!0);return e},ld.prototype.getAtomSetWithinSelection=function(t,e){var i=this.spatialHash,r=this.getAtomSet(!1),n=this.getAtomProxy();return this.getAtomSet(t).forEach((function(t){n.index=t,i.within(n.x,n.y,n.z,e).forEach((function(t){r.set(t)}))})),r},ld.prototype.getAtomSetWithinPoint=function(t,e){var i=t,r=this.getAtomSet(!1);return this.spatialHash.within(i.x,i.y,i.z,e).forEach((function(t){r.set(t)})),r},ld.prototype.getAtomSetWithinVolume=function(t,e,i,r,n){for(var o=new dp(t,i,r,n),a=o.getDataPosition(),s=a.length,c=o.matrix.getMaxScaleOnAxis(),u=this.getAtomSet(!1),h=0;h<s;h+=3)this.spatialHash.within(a[h],a[h+1],a[h+2],c).forEach((function(t){u.set(t)}));return u},ld.prototype.getAtomSetWithinGroup=function(t){var e=this.atomStore.residueIndex,i=this.getAtomSet(!1),r=this.getResidueProxy();return this.getAtomSet(t).forEach((function(t){r.index=e[t];for(var n=r.atomOffset;n<=r.atomEnd;++n)i.set(n)})),i},ld.prototype.getSelection=function(){return!1},ld.prototype.getStructure=function(){return this},ld.prototype.eachEntity=function(t,e){this.entityList.forEach((function(i){void 0!==e&&i.getEntityType()!==e||t(i)}))},ld.prototype.eachBond=function(t,e){var i,r=this.getBondProxy();if(e&&e.test&&(i=this.getBondSet(e),this.bondSet&&i.intersection(this.bondSet)),i)i.forEach((function(e){r.index=e,t(r)}));else for(var n=this.bondStore.count,o=0;o<n;++o)r.index=o,t(r)},ld.prototype.eachAtom=function(t,e){if(e&&e.test)this.eachModel((function(i){i.eachAtom(t,e)}),e);else for(var i=this.atomStore.count,r=this.getAtomProxy(),n=0;n<i;++n)r.index=n,t(r)},ld.prototype.eachResidue=function(t,e){var i;if(e&&e.test){var r=this.modelStore.count,n=this.getModelProxy(),o=e.modelOnlyTest;if(o)for(i=0;i<r;++i)n.index=i,o(n)&&n.eachResidue(t,e);else for(i=0;i<r;++i)n.index=i,n.eachResidue(t,e)}else{var a=this.residueStore.count,s=this.getResidueProxy();for(i=0;i<a;++i)s.index=i,t(s)}},ld.prototype.eachResidueN=function(t,e){var i,r,n=this.residueStore.count;if(!(n<t)){var o=new Array(t);for(i=0;i<t;++i)o[i]=this.getResidueProxy(i);for(e.apply(this,o),r=t;r<n;++r){for(i=0;i<t;++i)o[i].index+=1;e.apply(this,o)}}},ld.prototype.eachPolymer=function(t,e){if(e&&e.modelOnlyTest){var i=e.modelOnlyTest;this.eachModel((function(r){i(r)&&r.eachPolymer(t,e)}))}else this.eachModel((function(i){i.eachPolymer(t,e)}))},ld.prototype.eachChain=function(t,e){if(e&&e.test)this.eachModel((function(i){i.eachChain(t,e)}));else for(var i=this.chainStore.count,r=this.getChainProxy(),n=0;n<i;++n)r.index=n,t(r)},ld.prototype.eachModel=function(t,e){var i,r=this.modelStore.count,n=this.getModelProxy();if(e&&e.test){var o=e.modelOnlyTest;if(o)for(i=0;i<r;++i)n.index=i,o(n)&&t(n,e);else for(i=0;i<r;++i)n.index=i,t(n,e)}else for(i=0;i<r;++i)n.index=i,t(n)},ld.prototype.getAtomData=function(t){var e=Object.assign({},t);e.colorParams&&(e.colorParams.structure=this.getStructure());var i,r,n,o,a,s,c,u=e.what,h=Eo(e.atomSet,this.atomSet),l={},p=this.getAtomProxy(),d=h.getSize();return u&&!u.position||(n=new Float32Array(3*d),l.position=n),u&&!u.color||(o=new Float32Array(3*d),l.color=o,r=yc.getScheme(e.colorParams)),u&&!u.picking||(a=new Float32Array(d),l.picking=new $h(a,this.getStructure())),u&&!u.radius||(s=new Float32Array(d),l.radius=s,i=new Il(e.radiusParams.radius,e.radiusParams.scale)),u&&!u.index||(c=new Float32Array(d),l.index=c),h.forEach((function(t,e){var u=3*e;p.index=t,n&&p.positionToArray(n,u),o&&r.atomColorToArray(p,o,u),a&&(a[e]=t),s&&(s[e]=i.atomRadius(p)),c&&(c[e]=t)})),l},ld.prototype.getBondData=function(t){var e=Object.assign({},t);e.colorParams&&(e.colorParams.structure=this.getStructure());var i,r,n,o,a,s,c,u,h,l=e.what,p=Eo(e.bondSet,this.bondSet),d=Eo(e.multipleBond,"off"),f="off"!==d,m="offset"===d,g=Eo(e.bondScale,.4),v=Eo(e.bondSpacing,1),y={},b=this.getBondProxy();e.bondStore&&(b.bondStore=e.bondStore);var x,_=this.getAtomProxy(),w=this.getAtomProxy();if(f){var S=b.bondStore.bondOrder;x=0,p.forEach((function(t){x+=S[t]}))}else x=p.getSize();l&&!l.position||(n=new Float32Array(3*x),o=new Float32Array(3*x),y.position1=n,y.position2=o),l&&!l.color||(a=new Float32Array(3*x),s=new Float32Array(3*x),y.color=a,y.color2=s,r=yc.getScheme(e.colorParams)),l&&!l.picking||(c=new Float32Array(x),y.picking=new Wh(c,this.getStructure(),e.bondStore)),(!l||l.radius||f&&l.position)&&(i=new Il(e.radiusParams.radius,e.radiusParams.scale)),l&&!l.radius||(u=new Float32Array(x),y.radius=u,e.radius2&&(h=new Float32Array(x),y.radius2=h));var A,M,P,T,E,C,I,R=0,L=new O,N=new O,D=new O;return p.forEach((function(t){if(M=3*R,b.index=t,_.index=b.atomIndex1,w.index=b.atomIndex2,T=b.bondOrder,n&&(f&&T>1?(E=i.atomRadius(_),C=E*g/(.5*T),b.calculateShiftDir(D),m?(I=2*v*E,D.multiplyScalar(I),D.negate(),N.subVectors(w,_).multiplyScalar(Math.max(.1,I/1.88)),_.positionToArray(n,M),w.positionToArray(o,M),T>=2&&(L.addVectors(_,D).add(N).toArray(n,M+3),L.addVectors(w,D).sub(N).toArray(o,M+3),T>=3&&(L.subVectors(_,D).add(N).toArray(n,M+6),L.subVectors(w,D).sub(N).toArray(o,M+6)))):(I=(v-g)*E,D.multiplyScalar(I),2===T?(L.addVectors(_,D).toArray(n,M),L.subVectors(_,D).toArray(n,M+3),L.addVectors(w,D).toArray(o,M),L.subVectors(w,D).toArray(o,M+3)):3===T?(_.positionToArray(n,M),L.addVectors(_,D).toArray(n,M+3),L.subVectors(_,D).toArray(n,M+6),w.positionToArray(o,M),L.addVectors(w,D).toArray(o,M+3),L.subVectors(w,D).toArray(o,M+6)):(_.positionToArray(n,M),w.positionToArray(o,M)))):(_.positionToArray(n,M),w.positionToArray(o,M))),a&&(r.bondColorToArray(b,1,a,M),r.bondColorToArray(b,0,s,M),f&&T>1))for(A=1;A<T;++A)hu(a,M,P=3*A+M,3),hu(s,M,P,3);if(c&&(c[R]=t,f&&T>1))for(A=1;A<T;++A)c[R+A]=t;if(u&&(u[R]=i.atomRadius(_),f&&T>1))for(C=u[R]*g/(m?1:.5*T),A=m?1:0;A<T;++A)u[R+A]=C;if(h&&(h[R]=i.atomRadius(w),f&&T>1))for(C=h[R]*g/(m?1:.5*T),A=m?1:0;A<T;++A)h[R+A]=C;R+=f?T:1})),y},ld.prototype.getBackboneAtomData=function(t){return t=Object.assign({atomSet:this.atomSetCache.__backbone},t),this.getAtomData(t)},ld.prototype.getBackboneBondData=function(t){return t=Object.assign({bondSet:this.getBackboneBondSet(),bondStore:this.backboneBondStore},t),this.getBondData(t)},ld.prototype.getRungAtomData=function(t){return t=Object.assign({atomSet:this.atomSetCache.__rung},t),this.getAtomData(t)},ld.prototype.getRungBondData=function(t){return t=Object.assign({bondSet:this.getRungBondSet(),bondStore:this.rungBondStore},t),this.getBondData(t)},ld.prototype.getBoundingBox=function(t,e){gc&&mc.time("getBoundingBox"),e=e||new jt;var i=1/0,r=1/0,n=1/0,o=-1/0,a=-1/0,s=-1/0;return this.eachAtom((function(t){var e=t.x,c=t.y,u=t.z;e<i&&(i=e),c<r&&(r=c),u<n&&(n=u),e>o&&(o=e),c>a&&(a=c),u>s&&(s=u)}),t),e.min.set(i,r,n),e.max.set(o,a,s),gc&&mc.timeEnd("getBoundingBox"),e},ld.prototype.getPrincipalAxes=function(t){gc&&mc.time("getPrincipalAxes");var e=0,i=new Rl(3,this.atomCount),r=i.data;return this.eachAtom((function(t){r[e+0]=t.x,r[e+1]=t.y,r[e+2]=t.z,e+=3}),t),gc&&mc.timeEnd("getPrincipalAxes"),new Zl(i)},ld.prototype.atomCenter=function(t){return t?this.getBoundingBox(t).getCenter():this.center.clone()},ld.prototype.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},ld.prototype.getAtomIndices=function(t){var e;if(t&&t.string)e=[],this.eachAtom((function(t){e.push(t.index)}),t);else{e=this.getAtomData({what:{index:!0}}).index}return e},ld.prototype.getChainnameCount=function(t){var e=new Set;return this.eachChain((function(t){t.residueCount&&e.add(t.chainname)}),t),e.size},ld.prototype.updatePosition=function(t){var e=0;this.eachAtom((function(i){i.positionFromArray(t,e),e+=3}))},ld.prototype.refreshPosition=function(){this.getBoundingBox(void 0,this.boundingBox),this.boundingBox.getCenter(this.center),this.spatialHash=new Kl(this.atomStore,this.boundingBox)},ld.prototype.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},Object.defineProperties(ld.prototype,pd);var fd=function(t,e){var i;"function"==typeof t.eachAtom?i=t.atomCount:t instanceof Float32Array&&(i=t.length/3);var r=new Rl(3,i),n=new Rl(3,i);this.coords1t=new Rl(i,3),this.coords2t=new Rl(i,3),this.A=new Rl(3,3),this.W=new Rl(1,3),this.U=new Rl(3,3),this.V=new Rl(3,3),this.VH=new Rl(3,3),this.R=new Rl(3,3),this.tmp=new Rl(3,3),this.c=new Rl(3,3),this.c.data.set([1,0,0,0,1,0,0,0,-1]),this.prepCoords(t,r),this.prepCoords(e,n),this._superpose(r,n)};fd.prototype._superpose=function(t,e){var i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S;this.mean1=Dl(t),this.mean2=Dl(e),kl(t,this.mean1),kl(e,this.mean2),Ll(this.coords1t,t),Ll(this.coords2t,e),Ol(this.A,this.coords2t,this.coords1t),zl(this.A,this.W,this.U,this.V),i=this.V,r=this.VH,n=i.data,o=r.data,a=n[4],s=n[8],c=n[5],u=n[7],h=n[0],l=h*a,p=h*c,d=n[3],f=n[1],m=d*f,g=n[2],v=d*g,y=n[6],_=1/(l*s-p*u-m*s+v*u+(b=y*f)*c-(x=y*g)*a),o[0]=(a*s-c*u)*_,o[1]=-(f*s-g*u)*_,o[2]=-(-f*c+g*a)*_,o[3]=-(d*s-c*y)*_,o[4]=(h*s-x)*_,o[5]=-(p-v)*_,o[6]=-(-d*u+a*y)*_,o[7]=-(h*u-b)*_,o[8]=(l-m)*_,Nl(this.R,this.U,this.VH),w=this.R,(S=w.data)[0]*S[4]*S[8]-S[0]*S[5]*S[7]-S[3]*S[1]*S[8]+S[3]*S[2]*S[7]+S[6]*S[1]*S[5]-S[6]*S[2]*S[4]<0&&(gc&&mc.log("R not a right handed system"),Nl(this.tmp,this.c,this.VH),Nl(this.R,this.U,this.tmp))},fd.prototype.prepCoords=function(t,e){var i=0,r=e.data;"function"==typeof t.eachAtom?t.eachAtom((function(t){r[i+0]=t.x,r[i+1]=t.y,r[i+2]=t.z,i+=3})):t instanceof Float32Array?r.set(t):mc.warn("prepCoords: input type unknown")},fd.prototype.transform=function(t){var e;"function"==typeof t.eachAtom?e=t.atomCount:t instanceof Float32Array&&(e=t.length/3);var i=new Rl(3,e),r=new Rl(e,3);this.prepCoords(t,i),kl(i,this.mean1),Ol(r,this.R,i),Ll(i,r),function(t,e){var i,r,n=0,o=t.rows,a=t.cols,s=t.data;for(i=0;i<o;++i)for(r=0;r<a;++r,++n)s[n]+=e[r]}(i,this.mean2);var n=0,o=i.data;"function"==typeof t.eachAtom?t.eachAtom((function(t){t.x=o[n+0],t.y=o[n+1],t.z=o[n+2],n+=3})):t instanceof Float32Array?t.set(o.subarray(0,3*e)):mc.warn("transform: input type unknown")};var md=function(t,e){this.signals={startedRunning:new Fs,haltedRunning:new Fs};var i=Object.assign({},e);t.signals.playerChanged.add((function(t){t!==this&&this.pause()}),this);var r=Eo(t.numframes,1);this.traj=t,this.start=Eo(i.start,0),this.end=Math.min(Eo(i.end,r-1),r-1),this.step=Eo(i.step,Math.ceil((r+1)/100)),this.timeout=Eo(i.timeout,50),this.interpolateType=Eo(i.interpolateType,""),this.interpolateStep=Eo(i.interpolateStep,5),this.mode=Eo(i.mode,"loop"),this.direction=Eo(i.direction,"forward"),this._stopFlag=!1,this._running=!1,t.signals.gotNumframes.add((function(t){this.end=Math.min(Eo(i.end,t-1),t-1)}),this)};md.prototype._animate=function(){var t,e,i,r;(this._running=!0,this.traj.inProgress||this._stopFlag||(((t="forward"===this.direction?this.traj.currentFrame+this.step:this.traj.currentFrame-this.step)>=this.end||t<this.start)&&("once"===this.mode?(this.pause(),t="forward"===this.direction?this.end:this.start):t="forward"===this.direction?this.start:this.end),this.interpolateType||this.traj.setFrame(t)),this._stopFlag)?this._running=!1:!this.traj.inProgress&&this.interpolateType?("forward"===this.direction?(e=Math.max(this.start,t-this.step),i=Math.max(this.start,t-2*this.step),r=Math.max(this.start,t-3*this.step)):(e=Math.min(this.end,t+this.step),i=Math.min(this.end,t+2*this.step),r=Math.min(this.end,t+3*this.step)),this._interpolate(t,e,i,r,1/this.interpolateStep,0)):setTimeout(this._animate.bind(this),this.timeout)},md.prototype._interpolate=function(t,e,i,r,n,o){if((o+=n)<=1){var a=Math.round(this.timeout*n);this.traj.setFrameInterpolated(t,e,i,r,o,this.interpolateType,function(){setTimeout(function(){this._interpolate(t,e,i,r,n,o)}.bind(this),a)}.bind(this))}else setTimeout(this._animate.bind(this),0)},md.prototype.toggle=function(){this._running?this.pause():this.play()},md.prototype.play=function(){if(!this._running){this.traj.player!==this&&this.traj.setPlayer(this);var t=this.traj.currentFrame,e=Math.ceil(t/this.step)*this.step;"forward"===this.direction&&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()}},md.prototype.pause=function(){this._running&&(this._stopFlag=!0,this.signals.haltedRunning.dispatch())},md.prototype.stop=function(){this.traj.setFrame(this.start),this.pause()};var gd=function(t,e,i){this.signals={gotNumframes:new Fs,frameChanged:new Fs,selectionChanged:new Fs,playerChanged:new Fs};var r=i||{};r.centerPbc=Eo(r.centerPbc,!0),r.removePbc=Eo(r.removePbc,!0),r.superpose=Eo(r.superpose,!0),this.setParameters(r),this.name=t.replace(/^.*[\\/]/,""),this.selection=new nc(Eo(r.sele,"backbone and not hydrogen")),this.selection.signals.stringChanged.add((function(){this.makeIndices(),this.resetCache()}),this),this.setStructure(e),this.setPlayer(new md(this)),this.trajPath=t,this.numframes=void 0,this.getNumframes()};function vd(t){return"front"===t?0:"back"===t?1:2}gd.prototype.setStructure=function(t){this.structure=t,this.atomCount=t.atomCount,this.makeAtomIndices(),this.saveInitialStructure(),this.backboneIndices=this.getIndices(new nc("backbone and not hydrogen")),this.makeIndices(),this.frameCache=[],this.boxCache=[],this.pathCache=[],this.frameCacheSize=0,this.currentFrame=-1},gd.prototype.saveInitialStructure=function(){var t=0,e=new Float32Array(3*this.atomCount);this.structure.eachAtom((function(i){e[t+0]=i.x,e[t+1]=i.y,e[t+2]=i.z,t+=3})),this.initialStructure=e},gd.prototype.setSelection=function(t){return this.selection.setString(t),this},gd.prototype.getIndices=function(t){var e;if(t&&t.test){var i=0,r=t.test;e=[],this.structure.eachAtom((function(t){r(t)&&e.push(i),i+=1}))}else e=this.structure.getAtomIndices(this.selection);return e},gd.prototype.makeIndices=function(){var t,e;this.indices=this.getIndices(this.selection);var i=3*this.indices.length;this.coords1=new Float32Array(i),this.coords2=new Float32Array(i);var r=this.initialStructure,n=this.coords2;for(t=0;t<i;t+=3)e=3*this.indices[t/3],n[t+0]=r[e+0],n[t+1]=r[e+1],n[t+2]=r[e+2]},gd.prototype.makeAtomIndices=function(){mc.error("Trajectory.makeAtomIndices not implemented")},gd.prototype.getNumframes=function(){mc.error("Trajectory.loadFrame not implemented")},gd.prototype.resetCache=function(){return this.frameCache=[],this.boxCache=[],this.pathCache=[],this.frameCacheSize=0,this.setFrame(this.currentFrame),this},gd.prototype.setParameters=function(t){var e=t,i=!1;void 0!==e.centerPbc&&e.centerPbc!==this.centerPbc&&(this.centerPbc=e.centerPbc,i=!0),void 0!==e.removePbc&&e.removePbc!==this.removePbc&&(this.removePbc=e.removePbc,i=!0),void 0!==e.superpose&&e.superpose!==this.superpose&&(this.superpose=e.superpose,i=!0),i&&this.resetCache()},gd.prototype.setFrame=function(t,e){return void 0===t?this:(this.inProgress=!0,-1===(t=parseInt(t))||this.frameCache[t]?this.updateStructure(t,e):this.loadFrame(t,function(){this.updateStructure(t,e)}.bind(this)),this)},gd.prototype.interpolate=function(t,e,i,r,n,o,a){var s,c=this.frameCache,u=c[t],h=c[e],l=c[i],p=c[r],d=u.length,f=new Float32Array(d);if("spline"===o)for(s=0;s<d;s+=3)f[s+0]=Is(p[s+0],l[s+0],h[s+0],u[s+0],n,1),f[s+1]=Is(p[s+1],l[s+1],h[s+1],u[s+1],n,1),f[s+2]=Is(p[s+2],l[s+2],h[s+2],u[s+2],n,1);else for(s=0;s<d;s+=3)f[s+0]=Cs(h[s+0],u[s+0],n),f[s+1]=Cs(h[s+1],u[s+1],n),f[s+2]=Cs(h[s+2],u[s+2],n);this.structure.updatePosition(f),this.currentFrame=t,this.signals.frameChanged.dispatch(t),"function"==typeof a&&a()},gd.prototype.setFrameInterpolated=function(t,e,i,r,n,o,a){if(void 0===t)return this;var s=this.frameCache,c=[];return s[r]||c.push(r),s[i]||c.push(i),s[e]||c.push(e),s[t]||c.push(t),c.length?this.loadFrame(c,function(){this.interpolate(t,e,i,r,n,o,a)}.bind(this)):this.interpolate(t,e,i,r,n,o,a),this},gd.prototype.loadFrame=function(t,e){if(Array.isArray(t)){var i,r=function(t,r){this._loadFrame(t,r),0===i.length()&&"function"==typeof e&&e()}.bind(this);i=new dd(r,t)}else this._loadFrame(t,e)},gd.prototype._loadFrame=function(t,e){mc.error("Trajectory._loadFrame not implemented",t,e)},gd.prototype.updateStructure=function(t,e){this._disposed||(-1===t?this.structure.updatePosition(this.initialStructure):this.structure.updatePosition(this.frameCache[t]),this.structure.trajectory={name:this.trajPath,frame:t},"function"==typeof e&&e(),this.currentFrame=t,this.inProgress=!1,this.signals.frameChanged.dispatch(t))},gd.prototype.getCircularMean=function(t,e,i){return[ru(e,i[0],3,0,t),ru(e,i[1],3,1,t),ru(e,i[2],3,2,t)]},gd.prototype.doSuperpose=function(t){var e,i,r=3*this.indices.length,n=this.coords1,o=this.coords2;for(e=0;e<r;e+=3)i=3*this.indices[e/3],n[e+0]=t[i+0],n[e+1]=t[i+1],n[e+2]=t[i+2];new fd(n,o).transform(t)},gd.prototype.process=function(t,e,i,r){if(this.setNumframes(r),e){if(this.backboneIndices.length>0&&this.centerPbc){var n=[e[0],e[4],e[8]];!function(t,e,i){if(0!==i[0]&&0!==i[8]&&0!==i[4]){var r,n=t.length,o=i[0],a=i[1],s=i[2],c=-e[0]+o+o/2,u=-e[1]+a+a/2,h=-e[2]+s+s/2;for(r=0;r<n;r+=3)t[r+0]=(t[r+0]+c)%o,t[r+1]=(t[r+1]+u)%a,t[r+2]=(t[r+2]+h)%s}}(i,this.getCircularMean(this.backboneIndices,i,n),n)}this.removePbc&&function(t,e){if(0!==e[0]&&0!==e[8]&&0!==e[4]){var i,r,n,o,a=t.length;for(i=3;i<a;i+=3)for(r=0;r<3;++r)if(o=t[i+r]-t[i-3+r],Math.abs(o)>.9*e[3*r+r])if(o>0)for(n=0;n<3;++n)t[i+n]-=e[3*r+n];else for(n=0;n<3;++n)t[i+n]+=e[3*r+n]}}(i,e)}this.indices.length>0&&this.superpose&&this.doSuperpose(i),this.frameCache[t]=i,this.boxCache[t]=e,this.frameCacheSize+=1},gd.prototype.setNumframes=function(t){t!==this.numframes&&(this.numframes=t,this.signals.gotNumframes.dispatch(t))},gd.prototype.dispose=function(){this.frameCache=[],this._disposed=!0,this.player&&this.player.stop()},gd.prototype.setPlayer=function(t){this.player=t,this.signals.playerChanged.dispatch(t)},gd.prototype.getPath=function(t,e){mc.error("Trajectory.getPath not implemented",t,e)},wc.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 )\n#include unpack_color\nattribute float primitiveId;\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 = unpackColor( primitiveId );\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}"),wc.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 )\nif( opacity < 0.7 )\ndiscard;\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}");var yd={f:1,v2:2,v3:3,c:3};function bd(t,e){t.matrix.copy(e),t.matrix.decompose(t.position,t.quaternion,t.scale),t.matrixWorldNeedsUpdate=!0}var xd=function(t,e){var i=t||{},r=e||{};this.opaqueBack=Eo(r.opaqueBack,!1),this.dullInterior=Eo(r.dullInterior,!1),this.side=Eo(r.side,"double"),this.opacity=Eo(r.opacity,1),this.depthWrite=Eo(r.depthWrite,!0),this.clipNear=Eo(r.clipNear,0),this.clipRadius=Eo(r.clipRadius,0),this.clipCenter=Eo(r.clipCenter,new O),this.flatShaded=Eo(r.flatShaded,!1),this.background=Eo(r.background,!1),this.linewidth=Eo(r.linewidth,1),this.wireframe=Eo(r.wireframe,!1),this.wireframeLinewidth=Eo(r.wireframeLinewidth,1),this.roughness=Eo(r.roughness,.4),this.metalness=Eo(r.metalness,0),this.diffuse=Eo(r.diffuse,16777215),this.forceTransparent=Eo(r.forceTransparent,!1),this.disablePicking=Eo(r.disablePicking,!1),this.geometry=new _e,this.indexVersion=0,this.wireframeIndexVersion=-1,this.uniforms=Mt.merge([At.common,{fogColor:{value:null},fogNear:{value:0},fogFar:{value:0},opacity:{value:this.opacity},nearClip:{value:0},clipRadius:{value:this.clipRadius},clipCenter:{value:this.clipCenter}},{emissive:{value:new St(0)},roughness:{value:this.roughness},metalness:{value:this.metalness}},At.ambient,At.lights]),this.uniforms.diffuse.value.set(this.diffuse),this.pickingUniforms={nearClip:{value:0},objectId:{value:0},opacity:{value:this.opacity}},this.group=new Ci,this.wireframeGroup=new Ci,this.pickingGroup=new Ci,this.matrix=Eo(r.matrix,new N);var n=i.position||i.position1;this._positionDataSize=n?n.length/3:0,this.addAttributes({position:{type:"v3",value:i.position},color:{type:"c",value:i.color},primitiveId:{type:"f",value:i.primitiveId}}),i.index&&this.initIndex(i.index),this.picking=i.picking,this.makeWireframeGeometry()},_d={parameters:{},matrix:{},transparent:{},size:{},attributeSize:{},pickable:{},dynamic:{},vertexShader:{},fragmentShader:{}};_d.parameters.get=function(){return{opaqueBack:{updateShader:!0},dullInterior:{updateShader:!0},side:{updateShader:!0,property:!0},opacity:{uniform:!0},depthWrite:{property:!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},matrix:{}}},_d.matrix.set=function(t){this.setMatrix(t)},_d.matrix.get=function(){return this.group.matrix.clone()},_d.transparent.get=function(){return this.opacity<1||this.forceTransparent},_d.size.get=function(){return this._positionDataSize},_d.attributeSize.get=function(){return this.size},_d.pickable.get=function(){return!!this.picking&&!this.disablePicking},_d.dynamic.get=function(){return!0},_d.vertexShader.get=function(){},_d.fragmentShader.get=function(){},xd.prototype.setMatrix=function(t){bd(this.group,t),bd(this.wireframeGroup,t),bd(this.pickingGroup,t)},xd.prototype.initIndex=function(t){this.geometry.setIndex(new me(t,1)),this.geometry.getIndex().setDynamic(this.dynamic)},xd.prototype.makeMaterial=function(){var t=vd(this.side),e=new zt({uniforms:this.uniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:this.transparent,depthWrite:this.depthWrite,lights:!0,fog:!0,side:t,linewidth:this.linewidth});e.vertexColors=2,e.extensions.derivatives=this.flatShaded,e.extensions.fragDepth=this.isImpostor,e.clipNear=this.clipNear;var i=new zt({uniforms:this.uniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:this.transparent,depthWrite:this.depthWrite,lights:!1,fog:!0,side:t,linewidth:this.linewidth});i.vertexColors=2,i.clipNear=this.clipNear;var r=new zt({uniforms:this.pickingUniforms,vertexShader:"",fragmentShader:"",depthTest:!0,transparent:!1,depthWrite:this.depthWrite,lights:!1,fog:!1,side:t,linewidth:this.linewidth,blending:0});r.vertexColors=2,r.extensions.fragDepth=this.isImpostor,r.clipNear=this.clipNear,this.material=e,this.wireframeMaterial=i,this.pickingMaterial=r,this.updateShader()},xd.prototype.makeWireframeGeometry=function(){this.makeWireframeIndex();var t=this.geometry,e=this.wireframeIndex,i=new _e;i.attributes=t.attributes,e&&(i.setIndex(new me(e,1).setDynamic(this.dynamic)),i.setDrawRange(0,this.wireframeIndexCount)),this.wireframeGeometry=i},xd.prototype.makeWireframeIndex=function(){var t=[];function e(e,i){if(e>i){var r=e;e=i,i=r}var n=t[e];return void 0===n?(t[e]=[i],!0):!n.includes(i)&&(n.push(i),!0)}var i=this.geometry,r=i.index;if(this.wireframe)if(r){var n,o=r.array,a=o.length;if(i.drawRange.count!==1/0&&(a=i.drawRange.count),this.wireframeIndex&&this.wireframeIndex.length>2*a)n=this.wireframeIndex;else n=zo(2*a,i.attributes.position.count);var s=0;t.length=0;for(var c=0;c<a;c+=3){var u=o[c+0],h=o[c+1],l=o[c+2];e(u,h)&&(n[s+0]=u,n[s+1]=h,s+=2),e(h,l)&&(n[s+0]=h,n[s+1]=l,s+=2),e(l,u)&&(n[s+0]=l,n[s+1]=u,s+=2)}this.wireframeIndex=n,this.wireframeIndexCount=s,this.wireframeIndexVersion=this.indexVersion}else{var p,d=i.attributes.position.count;p=this.wireframeIndex&&this.wireframeIndex.length>2*d?this.wireframeIndex:zo(2*d,d);for(var f=0,m=0;f<d;f+=3)p[m+0]=f,p[m+1]=f+1,p[m+2]=f+1,p[m+3]=f+2,p[m+4]=f+2,p[m+5]=f,m+=6;this.wireframeIndex=p,this.wireframeIndexCount=2*d,this.wireframeIndexVersion=this.indexVersion}else this.wireframeIndex=new Uint16Array(0),this.wireframeIndexCount=0},xd.prototype.updateWireframeIndex=function(){if(this.wireframeGeometry.setDrawRange(0,1/0),this.wireframeIndexVersion<this.indexVersion&&this.makeWireframeIndex(),this.wireframeIndex.length>this.wireframeGeometry.index.array.length)this.wireframeGeometry.setIndex(new me(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)},xd.prototype.getRenderOrder=function(){var t=0;return this.isText?t=1:this.transparent&&(t=this.isSurface?3:2),t},xd.prototype._getMesh=function(t){this.material||this.makeMaterial();var e,i=this.geometry,r=this[t];return this.isLine?e=new Mi(i,r):this.isPoint?(e=new Ei(i,r),this.sortParticles&&(e.sortParticles=!0)):e=new Ie(i,r),e.frustumCulled=!1,e.renderOrder=this.getRenderOrder(),e},xd.prototype.getMesh=function(){return this._getMesh("material")},xd.prototype.getWireframeMesh=function(){var t;return this.material||this.makeMaterial(),this.wireframeGeometry||this.makeWireframeGeometry(),(t=new Mi(this.wireframeGeometry,this.wireframeMaterial)).frustumCulled=!1,t.renderOrder=this.getRenderOrder(),t},xd.prototype.getPickingMesh=function(){return this._getMesh("pickingMaterial")},xd.prototype.getShader=function(t,e){return qc(t,this.getDefines(e))},xd.prototype.getVertexShader=function(t){return this.getShader(this.vertexShader,t)},xd.prototype.getFragmentShader=function(t){return this.getShader(this.fragmentShader,t)},xd.prototype.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},xd.prototype.getParameters=function(){var t={};for(var e in this.parameters)t[e]=this[e];return t},xd.prototype.addUniforms=function(t){this.uniforms=Mt.merge([this.uniforms,t]),this.pickingUniforms=Mt.merge([this.pickingUniforms,t])},xd.prototype.addAttributes=function(t){for(var e in t){var i=void 0,r=t[e],n=this.attributeSize*yd[r.type];r.value?(n!==r.value.length&&mc.error("attribute value has wrong length",e),i=r.value):i=Bo("float32",n),this.geometry.addAttribute(e,new me(i,yd[r.type]).setDynamic(this.dynamic))}},xd.prototype.updateRenderOrder=function(){var t=this.getRenderOrder();function e(e){e.renderOrder=t}this.group.children.forEach(e),this.pickingGroup&&this.pickingGroup.children.forEach(e)},xd.prototype.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},xd.prototype.setParameters=function(t){if(t){var e=t,i=this.parameters,r={},n={},o=!1,a=!1;for(var s in e){var c=e[s];void 0!==c&&(void 0!==i[s]&&(this[s]=c,i[s].property&&(!0!==i[s].property?r[i[s].property]=c:r[s]=c),i[s].uniform&&(!0!==i[s].uniform?n[i[s].uniform]=c:n[s]=c),i[s].updateShader&&(o=!0),i[s].updateVisibility&&(a=!0),this.dynamic&&"wireframe"===s&&!0===c&&this.updateWireframeIndex(),"flatShaded"===s&&(this.material.extensions.derivatives=this.flatShaded),"forceTransparent"===s&&(r.transparent=this.transparent)))}this.setProperties(r),this.setUniforms(n),o&&this.updateShader(),a&&this.setVisibility(this.visible)}},xd.prototype.setAttributes=function(t){var e=this.geometry,i=e.attributes;for(var r in t)if("picking"!==r){var n=t[r],o=n.length;if("index"===r){var a=e.getIndex();e.setDrawRange(0,1/0),o>a.array.length?e.setIndex(new me(n,1).setDynamic(this.dynamic)):(a.set(n),a.needsUpdate=o>0,a.updateRange.count=o,e.setDrawRange(0,o)),this.indexVersion++,this.wireframe&&this.updateWireframeIndex()}else{var s=i[r];o>s.array.length?e.addAttribute(r,new me(n,s.itemSize).setDynamic(this.dynamic)):(i[r].set(n),i[r].needsUpdate=o>0,i[r].updateRange.count=o)}}},xd.prototype.setUniforms=function(t){if(t){var e=this.material.uniforms,i=this.wireframeMaterial.uniforms,r=this.pickingMaterial.uniforms;for(var n in t)"opacity"===n&&this.setProperties({transparent:this.transparent}),void 0!==e[n]&&(e[n].value.isVector3?e[n].value.copy(t[n]):e[n].value.set?e[n].value.set(t[n]):e[n].value=t[n]),void 0!==i[n]&&(i[n].value.isVector3?i[n].value.copy(t[n]):i[n].value.set?i[n].value.set(t[n]):i[n].value=t[n]),void 0!==r[n]&&(r[n].value.isVector3?r[n].value.copy(t[n]):r[n].value.set?r[n].value.set(t[n]):r[n].value=t[n])}},xd.prototype.setProperties=function(t){if(t){var e=this.material,i=this.wireframeMaterial,r=this.pickingMaterial;for(var n in t){var o=t[n];"transparent"===n?this.updateRenderOrder():"side"===n&&(o=vd(o)),void 0!==e[n]&&(e[n]=o),void 0!==i[n]&&(i[n]=o),void 0!==r[n]&&(r[n]=o)}e.needsUpdate=!0,i.needsUpdate=!0,r.needsUpdate=!0}},xd.prototype.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))},xd.prototype.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()},Object.defineProperties(xd.prototype,_d);var wd=function(t){function e(e,i){var r=e||{};!r.primitiveId&&r.position&&(r.primitiveId=su(r.position.length/3)),t.call(this,r,i),this.addAttributes({normal:{type:"v3",value:r.normal}}),void 0===r.normal&&this.geometry.computeVertexNormals()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={vertexShader:{},fragmentShader:{}};return i.vertexShader.get=function(){return"Mesh.vert"},i.fragmentShader.get=function(){return"Mesh.frag"},Object.defineProperties(e.prototype,i),e}(xd),Sd=new N,Ad=new Vt,Md=function(t){function e(e,i,r){var n,o=e||{},a=i||{},s=r.attributes.position.array,c=r.attributes.normal.array,u=r.index?r.index.array:void 0,h=o.position.length/3,l=s.length/3,p=h*l,d=new Float32Array(3*p),f=new Float32Array(3*p),m=new Float32Array(3*p);u&&(n=zo(h*u.length,p)),t.call(this,{position:d,color:m,index:n,normal:f,primitiveId:o.primitiveId||cu(h,l),picking:o.picking},a),this.setAttributes(o),this.geoPosition=s,this.geoNormal=c,this.geoIndex=u,this.positionCount=h,this.geoPositionCount=l,this.transformedGeoPosition=new Float32Array(3*l),this.transformedGeoNormal=new Float32Array(3*l),this.meshPosition=d,this.meshColor=m,this.meshIndex=n,this.meshNormal=f,this.meshIndex=n,this.makeIndex()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={updateNormals:{}};return e.prototype.applyPositionTransform=function(){},e.prototype.setAttributes=function(t,e){var i,r,n,o,a,s,c,u,h,l=this.geometry.attributes,p=this.updateNormals;t.position&&(i=t.position,n=this.geoPosition,c=this.meshPosition,a=this.transformedGeoPosition,l.position.needsUpdate=!0,(p||e)&&(o=this.geoNormal,h=this.meshNormal,s=this.transformedGeoNormal,l.normal.needsUpdate=!0)),t.color&&(r=t.color,u=this.meshColor,l.color.needsUpdate=!0);for(var d=this.positionCount,f=this.geoPositionCount,m=0;m<d;++m){var g=void 0,v=void 0,y=m*f*3,b=3*m;if(i&&(a.set(n),Sd.makeTranslation(i[b],i[b+1],i[b+2]),this.applyPositionTransform(Sd,m,b),Ah(Sd.elements,a),c.set(a,y),p?(s.set(o),Ad.getNormalMatrix(Sd),Mh(Ad.elements,s),h.set(s,y)):e&&h.set(o,y)),r)for(g=0;g<f;++g)u[v=y+3*g]=r[b],u[v+1]=r[b+1],u[v+2]=r[b+2]}},e.prototype.makeIndex=function(){var t=this.geoIndex,e=this.meshIndex;if(t)for(var i=this.positionCount,r=this.geoPositionCount,n=3*(t.length/3),o=0;o<i;++o){var a=o*n,s=a+n;e.set(t,a);for(var c=a;c<s;++c)e[c]+=o*r}},i.updateNormals.get=function(){return!1},Object.defineProperties(e.prototype,i),e}(wd),Pd=new O,Td=function(t){function e(e,i){var r=i||{},n=new Gi(1,Eo(r.sphereDetail,1));t.call(this,e,r,n),this.setAttributes(e,!0)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.applyPositionTransform=function(t,e){var i=this._radius[e];Pd.set(i,i,i),t.scale(Pd)},e.prototype.setAttributes=function(e,i){e.radius&&(this._radius=e.radius),t.prototype.setAttributes.call(this,e,i)},e}(Md);wc.add("shader/SphereImpostor.vert","uniform mat4 projectionMatrixInverse;\nuniform float nearClip;\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\nattribute vec2 mapping;\nattribute float radius;\n#ifdef PICKING\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#endif\n#include matrix_scale\nconst mat4 D = mat4(\n1.0, 0.0, 0.0, 0.0,\n0.0, 1.0, 0.0, 0.0,\n0.0, 0.0, 1.0, 0.0,\n0.0, 0.0, 0.0, -1.0\n);\nmat4 transpose( in mat4 inMatrix ) {\nvec4 i0 = inMatrix[0];\nvec4 i1 = inMatrix[1];\nvec4 i2 = inMatrix[2];\nvec4 i3 = inMatrix[3];\nmat4 outMatrix = mat4(\nvec4(i0.x, i1.x, i2.x, i3.x),\nvec4(i0.y, i1.y, i2.y, i3.y),\nvec4(i0.z, i1.z, i2.z, i3.z),\nvec4(i0.w, i1.w, i2.w, i3.w)\n);\nreturn outMatrix;\n}\nvoid ComputePointSizeAndPositionInClipCoordSphere(){\nvec2 xbc;\nvec2 ybc;\nmat4 T = mat4(\nradius, 0.0, 0.0, 0.0,\n0.0, radius, 0.0, 0.0,\n0.0, 0.0, radius, 0.0,\nposition.x, position.y, position.z, 1.0\n);\nmat4 R = transpose( projectionMatrix * modelViewMatrix * T );\nfloat A = dot( R[ 3 ], D * R[ 3 ] );\nfloat B = -2.0 * dot( R[ 0 ], D * R[ 3 ] );\nfloat C = dot( R[ 0 ], D * R[ 0 ] );\nxbc[ 0 ] = ( -B - sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nxbc[ 1 ] = ( -B + sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nfloat sx = abs( xbc[ 0 ] - xbc[ 1 ] ) * 0.5;\nA = dot( R[ 3 ], D * R[ 3 ] );\nB = -2.0 * dot( R[ 1 ], D * R[ 3 ] );\nC = dot( R[ 1 ], D * R[ 1 ] );\nybc[ 0 ] = ( -B - sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nybc[ 1 ] = ( -B + sqrt( B * B - 4.0 * A * C ) ) / ( 2.0 * A );\nfloat sy = abs( ybc[ 0 ] - ybc[ 1 ] ) * 0.5;\ngl_Position.xy = vec2( 0.5 * ( xbc.x + xbc.y ), 0.5 * ( ybc.x + ybc.y ) );\ngl_Position.xy -= mapping * vec2( sx, sy );\ngl_Position.xy *= gl_Position.w;\n}\nvoid main(void){\n#ifdef PICKING\nvPickingColor = unpackColor( primitiveId );\n#else\n#include color_vertex\n#endif\nvRadius = radius * matrixScale( modelViewMatrix );\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nmvPosition.z -= vRadius;\ngl_Position = projectionMatrix * vec4( mvPosition.xyz, 1.0 );\nComputePointSizeAndPositionInClipCoordSphere();\nvRadiusSq = vRadius * vRadius;\nvec4 vPoint4 = projectionMatrixInverse * gl_Position;\nvPoint = vPoint4.xyz / vPoint4.w;\nvPointViewPosition = -mvPosition.xyz / mvPosition.w;\n}"),wc.add("shader/SphereImpostor.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 mat4 projectionMatrix;\nuniform float ortho;\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n#ifdef PICKING\nuniform float objectId;\nvarying vec3 vPickingColor;\n#else\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\nbool flag2 = false;\nbool interior = false;\nvec3 cameraPos;\nvec3 cameraNormal;\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}\nfloat calcClip( vec3 cameraPos ){\nreturn dot( vec4( cameraPos, 1.0 ), vec4( 0.0, 0.0, 1.0, nearClip - 0.5 ) );\n}\nbool Impostor( out vec3 cameraPos, out vec3 cameraNormal ){\nvec3 cameraSpherePos = -vPointViewPosition;\ncameraSpherePos.z += vRadius;\nvec3 rayOrigin = mix( vec3( 0.0, 0.0, 0.0 ), vPoint, ortho );\nvec3 rayDirection = mix( normalize( vPoint ), vec3( 0.0, 0.0, 1.0 ), ortho );\nvec3 cameraSphereDir = mix( cameraSpherePos, rayOrigin - cameraSpherePos, ortho );\nfloat B = dot( rayDirection, cameraSphereDir );\nfloat det = B * B + vRadiusSq - dot( cameraSphereDir, cameraSphereDir );\nif( det < 0.0 ){\ndiscard;\nreturn false;\n}else{\nfloat sqrtDet = sqrt( det );\nfloat posT = mix( B + sqrtDet, B + sqrtDet, ortho );\nfloat negT = mix( B - sqrtDet, sqrtDet - B, ortho );\ncameraPos = rayDirection * negT + rayOrigin;\n#ifdef NEAR_CLIP\nif( calcDepth( cameraPos ) <= 0.0 ){\ncameraPos = rayDirection * posT + rayOrigin;\ninterior = true;\nreturn false;\n}else if( calcClip( cameraPos ) > 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}");var Ed=function(t){function e(e,i){t.call(this,e,i),this.index=zo(this.indexSize,this.attributeSize),this.makeIndex(),this.initIndex(this.index,1),this.addAttributes({mapping:{type:this.mappingType,value:null}}),this.setAttributes({primitiveId:su(this.size)})}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={attributeSize:{},indexSize:{},mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return i.attributeSize.get=function(){return this.size*this.mappingSize},i.indexSize.get=function(){return this.size*this.mappingIndicesSize},i.mapping.get=function(){},i.mappingIndices.get=function(){},i.mappingIndicesSize.get=function(){},i.mappingType.get=function(){},i.mappingSize.get=function(){},i.mappingItemSize.get=function(){},e.prototype.addAttributes=function(e){var i={};for(var r in e){var n=e[r];i[r]={type:n.type,value:null}}t.prototype.addAttributes.call(this,i)},e.prototype.getAttributeIndex=function(t){return 3*t*this.mappingSize},e.prototype.setAttributes=function(t){t&&!t.position&&t.position1&&t.position2&&(t.position=nu(t.position1,t.position2));var e,i,r,n,o,a,s,c=this.size,u=this.mappingSize,h=this.geometry.attributes;for(var l in t)if("index"!==l&&"picking"!==l){i=t[l],r=(e=h[l]).itemSize,n=e.array;for(var p=0;p<c;++p){a=(o=p*r)*u;for(var d=0;d<u;++d){s=a+r*d;for(var f=0;f<r;++f)n[s+f]=i[o+f]}}e.needsUpdate=!0}},e.prototype.makeMapping=function(){for(var t=this.size,e=this.mapping,i=this.mappingSize,r=this.mappingItemSize,n=this.geometry.attributes.mapping.array,o=0;o<t;o++)n.set(e,o*r*i)},e.prototype.makeIndex=function(){for(var t,e,i=this.size,r=this.mappingSize,n=this.mappingIndices,o=this.mappingIndicesSize,a=this.index,s=0;s<i;s++){t=s*o,e=s*r,a.set(n,t);for(var c=0;c<o;++c)a[t+c]+=e}},Object.defineProperties(e.prototype,i),e}(xd),Cd=new Float32Array([-1,1,-1,-1,1,1,1,-1]),Id=new Uint16Array([0,1,2,1,3,2]),Rd=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return i.mapping.get=function(){return Cd},i.mappingIndices.get=function(){return Id},i.mappingIndicesSize.get=function(){return 6},i.mappingType.get=function(){return"v2"},i.mappingSize.get=function(){return 4},i.mappingItemSize.get=function(){return 2},Object.defineProperties(e.prototype,i),e}(Ed),Ld=function(t){function e(e,i){t.call(this,e,i),this.addUniforms({projectionMatrixInverse:{value:new N},ortho:{value:0}}),this.addAttributes({radius:{type:"f",value:null}}),this.setAttributes(e),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isImpostor:{},vertexShader:{},fragmentShader:{}};return i.isImpostor.get=function(){return!0},i.vertexShader.get=function(){return"SphereImpostor.vert"},i.fragmentShader.get=function(){return"SphereImpostor.frag"},Object.defineProperties(e.prototype,i),e}(Rd),Od=function(t,e){return!dc||e&&e.disableImpostor?new Td(t,e):new Ld(t,e)},Nd=new O,Dd=new O,kd=new O,Fd=new O(0,0,0),Bd=function(t){function e(e,i){var r=i||{},n=new Gi(1,Eo(r.sphereDetail,2));t.call(this,e,r,n),this.setAttributes(e,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,i){Dd.fromArray(this._majorAxis,i),kd.fromArray(this._minorAxis,i),t.lookAt(Fd,Dd,kd),Nd.set(this._radius[e],kd.length(),Dd.length()),t.scale(Nd)},e.prototype.setAttributes=function(e,i){e.radius&&(this._radius=e.radius),e.majorAxis&&(this._majorAxis=e.majorAxis),e.minorAxis&&(this._minorAxis=e.minorAxis),t.prototype.setAttributes.call(this,e,i)},i.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,i),e}(Md),zd=function(t,e){return new Bd(t,e)},Ud=new O,jd=new O,Gd=new O,Vd=new O(0,1,0),$d=function(t){function e(e,i){var r=e||{},n=i||{},o=Eo(n.radialSegments,10),a=Eo(n.openEnded,!0),s=(new N).makeRotationX(Math.PI/2),c=new pr(1,1,1,o,1,a);c.applyMatrix(s);var u=r.position1.length,h=r.radius.length,l=c.attributes.position.array.length/3,p=u/3,d=new Float32Array(2*p*l);cu(p,l,0,d),cu(p,l,p*l,d);var f=new Float32Array(2*u),m=new Float32Array(2*u);t.call(this,{position:f,color:m,primitiveId:d,picking:r.picking},n,c),this.__center=new Float32Array(u),this._position=f,this._color=m,this._from=new Float32Array(2*u),this._to=new Float32Array(2*u),this._radius=new Float32Array(2*h),this.setAttributes(r,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,i){jd.fromArray(this._from,i),Gd.fromArray(this._to,i),t.lookAt(jd,Gd,Vd);var r=this._radius[e];Ud.set(r,r,jd.distanceTo(Gd)),t.scale(Ud)},e.prototype.setAttributes=function(e,i){var r={};e.position1&&e.position2&&(nu(e.position1,e.position2,this.__center),nu(e.position1,this.__center,this._position),nu(this.__center,e.position2,this._position,e.position1.length),this._from.set(e.position1),this._from.set(this.__center,e.position1.length),this._to.set(this.__center),this._to.set(e.position2,this.__center.length),r.position=this._position),e.color&&e.color2&&(this._color.set(e.color),this._color.set(e.color2,e.color.length),r.color=this._color),e.radius&&(this._radius.set(e.radius),this._radius.set(e.radius,e.radius.length),r.radius=this._radius),t.prototype.setAttributes.call(this,r,i)},i.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,i),e}(Md);wc.add("shader/CylinderImpostor.vert","\nattribute vec3 mapping;\nattribute vec3 position1;\nattribute vec3 position2;\nattribute float radius;\nvarying vec3 axis;\nvarying vec4 base_radius;\nvarying vec4 end_b;\nvarying vec3 U;\nvarying vec3 V;\nvarying vec4 w;\n#ifdef PICKING\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\nattribute vec3 color2;\nvarying vec3 vColor1;\nvarying vec3 vColor2;\n#endif\nuniform mat4 modelViewMatrixInverse;\nuniform float ortho;\n#include matrix_scale\nvoid main(){\n#ifdef PICKING\nvPickingColor = unpackColor( primitiveId );\n#else\nvColor1 = color;\nvColor2 = color2;\n#endif\nbase_radius.w = radius * matrixScale( modelViewMatrix );\nvec3 center = position;\nvec3 dir = normalize( position2 - position1 );\nfloat ext = length( position2 - position1 ) / 2.0;\nvec3 cam_dir;\nif( ortho == 0.0 ){\ncam_dir = ( modelViewMatrixInverse * vec4( 0, 0, 0, 1 ) ).xyz - center;\n}else{\ncam_dir = ( modelViewMatrixInverse * vec4( 0, 0, 1, 0 ) ).xyz;\n}\ncam_dir = normalize( cam_dir );\nvec3 ldir;\nfloat b = dot( cam_dir, dir );\nend_b.w = b;\nif( b < 0.0 )\nldir = -ext * dir;\nelse\nldir = ext * dir;\nvec3 left = normalize( cross( cam_dir, ldir ) );\nleft = radius * left;\nvec3 up = radius * normalize( cross( left, ldir ) );\naxis = normalize( normalMatrix * ldir );\nU = normalize( normalMatrix * up );\nV = normalize( normalMatrix * left );\nvec4 base4 = modelViewMatrix * vec4( center - ldir, 1.0 );\nbase_radius.xyz = base4.xyz / base4.w;\nvec4 top_position = modelViewMatrix * vec4( center + ldir, 1.0 );\nvec4 end4 = top_position;\nend_b.xyz = end4.xyz / end4.w;\nw = modelViewMatrix * vec4(\ncenter + mapping.x*ldir + mapping.y*left + mapping.z*up, 1.0\n);\ngl_Position = projectionMatrix * w;\ngl_Position.z = 0.99;\n}"),wc.add("shader/CylinderImpostor.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 mat4 projectionMatrix;\nuniform float ortho;\nvarying vec3 axis;\nvarying vec4 base_radius;\nvarying vec4 end_b;\nvarying vec3 U;\nvarying vec3 V;\nvarying vec4 w;\n#ifdef PICKING\nuniform float objectId;\nvarying vec3 vPickingColor;\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 distSq3( vec3 v3a, vec3 v3b ){\nreturn (\n( v3a.x - v3b.x ) * ( v3a.x - v3b.x ) +\n( v3a.y - v3b.y ) * ( v3a.y - v3b.y ) +\n( v3a.z - v3b.z ) * ( v3a.z - v3b.z )\n);\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}\nfloat calcClip( vec3 cameraPos ){\nreturn dot( vec4( cameraPos, 1.0 ), vec4( 0.0, 0.0, 1.0, nearClip - 0.5 ) );\n}\nvoid main(){\nvec3 point = w.xyz / w.w;\nvec3 base = base_radius.xyz;\nfloat vRadius = base_radius.w;\nvec3 end = end_b.xyz;\nfloat b = end_b.w;\nvec3 end_cyl = end;\nvec3 surface_point = point;\nvec3 ray_target = surface_point;\nvec3 ray_origin = vec3(0.0);\nvec3 ray_direction = mix(normalize(ray_origin - ray_target), vec3(0.0, 0.0, 1.0), ortho);\nmat3 basis = mat3( U, V, axis );\nvec3 diff = ray_target - 0.5 * (base + end_cyl);\nvec3 P = diff * basis;\nfloat dz = dot( axis, ray_direction );\nfloat radius2 = vRadius*vRadius;\nvec3 D = vec3(dot(U, ray_direction),\ndot(V, ray_direction),\ndz);\nfloat a0 = P.x*P.x + P.y*P.y - radius2;\nfloat a1 = P.x*D.x + P.y*D.y;\nfloat a2 = D.x*D.x + D.y*D.y;\nfloat d = a1*a1 - a0*a2;\nif (d < 0.0)\ndiscard;\nfloat dist = (-a1 + sqrt(d)) / a2;\nvec3 new_point = ray_target + dist * ray_direction;\nvec3 tmp_point = new_point - base;\nvec3 _normal = normalize( tmp_point - axis * dot(tmp_point, axis) );\nray_origin = mix( ray_origin, surface_point, ortho );\nfloat front_cap_test = dot( tmp_point, axis );\nfloat end_cap_test = dot((new_point - end_cyl), axis);\n#ifndef CAP\nvec3 new_point2 = ray_target + ( (-a1 - sqrt(d)) / a2 ) * ray_direction;\nvec3 tmp_point2 = new_point2 - base;\n#endif\nif (front_cap_test < 0.0)\n{\nfloat dNV = dot(-axis, ray_direction);\nif (dNV < 0.0)\ndiscard;\nfloat near = dot(-axis, (base)) / dNV;\nvec3 front_point = ray_direction * near + ray_origin;\nif (dot(front_point - base, front_point-base) > 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\ngl_FragColor = vec4( vPickingColor, objectId );\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}");var Hd=new Float32Array([-1,1,-1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,1,-1,1]),Wd=new Uint16Array([0,1,2,1,4,2,2,4,3,4,5,3]),Xd=function(t){function e(e,i){t.call(this,e,i);var r=i||{};this.openEnded=Eo(r.openEnded,!1),this.addUniforms({modelViewMatrixInverse:{value:new N},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(e),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={parameters:{},isImpostor:{},vertexShader:{},fragmentShader:{}};return i.parameters.get=function(){return Object.assign.call(this,{openEnded:{updateShader:!0}},t.prototype.parameters)},e.prototype.getDefines=function(e){var i=t.prototype.getDefines.call(this,e);return this.openEnded||(i.CAP=1),i},i.isImpostor.get=function(){return!0},i.vertexShader.get=function(){return"CylinderImpostor.vert"},i.fragmentShader.get=function(){return"CylinderImpostor.frag"},Object.defineProperties(e.prototype,i),e}(function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return i.mapping.get=function(){return Hd},i.mappingIndices.get=function(){return Wd},i.mappingIndicesSize.get=function(){return 12},i.mappingType.get=function(){return"v3"},i.mappingSize.get=function(){return 6},i.mappingItemSize.get=function(){return 3},Object.defineProperties(e.prototype,i),e}(Ed)),qd=function(t,e){return!dc||e&&e.disableImpostor?new $d(t,e):new Xd(t,e)},Yd=new O,Zd=new O,Kd=new O,Qd=new O(0,1,0),Jd=function(t){function e(e,i){var r=i||{},n=Eo(r.radialSegments,60),o=Eo(r.openEnded,!1),a=(new N).makeRotationX(-Math.PI/2),s=new fr(1,1,n,1,o);s.applyMatrix(a);var c=e.position1.length,u=e.radius.length,h=new Float32Array(c);t.call(this,{position:h,color:e.color,picking:e.picking},r,s),this._position=h,this._from=new Float32Array(c),this._to=new Float32Array(c),this._radius=new Float32Array(u),this.setAttributes(e,!0)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={updateNormals:{}};return e.prototype.applyPositionTransform=function(t,e,i){Zd.fromArray(this._from,i),Kd.fromArray(this._to,i),t.lookAt(Zd,Kd,Qd);var r=this._radius[e];Yd.set(r,r,Zd.distanceTo(Kd)),t.scale(Yd)},e.prototype.setAttributes=function(e,i){var r={};e.position1&&e.position2&&(nu(e.position1,e.position2,this._position),this._from.set(e.position1),this._to.set(e.position2),r.position=this._position),e.color&&(r.color=e.color),e.radius&&this._radius.set(e.radius),t.prototype.setAttributes.call(this,r,i)},i.updateNormals.get=function(){return!0},Object.defineProperties(e.prototype,i),e}(Md),tf=function(t,e){return new Jd(t,e)},ef=function(t){this.geometryList=t,this.boundingBox=null};ef.prototype.computeBoundingBox=function(){var t=this;this.boundingBox?this.boundingBox.empty():this.boundingBox=new jt,this.geometryList.forEach((function(e){e.boundingBox||e.computeBoundingBox(),t.boundingBox.union(e.boundingBox)}))};var rf=function(t,e){var i=t||{},r=e||{};this.aspectRatio=Eo(r.aspectRatio,1.5),this.wireframe=Eo(r.wireframe,!1),this.splitPosition=new Float32Array(i.position1.length),this.cylinderRadius=new Float32Array(i.radius.length);var n=this.makeAttributes(i),o={radialSegments:Eo(r.radialSegments,50),openEnded:Eo(r.openEnded,!1),disableImpostor:Eo(r.disableImpostor,!1)};this.cylinderBuffer=new qd(n.cylinder,o),this.coneBuffer=new tf(n.cone,o),this.geometry=new ef([this.cylinderBuffer.geometry,this.coneBuffer.geometry]),this.group=new Ci,this.wireframeGroup=new Ci,this.pickingGroup=new Ci,this.matrix=Eo(r.matrix,new N),this.picking=i.picking},nf={matrix:{},pickable:{}};nf.matrix.set=function(t){xd.prototype.setMatrix.call(this,t)},nf.matrix.get=function(){return this.group.matrix.clone()},nf.pickable.get=function(){return!!this.picking},rf.prototype.makeAttributes=function(t){var e,i,r=this.splitPosition,n=this.cylinderRadius,o=this.aspectRatio,a={},s={};if(t.radius){for(e=0,i=n.length;e<i;++e)n[e]=t.radius[e]/o;a.radius=n,s.radius=t.radius}if(t.position1&&t.position2){var c=new O,u=new O,h=new O,l=new O;for(e=0,i=r.length;e<i;e+=3){c.fromArray(t.position1,e),u.fromArray(t.position2,e),h.subVectors(c,u);var p=h.length(),d=n[e/3]*o*2,f=Math.min(p,d);h.setLength(f),l.copy(u).add(h),l.toArray(r,e)}a.position1=t.position1,a.position2=r,s.position1=r,s.position2=t.position2}return t.color&&(a.color=t.color,a.color2=t.color,s.color=t.color),{cylinder:a,cone:s}},rf.prototype.getMesh=function(t){return(new Ci).add(this.cylinderBuffer.getMesh(t),this.coneBuffer.getMesh(t))},rf.prototype.getWireframeMesh=function(){return(new Ci).add(this.cylinderBuffer.getWireframeMesh(),this.coneBuffer.getWireframeMesh())},rf.prototype.getPickingMesh=function(){return(new Ci).add(this.cylinderBuffer.getPickingMesh(),this.coneBuffer.getPickingMesh())},rf.prototype.setAttributes=function(t){var e=this.makeAttributes(t);this.cylinderBuffer.setAttributes(e.cylinder),this.coneBuffer.setAttributes(e.cone)},rf.prototype.setParameters=function(t){(t=Object.assign({},t))&&void 0!==t.matrix&&(this.matrix=t.matrix),delete t.matrix,t&&void 0!==t.wireframe&&(this.wireframe=t.wireframe,this.setVisibility(this.visible)),this.cylinderBuffer.setParameters(t),this.coneBuffer.setParameters(t)},rf.prototype.setVisibility=function(){xd.prototype.setVisibility.apply(this,arguments)},rf.prototype.dispose=function(){this.cylinderBuffer.dispose(),this.coneBuffer.dispose()},Object.defineProperties(rf.prototype,nf),wc.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;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvarying vec3 vViewPosition;\n#endif\nvarying vec2 texCoord;\n#if defined( RADIUS_CLIP )\nvarying vec3 vClipCenter;\n#endif\n#if defined( PICKING )\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#endif\nattribute vec2 mapping;\nattribute vec2 inputTexCoord;\nattribute float inputSize;\n#include matrix_scale\n#include common\nvoid main(void){\n#if defined( PICKING )\nvPickingColor = unpackColor( primitiveId );\n#else\n#include color_vertex\n#endif\ntexCoord = inputTexCoord;\nfloat scale = matrixScale( modelViewMatrix );\nfloat _zOffset = zOffset * scale;\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 * scale;\ncameraCornerPos.x += xOffset * scale;\ncameraCornerPos.y += yOffset * scale;\nif( !ortho ){\ncameraCornerPos.xyz += normalize( -cameraCornerPos.xyz ) * _zOffset;\n}\ngl_Position = projectionMatrix * cameraCornerPos;\n#if defined( NEAR_CLIP ) || defined( RADIUS_CLIP ) || ( !defined( PICKING ) && !defined( NOLIGHT ) )\nvViewPosition = -cameraCornerPos.xyz;\n#endif\n#if defined( RADIUS_CLIP )\nvClipCenter = -( modelViewMatrix * vec4( clipCenter, 1.0 ) ).xyz;\n#endif\n#include nearclip_vertex\n#include radiusclip_vertex\n}"),wc.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#if defined( PICKING )\nuniform float objectId;\nvarying vec3 vPickingColor;\nconst vec3 vColor = vec3( 0.0 );\n#else\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#endif\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#if defined( PICKING )\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\n#include premultiplied_alpha_fragment\n#include tonemapping_fragment\n#include encodings_fragment\n#include fog_fragment\n#endif\n}");var of={};var af=function(t){var e=Object.assign({},t);if(this.font=Eo(e.font,["sans-serif"]),this.size=Eo(e.size,36),this.style=Eo(e.style,"normal"),this.variant=Eo(e.variant,"normal"),this.weight=Eo(e.weight,"normal"),this.outline=Eo(e.outline,0),this.width=Eo(e.width,2048),this.height=Eo(e.height,2048),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 Ri(this.canvas2),this.texture.flipY=!1,this.texture.needsUpdate=!0};af.prototype.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 r=i.getContext("2d");r.font=this.style+" "+this.variant+" "+this.weight+" "+this.size+"px "+this.font,r.fillStyle="#FF0000",r.textAlign="left",r.textBaseline="bottom",r.lineJoin="round";for(var n=[],o=3*this.outline,a=0;a<o;++a){var s=("00"+Math.max(0,8*-a+128-8*!a).toString(16)).slice(-2);n.push("#"+s+s+s)}var c=new Uint8Array(e*t*2);this.canvas=i,this.context=r,this.lineHeight=t,this.maxWidth=e,this.colors=n,this.scratch=c,this.data=new Uint8Array(this.width*this.height*4),this.canvas2=document.createElement("canvas"),this.canvas2.width=this.width,this.canvas2.height=this.height,this.context2=this.canvas2.getContext("2d")},af.prototype.map=function(t){return void 0===this.mapped[t]&&(this.draw(t),this.currentX+this.scratchW>this.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]},af.prototype.get=function(t){return this.mapped[t]||this.placeholder},af.prototype.draw=function(t){var e,i,r,n,o,a=this.lineHeight,s=this.outline,c=this.context,u=this.scratch,h=this.maxWidth,l=this.colors,p=s,d=a-this.outline,f=c.measureText(t),m=Math.min(h,Math.ceil(f.width+2*p+1));if(c.clearRect(0,0,m,a),0===this.outline)for(c.fillText(t,p,d),r=3,e=0,i=(o=(n=c.getImageData(0,0,m,a)).data).length/4;e<i;++e)u[e]=o[r],r+=4;else{for(c.globalCompositeOperation="source-over",e=s+1;e>0;--e)r=e>1?2*e-2:e,c.strokeStyle=l[r-1],c.lineWidth=r,c.strokeText(t,p,d);c.globalCompositeOperation="multiply",c.fillStyle="#FF00FF",c.fillText(t,p,d),o=(n=c.getImageData(0,0,m,a)).data,r=0;var g=this.gamma;for(e=0,i=o.length/4;e<i;++e){var v=o[r],y=v?o[r+1]/v:1;.5===g&&(y=Math.sqrt(y));var b=256-v,x=b+(v-b)*(y=Math.min(1,Math.max(0,y)));u[e]=Math.max(0,Math.min(255,x+2)),o[r+3]=u[e],r+=4}}c.putImageData(n,0,0),this.scratchW=m,this.scratchH=a},af.prototype.populate=function(){this.placeholder=this.map(String.fromCharCode(65533));for(var t=0;t<127;++t)this.map(String.fromCharCode(t));for(var e=128;e<255;++e)this.map(String.fromCharCode(e));for(var i=880;i<1023;++i)this.map(String.fromCharCode(i));for(var r=1024;r<1279;++r)this.map(String.fromCharCode(r));this.map(String.fromCharCode(8491))};var sf=function(t){function e(e,i){var r=e||{},n=i||{};n.forceTransparent=!0;for(var o=r.position.length/3,a=0,s=0;s<o;++s)a+=r.text[s].length;var c=a;n.showBackground&&(c+=o),t.call(this,{position:new Float32Array(3*c),color:new Float32Array(3*c),picking:new Qh},n),this.fontFamily=Eo(n.fontFamily,"sans-serif"),this.fontStyle=Eo(n.fontStyle,"normal"),this.fontWeight=Eo(n.fontWeight,"bold"),this.fontSize=Eo(n.fontSize,48),this.sdf=Eo(n.sdf,"Chrome"===hc),this.xOffset=Eo(n.xOffset,0),this.yOffset=Eo(n.yOffset,0),this.zOffset=Eo(n.zOffset,.5),this.attachment=Eo(n.attachment,"bottom-left"),this.showBorder=Eo(n.showBorder,!1),this.borderColor=Eo(n.borderColor,"lightgrey"),this.borderWidth=Eo(n.borderWidth,.15),this.showBackground=Eo(n.showBackground,!1),this.backgroundColor=Eo(n.backgroundColor,"lightgrey"),this.backgroundMargin=Eo(n.backgroundMargin,.5),this.backgroundOpacity=Eo(n.backgroundOpacity,1),this.text=r.text,this.positionCount=o,this.addUniforms({fontTexture:{value:null},xOffset:{value:this.xOffset},yOffset:{value:this.yOffset},zOffset:{value:this.zOffset},ortho:{value:!1},showBorder:{value:this.showBorder},borderColor:{value:new St(this.borderColor)},borderWidth:{value:this.borderWidth},backgroundColor:{value:new St(this.backgroundColor)},backgroundOpacity:{value:this.backgroundOpacity}}),this.addAttributes({inputTexCoord:{type:"v2",value:null},inputSize:{type:"f",value:null}}),this.setAttributes(e),this.makeTexture(),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={parameters:{},wireframe:{},isText:{},vertexShader:{},fragmentShader:{}};return i.parameters.get=function(){return Object.assign.call(this,{fontFamily:{uniform:!0},fontStyle:{uniform:!0},fontWeight:{uniform:!0},fontSize:{uniform:!0},sdf:{updateShader:!0,uniform:!0},xOffset:{uniform:!0},yOffset:{uniform:!0},zOffset:{uniform:!0},showBorder:{uniform:!0},borderColor:{uniform:!0},borderWidth:{uniform:!0},backgroundColor:{uniform:!0},backgroundOpacity:{uniform:!0}},t.prototype.parameters,{flatShaded:void 0})},e.prototype.makeMaterial=function(){t.prototype.makeMaterial.call(this);var e=this.texture,i=this.material;i.extensions.derivatives=!0,i.lights=!1,i.uniforms.fontTexture.value=e,i.needsUpdate=!0;var r=this.wireframeMaterial;r.extensions.derivatives=!0,r.lights=!1,r.uniforms.fontTexture.value=e,r.needsUpdate=!0;var n=this.pickingMaterial;n.extensions.derivatives=!0,n.lights=!1,n.uniforms.fontTexture.value=e,n.needsUpdate=!0},e.prototype.setAttributes=function(t){var e,i,r,n,o,a,s=this.text,c=this.geometry.attributes;t.position&&(e=t.position,n=c.position.array,c.position.needsUpdate=!0),t.size&&(i=t.size,o=c.inputSize.array,c.inputSize.needsUpdate=!0),t.color&&(r=t.color,a=c.color.array,c.color.needsUpdate=!0);for(var u,h,l,p,d=this.positionCount,f=0,m=0;m<d;++m)for(h=3*m,p=s[m].length,this.showBackground&&(p+=1),l=0;l<p;++l,++f)for(var g=0;g<4;g++)u=4*f*3+3*g,e&&(n[u]=e[h],n[u+1]=e[h+1],n[u+2]=e[h+2]),i&&(o[4*f+g]=i[m]),r&&(a[u]=r[h],a[u+1]=r[h+1],a[u+2]=r[h+2])},e.prototype.makeTexture=function(){var t,e;this.textAtlas=(t={font:[this.fontFamily],style:this.fontStyle,weight:this.fontWeight,size:this.fontSize,outline:this.sdf?5:0},e=JSON.stringify(t),void 0===of[e]&&(of[e]=new af(t)),of[e]),this.texture=this.textAtlas.texture},e.prototype.makeMapping=function(){for(var t,e,i,r,n,o,a,s,c=this.textAtlas,u=this.text,h=this.attachment,l=c.lineHeight*this.backgroundMargin*.1-10,p=this.geometry.attributes.inputTexCoord.array,d=this.geometry.attributes.mapping.array,f=this.positionCount,m=0,g=0;g<f;++g){for(r=0,o=(i=u[g]).length,n=0;n<o;++n)r+=(t=c.get(i[n])).w-2*c.outline;for(s=h.startsWith("top")?c.lineHeight/1.25:h.startsWith("middle")?c.lineHeight/2.5:0,a=h.endsWith("right")?r:h.endsWith("center")?r/2:0,a+=c.outline,s+=c.outline,this.showBackground&&(d[(e=2*m*4)+0]=-c.lineHeight/6-a-l,d[e+1]=c.lineHeight-s+l,d[e+2]=-c.lineHeight/6-a-l,d[e+3]=0-s-l,d[e+4]=r+c.lineHeight/6-a+2*c.outline+l,d[e+5]=c.lineHeight-s+l,d[e+6]=r+c.lineHeight/6-a+2*c.outline+l,d[e+7]=0-s-l,p[e+0]=10,p[e+2]=10,p[e+4]=10,p[e+6]=10,m+=1),r=0,n=0;n<o;++n,++m){t=c.get(i[n]),d[(e=2*m*4)+0]=r-a,d[e+1]=t.h-s,d[e+2]=r-a,d[e+3]=0-s,d[e+4]=r+t.w-a,d[e+5]=t.h-s,d[e+6]=r+t.w-a,d[e+7]=0-s;var v=c.width,y=c.height,b=[t.x/v,t.y/y,t.x/v,(t.y+t.h)/y,(t.x+t.w)/v,t.y/y,(t.x+t.w)/v,(t.y+t.h)/y];p.set(b,e),r+=t.w-2*c.outline}}this.geometry.attributes.inputTexCoord.needsUpdate=!0,this.geometry.attributes.mapping.needsUpdate=!0},e.prototype.getDefines=function(e){var i=t.prototype.getDefines.call(this,e);return this.sdf&&(i.SDF=1),i},e.prototype.setUniforms=function(e){!e||void 0===e.fontFamily&&void 0===e.fontStyle&&void 0===e.fontWeight&&void 0===e.fontSize&&void 0===e.sdf||(this.makeTexture(),this.makeMapping(),this.texture.needsUpdate=!0,e.fontTexture=this.texture),t.prototype.setUniforms.call(this,e)},i.wireframe.set=function(t){},i.wireframe.get=function(){return!1},i.isText.get=function(){return!0},i.vertexShader.get=function(){return"SDFFont.vert"},i.fragmentShader.get=function(){return"SDFFont.frag"},Object.defineProperties(e.prototype,i),e}(Rd);function cf(t,e){void 0!==t.toArray?t=t.toArray():void 0!==t.x?t=[t.x,t.y,t.z]:void 0!==t.r&&(t=[t.r,t.g,t.b]),e.push.apply(e,t)}var uf=new O,hf=new jt,lf=function(t,e){this.name=Eo(t,"shape");var i=e||{};this.aspectRatio=Eo(i.aspectRatio,1.5),this.sphereDetail=Eo(i.sphereDetail,2),this.radialSegments=Eo(i.radialSegments,50),this.disableImpostor=Eo(i.disableImpostor,!1),this.openEnded=Eo(i.openEnded,!1),this.labelParams=Eo(i.labelParams,{}),this.boundingBox=new jt,this.bufferList=[],this.meshCount=0,this.spherePosition=[],this.sphereColor=[],this.sphereRadius=[],this.sphereName=[],this.ellipsoidPosition=[],this.ellipsoidColor=[],this.ellipsoidRadius=[],this.ellipsoidMajorAxis=[],this.ellipsoidMinorAxis=[],this.ellipsoidName=[],this.cylinderPosition1=[],this.cylinderPosition2=[],this.cylinderColor=[],this.cylinderRadius=[],this.cylinderName=[],this.conePosition1=[],this.conePosition2=[],this.coneColor=[],this.coneRadius=[],this.coneName=[],this.arrowPosition1=[],this.arrowPosition2=[],this.arrowColor=[],this.arrowRadius=[],this.arrowName=[],this.labelPosition=[],this.labelColor=[],this.labelSize=[],this.labelText=[]},pf={center:{},type:{}};lf.prototype.addBuffer=function(t){this.bufferList.push(t);var e=t.geometry;return e.boundingBox||e.computeBoundingBox(),this.boundingBox.union(e.boundingBox),this},lf.prototype.addMesh=function(t,e,i,r,n){t=$o(t),e=$o(e),Array.isArray(i)&&(i=zo(i,t.length)),r&&(r=$o(r));var o={position:t,color:e,index:i,normal:r},a=new Jh(this,Object.assign({serial:this.meshCount,name:n},o)),s=new wd(Object.assign({picking:a},o));return this.bufferList.push(s),hf.setFromArray(t),this.boundingBox.union(hf),this.meshCount+=1,this},lf.prototype.addSphere=function(t,e,i,r){return cf(t,this.spherePosition),cf(e,this.sphereColor),this.sphereRadius.push(i),this.sphereName.push(r),this.boundingBox.expandByPoint(uf.fromArray(t)),this},lf.prototype.addEllipsoid=function(t,e,i,r,n,o){return cf(t,this.ellipsoidPosition),cf(e,this.ellipsoidColor),this.ellipsoidRadius.push(i),cf(r,this.ellipsoidMajorAxis),cf(n,this.ellipsoidMinorAxis),this.ellipsoidName.push(o),this.boundingBox.expandByPoint(uf.fromArray(t)),this},lf.prototype.addCylinder=function(t,e,i,r,n){return cf(t,this.cylinderPosition1),cf(e,this.cylinderPosition2),cf(i,this.cylinderColor),this.cylinderRadius.push(r),this.cylinderName.push(n),this.boundingBox.expandByPoint(uf.fromArray(t)),this.boundingBox.expandByPoint(uf.fromArray(e)),this},lf.prototype.addCone=function(t,e,i,r,n){return cf(t,this.conePosition1),cf(e,this.conePosition2),cf(i,this.coneColor),this.coneRadius.push(r),this.coneName.push(n),this.boundingBox.expandByPoint(uf.fromArray(t)),this.boundingBox.expandByPoint(uf.fromArray(e)),this},lf.prototype.addArrow=function(t,e,i,r,n){return cf(t,this.arrowPosition1),cf(e,this.arrowPosition2),cf(i,this.arrowColor),this.arrowRadius.push(r),this.arrowName.push(n),this.boundingBox.expandByPoint(uf.fromArray(t)),this.boundingBox.expandByPoint(uf.fromArray(e)),this},lf.prototype.addLabel=function(t,e,i,r){return cf(t,this.labelPosition),cf(e,this.labelColor),this.labelSize.push(i),this.labelText.push(r),this.boundingBox.expandByPoint(uf.fromArray(t)),this},lf.prototype.getBufferList=function(){var t=[];if(this.spherePosition.length){var e=new Od({position:new Float32Array(this.spherePosition),color:new Float32Array(this.sphereColor),radius:new Float32Array(this.sphereRadius),picking:new tl(this)},{sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor});t.push(e)}if(this.ellipsoidPosition.length){var i=new zd({position:new Float32Array(this.ellipsoidPosition),color:new Float32Array(this.ellipsoidColor),radius:new Float32Array(this.ellipsoidRadius),majorAxis:new Float32Array(this.ellipsoidMajorAxis),minorAxis:new Float32Array(this.ellipsoidMinorAxis),picking:new Kh(this)},{sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor});t.push(i)}if(this.cylinderPosition1.length){var r=new qd({position1:new Float32Array(this.cylinderPosition1),position2:new Float32Array(this.cylinderPosition2),color:new Float32Array(this.cylinderColor),color2:new Float32Array(this.cylinderColor),radius:new Float32Array(this.cylinderRadius),picking:new Gh(this)},{radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,openEnded:this.openEnded});t.push(r)}if(this.conePosition1.length){var n=new tf({position1:new Float32Array(this.conePosition1),position2:new Float32Array(this.conePosition2),color:new Float32Array(this.coneColor),radius:new Float32Array(this.coneRadius),picking:new qh(this)},{radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,openEnded:this.openEnded});t.push(n)}if(this.arrowPosition1.length){var o=new rf({position1:new Float32Array(this.arrowPosition1),position2:new Float32Array(this.arrowPosition2),color:new Float32Array(this.arrowColor),radius:new Float32Array(this.arrowRadius),picking:new Vh(this)},{aspectRatio:this.aspectRatio,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,openEnded:this.openEnded});t.push(o)}if(this.labelPosition.length){var a=new sf({position:new Float32Array(this.labelPosition),color:new Float32Array(this.labelColor),size:new Float32Array(this.labelSize),text:this.labelText},this.labelParams);t.push(a)}return this.bufferList.concat(t)},lf.prototype.dispose=function(){this.bufferList.forEach((function(t){t.dispose()})),this.bufferList.length=0,this.spherePosition.length=0,this.sphereColor.length=0,this.sphereRadius.length=0,this.sphereName.length=0,this.ellipsoidPosition.length=0,this.ellipsoidColor.length=0,this.ellipsoidRadius.length=0,this.ellipsoidMajorAxis.length=0,this.ellipsoidMinorAxis.length=0,this.ellipsoidName.length=0,this.cylinderPosition1.length=0,this.cylinderPosition2.length=0,this.cylinderColor.length=0,this.cylinderRadius.length=0,this.cylinderName.length=0,this.conePosition1.length=0,this.conePosition2.length=0,this.coneColor.length=0,this.coneRadius.length=0,this.coneName.length=0,this.arrowPosition1.length=0,this.arrowPosition2.length=0,this.arrowColor.length=0,this.arrowRadius.length=0,this.arrowName.length=0,this.labelPosition.length=0,this.labelColor.length=0,this.labelSize.length=0,this.labelText.length=0},pf.center.get=function(){return this._center||(this._center=this.boundingBox.getCenter()),this._center},pf.type.get=function(){return"Shape"},Object.defineProperties(lf.prototype,pf);var df=function(t,e,i){this.type="",this.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},depthWrite:{type:"boolean",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:{}},colorScale:{type:"select",update:"color",options:yc.getScales()},colorReverse:{type:"boolean",update:"color"},colorValue:{type:"color",update:"color"},colorDomain:{type:"hidden",update:"color"},colorMode:{type:"select",update:"color",options:yc.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},matrix:{type:"hidden",buffer:!0},disablePicking:{type:"boolean",rebuild:!0}},this.viewer=e,this.tasks=new $c,this.queue=new dd(this.make.bind(this)),this.bufferList=[],this.parameters.colorScheme&&(this.parameters.colorScheme.options=yc.getSchemes())};df.prototype.init=function(t){var e=t||{};this.clipNear=Eo(e.clipNear,0),this.clipRadius=Eo(e.clipRadius,0),this.clipCenter=Eo(e.clipCenter,new O),this.flatShaded=Eo(e.flatShaded,!1),this.side=Eo(e.side,"double"),this.opacity=Eo(e.opacity,1),this.depthWrite=Eo(e.depthWrite,!0),this.wireframe=Eo(e.wireframe,!1),this.linewidth=Eo(e.linewidth,2),this.setColor(e.color,e),this.colorScheme=Eo(e.colorScheme,"uniform"),this.colorScale=Eo(e.colorScale,""),this.colorReverse=Eo(e.colorReverse,!1),this.colorValue=Eo(e.colorValue,9474192),this.colorDomain=Eo(e.colorDomain,void 0),this.colorMode=Eo(e.colorMode,"hcl"),this.visible=Eo(e.visible,!0),this.quality=Eo(e.quality,void 0),this.roughness=Eo(e.roughness,.4),this.metalness=Eo(e.metalness,0),this.diffuse=Eo(e.diffuse,16777215),this.lazy=Eo(e.lazy,!1),this.lazyProps={build:!1,bufferParams:{},what:{}},this.matrix=Eo(e.matrix,new N),this.disablePicking=Eo(e.disablePicking,!1);var i=this.parameters;!0===i.sphereDetail&&(i.sphereDetail={type:"integer",max:3,min:0,rebuild:"impostor"}),!0===i.radialSegments&&(i.radialSegments={type:"integer",max:25,min:5,rebuild:"impostor"}),!0===i.openEnded&&(i.openEnded={type:"boolean",rebuild:"impostor",buffer:!0}),!0===i.disableImpostor&&(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=Eo(e.sphereDetail,1)),i.radialSegments&&(this.radialSegments=Eo(e.radialSegments,10))),i.openEnded&&(this.openEnded=Eo(e.openEnded,!0)),i.disableImpostor&&(this.disableImpostor=Eo(e.disableImpostor,!1))},df.prototype.getColorParams=function(t){return Object.assign({scheme:this.colorScheme,scale:this.colorScale,reverse:this.colorReverse,value:this.colorValue,domain:this.colorDomain,mode:this.colorMode},t)},df.prototype.getBufferParams=function(t){return Object.assign({clipNear:this.clipNear,clipRadius:this.clipRadius,clipCenter:this.clipCenter,flatShaded:this.flatShaded,opacity:this.opacity,depthWrite:this.depthWrite,side:this.side,wireframe:this.wireframe,linewidth:this.linewidth,roughness:this.roughness,metalness:this.metalness,diffuse:this.diffuse,matrix:this.matrix,disablePicking:this.disablePicking},t)},df.prototype.setColor=function(t,e){return Object.keys(yc.getSchemes()).includes(t)?e?e.colorScheme=t:this.setParameters({colorScheme:t}):void 0!==t&&(t=new St(t).getHex(),e?(e.colorScheme="uniform",e.colorValue=t):this.setParameters({colorScheme:"uniform",colorValue:t})),this},df.prototype.create=function(){},df.prototype.update=function(){this.build()},df.prototype.build=function(t){if(!this.lazy||this.visible){if(!this.prepare)return this.tasks.increment(),void this.make();this.queue.length()>0?(this.tasks.change(1-this.queue.length()),this.queue.kill()):this.tasks.increment(),this.queue.push(t||!1)}else this.lazyProps.build=!0},df.prototype.make=function(t,e){gc&&mc.time("Representation.make "+this.type);var i=function(){t?(this.update(t),this.viewer.requestRender(),this.tasks.decrement(),e&&e()):(this.clear(),this.create(),this.manualAttach||this.disposed||(gc&&mc.time("Representation.attach "+this.type),this.attach(function(){gc&&mc.timeEnd("Representation.attach "+this.type),this.tasks.decrement(),e&&e()}.bind(this)))),gc&&mc.timeEnd("Representation.make "+this.type)}.bind(this);this.prepare?this.prepare(i):i()},df.prototype.attach=function(t){this.setVisibility(this.visible),t()},df.prototype.setVisibility=function(t,e){if(this.visible=t,this.visible){var i=this.lazyProps,r=i.bufferParams,n=i.what;if(i.build)return i.build=!1,void this.build();(Object.keys(r).length||Object.keys(n).length)&&(i.bufferParams={},i.what={},this.updateParameters(r,n))}return this.bufferList.forEach((function(e){e.setVisibility(t)})),e||this.viewer.requestRender(),this},df.prototype.setParameters=function(t,e,i){var r=t||{},n=this.parameters;e=e||{},i=i||!1;var o={};for(var a in r)void 0!==r[a]&&void 0!==n[a]&&(n[a].int&&(r[a]=parseInt(r[a])),n[a].float&&(r[a]=parseFloat(r[a])),(r[a]!==this[a]||r[a].equals&&!r[a].equals(this[a]))&&(this[a].set?this[a].set(r[a]):this[a]=r[a],n[a].buffer&&(!0===n[a].buffer?o[a]=r[a]:o[n[a].buffer]=r[a]),n[a].update&&(e[n[a].update]=!0),!n[a].rebuild||"impostor"===n[a].rebuild&&dc&&!this.disableImpostor||(i=!0)));return i?this.build():this.updateParameters(o,e),this},df.prototype.updateParameters=function(t,e){if(this.lazy&&!this.visible)return 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),this.viewer.requestRender()},df.prototype.getParameters=function(){var t=this,e={lazy:this.lazy,visible:this.visible,quality:this.quality};return Object.keys(this.parameters).forEach((function(i){null!==t.parameters[i]&&(e[i]=t[i])})),e},df.prototype.clear=function(){var t=this;this.bufferList.forEach((function(e){t.viewer.remove(e),e.dispose()})),this.bufferList.length=0,this.viewer.requestRender()},df.prototype.dispose=function(){this.disposed=!0,this.queue.kill(),this.tasks.dispose(),this.clear()};var ff=function(t){function e(e,i,r){Array.isArray(e)||(e=[e]),t.call(this,e,i,r),this.type="buffer",this.parameters=Object.assign({},this.parameters,{colorScheme:null,colorScale:null,colorValue:null,colorDomain:null,colorMode:null}),this.buffer=e,this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){t.prototype.init.call(this,e),this.build()},e.prototype.create=function(){this.bufferList.push.apply(this.bufferList,this.buffer)},e.prototype.attach=function(t){var e=this;this.bufferList.forEach((function(t){e.viewer.add(t),t.setParameters(e.getBufferParams())})),this.setVisibility(this.visible),t()},e}(df),mf=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isSurface:{}};return i.isSurface.get=function(){return!0},Object.defineProperties(e.prototype,i),e}(wd);function gf(t){t.visible=!0}function vf(t){t.visible=!1}var yf=function(t){this.size=t.size,this.side=t.side,this.wireframe=t.wireframe,this.visible=t.visible,this.geometry=t.geometry,this.picking=t.picking,this.background=t.background,this.disablePicking=t.disablePicking,this.group=new Ci,this.wireframeGroup=new Ci,this.pickingGroup=new Ci,this.matrix=t.matrix,this.frontMeshes=[],this.backMeshes=[];var e=t,i=new t.constructor;e.makeMaterial(),i.makeMaterial(),i.picking=t.picking,i.geometry=t.geometry,i.wireframeGeometry=t.wireframeGeometry,i.setParameters(t.getParameters()),i.updateShader(),e.setParameters({side:"front"}),i.setParameters({side:"back",opacity:i.opacity}),this.buffer=t,this.frontBuffer=e,this.backBuffer=i},bf={matrix:{},pickable:{}};bf.matrix.set=function(t){xd.prototype.setMatrix.call(this,t)},bf.matrix.get=function(){return this.group.matrix.clone()},bf.pickable.get=function(){return!!this.picking&&!this.disablePicking},yf.prototype.getMesh=function(t){var e,i;return t?(i=this.backBuffer.getPickingMesh(),e=this.frontBuffer.getPickingMesh()):(i=this.backBuffer.getMesh(),e=this.frontBuffer.getMesh()),this.frontMeshes.push(e),this.backMeshes.push(i),this.setParameters({side:this.side}),(new Ci).add(i,e)},yf.prototype.getWireframeMesh=function(){return this.buffer.getWireframeMesh()},yf.prototype.getPickingMesh=function(){return this.getMesh(!0)},yf.prototype.setAttributes=function(t){this.buffer.setAttributes(t)},yf.prototype.setParameters=function(t){"front"===(t=Object.assign({},t)).side?(this.frontMeshes.forEach(gf),this.backMeshes.forEach(vf)):"back"===t.side?(this.frontMeshes.forEach(vf),this.backMeshes.forEach(gf)):"double"===t.side&&(this.frontMeshes.forEach(gf),this.backMeshes.forEach(gf)),void 0!==t.matrix&&(this.matrix=t.matrix),delete t.matrix,void 0!==t.side&&(this.side=t.side),delete t.side,this.frontBuffer.setParameters(t),void 0!==t.wireframe&&(this.wireframe=t.wireframe,this.setVisibility(this.visible)),delete t.wireframe,this.backBuffer.setParameters(t)},yf.prototype.dispose=function(){this.frontBuffer.dispose(),this.backBuffer.dispose()},Object.defineProperties(yf.prototype,bf),yf.prototype.setVisibility=xd.prototype.setVisibility,wc.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}"),wc.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}");var xf=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isLine:{},vertexShader:{},fragmentShader:{}};return i.isLine.get=function(){return!0},i.vertexShader.get=function(){return"Line.vert"},i.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,i),e}(xd),_f=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="surface",this.parameters=Object.assign({isolevelType:{type:"select",options:{value:"value",sigma:"sigma"}},isolevel:{type:"number",precision:2,max:1e3,min:-1e3},negateIsolevel:{type:"boolean"},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},colorVolume:{type:"hidden"},contour:{type:"boolean",rebuild:!0},useWorker:{type:"boolean",rebuild:!0},wrap:{type:"boolean",rebuild:!0}},this.parameters),e instanceof lp?(this.surface=void 0,this.volume=e):(this.surface=e,this.volume=void 0),this.boxCenter=new O,this.__boxCenter=new O,this.box=new jt,this.__box=new jt,this._position=new O,this.setBox=function(){this._position.copy(i.translationGroup.position).negate(),this._position.equals(this.boxCenter)||this.setParameters({boxCenter:this._position})},this.viewer.signals.ticked.add(this.setBox,this),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"uniform"),i.colorValue=Eo(i.colorValue,14540253),this.isolevelType=Eo(i.isolevelType,"sigma"),this.isolevel=Eo(i.isolevel,2),this.negateIsolevel=Eo(i.negateIsolevel,!1),this.smooth=Eo(i.smooth,0),this.background=Eo(i.background,!1),this.opaqueBack=Eo(i.opaqueBack,!0),this.boxSize=Eo(i.boxSize,0),this.colorVolume=Eo(i.colorVolume,void 0),this.contour=Eo(i.contour,!1),this.useWorker=Eo(i.useWorker,!0),this.wrap=Eo(i.wrap,!1),t.prototype.init.call(this,i),this.build()},e.prototype.attach=function(t){var e=this;this.bufferList.forEach((function(t){e.viewer.add(t)})),this.setVisibility(this.visible),t()},e.prototype.prepare=function(t){var e,i=this;if(this.volume)if(e="sigma"===this.isolevelType?this.volume.getValueForSigma(this.isolevel):this.isolevel,this.negateIsolevel&&(e*=-1),!this.surface||this.__isolevel!==e||this.__smooth!==this.smooth||this.__contour!==this.contour||this.__wrap!==this.wrap||this.__boxSize!==this.boxSize||this.boxSize>0&&!this.__boxCenter.equals(this.boxCenter)){this.__isolevel=e,this.__smooth=this.smooth,this.__contour=this.contour,this.__wrap=this.wrap,this.__boxSize=this.boxSize,this.__boxCenter.copy(this.boxCenter),this.__box.copy(this.box);var r=function(e){i.surface=e,t()};this.useWorker?this.volume.getSurfaceWorker(e,this.smooth,this.boxCenter,this.boxSize,this.contour,this.wrap,r):r(this.volume.getSurface(e,this.smooth,this.boxCenter,this.boxSize,this.contour,this.wrap))}else t();else t()},e.prototype.create=function(){var t,e={position:this.surface.getPosition(),color:this.surface.getColor(this.getColorParams()),index:this.surface.getIndex()};if(this.contour)t=new xf(e,this.getBufferParams({wireframe:!1}));else{e.normal=this.surface.getNormal(),e.picking=this.surface.getPicking();var i=new mf(e,this.getBufferParams({background:this.background,opaqueBack:this.opaqueBack,dullInterior:!1}));t=new yf(i)}this.bufferList.push(t)},e.prototype.update=function(t){if(0!==this.bufferList.length){var e={};(t=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)}))}},e.prototype.setParameters=function(e,i,r){return e&&void 0!==e.isolevelType&&this.volume&&("value"===this.isolevelType&&"sigma"===e.isolevelType?this.isolevel=this.volume.getSigmaForValue(this.isolevel):"sigma"===this.isolevelType&&"value"===e.isolevelType&&(this.isolevel=this.volume.getValueForSigma(this.isolevel)),this.isolevelType=e.isolevelType),e&&e.boxCenter&&(this.boxCenter.copy(e.boxCenter),delete e.boxCenter),e&&e.wireframe&&(e.contour||void 0===e.contour&&this.contour)&&(e.wireframe=!1),t.prototype.setParameters.call(this,e,i,r),this.volume&&this.volume.getBox(this.boxCenter,this.boxSize,this.box),e&&void 0!==e.colorVolume&&(i.color=!0),this.surface&&(void 0!==e.isolevel||void 0!==e.negateIsolevel||void 0!==e.smooth||void 0!==e.wrap||void 0!==e.boxSize||this.boxSize>0&&!this.__box.equals(this.box))&&this.build({position:!0,color:!0,index:!0,normal:!this.contour}),this},e.prototype.getColorParams=function(){var e=t.prototype.getColorParams.call(this);return e.volume=this.colorVolume,e},e.prototype.dispose=function(){this.viewer.signals.ticked.remove(this.setBox,this),t.prototype.dispose.call(this)},e}(df);wc.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#if defined( PICKING )\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\n#include color_pars_vertex\n#endif\n#include common\nvoid main(){\n#if defined( PICKING )\nvPickingColor = unpackColor( primitiveId );\n#else\n#include color_vertex\n#endif\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}"),wc.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#if defined( PICKING )\nuniform float objectId;\nvarying vec3 vPickingColor;\n#else\n#include common\n#include color_pars_fragment\n#include fog_pars_fragment\n#endif\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\n#if defined( PICKING )\n#ifdef USE_MAP\nif( texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) ).a < 0.5 )\ndiscard;\n#endif\ngl_FragColor = vec4( vPickingColor, objectId );\n#else\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#endif\n}");var wf=function(t){function e(e,i){var r=e||{},n=i||{};r.primitiveId||(r.primitiveId=su(r.position.length/3)),t.call(this,r,n),this.pointSize=Eo(n.pointSize,1),this.sizeAttenuation=Eo(n.sizeAttenuation,!0),this.sortParticles=Eo(n.sortParticles,!1),this.alphaTest=Eo(n.alphaTest,.5),this.useTexture=Eo(n.useTexture,!1),this.forceTransparent=Eo(n.forceTransparent,!1),this.edgeBleach=Eo(n.edgeBleach,0),this.addUniforms({size:{value:this.pointSize},canvasHeight:{value:1},pixelRatio:{value:1},map:{value:null}})}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={parameters:{},isPoint:{},vertexShader:{},fragmentShader:{}};return i.parameters.get=function(){return Object.assign.call(this,{pointSize:{uniform:"size"},sizeAttenuation:{updateShader:!0},sortParticles:{},alphaTest:{updateShader:!0},useTexture:{updateShader:!0},forceTransparent:{},edgeBleach:{uniform:!0}},t.prototype.parameters)},e.prototype.makeMaterial=function(){t.prototype.makeMaterial.call(this),this.makeTexture();var e=this.material,i=this.wireframeMaterial,r=this.pickingMaterial;e.uniforms.map.value=this.tex,e.needsUpdate=!0,i.uniforms.map.value=this.tex,i.needsUpdate=!0,r.uniforms.map.value=this.tex,r.needsUpdate=!0},e.prototype.makeTexture=function(){this.tex&&this.tex.dispose(),this.tex=function(t){for(var e,i,r=t||{},n=Eo(r.width,256),o=Eo(r.height,256),a=[n/2,o/2],s=Math.min(n/2,o/2),c=Eo(r.delta,1/(s+1))*s,u=0,h=0,l=new Uint8Array(n*o*4),p=0,d=l.length;p<d;p+=4){var f=1-Rs(s-c,s,(e=void 0,i=void 0,e=a[0]-u,i=a[1]-h,Math.sqrt(e*e+i*i)));l[p]=255*f,l[p+1]=255*f,l[p+2]=255*f,l[p+3]=255*f,++u===n&&(u=0,h++)}var m=new D(l,n,o);return m.needsUpdate=!0,m}({delta:this.edgeBleach})},e.prototype.getDefines=function(e){var i=t.prototype.getDefines.call(this,e);return this.sizeAttenuation&&(i.USE_SIZEATTENUATION=1),this.useTexture&&(i.USE_MAP=1),this.alphaTest>0&&this.alphaTest<=1&&(i.ALPHATEST=this.alphaTest.toPrecision(2)),i},e.prototype.setUniforms=function(e){e&&void 0!==e.edgeBleach&&(this.makeTexture(),e.map=this.tex),t.prototype.setUniforms.call(this,e)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.tex&&this.tex.dispose()},i.isPoint.get=function(){return!0},i.vertexShader.get=function(){return"Point.vert"},i.fragmentShader.get=function(){return"Point.frag"},Object.defineProperties(e.prototype,i),e}(xd),Sf=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="dot",this.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}},this.parameters,{colorScheme:{type:"select",update:"color",options:{"":"",value:"value",uniform:"uniform",random:"random"}}}),e instanceof lp?(this.surface=void 0,this.volume=new dp(e)):(this.surface=e,this.volume=void 0),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"uniform"),i.colorValue=Eo(i.colorValue,14540253),this.thresholdType=Eo(i.thresholdType,"sigma"),this.thresholdMin=Eo(i.thresholdMin,2),this.thresholdMax=Eo(i.thresholdMax,1/0),this.thresholdOut=Eo(i.thresholdOut,!1),this.dotType=Eo(i.dotType,"point"),this.radius=Eo(i.radius,.1),this.scale=Eo(i.scale,1),this.pointSize=Eo(i.pointSize,1),this.sizeAttenuation=Eo(i.sizeAttenuation,!0),this.sortParticles=Eo(i.sortParticles,!1),this.useTexture=Eo(i.useTexture,!1),this.alphaTest=Eo(i.alphaTest,.5),this.forceTransparent=Eo(i.forceTransparent,!1),this.edgeBleach=Eo(i.edgeBleach,0),t.prototype.init.call(this,i),this.build()},e.prototype.attach=function(t){var e=this;this.bufferList.forEach((function(t){e.viewer.add(t)})),this.setVisibility(this.visible),t()},e.prototype.create=function(){var t={};if(this.volume){var e,i,r=this.volume;"sigma"===this.thresholdType?(e=r.getValueForSigma(this.thresholdMin),i=r.getValueForSigma(this.thresholdMax)):(e=this.thresholdMin,i=this.thresholdMax),r.setFilter(e,i,this.thresholdOut),t.position=r.getDataPosition(),t.color=r.getDataColor(this.getColorParams()),"sphere"===this.dotType&&(t.radius=r.getDataSize(this.radius,this.scale),t.picking=r.getDataPicking())}else{var n=this.surface;t.position=n.getPosition(),t.color=n.getColor(this.getColorParams()),"sphere"===this.dotType&&(t.radius=n.getSize(this.radius,this.scale),t.picking=n.getPicking())}"sphere"===this.dotType?this.dotBuffer=new Od(t,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!1})):this.dotBuffer=new wf(t,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)},e.prototype.update=function(t){if(0!==this.bufferList.length){var e={};(t=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)}},e.prototype.setParameters=function(e,i,r){return i=i||{},e&&void 0!==e.thresholdType&&this.volume instanceof lp&&("value"===this.thresholdType&&"sigma"===e.thresholdType?(this.thresholdMin=this.volume.getSigmaForValue(this.thresholdMin),this.thresholdMax=this.volume.getSigmaForValue(this.thresholdMax)):"sigma"===this.thresholdType&&"value"===e.thresholdType&&(this.thresholdMin=this.volume.getValueForSigma(this.thresholdMin),this.thresholdMax=this.volume.getValueForSigma(this.thresholdMax)),this.thresholdType=e.thresholdType),e&&void 0!==e.radiusType&&("radius"===e.radiusType?this.radius=.1:this.radius=e.radiusType,i.radius=!0,"sphere"!==this.dotType||dc&&!this.disableImpostor||(r=!0)),e&&void 0!==e.radius&&(i.radius=!0,"sphere"!==this.dotType||dc&&!this.disableImpostor||(r=!0)),e&&void 0!==e.scale&&(i.scale=!0,"sphere"!==this.dotType||dc&&!this.disableImpostor||(r=!0)),t.prototype.setParameters.call(this,e,i,r),this},e}(df);wc.add("shader/Image.vert","uniform float clipRadius;\nuniform vec3 clipCenter;\nvarying vec2 vUv;\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\nvoid main() {\n#include begin_vertex\n#include project_vertex\nvUv = uv;\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}"),wc.add("shader/Image.frag","uniform sampler2D map;\nuniform float opacity;\nuniform vec2 mapSize;\nuniform float nearClip;\nuniform float clipRadius;\nvarying vec2 vUv;\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\n#if defined( PICKING )\nuniform sampler2D pickingMap;\nuniform float objectId;\n#else\n#include fog_pars_fragment\n#endif\n#if defined( CUBIC_INTERPOLATION )\n#if defined( CATMULROM_FILTER ) || defined( MITCHELL_FILTER )\n#if defined( CATMULROM_FILTER )\nconst float B = 0.0;\nconst float C = 0.5;\n#elif defined( MITCHELL_FILTER )\nconst float B = 0.333;\nconst float C = 0.333;\n#endif\nfloat filter( float x ){\nfloat f = x;\nif( f < 0.0 ){\nf = -f;\n}\nif( f < 1.0 ){\nreturn ( ( 12.0 - 9.0 * B - 6.0 * C ) * ( f * f * f ) +\n( -18.0 + 12.0 * B + 6.0 *C ) * ( f * f ) +\n( 6.0 - 2.0 * B ) ) / 6.0;\n}else if( f >= 1.0 && f < 2.0 ){\nreturn ( ( -B - 6.0 * C ) * ( f * f * f )\n+ ( 6.0 * B + 30.0 * C ) * ( f *f ) +\n( - ( 12.0 * B ) - 48.0 * C ) * f +\n8.0 * B + 24.0 * C ) / 6.0;\n}else{\nreturn 0.0;\n}\n}\n#elif defined( BSPLINE_FILTER )\nfloat filter( float x ){\nfloat f = x;\nif( f < 0.0 ){\nf = -f;\n}\nif( f >= 0.0 && f <= 1.0 ){\nreturn ( 2.0 / 3.0 ) + ( 0.5 ) * ( f * f * f ) - ( f * f );\n}else if( f > 1.0 && f <= 2.0 ){\nreturn 1.0 / 6.0 * pow( ( 2.0 - f ), 3.0 );\n}\nreturn 1.0;\n}\n#else\nfloat filter( float x ){\nreturn 1.0;\n}\n#endif\nvec4 biCubic( sampler2D tex, vec2 texCoord ){\nvec2 texelSize = 1.0 / mapSize;\ntexCoord -= texelSize / 2.0;\nvec4 nSum = vec4( 0.0 );\nfloat nDenom = 0.0;\nvec2 cell = fract( texCoord * mapSize );\nfor( float m = -1.0; m <= 2.0; ++m ){\nfor( float n = -1.0; n <= 2.0; ++n ){\nvec4 vecData = texture2D(\ntex, texCoord + texelSize * vec2( m, n )\n);\nfloat c = filter( m - cell.x ) * filter( -n + cell.y );\nnSum += vecData * c;\nnDenom += c;\n}\n}\nreturn nSum / nDenom;\n}\n#endif\nvoid main(){\n#include nearclip_fragment\n#include radiusclip_fragment\n#if defined( CUBIC_INTERPOLATION )\ngl_FragColor = biCubic( map, vUv );\n#else\ngl_FragColor = texture2D( map, vUv );\n#endif\n#if defined( PICKING )\nif( gl_FragColor.a < 0.7 )\ndiscard;\ngl_FragColor = vec4( texture2D( pickingMap, vUv ).xyz, objectId );\n#else\nif( gl_FragColor.a < 0.01 )\ndiscard;\ngl_FragColor.a *= opacity;\n#include fog_fragment\n#endif\n}");var Af=new Uint16Array([0,1,2,1,3,2]),Mf=new Float32Array([0,1,0,0,1,1,1,0]),Pf=function(t){function e(e,i){var r=e||{},n=i||{};t.call(this,{position:r.position,index:Af,picking:r.picking},n),this.forceTransparent=!0,this.filter=Eo(n.filter,"nearest");var o=new D(r.imageData,r.width,r.height);o.flipY=!0,this.tex=o;for(var a=r.imageData.length,s=new Uint8Array(a),c=0;c<a;c+=4){var u=c/4;s[c]=u>>16&255,s[c+1]=u>>8&255,s[c+2]=255&u}var h=new D(s,r.width,r.height);h.flipY=!0,h.minFilter=1003,h.magFilter=1003,this.pickingTex=h,this.addUniforms({map:{value:o},pickingMap:{value:h},mapSize:{value:new _(r.width,r.height)}}),this.geometry.addAttribute("uv",new me(Mf,2))}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={parameters:{},vertexShader:{},fragmentShader:{}};return i.parameters.get=function(){return Object.assign.call(this,{filter:{updateShader:!0,uniform:!0}},t.prototype.parameters)},e.prototype.getDefines=function(e){var i=t.prototype.getDefines.call(this,e);return this.filter.startsWith("cubic")&&(i.CUBIC_INTERPOLATION=1,this.filter.endsWith("bspline")?i.BSPLINE_FILTER=1:this.filter.endsWith("catmulrom")?i.CATMULROM_FILTER=1:this.filter.endsWith("mitchell")&&(i.MITCHELL_FILTER=1)),i},e.prototype.updateTexture=function(){var t=this.tex;this.filter.startsWith("cubic")?(t.minFilter=1003,t.magFilter=1003):"linear"===this.filter?(t.minFilter=1006,t.magFilter=1006):(t.minFilter=1003,t.magFilter=1003),t.needsUpdate=!0,this.pickingTex.needsUpdate=!0},e.prototype.makeMaterial=function(){t.prototype.makeMaterial.call(this),this.updateTexture();var e=this.material;e.uniforms.map.value=this.tex,e.blending=1,e.needsUpdate=!0;var i=this.wireframeMaterial;i.uniforms.map.value=this.tex,i.blending=1,i.needsUpdate=!0;var r=this.pickingMaterial;r.uniforms.map.value=this.tex,r.uniforms.pickingMap.value=this.pickingTex,r.blending=1,r.needsUpdate=!0},e.prototype.setUniforms=function(e){e&&void 0!==e.filter&&(this.updateTexture(),e.map=this.tex),t.prototype.setUniforms.call(this,e)},i.vertexShader.get=function(){return"Image.vert"},i.fragmentShader.get=function(){return"Image.frag"},Object.defineProperties(e.prototype,i),e}(xd),Tf=function(t,e){var i=e||{};this.dimension=Eo(i.dimension,"x"),this.positionType=Eo(i.positionType,"percent"),this.position=Eo(i.position,30),this.thresholdType=Eo(i.thresholdType,"sigma"),this.thresholdMin=Eo(i.thresholdMin,-1/0),this.thresholdMax=Eo(i.thresholdMax,1/0),this.normalize=Eo(i.normalize,!1),this.volume=t};Tf.prototype.getPositionFromCoordinate=function(t){var e,i=this.dimension,r=this.volume,n=r.matrix,o=(new O).setFromMatrixPosition(n)[i],a=(new O).setFromMatrixScale(n)[i];return e="x"===i?r.nx:"y"===i?r.ny:r.nz,Math.round(((t-o)/(e/100)+1)/a)},Tf.prototype.getData=function(t){t=t||{};var e,i=this.volume,r=i.data,n=i.matrix;function o(t){return Math.round(t/100*(e-1))}function a(t,e,r,n){return 3*(r*i.ny*i.nx+e*i.nx+t)+n}e="coordinate"===this.positionType?this.getPositionFromCoordinate(this.position):this.position;var s,c,u,h,l,p=new Float32Array(12),d=new O,f=0,m=0,g=0,v=i.nx,y=i.ny,b=i.nz;function x(t,e,i,r){d.set(t,e,i).applyMatrix4(n).toArray(p,r)}"x"===this.dimension?(u=o(i.nx),h=i.ny-1,l=i.nz-1,s=i.nz,c=i.ny,v=(f=u)+1,x(u,0,0,0),x(u,h,0,3),x(u,0,l,6),x(u,h,l,9)):"y"===this.dimension?(u=i.nx-1,h=o(i.ny),l=i.nz-1,s=i.nz,c=i.nx,y=(m=h)+1,x(0,h,0,0),x(u,h,0,3),x(0,h,l,6),x(u,h,l,9)):"z"===this.dimension&&(u=i.nx-1,h=i.ny-1,l=o(i.nz),s=i.nx,c=i.ny,b=(g=l)+1,x(0,0,l,0),x(0,h,l,3),x(u,0,l,6),x(u,h,l,9));var _,w,S=0,A=0,M=new Uint8Array(s*c*4),P=new Float32Array(s*c);"sigma"===this.thresholdType?(_=i.getValueForSigma(this.thresholdMin),w=i.getValueForSigma(this.thresholdMax)):(_=this.thresholdMin,w=this.thresholdMax);var T=Object.assign({},t.colorParams,{volume:i});this.normalize&&(T.domain=[0,1]);var E,C,I,R=yc.getScheme(T),L=new Float32Array(3),N=R.getScale();if(this.normalize){E=1/0,C=-1/0;for(var D=m;D<y;++D)for(var k=f;k<v;++k)for(var F=g;F<b;++F){var B=r[a(k,D,F,0)/3];B<E&&(E=B),B>C&&(C=B)}I=C-E}for(var z=m;z<y;++z)for(var U=f;U<v;++U)for(var j=g;j<b;++j){var G=a(U,z,j,0)/3,V=r[G];this.normalize&&(V=(V-E)/I),R.colorToArray(N(V),L),M[S]=Math.round(255*L[0]),M[S+1]=Math.round(255*L[1]),M[S+2]=Math.round(255*L[2]),M[S+3]=V>_&&V<w?255:0,P[A]=G,++A,S+=4}var $=new nl(P,i);return{position:p,imageData:M,width:s,height:c,picking:$}};var Ef=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="slice",this.parameters=Object.assign({filter:{type:"select",buffer:!0,options:{nearest:"nearest",linear:"linear","cubic-bspline":"cubic-bspline","cubic-catmulrom":"cubic-catmulrom","cubic-mitchell":"cubic-mitchell"}},positionType:{type:"select",rebuild:!0,options:{percent:"percent",coordinate:"coordinate"}},position:{type:"range",step:.1,max:100,min:1,rebuild:!0},dimension:{type:"select",rebuild:!0,options:{x:"x",y:"y",z:"z"}},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},normalize:{type:"boolean",rebuild:!0}},this.parameters,{flatShaded:null,side:null,wireframe:null,linewidth:null,colorScheme:null,roughness:null,metalness:null,diffuse:null}),this.volume=e,this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=this.volume,r=e||{};r.colorDomain=Eo(r.colorDomain,[i.min,i.max]),r.colorScheme=Eo(r.colorScheme,"value"),r.colorScale=Eo(r.colorScale,"Spectral"),this.colorScheme="value",this.dimension=Eo(r.dimension,"x"),this.filter=Eo(r.filter,"cubic-bspline"),this.positionType=Eo(r.positionType,"percent"),this.position=Eo(r.position,30),this.thresholdType=Eo(r.thresholdType,"sigma"),this.thresholdMin=Eo(r.thresholdMin,-1/0),this.thresholdMax=Eo(r.thresholdMax,1/0),this.normalize=Eo(r.normalize,!1),t.prototype.init.call(this,r),this.build()},e.prototype.attach=function(t){var e=this;this.bufferList.forEach((function(t){e.viewer.add(t)})),this.setVisibility(this.visible),t()},e.prototype.create=function(){var t=new Tf(this.volume,{positionType:this.positionType,position:this.position,dimension:this.dimension,thresholdType:this.thresholdType,thresholdMin:this.thresholdMin,thresholdMax:this.thresholdMax,normalize:this.normalize}),e=new Pf(t.getData({colorParams:this.getColorParams()}),this.getBufferParams({filter:this.filter}));this.bufferList.push(e)},e}(df),Cf=function(t){function e(e,i,r){var n=r||{};if(t.call(this,e,i,n),this.type="structure",this.parameters=Object.assign({radiusType:{type:"select",options:Il.types},radius:{type:"number",precision:3,max:10,min:.001},scale:{type:"number",precision:3,max:10,min:.001},assembly:null,defaultAssembly:{type:"hidden"}},this.parameters),this.selection=new nc(n.sele),this.dataList=[],this.structure=e,this.structureView=this.structure.getView(this.selection),e.biomolDict){var o={default:"default","":e.unitcell?"AU":"FULL"};Object.keys(e.biomolDict).forEach((function(t){o[t]=t})),this.parameters.assembly={type:"select",options:o,rebuild:!0}}else this.parameters.assembly=null}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={defaultScale:{}};return i.defaultScale.get=function(){return{vdw:1,covalent:1,bfactor:.01,sstruc:1}},e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"element"),this.radius=Eo(i.radius,"vdw"),this.scale=Eo(i.scale,1),this.assembly=Eo(i.assembly,"default"),this.defaultAssembly=Eo(i.defaultAssembly,""),"auto"===i.quality&&(i.quality=this.getQuality()),t.prototype.init.call(this,i),this.selection.signals.stringChanged.add((function(){this.build()}),this),this.build()},e.prototype.getAssembly=function(){var t="default"===this.assembly?this.defaultAssembly:this.assembly;return this.structure.biomolDict[t]},e.prototype.getQuality=function(){var t,e=this.structureView,i=this.getAssembly();return t=i?i.getAtomCount(e):e.atomCount,lc&&(t*=4),e.atomStore.count/e.residueStore.count<2&&(t*=10),t<15e3?"high":t<8e4?"medium":"low"},e.prototype.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 r=this.createData(i,e);r&&(r.sview=i,r.instanceList=t.getInstanceList(),this.dataList.push(r))}}),this);else{var e=this.createData(this.structureView,0);e&&(e.sview=this.structureView,this.dataList.push(e))}}},e.prototype.createData=function(){console.error("createData not implemented")},e.prototype.update=function(t){!this.lazy||this.visible?this.dataList.forEach((function(e){e.bufferList.length>0&&this.updateData(t,e)}),this):Object.assign(this.lazyProps.what,t)},e.prototype.updateData=function(){this.build()},e.prototype.getColorParams=function(){var e=t.prototype.getColorParams.call(this);return e.structure=this.structure,e},e.prototype.getAtomParams=function(t,e){return Object.assign({what:t,colorParams:this.getColorParams(),radiusParams:{radius:this.radius,scale:this.scale}},e)},e.prototype.getBondParams=function(t,e){return Object.assign({what:t,colorParams:this.getColorParams(),radiusParams:{radius:this.radius,scale:this.scale}},e)},e.prototype.setSelection=function(t,e){return this.selection.setString(t,e),this},e.prototype.setParameters=function(e,i,r){return i=i||{},e&&void 0!==e.radiusType&&("size"===e.radiusType?this.radius=1:this.radius=e.radiusType,delete e.radiusType,i.radius=!0,dc&&!this.disableImpostor||(r=!0)),e&&void 0!==e.radius&&(i.radius=!0,dc&&!this.disableImpostor||(r=!0)),e&&void 0!==e.scale&&(i.radius=!0,dc&&!this.disableImpostor||(r=!0)),e&&void 0!==e.defaultAssembly&&(r=!0),t.prototype.setParameters.call(this,e,i,r),this},e.prototype.getParameters=function(){return Object.assign(t.prototype.getParameters.call(this),{sele:this.selection?this.selection.string:void 0,defaultAssembly:this.defaultAssembly})},e.prototype.attach=function(t){var e=this.viewer,i=this.bufferList;this.dataList.forEach((function(t){t.bufferList.forEach((function(r){i.push(r),e.add(r,t.instanceList)}))})),this.setVisibility(this.visible),t()},e.prototype.clear=function(){this.dataList.length=0,t.prototype.clear.call(this)},e.prototype.dispose=function(){this.structureView.dispose(),delete this.structure,delete this.structureView,t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,i),e}(df),If=function(t){function e(e,i){var r=4*(e.position1.length/3);t.call(this,{position:new Float32Array(3*r),color:new Float32Array(3*r)},i),this.setAttributes(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isLine:{},vertexShader:{},fragmentShader:{}};return e.prototype.setAttributes=function(t){var e,i,r,n,o,a,s=this.geometry.attributes;t.position1&&t.position2&&(e=t.position1,i=t.position2,o=s.position.array,s.position.needsUpdate=!0),t.color&&t.color2&&(r=t.color,n=t.color2,a=s.color.array,s.color.needsUpdate=!0);for(var c,u,h,l,p,d,f,m,g,v,y,b=this.size,x=0;x<b;x++)u=3*x,c=4*x*3,e&&i&&(d=e[u],f=e[u+1],m=e[u+2],h=(d+(g=i[u]))/2,l=(f+(v=i[u+1]))/2,p=(m+(y=i[u+2]))/2,o[c]=d,o[c+1]=f,o[c+2]=m,o[c+3]=h,o[c+4]=l,o[c+5]=p,o[c+6]=h,o[c+7]=l,o[c+8]=p,o[c+9]=g,o[c+10]=v,o[c+11]=y),r&&n&&(a[c]=a[c+3]=r[u],a[c+1]=a[c+4]=r[u+1],a[c+2]=a[c+5]=r[u+2],a[c+6]=a[c+9]=n[u],a[c+7]=a[c+10]=n[u+1],a[c+8]=a[c+11]=n[u+2])},i.isLine.get=function(){return!0},i.vertexShader.get=function(){return"Line.vert"},i.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,i),e}(xd),Rf=function(t){function e(e,i,r){t.call(this,e.structure,i,r),this.type="trajectory",this.parameters=Object.assign({drawLine:{type:"boolean",rebuild:!0},drawCylinder:{type:"boolean",rebuild:!0},drawPoint:{type:"boolean",rebuild:!0},drawSphere:{type:"boolean",rebuild:!0},linewidth:{type:"integer",max:20,min:1,rebuild:!0},pointSize:{type:"integer",max:20,min:1,rebuild:!0},sizeAttenuation:{type:"boolean",rebuild:!0},sort:{type:"boolean",rebuild:!0}},this.parameters),this.manualAttach=!0,this.trajectory=e,this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"uniform"),i.colorValue=Eo(i.colorValue,14540253),this.drawLine=Eo(i.drawLine,!0),this.drawCylinder=Eo(i.drawCylinder,!1),this.drawPoint=Eo(i.drawPoint,!1),this.drawSphere=Eo(i.drawSphere,!1),this.pointSize=Eo(i.pointSize,1),this.sizeAttenuation=Eo(i.sizeAttenuation,!1),this.sort=Eo(i.sort,!0),t.prototype.init.call(this,i)},e.prototype.attach=function(t){var e=this;this.bufferList.forEach((function(t){e.viewer.add(t)})),this.setVisibility(this.visible),t()},e.prototype.prepare=function(t){t()},e.prototype.create=function(){if(0!==this.atomSet.atomCount){var t=this,e=this.atomSet.atoms[0].index;this.trajectory.getPath(e,(function(e){var i=e.length/3,r=new St(t.colorValue);if(t.drawSphere){var n=new Od({position:e,color:au(i,r.r,r.g,r.b),radius:ou(i,.2)},t.getBufferParams({sphereDetail:t.sphereDetail,dullInterior:!0,disableImpostor:t.disableImpostor}));t.bufferList.push(n)}if(t.drawCylinder){var o=new qd({position1:e.subarray(0,-3),position2:e.subarray(3),color:au(i-1,r.r,r.g,r.b),color2:au(i-1,r.r,r.g,r.b),radius:ou(i,.05)},t.getBufferParams({openEnded:!1,radialSegments:t.radialSegments,disableImpostor:t.disableImpostor,dullInterior:!0}));t.bufferList.push(o)}if(t.drawPoint){var a=new wf({position:e,color:au(i,r.r,r.g,r.b)},t.getBufferParams({pointSize:t.pointSize,sizeAttenuation:t.sizeAttenuation,sort:t.sort}));t.bufferList.push(a)}if(t.drawLine){var s=new If({position1:e.subarray(0,-3),position2:e.subarray(3),color:au(i-1,r.r,r.g,r.b),color2:au(i-1,r.r,r.g,r.b)},t.getBufferParams());t.bufferList.push(s)}t.attach()}))}},e}(Cf);function Lf(t){mc.error("makeRepresentation: representation type "+t+" unknown")}var Of=0,Nf=new N,Df=new O,kf=function(t,e){Object.defineProperty(this,"id",{value:Of++});var i=e||{};this.name=i.name,this.uuid=Ps(),this.visible=void 0===i.visible||i.visible,this.signals={representationAdded:new Fs,representationRemoved:new Fs,visibilityChanged:new Fs,matrixChanged:new Fs,statusChanged:new Fs,nameChanged:new Fs,disposed:new Fs},this.stage=t,this.viewer=t.viewer,this.reprList=[],this.annotationList=[],this.matrix=new N,this.position=new O,this.quaternion=new L,this.scale=new O(1,1,1),this.transform=new N,this.controls=new bh(this)},Ff={type:{}};Ff.type.get=function(){return"component"},kf.prototype.setPosition=function(t){return Array.isArray(t)?this.position.fromArray(t):this.position.copy(t),this.updateMatrix(),this},kf.prototype.setRotation=function(t){if(Array.isArray(t))if(3===t.length){var e=(new qt).fromArray(t);this.quaternion.setFromEuler(e)}else this.quaternion.fromArray(t);else t instanceof qt?this.quaternion.setFromEuler(t):this.quaternion.copy(t);return this.updateMatrix(),this},kf.prototype.setScale=function(t){return this.scale.set(t,t,t),this.updateMatrix(),this},kf.prototype.setTransform=function(t){return this.transform.copy(t),this.updateMatrix(),this},kf.prototype.updateMatrix=function(){var t=this,e=this.getCenterUntransformed(Df);this.matrix.makeTranslation(-e.x,-e.y,-e.z),Nf.makeRotationFromQuaternion(this.quaternion),this.matrix.premultiply(Nf),Nf.makeScale(this.scale.x,this.scale.y,this.scale.z),this.matrix.premultiply(Nf);var i=this.position;Nf.makeTranslation(i.x+e.x,i.y+e.y,i.z+e.z),this.matrix.premultiply(Nf),this.matrix.premultiply(this.transform),this.reprList.forEach((function(e){e.setParameters({matrix:t.matrix})})),this.stage.viewer.updateBoundingBox(),this.signals.matrixChanged.dispatch(this.matrix)},kf.prototype.addAnnotation=function(t,e,i){var r=new mh(this,t,e,i);return this.annotationList.push(r),r},kf.prototype.removeAnnotation=function(t){var e=this.annotationList.indexOf(t);-1!==e&&(this.annotationList.splice(e,1),t.dispose())},kf.prototype.removeAllAnnotations=function(){this.annotationList.forEach((function(t){t.dispose()})),this.annotationList.length=0},kf.prototype.addRepresentation=function(t,e,i){var r=i||{},n=this.stage.getParameters();r.matrix=this.matrix.clone(),r.quality=r.quality||n.quality,r.disableImpostor=Eo(r.disableImpostor,!n.impostor),r.useWorker=Eo(r.useWorker,n.workerDefault),r.visible=Eo(r.visible,!0);var o=Object.assign({},r,{visible:this.visible&&r.visible}),a=function(t,e,i,r){var n;if(gc&&mc.time("makeRepresentation "+t),e instanceof ld){if(!(n=xc.get(t)))return void Lf(t)}else if(e instanceof cp)if("surface"===t)n=_f;else{if("dot"!==t)return void Lf(t);n=Sf}else if(e instanceof lp)if("surface"===t)n=_f;else if("dot"===t)n=Sf;else{if("slice"!==t)return void Lf(t);n=Ef}else if(e instanceof gd)n=Rf;else if(e instanceof lf)n=ff,e=e.getBufferList();else{if("buffer"!==t)return void mc.error("makeRepresentation: object "+e+" unknown");n=ff}var o=new n(e,i,r);return gc&&mc.timeEnd("makeRepresentation "+t),o}(t,e,this.viewer,o),s=this.__getRepresentationComponent(a,r);return this.reprList.push(s),this.signals.representationAdded.dispatch(s),s},kf.prototype.addBufferRepresentation=function(t,e){return kf.prototype.addRepresentation.call(this,"buffer",t,e)},kf.prototype.hasRepresentation=function(t){return-1!==this.reprList.indexOf(t)},kf.prototype.removeRepresentation=function(t){var e=this.reprList.indexOf(t);-1!==e&&(this.reprList.splice(e,1),t.dispose(),this.signals.representationRemoved.dispatch(t))},kf.prototype.updateRepresentations=function(t){this.reprList.forEach((function(e){e.update(t)})),this.stage.viewer.requestRender()},kf.prototype.removeAllRepresentations=function(){this.reprList.slice(0).forEach((function(t){t.dispose()}))},kf.prototype.dispose=function(){this.removeAllAnnotations(),this.removeAllRepresentations(),delete this.annotationList,delete this.reprList,this.signals.disposed.dispatch()},kf.prototype.setVisibility=function(t){return this.visible=t,this.eachRepresentation((function(t){t.updateVisibility()})),this.annotationList.forEach((function(t){t.updateVisibility()})),this.signals.visibilityChanged.dispatch(t),this},kf.prototype.setStatus=function(t){return this.status=t,this.signals.statusChanged.dispatch(t),this},kf.prototype.setName=function(t){return this.name=t,this.signals.nameChanged.dispatch(t),this},kf.prototype.getBox=function(){return(t=this).getBoxUntransformed.apply(t,arguments).clone().applyMatrix4(this.matrix);var t},kf.prototype.getCenter=function(){return(t=this).getCenterUntransformed.apply(t,arguments).clone().applyMatrix4(this.matrix);var t},kf.prototype.getZoom=function(){return this.stage.getZoomForBox((t=this).getBox.apply(t,arguments));var t},kf.prototype.getBoxUntransformed=function(){},kf.prototype.getCenterUntransformed=function(){return this.getBoxUntransformed().getCenter()},kf.prototype.autoView=function(t){this.stage.animationControls.zoomMove(this.getCenter(),this.getZoom(),Eo(t,0))},kf.prototype.eachRepresentation=function(t){this.reprList.forEach(t)},Object.defineProperties(kf.prototype,Ff),kf.prototype.__getRepresentationComponent=function(t,e){return new Bf(this.stage,t,e,this)};var Bf=function(t){function e(e,i,r,n){var o=r||{};o.name=Eo(o.name,i.type),t.call(this,e,o),this.signals=Object.assign(this.signals,{parametersChanged:new Fs}),this.parent=n,this.setRepresentation(i)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"representation"},e.prototype.getType=function(){return this.repr.type},e.prototype.setRepresentation=function(t){this.disposeRepresentation(),this.repr=t,this.stage.tasks.listen(this.repr.tasks),this.updateVisibility()},e.prototype.addRepresentation=function(){},e.prototype.removeRepresentation=function(){},e.prototype.hasRepresentation=function(){},e.prototype.disposeRepresentation=function(){this.repr&&(this.stage.tasks.unlisten(this.repr.tasks),this.repr.dispose())},e.prototype.dispose=function(){this.parent&&this.parent.hasRepresentation(this)?this.parent.removeRepresentation(this):(this.disposeRepresentation(),this.signals.disposed.dispatch())},e.prototype.setVisibility=function(t){return this.visible=t,this.updateVisibility(),this.signals.visibilityChanged.dispatch(this.visible),this},e.prototype.getVisibility=function(){return this.parent?this.parent.visible&&this.visible:this.visible},e.prototype.toggleVisibility=function(){return this.setVisibility(!this.visible)},e.prototype.updateVisibility=function(){this.repr.setVisibility(this.getVisibility())},e.prototype.update=function(t){return this.repr.update(t),this},e.prototype.build=function(t){return this.repr.build(t),this},e.prototype.setSelection=function(t){return this.repr.setSelection(t),this},e.prototype.setParameters=function(t){return this.repr.setParameters(t),this.signals.parametersChanged.dispatch(this.repr.getParameters()),this},e.prototype.getParameters=function(){return this.repr.getParameters()},e.prototype.setColor=function(t){return this.repr.setColor(t),this},e.prototype.getCenter=function(){},e.prototype.getZoom=function(){},e.prototype.getBox=function(){},Object.defineProperties(e.prototype,i),e}(kf),zf=function(t){this.list=t||[];for(var e=this.list.length,i=0;i<e;++i){this.list[i].signals.disposed.add(this._remove,this)}};zf.prototype._remove=function(t){var e=this.list.indexOf(t);-1!==e&&this.list.splice(e,1)},zf.prototype._invoke=function(t,e){for(var i=this.list.length,r=0;r<i;++r){var n=this.list[r],o=n[t];"function"==typeof o&&o.apply(n,e)}return this},zf.prototype.setVisibility=function(t){return this._invoke("setVisibility",[t])},zf.prototype.setSelection=function(t){return this._invoke("setSelection",[t])},zf.prototype.dispose=function(){return this._invoke("dispose")};var Uf=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.addRepresentation=function(t,e){return this._invoke("addRepresentation",[t,e])},e.prototype.autoView=function(t){return this._invoke("autoView",[t])},e}(zf),jf=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setParameters=function(t){return this._invoke("setParameters",[t])},e.prototype.setColor=function(t){return this._invoke("setColor",[t])},e}(zf);function Gf(t,e){return t instanceof RegExp?null!==e.name.match(t):e.name===t}var Vf=new O,$f=function(t,e){if(this.signals={parametersChanged:new Fs,fullscreenChanged:new Fs,componentAdded:new Fs,componentRemoved:new Fs,clicked:new Fs,hovered:new Fs},this.tasks=new $c,this.compList=[],this.defaultFileParams={},this.viewer=new wu(t),this.viewer.renderer){this.tooltip=document.createElement("div"),Object.assign(this.tooltip.style,{display:"none",position:"fixed",zIndex:2+(parseInt(this.viewer.container.style.zIndex)||0),pointerEvents:"none",backgroundColor:"rgba( 0, 0, 0, 0.6 )",color:"lightgrey",padding:"8px",fontFamily:"sans-serif"}),document.body.appendChild(this.tooltip),this.mouseObserver=new Au(this.viewer.renderer.domElement),this.viewerControls=new Wu(this),this.trackballControls=new Ou(this),this.pickingControls=new Fu(this),this.animationControls=new oh(this),this.mouseControls=new hh(this),this.pickingBehavior=new lh(this),this.mouseBehavior=new ph(this),this.animationBehavior=new dh(this),this.keyBehavior=new fh(this),this.spinAnimation=this.animationControls.spin([0,1,0],.005),this.spinAnimation.pause(!0),this.rockAnimation=this.animationControls.rock([0,1,0],.005),this.rockAnimation.pause(!0);var i=Object.assign({impostor:!0,quality:"medium",workerDefault:!0,sampleLevel:0,backgroundColor:"black",rotateSpeed:2,zoomSpeed:1.2,panSpeed:1,clipNear:0,clipFar:100,clipDist:10,fogNear:50,fogFar:100,cameraFov:40,cameraType:"perspective",lightColor:14540253,lightIntensity:1,ambientColor:14540253,ambientIntensity:.2,hoverTimeout:0,tooltip:!0,mousePreset:"default"},e);this.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"},workerDefault:{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:-1},tooltip:{type:"boolean"},mousePreset:{type:"select",options:{default:"default",pymol:"pymol",coot:"coot"}}},this.setParameters(i),this.viewer.animate()}};$f.prototype.setParameters=function(t){var e=Object.assign({},t),i=this.parameters,r=this.viewer,n=this.trackballControls;for(var o in e)void 0!==e[o]&&i[o]&&(i[o].int&&(e[o]=parseInt(e[o])),i[o].float&&(e[o]=parseFloat(e[o])),i[o].value=e[o]);return void 0!==e.quality&&this.setQuality(e.quality),void 0!==e.impostor&&this.setImpostor(e.impostor),void 0!==e.rotateSpeed&&(n.rotateSpeed=e.rotateSpeed),void 0!==e.zoomSpeed&&(n.zoomSpeed=e.zoomSpeed),void 0!==e.panSpeed&&(n.panSpeed=e.panSpeed),void 0!==e.mousePreset&&this.mouseControls.preset(e.mousePreset),this.mouseObserver.setParameters({hoverTimeout:e.hoverTimeout}),r.setClip(e.clipNear,e.clipFar,e.clipDist),r.setFog(void 0,e.fogNear,e.fogFar),r.setCamera(e.cameraType,e.cameraFov),r.setSampling(e.sampleLevel),r.setBackground(e.backgroundColor),r.setLight(e.lightColor,e.lightIntensity,e.ambientColor,e.ambientIntensity),this.signals.parametersChanged.dispatch(this.getParameters()),this},$f.prototype.getParameters=function(){var t={};for(var e in this.parameters)t[e]=this.parameters[e].value;return t},$f.prototype.defaultFileRepresentation=function(t){if("structure"===t.type){var e,i,r;t.setSelection("/0");var n=t.structure;if(n.biomolDict.BU1){var o=n.biomolDict.BU1;e=o.getAtomCount(n),i=o.getResidueCount(n),r=o.getInstanceCount(),t.setDefaultAssembly("BU1")}else e=n.getModelProxy(0).atomCount,i=n.getModelProxy(0).residueCount,r=1;var a=e;lc&&(a*=4);var s=n.atomStore.count/n.residueStore.count<2;s&&(a*=10);var c="chainname",u="RdYlBu",h=!1;if(1===n.getChainnameCount("polymer and /0")&&(c="residueindex",u="spectral",h=!0),gc&&console.log(a,e,r,s),i/r<4)t.addRepresentation("ball+stick",{colorScheme:"element",scale:2,aspectRatio:1.5,bondScale:.3,bondSpacing:.75,quality:"auto"});else if(r>5&&a>15e3||a>7e5){var l=Math.min(1.5,Math.max(.1,2e3/(a/r)));s&&(l=Math.min(l,.15)),t.addRepresentation("surface",{sele:"polymer",surfaceType:"sas",probeRadius:1.4,scaleFactor:l,colorScheme:c,colorScale:u,colorReverse:h,useWorker:!1})}else a>25e4?t.addRepresentation("backbone",{lineOnly:!0,colorScheme:c,colorScale:u,colorReverse:h}):a>1e5?t.addRepresentation("backbone",{quality:"low",disableImpostor:!0,colorScheme:c,colorScale:u,colorReverse:h,scale:2}):a>8e4?t.addRepresentation("backbone",{colorScheme:c,colorScale:u,colorReverse:h,scale:2}):(t.addRepresentation("cartoon",{colorScheme:c,colorScale:u,colorReverse:h,scale:.7,aspectRatio:5,quality:"auto"}),a<5e4&&t.addRepresentation("base",{colorScheme:c,colorScale:u,colorReverse:h,quality:"auto"}),t.addRepresentation("ball+stick",{sele:"ligand",colorScheme:"element",scale:2,aspectRatio:1.5,bondScale:.3,bondSpacing:.75,quality:"auto"}));t.structure.frames.length&&t.addTrajectory()}else"surface"!==t.type&&"volume"!==t.type||t.addRepresentation("surface");this.tasks.onZeroOnce(this.autoView,this)},$f.prototype.loadFile=function(t,e){var i=Object.assign({},this.defaultFileParams,e),r=new kf(this,i);r.name=Lo(t).name,this.addComponent(r);var n=this.tasks;n.increment();var o=function(t){return this.removeComponent(r),"script"===(r=this.addComponentFromObject(t,i)).type?r.run():i.defaultRepresentation&&this.defaultFileRepresentation(r),n.decrement(),r}.bind(this);return("dcd"===Eo(i.ext,Lo(t).ext)?Promise.reject(new Error("loadFile: ext 'dcd' must be loaded into a structure component")):Bc(t,i)).then(o,(function(t){throw r.setStatus(t),n.decrement(),t}))},$f.prototype.addComponent=function(t){t?(this.compList.push(t),this.signals.componentAdded.dispatch(t)):mc.warn("Stage.addComponent: no component given")},$f.prototype.addComponentFromObject=function(t,e){var i=Ac.get(t.type);if(i){var r=new i(this,t,e);return this.addComponent(r),r}mc.warn("no component for object type",t.type)},$f.prototype.removeComponent=function(t){var e=this.compList.indexOf(t);-1!==e&&(this.compList.splice(e,1),t.dispose(),this.signals.componentRemoved.dispatch(t))},$f.prototype.removeAllComponents=function(t){this.compList.slice().forEach((function(e){t&&e.type!==t||this.removeComponent(e)}),this)},$f.prototype.handleResize=function(){this.viewer.handleResize()},$f.prototype.setSize=function(t,e){var i=this.viewer.container;i!==document.body&&(void 0!==t&&(i.style.width=t),void 0!==e&&(i.style.height=e),this.handleResize())},$f.prototype.toggleFullscreen=function(t){if(document.fullscreenEnabled||document.mozFullScreenEnabled||document.webkitFullscreenEnabled||document.msFullscreenEnabled){var e=this;t=t||this.viewer.container,this.lastFullscreenElement=t,i()?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=window.screen.width+"px",t.style.height=window.screen.height+"px",t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen(),document.addEventListener("fullscreenchange",r),document.addEventListener("mozfullscreenchange",r),document.addEventListener("webkitfullscreenchange",r),document.addEventListener("MSFullscreenChange",r),this.handleResize(),this.signals.fullscreenChanged.dispatch(!0),setTimeout((function(){e.handleResize()}),100))}else mc.log("fullscreen mode (currently) not possible");function i(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement}function r(){if(!i()&&e.lastFullscreenElement){var t=e.lastFullscreenElement;t.style.width=t.dataset.normalWidth,t.style.height=t.dataset.normalHeight,document.removeEventListener("fullscreenchange",r),document.removeEventListener("mozfullscreenchange",r),document.removeEventListener("webkitfullscreenchange",r),document.removeEventListener("MSFullscreenChange",r),e.handleResize(),e.signals.fullscreenChanged.dispatch(!1)}}},$f.prototype.setSpin=function(t){t?(this.spinAnimation.resume(!0),this.rockAnimation.pause(!0)):this.spinAnimation.pause(!0)},$f.prototype.setRock=function(t){t?(this.rockAnimation.resume(!0),this.spinAnimation.pause(!0)):this.rockAnimation.pause(!0)},$f.prototype.toggleSpin=function(){this.setSpin(this.spinAnimation.paused)},$f.prototype.toggleRock=function(){this.setRock(this.rockAnimation.paused)},$f.prototype.setFocus=function(t){var e=Ts(t/2,0,49.9),i=100-e,r=(i-e)/2;this.setParameters({clipNear:e,clipFar:i,fogNear:Es(i-r),fogFar:Es(i+r)})},$f.prototype.getZoomForBox=function(t){var e=t.getSize(Vf),i=Math.max(e.x,e.y,e.z),r=Math.min(e.x,e.y,e.z),n=i+Math.sqrt(r),o=Qo(this.viewer.perspectiveCamera.fov),a=this.viewer.width,s=this.viewer.height,c=s<a?1:a/s;return n=Math.abs(.5*n/c/Math.sin(o/2)),-(n+=this.parameters.clipDist.value)},$f.prototype.getBox=function(){return this.viewer.boundingBox},$f.prototype.getZoom=function(){return this.getZoomForBox(this.getBox())},$f.prototype.getCenter=function(t){return this.getBox().getCenter(t)},$f.prototype.autoView=function(t){this.animationControls.zoomMove(this.getCenter(),this.getZoom(),Eo(t,0))},$f.prototype.makeImage=function(t){var e=this.viewer,i=this.tasks;return new Promise((function(r,n){i.onZeroOnce((function(){i.increment(),e.makeImage(t).then((function(t){i.decrement(),r(t)})).catch((function(t){i.decrement(),n(t)}))}))}))},$f.prototype.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 r=i.getParameters();r.disableImpostor=!t,i.build(r)}}))},$f.prototype.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(r){if("script"!==r.type){var n=r.getParameters();if(!e.includes(r.getType())){if(!i.includes(r.getType()))return;if(!n.disableImpostor)return void(r.repr.quality=t)}n.quality=t,r.build(n)}}))},$f.prototype.eachComponent=function(t,e){this.compList.slice().forEach((function(i,r){e&&i.type!==e||t(i,r)}))},$f.prototype.eachRepresentation=function(t,e){this.eachComponent((function(e){e.reprList.slice().forEach((function(i){t(i,e)}))}),e)},$f.prototype.getComponentsByName=function(t,e){var i=[];return this.eachComponent((function(e){(void 0===t||Gf(t,e))&&i.push(e)}),e),new Uf(i)},$f.prototype.getComponentsByObject=function(t){var e=[];return this.eachComponent((function(i){i[i.type]===t&&e.push(i)})),new Uf(e)},$f.prototype.getRepresentationsByName=function(t,e){var i,r;"object"!=typeof t||t instanceof RegExp?(i=void 0,r=t):(i=t.comp,r=t.repr);var n=[];return this.eachRepresentation((function(t,e){(void 0===i||Gf(i,e))&&(void 0===r||Gf(r,t))&&n.push(t)}),e),new jf(n)},$f.prototype.getAnythingByName=function(t){var e=this.getComponentsByName(t).list,i=this.getRepresentationsByName(t).list;return new zf(e.concat(i))},$f.prototype.dispose=function(){this.tasks.dispose()};var Hf=[[4,0,-2,-1,-2,0,-2,-1,-1,-1,-1,-2,-1,-1,-1,1,0,0,-3,-2],[0,9,-3,-4,-2,-3,-3,-1,-3,-1,-1,-3,-3,-3,-3,-1,-1,-1,-2,-2],[-2,-3,6,2,-3,-1,-1,-3,-1,-4,-3,1,-1,0,-2,0,-1,-3,-4,-3],[-1,-4,2,5,-3,-2,0,-3,1,-3,-2,0,-1,2,0,0,-1,-2,-3,-2],[-2,-2,-3,-3,6,-3,-1,0,-3,0,0,-3,-4,-3,-3,-2,-2,-1,1,3],[0,-3,-1,-2,-3,6,-2,-4,-2,-4,-3,0,-2,-2,-2,0,-2,-3,-2,-3],[-2,-3,-1,0,-1,-2,8,-3,-1,-3,-2,1,-2,0,0,-1,-2,-3,-2,2],[-1,-1,-3,-3,0,-4,-3,4,-3,2,1,-3,-3,-3,-3,-2,-1,3,-3,-1],[-1,-3,-1,1,-3,-2,-1,-3,5,-2,-1,0,-1,1,2,0,-1,-2,-3,-2],[-1,-1,-4,-3,0,-4,-3,2,-2,4,2,-3,-3,-2,-2,-2,-1,1,-2,-1],[-1,-1,-3,-2,0,-3,-2,1,-1,2,5,-2,-2,0,-1,-1,-1,1,-1,-1],[-2,-3,1,0,-3,0,1,-3,0,-3,-2,6,-2,0,0,1,0,-3,-4,-2],[-1,-3,-1,-1,-4,-2,-2,-3,-1,-3,-2,-2,7,-1,-2,-1,-1,-2,-4,-3],[-1,-3,0,2,-3,-2,0,-3,1,-2,0,0,-1,5,1,0,-1,-2,-2,-1],[-1,-3,-2,0,-3,-2,0,-3,2,-2,-1,0,-2,1,5,-1,-1,-3,-3,-2],[1,-1,0,0,-2,0,-1,-2,0,-2,-1,1,-1,0,-1,4,1,-2,-3,-2],[0,-1,-1,-1,-2,-2,-2,-1,-1,-1,-1,0,-1,-1,-1,1,5,0,-2,-2],[0,-1,-3,-2,-1,-3,-3,3,-2,1,1,-3,-2,-2,-3,-2,0,4,-3,-1],[-3,-2,-4,-3,1,-2,-2,-3,-3,-2,-1,-4,-4,-2,-3,-3,-2,-3,11,2],[-2,-2,-3,-2,3,-3,2,-1,-2,-1,-1,-2,-3,-1,-2,-2,-2,-1,2,7]];function Wf(t,e){var i,r=0,n={};return e.forEach((function(e){i=0;var o={};e.forEach((function(e){o[t[i++]]=e})),n[t[r++]]=o})),n}var Xf={blosum62:Wf("ARNDCQEGHILKMFPSTWYVBZ?",[[4,-1,-2,-2,0,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-3,-2,0,-2,-1,0],[-1,5,0,-2,-3,1,0,-2,0,-3,-2,2,-1,-3,-2,-1,-1,-3,-2,-3,-1,0,-1],[-2,0,6,1,-3,0,0,0,1,-3,-3,0,-2,-3,-2,1,0,-4,-2,-3,3,0,-1],[-2,-2,1,6,-3,0,2,-1,-1,-3,-4,-1,-3,-3,-1,0,-1,-4,-3,-3,4,1,-1],[0,-3,-3,-3,9,-3,-4,-3,-3,-1,-1,-3,-1,-2,-3,-1,-1,-2,-2,-1,-3,-3,-2],[-1,1,0,0,-3,5,2,-2,0,-3,-2,1,0,-3,-1,0,-1,-2,-1,-2,0,3,-1],[-1,0,0,2,-4,2,5,-2,0,-3,-3,1,-2,-3,-1,0,-1,-3,-2,-2,1,4,-1],[0,-2,0,-1,-3,-2,-2,6,-2,-4,-4,-2,-3,-3,-2,0,-2,-2,-3,-3,-1,-2,-1],[-2,0,1,-1,-3,0,0,-2,8,-3,-3,-1,-2,-1,-2,-1,-2,-2,2,-3,0,0,-1],[-1,-3,-3,-3,-1,-3,-3,-4,-3,4,2,-3,1,0,-3,-2,-1,-3,-1,3,-3,-3,-1],[-1,-2,-3,-4,-1,-2,-3,-4,-3,2,4,-2,2,0,-3,-2,-1,-2,-1,1,-4,-3,-1],[-1,2,0,-1,-3,1,1,-2,-1,-3,-2,5,-1,-3,-1,0,-1,-3,-2,-2,0,1,-1],[-1,-1,-2,-3,-1,0,-2,-3,-2,1,2,-1,5,0,-2,-1,-1,-1,-1,1,-3,-1,-1],[-2,-3,-3,-3,-2,-3,-3,-3,-1,0,0,-3,0,6,-4,-2,-2,1,3,-1,-3,-3,-1],[-1,-2,-2,-1,-3,-1,-1,-2,-2,-3,-3,-1,-2,-4,7,-1,-1,-4,-3,-2,-2,-1,-2],[1,-1,1,0,-1,0,0,0,-1,-2,-2,0,-1,-2,-1,4,1,-3,-2,-2,0,0,0],[0,-1,0,-1,-1,-1,-1,-2,-2,-1,-1,-1,-1,-2,-1,1,5,-2,-2,0,-1,-1,0],[-3,-3,-4,-4,-2,-2,-3,-2,-2,-3,-2,-3,-1,1,-4,-3,-2,11,2,-3,-4,-3,-2],[-2,-2,-2,-3,-2,-1,-2,-3,2,-1,-1,-2,-1,3,-3,-2,-2,2,7,-1,-3,-2,-1],[0,-3,-3,-3,-1,-2,-2,-3,-3,3,1,-2,1,-1,-2,-2,0,-3,-1,4,-3,-2,-1],[-2,-1,3,4,-3,0,1,-1,0,-3,-4,0,-3,-3,-2,0,-1,-4,-3,-3,4,1,-1],[-1,0,0,1,-3,3,4,-2,0,-3,-3,1,-1,-3,-1,0,-1,-3,-2,-2,1,4,-1],[0,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,0,0,-2,-1,-1,-1,-1,-1]]),blosum62x:Wf("ACDEFGHIKLMNPQRSTVWY",Hf)},qf=function(t,e,i,r,n){this.seq1=t,this.seq2=e,this.gapPenalty=i||-10,this.gapExtensionPenalty=r||-1,this.substMatrix=n||"blosum62",this.substMatrix&&(this.substMatrix=Xf[this.substMatrix])};qf.prototype.initMatrices=function(){var t,e;for(this.n=this.seq1.length,this.m=this.seq2.length,this.score=void 0,this.ali="",this.S=[],this.V=[],this.H=[],t=0;t<=this.n;++t)for(this.S[t]=[],this.V[t]=[],this.H[t]=[],e=0;e<=this.m;++e)this.S[t][e]=0,this.V[t][e]=0,this.H[t][e]=0;for(t=0;t<=this.n;++t)this.S[t][0]=this.gap(0),this.H[t][0]=-1/0;for(e=0;e<=this.m;++e)this.S[0][e]=this.gap(0),this.V[0][e]=-1/0;this.S[0][0]=0},qf.prototype.gap=function(t){return this.gapPenalty+t*this.gapExtensionPenalty},qf.prototype.makeScoreFn=function(){var t,e,i=this.seq1,r=this.seq2,n=this.substMatrix;return n?function(o,a){t=i[o],e=r[a];try{return n[t][e]}catch(t){return-4}}:(mc.warn("Alignment: no subst matrix"),function(n,o){return t=i[n],e=r[o],t===e?5:-3})},qf.prototype.calc=function(){gc&&mc.time("Alignment.calc"),this.initMatrices();var t,e,i,r,n,o,a,s=this.gap(0),c=this.makeScoreFn(),u=this.gapExtensionPenalty,h=this.V,l=this.H,p=this.S,d=this.n,f=this.m;for(o=1;o<=d;++o)for(e=p[o-1],t=h[o-1],i=h[o],r=l[o],n=p[o],a=1;a<=f;++a)i[a]=Math.max(e[a]+s,t[a]+u),r[a]=Math.max(n[a-1]+s,r[a-1]+u),n[a]=Math.max(e[a-1]+c(o-1,a-1),i[a],r[a]);gc&&mc.timeEnd("Alignment.calc"),gc&&mc.log(this.S,this.V,this.H)},qf.prototype.trace=function(){gc&&mc.time("Alignment.trace"),this.ali1="",this.ali2="";var t,e=this.makeScoreFn(),i=this.n,r=this.m;for(this.S[i][r]>=this.V[i][r]?(t="S",this.score=this.S[i][r]):this.V[i][r]>=this.H[i][r]?(t="V",this.score=this.V[i][r]):(t="H",this.score=this.H[i][r]),gc&&mc.log("Alignment: SCORE",this.score),gc&&mc.log("Alignment: S, V, H",this.S[i][r],this.V[i][r],this.H[i][r]);i>0&&r>0;)"S"===t?this.S[i][r]===this.S[i-1][r-1]+e(i-1,r-1)?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2=this.seq2[r-1]+this.ali2,--i,--r,t="S"):this.S[i][r]===this.V[i][r]?t="V":this.S[i][r]===this.H[i][r]?t="H":(--i,--r):"V"===t?this.V[i][r]===this.V[i-1][r]+this.gapExtensionPenalty?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i,t="V"):this.V[i][r]===this.S[i-1][r]+this.gap(0)?(this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i,t="S"):--i:"H"===t?this.H[i][r]===this.H[i][r-1]+this.gapExtensionPenalty?(this.ali1="-"+this.ali1,this.ali2=this.seq2[r-1]+this.ali2,--r,t="H"):this.H[i][r]===this.S[i][r-1]+this.gap(0)?(this.ali1="-"+this.ali1,this.ali2=this.seq2[r-1]+this.ali2,--r,t="S"):--r:mc.error("Alignment: no matrix");for(;i>0;)this.ali1=this.seq1[i-1]+this.ali1,this.ali2="-"+this.ali2,--i;for(;r>0;)this.ali1="-"+this.ali1,this.ali2=this.seq2[r-1]+this.ali2,--r;gc&&mc.timeEnd("Alignment.trace"),gc&&mc.log([this.ali1,this.ali2])};var Yf=function(t){function e(e){var i=this;t.call(this,e),e.scale||(this.scale="rainbow",this.reverse=Eo(e.reverse,!0)),this.scalePerModel={},this.structure.eachModel((function(t){i.domain=[t.atomOffset,t.atomEnd],i.scalePerModel[t.index]=i.getScale()}))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){return this.scalePerModel[t.modelIndex](t.index)},e}(Ns);yc.add("atomindex",Yf);var Zf=function(t){function e(e){if(t.call(this,e),e.scale||(this.scale="OrRd"),!e.domain){var i,r=1/0,n=-1/0;e.sele&&(i=new nc(e.sele)),this.structure.eachAtom((function(t){var e=t.bfactor;r=Math.min(r,e),n=Math.max(n,e)}),i),this.domain=[r,n]}this.bfactorScale=this.getScale()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){return this.bfactorScale(t.bfactor)},e}(Ns);yc.add("bfactor",Zf);var Kf=function(t){function e(e){t.call(this,e),e.scale||(this.scale="Spectral");var i={},r={};this.structure.eachModel(function(t){var e=0,n={};t.eachChain((function(t){void 0===n[t.chainid]&&(n[t.chainid]=e,e+=1)})),this.domain=[0,e-1],i[t.index]=n,r[t.index]=this.getScale()}.bind(this)),this.atomColor=function(t){var e=i[t.modelIndex];return r[t.modelIndex](e[t.chainid])}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("chainid",Kf);var Qf=function(t){function e(e){if(t.call(this,e),e.scale||(this.scale="Spectral"),e.domain){var i=this.getScale();this.atomColor=function(t){return i(t.chainIndex)}}else{var r={};this.structure.eachModel(function(t){this.domain=[t.chainOffset,t.chainEnd],r[t.index]=this.getScale()}.bind(this)),this.atomColor=function(t){return r[t.modelIndex](t.chainIndex)}}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("chainindex",Qf);var Jf=function(t){function e(e){t.call(this,e),e.scale||(this.scale="Spectral");var i={},r={};this.structure.eachModel(function(t){var e=0,n={};t.eachChain((function(t){void 0===n[t.chainname]&&(n[t.chainname]=e,e+=1)})),this.domain=[0,e-1],i[t.index]=n,r[t.index]=this.getScale()}.bind(this)),this.atomColor=function(t){var e=i[t.modelIndex];return r[t.modelIndex](e[t.chainname])}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("chainname",Jf);var tm=function(t){function e(e){t.call(this,e),e.scale||(this.scale="RdYlBu"),this.rsrzScale=this.getScale({domain:[2,0]}),this.rsccScale=this.getScale({domain:[.678,1]});var i=e.structure.validation||{};this.rsrzDict=i.rsrzDict||{},this.rsccDict=i.rsccDict||{}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.resno;t.inscode&&(e+="^"+t.inscode),t.chainname&&(e+=":"+t.chainname),e+="/"+t.modelIndex;var i=this.rsrzDict[e];if(void 0!==i)return this.rsrzScale(i);var r=this.rsccDict[e];return void 0!==r?this.rsccScale(r):9474192},e}(Ns);yc.add("densityfit",tm);var em={ARG:{CD:.1,CZ:.5,NE:-.1},ASN:{CG:.55,OD1:-.55},ASP:{CB:-.16,CG:.36,OD1:-.6,OD2:-.6},CYS:{CB:.19,SG:-.19},GLN:{CD:.55,OE1:-.55},GLU:{CD:.36,CG:-.16,OE1:-.6,OE2:-.6},HIS:{CB:.1,CD2:.2,CE1:.45,CG:.15,ND1:.05,NE2:.05},LYS:{CE:.25,NZ:.75},MET:{CE:.06,CG:.06,SD:-.12},PTR:{C:.55,CA:.1,CZ:.25,N:-.35,O:-.55,O1P:-.85,O2P:-.85,O3P:-.85,OG1:-1.1,P:1.4},SEP:{C:.55,CA:.1,CB:.25,N:-.35,O:-.55,O1P:-.85,O2P:-.85,O3P:-.85,OG1:-1.1,P:1.4},SER:{CB:.25,OG:-.25},THR:{CB:.25,OG1:-.25},TPO:{C:.55,CA:.1,CB:.25,N:-.35,O:-.55,OG1:-1.1,O1P:-.85,O2P:-.85,O3P:-.85,P:1.4},TRP:{CD1:.06,CD2:.1,CE2:-.04,CE3:-.03,CG:-.03,NE1:-.06},TYR:{CZ:.25,OH:-.25},backbone:{C:.55,O:-.55,N:-.35,CA:.1}};var im=function(t){function e(e){t.call(this,e),e.scale||(this.scale="rwb"),e.domain||(this.domain=[-.5,0,.5]);var i=this.getScale();var r=this.structure,n=new Float32Array(r.atomCount),o=[],a=[];r.eachAtom((function(t){var e;if(n[t.index]=((e=t).isProtein()&&(em[e.resname]&&em[e.resname][e.atomname]||em.backbone[e.atomname])||0)*t.occupancy,"N"===t.atomname){var i=function(t,e){e=e||new O;var i=!1,r=!1,n=!1;return e.set(2*t.x,2*t.y,2*t.z),t.eachBondedAtom((function(t){if(!i)return"H"===t.atomname?(e.set(t),void(i=!0)):void(r||"CA"!==t.atomname?n||"C"!==t.atomname||(n=!0,e.sub(t)):(e.sub(t),r=!0))})),i?e:r&&n?(e.normalize(),e.multiplyScalar(1.04),e.add(t),e):void 0}(t);void 0!==i&&(o.push(i),a.push(.25*t.occupancy))}}));var s=this.structure.getBoundingBox();s.expandByScalar(1.04);var c=function(t){for(var e=t.length,i=new Float32Array(e),r=new Float32Array(e),n=new Float32Array(e),o=0;o<t.length;o++){var a=t[o];i[o]=a.x,r[o]=a.y,n[o]=a.z}return{x:i,y:r,z:n,count:e}}(o),u=new Kl(c,s),h=new Kl(this.structure.atomStore,s),l=this.atomProxy,p=new O;this.positionColor=function(t){for(var e=0,r=h.within(t.x,t.y,t.z,12),o=0;o<r.length;o++){var s=r[o],d=n[s];if(0!==d){l.index=s,p.x=t.x-l.x,p.y=t.y-l.y,p.z=t.z-l.z;var f=p.lengthSq();f<144&&(e+=d/f)}}for(var m=u.within(t.x,t.y,t.z,12),g=0;g<m.length;g++){var v=m[g];p.x=t.x-c.x[v],p.y=t.y-c.y[v],p.z=t.z-c.z[v];var y=p.lengthSq();y<144&&(e+=a[v]/y)}return i(e)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("electrostatic",im);var rm={H:16777215,HE:14286847,LI:13402367,BE:12779264,B:16758197,C:9474192,N:3166456,O:16715021,F:9494608,NE:11789301,NA:11230450,MG:9109248,AL:12560038,SI:1578e4,P:16744448,S:16777008,CL:2093087,AR:8442339,K:9388244,CA:4062976,SC:15132390,TI:12567239,V:10921643,CR:9083335,MN:10255047,FE:14706227,CO:15765664,NI:5296208,CU:13140019,ZN:8224944,GA:12750735,GE:6721423,AS:12419299,SE:16752896,BR:10889513,KR:6076625,RB:7351984,SR:65280,Y:9764863,ZR:9756896,NB:7586505,MO:5551541,TC:3907230,RU:2396047,RH:687500,PD:27013,AG:12632256,CD:16767375,IN:10909043,SN:6717568,SB:10380213,TE:13924864,I:9699476,XE:9699476,CS:5707663,BA:51456,LA:7394559,CE:16777159,PR:14286791,ND:13107143,PM:10747847,SM:9437127,EU:6422471,GD:4587463,TB:3211207,DY:2097095,HO:65436,ER:58997,TM:54354,YB:48952,LU:43812,HF:5096191,TA:5089023,W:2200790,RE:2522539,OS:2516630,IR:1528967,PT:13684960,AU:16765219,HG:12105936,TL:10900557,PB:5724513,BI:10375093,PO:11230208,AT:7688005,RN:4358806,FR:4325478,RA:32e3,AC:7384058,TH:47871,PA:41471,U:36863,NP:33023,PU:27647,AM:5528818,CM:7888099,BK:9064419,CF:10565332,ES:11739092,FM:11739066,MD:11734438,NO:12389767,LR:13041766,RF:13369433,DB:13697103,SG:14221381,BH:14680120,HS:15073326,MT:15400998,DS:16777215,RG:16777215,CN:16777215,UUT:16777215,FL:16777215,UUP:16777215,LV:16777215,UUH:16777215,D:16777152,T:16777120},nm=function(t){function e(e){var i=e||{};i.value=Eo(i.value,rm.C),t.call(this,i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.element;return"C"===e?this.value:rm[e]||16777215},e}(Ns);yc.add("element",nm);var om=function(t){function e(e){t.call(this,e),e.scale||(this.scale="Spectral"),e.domain||(this.domain=[0,this.structure.entityList.length-1]);var i=this.getScale();this.atomColor=function(t){return i(t.entityIndex)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("entityindex",om);var am=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.entity;switch(e?e.entityType:void 0){case 1:return 8374655;case 2:return 16629894;case 3:return 12496596;case 4:return 3697840;default:return 16777113}},e}(Ns);yc.add("entitytype",am);var sm=function(t){function e(e){t.call(this,e);var i=e.structure.validation||{};this.geoAtomDict=i.geoAtomDict||{},this.geoDict=i.geoDict||{}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e,i=t.resno;t.inscode&&(i+="^"+t.inscode),t.chainname&&(i+=":"+t.chainname),i+="/"+t.modelIndex;var r,n=this.geoAtomDict[i];if(void 0!==n){var o=n[t.atomname]||0;r=o,e=16843009*((r=(858993459&(r-=r>>1&1431655765))+(r>>2&858993459))+(r>>4)&252645135)>>24}else e=this.geoDict[i]||0;return 0===e?2188972:1===e?16703627:2===e?16018755:e>=3?10813478:9474192},e}(Ns);yc.add("geoquality",sm);var cm=function(t){function e(e){var i;t.call(this,e),e.scale||(this.scale="RdYlGn");var r={};for(i in vl)r[i]=vl[i][0];if(!e.domain){var n,o=1/0,a=-1/0;for(i in r)n=r[i],o=Math.min(o,n),a=Math.max(a,n);this.domain=[o,0,a]}var s=this.getScale();this.atomColor=function(t){return s(r[t.resname]||yl)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("hydrophobicity",cm);var um=function(t){function e(e){t.call(this,e),e.scale||(this.scale="rainbow"),e.domain||(this.domain=[0,this.structure.modelStore.count]);var i=this.getScale();this.atomColor=function(t){return i(t.modelIndex)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("modelindex",um);var hm=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){switch(t.residueType.moleculeType){case 1:return 3697840;case 2:return 15729279;case 3:return 12496596;case 4:return 16629894;case 5:return 12540695;case 6:return 8374655;default:return 16777113}},e}(Ns);yc.add("moleculetype",hm);var lm=function(t){function e(e){t.call(this,e),e.scale||(this.scale="PuBu"),e.domain||(this.domain=[0,1]);var i=this.getScale();this.atomColor=function(t){return i(t.occupancy)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);function pm(){return 16777215*Math.random()}yc.add("occupancy",lm);var dm=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(){return pm()},e.prototype.volumeColor=function(){return pm()},e.prototype.positionColor=function(){return pm()},e}(Ns);yc.add("random",dm);var fm=function(t){function e(e){var i=this;if(t.call(this,e),e.scale||(this.scale="rainbow",this.reverse=Eo(e.reverse,!0)),e.domain){var r=this.getScale();this.atomColor=function(t){return r(t.residueIndex)}}else{var n={};this.structure.eachChain((function(t){i.domain=[t.residueOffset,t.residueEnd],n[t.index]=i.getScale()})),this.atomColor=function(t){return n[t.chainIndex](t.residueIndex)}}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ns);yc.add("residueindex",fm);var mm={ALA:9240460,ARG:124,ASN:16743536,ASP:10485826,CYS:16777072,GLN:16731212,GLU:6684672,GLY:16777215,HIS:7368959,ILE:19456,LEU:4546117,LYS:4671416,MET:12099650,PHE:5459026,PRO:5395026,SER:16740418,THR:12078080,TRP:5195264,TYR:9203788,VAL:16747775,ASX:16711935,GLX:16711935,ASH:16711935,GLH:16711935,A:10526975,G:16740464,I:8454143,C:16747595,T:10551200,U:16744576,DA:10526975,DG:16740464,DI:8454143,DC:16747595,DT:10551200,DU:16744576},gm=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){return mm[t.resname]||16711935},e}(Ns);yc.add("resname",gm);var vm=16711808,ym=10485888,bm=6291584,xm=16762880,_m=6324479,wm=16777215,Sm=11403518,Am=16580962,Mm=10921722,Pm=function(t){function e(e){t.call(this,e),this.rp=this.structure.getResidueProxy()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(t){var e=t.sstruc,i=this.rp;return"h"===e?vm:"g"===e?ym:"i"===e?bm:"e"===e||"b"===e?xm:"t"===e?_m:(i.index=t.residueIndex,i.isDna()?Sm:i.isRna()?Am:i.isSaccharide()?Mm:i.isProtein()||"s"===e||"l"===e?wm:8421504)},e}(Ns);yc.add("sstruc",Pm);var Tm=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.atomColor=function(){return this.value},e.prototype.bondColor=function(){return this.value},e.prototype.valueColor=function(){return this.value},e.prototype.volumeColor=function(){return this.value},e}(Ns);yc.add("uniform",Tm);var Em=function(t){function e(e){t.call(this,e),this.valueScale=this.getScale()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.volumeColor=function(t){return this.valueScale(this.volume.data[t])},e}(Ns);yc.add("value",Em);var Cm=function(t){function e(e){t.call(this,e);var i=this.volume;if(i&&i.inverseMatrix){var r=this.getScale(),n=i.inverseMatrix,o=i.data,a=i.nx,s=i.ny,c=a*s,u=new O;this.positionColor=function(t){u.copy(t),u.applyMatrix4(n);var e=Math.floor(u.x),i=Math.floor(u.y),h=Math.floor(u.z),l=(h*s+i)*a+e,p=l+1,d=l+a,f=l+c,m=d+1,g=f+1,v=d+c,y=v+1,b=o[l],x=o[p],_=o[d],w=o[f],S=o[m],A=o[g],M=o[v],P=o[y],T=u.x-e,E=u.y-i,C=u.z-h,I=Cs(b,x,T),R=Cs(w,A,T),L=Cs(_,S,T),O=Cs(M,P,T),N=Cs(I,L,E),D=Cs(R,O,E),k=Cs(N,D,C);return r(k)}}else{var h=this.value;this.positionColor=function(){return h}}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.positionColor=function(){},e}(Ns);yc.add("volume",Cm);var Im=function(t){function e(e,i,r){var n=this,o=r||{};o.name=Eo(o.name,i.name),t.call(this,e,o),this.script=i,this.status="loaded",this.script.signals.nameChanged.add((function(t){n.setName(t)}))}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"script"},e.prototype.addRepresentation=function(){},e.prototype.removeRepresentation=function(){},e.prototype.run=function(){var t=this;this.setStatus("running"),this.script.call(this.stage).then((function(){t.setStatus("finished")})),this.setStatus("called")},e.prototype.dispose=function(){this.signals.disposed.dispatch()},e.prototype.setVisibility=function(){},e.prototype.getCenter=function(){},e.prototype.getZoom=function(){},e.prototype.getBox=function(){},Object.defineProperties(e.prototype,i),e}(kf);Ac.add("script",Im);var Rm=function(t){function e(e,i,r){var n=r||{};n.name=Eo(n.name,i.name),t.call(this,e,n),this.shape=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"shape"},e.prototype.addRepresentation=function(e,i){return t.prototype.addRepresentation.call(this,e,this.shape,i)},e.prototype.getBoxUntransformed=function(){return this.shape.boundingBox},e.prototype.getCenterUntransformed=function(){return this.shape.center},e.prototype.dispose=function(){this.shape.dispose(),t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,i),e}(kf);Ac.add("shape",Rm);var Lm=function(t){function e(e,i,r,n){var o=this,a=r||{};a.name=Eo(a.name,i.name),t.call(this,e,a),this.signals=Object.assign(this.signals,{frameChanged:new Fs,playerChanged:new Fs,gotNumframes:new Fs,parametersChanged:new Fs}),this.trajectory=i,this.parent=n,this.status="loaded",this.defaultStep=Eo(a.defaultStep,void 0),this.defaultTimeout=Eo(a.defaultTimeout,50),this.defaultInterpolateType=Eo(a.defaultInterpolateType,""),this.defaultInterpolateStep=Eo(a.defaultInterpolateStep,5),this.defaultMode=Eo(a.defaultMode,"loop"),this.defaultDirection=Eo(a.defaultDirection,"forward"),i.signals.frameChanged.add((function(t){o.signals.frameChanged.dispatch(t)})),i.signals.playerChanged.add((function(t){o.signals.playerChanged.dispatch(t)})),i.signals.gotNumframes.add((function(t){o.signals.gotNumframes.dispatch(t)})),void 0!==a.initialFrame&&this.setFrame(a.initialFrame)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"trajectory"},e.prototype.addRepresentation=function(e,i){return t.prototype.addRepresentation.call(this,e,this.trajectory,i)},e.prototype.setFrame=function(t){this.trajectory.setFrame(t)},e.prototype.setParameters=function(t){this.trajectory.setParameters(t),this.signals.parametersChanged.dispatch(t)},e.prototype.dispose=function(){this.trajectory.dispose(),t.prototype.dispose.call(this)},e.prototype.getCenter=function(){},Object.defineProperties(e.prototype,i),e}(kf),Om=function(t){function e(e,i,r){t.call(this,"",i,r),this.name=e.name,this.path=e.path,this.frames=e.coordinates,this.boxes=e.boxes,this.getNumframes()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"frames"},e.prototype.makeAtomIndices=function(){"StructureView"===this.structure.type?this.atomIndices=this.structure.getAtomIndices():this.atomIndices=null},e.prototype._loadFrame=function(t,e){var i,r=this.frames[t];if(this.atomIndices){var n=this.atomIndices,o=n.length;i=new Float32Array(3*o);for(var a=0;a<o;++a){var s=3*a,c=3*n[a];i[s+0]=r[c+0],i[s+1]=r[c+1],i[s+2]=r[c+2]}}else i=new Float32Array(r);var u=this.boxes[t],h=this.frames.length;this.process(t,u,i,h),"function"==typeof e&&e()},e.prototype.getNumframes=function(){this.frames&&this.setNumframes(this.frames.length)},e.prototype.getPath=function(t,e){var i,r,n,o=this.numframes,a=3*t,s=new Float32Array(3*o);for(i=0;i<o;++i)r=3*i,n=this.frames[i],s[r+0]=n[a+0],s[r+1]=n[a+1],s[r+2]=n[a+2];e(s)},Object.defineProperties(e.prototype,i),e}(gd),Nm=function(t){function e(e,i,r){t.call(this,"",i,r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"structure"},e.prototype.makeAtomIndices=function(){this.structure.atomSet.getSize()<this.structure.atomStore.count?this.atomIndices=this.structure.getAtomIndices():this.atomIndices=null},e.prototype._loadFrame=function(t,e){var i,r=this.structure,n=r.frames[t];if(this.atomIndices){var o=this.atomIndices,a=o.length;i=new Float32Array(3*a);for(var s=0;s<a;++s){var c=3*s,u=3*o[s];i[c+0]=n[u+0],i[c+1]=n[u+1],i[c+2]=n[u+2]}}else i=new Float32Array(n);var h=r.boxes[t],l=r.frames.length;this.process(t,h,i,l),"function"==typeof e&&e()},e.prototype.getNumframes=function(){this.setNumframes(this.structure.frames.length)},e.prototype.getPath=function(t,e){var i,r,n,o=this.numframes,a=3*t,s=new Float32Array(3*o);for(i=0;i<o;++i)r=3*i,n=this.structure.frames[i],s[r+0]=n[a+0],s[r+1]=n[a+1],s[r+2]=n[a+2];e(s)},Object.defineProperties(e.prototype,i),e}(gd),Dm=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"remote"},e.prototype.makeAtomIndices=function(){var t=[];if("StructureView"===this.structure.type){var e,i,r=this.structure.getAtomIndices(),n=r[0],o=r[0],a=r.length;for(e=1;e<a;++e)o+1<(i=r[e])&&(t.push([n,o+1]),n=i),o=i;t.push([n,o+1])}else t.push([0,this.atomCount]);this.atomIndices=t},e.prototype._loadFrame=function(t,e){var i=new window.XMLHttpRequest,r=bc.trajectory,n=r.getFrameUrl(this.trajPath,t),o=r.getFrameParams(this.trajPath,this.atomIndices);i.open("POST",n,!0),i.responseType="arraybuffer",i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.addEventListener("load",function(){var r=i.response;if(r){var o=new Int32Array(r,0,1)[0],a=new Float32Array(r,8,9),s=new Float32Array(r,44);this.process(t,a,s,o),"function"==typeof e&&e()}else mc.error("empty arrayBuffer for '"+n+"'")}.bind(this),!1),i.send(o)},e.prototype.getNumframes=function(){var t=new window.XMLHttpRequest,e=bc.trajectory.getNumframesUrl(this.trajPath);t.open("GET",e,!0),t.addEventListener("load",function(){this.setNumframes(parseInt(t.response))}.bind(this),!1),t.send(null)},e.prototype.getPath=function(t,e){if(this.pathCache[t])e(this.pathCache[t]);else{mc.time("loadPath");var i=new window.XMLHttpRequest,r=bc.trajectory.getPathUrl(this.trajPath,t);i.open("POST",r,!0),i.responseType="arraybuffer",i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.addEventListener("load",function(){mc.timeEnd("loadPath");var n=i.response;if(n){var o=new Float32Array(n);this.pathCache[t]=o,e(o)}else mc.error("empty arrayBuffer for '"+r+"'")}.bind(this),!1),i.send("")}},Object.defineProperties(e.prototype,i),e}(gd);ld.prototype.getView=function(t){return new km(this,t)};var km=function(t){function e(e,i){t.call(this),this.structure=e,this.selection=i,this.center=new O,this.boundingBox=new jt,this._bp=this.getBondProxy(),this._ap=this.getAtomProxy(),this._rp=this.getResidueProxy(),this._cp=this.getChainProxy(),this.selection&&this.selection.signals.stringChanged.add(this.refresh,this),this.structure.signals.refreshed.add(this.refresh,this),this.refresh()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},name:{},path:{},title:{},id:{},atomSetDict:{},biomolDict:{},entityList:{},unitcell:{},frames:{},boxes:{},validation:{},bondStore:{},backboneBondStore:{},rungBondStore:{},atomStore:{},residueStore:{},chainStore:{},modelStore:{},atomMap:{},residueMap:{},bondHash:{},spatialHash:{}};return e.prototype.init=function(){},i.type.get=function(){return"StructureView"},i.name.get=function(){return this.structure.name},i.path.get=function(){return this.structure.path},i.title.get=function(){return this.structure.title},i.id.get=function(){return this.structure.id},i.atomSetDict.get=function(){return this.structure.atomSetDict},i.biomolDict.get=function(){return this.structure.biomolDict},i.entityList.get=function(){return this.structure.entityList},i.unitcell.get=function(){return this.structure.unitcell},i.frames.get=function(){return this.structure.frames},i.boxes.get=function(){return this.structure.boxes},i.validation.get=function(){return this.structure.validation},i.bondStore.get=function(){return this.structure.bondStore},i.backboneBondStore.get=function(){return this.structure.backboneBondStore},i.rungBondStore.get=function(){return this.structure.rungBondStore},i.atomStore.get=function(){return this.structure.atomStore},i.residueStore.get=function(){return this.structure.residueStore},i.chainStore.get=function(){return this.structure.chainStore},i.modelStore.get=function(){return this.structure.modelStore},i.atomMap.get=function(){return this.structure.atomMap},i.residueMap.get=function(){return this.structure.residueMap},i.bondHash.get=function(){return this.structure.bondHash},i.spatialHash.get=function(){return this.structure.spatialHash},e.prototype.refresh=function(){for(var t in gc&&mc.time("StructureView.refresh"),this.atomSetCache={},this.atomSet=this.getAtomSet(this.selection,!0),this.structure.atomSet&&(this.atomSet=this.atomSet.intersection(this.structure.atomSet)),this.bondSet=this.getBondSet(),this.atomSetDict){var e=this.atomSetDict[t];this.atomSetCache["__"+t]=e.makeIntersection(this.atomSet)}this.atomCount=this.atomSet.getSize(),this.bondCount=this.bondSet.getSize(),this.boundingBox=this.getBoundingBox(),this.center=this.boundingBox.getCenter(),gc&&mc.timeEnd("StructureView.refresh"),this.signals.refreshed.dispatch()},e.prototype.setSelection=function(t){this.selection=t,this.refresh()},e.prototype.getSelection=function(t){var e=[];t&&t.string&&e.push(t.string);var i=this.structure.getSelection();i&&i.string&&e.push(i.string),this.selection&&this.selection.string&&e.push(this.selection.string);var r="";return e.length>0&&(r="( "+e.join(" ) AND ( ")+" )"),new nc(r)},e.prototype.getStructure=function(){return this.structure.getStructure()},e.prototype.eachBond=function(t,e){this.structure.eachBond(t,this.getSelection(e))},e.prototype.eachAtom=function(t,e){var i=this.getAtomProxy(),r=this.getAtomSet(e),n=this.atomStore.count;if(r.getSize()<n)r.forEach((function(e){i.index=e,t(i)}));else for(var o=0;o<n;++o)i.index=o,t(i)},e.prototype.eachResidue=function(t,e){this.structure.eachResidue(t,this.getSelection(e))},e.prototype.eachResidueN=function(){console.error("StructureView.eachResidueN() not implemented")},e.prototype.eachChain=function(t,e){this.structure.eachChain(t,this.getSelection(e))},e.prototype.eachModel=function(t,e){this.structure.eachModel(t,this.getSelection(e))},e.prototype.getAtomSet=function(t,e){var i=this.structure.getAtomSet(t);return!e&&this.atomSet&&(i=i.makeIntersection(this.atomSet)),i},e.prototype.getAtomIndices=function(t){return this.structure.getAtomIndices(this.getSelection(t))},e.prototype.refreshPosition=function(){return this.structure.refreshPosition()},e.prototype.dispose=function(){this.selection&&this.selection.signals.stringChanged.remove(this.refresh,this),this.structure.signals.refreshed.remove(this.refresh,this),delete this.structure,delete this.atomSet,delete this.bondSet,delete this.atomCount,delete this.bondCount},Object.defineProperties(e.prototype,i),e}(ld),Fm=function(t){function e(e,i,r){var n=r||{};n.name=Eo(n.name,i.name),t.call(this,e,n),this.signals=Object.assign(this.signals,{trajectoryAdded:new Fs,trajectoryRemoved:new Fs,defaultAssemblyChanged:new Fs}),this.structure=i,this.trajList=[],this.initSelection(n.sele),this.setDefaultAssembly(n.assembly||"")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"structure"},e.prototype.initSelection=function(t){var e=this;this.selection=new nc(t),this.structureView=new km(this.structure,this.selection),this.selection.signals.stringChanged.add((function(){e.structureView.setSelection(e.selection),e.rebuildRepresentations(),e.rebuildTrajectories()}))},e.prototype.setSelection=function(t){return this.selection.setString(t),this},e.prototype.setDefaultAssembly=function(t){var e=this;this.defaultAssembly=t,this.reprList.forEach((function(t){t.setParameters({defaultAssembly:e.defaultAssembly})})),this.signals.defaultAssemblyChanged.dispatch(t)},e.prototype.rebuildRepresentations=function(){this.reprList.forEach((function(t){t.build()}))},e.prototype.rebuildTrajectories=function(){var t=this;this.trajList.slice().forEach((function(e){e.trajectory.setStructure(t.structureView)}))},e.prototype.addRepresentation=function(e,i){var r=i||{};return r.defaultAssembly=this.defaultAssembly,t.prototype.addRepresentation.call(this,e,this.structureView,r)},e.prototype.addTrajectory=function(t,e){var i=this,r=function(t,e,i){return t&&"Frames"===t.type?new Om(t,e,i):!t&&e.frames?new Nm(t,e,i):new Dm(t,e,i)}(t,this.structureView,e);r.signals.frameChanged.add((function(){i.updateRepresentations({position:!0})}));var n=new Lm(this.stage,r,e,this);return this.trajList.push(n),this.signals.trajectoryAdded.dispatch(n),n},e.prototype.removeTrajectory=function(t){var e=this.trajList.indexOf(t);-1!==e&&this.trajList.splice(e,1),t.dispose(),this.signals.trajectoryRemoved.dispatch(t)},e.prototype.dispose=function(){this.trajList.slice().forEach((function(t){t.dispose()})),this.trajList.length=0,this.structure.dispose(),t.prototype.dispose.call(this)},e.prototype.autoView=function(t,e){Number.isInteger(t)&&(e=t,t=void 0),this.stage.animationControls.zoomMove(this.getCenter(t),this.getZoom(t),Eo(e,0))},e.prototype.getBoxUntransformed=function(t){return t?this.structureView.getBoundingBox(new nc(t)):this.structureView.boundingBox},e.prototype.getCenterUntransformed=function(t){return t&&"string"==typeof t?this.structure.atomCenter(new nc(t)):this.structure.center},e.prototype.superpose=function(t,e,i,r){return function(t,e,i,r,n){var o,a,s,c,u;if(i=Eo(i,!1),r=Eo(r,""),n=Eo(n,""),i){var h=t,l=e;r&&n&&(h=t.getView(new nc(r)),l=e.getView(new nc(n)));var p,d,f,m,g,v=h.getSequence(),y=l.getSequence(),b=new qf(v.join(""),y.join(""));b.calc(),b.trace(),o=0,a=0,s=b.ali1.length;var x=[],_=[];for(p=0;p<s;++p)m=b.ali1[p],g=b.ali2[p],d=0,f=0,"-"===m?_[a]=!1:(_[a]=!0,d=1),"-"===g?x[o]=!1:(x[o]=!0,f=1),o+=d,a+=f;var w=[],S=[],A=h.getAtomProxy(),M=l.getAtomProxy();o=0,h.eachResidue((function(t){void 0!==t.traceAtomIndex&&t.traceAtomIndex===t.getAtomIndexByName("CA")&&(x[o]&&(A.index=t.getAtomIndexByName("CA"),w.push(A.x,A.y,A.z)),o+=1)})),o=0,l.eachResidue((function(t){void 0!==t.traceAtomIndex&&t.traceAtomIndex===t.getAtomIndexByName("CA")&&(_[o]&&(M.index=t.getAtomIndexByName("CA"),S.push(M.x,M.y,M.z)),o+=1)})),c=new Float32Array(w),u=new Float32Array(S)}else{c=t.getView(new nc(r+" and .CA")),u=e.getView(new nc(n+" and .CA"))}new fd(c,u).transform(t),t.refreshPosition()}(this.structureView,t.structureView,e,i,r),this.updateRepresentations({position:!0}),this},e.prototype.setVisibility=function(e){return t.prototype.setVisibility.call(this,e),this.trajList.forEach((function(t){t.setVisibility(e)})),this},Object.defineProperties(e.prototype,i),e}(kf);Ac.add("structure",Fm),Ac.add("structureview",Fm);var Bm=function(t){function e(e,i,r){var n=r||{};n.name=Eo(n.name,i.name),t.call(this,e,n),this.surface=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"surface"},e.prototype.addRepresentation=function(e,i){return t.prototype.addRepresentation.call(this,e,this.surface,i)},e.prototype.getBoxUntransformed=function(){return this.surface.boundingBox},e.prototype.getCenterUntransformed=function(){return this.surface.center},e.prototype.dispose=function(){this.surface.dispose(),t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,i),e}(kf);Ac.add("surface",Bm);var zm=function(t){function e(e,i,r){var n=r||{};n.name=Eo(n.name,i.name),t.call(this,e,n),this.volume=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"volume"},e.prototype.addRepresentation=function(e,i){return t.prototype.addRepresentation.call(this,e,this.volume,i)},e.prototype.getBoxUntransformed=function(){return this.volume.boundingBox},e.prototype.getCenterUntransformed=function(){return this.volume.center},e.prototype.dispose=function(){this.volume.dispose(),t.prototype.dispose.call(this)},Object.defineProperties(e.prototype,i),e}(kf);Ac.add("volume",zm);var Um=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="axes",this.parameters=Object.assign({radius:{type:"number",precision:3,max:10,min:.001},sphereDetail:!0,radialSegments:!0,disableImpostor:!0,showAxes:{type:"boolean",rebuild:!0},showBox:{type:"boolean",rebuild:!0}},this.parameters,{assembly:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.radius=Eo(i.radius,.5),i.colorValue=Eo(i.colorValue,"lightgreen"),this.showAxes=Eo(i.showAxes,!0),this.showBox=Eo(i.showBox,!1),t.prototype.init.call(this,i)},e.prototype.getPrincipalAxes=function(){var t,e=this.getAssembly();return e&&(t=e.partList[0].getSelection()),this.structureView.getPrincipalAxes(t)},e.prototype.getAxesData=function(t){var e=this.getPrincipalAxes(t),i=new St(this.colorValue),r=0,n=0;this.showAxes&&(r+=6,n+=3),this.showBox&&(r+=8,n+=12);var o=new Float32Array(3*r),a=au(r,i.r,i.g,i.b),s=ou(r,this.radius),c=new Float32Array(3*n),u=new Float32Array(3*n),h=au(n,i.r,i.g,i.b),l=ou(n,this.radius),p=0;if(this.showAxes){var d=function(t,e){t.toArray(o,2*p),e.toArray(o,2*p+3),t.toArray(c,p),e.toArray(u,p),p+=3};d(e.begA,e.endA),d(e.begB,e.endB),d(e.begC,e.endC)}if(this.showBox){var f=new O,m=e.getProjectedScaleForAtoms(t),g=m.d1a,v=m.d2a,y=m.d3a,b=m.d1b,x=m.d2b,_=m.d3b;console.log(g,v,y,b,x,_);var w=2*p,S=function(t,i,r){f.copy(e.center).addScaledVector(e.normVecA,t).addScaledVector(e.normVecB,i).addScaledVector(e.normVecC,r),f.toArray(o,w),w+=3};S(g,v,y),S(g,v,_),S(g,x,_),S(g,x,y),S(b,x,_),S(b,x,y),S(b,v,y),S(b,v,_);var A=p,M=function(t,e){f.fromArray(o,2*p+3*t).toArray(c,A),f.fromArray(o,2*p+3*e).toArray(u,A),A+=3};M(0,1),M(0,3),M(0,6),M(1,2),M(1,7),M(2,3),M(2,4),M(3,5),M(4,5),M(4,7),M(5,6),M(6,7)}var P=new Hh(e);return{vertex:{position:o,color:a,radius:s,picking:P},edge:{position1:c,position2:u,color:h,color2:h,radius:l,picking:P}}},e.prototype.create=function(){var t=this.getAxesData(this.structureView);this.sphereBuffer=new Od(t.vertex,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0})),this.cylinderBuffer=new qd(t.edge,this.getBufferParams({openEnded:!0,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bufferList:[this.sphereBuffer,this.cylinderBuffer]})},e.prototype.updateData=function(t,e){var i=this.getAxesData(e.sview),r={},n={};t&&!t.position||(r.position=i.vertex.position,n.position1=i.edge.position1,n.position2=i.edge.position2),t&&!t.color||(r.color=i.vertex.color,n.color=i.edge.color,n.color2=i.edge.color),t&&!t.radius||(r.radius=i.vertex.radius,n.radius=i.edge.radius),this.sphereBuffer.setAttributes(r),this.cylinderBuffer.setAttributes(n)},e}(Cf);xc.add("axes",Um);var jm=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="ball+stick",this.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}},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.radius=Eo(i.radius,.15),this.aspectRatio=Eo(i.aspectRatio,2),this.lineOnly=Eo(i.lineOnly,!1),this.cylinderOnly=Eo(i.cylinderOnly,!1),this.multipleBond=Eo(i.multipleBond,"off"),this.bondSpacing=Eo(i.bondSpacing,1),this.bondScale=Eo(i.bondScale,.4),t.prototype.init.call(this,i)},e.prototype.getAtomParams=function(e,i){return i=Object.assign({radiusParams:{radius:this.radius,scale:this.scale*this.aspectRatio}},i),t.prototype.getAtomParams.call(this,e,i)},e.prototype.getAtomData=function(t,e,i){return t.getAtomData(this.getAtomParams(e,i))},e.prototype.getBondParams=function(e,i){return i=Object.assign({multipleBond:this.multipleBond,bondSpacing:this.bondSpacing,bondScale:this.bondScale},i),t.prototype.getBondParams.call(this,e,i)},e.prototype.getBondData=function(t,e,i){return t.getBondData(this.getBondParams(e,i))},e.prototype.createData=function(t){var e=this.getBondData(t),i=[];if(this.lineOnly)this.lineBuffer=new If(e,this.getBufferParams()),i.push(this.lineBuffer);else{var r=new qd(e,this.getBufferParams({openEnded:this.openEnded,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}));if(i.push(r),!this.cylinderOnly){var n=new Od(this.getAtomData(t),this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0}));i.push(n)}}return{bufferList:i}},e.prototype.updateData=function(t,e){"off"!==this.multipleBond&&t&&t.radius&&(t.position=!0);var i=this.getBondData(e.sview,t);if(this.lineOnly){var r={};t&&!t.position||(r.position1=i.position1,r.position2=i.position2),t&&!t.color||(r.color=i.color,r.color2=i.color2),e.bufferList[0].setAttributes(r)}else{var n={};if(t&&!t.position||(n.position1=i.position1,n.position2=i.position2),t&&!t.color||(n.color=i.color,n.color2=i.color2),t&&!t.radius||(n.radius=i.radius),e.bufferList[0].setAttributes(n),!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)}}},e.prototype.setParameters=function(e){var i=!1,r={};return e&&(e.aspectRatio||e.bondSpacing||e.bondScale)&&(r.radius=!0,dc&&!this.disableImpostor||(i=!0)),t.prototype.setParameters.call(this,e,r,i),this},e}(Cf);xc.add("ball+stick",jm);var Gm=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="backbone",this.parameters=Object.assign({},this.parameters,{multipleBond:null,bondSpacing:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.aspectRatio=Eo(i.aspectRatio,1),i.radius=Eo(i.radius,.25),t.prototype.init.call(this,i)},e.prototype.getAtomData=function(t,e,i){return t.getBackboneAtomData(this.getAtomParams(e,i))},e.prototype.getBondData=function(t,e,i){return t.getBackboneBondData(this.getBondParams(e,i))},e}(jm);xc.add("backbone",Gm);var Vm=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="base",this.parameters=Object.assign({},this.parameters,{multipleBond:null,bondSpacing:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.aspectRatio=Eo(i.aspectRatio,1),i.radius=Eo(i.radius,.3),t.prototype.init.call(this,i)},e.prototype.getAtomData=function(t,e,i){return t.getRungAtomData(this.getAtomParams(e,i))},e.prototype.getBondData=function(t,e,i){var r=this.getBondParams(e,i);return r.colorParams.rung=!0,t.getRungBondData(r)},e}(jm);function $m(t,e){var i=1/t,r=new O,n=new O;function o(t,i,r,n,o,a,s){a[s+0]=Is(t.x,i.x,r.x,n.x,o,e),a[s+1]=Is(t.y,i.y,r.y,n.y,o,e),a[s+2]=Is(t.z,i.z,r.z,n.z,o,e)}function a(t,i,r,n,o,a){a.x=Is(t.x,i.x,r.x,n.x,o,e),a.y=Is(t.y,i.y,r.y,n.y,o,e),a.z=Is(t.z,i.z,r.z,n.z,o,e)}function s(e,r,n,a,s,c){for(var u=0;u<t;++u){o(e,r,n,a,i*u,s,c+3*u)}}function c(e,o,s,c,u,h){for(var l=0;l<t;++l){var p=i*l,d=p-1e-4,f=p+1e-4,m=h+3*l;d<0&&(d=0),f>1&&(f=1),a(e,o,s,c,d,r),a(e,o,s,c,f,n),n.sub(r).normalize(),n.toArray(u,m)}}function u(e,i,r,n,o){for(var a=i.next(),s=i.next(),c=i.next(),u=i.size,h=u-1,l=n||0,p=0;p<h;++p)e(a,a=s,s=c,c=i.next(),r,l),l+=3*t;o&&(e(i.get(u-2),a=i.get(u-1),s=i.get(0),c=i.get(1),r,l),l+=3*t)}this.getPosition=function(e,i,r,n){e.reset(),u(s,e,i,r,n);var o=e.size-1,a=o*t*3;n&&(a+=3*t);var c=e.get(n?0:o);i[a]=c.x,i[a+1]=c.y,i[a+2]=c.z},this.getTangent=function(e,i,r,n){e.reset(),u(c,e,i,r,n);var o=(e.size-1)*t*3;n&&(o+=3*t),uu(i,i,o-3,o,3)};var h=new O,l=new O,p=new O,d=new O,f=Math.ceil(t/2);function m(e,o,s,c,u,m,g,v,y,b,x,_,w){for(var S=0;S<t;++S){var A=_+3*S;w&&(A+=3*f);var M=i*S;a(e,o,s,c,M,r),a(u,m,g,v,M,n),h.subVectors(n,r).normalize(),l.fromArray(y,A),d.crossVectors(h,l).normalize(),d.toArray(x,A),p.crossVectors(l,d).normalize(),p.toArray(b,A)}}function g(e,i,r,n,o){for(var a=0;a<t;++a){var s=o+3*a;e.copy(p),l.fromArray(i,s),d.crossVectors(e,l).normalize(),d.toArray(n,s),p.crossVectors(l,d).normalize(),p.toArray(r,s)}}function v(e,i,r,n,o){var a;for(a=0;a<f;++a)r(e,n,o+3*a);for(a=f;a<t;++a)r(i,n,o+3*a)}function y(e,i,r,n,o){var a;for(a=0;a<f;++a)n[o+a]=r(e);for(a=f;a<t;++a)n[o+a]=r(i)}function b(e,i,r,n,o){for(var a=r(e),s=r(i),c=0;c<t;++c){var u=c/t;n[o+c]=(1-u)*a+u*s}}this.getNormal=function(e,i,r,n,o,a){p.set(0,0,1);for(var s=e-1,c=o||0,u=0;u<s;++u)g(h,i,r,n,c),c+=3*t;a&&(g(h,i,r,n,c),c+=3*t),d.toArray(n,c),p.toArray(r,c)},this.getNormalDir=function(e,i,r,n,o,a,s,c){e.reset(),i.reset();var u=new O,h=new O,l=new O,g=new O,v=new O,y=(new O).copy(e.next()),b=(new O).copy(e.next()),x=(new O).copy(e.next()),_=new O,w=(new O).copy(i.next()),S=(new O).copy(i.next()),A=(new O).copy(i.next());p.set(0,0,1);for(var M=e.size,P=M-1,T=a||0,E=0;E<P;++E)v.copy(y),y.copy(b),b.copy(x),x.copy(e.next()),_.copy(w),w.copy(S),S.copy(A),A.copy(i.next()),0===E?(u.subVectors(_,v),h.subVectors(w,y),u.dot(h)<0&&(h.multiplyScalar(-1),w.addVectors(y,h)),l.subVectors(S,b),h.dot(l)<0&&(l.multiplyScalar(-1),S.addVectors(b,l))):l.copy(g),g.subVectors(A,x),l.dot(g)<0&&(g.multiplyScalar(-1),A.addVectors(x,g)),m(v,y,b,x,_,w,S,A,r,n,o,T,c),T+=3*t;if(s&&(v.copy(e.get(M-2)),y.copy(e.get(M-1)),b.copy(e.get(0)),x.copy(e.get(1)),_.copy(i.get(M-2)),w.copy(i.get(M-1)),S.copy(i.get(0)),A.copy(i.get(1)),l.copy(g),g.subVectors(A,x),l.dot(g)<0&&(g.multiplyScalar(-1),A.addVectors(x,g)),m(v,y,b,x,_,w,S,A,r,n,o,T,c),T+=3*t),c){d.fromArray(o,3*f),p.fromArray(n,3*f);for(var C=0;C<f;++C)d.toArray(o,3*C),p.toArray(n,3*C)}else d.toArray(o,T),p.toArray(n,T)},this.getColor=function(e,i,r,n,o){e.reset(),e.next();for(var a=e.next(),s=e.size,c=s-1,u=n||0,h=0;h<c;++h)v(a,a=e.next(),i,r,u),u+=3*t;o&&(v(e.get(s-1),a=e.get(0),i,r,u),u+=3*t),r[u]=r[u-3],r[u+1]=r[u-2],r[u+2]=r[u-1]},this.getPicking=function(e,i,r,n,o){e.reset(),e.next();for(var a=e.next(),s=e.size,c=s-1,u=n||0,h=0;h<c;++h)y(a,a=e.next(),i,r,u),u+=t;o&&(y(e.get(s-1),a=e.get(0),i,r,u),u+=t),r[u]=r[u-1]},this.getSize=function(e,i,r,n,o){e.reset(),e.next();for(var a=e.next(),s=e.size,c=s-1,u=n||0,h=0;h<c;++h)b(a,a=e.next(),i,r,u),u+=t;o&&(b(e.get(s-1),a=e.get(0),i,r,u),u+=t),r[u]=r[u-1]}}function Hm(t,e){this.polymer=t,this.size=t.residueCount;var i=e||{};this.directional=i.directional||!1,this.positionIterator=i.positionIterator||!1,this.subdiv=i.subdiv||1,this.smoothSheet=i.smoothSheet||!1,isNaN(i.tension)?this.tension=this.polymer.isNucleic()?.5:.9:this.tension=i.tension||.5,this.interpolator=new $m(this.subdiv,this.tension)}xc.add("base",Vm),Hm.prototype={constructor:Hm,getAtomIterator:function(t,e){var i=this.polymer,r=i.structure,n=i.residueCount,o=0,a=-1,s=[r.getAtomProxy(),r.getAtomProxy(),r.getAtomProxy(),r.getAtomProxy()],c=[new O,new O,new O,new O];var u=r.getAtomProxy(),h=r.getAtomProxy();return{size:n,next:function(){var t=this.get(a);return a+=1,t},get:function(r){var a=s[o%4];if(a.index=i.getAtomIndexByType(r,t),e&&r>0&&r<n&&"e"===a.sstruc){var l=c[o%4];return u.index=i.getAtomIndexByType(r+1,t),h.index=i.getAtomIndexByType(r-1,t),l.addVectors(u,h).add(a).add(a).multiplyScalar(.25),o+=1,l}return o+=1,a},reset:function(){o=0,a=-1}}},getSubdividedColor:function(t){var e=this.subdiv,i=this.polymer,r=(i.residueCount-1)*e*3+3;i.isCyclic&&(r+=3*e);var n=new Float32Array(r),o=this.getAtomIterator("trace"),a=t||{};a.structure=i.structure;var s=yc.getScheme(a);return this.interpolator.getColor(o,(function(t,e,i){s.atomColorToArray(t,e,i)}),n,0,i.isCyclic),{color:n}},getSubdividedPicking:function(){var t=this.subdiv,e=this.polymer,i=(e.residueCount-1)*t+1;e.isCyclic&&(i+=t);var r=e.structure,n=this.getAtomIterator("trace"),o=new Float32Array(i);return this.interpolator.getPicking(n,(function(t){return t.index}),o,0,e.isCyclic),{picking:new $h(o,r)}},getSubdividedPosition:function(){return{position:this.getPosition()}},getSubdividedOrientation:function(){var t=this.getTangent(),e=this.getNormals(t);return{tangent:t,normal:e.normal,binormal:e.binormal}},getSubdividedSize:function(t,e){var i=this.subdiv,r=this.polymer,n=(r.residueCount-1)*i+1;r.isCyclic&&(n+=i);var o=new Float32Array(n),a=this.getAtomIterator("trace"),s=new Il(t,e);return this.interpolator.getSize(a,(function(t){return s.atomRadius(t)}),o,0,r.isCyclic),{size:o}},getPosition:function(){var t=this.subdiv,e=this.polymer,i=(e.residueCount-1)*t*3+3;e.isCyclic&&(i+=3*t);var r=new Float32Array(i),n=this.positionIterator||this.getAtomIterator("trace",this.smoothSheet);return this.interpolator.getPosition(n,r,0,e.isCyclic),r},getTangent:function(){var t=this.subdiv,e=this.polymer,i=(this.size-1)*t*3+3;e.isCyclic&&(i+=3*t);var r=new Float32Array(i),n=this.positionIterator||this.getAtomIterator("trace",this.smoothSheet);return this.interpolator.getTangent(n,r,0,e.isCyclic),r},getNormals:function(t){var e=this.subdiv,i=this.polymer,r=i.isProtein(),n=this.size,o=(n-1)*e*3+3;i.isCyclic&&(o+=3*e);var a=new Float32Array(o),s=new Float32Array(o);if(this.directional&&!this.polymer.isCg()){var c=this.getAtomIterator("direction1"),u=this.getAtomIterator("direction2");this.interpolator.getNormalDir(c,u,t,a,s,0,i.isCyclic,r)}else this.interpolator.getNormal(n,t,a,s,0,i.isCyclic,r);return{normal:a,binormal:s}}};var Wm=new O,Xm=new O,qm=function(t){function e(e,i){var r=e||{},n=i||{},o=Eo(n.radialSegments,4),a=Eo(n.capped,!1),s=a?o:0,c=a?o-2:0,u=r.position.length/3,h=u*o*3+2*s*3,l=2*(u-1)*o*3+2*c*3,p=new Float32Array(h),d=new Float32Array(h),f=new Float32Array(h),m=zo(l,h/3);t.call(this,{position:p,color:d,index:m,normal:f,picking:r.picking},n),this.aspectRatio=Eo(n.aspectRatio,1),this.radialSegments=o,this.capped=a,this.capVertices=s,this.capTriangles=c,this.size2=u,r.primitiveId=su(u),this.setAttributes(r),this.meshIndex=m,this.makeIndex()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setAttributes=function(t){var e,i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,P,T,E,C,I,R,L,O,N,D=this.aspectRatio,k=this.size2,F=k-1,B=this.radialSegments,z=this.geometry.attributes;t.position&&(e=t.position,i=t.normal,r=t.binormal,n=t.tangent,a=t.size,c=z.position.array,h=z.normal.array,z.position.needsUpdate=!0,z.normal.needsUpdate=!0),t.color&&(o=t.color,u=z.color.array,z.color.needsUpdate=!0),t.primitiveId&&(s=t.primitiveId,l=z.primitiveId.array,z.primitiveId.needsUpdate=!0);var U=[],j=[],G=[],V=[],$=[],H=[];if(e)for(d=0;d<B;++d)y=d/B*2*Math.PI,U[d]=D*Math.cos(y),j[d]=Math.sin(y),G[d]=D*Math.cos(y-.01),V[d]=Math.sin(y-.01),$[d]=D*Math.cos(y+.01),H[d]=Math.sin(y+.01);for(p=0;p<k;++p)for(m=(f=3*p)*B,e&&(Wm.set(n[f],n[f+1],n[f+2]),P=i[f],T=i[f+1],E=i[f+2],C=r[f],I=r[f+1],R=r[f+2],L=e[f],O=e[f+1],N=e[f+2],M=a[p]),d=0;d<B;++d)g=m+3*d,e&&(b=-M*U[d],x=M*j[d],_=-M*G[d],w=M*V[d],S=-M*$[d],A=M*H[d],c[g]=L+b*P+x*C,c[g+1]=O+b*T+x*I,c[g+2]=N+b*E+x*R,Xm.set(S*P+A*C-(_*P+w*C),S*T+A*I-(_*T+w*I),S*E+A*R-(_*E+w*R)).cross(Wm),h[g]=Xm.x,h[g+1]=Xm.y,h[g+2]=Xm.z),o&&(u[g]=o[f],u[g+1]=o[f+1],u[g+2]=o[f+2]),s&&(l[p*B+d]=s[p]);for(f=0,m=3*k*B,d=0;d<B;++d)g=f+3*d,v=m+3*d,e&&(c[v]=c[g],c[v+1]=c[g+1],c[v+2]=c[g+2],h[v]=n[f],h[v+1]=n[f+1],h[v+2]=n[f+2]),o&&(u[v]=u[g],u[v+1]=u[g+1],u[v+2]=u[g+2]),s&&(l[k*B+d]=l[0+d]);for(f=3*(k-1)*B,m=3*(k+1)*B,d=0;d<B;++d)g=f+3*d,v=m+3*d,e&&(c[v]=c[g],c[v+1]=c[g+1],c[v+2]=c[g+2],h[v]=n[3*F],h[v+1]=n[3*F+1],h[v+2]=n[3*F+2]),o&&(u[v]=u[g],u[v+1]=u[g+1],u[v+2]=u[g+2]),s&&(l[(k+1)*B+d]=l[(k-1)*B+d])},e.prototype.makeIndex=function(){var t,e,i,r,n,o,a=this.meshIndex,s=this.size2,c=s-1,u=this.capTriangles,h=this.radialSegments,l=this.radialSegments+1;for(t=0;t<c;++t)for(e=t*h*3*2,i=t*h,r=(t+1)*h,o=0;o<h;++o)a[n=e+3*o*2]=i+o,a[n+1]=i+(o+1)%h,a[n+2]=r+o,a[n+3]=r+o,a[n+4]=i+(o+1)%h,a[n+5]=r+(o+1)%h;var p=[0];for(o=1;o<l/2;++o)p.push(o),h-o!==o&&p.push(h-o);for(n=c*h*3*2,e=s*h,o=0;o<p.length-2;++o)o%2==0?(a[n+3*o+0]=e+p[o+0],a[n+3*o+1]=e+p[o+1],a[n+3*o+2]=e+p[o+2]):(a[n+3*o+0]=e+p[o+2],a[n+3*o+1]=e+p[o+1],a[n+3*o+2]=e+p[o+0]);for(n=c*h*3*2+3*u,e=s*h+h,o=0;o<p.length-2;++o)o%2==0?(a[n+3*o+0]=e+p[o+0],a[n+3*o+1]=e+p[o+1],a[n+3*o+2]=e+p[o+2]):(a[n+3*o+0]=e+p[o+2],a[n+3*o+1]=e+p[o+1],a[n+3*o+2]=e+p[o+0])},e}(wd),Ym=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="cartoon",this.parameters=Object.assign({aspectRatio:{type:"number",precision:1,max:10,min:1},subdiv:{type:"integer",max:50,min:1,rebuild:!0},radialSegments:{type:"integer",max:50,min:1,rebuild:!0},tension:{type:"number",precision:1,max:1,min:.1},capped:{type:"boolean",rebuild:!0},smoothSheet:{type:"boolean",rebuild:!0}},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"chainname"),i.colorScale=Eo(i.colorScale,"RdYlBu"),i.radius=Eo(i.radius,"sstruc"),i.scale=Eo(i.scale,.7),this.aspectRatio=Eo(i.aspectRatio,5),this.tension=Eo(i.tension,NaN),this.capped=Eo(i.capped,!0),this.smoothSheet=Eo(i.smoothSheet,!1),"low"===i.quality?(this.subdiv=3,this.radialSegments=6):"medium"===i.quality?this.subdiv=6:"high"===i.quality?this.subdiv=12:this.subdiv=Eo(i.subdiv,6),t.prototype.init.call(this,i)},e.prototype.getSplineParams=function(t){return Object.assign({subdiv:this.subdiv,tension:this.tension,directional:1!==this.aspectRatio,smoothSheet:this.smoothSheet},t)},e.prototype.getSpline=function(t){return new Hm(t,this.getSplineParams())},e.prototype.getScale=function(t){return t.isCg()?this.scale*this.aspectRatio:this.scale},e.prototype.getAspectRatio=function(t){return t.isCg()?1:this.aspectRatio},e.prototype.createData=function(t){var e=this,i=[],r=[];return this.structure.eachPolymer((function(t){if(!(t.residueCount<4)){r.push(t);var n=e.getSpline(t),o=n.getSubdividedPosition(),a=n.getSubdividedOrientation(),s=n.getSubdividedColor(e.getColorParams()),c=n.getSubdividedPicking(),u=n.getSubdividedSize(e.radius,e.getScale(t));i.push(new qm(Object.assign({},o,a,s,c,u),e.getBufferParams({radialSegments:e.radialSegments,aspectRatio:e.getAspectRatio(t),capped:e.capped,dullInterior:!0})))}}),t.getSelection()),{bufferList:i,polymerList:r}},e.prototype.updateData=function(t,e){gc&&mc.time(this.type+" repr update"),t=t||{};for(var i=0,r=e.polymerList.length;i<r;++i){var n={},o=e.polymerList[i],a=this.getSpline(o);if(e.bufferList[i].aspectRatio=this.getAspectRatio(o),t.position||t.radius){var s=a.getSubdividedPosition(),c=a.getSubdividedOrientation(),u=a.getSubdividedSize(this.radius,this.getScale(o));n.position=s.position,n.normal=c.normal,n.binormal=c.binormal,n.tangent=c.tangent,n.size=u.size}if(t.color){var h=a.getSubdividedColor(this.getColorParams());n.color=h.color}if(t.picking){var l=a.getSubdividedPicking();n.picking=l.picking}e.bufferList[i].setAttributes(n)}gc&&mc.timeEnd(this.type+" repr update")},e.prototype.setParameters=function(e){var i={};return e&&e.aspectRatio&&(i.radius=!0),e&&e.tension&&(i.position=!0),t.prototype.setParameters.call(this,e,i,!1),this},e}(Cf);xc.add("cartoon",Ym);var Zm=function(t,e){this.sview1=t,this.sview2=e,this.kdtree2=new Tp(e)};function Km(t,e,i){e=e||3.5,i=i||40;for(var r=new nc("( 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 )"),n=new nc("( 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(r),a=t.getView(n),s=new Zm(o,a).within(e),c=s.bondStore,u=t.getAtomProxy(),h=t.getAtomProxy(),l=t.getAtomProxy(),p=t.getAtomProxy(),d=t.getResidueProxy(),f=t.getResidueProxy(),m=new O,g=new O,v=function(t,e,r,n){var o,a;t.atomname===r?(o=t,a=e):(o=e,a=t),d.index=o.residueIndex;var s=d.getAtomIndexByName(n);return m.subVectors(s,o),g.subVectors(s,a),Jo(m.angleTo(g))<i},y=0,b=c.count;y<b;++y)if(u.index=c.atomIndex1[y],h.index=c.atomIndex2[y],"O"===u.atomname&&"N"===h.atomname||"N"===u.atomname&&"O"===h.atomname)s.bondSet.clear(y);else if("N"===u.atomname||"N"===h.atomname){var x,_;if("N"===u.atomname?(x=u,_=h):(x=h,_=u),d.index=x.residueIndex,l.index=d.getAtomIndexByName("CA"),void 0===l.index)continue;var w=d.getPreviousConnectedResidue(f);if(void 0===w)continue;if(p.index=w.getAtomIndexByName("C"),void 0===p.index)continue;m.subVectors(x,p),g.subVectors(x,l),m.add(g).multiplyScalar(.5),g.subVectors(_,x),Jo(m.angleTo(g))>i&&s.bondSet.clear(y)}else("OH"===u.atomname&&"TYR"===u.resname||"OH"===h.atomname&&"TYR"===h.resname)&&(v(u,h,"OH","CZ")||s.bondSet.clear(y));return{atomSet:s.atomSet,bondSet:s.bondSet,bondStore:s.bondStore}}function Qm(t,e,i){e=e||3.5,i=i||40;for(var r=new nc("( PROTEIN and .N )"),n=new nc("( PROTEIN and .O )"),o=t.getView(r),a=t.getView(n),s=new Zm(o,a).within(e),c=s.bondStore,u=t.getAtomProxy(),h=t.getAtomProxy(),l=t.getAtomProxy(),p=t.getAtomProxy(),d=t.getResidueProxy(),f=t.getResidueProxy(),m=new O,g=new O,v=0,y=c.count;v<y;++v){var b,x;if(u.index=c.atomIndex1[v],h.index=c.atomIndex2[v],"N"===u.atomname?(b=u,x=h):(b=h,x=u),d.index=b.residueIndex,l.index=d.getAtomIndexByName("CA"),void 0!==l.index){var _=d.getPreviousConnectedResidue(f);void 0!==_&&(p.index=_.getAtomIndexByName("C"),void 0!==p.index&&(m.subVectors(b,p),g.subVectors(b,l),m.add(g).multiplyScalar(.5),g.subVectors(x,b),Jo(m.angleTo(g))>i&&s.bondSet.clear(v)))}}return{atomSet:s.atomSet,bondSet:s.bondSet,bondStore:s.bondStore}}Zm.prototype.within=function(t,e){mc.time("Contact within");var i=this.kdtree2,r=this.sview1.getAtomProxy(),n=this.sview1.getAtomSet(!1),o=new yp;this.sview1.eachAtom((function(a){for(var s=!1,c=i.nearest(a,1/0,t),u=0,h=c.length;u<h;++u){var l=c[u];r.index=l.index,a.residueIndex!==r.residueIndex&&(!e||l.distance>e)&&(s=!0,n.set(r.index),o.addBond(a,r,1))}s&&n.set(a.index)}));var a=new al(o.count,!0);return mc.timeEnd("Contact within"),{atomSet:n,bondSet:a,bondStore:o}};var Jm=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="contact",this.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},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.radius=Eo(i.radius,.25),this.contactType=Eo(i.contactType,"polarBackbone"),this.maxDistance=Eo(i.maxDistance,3.5),this.maxAngle=Eo(i.maxAngle,40),t.prototype.init.call(this,i)},e.prototype.getContactData=function(t){return{polar:Km,polarBackbone:Qm}[this.contactType](t,this.maxDistance,this.maxAngle)},e.prototype.getBondData=function(t,e,i){var r=t.getBondData(this.getBondParams(e,i));return r.picking&&(r.picking=new Xh(r.picking.array,r.picking.structure,i.bondStore)),r},e.prototype.createData=function(t){var e=this.getContactData(t);return{bufferList:[new qd(this.getBondData(t,void 0,{bondSet:e.bondSet,bondStore:e.bondStore}),this.getBufferParams({openEnded:!1,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}))],bondSet:e.bondSet,bondStore:e.bondStore}},e.prototype.updateData=function(t,e){if(!t||t.position){var i=this.getContactData(e.sview);e.bondSet=i.bondSet,e.bondStore=i.bondStore}var r={bondSet:e.bondSet,bondStore:e.bondStore},n=this.getBondData(e.sview,t,r),o={};t&&!t.position||(o.position=nu(n.position1,n.position2),o.position1=n.position1,o.position2=n.position2),t&&!t.color||(o.color=n.color,o.color2=n.color2),t&&!t.radius||(o.radius=n.radius),e.bufferList[0].setAttributes(o)},e}(Cf);xc.add("contact",Jm);var tg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="distance",this.parameters=Object.assign({labelSize:{type:"number",precision:3,max:10,min:.001},labelColor:{type:"color"},labelVisible:{type:"boolean"},labelZOffset:{type:"number",precision:1,max:20,min:-20,buffer:"zOffset"},labelUnit:{type:"select",rebuild:!0,options:{"":"",angstrom:"angstrom",nm:"nm"}},atomPair:{type:"hidden",rebuild:!0},radialSegments:!0,disableImpostor:!0},this.parameters,{flatShaded:null,assembly:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.radius=Eo(i.radius,.15),this.fontFamily=Eo(i.fontFamily,"sans-serif"),this.fontStyle=Eo(i.fontStyle,"normal"),this.fontWeight=Eo(i.fontWeight,"bold"),this.sdf=Eo(i.sdf,"Firefox"!==hc),this.labelSize=Eo(i.labelSize,2),this.labelColor=Eo(i.labelColor,16777215),this.labelVisible=Eo(i.labelVisible,!0),this.labelZOffset=Eo(i.labelZOffset,.5),this.labelUnit=Eo(i.labelUnit,""),this.atomPair=Eo(i.atomPair,[]),t.prototype.init.call(this,i)},e.prototype.getDistanceData=function(t,e){var i=e.length,r=new Array(i),n=new Float32Array(3*i),o=new nc,a=new nc,s=new yp,c=t.getAtomProxy(),u=t.getAtomProxy(),h=0;e.forEach((function(e,i){var l=e[0],p=e[1];if(Number.isInteger(l)&&Number.isInteger(p))c.index=l,u.index=p;else{o.setString(l),a.setString(p);var d=t.getAtomIndices(o),f=t.getAtomIndices(a);if(!d.length||!f.length)return void(h+=1);c.index=d[0],u.index=f[0]}s.addBond(c,u,1),i-=h;var m=c.distanceTo(u);switch(this.labelUnit){case"angstrom":r[i]=m.toFixed(2)+" "+String.fromCharCode(8491);break;case"nm":r[i]=(m/10).toFixed(2)+" nm";break;default:r[i]=m.toFixed(2)}var g=3*i;n[g+0]=(c.x+u.x)/2,n[g+1]=(c.y+u.y)/2,n[g+2]=(c.z+u.z)/2}),this),h>0&&(i-=h,n=n.subarray(0,3*i));var l=new al(s.count,!0);return{text:r,position:n,bondSet:l,bondStore:s}},e.prototype.getBondData=function(t,e,i){var r=t.getBondData(this.getBondParams(e,i));return r.picking&&(r.picking=new Zh(r.picking.array,r.picking.structure,i.bondStore)),r},e.prototype.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 St(this.labelColor);this.textBuffer=new sf({position:e.position,size:ou(t,this.labelSize),color:au(t,i.r,i.g,i.b),text: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 r={bondSet:e.bondSet,bondStore:e.bondStore},n=this.getBondData(this.structureView,void 0,r);this.cylinderBuffer=new qd(n,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]})}}},e.prototype.update=function(e){e.position?this.build():t.prototype.update.call(this,e)},e.prototype.updateData=function(t,e){var i={bondSet:e.bondSet,bondStore:e.bondStore},r=this.getBondData(e.sview,t,i),n={},o={},a=this.atomPair.length;if(t.labelSize&&(o.size=ou(a,this.labelSize)),t.labelColor){var s=new St(this.labelColor);o.color=au(a,s.r,s.g,s.b)}t.color&&(n.color=r.color,n.color2=r.color2),(t.radius||t.scale)&&(n.radius=r.radius),this.textBuffer.setAttributes(o),this.cylinderBuffer.setAttributes(n)},e.prototype.setVisibility=function(e,i){return t.prototype.setVisibility.call(this,e,!0),this.textBuffer&&this.textBuffer.setVisibility(this.labelVisible&&this.visible),i||this.viewer.requestRender(),this},e.prototype.setParameters=function(e){var i={};return e&&e.labelSize&&(i.labelSize=!0),e&&(e.labelColor||0===e.labelColor)&&(i.labelColor=!0),t.prototype.setParameters.call(this,e,i,!1),e&&void 0!==e.labelVisible&&this.setVisibility(this.visible),this},e}(Cf);xc.add("distance",tg);var eg=function(t){function e(e,i){var r=i||{},n=2*(e.position.length/3),o=new St(Eo(r.color,"grey")),a=new Float32Array(3*n),s=au(n,o.r,o.g,o.b);t.call(this,{position:a,color:s},r),this.scale=Eo(r.scale,1),this.setAttributes(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isLine:{},vertexShader:{},fragmentShader:{}};return e.prototype.setAttributes=function(t){var e,i,r,n=this.geometry.attributes;t.position&&t.vector&&(e=t.position,i=t.vector,r=n.position.array,n.position.needsUpdate=!0);var o,a,s=this.size/2,c=this.scale;if(t.position&&t.vector)for(var u=0;u<s;u++)a=3*u,r[(o=2*u*3)+0]=e[a+0],r[o+1]=e[a+1],r[o+2]=e[a+2],r[o+3]=e[a+0]+i[a+0]*c,r[o+4]=e[a+1]+i[a+1]*c,r[o+5]=e[a+2]+i[a+2]*c},i.isLine.get=function(){return!0},i.vertexShader.get=function(){return"Line.vert"},i.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,i),e}(xd),ig=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="helixorient",this.parameters=Object.assign({sphereDetail:!0,disableImpostor:!0},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"sstruc"),i.radius=Eo(i.radius,.15),i.scale=Eo(i.scale,1),t.prototype.init.call(this,i)},e.prototype.createData=function(t){var e=this,i=[],r=[];return this.structure.eachPolymer((function(t){if(!(t.residueCount<4)){r.push(t);var n=new Sp(t),o=n.getPosition(),a=n.getColor(e.getColorParams()),s=n.getSize(e.radius,e.scale),c=n.getPicking();i.push(new Od({position:o.center,color:a.color,radius:s.size,picking:c.picking},e.getBufferParams({sphereDetail:e.sphereDetail,disableImpostor:e.disableImpostor,dullInterior:!0})),new eg({position:o.center,vector:o.axis},e.getBufferParams({color:"skyblue",scale:1})),new eg({position:o.center,vector:o.resdir},e.getBufferParams({color:"lightgreen",scale:1})))}}),t.getSelection()),{bufferList:i,polymerList:r}},e.prototype.updateData=function(t,e){gc&&mc.time(this.type+" repr update"),t=t||{};for(var i=0,r=e.polymerList.length;i<r;++i){var n=3*i,o={},a=new Sp(e.polymerList[i]);if(t.position){var s=a.getPosition();o.position=s.center,e.bufferList[n+1].setAttributes({position:s.center,vector:s.axis}),e.bufferList[n+2].setAttributes({position:s.center,vector:s.resdir})}e.bufferList[n].setAttributes(o)}gc&&mc.timeEnd(this.type+" repr update")},e}(Cf);xc.add("helixorient",ig);var rg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="licorice",this.parameters=Object.assign({},this.parameters,{aspectRatio:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.aspectRatio=1,t.prototype.init.call(this,i)},e}(jm);xc.add("licorice",rg),wc.add("shader/HyperballStickImpostor.vert","\nattribute vec3 mapping;\nattribute float radius;\nattribute float radius2;\nattribute vec3 position1;\nattribute vec3 position2;\nvarying mat4 matrix_near;\nvarying vec4 prime1;\nvarying vec4 prime2;\nvarying float vRadius;\nvarying float vRadius2;\n#ifdef PICKING\n#include unpack_color\nattribute float primitiveId;\nvarying vec3 vPickingColor;\n#else\nattribute vec3 color2;\nvarying vec3 vColor1;\nvarying vec3 vColor2;\n#endif\nuniform float shrink;\nuniform mat4 modelViewProjectionMatrix;\nuniform mat4 modelViewProjectionMatrixInverse;\nvoid main(){\nvRadius = radius;\nvRadius2 = radius2;\nvec4 spaceposition;\nvec3 position_atom1;\nvec3 position_atom2;\nvec4 vertex_position;\n#ifdef PICKING\nvPickingColor = unpackColor( primitiveId );\n#else\nvColor1 = color;\nvColor2 = color2;\n#endif\nfloat radius1 = radius;\nposition_atom1 = position1;\nposition_atom2 = position2;\nfloat distance = distance( position_atom1, position_atom2 );\nspaceposition.z = mapping.z * distance;\nif (radius1 > 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}"),wc.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;\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\ngl_FragColor = vec4( vPickingColor, objectId );\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}");var ng=new Float32Array([-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,-1,1,-1,1,1,-1,1,1,1,-1,1,1]),og=new Uint16Array([0,1,2,0,2,3,1,5,6,1,6,2,4,6,5,4,7,6,0,7,4,0,3,7,0,5,1,0,4,5,3,2,6,3,6,7]),ag=function(t){function e(e,i){t.call(this,e,i);var r=e||{},n=Eo((i||{}).shrink,.14);this.addUniforms({modelViewProjectionMatrix:{value:new N},modelViewProjectionMatrixInverse:{value:new N},modelViewMatrixInverseTranspose:{value:new N},shrink:{value:n}}),this.addAttributes({position1:{type:"v3",value:null},position2:{type:"v3",value:null},color2:{type:"c",value:null},radius:{type:"f",value:null},radius2:{type:"f",value:null}}),this.setAttributes(r),this.makeMapping()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={parameters:{},isImpostor:{},vertexShader:{},fragmentShader:{}};return i.parameters.get=function(){return Object.assign.call(this,{shrink:{uniform:!0}},t.prototype.parameters)},i.isImpostor.get=function(){return!0},i.vertexShader.get=function(){return"HyperballStickImpostor.vert"},i.fragmentShader.get=function(){return"HyperballStickImpostor.frag"},Object.defineProperties(e.prototype,i),e}(function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={mapping:{},mappingIndices:{},mappingIndicesSize:{},mappingType:{},mappingSize:{},mappingItemSize:{}};return i.mapping.get=function(){return ng},i.mappingIndices.get=function(){return og},i.mappingIndicesSize.get=function(){return 36},i.mappingType.get=function(){return"v3"},i.mappingSize.get=function(){return 8},i.mappingItemSize.get=function(){return 3},Object.defineProperties(e.prototype,i),e}(Ed)),sg=function(t,e){return!dc||e&&e.disableImpostor?(t.radius=function(t,e){for(var i=t.length,r=new Float32Array(i),n=0;n<i;n++)r[n]=Math.min(t[n],e[n]);return r}(t.radius1,t.radius2),new $d(t,e)):new ag(t,e)},cg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="hyperball",this.parameters=Object.assign({shrink:{type:"number",precision:3,max:1,min:.001,buffer:!0}},this.parameters,{multipleBond:null,bondSpacing:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.scale=Eo(i.scale,.2),i.radius=Eo(i.radius,"vdw"),this.shrink=Eo(i.shrink,.12),t.prototype.init.call(this,i)},e.prototype.getBondParams=function(e,i){return e&&!e.radius||(i=Object.assign({radius2:!0},i)),t.prototype.getBondParams.call(this,e,i)},e.prototype.createData=function(t){var e=new Od(t.getAtomData(this.getAtomParams()),this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0}));return this.__center=new Float32Array(3*t.bondCount),{bufferList:[e,new sg(t.getBondData(this.getBondParams()),this.getBufferParams({shrink:this.shrink,radialSegments:this.radialSegments,dullInterior:!0}))]}},e.prototype.updateData=function(t,e){var i=e.sview.getAtomData(this.getAtomParams()),r=e.sview.getBondData(this.getBondParams()),n={},o={};if(!t||t.position){n.position=i.position;var a=r.position1,s=r.position2;o.position=nu(a,s,this.__center),o.position1=a,o.position2=s}t&&!t.color||(n.color=i.color,o.color=r.color,o.color2=r.color2),t&&!t.radius||(n.radius=i.radius,o.radius=r.radius,o.radius2=r.radius2),e.bufferList[0].setAttributes(n),e.bufferList[1].setAttributes(o)},e}(rg);function ug(t,e){this.type=t,this.text=e||{}}xc.add("hyperball",cg),ug.prototype={constructor:ug,atomLabel:function(t){var e;switch(this.type){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 i=t.resname.toUpperCase();e=(bl[i]||i)+t.resno;break;case"text":e=this.text[t.index];break;default:e=t.qualifiedName()}return void 0===e?"":e}},ug.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"};var hg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="label",this.parameters=Object.assign({labelType:{type:"select",options:ug.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}},this.parameters,{side:null,flatShaded:null,wireframe:null,linewidth:null,roughness:null,metalness:null,diffuse:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};this.labelType=Eo(i.labelType,"res"),this.labelText=Eo(i.labelText,{}),this.fontFamily=Eo(i.fontFamily,"sans-serif"),this.fontStyle=Eo(i.fontStyle,"normal"),this.fontWeight=Eo(i.fontWeight,"bold"),this.sdf=Eo(i.sdf,"Chrome"===hc),this.xOffset=Eo(i.xOffset,0),this.yOffset=Eo(i.yOffset,0),this.zOffset=Eo(i.zOffset,.5),this.attachment=Eo(i.attachment,"bottom-left"),this.showBorder=Eo(i.showBorder,!1),this.borderColor=Eo(i.borderColor,"lightgrey"),this.borderWidth=Eo(i.borderWidth,.15),this.showBackground=Eo(i.showBackground,!1),this.backgroundColor=Eo(i.backgroundColor,"lightgrey"),this.backgroundMargin=Eo(i.backgroundMargin,.5),this.backgroundOpacity=Eo(i.backgroundOpacity,1),t.prototype.init.call(this,i)},e.prototype.createData=function(t){var e=t.getAtomData(this.getAtomParams({position:!0,color:!0,radius:!0})),i=[],r=new ug(this.labelType,this.labelText);return t.eachAtom((function(t){i.push(r.atomLabel(t))})),{bufferList:[new sf({position:e.position,size:e.radius,color:e.color,text:i},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}))]}},e.prototype.updateData=function(t,e){var i=e.sview.getAtomData(this.getAtomParams(t)),r={};t&&!t.position||(r.position=i.position),t&&!t.radius||(r.size=i.radius),t&&!t.color||(r.color=i.color),e.bufferList[0].setAttributes(r)},e}(Cf);xc.add("label",hg);var lg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="line",this.parameters=Object.assign({multipleBond:{type:"select",rebuild:!0,options:{off:"off",symmetric:"symmetric",offset:"offset"}},bondSpacing:{type:"number",precision:2,max:2,min:.5}},this.parameters,{flatShaded:null,side:null,wireframe:null,roughness:null,metalness:null,diffuse:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};this.multipleBond=Eo(i.multipleBond,"off"),this.bondSpacing=Eo(i.bondSpacing,1),t.prototype.init.call(this,i)},e.prototype.getBondParams=function(e,i){return i=Object.assign({multipleBond:this.multipleBond,bondSpacing:this.bondSpacing,radiusParams:{radius:.1,scale:1}},i),t.prototype.getBondParams.call(this,e,i)},e.prototype.createData=function(t){var e=t.getBondData(this.getBondParams({position:!0,color:!0}));return{bufferList:[new If(e,this.getBufferParams())]}},e.prototype.updateData=function(t,e){var i=e.sview.getBondData(this.getBondParams(t)),r={};t&&!t.position||(r.position1=i.position1,r.position2=i.position2),t&&!t.color||(r.color=i.color,r.color2=i.color2),e.bufferList[0].setAttributes(r)},e.prototype.setParameters=function(e){var i={};return e&&e.bondSpacing&&(i.position=!0),t.prototype.setParameters.call(this,e,i,!1),this},e}(Cf);function pg(t,e,i,r,n){var o,a=new(r=r||Int32Array)(t*e*i*(n=n||1));function s(t,r,o){return((t*e+r)*i+o)*n}this.data=a,this.index=s,this.set=function(t,e,i){var r=arguments,c=s(t,e,i);for(o=0;o<n;++o)a[c+o]=r[3+o]},this.toArray=function(t,e,i,r,c){var u=s(t,e,i);for(void 0===r&&(r=[]),void 0===c&&(c=0),o=0;o<n;++o)r[c+o]=a[u+o]},this.fromArray=function(t,e,i,r,c){var u=s(t,e,i);for(void 0===c&&(c=0),o=0;o<n;++o)a[u+o]=r[c+o]},this.copy=function(t){this.data.set(t.data)},this.clone=function(){return new pg(t,e,i,r,n).copy(this)}}function dg(t,e,i){var r=ap(e),n=Sh(t);0===t.length&&(n[0].set([0,0,0]),n[1].set([0,0,0]));var o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x=n[0],_=n[1];function w(t,e,i,n,w){o=e||1.4,a=i||2,g=w||!0;var S=0;for(var M in r)S=Math.max(S,M);var P=sp(x,_,S,a,t?o:0);c=P.dim[0],u=P.dim[1],h=P.dim[2],l=P.matrix,p=P.tran,a=P.scaleFactor,d={},f={},A(t),m=o*a,s=n||o/a,v=new Uint8Array(c*u*h),t&&(y=new Float64Array(c*u*h)),g&&(b=new Int32Array(c*u*h))}var S=[new Int32Array([1,0,0]),new Int32Array([-1,0,0]),new Int32Array([0,1,0]),new Int32Array([0,-1,0]),new Int32Array([0,0,1]),new Int32Array([0,0,-1]),new Int32Array([1,1,0]),new Int32Array([1,-1,0]),new Int32Array([-1,1,0]),new Int32Array([-1,-1,0]),new Int32Array([1,0,1]),new Int32Array([1,0,-1]),new Int32Array([-1,0,1]),new Int32Array([-1,0,-1]),new Int32Array([0,1,1]),new Int32Array([0,1,-1]),new Int32Array([0,-1,1]),new Int32Array([0,-1,-1]),new Int32Array([1,1,1]),new Int32Array([1,1,-1]),new Int32Array([1,-1,1]),new Int32Array([-1,1,1]),new Int32Array([1,-1,-1]),new Int32Array([-1,-1,1]),new Int32Array([-1,1,-1]),new Int32Array([-1,-1,-1])];function A(t){var e,i,n,s,c,u,h,l,p,m;for(var g in r)if(e=r[g],!d[g]){for(u=(h=t?(e+o)*a+.5:e*a+.5)*h,l=Math.floor(h)+1,p=new Int32Array(l*l),m=0,i=0;i<l;++i)for(n=0;n<l;++n)(s=i*i+n*n)>u?p[m]=-1:(c=Math.sqrt(u-s),p[m]=Math.floor(c)),++m;f[g]=l,d[g]=p}}function M(i){var r,n,o,s,l,m,y,x,_,w,S,A,M,P,T,E,C,I,R=3*i,L=i;r=Math.floor(.5+a*(t[R]+p[0])),n=Math.floor(.5+a*(t[R+1]+p[1])),o=Math.floor(.5+a*(t[R+2]+p[2]));var O,N=e[L],D=d[N],k=0,F=u*h,B=f[N];for(w=0;w<B;++w)for(S=0;S<B;++S){if(-1!==(O=D[k]))for(E=-1;E<2;++E)for(C=-1;C<2;++C)for(I=-1;I<2;++I)if(0!==E&&0!==C&&0!==I)for(y=E*w,_=I*S,A=0;A<=O;++A)if(P=n+(x=A*C),T=o+_,!((M=r+y)<0||P<0||T<0||M>=c||P>=u||T>=h)){var z=M*F+P*h+T;if(g)if(1&v[z]){if(1&v[z]){var U=b[z];U!==R&&y*y+x*x+_*_<(s=r+y-Math.floor(.5+a*(t[U]+p[0])))*s+(l=n+x-Math.floor(.5+a*(t[U+1]+p[1])))*l+(m=o+_-Math.floor(.5+a*(t[U+2]+p[2])))*m&&(b[z]=i)}}else v[z]|=1,b[z]=i;else v[z]|=1}k++}}function P(e){var i,r;for(console.time("EDTSurface fillvoxels"),i=0,r=v.length;i<r;++i)v[i]=0,e&&(y[i]=-1),g&&(b[i]=-1);for(i=0,r=t.length/3;i<r;++i)M(i);for(i=0,r=v.length;i<r;++i)1&v[i]&&(v[i]|=2);console.timeEnd("EDTSurface fillvoxels")}function T(i){var r,n,o,s,l,m,y,x,_,w,S,A,M,P,T,E,C,I,R,L=3*i,O=i,N=0;r=Math.floor(.5+a*(t[L]+p[0])),n=Math.floor(.5+a*(t[L+1]+p[1])),o=Math.floor(.5+a*(t[L+2]+p[2]));var D=e[O],k=u*h;for(M=0,R=f[D];M<R;++M)for(P=0;P<R;++P){if(-1!==d[D][N])for(E=-1;E<2;++E)for(C=-1;C<2;++C)for(I=-1;I<2;++I)if(0!==E&&0!==C&&0!==I)for(y=E*M,_=I*P,T=0;T<=d[D][N];++T)if(S=n+(x=T*C),A=o+_,!((w=r+y)<0||S<0||A<0||w>=c||S>=u||A>=h)){var F=w*k+S*h+A;if(2&v[F]){if(g){var B=b[F];y*y+x*x+_*_<(s=Math.floor(.5+a*(t[B]+p[0])))*s+(l=Math.floor(.5+a*(t[B+1]+p[1])))*l+(m=Math.floor(.5+a*(t[B+2]+p[2])))*m&&(b[F]=i)}}else v[F]|=2,g&&(b[F]=i)}N++}}function E(){var t,e,i,r;console.time("EDTSurface fastdistancemap");var n,o=new pg(c,u,h,Uint16Array,3),a=u*h,l=m*m,p=0;for(t=0;t<c;++t)for(e=0;e<u;++e)for(i=0;i<h;++i)v[n=t*a+e*h+i]&=-3,1&v[n]&&4&v[n]&&(o.set(t,e,i,t,e,i),y[n]=0,v[n]|=2,p+=1);var d=new Int32Array(3*p),f=0,x=new Int32Array(3*p),_=0;for(t=0;t<c;++t)for(e=0;e<u;++e)for(i=0;i<h;++i)4&v[n=t*a+e*h+i]&&(d[f]=t,d[f+1]=e,d[f+2]=i,f+=3,v[n]&=-5);do{for(_=C(d,o,f,x),f=0,t=0,r=_;t<r;t+=3)n=a*x[t]+h*x[t+1]+x[t+2],v[n]&=-5,y[n]<=1.0404*l&&(d[f]=x[t],d[f+1]=x[t+1],d[f+2]=x[t+2],f+=3)}while(f>0);var w,S=s*s,A=new Uint16Array(3);for(t=0;t<c;++t)for(e=0;e<u;++e)for(i=0;i<h;++i)v[n=t*a+e*h+i]&=-5,1&v[n]&&(2&v[n]&&!(2&v[n]&&y[n]>=S)||(v[n]|=4,g&&2&v[n]&&(o.toArray(t,e,i,A),w=A[0]*a+A[1]*h+A[2],b[n]=b[w])));console.timeEnd("EDTSurface fastdistancemap")}function C(t,e,i,r){var n,o,a,s,l,p,d,f,m,g,b,x,_=new Uint16Array(3),w=0;if(0===i)return w;var A=-1,M=-1,P=-1,T=u*h;for(d=0,m=i;d<m;d+=3)for(n=t[d],o=t[d+1],a=t[d+2],e.toArray(n,o,a,_),f=0;f<6;++f)A=n+(x=S[f])[0],M=o+x[1],P=a+x[2],A<c&&A>-1&&M<u&&M>-1&&P<h&&P>-1&&(1&v[b=A*T+h*M+P]&&!(2&v[b])?(e.fromArray(A,M,P,_),g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p,y[b]=g,v[b]|=2,v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3):1&v[b]&&2&v[b]&&(g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p)<y[b]&&(e.fromArray(A,M,P,_),y[b]=g,4&v[b]||(v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3)));for(d=0,m=i;d<m;d+=3)for(n=t[d],o=t[d+1],a=t[d+2],e.toArray(n,o,a,_),f=6;f<18;f++)A=n+(x=S[f])[0],M=o+x[1],P=a+x[2],A<c&&A>-1&&M<u&&M>-1&&P<h&&P>-1&&(1&v[b=A*T+h*M+P]&&!(2&v[b])?(e.fromArray(A,M,P,_),g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p,y[b]=g,v[b]|=2,v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3):1&v[b]&&2&v[b]&&(g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p)<y[b]&&(e.fromArray(A,M,P,_),y[b]=g,4&v[b]||(v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3)));for(d=0,m=i;d<m;d+=3)for(n=t[d],o=t[d+1],a=t[d+2],e.toArray(n,o,a,_),f=18;f<26;f++)A=n+(x=S[f])[0],M=o+x[1],P=a+x[2],A<c&&A>-1&&M<u&&M>-1&&P<h&&P>-1&&(1&v[b=A*T+h*M+P]&&!(2&v[b])?(e.fromArray(A,M,P,_),g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p,y[b]=g,v[b]|=2,v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3):1&v[b]&&2&v[b]&&(g=(s=A-_[0])*s+(l=M-_[1])*l+(p=P-_[2])*p)<y[b]&&(e.fromArray(A,M,P,_),y[b]=g,4&v[b]||(v[b]|=4,r[w]=A,r[w+1]=M,r[w+2]=P,w+=3)));return w}this.getVolume=function(e,r,n,o,a){console.time("EDTSurface.getVolume");var s="vws"!==e;w(s,r,n,o,a),P(s),function(){var t,e,i,r=u*h;for(t=0;t<c;++t)for(e=0;e<h;++e)for(i=0;i<u;++i){var n=t*r+i*h+e;if(1&v[n])for(var o=0;o<26;){var a=t+S[o][0],s=e+S[o][2],l=i+S[o][1];if(a>-1&&a<c&&l>-1&&l<u&&s>-1&&s<h&&!(1&v[a*r+l*h+s])){v[n]|=4;break}o++}}}(),"ms"!==e&&"ses"!==e||E(),"ses"===e&&(A(!1),function(){var e,i;for(e=0,i=v.length;e<i;++e)v[e]&=-3;for(e=0,i=t.length/3;e<i;++e)T(e)}()),function(t){var e,i=v.length;if("vws"===t)for(e=0;e<i;++e)v[e]&=-5,v[e]=2&v[e]?1:0;else if("ms"===t)for(e=0;e<i;++e)v[e]&=-3,4&v[e]&&(v[e]|=2),v[e]&=-5,v[e]=2&v[e]?1:0;else if("ses"===t)for(e=0;e<i;++e)4&v[e]&&2&v[e]?v[e]&=-5:4&v[e]&&!(2&v[e])&&(v[e]|=2),v[e]=2&v[e]?1:0;else if("sas"===t)for(e=0;e<i;++e)v[e]&=-5,v[e]=2&v[e]?1:0}(e);for(var l=0,p=b.length;l<p;++l)b[l]=i[b[l]];return console.timeEnd("EDTSurface.getVolume"),{data:v,nx:h,ny:u,nz:c,atomindex:b}},this.getSurface=function(t,e,i,r,n,o,a){var s=this.getVolume(t,e,i,r,n);return new hp(s.data,s.nx,s.ny,s.nz,s.atomindex).getSurface(1,o,void 0,l,a)}}function fg(t,e,i,r,n,o,a){var s=t.length,c=n[0],u=n[1],h=n[2],l=o[0],p=o[1],d=o[2];function f(t,e){return Math.floor((t-e)/a)}for(var m=f(l,c)+1,g=f(p,u)+1,v=f(d,h)+1,y=m*g*v,b=g*v,x=function(t,e,i){return(f(t,c)*g+f(e,u))*v+f(i,h)},_=[],w=0;w<s;w++){var S=x(t[w],e[w],i[w]);void 0===_[S]?_[S]=[w]:_[S].push(w)}var A=new Uint32Array(y),M=new Uint16Array(y),P=new Uint32Array(s),T=0,E=0;for(w=0;w<y;w++){var C=A[w]=T,I=_[w];if(void 0!==I)for(var R=0;R<I.length;R++)P[T]=I[R],T++;var L=T-C;M[w]=L,L>E&&(E=L)}this.neighbourListLength=27*E+1,this.withinRadii=function(n,o,a,s,l){for(var p=0,d=f(n,c),y=f(o,u),x=f(a,h),_=Math.max(0,d-1),w=Math.max(0,y-1),S=Math.max(0,x-1),T=Math.min(m,d+1),E=Math.min(g,y+1),C=Math.min(v,x+1),I=_;I<=T;++I)for(var R=I*b,L=w;L<=E;++L)for(var O=L*v,N=S;N<=C;++N)for(var D=R+O+N,k=A[D],F=k+M[D],B=k;B<F;B++){var z=P[B],U=t[z]-n,j=e[z]-o,G=i[z]-a,V=r[z]+s;U*U+j*j+G*G<=V*V&&(l[p++]=P[B])}l[p]=-1}}function mg(t,e,i){for(var r=e.length,n=new Float32Array(r),o=new Float32Array(r),a=new Float32Array(r),s=0;s<r;s++){var c=3*s;n[s]=t[c],o[s]=t[c+1],a[s]=t[c+2]}var u=Sh(t);0===t.length&&(u[0].set([0,0,0]),u[1].set([0,0,0]));var h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,P,T,E,C=u[0],I=u[1],R=-1,L=new Float32Array([0,0,0]),O=new Float32Array([0,0,0]),N=new Float32Array([0,0,0]);function D(t,i,s,c){d=Eo(t,1.4),f=Eo(i,2),m=Eo(s,!0),g=Eo(c,30),h=new Float32Array(r),l=new Float32Array(r);for(var u=0;u<h.length;++u){var L=e[u]+d;h[u]=L,l[u]=L*L}p=0;for(var O=0;O<h.length;++O)h[O]>p&&(p=h[O]);var N;N=sp(C,I,p,f,0),f=N.scaleFactor,v=N.dim,y=N.matrix,E=Math.min(5,2+Math.floor(d*f)),b=ou(v[0]*v[1]*v[2],-1001),x=new Int32Array(b.length),_=new Float32Array(v[0]),w=new Float32Array(v[1]),S=new Float32Array(v[2]),k(_,C[0],1/f),k(w,C[1],1/f),k(S,C[2],1/f),function(){var t=0,e=2*Math.PI/g;M=new Float32Array(g),A=new Float32Array(g);for(var i=0;i<g;i++)M[i]=Math.cos(t),A[i]=Math.sin(t),t+=e}(),P=new fg(n,o,a,h,C,I,2.01*p),T=new Int32Array(P.neighbourListLength),R=-1}function k(t,e,i){for(var r=0;r<t.length;r++)t[r]=e+i*r}function F(t,e,i,r,n){var o;if(-1!==R){if((o=R)!==r&&o!==n&&B(o,t,e,i))return o;R=-1}var a=0;for(o=T[a];o>=0;){if(o!==r&&o!==n&&B(o,t,e,i))return R=o,o;o=T[++a]}return R=-1,-1}function B(e,i,r,n){var o=3*e,a=l[e],s=t[o]-i,c=t[o+1]-r,u=t[o+2]-n;return s*s+c*c+u*u<a}function z(){for(var t=0;t<r;t++){var e=n[t],i=o[t],s=a[t],c=h[t],u=l[t];P.withinRadii(e,i,s,c,T);for(var p=Math.ceil(c*f),d=Math.floor(f*(e-C[0])),g=Math.floor(f*(i-C[1])),y=Math.floor(f*(s-C[2])),A=Math.max(0,d-p),M=Math.max(0,g-p),E=Math.max(0,y-p),I=Math.min(v[0],d+p+2),R=Math.min(v[1],g+p+2),L=Math.min(v[2],y+p+2),O=A;O<I;O++)for(var N=_[O]-e,D=v[1]*v[2]*O,k=M;k<R;k++)for(var B=w[k]-i,z=N*N+B*B,U=D+v[2]*k,j=E;j<L;j++){var G=S[j]-s,V=z+G*G;if(V<u){var $=j+U;b[$]<0&&(b[$]=-b[$]);var H=Math.sqrt(V),W=c/H,X=N*W,q=B*W,Y=G*W;if(-1===F(X+=e,q+=i,Y+=s,t,-1)){var Z=c-H;Z<b[$]&&(b[$]=Z,m&&(x[$]=t))}}}}}function U(t,e){var i=h[t],r=h[e],s=L[0]=n[e]-n[t],c=L[1]=o[e]-o[t],u=L[2]=a[e]-a[t],l=s*s+c*c+u*u,p=Math.sqrt(l),d=i*((i*i+p*p-r*r)/(2*i*p));Nh(L,L),function(t,e){t[0]=t[1]=t[2]=1,0!==e[0]?t[0]=(e[1]+e[2])/-e[0]:0!==e[1]?t[1]=(e[0]+e[2])/-e[1]:0!==e[2]&&(t[2]=(e[0]+e[1])/-e[2])}(O,L),Nh(O,O),Eh(N,L,O),Nh(N,N);var y=Math.sqrt(i*i-d*d);Oh(O,O,y),Oh(N,N,y),Oh(L,L,d),L[0]+=n[t],L[1]+=o[t],L[2]+=a[t],R=-1;for(var P=E,T=0;T<g;T++){var I=M[T],D=A[T],k=L[0]+I*O[0]+D*N[0],B=L[1]+I*O[1]+D*N[1],z=L[2]+I*O[2]+D*N[2];if(-1===F(k,B,z,t,e))for(var U=Math.floor(f*(k-C[0])),j=Math.floor(f*(B-C[1])),G=Math.floor(f*(z-C[2])),V=Math.max(0,U-P),$=Math.max(0,j-P),H=Math.max(0,G-P),W=Math.min(v[0],U+P+2),X=Math.min(v[1],j+P+2),q=Math.min(v[2],G+P+2),Y=V;Y<W;Y++){s=k-_[Y];for(var Z=v[1]*v[2]*Y,K=$;K<X;K++)for(var Q=s*s+(c=B-w[K])*c,J=Z+v[2]*K,tt=H;tt<q;tt++){l=Q+(u=z-S[tt])*u;var et=tt+J,it=b[et];it>0&&l<it*it&&(b[et]=Math.sqrt(l),m&&(x[et]=t))}}}}function j(t,e,s){console.time("AVSurface.getVolume"),console.time("AVSurface.init"),D(t,e,s),console.timeEnd("AVSurface.init"),console.time("AVSurface.projectPoints"),z(),console.timeEnd("AVSurface.projectPoints"),console.time("AVSurface.projectTorii"),function(){for(var t=0;t<r;t++){P.withinRadii(n[t],o[t],a[t],h[t],T);for(var e=0,i=T[e];i>=0;)t<i&&U(t,i),i=T[++e]}}(),console.timeEnd("AVSurface.projectTorii"),function(){for(var t=0;t<b.length;t++)b[t]<0&&(b[t]=0)}(),function(){for(var t=0;t<x.length;t++)x[t]=i[x[t]]}(),console.timeEnd("AVSurface.getVolume")}this.getSurface=function(t,e,i,r,n,o,a){return j(e,i,n),new hp(b,v[2],v[1],v[0],x).getSurface(e,!1,void 0,y,a)}}xc.add("line",lg),dg.__deps=[sp,ap,hp,Sh,pg],mg.__deps=[sp,hp,ou,Sh,Oh,Eh,Nh,fg,Eo],vc.add("molsurf",(function(t,e){var i=t.data.args,r=t.data.params;if(i&&r){var n=new("av"===r.type?mg:dg)(i.coordList,i.radiusList,i.indexList).getSurface(r.type,r.probeRadius,r.scaleFactor,r.cutoff,!0,r.smooth,r.contour),o=[n.position.buffer,n.index.buffer];n.normal&&o.push(n.normal.buffer),n.atomindex&&o.push(n.atomindex.buffer),e({sd:n,p:r},o)}}),[dg,mg]);var gg=function(t){this.structure=t};gg.prototype._getAtomData=function(){return this.structure.getAtomData({what:{position:!0,radius:!0,index:!0},radiusParams:{radius:"vdw",scale:1}})},gg.prototype._makeSurface=function(t,e){var i=new cp(e.name,"",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},gg.prototype.getSurface=function(t){var e=t||{},i=this._getAtomData(),r=i.position,n=i.radius,o=i.index,a=new("av"===e.type?mg:dg)(r,n,o).getSurface(e.type,e.probeRadius,e.scaleFactor,e.cutoff,!0,e.smooth,e.contour);return this._makeSurface(a,e)},gg.prototype.getSurfaceWorker=function(t,e){var i=this,r=Object.assign({},t);if(window.Worker){void 0===this.worker&&(this.worker=new Ql("molsurf"));var n=this._getAtomData(),o=n.position,a=n.radius,s=n.index,c={args:{coordList:o,radiusList:a,indexList:s},params:r},u=[o.buffer,a.buffer,s.buffer];this.worker.post(c,u,(function(t){e(i._makeSurface(t.data.sd,r))}),(function(t){console.warn("MolecularSurface.getSurfaceWorker error - trying without worker",t),i.worker.terminate(),i.worker=void 0;var n=i.getSurface(r);e(n)}))}else{var h=this.getSurface(r);e(h)}},gg.prototype.dispose=function(){this.worker&&this.worker.terminate()};var vg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="surface",this.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},contour:{type:"boolean",rebuild:!0},background:{type:"boolean",rebuild:!0},opaqueBack:{type:"boolean",buffer:!0},filterSele:{type:"text",rebuild:!0},colorVolume:{type:"hidden"},useWorker:{type:"boolean",rebuild:!0}},this.parameters,{radiusType:null,radius:null,scale:null}),this.__infoList=[],this.structure.signals.refreshed.add((function(){this.__forceNewMolsurf=!0}),this),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"uniform"),i.colorValue=Eo(i.colorValue,14540253),i.disablePicking=Eo(i.disablePicking,!0),this.surfaceType=Eo(i.surfaceType,"ms"),this.probeRadius=Eo(i.probeRadius,1.4),this.smooth=Eo(i.smooth,2),this.scaleFactor=Eo(i.scaleFactor,2),this.cutoff=Eo(i.cutoff,0),this.contour=Eo(i.contour,!1),this.background=Eo(i.background,!1),this.opaqueBack=Eo(i.opaqueBack,!0),this.filterSele=Eo(i.filterSele,""),this.colorVolume=Eo(i.colorVolume,void 0),this.useWorker=Eo(i.useWorker,!0),t.prototype.init.call(this,e)},e.prototype.prepareData=function(t,e,i){var r=this.__infoList[e];if(r||(r={},this.__infoList[e]=r),r.molsurf&&r.sele===t.selection.string)i(e);else{if(this.filterSele){var n=t.structure.getView(new nc(this.filterSele)),o=n.boundingBox.getSize(),a=Math.max(o.x,o.y,o.z),s=t.getAtomSetWithinPoint(n.center,a/2+6);t=t.getView(new nc(t.getAtomSetWithinSelection(s,3).toSeleString()))}r.sele=t.selection.string,r.molsurf=new gg(t);var c=this.getSurfaceParams(),u=function(t){r.surface=t,i(e)};this.useWorker?r.molsurf.getSurfaceWorker(c,u):u(r.molsurf.getSurface(c))}},e.prototype.prepare=function(t){var e=this;if((this.__forceNewMolsurf||this.__sele!==this.selection.string||this.__surfaceParams!==JSON.stringify(this.getSurfaceParams()))&&(this.__infoList.forEach((function(t){t.molsurf.dispose()})),this.__infoList.length=0),0!==this.structureView.atomCount){var i=function(){this.__sele=this.selection.string,this.__surfaceParams=JSON.stringify(this.getSurfaceParams()),this.__forceNewMolsurf=!1,t()}.bind(this),r="default"===this.assembly?this.defaultAssembly:this.assembly,n=this.structure.biomolDict[r];n?n.partList.forEach((function(t,r){var o=t.getView(e.structureView);e.prepareData(o,r,(function(t){t===n.partList.length-1&&i()}))})):this.prepareData(this.structureView,0,i)}else t()},e.prototype.createData=function(t,e){var i=this.__infoList[e],r=i.surface,n={position:r.getPosition(),color:r.getColor(this.getColorParams()),index:r.getFilteredIndex(this.filterSele,t)},o=[];if(r.contour){var a=new xf(n,this.getBufferParams({wireframe:!1}));o.push(a)}else{n.normal=r.getNormal(),n.picking=r.getPicking(t.getStructure());var s=new mf(n,this.getBufferParams({background:this.background,opaqueBack:this.opaqueBack,dullInterior:!1})),c=new yf(s);o.push(c)}return{bufferList:o,info:i}},e.prototype.updateData=function(t,e){var i={};if(t.position)return 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)),e.bufferList[0].setAttributes(i)},e.prototype.setParameters=function(e,i,r){return i=i||{},e&&e.filterSele&&(i.index=!0),e&&void 0!==e.colorVolume&&(i.color=!0),e&&e.wireframe&&(e.contour||void 0===e.contour&&this.contour)&&(e.wireframe=!1),t.prototype.setParameters.call(this,e,i,r),this},e.prototype.getSurfaceParams=function(t){return Object.assign({type:this.surfaceType,probeRadius:this.probeRadius,scaleFactor:this.scaleFactor,smooth:this.smooth&&!this.contour,cutoff:this.cutoff,contour:this.contour,useWorker:this.useWorker},t)},e.prototype.getColorParams=function(){var e=t.prototype.getColorParams.call(this);return e.volume=this.colorVolume,e},e.prototype.clear=function(){t.prototype.clear.call(this)},e.prototype.dispose=function(){this.__infoList.forEach((function(t){t.molsurf.dispose()})),this.__infoList.length=0,t.prototype.dispose.call(this)},e}(Cf);xc.add("surface",vg);var yg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="point",this.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}},this.parameters,{flatShaded:null,wireframe:null,linewidth:null,roughness:null,metalness:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};this.pointSize=Eo(i.pointSize,1),this.sizeAttenuation=Eo(i.sizeAttenuation,!0),this.sortParticles=Eo(i.sortParticles,!1),this.useTexture=Eo(i.useTexture,!1),this.alphaTest=Eo(i.alphaTest,.5),this.forceTransparent=Eo(i.forceTransparent,!1),this.edgeBleach=Eo(i.edgeBleach,0),t.prototype.init.call(this,i)},e.prototype.createData=function(t){var e=t.getAtomData(this.getAtomParams({position:!0,color:!0,picking:!0}));return{bufferList:[new wf(e,this.getBufferParams({pointSize:this.pointSize,sizeAttenuation:this.sizeAttenuation,sortParticles:this.sortParticles,useTexture:this.useTexture,alphaTest:this.alphaTest,forceTransparent:this.forceTransparent,edgeBleach:this.edgeBleach}))]}},e.prototype.updateData=function(t,e){var i=e.sview.getAtomData(this.getAtomParams(t)),r={};t&&!t.position||(r.position=i.position),t&&!t.color||(r.color=i.color),e.bufferList[0].setAttributes(r)},e}(Cf);xc.add("point",yg),wc.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\n#include unpack_color\nattribute float primitiveId;\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 = unpackColor( primitiveId );\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}");var bg=new Uint16Array([0,1,2,1,3,2]),xg=function(t){function e(e,i){var r=e||{},n=r.position.length/3-1,o=4*n,a=3*o,s=new Float32Array(a),c=new Float32Array(a),u=new Float32Array(a),h=zo(a,a/3);t.call(this,{position:s,color:c,index:h,normal:u,picking:r.picking},i),this.addAttributes({dir:{type:"v3",value:new Float32Array(a)}}),this.addAttributes({size:{type:"f",value:new Float32Array(o)}}),r.primitiveId=su(n),this.setAttributes(r),this.meshIndex=h,this.makeIndex()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={vertexShader:{}};return e.prototype.setAttributes=function(t){var e,i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x=this.size/4,_=this.geometry.attributes;t.position&&(e=t.position,s=_.position.array,_.position.needsUpdate=!0),t.normal&&(i=t.normal,c=_.normal.array,_.normal.needsUpdate=!0),t.size&&(r=t.size,u=_.size.array,_.size.needsUpdate=!0),t.dir&&(n=t.dir,h=_.dir.array,_.dir.needsUpdate=!0),t.color&&(o=t.color,l=_.color.array,_.color.needsUpdate=!0),t.primitiveId&&(a=t.primitiveId,p=_.primitiveId.array,_.primitiveId.needsUpdate=!0);var w=r?r[0]:null;for(d=0;d<x;++d){for(y=3*d,m=3*d*4,v=4*d,e&&(s[m]=s[m+3]=e[y],s[m+1]=s[m+4]=e[y+1],s[m+2]=s[m+5]=e[y+2],s[m+6]=s[m+9]=e[y+3],s[m+7]=s[m+10]=e[y+4],s[m+8]=s[m+11]=e[y+5]),i&&(c[m]=c[m+3]=-i[y],c[m+1]=c[m+4]=-i[y+1],c[m+2]=c[m+5]=-i[y+2],c[m+6]=c[m+9]=-i[y+3],c[m+7]=c[m+10]=-i[y+4],c[m+8]=c[m+11]=-i[y+5]),f=0;f<4;++f)g=m+3*f,o&&(l[g]=o[y],l[g+1]=o[y+1],l[g+2]=o[y+2]),a&&(p[v+f]=a[d]);r&&(b=r[d],w!==r[d]?(u[v]=w,u[v+1]=w,u[v+2]=b,u[v+3]=b):(u[v]=b,u[v+1]=b,u[v+2]=b,u[v+3]=b),w=b),n&&(h[m]=n[y],h[m+1]=n[y+1],h[m+2]=n[y+2],h[m+3]=-n[y],h[m+4]=-n[y+1],h[m+5]=-n[y+2],h[m+6]=n[y+3],h[m+7]=n[y+4],h[m+8]=n[y+5],h[m+9]=-n[y+3],h[m+10]=-n[y+4],h[m+11]=-n[y+5])}},e.prototype.makeIndex=function(){var t,e,i,r,n=this.meshIndex,o=n.length/4/3;for(e=0;e<o;++e)for(i=6*e,r=4*e,n.set(bg,i),t=0;t<6;++t)n[i+t]+=r},i.vertexShader.get=function(){return"Ribbon.vert"},Object.defineProperties(e.prototype,i),e}(wd),_g=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="ribbon",this.parameters=Object.assign({subdiv:{type:"integer",max:50,min:1,rebuild:!0},tension:{type:"number",precision:1,max:1,min:.1},smoothSheet:{type:"boolean",rebuild:!0}},this.parameters,{side:null,wireframe:null,linewidth:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"chainname"),i.colorScale=Eo(i.colorScale,"RdYlBu"),i.radius=Eo(i.radius,"sstruc"),i.scale=Eo(i.scale,4),"low"===i.quality?this.subdiv=3:"medium"===i.quality?this.subdiv=6:"high"===i.quality?this.subdiv=12:this.subdiv=Eo(i.subdiv,6),this.tension=Eo(i.tension,NaN),this.smoothSheet=Eo(i.smoothSheet,!1),t.prototype.init.call(this,i)},e.prototype.getSplineParams=function(t){return Object.assign({subdiv:this.subdiv,tension:this.tension,directional:!0,smoothSheet:this.smoothSheet},t)},e.prototype.createData=function(t){var e=this,i=[],r=[];return this.structure.eachPolymer((function(t){if(!(t.residueCount<4)){r.push(t);var n=new Hm(t,e.getSplineParams()),o=n.getSubdividedPosition(),a=n.getSubdividedOrientation(),s=n.getSubdividedColor(e.getColorParams()),c=n.getSubdividedPicking(),u=n.getSubdividedSize(e.radius,e.scale);i.push(new xg({position:o.position,normal:a.binormal,dir:a.normal,color:s.color,size:u.size,picking:c.picking},e.getBufferParams()))}}),t.getSelection()),{bufferList:i,polymerList:r}},e.prototype.updateData=function(t,e){t=t||{};var i=0,r=e.polymerList.length;for(i=0;i<r;++i){var n={},o=new Hm(e.polymerList[i],this.getSplineParams());if(t.position){var a=o.getSubdividedPosition(),s=o.getSubdividedOrientation();n.position=a.position,n.normal=s.binormal,n.dir=s.normal}if(t.radius||t.scale){var c=o.getSubdividedSize(this.radius,this.scale);n.size=c.size}if(t.color){var u=o.getSubdividedColor(this.getColorParams());n.color=u.color}e.bufferList[i].setAttributes(n)}},e.prototype.setParameters=function(e){var i={};return e&&e.tension&&(i.position=!0),t.prototype.setParameters.call(this,e,i,!1),this},e}(Cf);xc.add("ribbon",_g);var wg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="rocket",this.parameters=Object.assign({localAngle:{type:"integer",max:180,min:0,rebuild:!0},centerDist:{type:"number",precision:1,max:10,min:0,rebuild:!0},ssBorder:{type:"boolean",rebuild:!0},radialSegments:!0,openEnded:!0,disableImpostor:!0},this.parameters),this.helixbundleList=[],this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"sstruc"),i.radius=Eo(i.radius,1.5),i.scale=Eo(i.scale,1),i.openEnded=Eo(i.openEnded,!1),this.localAngle=Eo(i.localAngle,30),this.centerDist=Eo(i.centerDist,2.5),this.ssBorder=Eo(i.ssBorder,!1),t.prototype.init.call(this,i)},e.prototype.createData=function(t){var e=this,i=0,r=[],n=[];this.structure.eachPolymer((function(t){if(!(t.residueCount<4||t.isNucleic())){var o=new Ap(t),a=o.getAxis(e.localAngle,e.centerDist,e.ssBorder,e.getColorParams(),e.radius,e.scale);i+=a.size.length,r.push(a),n.push(o)}}),t.getSelection());var o={begin:new Float32Array(3*i),end:new Float32Array(3*i),size:new Float32Array(i),color:new Float32Array(3*i),picking:new Float32Array(i)},a=0;return r.forEach((function(t){o.begin.set(t.begin,3*a),o.end.set(t.end,3*a),o.size.set(t.size,a),o.color.set(t.color,3*a),o.picking.set(t.picking.array,a),a+=t.size.length})),i&&(o.picking=new $h(o.picking,t.getStructure())),{bufferList:[new qd({position1:o.begin,position2:o.end,color:o.color,color2:o.color,radius:o.size,picking:o.picking},this.getBufferParams({openEnded:this.openEnded,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0}))],axisList:r,helixbundleList:n,axisData:o}},e.prototype.updateData=function(t,e){var i=this;if((t=t||{}).position)this.build();else{var r={};if(t.color||t.radius){var n=0;e.helixbundleList.forEach((function(r){var o=r.getAxis(i.localAngle,i.centerDist,i.ssBorder,i.getColorParams(),i.radius,i.scale);t.color&&e.axisData.color.set(o.color,3*n),(t.radius||t.scale)&&e.axisData.size.set(o.size,n),n+=o.size.length})),t.color&&(r.color=e.axisData.color,r.color2=e.axisData.color),(t.radius||t.scale)&&(r.radius=e.axisData.size)}e.bufferList[0].setAttributes(r)}},e}(Cf);xc.add("rocket",wg);var Sg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="rope",this.parameters=Object.assign({smooth:{type:"integer",max:15,min:0,rebuild:!0}},this.parameters,{aspectRatio:null,smoothSheet:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.aspectRatio=1,i.tension=Eo(i.tension,.5),i.scale=Eo(i.scale,5),i.smoothSheet=!1,this.smooth=Eo(i.smooth,2),t.prototype.init.call(this,i)},e.prototype.getSpline=function(t){var e=new Sp(t);return new Hm(t,this.getSplineParams({directional:!1,positionIterator:e.getCenterIterator(this.smooth)}))},e}(Ym);xc.add("rope",Sg);var Ag=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="spacefill",this.parameters=Object.assign({sphereDetail:!0,disableImpostor:!0},this.parameters),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};t.prototype.init.call(this,i)},e.prototype.createData=function(t){return{bufferList:[new Od(t.getAtomData(this.getAtomParams()),this.getBufferParams({sphereDetail:this.sphereDetail,dullInterior:!0,disableImpostor:this.disableImpostor}))]}},e.prototype.updateData=function(t,e){var i=e.sview.getAtomData(this.getAtomParams(t)),r={};t&&!t.position||(r.position=i.position),t&&!t.color||(r.color=i.color),t&&!t.radius||(r.radius=i.radius),e.bufferList[0].setAttributes(r)},e}(Cf);xc.add("spacefill",Ag);var Mg=function(t){function e(e,i){var r=i||{},n=(e||{}).position.length/3-1,o=new Float32Array(3*n*2),a=new Float32Array(3*n*2);t.call(this,{position:o,color:a},r),this.setAttributes(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={isLine:{},vertexShader:{},fragmentShader:{}};return e.prototype.setAttributes=function(t){var e,i,r,n,o=this.geometry.attributes;if(t.position&&(e=t.position,r=o.position.array,o.position.needsUpdate=!0),t.color&&(i=t.color,n=o.color.array,o.color.needsUpdate=!0),e||i)for(var a,s,c=this.size-1,u=0;u<c;++u)a=3*u,s=3*u*2,e&&(r[s]=e[a],r[s+1]=e[a+1],r[s+2]=e[a+2],r[s+3]=e[a+3],r[s+4]=e[a+4],r[s+5]=e[a+5]),i&&(n[s]=i[a],n[s+1]=i[a+1],n[s+2]=i[a+2],n[s+3]=i[a+3],n[s+4]=i[a+4],n[s+5]=i[a+5]);else mc.warn("TraceBuffer.prototype.setAttributes no data")},i.isLine.get=function(){return!0},i.vertexShader.get=function(){return"Line.vert"},i.fragmentShader.get=function(){return"Line.frag"},Object.defineProperties(e.prototype,i),e}(xd),Pg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="trace",this.parameters=Object.assign({subdiv:{type:"integer",max:50,min:1,rebuild:!0},tension:{type:"number",precision:1,max:1,min:.1},smoothSheet:{type:"boolean",rebuild:!0}},this.parameters,{flatShaded:null,side:null,wireframe:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorScheme=Eo(i.colorScheme,"chainname"),i.colorScale=Eo(i.colorScale,"RdYlBu"),"low"===i.quality?this.subdiv=3:"medium"===i.quality?this.subdiv=6:"high"===i.quality?this.subdiv=12:this.subdiv=Eo(i.subdiv,6),this.tension=Eo(i.tension,NaN),this.smoothSheet=Eo(i.smoothSheet,!1),t.prototype.init.call(this,i)},e.prototype.getSplineParams=function(t){return Object.assign({subdiv:this.subdiv,tension:this.tension,directional:!1,smoothSheet:this.smoothSheet},t)},e.prototype.createData=function(t){var e=this,i=[],r=[];return this.structure.eachPolymer((function(t){if(!(t.residueCount<4)){r.push(t);var n=new Hm(t,e.getSplineParams()),o=n.getSubdividedPosition(),a=n.getSubdividedColor(e.getColorParams());i.push(new Mg(Object.assign({},o,a),e.getBufferParams()))}}),t.getSelection()),{bufferList:i,polymerList:r}},e.prototype.updateData=function(t,e){t=t||{};var i=0,r=e.polymerList.length;for(i=0;i<r;++i){var n={},o=new Hm(e.polymerList[i],this.getSplineParams());if(t.position){var a=o.getSubdividedPosition();n.position=a.position}if(t.color){var s=o.getSubdividedColor(this.getColorParams());n.color=s.color}e.bufferList[i].setAttributes(n)}},e.prototype.setParameters=function(e){var i={};return e&&e.tension&&(i.position=!0),t.prototype.setParameters.call(this,e,i,!1),this},e}(Cf);xc.add("trace",Pg);var Tg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="tube",this.parameters=Object.assign({},this.parameters,{aspectRatio:null})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.aspectRatio=1,i.scale=Eo(i.scale,2),"low"===i.quality&&(this.radialSegments=5),t.prototype.init.call(this,i)},e.prototype.getSplineParams=function(){return t.prototype.getSplineParams.call(this,{directional:!1})},e}(Ym);xc.add("tube",Tg);var Eg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="unitcell",this.parameters=Object.assign({radius:{type:"number",precision:3,max:10,min:.001},sphereDetail:!0,radialSegments:!0,disableImpostor:!0},this.parameters,{assembly:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{},r=.5;this.structure.unitcell&&(r=Math.cbrt(this.structure.unitcell.volume)/200),i.radius=Eo(i.radius,r),i.colorValue=Eo(i.colorValue,"orange"),t.prototype.init.call(this,i)},e.prototype.getUnitcellData=function(t){return t.unitcell.getData(t)},e.prototype.create=function(){var t=this.structureView.getStructure();if(t.unitcell){var e=this.getUnitcellData(t);this.sphereBuffer=new Od(e.vertex,this.getBufferParams({sphereDetail:this.sphereDetail,disableImpostor:this.disableImpostor,dullInterior:!0})),this.cylinderBuffer=new qd(e.edge,this.getBufferParams({openEnded:!0,radialSegments:this.radialSegments,disableImpostor:this.disableImpostor,dullInterior:!0})),this.dataList.push({sview:this.structureView,bufferList:[this.sphereBuffer,this.cylinderBuffer]})}},e.prototype.updateData=function(t,e){var i=e.sview.getStructure(),r=this.getUnitcellData(i),n={},o={};t&&!t.position||(n.position=r.vertexPosition,o.position1=r.edgePosition1,o.position2=r.edgePosition2),t&&!t.color||(n.color=r.vertexColor,o.color=r.edgeColor,o.color2=r.edgeColor),t&&!t.radius||(n.radius=r.vertexRadius,o.radius=r.edgeRadius),this.sphereBuffer.setAttributes(n),this.cylinderBuffer.setAttributes(o)},e}(Cf);xc.add("unitcell",Eg);var Cg=function(t){function e(e,i,r){t.call(this,e,i,r),this.type="validation",this.parameters=Object.assign({},this.parameters,{radiusType:null,radius:null,scale:null}),this.init(r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.init=function(e){var i=e||{};i.colorValue=Eo(i.colorValue,"#f0027f"),t.prototype.init.call(this,i)},e.prototype.createData=function(t){if(t.validation){var e=t.validation.getClashData({structure:t,color:this.colorValue});return{bufferList:[new qd(e,this.getBufferParams({openEnded:!1}))]}}},e}(Cf);xc.add("validation",Cg);var Ig=function(t,e){var i=e||{};this.streamer=t,this.name=Eo(i.name,""),this.path=Eo(i.path,"")},Rg={type:{},__objName:{}};function Lg(t){var e,i,r=null,n=null,o=null,a=null,s=null,c=null,u=t.atomStore,h=t.residueStore,l=t.chainStore,p=t.modelStore,d=t.residueMap,f=-1,m=-1,g=-1,v=-1;function y(t){for(var r=h.atomCount[t],n=h.atomOffset[t],o=new Array(r),a=0;a<r;++a)o[a]=u.atomTypeId[n+a];h.residueTypeId[t]=d.add(e,o,i)}this.addAtom=function(t,d,b,x,_,w,S,A){var M=!1,P=!1,T=!1;r!==t?(M=!0,P=!0,T=!0,v+=1,g+=1,m+=1):n!==b?(P=!0,T=!0,g+=1,m+=1):a===_&&o===x&&s===A||(T=!0,m+=1),f+=1,M&&(p.growIfFull(),p.chainOffset[v]=g,p.chainCount[v]=0,p.count+=1,l.modelIndex[g]=v),P&&(l.growIfFull(),l.setChainname(g,d),l.setChainid(g,b),l.residueOffset[g]=m,l.residueCount[g]=0,l.count+=1,l.modelIndex[g]=v,p.chainCount[v]+=1,h.chainIndex[m]=g),T&&(e=o,i=c,m>0&&y(m-1),h.growIfFull(),h.resno[m]=_,void 0!==S&&(h.sstruc[m]=S.charCodeAt(0)),void 0!==A&&(h.inscode[m]=A.charCodeAt(0)),h.atomOffset[m]=f,h.atomCount[m]=0,h.count+=1,h.chainIndex[m]=g,l.residueCount[g]+=1),u.count+=1,u.residueIndex[f]=m,h.atomCount[m]+=1,r=t,n=b,o=x,a=_,s=A,c=w},this.finalize=function(){e=o,i=c,m>-1&&y(m)}}Rg.type.get=function(){return""},Rg.__objName.get=function(){return""},Ig.prototype.parse=function(){var t=this;return this.streamer.read().then((function(){return t._beforeParse(),t._parse(),t._afterParse(),t[t.__objName]}))},Ig.prototype._parse=function(){},Ig.prototype._beforeParse=function(){},Ig.prototype._afterParse=function(){gc&&mc.log(this[this.__objName])},Object.defineProperties(Ig.prototype,Rg);var Og=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.firstModelOnly=Eo(r.firstModelOnly,!1),this.asTrajectory=Eo(r.asTrajectory,!1),this.cAlphaOnly=Eo(r.cAlphaOnly,!1),this.structure=new ld(this.name,this.path),this.structureBuilder=new Lg(this.structure)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"structure"},i.__objName.get=function(){return"structure"},Object.defineProperties(e.prototype,i),e}(Ig);var Ng=function(t,e,i,r,n){this.structure=t,this.index=e,this.description=i||"",this.entityType=function(t){switch(t=t.toLowerCase()){case"polymer":return 1;case"non-polymer":return 2;case"macrolide":return 3;case"water":return 4;default:return 0}}(r||""),this.chainIndexList=n||[],n.forEach((function(i){t.chainStore.entityIndex[i]=e}))},Dg={type:{}};Dg.type.get=function(){return"Entity"},Ng.prototype.getEntityType=function(){return this.entityType},Ng.prototype.isPolymer=function(){return 1===this.entityType},Ng.prototype.isNonPolymer=function(){return 2===this.entityType},Ng.prototype.isMacrolide=function(){return 3===this.entityType},Ng.prototype.isWater=function(){return 4===this.entityType},Ng.prototype.eachChain=function(t){var e=this.structure.getChainProxy();this.chainIndexList.forEach((function(i){e.index=i,t(e)}))},Object.defineProperties(Ng.prototype,Dg);var kg=function(t){var e=t||{};this.a=e.a||1,this.b=e.b||1,this.c=e.c||1,this.alpha=e.alpha||90,this.beta=e.beta||90,this.gamma=e.gamma||90,this.spacegroup=e.spacegroup||"P 1",this.cartToFrac=e.cartToFrac||e.scale,this.fracToCart=new N;var i=Qo(this.alpha),r=Qo(this.beta),n=Qo(this.gamma),o=Math.cos(i),a=Math.cos(r),s=Math.cos(n),c=Math.sin(r),u=Math.sin(n);if(this.volume=this.a*this.b*this.c*Math.sqrt(1-o*o-a*a-s*s+2*o*a*s),void 0===this.cartToFrac){var h=this.a*this.b*u/this.volume,l=(a*s-o)/(c*u);this.fracToCart.set(this.a,0,0,0,this.b*s,this.b*u,0,0,this.c*a,-this.c*c*l,1/h,0,0,0,0,1).transpose(),this.cartToFrac=(new N).getInverse(this.fracToCart)}else this.fracToCart.getInverse(this.cartToFrac)};kg.prototype.getPosition=function(t){var e=new Float32Array(24),i=t.unitcell,r=t.center.clone().applyMatrix4(i.cartToFrac).floor().multiplyScalar(2).addScalar(1),n=new O,o=0;function a(t,a,s){n.set(t,a,s).multiply(r).applyMatrix4(i.fracToCart).toArray(e,o),o+=3}return a(0,0,0),a(1,0,0),a(0,1,0),a(0,0,1),a(1,1,0),a(1,0,1),a(0,1,1),a(1,1,1),e},kg.prototype.getCenter=function(t){return function(t,e){var i=t.length;e=e||new O;for(var r=0;r<i;r+=3)e.x+=t[r],e.y+=t[r+1],e.z+=t[r+2];return e.divideScalar(i/3),e}(this.getPosition(t))},kg.prototype.getData=function(t,e){var i=e||{},r=Eo(i.colorValue,"orange"),n=Eo(i.radius,Math.cbrt(this.volume)/200),o=new St(r),a=new O,s=this.getPosition(t),c=au(8,o.r,o.g,o.b),u=ou(8,n),h=new Float32Array(36),l=new Float32Array(36),p=au(12,o.r,o.g,o.b),d=ou(12,n),f=0;function m(t,e){a.fromArray(s,3*t).toArray(h,f),a.fromArray(s,3*e).toArray(l,f),f+=3}m(0,1),m(0,2),m(0,3),m(1,4),m(1,5),m(2,6),m(3,5),m(4,7),m(5,7),m(2,4),m(7,6),m(3,6);var g=new il(this,t);return{vertex:{position:s,color:c,radius:u,picking:g},edge:{position1:h,position2:l,color:p,color2:p,radius:d,picking:g}}};var Fg={1:"h",2:"h",3:"i",4:"h",5:"g",6:"h",7:"h",8:"h",9:"h",10:"h","":"h"},Bg=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.hex=Eo(r.hex,!1)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"pdb"},e.prototype._parse=function(){gc&&mc.time("PdbParser._parse "+this.name);var t=!1,e=this.streamer.peekLines(1)[0],i=e.substr(62,4),r=e.substr(72,4);i===r&&r.trim()&&(t=!0);var n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,P,T,E,C,I,R,L,O,D,k,F="pqr"===this.type,B=/\s+/,z=this.structure,U=this.structureBuilder,j=this.hex,G=10,V=10,$=this.firstModelOnly,H=this.asTrajectory,W=this.cAlphaOnly,X=z.frames,q=z.boxes,Y=!1,Z=z.biomolDict,K={},Q={},J={},tt=[],et=["MOL_ID","MOLECULE","CHAIN","FRAGMENT","SYNONYM","EC","ENGINEERED","MUTATION","OTHER_DETAILS"],it={},rt={},nt={helices:[],sheets:[]},ot=nt.helices,at=nt.sheets,st=z.atomMap,ct=z.atomStore;ct.resize(Math.round(this.streamer.data.length/80));var ut=z.getAtomProxy(),ht=z.getAtomProxy(),lt=0,pt=0,dt=!0;this.streamer.eachChunkOfLines((function(e){!function(e,i,r){for(var nt=e;nt<i;++nt)if(u=r[nt],"ATOM  "===(h=u.substr(0,6))||"HETATM"===h){if(dt&&(H?(Y?(n=new Float32Array(3*ct.count),X.push(n)):n=[],o=0):$||(K={}),I=(C=1).toString(),R=!0,dt=!1),$&&pt>0)continue;var ft=void 0,mt=void 0,gt=void 0,vt=void 0,yt=void 0;if(F){if(yt=10===(vt=u.split(B)).length?1:0,v=vt[2],W&&"CA"!==v)continue;ft=parseFloat(vt[6-yt]),mt=parseFloat(vt[7-yt]),gt=parseFloat(vt[8-yt])}else{if(v=u.substr(12,4).trim(),W&&"CA"!==v)continue;ft=parseFloat(u.substr(30,8)),mt=parseFloat(u.substr(38,8)),gt=parseFloat(u.substr(46,8))}if(H){var bt=3*o;if(n[bt+0]=ft,n[bt+1]=mt,n[bt+2]=gt,o+=1,Y)continue}var xt=void 0;F?(l=parseInt(vt[1]),xt="",y="H"===u[0]?1:0,p=yt?"":vt[4],d=parseInt(vt[5-yt]),g="",f=vt[3],b=parseFloat(vt[9-yt]),x="",m=0):(l=parseInt(u.substr(6,5),G),j&&99999===l&&(G=16),y="H"===u[0]?1:0,p=u[21].trim(),d=parseInt(u.substr(22,4),V)||1,j&&9999===d&&(V=16),g=u[26].trim(),f=u.substr(17,4).trim()||"MOL",b=parseFloat(u.substr(60,6)),x=u[16].trim(),m=parseFloat(u.substr(54,6)),t||(xt=u.substr(76,2).trim(),p||(p=u.substr(72,4).trim()))),ct.growIfFull(),ct.atomTypeId[lt]=st.add(v,xt),ct.x[lt]=ft,ct.y[lt]=mt,ct.z[lt]=gt,ct.serial[lt]=l,ct.bfactor[lt]=isNaN(b)?0:b,ct.altloc[lt]=x.charCodeAt(0),ct.occupancy[lt]=isNaN(m)?0:m,y?L===p&&D===f&&(Al.includes(f)||O===d&&k===g)||(I=(C+=1).toString(),O=d,D=f,k=g):R||L===p||(I=(C+=1).toString()),U.addAtom(pt,p,I,f,d,y,void 0,g),K[l]=lt,lt+=1,R=!1,L=p}else if("CONECT"===h){var _t=K[parseInt(u.substr(6,5))],wt=[11,16,21,26],St={};if(void 0===_t)continue;for(var At=0;At<4;++At){var Mt=parseInt(u.substr(wt[At],5));if(!Number.isNaN(Mt)&&void 0!==(Mt=K[Mt]))if(_t<Mt?(ut.index=_t,ht.index=Mt):(ut.index=Mt,ht.index=_t),void 0!==St[Mt])z.bondStore.bondOrder[St[Mt]]+=1;else{var Pt=ut.index+"|"+ht.index;void 0===J[Pt]&&(J[Pt]=!0,St[Mt]=z.bondStore.count,z.bondStore.addBond(ut,ht,1))}}}else if("HELIX "===h){_=u[19].trim(),w=parseInt(u.substr(21,4)),S=u[25].trim(),A=u[31].trim(),M=parseInt(u.substr(33,4)),P=u[37].trim();var Tt=parseInt(u.substr(39,1));Tt=(Fg[Tt]||Fg[""]).charCodeAt(0),ot.push([_,w,S,A,M,P,Tt])}else if("SHEET "===h)_=u[21].trim(),w=parseInt(u.substr(22,4)),S=u[26].trim(),A=u[32].trim(),M=parseInt(u.substr(33,4)),P=u[37].trim(),at.push([_,w,S,A,M,P]);else if("HETNAM"===h)rt[u.substr(11,3)]=u.substr(15).trim();else if("COMPND"===h){var Et=u.substr(10,70).trim(),Ct=Et.indexOf(":"),It=Et.substring(0,Ct),Rt=void 0;et.includes(It)?(E=It,Rt=Et.substring(Ct+2)):Rt=Et,Rt=Rt.replace(/;$/,""),"MOL_ID"===E?(T={chainList:[],name:""},tt.push(T)):"MOLECULE"===E?(T.name&&(T.name+=" "),T.name+=Rt):"CHAIN"===E&&Array.prototype.push.apply(T.chainList,Rt.split(/\s*,\s*/))}else if(u.startsWith("TER")){var Lt=z.getChainProxy(z.chainStore.count-1);it[Lt.chainname]=Lt.index,I=(C+=1).toString(),R=!0}else if("REMARK"===h&&"350"===u.substr(7,3)){if("BIOMOLECULE:"===u.substr(11,12)){var Ot=u.substr(23).trim();/^(0|[1-9][0-9]*)$/.test(Ot)&&(Ot="BU"+Ot),a=new Rp(Ot),Z[Ot]=a}else if("BIOMT"===u.substr(13,5)){var Nt=u.split(/\s+/),Dt=parseInt(u[18])-1;0===Dt&&(c=new N,s.matrixList.push(c));var kt=c.elements;kt[0+Dt]=parseFloat(Nt[4]),kt[4+Dt]=parseFloat(Nt[5]),kt[8+Dt]=parseFloat(Nt[6]),kt[12+Dt]=parseFloat(Nt[7])}else if("APPLY THE FOLLOWING TO CHAINS:"===u.substr(11,30)||"                   AND CHAINS:"===u.substr(11,30)){"APPLY"===u.substr(11,5)&&(s=a.addPart());for(var Ft=u.substr(41,30).split(","),Bt=0,zt=Ft.length;Bt<zt;++Bt){var Ut=Ft[Bt].trim();Ut&&s.chainList.push(Ut)}}}else if("HEADER"===h)z.id=u.substr(62,4);else if("TITLE "===h)z.title+=(z.title?" ":"")+u.substr(10,70).trim();else if("MODEL "===h)dt=!0;else if("ENDMDL"===h||u.startsWith("END")){if(dt)continue;H&&!Y&&(X.push(new Float32Array(n)),Y=!0),pt+=1,dt=!0}else if("MTRIX"===u.substr(0,5)){if("1"===u[59])continue;var jt=u.split(/\s+/),Gt=jt[1].trim();if("1"===u[5]&&"1"===Gt){a=new Rp("NCS"),Z.NCS=a,s=a.addPart()}var Vt=parseInt(u[5])-1;0===Vt&&(c=new N,s.matrixList.push(c));var $t=c.elements;$t[0+Vt]=parseFloat(jt[2]),$t[4+Vt]=parseFloat(jt[3]),$t[8+Vt]=parseFloat(jt[4]),$t[12+Vt]=parseFloat(jt[5])}else if("ORIGX"===u.substr(0,5)){Q.origx||(Q.origx=new N);var Ht=u.split(/\s+/),Wt=parseInt(u[5])-1,Xt=Q.origx.elements;Xt[0+Wt]=parseFloat(Ht[1]),Xt[4+Wt]=parseFloat(Ht[2]),Xt[8+Wt]=parseFloat(Ht[3]),Xt[12+Wt]=parseFloat(Ht[4])}else if("SCALE"===u.substr(0,5)){Q.scale||(Q.scale=new N);var qt=u.split(/\s+/),Yt=parseInt(u[5])-1,Zt=Q.scale.elements;Zt[0+Yt]=parseFloat(qt[1]),Zt[4+Yt]=parseFloat(qt[2]),Zt[8+Yt]=parseFloat(qt[3]),Zt[12+Yt]=parseFloat(qt[4])}else if("CRYST1"===h){var Kt=parseFloat(u.substr(6,9)),Qt=parseFloat(u.substr(15,9)),Jt=parseFloat(u.substr(24,9)),te=parseFloat(u.substr(33,7)),ee=parseFloat(u.substr(40,7)),ie=parseFloat(u.substr(47,7)),re=u.substr(55,11).trim(),ne=new Float32Array(9);ne[0]=Kt,ne[4]=Qt,ne[8]=Jt,q.push(ne),0===pt&&(Q.a=Kt,Q.b=Qt,Q.c=Jt,Q.alpha=te,Q.beta=ee,Q.gamma=ie,Q.spacegroup=re)}}(0,e.length,e)}));var ft=tt.length;if(tt.length){z.eachChain((function(t){t.entityIndex=ft})),tt.forEach((function(t,e){var i=t.chainList.map((function(t){return it[t]}));z.entityList.push(new Ng(z,e,t.name,"polymer",i))}));var mt=tt.length,gt=z.getResidueProxy(),vt={};z.eachChain((function(t){t.entityIndex===ft&&(gt.index=t.residueOffset,vt[gt.resname]||(vt[gt.resname]=[]),vt[gt.resname].push(t.index))})),Object.keys(vt).forEach((function(t){var e=vt[t],i="non-polymer",r=rt[t]||t;Al.includes(t)&&(r="water",i="water"),z.entityList.push(new Ng(z,mt,r,i,e)),mt+=1}))}void 0!==Q.a?z.unitcell=new kg(Q):z.unitcell=void 0,(ot.length||at.length)&&Dp(z,nt),U.finalize(),z.finalizeAtoms(),t||Up(z),jp(z),z.finalizeBonds(),ot.length||at.length||zp(z),$p(z),gc&&mc.timeEnd("PdbParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("pdb",Bg),_c.add("pdb1",Bg),_c.add("ent",Bg);var zg=/\s+/,Ug=/'((?:(?!'\s).)*)'|"((?:(?!"\s).)*)"|(\S+)/g,jg=/"/g,Gg=/^['"]+|['"]+$/g;function Vg(t){return!t||t[0]!==t[t.length-1]||"'"!==t[0]&&'"'!==t[0]?t:t.substring(1,t.length-1)}function $g(t,e){Array.isArray(t[e])||Object.keys(t).forEach((function(e){t[e]=[t[e]]}))}function Hg(t){return"?"!==t}function Wg(t,e){return Hg(t)?t:e}function Xg(t){switch(t.toLowerCase()){case"?":case"sing":return 1;case"doub":return 2;case"trip":return 3;case"quad":return 4}return 0}var qg=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"cif"},e.prototype._parse=function(){mc.time("CifParser._parse "+this.name);var t,e,i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_=this.structure,w=this.structureBuilder,S=this.firstModelOnly,A=this.asTrajectory,M=this.cAlphaOnly,P=_.frames,T={},E={},C={},I=!1,R=null,L=!1,D=!1,k=!1,F=[],B=null,z=null,U=null,j=null,G=[],V=_.atomMap,$=_.atomStore;$.resize(this.streamer.data.length/100);var H,W=0,X=0;if(this.streamer.eachChunkOfLines((function(O){!function(O,N,q){for(var Y=O;Y<N;++Y)if(i=q[Y],((r=i.trim())||I||D)&&"#"!==r[0])if("data_"===r.substring(0,5))T.data=r.substring(5).trim();else if(";"===r[0])I?(D?(B===F.length&&(B=0),F[B].push(R),B+=1):!1===U?T[z]=R:T[z][U]=R,I=!1,R=null):(I=!0,R=r.substring(1));else if("loop_"===r)D=!0,k=!0,F.length=0,G.length=0,B=0;else if("_"===r[0]){var Z,K,Q;if(D&&!k&&(D=!1),D)K=(Z=r.split("."))[0].substring(1),Q=Z[1],1===Z.length?(Q=!1,T[K]||(T[K]=[]),F.push(T[K])):(T[K]||(T[K]={}),T[K][Q]?gc&&mc.warn(K,Q,"already exists"):(T[K][Q]=[],F.push(T[K][Q]),G.push(Q))),z=K,U=Q,j=!0;else{var J=r.match(Ug),tt=J[0],et=J[1];K=(Z=tt.split("."))[0].substring(1),Q=Z[1],1===Z.length?(Q=!1,T[K]=et):(T[K]||(T[K]={}),T[K][Q]?gc&&mc.warn(K,Q,"already exists"):T[K][Q]=et),et||(L=!0),z=K,U=Q}}else if(I)R+=i;else if(D){if(!r)continue;if("atom_site"===z){var it=r.split(zg);j&&(n=G.indexOf("auth_asym_id"),o=G.indexOf("auth_seq_id"),a=G.indexOf("label_atom_id"),s=G.indexOf("label_comp_id"),c=G.indexOf("label_asym_id"),u=G.indexOf("label_entity_id"),h=G.indexOf("label_alt_id"),g=G.indexOf("Cartn_x"),v=G.indexOf("Cartn_y"),y=G.indexOf("Cartn_z"),p=G.indexOf("id"),d=G.indexOf("type_symbol"),l=G.indexOf("group_PDB"),b=G.indexOf("B_iso_or_equiv"),f=G.indexOf("pdbx_PDB_model_num"),m=G.indexOf("pdbx_PDB_ins_code"),x=G.indexOf("occupancy"),j=!1,H=parseInt(it[f]),A&&(t=[],e=0));var rt=parseInt(it[f]);if(H!==rt&&(A&&(0===X&&P.push(new Float32Array(t)),t=new Float32Array(3*$.count),P.push(t),e=0),X+=1),H=rt,S&&X>0)continue;var nt=it[a].replace(jg,"");if(M&&"CA"!==nt)continue;var ot=parseFloat(it[g]),at=parseFloat(it[v]),st=parseFloat(it[y]);if(A){var ct=3*e;if(t[ct+0]=ot,t[ct+1]=at,t[ct+2]=st,e+=1,X>0)continue}var ut=it[s],ht=parseInt(it[o]),lt=it[m];lt="?"===lt?"":lt;var pt=it[n],dt=it[c],ft="H"===it[l][0]?1:0,mt=it[d],gt=parseFloat(it[b]),vt=parseFloat(it[x]),yt=it[h];if(yt="."===yt?"":yt,$.growIfFull(),$.atomTypeId[W]=V.add(nt,mt),$.x[W]=ot,$.y[W]=at,$.z[W]=st,$.serial[W]=parseInt(it[p]),$.bfactor[W]=isNaN(gt)?0:gt,$.occupancy[W]=isNaN(vt)?0:vt,$.altloc[W]=yt.charCodeAt(0),w.addAtom(X,pt,dt,ut,ht,ft,void 0,lt),gc){var bt=E[dt];void 0!==bt&&bt!==pt&&gc&&mc.warn(bt,pt)}E[dt]=pt;var xt=it[u];C[xt]||(C[xt]=new Set),C[xt].add(_.chainStore.count-1),W+=1}else{var _t=r.match(Ug),wt=_t.length;B===F.length&&(B=0);for(var St=0;St<wt;++St)F[B+St].push(_t[St]);B+=wt}k=!1}else if("'"===r[0]&&"'"===r[r.length-1]){var At=r.substring(1,r.length-1);!1===U?T[z]=At:T[z][U]=At}else L?!1===U?T[z]=r:T[z][U]=r:gc&&mc.log("CifParser._parse: unknown state",r);else I=!1,D=!1,L=!1,F.length=0,B=null,z=null,U=null,j=null,G.length=0}(0,O.length,O)})),T.chem_comp&&T.chem_comp_atom)!function(t,e,i){var r,n,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(Gg,"")),s.id&&(e.id=s.id.trim().replace(Gg,"")));var h={};if(c){var l,p,d,f;for(n=c.comp_id.length,r=0;r<n;++r)o.growIfFull(),l=c.atom_id[r].replace(jg,""),p=c.type_symbol[r],h[l]=r,o.atomTypeId[r]=a.add(l,p),o.x[r]=c.model_Cartn_x[r],o.y[r]=c.model_Cartn_y[r],o.z[r]=c.model_Cartn_z[r],o.serial[r]=r,d=c.pdbx_component_comp_id[r],f=c.pdbx_residue_numbering?c.pdbx_residue_numbering[r]:1,i.addAtom(0,"","",d,f,1);for(r=0;r<n;++r){var m=r+n;o.growIfFull(),l=c.atom_id[r].replace(jg,""),p=c.type_symbol[r],o.atomTypeId[m]=a.add(l,p),o.x[m]=c.pdbx_model_Cartn_x_ideal[r],o.y[m]=c.pdbx_model_Cartn_y_ideal[r],o.z[m]=c.pdbx_model_Cartn_z_ideal[r],o.serial[m]=m,d=c.pdbx_component_comp_id[r],f=c.pdbx_residue_numbering?c.pdbx_residue_numbering[r]:1,i.addAtom(1,"","",d,f,1)}}if(c&&u){var g,v,y;n=u.comp_id.length;var b=c.comp_id.length,x=e.getAtomProxy(),_=e.getAtomProxy();for(r=0;r<n;++r)g=u.atom_id_1[r].replace(jg,""),v=u.atom_id_2[r].replace(jg,""),y=Xg(u.value_order[r]),x.index=h[g],_.index=h[v],e.bondStore.growIfFull(),e.bondStore.addBond(x,_,y),x.index+=b,_.index+=b,e.bondStore.growIfFull(),e.bondStore.addBond(x,_,y)}}(T,_,w),w.finalize(),_.finalizeAtoms(),_.finalizeBonds(),qp(_);else if(T.atom_site_type_symbol&&T.atom_site_label&&T.atom_site_fract_x)!function(t,e,i){var r=e.atomStore,n=e.atomMap;t.data&&(e.id=t.data,e.name=t.data),e.unitcell=new kg({a:parseFloat(t.cell_length_a),b:parseFloat(t.cell_length_b),c:parseFloat(t.cell_length_c),alpha:parseFloat(t.cell_angle_alpha),beta:parseFloat(t.cell_angle_beta),gamma:parseFloat(t.cell_angle_gamma),spacegroup:Vg(t.symmetry_space_group_name_H)});for(var o=new O,a=new O,s=t.atom_site_type_symbol.length,c=0;c<s;++c){r.growIfFull();var u=t.atom_site_label[c],h=t.atom_site_type_symbol[c];r.atomTypeId[c]=n.add(u,h),o.set(t.atom_site_fract_x[c],t.atom_site_fract_y[c],t.atom_site_fract_z[c]),o.applyMatrix4(e.unitcell.fracToCart),a.add(o),r.x[c]=o.x,r.y[c]=o.y,r.z[c]=o.z,t.atom_site_occupancy&&(r.occupancy[c]=parseFloat(t.atom_site_occupancy[c])),r.serial[c]=c,i.addAtom(0,"","","HET",1,1)}a.divideScalar(s),e.center=a,$p(e);var l=new O,p=new O,d=e.biomolDict.SUPERCELL.partList[0].matrixList,f=s;function m(t){return n.get(r.atomTypeId[t]).covalent}for(var g=new N,v=function(t){var e=m(t);o.set(r.x[t],r.y[t],r.z[t]),d.forEach((function(n){if(!g.equals(n)){l.copy(o),l.applyMatrix4(n);for(var a=0;a<s;++a){p.set(r.x[a],r.y[a],r.z[a]);var c=l.distanceToSquared(p),u=m(a)+e,h=u+.3,d=u-.5;if(c<h*h&&c>d*d)return r.growIfFull(),r.atomTypeId[f]=r.atomTypeId[t],r.x[f]=l.x,r.y[f]=l.y,r.z[f]=l.z,r.occupancy[f]=r.occupancy[t],r.serial[f]=f,r.altloc[f]="A".charCodeAt(0),i.addAtom(0,"","","HET",1,1),void(f+=1)}}}))},y=0;y<s;++y)v(y)}(T,_,w),w.finalize(),_.finalizeAtoms(),jp(_),_.finalizeBonds();else{var q=function(t,e,i){var r,n,o,a,s=[],c=[],u=t.struct_conf;if(u)for($g(u,"id"),r=0,n=u.beg_auth_seq_id.length;r<n;++r){var h=parseInt(u.pdbx_PDB_helix_class[r]);Number.isNaN(h)||(o=u.pdbx_beg_PDB_ins_code[r],a=u.pdbx_end_PDB_ins_code[r],s.push([i[u.beg_label_asym_id[r]],parseInt(u.beg_auth_seq_id[r]),Wg(o,""),i[u.end_label_asym_id[r]],parseInt(u.end_auth_seq_id[r]),Wg(a,""),(Fg[h]||Fg[""]).charCodeAt(0)]))}var l=t.struct_sheet_range;if(l)for($g(l,"id"),r=0,n=l.beg_auth_seq_id.length;r<n;++r)o=l.pdbx_beg_PDB_ins_code[r],a=l.pdbx_end_PDB_ins_code[r],c.push([i[l.beg_label_asym_id[r]],parseInt(l.beg_auth_seq_id[r]),Wg(o,""),i[l.end_label_asym_id[r]],parseInt(l.end_auth_seq_id[r]),Wg(a,"")]);return!(!u&&!l)&&{helices:s,sheets:c}}(T,0,E);if(function(t,e,i){var r={},n=e.biomolDict;if(t.pdbx_struct_oper_list){var o=t.pdbx_struct_oper_list;$g(o,"id"),o.id.forEach((function(t,e){var i=new N,n=i.elements;n[0]=parseFloat(o["matrix[1][1]"][e]),n[1]=parseFloat(o["matrix[1][2]"][e]),n[2]=parseFloat(o["matrix[1][3]"][e]),n[4]=parseFloat(o["matrix[2][1]"][e]),n[5]=parseFloat(o["matrix[2][2]"][e]),n[6]=parseFloat(o["matrix[2][3]"][e]),n[8]=parseFloat(o["matrix[3][1]"][e]),n[9]=parseFloat(o["matrix[3][2]"][e]),n[10]=parseFloat(o["matrix[3][3]"][e]),n[3]=parseFloat(o["vector[1]"][e]),n[7]=parseFloat(o["vector[2]"][e]),n[11]=parseFloat(o["vector[3]"][e]),i.transpose(),r[t]=i}))}if(t.pdbx_struct_assembly_gen){var a=t.pdbx_struct_assembly_gen;$g(a,"assembly_id");var s=function(t){var e={};return t.replace(/[()']/g,"").split(",").forEach((function(t){if(t.includes("-"))for(var i=t.split("-"),n=parseInt(i[0]),o=parseInt(i[1]);n<=o;++n)e[n]=r[n];else e[t]=r[t]})),e};a.assembly_id.forEach((function(t,e){var r={},o=a.oper_expression[e].replace(/['"]\(|['"]/g,"");if(o.includes(")(")||o.indexOf("(")>0){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 N;i.multiplyMatrices(c[t],u[e]),r[t+"x"+e]=i}))}))}else r=s(o);var h=[];for(var l in r)h.push(r[l]);var p=t;/^(0|[1-9][0-9]*)$/.test(p)&&(p="BU"+p);for(var d=a.asym_id_list[e].split(","),f=0,m=d.length;f<m;++f)d[f]=i[d[f]];void 0===n[p]&&(n[p]=new Rp(p)),n[p].addPart(h,d)}))}if(t.struct_ncs_oper){var c=t.struct_ncs_oper;$g(c,"id");n.NCS=new Rp("NCS");var u=n.NCS.addPart();c.id.forEach((function(t,e){if("given"!==c.code[e]){var i=new N,r=i.elements;r[0]=parseFloat(c["matrix[1][1]"][e]),r[1]=parseFloat(c["matrix[1][2]"][e]),r[2]=parseFloat(c["matrix[1][3]"][e]),r[4]=parseFloat(c["matrix[2][1]"][e]),r[5]=parseFloat(c["matrix[2][2]"][e]),r[6]=parseFloat(c["matrix[2][3]"][e]),r[8]=parseFloat(c["matrix[3][1]"][e]),r[9]=parseFloat(c["matrix[3][2]"][e]),r[10]=parseFloat(c["matrix[3][3]"][e]),r[3]=parseFloat(c["vector[1]"][e]),r[7]=parseFloat(c["vector[2]"][e]),r[11]=parseFloat(c["vector[3]"][e]),i.transpose(),u.matrixList.push(i)}})),0===u.matrixList.length&&delete n.NCS}var h={};if(t.cell){var l=t.cell,p=parseFloat(l.length_a),d=parseFloat(l.length_b),f=parseFloat(l.length_c),m=new Float32Array(9);m[0]=p,m[4]=d,m[8]=f,e.boxes.push(m),h.a=p,h.b=d,h.c=f,h.alpha=parseFloat(l.angle_alpha),h.beta=parseFloat(l.angle_beta),h.gamma=parseFloat(l.angle_gamma)}t.symmetry&&(h.spacegroup=Vg(t.symmetry["space_group_name_H-M"]));var g=new N;if(t.database_PDB_matrix){var v=t.database_PDB_matrix,y=g.elements;y[0]=parseFloat(v["origx[1][1]"]),y[1]=parseFloat(v["origx[1][2]"]),y[2]=parseFloat(v["origx[1][3]"]),y[4]=parseFloat(v["origx[2][1]"]),y[5]=parseFloat(v["origx[2][2]"]),y[6]=parseFloat(v["origx[2][3]"]),y[8]=parseFloat(v["origx[3][1]"]),y[9]=parseFloat(v["origx[3][2]"]),y[10]=parseFloat(v["origx[3][3]"]),y[3]=parseFloat(v["origx_vector[1]"]),y[7]=parseFloat(v["origx_vector[2]"]),y[11]=parseFloat(v["origx_vector[3]"]),g.transpose(),h.origx=g}var b=new N;if(t.atom_sites){var x=t.atom_sites,_=b.elements;_[0]=parseFloat(x["fract_transf_matrix[1][1]"]),_[1]=parseFloat(x["fract_transf_matrix[1][2]"]),_[2]=parseFloat(x["fract_transf_matrix[1][3]"]),_[4]=parseFloat(x["fract_transf_matrix[2][1]"]),_[5]=parseFloat(x["fract_transf_matrix[2][2]"]),_[6]=parseFloat(x["fract_transf_matrix[2][3]"]),_[8]=parseFloat(x["fract_transf_matrix[3][1]"]),_[9]=parseFloat(x["fract_transf_matrix[3][2]"]),_[10]=parseFloat(x["fract_transf_matrix[3][3]"]),_[3]=parseFloat(x["fract_transf_vector[1]"]),_[7]=parseFloat(x["fract_transf_vector[2]"]),_[11]=parseFloat(x["fract_transf_vector[3]"]),b.transpose(),h.scale=b}void 0!==h.a?e.unitcell=new kg(h):e.unitcell=void 0}(T,_,E),function(t,e,i){var r=t.struct_conn;if(r){$g(r,"id");for(var n=/"/g,o=e.getAtomProxy(),a=e.getAtomProxy(),s={},c=0,u=r.id.length;c<u;++c){var h=r.conn_type_id[c];if("hydrog"!==h&&"mismat"!==h&&"saltbr"!==h&&("1_555"===r.ptnr1_symmetry[c]&&"1_555"===r.ptnr2_symmetry[c])){var l=r.pdbx_ptnr1_PDB_ins_code[c],p=r.pdbx_ptnr1_label_alt_id[c],d=r.ptnr1_auth_seq_id[c]+(Hg(l)?"^"+l:"")+":"+i[r.ptnr1_label_asym_id[c]]+"."+r.ptnr1_label_atom_id[c].replace(n,"")+(Hg(p)?"%"+p:""),f=s[d];if(!f){var m=new nc(d);if(m.selection.error){gc&&mc.warn("invalid selection for connection",d);continue}f=e.getAtomIndices(m),s[d]=f}var g=r.pdbx_ptnr2_PDB_ins_code[c],v=r.pdbx_ptnr2_label_alt_id[c],y=r.ptnr2_auth_seq_id[c]+(Hg(g)?"^"+g:"")+":"+i[r.ptnr2_label_asym_id[c]]+"."+r.ptnr2_label_atom_id[c].replace(n,"")+(Hg(v)?"%"+v:""),b=s[y];if(!b){var x=new nc(y);if(x.selection.error){gc&&mc.warn("invalid selection for connection",y);continue}b=e.getAtomIndices(x),s[y]=b}var _=f.length,w=b.length;if(_>w){var S=_;_=w,w=S;var A=f;f=b,b=A}if(0!==_&&0!==w)for(var M=0;M<w;++M)o.index=f[M%_],a.index=b[M],o&&a?e.bondStore.addBond(o,a,Xg(r.pdbx_value_order[c])):mc.log("atoms for connection not found");else gc&&mc.warn("no atoms found for",d,y)}}}}(T,_,E),function(t,e,i){if(t.entity){$g(t.entity,"id");for(var r=t.entity,n=r.id.length,o=0;o<n;++o){var a=r.pdbx_description[o],s=r.type[o],c=Array.from(i[r.id[o]]);e.entityList[o]=new Ng(e,o,a,s,c)}}}(T,_,C),T.struct&&T.struct.title&&(_.title=T.struct.title.trim().replace(Gg,"")),T.entry&&T.entry.id&&(_.id=T.entry.id.trim().replace(Gg,"")),T.database_PDB_rev){if(T.database_PDB_rev.date){$g(T.database_PDB_rev,"date");var Y=T.database_PDB_rev.date.filter(Hg);Y.length&&(_.header.releaseDate=Y[Y.length-1])}if(T.database_PDB_rev.date_original){$g(T.database_PDB_rev,"date_original");var Z=T.database_PDB_rev.date_original.filter(Hg);Z.length&&(_.header.depositionDate=Z[Z.length-1])}}T.reflns&&T.reflns.d_resolution_high?Hg(T.reflns.d_resolution_high)&&(_.header.resolution=parseFloat(T.reflns.d_resolution_high)):T.refine&&T.refine.ls_d_res_high&&Hg(T.refine.ls_d_res_high)&&(_.header.resolution=parseFloat(T.refine.ls_d_res_high)),T.refine&&T.refine.ls_R_factor_R_free&&Hg(T.refine.ls_R_factor_R_free)&&(_.header.rFree=parseFloat(T.refine.ls_R_factor_R_free)),T.refine&&T.refine.ls_R_factor_R_work&&Hg(T.refine.ls_R_factor_R_work)&&(_.header.rWork=parseFloat(T.refine.ls_R_factor_R_work)),T.exptl&&T.exptl.method&&($g(T.exptl,"method"),_.header.experimentalMethods=T.exptl.method.map((function(t){return t.replace(Gg,"")}))),w.finalize(),_.finalizeAtoms(),jp(_),_.finalizeBonds(),q?Dp(_,q):zp(_),$p(_),_.extraData.cif=T}gc&&mc.timeEnd("CifParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("cif",qg),_c.add("mcif",qg),_c.add("mmcif",qg);var Yg=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"gro"},e.prototype._parse=function(){gc&&mc.time("GroParser._parse "+this.name);var t,e,i=this.structure,r=this.structureBuilder,n=this.firstModelOnly,o=this.asTrajectory,a=this.cAlphaOnly,s=i.frames,c=i.boxes,u=this.streamer.peekLines(3);i.title=u[0].trim();var h,l,p,d,f=5+(u[2].length-u[2].lastIndexOf(".")-1),m=20+f,g=20+2*f,v=parseInt(u[1]),y=v+3,b=i.atomMap,x=i.atomStore;x.resize(v);var _=0,w=0,S=0;this.streamer.eachChunkOfLines((function(i){!function(i,u,A){for(var M=i;M<u;++M){var P=++S-1,T=A[M];if(T)if(P%y==0)o&&(t=new Float32Array(3*v),s.push(t),e=0);else if(P%y==1);else if(P%y==y-1){var E=T.trim().split(/\s+/),C=new Float32Array(9);if(C[0]=10*parseFloat(E[0]),C[4]=10*parseFloat(E[1]),C[8]=10*parseFloat(E[2]),c.push(C),n)return!0;w+=1}else{if(h=T.substr(10,5).trim(),a&&"CA"!==h)continue;var I=10*parseFloat(T.substr(20,f)),R=10*parseFloat(T.substr(m,f)),L=10*parseFloat(T.substr(g,f));if(o){var O=3*e;if(t[O+0]=I,t[O+1]=R,t[O+2]=L,e+=1,P>y)continue}l=T.substr(5,5).trim(),p=parseInt(T.substr(0,5)),d=parseInt(T.substr(15,5)),x.growIfFull(),x.atomTypeId[_]=b.add(h),x.x[_]=I,x.y[_]=R,x.z[_]=L,x.serial[_]=d,r.addAtom(w,"","",l,p,0,"l"),_+=1}}}(0,i.length,i)})),r.finalize(),i.finalizeAtoms(),Up(i),jp(i),i.finalizeBonds(),zp(i),gc&&mc.timeEnd("GroParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("gro",Yg);var Zg=["mmtfVersion","mmtfProducer","unitCell","spaceGroup","structureId","title","depositionDate","releaseDate","experimentalMethods","resolution","rFree","rWork","bioAssemblyList","ncsOperatorList","entityList","groupList","numBonds","numAtoms","numGroups","numChains","numModels","groupsPerChain","chainsPerModel"].concat(["xCoordList","yCoordList","zCoordList","groupIdList","groupTypeList","chainIdList","bFactorList","atomIdList","altLocList","occupancyList","secStructList","insCodeList","sequenceIndexList","chainNameList","bondAtomList","bondOrderList"]);function Kg(t,e,i){return e?new t(e.buffer,e.byteOffset,e.byteLength/(i||1)):void 0}function Qg(t){return Kg(DataView,t)}function Jg(t){return Kg(Int8Array,t)}function tv(t){return Kg(Int32Array,t,4)}function ev(t,e){var i=t.length/2;e||(e=new Int16Array(i));for(var r=0,n=0;r<i;++r,n+=2)e[r]=t[n]<<8^t[n+1]<<0;return e}function iv(t,e){var i=t.length/4;e||(e=new Int32Array(i));for(var r=0,n=0;r<i;++r,n+=4)e[r]=t[n]<<24^t[n+1]<<16^t[n+2]<<8^t[n+3]<<0;return e}function rv(t,e,i){var r=t.length,n=1/e;i||(i=new Float32Array(r));for(var o=0;o<r;++o)i[o]=t[o]*n;return i}function nv(t,e){var i,r;if(!e){var n=0;for(i=0,r=t.length;i<r;i+=2)n+=t[i+1];e=new t.constructor(n)}var o=0;for(i=0,r=t.length;i<r;i+=2)for(var a=t[i],s=t[i+1],c=0;c<s;++c)e[o]=a,++o;return e}function ov(t,e){var i=t.length;e||(e=new t.constructor(i)),i&&(e[0]=t[0]);for(var r=1;r<i;++r)e[r]=t[r]+e[r-1];return e}function av(t,e){var i,r,n=t instanceof Int8Array?127:32767,o=-n-1,a=t.length;if(!e){var s=0;for(i=0;i<a;++i)t[i]<n&&t[i]>o&&++s;e=new Int32Array(s)}for(i=0,r=0;i<a;){for(var c=0;t[i]===n||t[i]===o;)c+=t[i],++i;c+=t[i],++i,e[r]=c,++r}return e}function sv(t,e,i){return rv(av(t,tv(i)),e,i)}function cv(t,e,i){var r=av(t,tv(i));return function(t,e,i){return rv(ov(t,tv(i)),e,i)}(r,e,Kg(Float32Array,r,4))}function uv(t,e,i,r){switch(t){case 1:return function(t,e){var i=t.length;e||(e=new Float32Array(i/4));for(var r=Qg(e),n=Qg(t),o=0,a=0,s=i/4;o<s;++o,a+=4)r.setFloat32(a,n.getFloat32(a),!0);return e}(e);case 2:return Jg(e);case 3:return ev(e);case 4:return iv(e);case 5:return Kg(Uint8Array,e);case 6:return nv(iv(e),new Uint8Array(i));case 7:return nv(iv(e));case 8:return ov(nv(iv(e)),n);case 9:return function(t,e,i){return rv(nv(t,tv(i)),e,i)}(iv(e),iv(r)[0]);case 10:return cv(ev(e),iv(r)[0]);case 11:return rv(ev(e),iv(r)[0]);case 12:return sv(ev(e),iv(r)[0]);case 13:return sv(Jg(e),iv(r)[0]);case 14:return av(ev(e));case 15:return av(Jg(e))}var n}function hv(t,e){var i=(e=e||{}).ignoreFields,r={};return Zg.forEach((function(e){var n=!!i&&-1!==i.indexOf(e),o=t[e];n||void 0===o||(o instanceof Uint8Array?r[e]=uv.apply(null,function(t){var e=Qg(t),i=e.getInt32(0),r=e.getInt32(4),n=t.subarray(8,12);return[i,t=t.subarray(12),r,n]}(o)):r[e]=o)})),r}var lv={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)},pv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"mmtf"},e.prototype._parse=function(){var t,e,i,r,n;gc&&mc.time("MmtfParser._parse "+this.name);var o,a,s,c,u,h,l=this.structure,p=hv(function(t){var e=0,i=new DataView(t.buffer);function r(t){for(var e={},i=0;i<t;i++){e[s()]=s()}return e}function n(i){var r=t.subarray(e,e+i);return e+=i,r}function o(i){var r=t.subarray(e,e+i);e+=i;if(i>65535){for(var n=[],o=0;o<r.length;o+=65535)n.push(String.fromCharCode.apply(null,r.subarray(o,o+65535)));return n.join("")}return String.fromCharCode.apply(null,r)}function a(t){for(var e=new Array(t),i=0;i<t;i++)e[i]=s();return e}function s(){var s,c,u=t[e];if(0==(128&u))return e++,u;if(128==(240&u))return e++,r(c=15&u);if(144==(240&u))return e++,a(c=15&u);if(160==(224&u))return e++,o(c=31&u);if(224==(224&u))return s=i.getInt8(e),e++,s;switch(u){case 192:return e++,null;case 194:return e++,!1;case 195:return e++,!0;case 196:return c=i.getUint8(e+1),e+=2,n(c);case 197:return c=i.getUint16(e+1),e+=3,n(c);case 198:return c=i.getUint32(e+1),e+=5,n(c);case 202:return s=i.getFloat32(e+1),e+=5,s;case 203:return s=i.getFloat64(e+1),e+=9,s;case 204:return s=t[e+1],e+=2,s;case 205:return s=i.getUint16(e+1),e+=3,s;case 206:return s=i.getUint32(e+1),e+=5,s;case 208:return s=i.getInt8(e+1),e+=2,s;case 209:return s=i.getInt16(e+1),e+=3,s;case 210:return s=i.getInt32(e+1),e+=5,s;case 217:return c=i.getUint8(e+1),e+=2,o(c);case 218:return c=i.getUint16(e+1),e+=3,o(c);case 219:return c=i.getUint32(e+1),e+=5,o(c);case 220:return c=i.getUint16(e+1),e+=3,a(c);case 221:return c=i.getUint32(e+1),e+=5,a(c);case 222:return c=i.getUint16(e+1),e+=3,r(c);case 223:return c=i.getUint32(e+1),e+=5,r(c)}throw new Error("Unknown type 0x"+u.toString(16))}return s()}(this.streamer.data));if(["depositionDate","releaseDate","resolution","rFree","rWork","experimentalMethods"].forEach((function(t){void 0!==p[t]&&(l.header[t]=p[t])})),l.id=p.structureId,l.title=p.title,this.firstModelOnly||this.asTrajectory){for(u=1,s=0,t=0,e=c=p.chainsPerModel[0];t<e;++t)s+=p.groupsPerChain[t];for(a=0,t=0,e=s;t<e;++t)a+=(n=p.groupList[p.groupTypeList[t]]).atomNameList.length;o=p.numBonds,h=[c]}else o=p.numBonds,a=p.numAtoms,s=p.numGroups,c=p.numChains,u=p.numModels,h=p.chainsPerModel;if(o+=s,this.asTrajectory)for(t=0,e=p.numModels;t<e;++t){var d=new Float32Array(3*a),f=a*t;for(i=0;i<a;++i){var m=3*i,g=i+f;d[m]=p.xCoordList[g],d[m+1]=p.yCoordList[g],d[m+2]=p.zCoordList[g]}l.frames.push(d)}var v=new Uint32Array(o),y=new Uint32Array(o),b=new Uint8Array(o),x=new Uint32Array(a),_=new Uint32Array(s),w=new Uint32Array(s),S=new Uint16Array(s),A=new Uint16Array(c),M=new Uint32Array(c),P=new Uint32Array(c),T=new Uint32Array(u),E=new Uint32Array(u),C=0;for(t=0,e=u;t<e;++t){var I=h[t];for(T[t]=C,E[t]=I,i=0;i<I;++i)A[i+C]=t;C+=I}var R=p.groupsPerChain,L=0;for(t=0,e=c;t<e;++t){var O=R[t];for(M[t]=L,P[t]=O,i=0;i<O;++i)_[i+L]=t;L+=O}var D=0,k=0;for(t=0,e=s;t<e;++t){var F=(n=p.groupList[p.groupTypeList[t]]).atomNameList.length,B=n.bondAtomList,z=n.bondOrderList;for(i=0,r=z.length;i<r;++i)v[k]=D+B[2*i],y[k]=D+B[2*i+1],b[k]=z[i],k+=1;for(w[t]=D,S[t]=F,i=0;i<F;++i)x[D]=t,D+=1}var U=p.bondAtomList;if(U)for(p.bondOrderList&&b.set(p.bondOrderList,k),t=0,e=U.length;t<e;t+=2){var j=U[t],G=U[t+1];j<a&&G<a&&(v[k]=j,y[k]=G,k+=1)}l.bondStore.length=b.length,l.bondStore.count=k,l.bondStore.atomIndex1=v,l.bondStore.atomIndex2=y,l.bondStore.bondOrder=b,l.atomStore.length=a,l.atomStore.count=a,l.atomStore.residueIndex=x,l.atomStore.atomTypeId=new Uint16Array(a),l.atomStore.x=p.xCoordList.subarray(0,a),l.atomStore.y=p.yCoordList.subarray(0,a),l.atomStore.z=p.zCoordList.subarray(0,a),l.atomStore.serial=p.atomIdList.subarray(0,a),l.atomStore.bfactor=p.bFactorList.subarray(0,a),l.atomStore.altloc=p.altLocList.subarray(0,a),l.atomStore.occupancy=p.occupancyList.subarray(0,a),l.residueStore.length=s,l.residueStore.count=s,l.residueStore.chainIndex=_,l.residueStore.residueTypeId=p.groupTypeList,l.residueStore.atomOffset=w,l.residueStore.atomCount=S,l.residueStore.resno=p.groupIdList.subarray(0,s),l.residueStore.sstruc=p.secStructList.subarray(0,s),l.residueStore.inscode=p.insCodeList.subarray(0,s),l.chainStore.length=c,l.chainStore.count=c,l.chainStore.entityIndex=new Uint16Array(c),l.chainStore.modelIndex=A,l.chainStore.residueOffset=M,l.chainStore.residueCount=P,l.chainStore.chainname=p.chainNameList.subarray(0,4*c),l.chainStore.chainid=p.chainIdList.subarray(0,4*c),l.modelStore.length=u,l.modelStore.count=u,l.modelStore.chainOffset=T,l.modelStore.chainCount=E;var V={};for(t=0,e=p.groupList.length;t<e;++t){var $=p.groupList[t],H=[];for(i=0,r=$.atomNameList.length;i<r;++i){var W=$.elementList[i].toUpperCase(),X=$.atomNameList[i];H.push(l.atomMap.add(X,W))}var q=$.chemCompType.toUpperCase(),Y=ll.includes(q),Z=$.bondOrderList.length,K=new Array(Z),Q=new Array(Z);for(i=0;i<Z;++i)K[i]=$.bondAtomList[2*i],Q[i]=$.bondAtomList[2*i+1];var J={atomIndices1:K,atomIndices2:Q,bondOrders:$.bondOrderList};V[t]=l.residueMap.add($.groupName,H,Y,q,J)}for(t=0,e=s;t<e;++t)l.residueStore.residueTypeId[t]=V[l.residueStore.residueTypeId[t]];for(t=0,e=l.atomStore.count;t<e;++t){var tt=l.atomStore.residueIndex[t],et=l.residueMap.list[l.residueStore.residueTypeId[tt]],it=l.residueStore.atomOffset[tt];l.atomStore.atomTypeId[t]=et.atomTypeIdList[t-it]}if(p.secStructList){var rt=p.secStructList.length;for(t=0,e=l.residueStore.count;t<e;++t){var nt=lv[l.residueStore.sstruc[t%rt]];void 0!==nt&&(l.residueStore.sstruc[t]=nt)}}if(p.entityList&&p.entityList.forEach((function(t,e){l.entityList[e]=new Ng(l,e,t.description,t.type,t.chainIndexList)})),p.bioAssemblyList&&p.bioAssemblyList.forEach((function(t,e){var i=e+1,r=new Rp(i);l.biomolDict["BU"+i]=r;var n={};t.transformList.forEach((function(t){var e=(new N).fromArray(t.matrix).transpose(),i=t.chainIndexList.map((function(t){for(var e="",i=0;i<4;++i){var r=p.chainNameList[4*t+i];if(!r)break;e+=String.fromCharCode(r)}return e})),o=n[i];o?o.matrixList.push(e):n[i]=r.addPart([e],i)}))})),p.ncsOperatorList){var ot=new Rp("NCS"),at=ot.addPart();p.ncsOperatorList.forEach((function(t){var e=(new N).fromArray(t).transpose();at.matrixList.push(e)})),at.matrixList.length>0&&(l.biomolDict.NCS=ot)}var st=p.unitCell;st&&Array.isArray(st)&&st[0]?l.unitcell=new kg({a:st[0],b:st[1],c:st[2],alpha:st[3],beta:st[4],gamma:st[5],spacegroup:p.spaceGroup}):l.unitcell=void 0,Vp(l,!0),Gp(l,!0),l.finalizeAtoms(),l.finalizeBonds(),$p(l),gc&&mc.timeEnd("MmtfParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("mmtf",pv);var dv=/\s+/,fv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"mol2"},e.prototype._parse=function(){gc&&mc.time("Mol2Parser._parse "+this.name);var t,e,i=this.structure,r=this.structureBuilder,n=this.firstModelOnly,o=this.asTrajectory,a=i.frames,s=!1,c=i.atomMap,u=i.atomStore;u.resize(Math.round(this.streamer.data.length/60));var h=0,l=0,p=0,d=-1,f=0,m=0,g=i.getAtomProxy(),v=i.getAtomProxy(),y={1:1,2:2,3:3,am:1,ar:1,du:1,un:1,nc:0};this.streamer.eachChunkOfLines((function(b){!function(b,x,_){for(var w,S=b;S<x;++S){var A=_[S].trim();if(""!==A&&"#"!==A[0])if("@"===A[0])"@<TRIPOS>MOLECULE"===A?(m=1,l=0,++d):"@<TRIPOS>ATOM"===A?(m=2,p=u.count,o&&(e=0,t=new Float32Array(3*f),a.push(t),d>0&&(s=!0))):m="@<TRIPOS>BOND"===A?3:0;else if(1===m)0===l?(i.title=A,i.id=A):1===l&&(w=A.split(dv),f=parseInt(w[0])),++l;else if(2===m){if(w=A.split(dv),n&&d>0)continue;var M=parseFloat(w[2]),P=parseFloat(w[3]),T=parseFloat(w[4]);if(o){var E=3*e;if(t[E+0]=M,t[E+1]=P,t[E+2]=T,e+=1,s)continue}var C=w[0],I=w[1],R=w[5].split(".")[0],L=w[6]?parseInt(w[6]):1,O=w[7]?w[7]:"",N=w[8]?parseFloat(w[8]):0;u.growIfFull(),u.atomTypeId[h]=c.add(I,R),u.x[h]=M,u.y[h]=P,u.z[h]=T,u.serial[h]=C,u.bfactor[h]=N,r.addAtom(d,"","",O,L,1),h+=1}else if(3===m){if(n&&d>0)continue;if(o&&d>0)continue;w=A.split(dv),g.index=parseInt(w[1])-1+p,v.index=parseInt(w[2])-1+p;var D=y[w[3]];i.bondStore.addBond(g,v,D)}}}(0,b.length,b)})),r.finalize(),i.finalizeAtoms(),Up(i),Gp(i,!0),Vp(i,!0),i.finalizeBonds(),qp(i),zp(i),gc&&mc.timeEnd("Mol2Parser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("mol2",fv);var mv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"pqr"},Object.defineProperties(e.prototype,i),e}(Bg);_c.add("pqr",mv);var gv=/\s+/,vv=/(^\*|REMARK)*/,yv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"psf"},e.prototype._parse=function(){gc&&mc.time("PsfParser._parse "+this.name);var t,e,i,r,n=this.structure,o=this.structureBuilder,a=n.atomMap,s=n.atomStore,c=[],u=0,h=0;this.streamer.eachChunkOfLines((function(n){!function(n,l,p){for(var d=n;d<l;++d){var f=p[d].trim();if(f)if(2===t){var m=f.split(gv),g=parseInt(m[0]),v=parseInt(m[2]),y=m[3],b=m[4];s.growIfFull(),s.atomTypeId[u]=a.add(b),s.serial[u]=g,o.addAtom(0,"","",y,v,1),u+=1}else if(3===t)for(var x=f.split(gv),_=0,w=x.length;_<w;_+=2)e[h]=parseInt(x[_])-1,i[h]=parseInt(x[_+1])-1,r[h]=1,h+=1;else if(1===t)c.push(f.replace(vv,"").trim());else if(4===t);else if(5===t);else if(6===t);else if(f.includes("!NATOM")){t=2;var S=parseInt(f.split(gv)[0]);s.resize(S)}else if(f.includes("!NBOND")){t=3;var A=parseInt(f.split(gv)[0]);e=new Uint32Array(A),i=new Uint32Array(A),r=new Uint8Array(A)}else f.includes("!NTITLE")?t=1:f.includes("!NTHETA")?t=4:f.includes("!NPHI")?t=5:f.includes("!NIMPHI")&&(t=6);else t=void 0}}(0,n.length,n)})),n.title=c.join(" "),n.bondStore.length=r.length,n.bondStore.count=h,n.bondStore.atomIndex1=e,n.bondStore.atomIndex2=i,n.bondStore.bondOrder=r,o.finalize(),n.finalizeAtoms(),Up(n),n.finalizeBonds(),qp(n),gc&&mc.timeEnd("PsfParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("psf",yv);var bv=/> <(.+)>/,xv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"sdf"},e.prototype._parse=function(){gc&&mc.time("SdfParser._parse "+this.name);var t=this.structure,e=this.structureBuilder,i=this.firstModelOnly,r=this.asTrajectory,n=this.streamer.peekLines(2);t.id=n[0].trim(),t.title=n[1].trim();var o,a,s=t.frames,c=!1,u=t.atomMap,h=t.atomStore;h.resize(Math.round(this.streamer.data.length/50));var l,p,d,f,m,g,v,y=t.getAtomProxy(),b=t.getAtomProxy(),x=0,_=0,w=0,S=0,A=[],M=!1,P={};t.extraData.sdf=A,this.streamer.eachChunkOfLines((function(n){!function(n,T,E){for(var C=n;C<T;++C){var I=E[C];if("$$$$"===I.substr(0,4))_=-1,++w,S=h.count,A.push(P),P={},M=!1;else if(3===_)p=parseInt(I.substr(0,3)),d=parseInt(I.substr(3,3)),v=(g=m=(f=4)+p)+d,r&&(a=0,o=new Float32Array(3*p),s.push(o),w>0&&(c=!0));else if(_>=f&&_<m){if(i&&w>0)continue;var R=parseFloat(I.substr(0,10)),L=parseFloat(I.substr(10,10)),O=parseFloat(I.substr(20,10));if(r){var N=3*a;if(o[N+0]=R,o[N+1]=L,o[N+2]=O,a+=1,c)continue}var D=I.substr(31,3).trim(),k=D+(x+1);h.growIfFull(),h.atomTypeId[x]=u.add(k,D),h.x[x]=R,h.y[x]=L,h.z[x]=O,h.serial[x]=x,e.addAtom(w,"","","HET",1,1),x+=1}else if(_>=g&&_<v){if(i&&w>0)continue;if(r&&w>0)continue;y.index=parseInt(I.substr(0,3))-1+S,b.index=parseInt(I.substr(3,3))-1+S;var F=parseInt(I.substr(6,3));t.bondStore.addBond(y,b,F)}else(l=I.match(bv))?(M=l[1],P[M]=[]):!1!==M&&I&&P[M].push(I);++_}}(0,n.length,n)})),e.finalize(),t.finalizeAtoms(),t.finalizeBonds(),qp(t),gc&&mc.timeEnd("SdfParser._parse "+this.name)},e.prototype._postProcess=function(){qp(this.structure)},Object.defineProperties(e.prototype,i),e}(Og);_c.add("sdf",xv),_c.add("sd",xv);var _v=function(t,e){this.name=t,this.path=e,this.coordinates=[],this.boxes=[]},wv={type:{}};wv.type.get=function(){return"Frames"},Object.defineProperties(_v.prototype,wv);var Sv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"dcd"},e.prototype._parse=function(){gc&&mc.time("DcdParser._parse "+this.name);var t=this.streamer.data;t instanceof Uint8Array&&(t=t.buffer);var e,i,r=new DataView(t),n=this.frames,o=n.coordinates,a=n.boxes,s={},c=0,u=new Int32Array(t,0,23),h=u[0]!==r.getInt32(0);if(84!==u[0])for(i=t.byteLength,e=0;e<i;e+=4)r.setFloat32(e,r.getFloat32(e),!0);84!==u[0]&&mc.error("dcd bad format, header block start"),"CORD"!==String.fromCharCode(r.getUint8(4),r.getUint8(5),r.getUint8(6),r.getUint8(7))&&mc.error("dcd bad format, format string");var l=!1,p=!1,d=!1;0!==u[22]&&(l=!0,0!==u[12]&&(p=!0),1===u[13]&&(d=!0)),s.NSET=u[2],s.ISTART=u[3],s.NSAVC=u[4],s.NAMNF=u[10],s.DELTA=l?r.getFloat32(44,h):r.getFloat64(44,h),84!==u[22]&&mc.error("dcd bad format, header block end"),c=c+84+8;var f=r.getInt32(c,h),m=c+1;if((f-4)%80!=0&&mc.error("dcd bad format, title block start"),s.TITLE=Fo(new Uint8Array(t,m,f)),r.getInt32(m+f+4-1,h)!==f&&mc.error("dcd bad format, title block end"),c=c+f+8,4!==r.getInt32(c,h)&&mc.error("dcd bad format, natom block start"),s.NATOM=r.getInt32(c+4,h),4!==r.getInt32(c+8,h)&&mc.error("dcd bad format, natom block end"),c=c+4+8,s.NAMNF>0)mc.error("dcd format with fixed atoms unsupported, aborting");else{var g=s.NATOM,v=4*g;for(e=0,i=s.NSET;e<i;++e){if(p){c+=4;var y=new Float32Array(9);y[0]=r.getFloat64(c,h),y[4]=r.getFloat64(c+16,h),y[8]=r.getFloat64(c+40,h),a.push(y),c+=48,c+=4}for(var b=new Float32Array(3*g),x=0;x<3;++x){r.getInt32(c,h)!==v&&mc.error("dcd bad format, coord block start",e,x),c+=4;for(var _=new Float32Array(t,c,g),w=0;w<g;++w)b[3*w+x]=_[w];c+=v,r.getInt32(c,h)!==v&&mc.error("dcd bad format, coord block end",e,x),c+=4}if(o.push(b),d)c+=4+r.getInt32(c,h)+4}gc&&mc.timeEnd("DcdParser._parse "+this.name)}},Object.defineProperties(e.prototype,i),e}(function(t){function e(e,i){t.call(this,e,i),this.frames=new _v(this.name,this.path)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"trajectory"},i.__objName.get=function(){return"frames"},Object.defineProperties(e.prototype,i),e}(Ig));_c.add("dcd",Sv);var Av=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.volume=new lp(this.name,this.path),this.voxelSize=Eo(r.voxelSize,1)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"volume"},i.__objName.get=function(){return"volume"},e.prototype._afterParse=function(){this.volume.setMatrix(this.getMatrix())},e.prototype.getMatrix=function(){return new N},Object.defineProperties(e.prototype,i),e}(Ig),Mv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"cube"},e.prototype._parse=function(){gc&&mc.time("CubeParser._parse "+this.name);var t=this.volume,e=this.streamer.peekLines(6),i={},r=/\s+/,n=.529177210859*this.voxelSize;function o(t,i){var n=e[t].trim().split(r)[i];return parseFloat(n)}i.atomCount=Math.abs(o(2,0)),i.originX=.529177210859*o(2,1),i.originY=.529177210859*o(2,2),i.originZ=.529177210859*o(2,3),i.NVX=o(3,0),i.NVY=o(4,0),i.NVZ=o(5,0),i.basisX=new O(o(3,1),o(3,2),o(3,3)).multiplyScalar(n),i.basisY=new O(o(4,1),o(4,2),o(4,3)).multiplyScalar(n),i.basisZ=new O(o(5,1),o(5,2),o(5,3)).multiplyScalar(n);var a=new Float32Array(i.NVX*i.NVY*i.NVZ),s=0,c=0,u=o(2,0)>0?0:1;this.streamer.eachChunkOfLines((function(t){!function(t,e,n){for(var o=t;o<e;++o){var h=n[o].trim();if(""!==h&&c>=i.atomCount+6+u)for(var l=0,p=(h=h.split(r)).length;l<p;++l)1!==h.length&&(a[s]=parseFloat(h[l]),++s);++c}}(0,t.length,t)})),t.header=i,t.setData(a,i.NVZ,i.NVY,i.NVX),gc&&mc.timeEnd("CubeParser._parse "+this.name)},e.prototype.getMatrix=function(){var t=this.volume.header,e=new N;return e.multiply((new N).makeTranslation(t.originX,t.originY,t.originZ)),e.multiply((new N).makeBasis(t.basisZ,t.basisY,t.basisX)),e},Object.defineProperties(e.prototype,i),e}(Av);_c.add("cub",Mv),_c.add("cube",Mv);var Pv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"dsn6"},e.prototype._parse=function(){gc&&mc.time("Dsn6Parser._parse "+this.name);var t=this.streamer.data;t instanceof Uint8Array&&(t=t.buffer);var e,i,r=this.volume,n={},o=new Int16Array(t),a=new Uint8Array(t),s=String.fromCharCode.apply(null,a.subarray(0,512));if(s.startsWith(":-)"))n.xStart=parseInt(s.substr(10,5)),n.yStart=parseInt(s.substr(15,5)),n.zStart=parseInt(s.substr(20,5)),n.xExtent=parseInt(s.substr(32,5)),n.yExtent=parseInt(s.substr(38,5)),n.zExtent=parseInt(s.substr(42,5)),n.xRate=parseInt(s.substr(52,5)),n.yRate=parseInt(s.substr(58,5)),n.zRate=parseInt(s.substr(62,5)),n.xlen=parseFloat(s.substr(73,10))*this.voxelSize,n.ylen=parseFloat(s.substr(83,10))*this.voxelSize,n.zlen=parseFloat(s.substr(93,10))*this.voxelSize,n.alpha=parseFloat(s.substr(103,10)),n.beta=parseFloat(s.substr(113,10)),n.gamma=parseFloat(s.substr(123,10)),e=parseFloat(s.substr(138,12))/100,i=parseInt(s.substr(155,8));else{if(100!==o[18])for(var c=0,u=o.length;c<u;++c){var h=o[c];o[c]=(255&h)<<8|h>>8&255}n.xStart=o[0],n.yStart=o[1],n.zStart=o[2],n.xExtent=o[3],n.yExtent=o[4],n.zExtent=o[5],n.xRate=o[6],n.yRate=o[7],n.zRate=o[8];var l=1/o[17],p=l*this.voxelSize;n.xlen=o[9]*p,n.ylen=o[10]*p,n.zlen=o[11]*p,n.alpha=o[12]*l,n.beta=o[13]*l,n.gamma=o[14]*l,e=o[15]/100,i=o[16]}r.header=n,mc.log(n,e,i);for(var d=new Float32Array(n.xExtent*n.yExtent*n.zExtent),f=512,m=Math.ceil(n.xExtent/8),g=Math.ceil(n.yExtent/8),v=Math.ceil(n.zExtent/8),y=0;y<v;++y)for(var b=0;b<g;++b)for(var x=0;x<m;++x)for(var _=0;_<8;++_)for(var w=8*y+_,S=0;S<8;++S)for(var A=8*b+S,M=0;M<8;++M){var P=8*x+M;if(!(P<n.xExtent&&A<n.yExtent&&w<n.zExtent)){f+=8-M;break}d[(P*n.yExtent+A)*n.zExtent+w]=(a[f]-i)/e,++f}r.setData(d,n.zExtent,n.yExtent,n.xExtent),gc&&mc.timeEnd("Dsn6Parser._parse "+this.name)},e.prototype.getMatrix=function(){var t=this.volume.header,e=[t.xlen,0,0],i=[t.ylen*Math.cos(Math.PI/180*t.gamma),t.ylen*Math.sin(Math.PI/180*t.gamma),0],r=[t.zlen*Math.cos(Math.PI/180*t.beta),t.zlen*(Math.cos(Math.PI/180*t.alpha)-Math.cos(Math.PI/180*t.gamma)*Math.cos(Math.PI/180*t.beta))/Math.sin(Math.PI/180*t.gamma),0];r[2]=Math.sqrt(t.zlen*t.zlen*Math.sin(Math.PI/180*t.beta)*Math.sin(Math.PI/180*t.beta)-r[1]*r[1]);var n=[0,e,i,r],o=[0,t.xRate,t.yRate,t.zRate],a=[0,1,2,3],s=new N;return s.set(n[a[1]][0]/o[a[1]],n[a[2]][0]/o[a[2]],n[a[3]][0]/o[a[3]],0,n[a[1]][1]/o[a[1]],n[a[2]][1]/o[a[2]],n[a[3]][1]/o[a[3]],0,n[a[1]][2]/o[a[1]],n[a[2]][2]/o[a[2]],n[a[3]][2]/o[a[3]],0,0,0,0,1),s.multiply((new N).makeRotationY(Qo(90))),s.multiply((new N).makeTranslation(-t.zStart,t.yStart,t.xStart)),s.multiply((new N).makeScale(-1,1,1)),s},Object.defineProperties(e.prototype,i),e}(Av);_c.add("dsn6",Pv),_c.add("brix",Pv);var Tv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"dx"},e.prototype._parse=function(){gc&&mc.time("DxParser._parse "+this.name);var t=this.volume,e=this.streamer.peekLines(30),i=this.parseHeaderLines(e),r=this.volume.header,n=i.dataLineStart,o=/\s+/,a=r.nx*r.ny*r.nz,s=new Float32Array(a),c=0,u=0;this.streamer.eachChunkOfLines((function(t){!function(t,e,i){for(var r=t;r<e;++r){if(c<a&&u>n){var h=i[r].trim();if(""!==h)for(var l=h.split(o),p=0,d=l.length;p<d;++p)s[c]=parseFloat(l[p]),++c}++u}}(0,t.length,t)})),t.setData(s,r.nz,r.ny,r.nx),gc&&mc.timeEnd("DxParser._parse "+this.name)},e.prototype.parseHeaderLines=function(t){for(var e={},i=/\s+/,r=t.length,n=0,o=0,a=0,s=0;s<r;++s){var c,u=t[s];if(u.startsWith("object 1"))c=u.split(i),e.nx=parseInt(c[5]),e.ny=parseInt(c[6]),e.nz=parseInt(c[7]);else if(u.startsWith("origin"))c=u.split(i),e.xmin=parseFloat(c[1]),e.ymin=parseFloat(c[2]),e.zmin=parseFloat(c[3]);else if(u.startsWith("delta"))c=u.split(i),0===a?e.hx=parseFloat(c[1])*this.voxelSize:1===a?e.hy=parseFloat(c[2])*this.voxelSize:2===a&&(e.hz=parseFloat(c[3])*this.voxelSize),a+=1;else if(u.startsWith("object 3")){n=s,o+=u.length+1;break}o+=u.length+1}return this.volume.header=e,{dataLineStart:n,headerByteCount:o}},e.prototype.getMatrix=function(){var t=this.volume.header,e=new N;return e.multiply((new N).makeRotationY(Qo(90))),e.multiply((new N).makeTranslation(-t.zmin,t.ymin,t.xmin)),e.multiply((new N).makeScale(-t.hz,t.hy,t.hx)),e},Object.defineProperties(e.prototype,i),e}(Av);_c.add("dx",Tv);var Ev=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"dxbin"},e.prototype._parse=function(){gc&&mc.time("DxbinParser._parse "+this.name);var t=this.streamer.data;t instanceof Uint8Array&&(t=t.buffer);for(var e=function(t,e,i){e=void 0!==e?e:10485760,i=void 0!==i?i:"\n";for(var r="",n=[],o=0;o<t.length;o+=e){var a=Fo(t.subarray(o,o+e)),s=a.lastIndexOf(i);if(-1===s)r+=a;else{var c=r+a.substr(0,s);n=n.concat(c.split(i)),r=s===a.length-i.length?"":a.substr(s+i.length)}}return""!==r&&n.push(r),n}(new Uint8Array(t,0,1e3)),i=this.parseHeaderLines(e),r=this.volume.header,n=i.headerByteCount,o=r.nx*r.ny*r.nz,a=new DataView(t),s=new Float32Array(o),c=0;c<o;++c)s[c]=a.getFloat64(8*c+n,!0);this.volume.setData(s,r.nz,r.ny,r.nx),gc&&mc.timeEnd("DxbinParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Tv);_c.add("dxbin",Ev);var Cv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"mrc"},e.prototype._parse=function(){gc&&mc.time("MrcParser._parse "+this.name);var t=this.streamer.data;t instanceof Uint8Array&&(t=t.buffer);var e,i=this.volume,r={},n=new Int32Array(t,0,56),o=new Float32Array(t,0,56),a=new DataView(t);if(r.MAP=String.fromCharCode(a.getUint8(208),a.getUint8(209),a.getUint8(210),a.getUint8(211)),r.MACHST=[a.getUint8(212),a.getUint8(213)],17===r.MACHST[0]&&17===r.MACHST[1])for(var s=t.byteLength,c=0;c<s;c+=4)a.setFloat32(c,a.getFloat32(c),!0);if(r.NX=n[0],r.NY=n[1],r.NZ=n[2],r.MODE=n[3],r.NXSTART=n[4],r.NYSTART=n[5],r.NZSTART=n[6],r.MX=n[7],r.MY=n[8],r.MZ=n[9],r.xlen=o[10]*this.voxelSize,r.ylen=o[11]*this.voxelSize,r.zlen=o[12]*this.voxelSize,r.alpha=o[13],r.beta=o[14],r.gamma=o[15],r.MAPC=n[16],r.MAPR=n[17],r.MAPS=n[18],r.DMIN=o[19],r.DMAX=o[20],r.DMEAN=o[21],r.ISPG=n[22],r.NSYMBT=n[23],r.LSKFLG=n[24],r.originX=o[49],r.originY=o[50],r.originZ=o[51],r.ARMS=o[54],i.header=r,2===r.MODE)e=new Float32Array(t,1024+r.NSYMBT,r.NX*r.NY*r.NZ);else if(0===r.MODE){if(e=new Float32Array(new Int8Array(t,1024+r.NSYMBT,r.NX*r.NY*r.NZ)),-128===n[39]&&127===n[40])for(var u=(r.DMAX-r.DMIN)/255,h=.5*(r.DMIN+r.DMAX+u),l=0,p=e.length;l<p;++l)e[l]=u*e[l]+h}else mc.error("MrcParser unknown mode",r.MODE);i.setData(e,r.NX,r.NY,r.NZ),gc&&mc.timeEnd("MrcParser._parse "+this.name)},e.prototype.getMatrix=function(){var t=this.volume.header,e=[t.xlen,0,0],i=[t.ylen*Math.cos(Math.PI/180*t.gamma),t.ylen*Math.sin(Math.PI/180*t.gamma),0],r=[t.zlen*Math.cos(Math.PI/180*t.beta),t.zlen*(Math.cos(Math.PI/180*t.alpha)-Math.cos(Math.PI/180*t.gamma)*Math.cos(Math.PI/180*t.beta))/Math.sin(Math.PI/180*t.gamma),0];r[2]=Math.sqrt(t.zlen*t.zlen*Math.sin(Math.PI/180*t.beta)*Math.sin(Math.PI/180*t.beta)-r[1]*r[1]);var n=[0,e,i,r],o=[0,t.MX,t.MY,t.MZ],a=[0,t.MAPC,t.MAPR,t.MAPS],s=new N;return s.set(n[a[1]][0]/o[a[1]],n[a[2]][0]/o[a[2]],n[a[3]][0]/o[a[3]],0,n[a[1]][1]/o[a[1]],n[a[2]][1]/o[a[2]],n[a[3]][1]/o[a[3]],0,n[a[1]][2]/o[a[1]],n[a[2]][2]/o[a[2]],n[a[3]][2]/o[a[3]],0,0,0,0,1),s.setPosition(new O(t.originX,t.originY,t.originZ)),s.multiply((new N).makeTranslation(t.NXSTART,t.NYSTART,t.NZSTART)),s},Object.defineProperties(e.prototype,i),e}(Av);_c.add("mrc",Cv),_c.add("ccp4",Cv),_c.add("map",Cv);var Iv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"xplor"},e.prototype._parse=function(){gc&&mc.time("XplorParser._parse "+this.name);var t,e=this.volume,i=this.streamer.peekLines(8),r={},n=/\s+/;function o(t){return t.trim().split(n).map(parseFloat)}var a=(t=i[2].startsWith("REMARKS")?parseInt(i[1].substring(0,8))+2:5)+3,s=o(i[t]);r.NA=s[0],r.AMIN=s[1],r.AMAX=s[2],r.NB=s[3],r.BMIN=s[4],r.BMAX=s[5],r.NC=s[6],r.CMIN=s[7],r.CMAX=s[8];var c=o(i[t+1]);r.a=c[0]*this.voxelSize,r.b=c[1]*this.voxelSize,r.c=c[2]*this.voxelSize,r.alpha=c[3],r.beta=c[4],r.gamma=c[5];var u=r.AMAX-r.AMIN+1,h=r.BMAX-r.BMIN+1,l=r.CMAX-r.CMIN+1,p=u*h*l,d=new Float32Array(p),f=0,m=0,g=1+u*h/6;this.streamer.eachChunkOfLines((function(t){!function(t,e,i){for(var r=t;r<e;++r){var n=i[r];if(m>=a&&(m-a)%g!=0&&f<p)for(var o=0;o<6;++o)d[f]=parseFloat(n.substr(12*o,12)),++f;++m}}(0,t.length,t)})),e.header=r,e.setData(d,u,h,l),gc&&mc.timeEnd("XplorParser._parse "+this.name)},e.prototype.getMatrix=function(){var t=this.volume.header,e=[t.a,0,0],i=[t.b*Math.cos(Math.PI/180*t.gamma),t.b*Math.sin(Math.PI/180*t.gamma),0],r=[t.c*Math.cos(Math.PI/180*t.beta),t.c*(Math.cos(Math.PI/180*t.alpha)-Math.cos(Math.PI/180*t.gamma)*Math.cos(Math.PI/180*t.beta))/Math.sin(Math.PI/180*t.gamma),0];r[2]=Math.sqrt(t.c*t.c*Math.sin(Math.PI/180*t.beta)*Math.sin(Math.PI/180*t.beta)-r[1]*r[1]);var n=[0,e,i,r],o=[0,t.NA,t.NB,t.NC],a=[0,1,2,3],s=new N;return s.set(n[a[1]][0]/o[a[1]],n[a[2]][0]/o[a[2]],n[a[3]][0]/o[a[3]],0,n[a[1]][1]/o[a[1]],n[a[2]][1]/o[a[2]],n[a[3]][1]/o[a[3]],0,n[a[1]][2]/o[a[1]],n[a[2]][2]/o[a[2]],n[a[3]][2]/o[a[3]],0,0,0,0,1),s.multiply((new N).makeTranslation(t.AMIN,t.BMIN,t.CMIN)),s},Object.defineProperties(e.prototype,i),e}(Av);_c.add("xplor",Iv),_c.add("cns",Iv);var Rv=function(t){function e(e,i){t.call(this,e,i),this.loader=this.getLoader(),this.surface=new cp(this.name,this.path)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"surface"},i.__objName.get=function(){return"surface"},e.prototype._parse=function(){var t=this.loader.parse(this.streamer.asText());this.surface.fromGeometry(t)},Object.defineProperties(e.prototype,i),e}(Ig);function Lv(){this.regexp={vertex_pattern:/^v\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)/,normal_pattern:/^vn\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)/,uv_pattern:/^vt\s+([\d|.|+|\-|e|E]+)\s+([\d|.|+|\-|e|E]+)/,face_vertex:/^f\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)(?:\s+(-?\d+))?/,face_vertex_uv:/^f\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+))?/,face_vertex_uv_normal:/^f\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+)\/(-?\d+))?/,face_vertex_normal:/^f\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)(?:\s+(-?\d+)\/\/(-?\d+))?/,object_pattern:/^[og]\s*(.+)?/,smoothing_pattern:/^s\s+(\d+|on|off)/,material_library_pattern:/^mtllib /,material_use_pattern:/^usemtl /}}Lv.prototype={constructor:Lv,setPath:function(t){this.path=t},_createParserState:function(){var t={objects:[],object:{},vertices:[],normals:[],startObject:function(t,e){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=t,void(this.object.fromDeclaration=!1!==e);this.object={name:t||"",geometry:{vertices:[],normals:[]},fromDeclaration:!1!==e},this.objects.push(this.object)},parseVertexIndex:function(t,e){var i=parseInt(t,10);return 3*(i>=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 r=this.vertices,n=this.object.geometry.vertices;n.push(r[t+0]),n.push(r[t+1]),n.push(r[t+2]),n.push(r[e+0]),n.push(r[e+1]),n.push(r[e+2]),n.push(r[i+0]),n.push(r[i+1]),n.push(r[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 r=this.normals,n=this.object.geometry.normals;n.push(r[t+0]),n.push(r[t+1]),n.push(r[t+2]),n.push(r[e+0]),n.push(r[e+1]),n.push(r[e+2]),n.push(r[i+0]),n.push(r[i+1]),n.push(r[i+2])},addFace:function(t,e,i,r,n,o,a,s){var c,u=this.vertices.length,h=this.parseVertexIndex(t,u),l=this.parseVertexIndex(e,u),p=this.parseVertexIndex(i,u);if(void 0===r?this.addVertex(h,l,p):(c=this.parseVertexIndex(r,u),this.addVertex(h,l,c),this.addVertex(l,p,c)),void 0!==n){var d=this.normals.length;h=this.parseNormalIndex(n,d),l=n===o?h:this.parseNormalIndex(o,d),p=n===a?h:this.parseNormalIndex(a,d),void 0===r?this.addNormal(h,l,p):(c=this.parseNormalIndex(s,d),this.addNormal(h,l,c),this.addNormal(l,p,c))}},addLineGeometry:function(t){this.object.geometry.type="Line";for(var e=this.vertices.length,i=0,r=t.length;i<r;i++)this.addVertexLine(this.parseVertexIndex(t[i],e))}};return t.startObject("",!1),t},parse:function(t){var e,i,r=this._createParserState();-1!==t.indexOf("\r\n")&&(t=t.replace(/\r\n/g,"\n")),-1!==t.indexOf("\\\n")&&(t=t.replace(/\\\n/g,""));var n=t.split("\n"),o="",a="",s="",c=[],u="function"==typeof"".trimLeft;for(e=0,i=n.length;e<i;e++)if(o=n[e],0!==(o=u?o.trimLeft():o.trim()).length&&"#"!==(a=o.charAt(0)))if("v"===a){if(" "===(s=o.charAt(1))&&null!==(c=this.regexp.vertex_pattern.exec(o)))r.vertices.push(parseFloat(c[1]),parseFloat(c[2]),parseFloat(c[3]));else if("n"===s&&null!==(c=this.regexp.normal_pattern.exec(o)))r.normals.push(parseFloat(c[1]),parseFloat(c[2]),parseFloat(c[3]));else if("t"!==s||null===(c=this.regexp.uv_pattern.exec(o)))throw new Error("Unexpected vertex/normal/uv line: '"+o+"'")}else if("f"===a)if(null!==(c=this.regexp.face_vertex_uv_normal.exec(o)))r.addFace(c[1],c[4],c[7],c[10],c[3],c[6],c[9],c[12]);else if(null!==(c=this.regexp.face_vertex_uv.exec(o)));else if(null!==(c=this.regexp.face_vertex_normal.exec(o)))r.addFace(c[1],c[3],c[5],c[7],c[2],c[4],c[6],c[8]);else{if(null===(c=this.regexp.face_vertex.exec(o)))throw new Error("Unexpected face line: '"+o+"'");r.addFace(c[1],c[2],c[3],c[4])}else if("l"===a){var h=o.substring(1).trim().split(" "),l=[],p=[];if(-1===o.indexOf("/"))l=h;else for(var d=0,f=h.length;d<f;d++){var m=h[d].split("/");""!==m[0]&&l.push(m[0]),""!==m[1]&&p.push(m[1])}r.addLineGeometry(l,p)}else if(null!==(c=this.regexp.object_pattern.exec(o))){var g=c[0].substr(1).trim();r.startObject(g)}else if(this.regexp.material_use_pattern.test(o));else if(this.regexp.material_library_pattern.test(o));else if(null===(c=this.regexp.smoothing_pattern.exec(o))){if("\0"===o)continue;throw new Error("Unexpected line: '"+o+"'")}var v=[];for(e=0,i=r.objects.length;e<i;e++){var y=r.objects[e].geometry;if(0!==y.vertices.length){var b=new _e;b.addAttribute("position",new me(new Float32Array(y.vertices),3)),y.normals.length>0?b.addAttribute("normal",new me(new Float32Array(y.normals),3)):b.computeVertexNormals(),v.push(b)}}return v}};var Ov=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"obj"},e.prototype.getLoader=function(){return new Lv},Object.defineProperties(e.prototype,i),e}(Rv);function Nv(){this.propertyNameMapping={}}_c.add("obj",Ov),Nv.prototype={constructor:Nv,setPropertyNameMapping:function(t){this.propertyNameMapping=t},bin2str:function(t){for(var e=new Uint8Array(t),i="",r=0;r<t.byteLength;r++)i+=String.fromCharCode(e[r]);return i},isASCII:function(t){return"ascii"===this.parseHeader(this.bin2str(t)).format},parse:function(t){return t instanceof ArrayBuffer?this.isASCII(t)?this.parseASCII(this.bin2str(t)):this.parseBinary(t):this.parseASCII(t)},parseHeader:function(t){var e="",i=0,r=/ply([\s\S]*)end_header\s/.exec(t);null!==r&&(e=r[1],i=r[0].length);var n,o,a,s,c,u,h={comments:[],elements:[],headerLength:i},l=e.split("\n");for(var p=0;p<l.length;p++){var d=l[p];if(""!==(d=d.trim()))switch(o=(a=d.split(/\s+/)).shift(),d=a.join(" "),o){case"format":h.format=a[0],h.version=a[1];break;case"comment":h.comments.push(d);break;case"element":void 0!==n&&h.elements.push(n),(n={}).name=a[0],n.count=parseInt(a[1]),n.properties=[];break;case"property":n.properties.push((s=a,c=this.propertyNameMapping,u=void 0,"list"===(u={type:s[0]}).type?(u.name=s[3],u.countType=s[1],u.itemType=s[2]):u.name=s[1],u.name in c&&(u.name=c[u.name]),u));break;default:console.log("unhandled",o,a)}}return void 0!==n&&h.elements.push(n),h},parseASCIINumber:function(t,e){switch(e){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(t);case"float":case"double":case"float32":case"float64":return parseFloat(t)}},parseASCIIElement:function(t,e){for(var i=e.split(/\s+/),r={},n=0;n<t.length;n++)if("list"===t[n].type){for(var o=[],a=this.parseASCIINumber(i.shift(),t[n].countType),s=0;s<a;s++)o.push(this.parseASCIINumber(i.shift(),t[n].itemType));r[t[n].name]=o}else r[t[n].name]=this.parseASCIINumber(i.shift(),t[n].type);return r},parseASCII:function(t){var e,i=new fe,r=this.parseHeader(t),n="";null!==(e=/end_header\s([\s\S]*)$/.exec(t))&&(n=e[1]);var o=n.split("\n"),a=0,s=0;i.useColor=!1;for(var c=0;c<o.length;c++){var u=o[c];if(""!==(u=u.trim())){s>=r.elements[a].count&&(a++,s=0);var h=this.parseASCIIElement(r.elements[a].properties,u);this.handleElement(i,r.elements[a].name,h),s++}}return this.postProcess(i)},postProcess:function(t){if(t.useColor){for(var e=0;e<t.faces.length;e++)t.faces[e].vertexColors=[t.colors[t.faces[e].a],t.colors[t.faces[e].b],t.colors[t.faces[e].c]];t.elementsNeedUpdate=!0}return t.computeBoundingSphere(),t},handleElement:function(t,e,i){if("vertex"===e){if(t.vertices.push(new O(i.x,i.y,i.z)),"red"in i&&"green"in i&&"blue"in i){t.useColor=!0;var r=new St;r.setRGB(i.red/255,i.green/255,i.blue/255),t.colors.push(r)}}else if("face"===e){var n=i.vertex_indices;3===n.length?t.faces.push(new re(n[0],n[1],n[2])):4===n.length&&t.faces.push(new re(n[0],n[1],n[3]),new re(n[1],n[2],n[3]))}},binaryRead:function(t,e,i,r){switch(i){case"int8":case"char":return[t.getInt8(e),1];case"uint8":case"uchar":return[t.getUint8(e),1];case"int16":case"short":return[t.getInt16(e,r),2];case"uint16":case"ushort":return[t.getUint16(e,r),2];case"int32":case"int":return[t.getInt32(e,r),4];case"uint32":case"uint":return[t.getUint32(e,r),4];case"float32":case"float":return[t.getFloat32(e,r),4];case"float64":case"double":return[t.getFloat64(e,r),8]}},binaryReadElement:function(t,e,i,r){for(var n,o={},a=0,s=0;s<i.length;s++)if("list"===i[s].type){var c=[],u=(n=this.binaryRead(t,e+a,i[s].countType,r))[0];a+=n[1];for(var h=0;h<u;h++)n=this.binaryRead(t,e+a,i[s].itemType,r),c.push(n[0]),a+=n[1];o[i[s].name]=c}else n=this.binaryRead(t,e+a,i[s].type,r),o[i[s].name]=n[0],a+=n[1];return[o,a]},parseBinary:function(t){for(var e,i=new fe,r=this.parseHeader(this.bin2str(t)),n="binary_little_endian"===r.format,o=new DataView(t,r.headerLength),a=0,s=0;s<r.elements.length;s++)for(var c=0;c<r.elements[s].count;c++){a+=(e=this.binaryReadElement(o,a,r.elements[s].properties,n))[1];var u=e[0];this.handleElement(i,r.elements[s].name,u)}return this.postProcess(i)}};var Dv=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{}};return i.type.get=function(){return"ply"},e.prototype.getLoader=function(){return new Nv},Object.defineProperties(e.prototype,i),e}(Rv);_c.add("ply",Dv);var kv=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.delimiter=Eo(r.delimiter,","),this.comment=Eo(r.comment,"#"),this.columnNames=Eo(r.columnNames,!1),this.table={name:this.name,path:this.path,columnNames:[],data:[]}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"csv"},i.__objName.get=function(){return"table"},e.prototype._parse=function(){var t=this,e=this.table.data,i=new RegExp("\\s*"+this.delimiter+"\\s*"),r=0;this.streamer.eachChunkOfLines((function(n){for(var o=n.length,a=0;a<o;++a){var s=n[a].trim();if(!s.startsWith(t.comment)){var c=s.split(i);0===r?t.table.columnNames=c:s&&e.push(c),++r}}}))},Object.defineProperties(e.prototype,i),e}(Ig);_c.add("csv",kv);var Fv=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.string=Eo(r.string,!1),this.json={name:this.name,path:this.path,data:{}}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"json"},i.__objName.get=function(){return"json"},e.prototype._parse=function(){this.streamer.isBinary()||this.string?this.json.data=JSON.parse(this.streamer.asText()):this.json.data=this.streamer.data},Object.defineProperties(e.prototype,i),e}(Ig);_c.add("json",Fv);var Bv=function(t){function e(e,i){t.call(this,e,i),this.text={name:this.name,path:this.path,data:""}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"text"},i.__objName.get=function(){return"text"},e.prototype._parse=function(){this.text.data=this.streamer.asText()},Object.defineProperties(e.prototype,i),e}(Ig);_c.add("txt",Bv),_c.add("text",Bv);var zv=/^['"]|['"]$/g,Uv=/^<([\w-:.]+)\s*/,jv=/^([^<]*)/,Gv=/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/;function Vv(t){return t=t.trim().replace(/<!--[\s\S]*?-->/g,""),{declaration:e(),root:i()};function e(){if(n(/^<\?xml\s*/)){for(var t={attributes:{}};!o()&&!a("?>");){var e=r();if(!e)return t;t.attributes[e.name]=e.value}return n(/\?>\s*/),t}}function i(){var t=n(Uv);if(t){for(var e,s={name:t[1],attributes:{},children:[]};!(o()||a(">")||a("?>")||a("/>"));){var c=r();if(!c)return s;s.attributes[c.name]=c.value}if(n(/^\s*\/>\s*/))return s;for(n(/\??>\s*/),s.content=function(){var t=n(jv);if(t)return t[1];return""}();e=i();)s.children.push(e);return n(/^<\/[\w-:.]+>\s*/),s}}function r(){var t,e=n(Gv);if(e)return{name:e[1],value:(t=e[2],t.replace(zv,""))}}function n(e){var i=t.match(e);if(i)return t=t.slice(i[0].length),i}function o(){return 0===t.length}function a(e){return 0===t.indexOf(e)}}var $v=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.useDomParser=Eo(r.useDomParser,!1),this.xml={name:this.name,path:this.path,data:{}}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={type:{},__objName:{}};return i.type.get=function(){return"xml"},i.__objName.get=function(){return"xml"},e.prototype.__xmlParser=function(t){return Vv(t)},e.prototype.__domParser=function(t){return(new window.DOMParser).parseFromString(t,"text/xml")},e.prototype._parse=function(){gc&&mc.time("XmlParser._parse "+this.name),this.useDomParser?this.streamer.data instanceof window.Document?this.xml.data=this.streamer.data:this.xml.data=this.__domParser(this.streamer.asText()):this.xml.data=this.__xmlParser(this.streamer.asText()),gc&&mc.timeEnd("XmlParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}(Ig);function Hv(t,e,i){var r=t.icode.value,n=t.chain.value,o=t.altcode.value,a=t.resnum.value;return r.trim()&&(a+="^"+r),n.trim()&&(a+=":"+n),e&&(a+="."+e),i&&o.trim()&&(a+="%"+o),a+="/"+(parseInt(t.model.value)-1)}function Wv(t,e,i){void 0===t[e]?t[e]=i:t[e]|=i}function Xv(t,e){return void 0!==t&&t.value===e}function qv(t,e,i){for(var r=0,n=e.getElementsByTagName("clash"),o=0,a=n.length;o<a;++o)if(t[n[o].attributes.cid.value]){r+=1;break}return e.getElementsByTagName("angle-outlier").length>0&&(r+=1),e.getElementsByTagName("bond-outlier").length>0&&(r+=1),e.getElementsByTagName("plane-outlier").length>0&&(r+=1),Xv(i.rota,"OUTLIER")&&(r+=1),Xv(i.rama,"OUTLIER")&&(r+=1),Xv(i.RNApucker,"outlier")&&(r+=1),r}_c.add("xml",$v);var Yv=function(t,e){this.name=t,this.path=e,this.rsrzDict={},this.rsccDict={},this.clashDict={},this.clashArray=[],this.geoDict={},this.geoAtomDict={},this.atomDict={},this.clashSele="NONE"},Zv={type:{}};Zv.type.get=function(){return"validation"},Yv.prototype.fromXml=function(t){gc&&mc.time("Validation.fromXml");var e=this.rsrzDict,i=this.rsccDict,r=this.clashDict,n=this.clashArray,o=this.geoDict,a=this.geoAtomDict,s=this.atomDict,c=t.getElementsByTagName("ModelledSubgroup"),u={},h=[];gc&&mc.time("Validation.fromXml#clashDict");for(var l=0,p=c.length;l<p;++l){var d=c[l],f=d.attributes,m=Hv(f);void 0!==f.rsrz&&(e[m]=parseFloat(f.rsrz.value)),void 0!==f.rscc&&(i[m]=parseFloat(f.rscc.value)),f.sele=m;for(var g=d.getElementsByTagName("clash"),v=0,y=g.length;v<y;++v){var b=g[v].attributes,x=b.atom.value;if("H"!==Xp(x)){var _=b.cid.value,w=Hv(f,x,!0);if(s[w]=!0,void 0===u[_])u[_]={sele1:w,res1:m};else{var S=u[_];S.res1!==m&&(S.sele2=w,S.res2=m,h.push(S.res1,m),r[_]=S,n.push(S))}}}}gc&&mc.timeEnd("Validation.fromXml#clashDict");for(var A=0,M=c.length;A<M;++A){var P=c[A],T=P.attributes,E=T.sele;if("."!==T.seq.value){var C=qv(r,P,T);C>0&&(o[E]=C)}else{var I=P.getElementsByTagName("clash"),R=P.getElementsByTagName("mog-bond-outlier"),L=P.getElementsByTagName("mog-angle-outlier");if(R.length>0||L.length>0||I.length>0){var O={};a[E]=O;for(var N=0,D=I.length;N<D;++N){var k=I[N].attributes;r[k.cid.value]&&Wv(O,k.atom.value,1)}for(var F=0,B=R.length;F<B;++F){R[F].attributes.atoms.value.split(",").forEach((function(t){Wv(O,t,2)}))}for(var z=0,U=L.length;z<U;++z){L[z].attributes.atoms.value.split(",").forEach((function(t){Wv(O,t,4)}))}}}}this.clashSele=h.length?h.join(" OR "):"NONE",gc&&mc.timeEnd("Validation.fromXml")},Yv.prototype.getClashData=function(t){gc&&mc.time("Validation.getClashData");var e=t||{},i=e.structure,r=i.atomSet,n=new St(Eo(e.color,"#f0027f")),o=i.getAtomProxy(),a=i.getAtomProxy(),s=new O,c=new O,u=new O,h=this.clashArray,l=h.length,p=new Float32Array(3*l),d=new Float32Array(3*l),f=au(l,n.r,n.g,n.b),m=new Float32Array(l),g=new Float32Array(l);gc&&mc.time("Validation.getClashData#atomDict");var v=this.atomDict;i.eachAtom((function(t){var e=function(t){var e=t.inscode,i=t.chainname,r=t.atomname,n=t.altloc,o=t.resno;return e&&(o+="^"+e),i&&(o+=":"+i),r&&(o+="."+r),n&&(o+="%"+n),o+="/"+t.modelIndex}(t);!0===v[e]&&(v[e]=t.index)})),gc&&mc.timeEnd("Validation.getClashData#atomDict");var y=0;return h.forEach((function(t,e){if(o.index=v[t.sele1],a.index=v[t.sele2],void 0!==o.index&&void 0!==a.index&&r.isSet(o.index,a.index)){s.subVectors(a,o).setLength(o.vdw),c.copy(o).add(s),s.subVectors(o,a).setLength(a.vdw),u.copy(a).add(s);var i=o.distanceTo(a)/2,n=Math.sqrt(o.vdw*o.vdw-i*i),h=Math.sqrt(a.vdw*a.vdw-i*i);c.toArray(p,3*y),u.toArray(d,3*y),m[y]=(n+h)/2,g[y]=e,++y}})),gc&&mc.timeEnd("Validation.getClashData"),{position1:p.subarray(0,3*y),position2:d.subarray(0,3*y),color:f.subarray(0,3*y),color2:f.subarray(0,3*y),radius:m.subarray(0,y),picking:new Yh(g.subarray(0,y),this,i)}},Object.defineProperties(Yv.prototype,Zv);var Kv=function(t){function e(e,i){var r=i||{};t.call(this,e,r),this.useDomParser=!0,this.validation=new Yv(this.name,this.path)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={__objName:{}};return i.__objName.get=function(){return"validation"},e.prototype._parse=function(){t.prototype._parse.call(this),gc&&mc.time("ValidationParser._parse "+this.name),this.validation.fromXml(this.xml.data),gc&&mc.timeEnd("ValidationParser._parse "+this.name)},Object.defineProperties(e.prototype,i),e}($v);function Qv(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)}function Jv(t,e,i,r,n){if(e.subarray&&t.subarray)t.set(e.subarray(i,i+r),n);else for(var o=0;o<r;o++)t[n+o]=e[i+o]}function ty(t,e,i,r){for(var n=65535&t|0,o=t>>>16&65535|0,a=0;0!==i;){i-=a=i>2e3?2e3:i;do{o=o+(n=n+e[r++]|0)|0}while(--a);n%=65521,o%=65521}return n|o<<16|0}_c.add("validation",Kv);var ey=function(){for(var t,e=[],i=0;i<256;i++){t=i;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}();function iy(t,e,i,r){var n=ey,o=r+i;t^=-1;for(var a=r;a<o;a++)t=t>>>8^n[255&(t^e[a])];return-1^t}function ry(t,e){var i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,P;i=t.state,r=t.next_in,M=t.input,n=r+(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,p=i.window,d=i.hold,f=i.bits,m=i.lencode,g=i.distcode,v=(1<<i.lenbits)-1,y=(1<<i.distbits)-1;t:do{f<15&&(d+=M[r++]<<f,f+=8,d+=M[r++]<<f,f+=8),b=m[d&v];e:for(;;){if(d>>>=x=b>>>24,f-=x,0===(x=b>>>16&255))P[o++]=65535&b;else{if(!(16&x)){if(0==(64&x)){b=m[(65535&b)+(d&(1<<x)-1)];continue e}if(32&x){i.mode=12;break t}t.msg="invalid literal/length code",i.mode=30;break t}_=65535&b,(x&=15)&&(f<x&&(d+=M[r++]<<f,f+=8),_+=d&(1<<x)-1,d>>>=x,f-=x),f<15&&(d+=M[r++]<<f,f+=8,d+=M[r++]<<f,f+=8),b=g[d&y];i:for(;;){if(d>>>=x=b>>>24,f-=x,!(16&(x=b>>>16&255))){if(0==(64&x)){b=g[(65535&b)+(d&(1<<x)-1)];continue i}t.msg="invalid distance code",i.mode=30;break t}if(w=65535&b,f<(x&=15)&&(d+=M[r++]<<f,(f+=8)<x&&(d+=M[r++]<<f,f+=8)),(w+=d&(1<<x)-1)>c){t.msg="invalid distance too far back",i.mode=30;break t}if(d>>>=x,f-=x,w>(x=o-a)){if((x=w-x)>h&&i.sane){t.msg="invalid distance too far back",i.mode=30;break t}if(S=0,A=p,0===l){if(S+=u-x,x<_){_-=x;do{P[o++]=p[S++]}while(--x);S=o-w,A=P}}else if(l<x){if(S+=u+l-x,(x-=l)<_){_-=x;do{P[o++]=p[S++]}while(--x);if(S=0,l<_){_-=x=l;do{P[o++]=p[S++]}while(--x);S=o-w,A=P}}}else if(S+=l-x,x<_){_-=x;do{P[o++]=p[S++]}while(--x);S=o-w,A=P}for(;_>2;)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(r<n&&o<s);r-=_=f>>3,d&=(1<<(f-=_<<3))-1,t.next_in=r,t.next_out=o,t.avail_in=r<n?n-r+5:5-(r-n),t.avail_out=o<s?s-o+257:257-(o-s),i.hold=d,i.bits=f}var 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],oy=[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],ay=[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],sy=[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];function cy(t,e,i,r,n,o,a,s){var c,u,h,l,p,d,f,m,g,v=s.bits,y=0,b=0,x=0,_=0,w=0,S=0,A=0,M=0,P=0,T=0,E=null,C=0,I=new Uint16Array(16),R=new Uint16Array(16),L=null,O=0;for(y=0;y<=15;y++)I[y]=0;for(b=0;b<r;b++)I[e[i+b]]++;for(w=v,_=15;_>=1&&0===I[_];_--);if(w>_&&(w=_),0===_)return n[o++]=20971520,n[o++]=20971520,s.bits=1,0;for(x=1;x<_&&0===I[x];x++);for(w<x&&(w=x),M=1,y=1;y<=15;y++)if(M<<=1,(M-=I[y])<0)return-1;if(M>0&&(0===t||1!==_))return-1;for(R[1]=0,y=1;y<15;y++)R[y+1]=R[y]+I[y];for(b=0;b<r;b++)0!==e[i+b]&&(a[R[e[i+b]]++]=b);if(0===t?(E=L=a,d=19):1===t?(E=ny,C-=257,L=oy,O-=257,d=256):(E=ay,L=sy,d=-1),T=0,b=0,y=x,p=o,S=w,A=0,h=-1,l=(P=1<<w)-1,1===t&&P>852||2===t&&P>592)return 1;for(;;){f=y-A,a[b]<d?(m=0,g=a[b]):a[b]>d?(m=L[O+a[b]],g=E[C+a[b]]):(m=96,g=0),c=1<<y-A,x=u=1<<S;do{n[p+(T>>A)+(u-=c)]=f<<24|m<<16|g|0}while(0!==u);for(c=1<<y-1;T&c;)c>>=1;if(0!==c?(T&=c-1,T+=c):T=0,b++,0==--I[y]){if(y===_)break;y=e[i+a[b]]}if(y>w&&(T&l)!==h){for(0===A&&(A=w),p+=x,M=1<<(S=y-A);S+A<_&&!((M-=I[S+A])<=0);)S++,M<<=1;if(P+=1<<S,1===t&&P>852||2===t&&P>592)return 1;n[h=T&l]=w<<24|S<<16|p-o|0}}return 0!==T&&(n[p+T]=y-A<<24|64<<16|0),s.bits=w,0}function uy(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function hy(){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 ly(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,function(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=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,0):-2}(t)):-2}function py(t,e){var i,r;return t?(r=new hy,t.state=r,r.window=null,0!==(i=function(t,e){var i,r;return t&&t.state?(r=t.state,e<0?(i=0,e=-e):(i=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?-2:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=i,r.wbits=e,ly(t))):-2}(t,e))&&(t.state=null),i):-2}var dy,fy,my=!0;function gy(t){if(my){var e;for(dy=new Int32Array(512),fy=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(cy(1,t.lens,0,288,dy,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;cy(2,t.lens,0,32,fy,0,t.work,{bits:5}),my=!1}t.lencode=dy,t.lenbits=9,t.distcode=fy,t.distbits=5}function vy(t,e,i,r){var n,o=t.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),r>=o.wsize?(Jv(o.window,e,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((n=o.wsize-o.wnext)>r&&(n=r),Jv(o.window,e,i-r,n,o.wnext),(r-=n)?(Jv(o.window,e,i-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=n))),0}function yy(t,e){var i,r,n,o,a,s,c,u,h,l,p,d,f,m,g,v,y,b,x,_,w,S,A,M,P=0,T=new Uint8Array(4),E=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return-2;12===(i=t.state).mode&&(i.mode=13),a=t.next_out,n=t.output,c=t.avail_out,o=t.next_in,r=t.input,s=t.avail_in,u=i.hold,h=i.bits,l=s,p=c,S=0;t:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;h<16;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(2&i.wrap&&35615===u){i.check=0,T[0]=255&u,T[1]=u>>>8&255,i.check=iy(i.check,T,2,0),u=0,h=0,i.mode=2;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=30;break}if(8!=(15&u)){t.msg="unknown compression method",i.mode=30;break}if(h-=4,w=8+(15&(u>>>=4)),0===i.wbits)i.wbits=w;else if(w>i.wbits){t.msg="invalid window size",i.mode=30;break}i.dmax=1<<w,t.adler=i.check=1,i.mode=512&u?10:12,u=0,h=0;break;case 2:for(;h<16;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(i.flags=u,8!=(255&i.flags)){t.msg="unknown compression method",i.mode=30;break}if(57344&i.flags){t.msg="unknown header flags set",i.mode=30;break}i.head&&(i.head.text=u>>8&1),512&i.flags&&(T[0]=255&u,T[1]=u>>>8&255,i.check=iy(i.check,T,2,0)),u=0,h=0,i.mode=3;case 3:for(;h<32;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.head&&(i.head.time=u),512&i.flags&&(T[0]=255&u,T[1]=u>>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,i.check=iy(i.check,T,4,0)),u=0,h=0,i.mode=4;case 4:for(;h<16;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.head&&(i.head.xflags=255&u,i.head.os=u>>8),512&i.flags&&(T[0]=255&u,T[1]=u>>>8&255,i.check=iy(i.check,T,2,0)),u=0,h=0,i.mode=5;case 5:if(1024&i.flags){for(;h<16;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.length=u,i.head&&(i.head.extra_len=u),512&i.flags&&(T[0]=255&u,T[1]=u>>>8&255,i.check=iy(i.check,T,2,0)),u=0,h=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&((d=i.length)>s&&(d=s),d&&(i.head&&(w=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),Jv(i.head.extra,r,o,d,w)),512&i.flags&&(i.check=iy(i.check,r,d,o)),s-=d,o+=d,i.length-=d),i.length))break t;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===s)break t;d=0;do{w=r[o+d++],i.head&&w&&i.length<65536&&(i.head.name+=String.fromCharCode(w))}while(w&&d<s);if(512&i.flags&&(i.check=iy(i.check,r,d,o)),s-=d,o+=d,w)break t}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===s)break t;d=0;do{w=r[o+d++],i.head&&w&&i.length<65536&&(i.head.comment+=String.fromCharCode(w))}while(w&&d<s);if(512&i.flags&&(i.check=iy(i.check,r,d,o)),s-=d,o+=d,w)break t}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;h<16;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(u!==(65535&i.check)){t.msg="header crc mismatch",i.mode=30;break}u=0,h=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=12;break;case 10:for(;h<32;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}t.adler=i.check=uy(u),u=0,h=0,i.mode=11;case 11:if(0===i.havedict)return t.next_out=a,t.avail_out=c,t.next_in=o,t.avail_in=s,i.hold=u,i.bits=h,2;t.adler=i.check=1,i.mode=12;case 12:if(5===e||6===e)break t;case 13:if(i.last){u>>>=7&h,h-=7&h,i.mode=27;break}for(;h<3;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}switch(i.last=1&u,h-=1,3&(u>>>=1)){case 0:i.mode=14;break;case 1:if(gy(i),i.mode=20,6===e){u>>>=2,h-=2;break t}break;case 2:i.mode=17;break;case 3:t.msg="invalid block type",i.mode=30}u>>>=2,h-=2;break;case 14:for(u>>>=7&h,h-=7&h;h<32;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if((65535&u)!=(u>>>16^65535)){t.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&u,u=0,h=0,i.mode=15,6===e)break t;case 15:i.mode=16;case 16:if(d=i.length){if(d>s&&(d=s),d>c&&(d=c),0===d)break t;Jv(n,r,o,d,a),s-=d,o+=d,c-=d,a+=d,i.length-=d;break}i.mode=12;break;case 17:for(;h<14;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(i.nlen=257+(31&u),u>>>=5,h-=5,i.ndist=1+(31&u),u>>>=5,h-=5,i.ncode=4+(15&u),u>>>=4,h-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=30;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;h<3;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.lens[E[i.have++]]=7&u,u>>>=3,h-=3}for(;i.have<19;)i.lens[E[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,A={bits:i.lenbits},S=cy(0,i.lens,0,19,i.lencode,0,i.work,A),i.lenbits=A.bits,S){t.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;v=(P=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,y=65535&P,!((g=P>>>24)<=h);){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(y<16)u>>>=g,h-=g,i.lens[i.have++]=y;else{if(16===y){for(M=g+2;h<M;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(u>>>=g,h-=g,0===i.have){t.msg="invalid bit length repeat",i.mode=30;break}w=i.lens[i.have-1],d=3+(3&u),u>>>=2,h-=2}else if(17===y){for(M=g+3;h<M;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}h-=g,w=0,d=3+(7&(u>>>=g)),u>>>=3,h-=3}else{for(M=g+7;h<M;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}h-=g,w=0,d=11+(127&(u>>>=g)),u>>>=7,h-=7}if(i.have+d>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=30;break}for(;d--;)i.lens[i.have++]=w}}if(30===i.mode)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,A={bits:i.lenbits},S=cy(1,i.lens,0,i.nlen,i.lencode,0,i.work,A),i.lenbits=A.bits,S){t.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,A={bits:i.distbits},S=cy(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,A),i.distbits=A.bits,S){t.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===e)break t;case 20:i.mode=21;case 21: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,ry(t,p),a=t.next_out,n=t.output,c=t.avail_out,o=t.next_in,r=t.input,s=t.avail_in,u=i.hold,h=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;v=(P=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,y=65535&P,!((g=P>>>24)<=h);){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(v&&0==(240&v)){for(b=g,x=v,_=y;v=(P=i.lencode[_+((u&(1<<b+x)-1)>>b)])>>>16&255,y=65535&P,!(b+(g=P>>>24)<=h);){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}u>>>=b,h-=b,i.back+=b}if(u>>>=g,h-=g,i.back+=g,i.length=y,0===v){i.mode=26;break}if(32&v){i.back=-1,i.mode=12;break}if(64&v){t.msg="invalid literal/length code",i.mode=30;break}i.extra=15&v,i.mode=22;case 22:if(i.extra){for(M=i.extra;h<M;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.length+=u&(1<<i.extra)-1,u>>>=i.extra,h-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;v=(P=i.distcode[u&(1<<i.distbits)-1])>>>16&255,y=65535&P,!((g=P>>>24)<=h);){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(0==(240&v)){for(b=g,x=v,_=y;v=(P=i.distcode[_+((u&(1<<b+x)-1)>>b)])>>>16&255,y=65535&P,!(b+(g=P>>>24)<=h);){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}u>>>=b,h-=b,i.back+=b}if(u>>>=g,h-=g,i.back+=g,64&v){t.msg="invalid distance code",i.mode=30;break}i.offset=y,i.extra=15&v,i.mode=24;case 24:if(i.extra){for(M=i.extra;h<M;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}i.offset+=u&(1<<i.extra)-1,u>>>=i.extra,h-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===c)break t;if(d=p-c,i.offset>d){if((d=i.offset-d)>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=30;break}d>i.wnext?(d-=i.wnext,f=i.wsize-d):f=i.wnext-d,d>i.length&&(d=i.length),m=i.window}else m=n,f=a-i.offset,d=i.length;d>c&&(d=c),c-=d,i.length-=d;do{n[a++]=m[f++]}while(--d);0===i.length&&(i.mode=21);break;case 26:if(0===c)break t;n[a++]=i.length,c--,i.mode=21;break;case 27:if(i.wrap){for(;h<32;){if(0===s)break t;s--,u|=r[o++]<<h,h+=8}if(p-=c,t.total_out+=p,i.total+=p,p&&(t.adler=i.check=i.flags?iy(i.check,n,p,a-p):ty(i.check,n,p,a-p)),p=c,(i.flags?u:uy(u))!==i.check){t.msg="incorrect data check",i.mode=30;break}u=0,h=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;h<32;){if(0===s)break t;s--,u+=r[o++]<<h,h+=8}if(u!==(4294967295&i.total)){t.msg="incorrect length check",i.mode=30;break}u=0,h=0}i.mode=29;case 29:S=1;break t;case 30:S=-3;break t;case 31:return-4;case 32:default:return-2}return t.next_out=a,t.avail_out=c,t.next_in=o,t.avail_in=s,i.hold=u,i.bits=h,(i.wsize||p!==t.avail_out&&i.mode<30&&(i.mode<27||4!==e))&&vy(t,t.output,t.next_out,p-t.avail_out)?(i.mode=31,-4):(l-=t.avail_in,p-=t.avail_out,t.total_in+=l,t.total_out+=p,i.total+=p,i.wrap&&p&&(t.adler=i.check=i.flags?iy(i.check,n,p,t.next_out-p):ty(i.check,n,p,t.next_out-p)),t.data_type=i.bits+(i.last?64:0)+(12===i.mode?128:0)+(20===i.mode||15===i.mode?256:0),(0===l&&0===p||4===e)&&0===S&&(S=-5),S)}function by(t,e){var i,r=e.length;return t&&t.state?0!==(i=t.state).wrap&&11!==i.mode?-2:11===i.mode&&ty(1,e,r,0)!==i.check?-3:vy(t,e,r,r)?(i.mode=31,-4):(i.havedict=1,0):-2}var xy=!0,_y=!0;try{String.fromCharCode.apply(null,[0])}catch(t){xy=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){_y=!1}for(var wy=new Uint8Array(256),Sy=0;Sy<256;Sy++)wy[Sy]=Sy>=252?6:Sy>=248?5:Sy>=240?4:Sy>=224?3:Sy>=192?2:1;function Ay(t){var e,i,r,n,o,a=t.length,s=0;for(n=0;n<a;n++)55296==(64512&(i=t.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=t.charCodeAt(n+1)))&&(i=65536+(i-55296<<10)+(r-56320),n++),s+=i<128?1:i<2048?2:i<65536?3:4;for(e=new Uint8Array(s),o=0,n=0;o<s;n++)55296==(64512&(i=t.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=t.charCodeAt(n+1)))&&(i=65536+(i-55296<<10)+(r-56320),n++),i<128?e[o++]=i:i<2048?(e[o++]=192|i>>>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 My(t,e){var i,r,n,o,a=e||t.length,s=new Array(2*a);for(r=0,i=0;i<a;)if((n=t[i++])<128)s[r++]=n;else if((o=wy[n])>4)s[r++]=65533,i+=o-1;else{for(n&=2===o?31:3===o?15:7;o>1&&i<a;)n=n<<6|63&t[i++],o--;o>1?s[r++]=65533:n<65536?s[r++]=n:(n-=65536,s[r++]=55296|n>>10&1023,s[r++]=56320|1023&n)}return function(t,e){if(e<65537&&(t.subarray&&_y||!t.subarray&&xy))return String.fromCharCode.apply(null,Qv(t,e));for(var i="",r=0;r<e;r++)i+=String.fromCharCode(t[r]);return i}(s,r)}function Py(t,e){var i;for((e=e||t.length)>t.length&&(e=t.length),i=e-1;i>=0&&128==(192&t[i]);)i--;return i<0?e:0===i?e:i+wy[t[i]]>e?i:e}wy[254]=wy[254]=1;var Ty={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"};function Ey(){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 Cy(){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}var Iy=Object.prototype.toString;function Ry(t){if(!(this instanceof Ry))return new Ry(t);this.options=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}}return t}({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 Ey,this.strm.avail_out=0;var i,r,n,o=py(this.strm,e.windowBits);if(0!==o)throw new Error(Ty[o]);this.header=new Cy,i=this.strm,r=this.header,i&&i.state&&(0==(2&(n=i.state).wrap)||(n.head=r,r.done=!1))}Ry.prototype.push=function(t,e){var i,r,n,o,a,s,c=this.strm,u=this.options.chunkSize,h=this.options.dictionary,l=!1;if(this.ended)return!1;r=e===~~e?e:!0===e?4:0,"string"==typeof t?c.input=function(t){for(var e=new Uint8Array(t.length),i=0,r=e.length;i<r;i++)e[i]=t.charCodeAt(i);return e}(t):"[object ArrayBuffer]"===Iy.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),2===(i=yy(c,0))&&h&&(s="string"==typeof h?Ay(h):"[object ArrayBuffer]"===Iy.call(h)?new Uint8Array(h):h,i=by(this.strm,s)),-5===i&&!0===l&&(i=0,l=!1),1!==i&&0!==i)return this.onEnd(i),this.ended=!0,!1;c.next_out&&(0!==c.avail_out&&1!==i&&(0!==c.avail_in||4!==r&&2!==r)||("string"===this.options.to?(n=Py(c.output,c.next_out),o=c.next_out-n,a=My(c.output,n),c.next_out=o,c.avail_out=u-o,o&&Jv(c.output,c.output,n,o,0),this.onData(a)):this.onData(Qv(c.output,c.next_out)))),0===c.avail_in&&0===c.avail_out&&(l=!0)}while((c.avail_in>0||0===c.avail_out)&&1!==i);return 1===i&&(r=4),4===r?(i=function(t){if(!t||!t.state)return-2;var e=t.state;return e.window&&(e.window=null),t.state=null,0}(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==r||(this.onEnd(0),c.avail_out=0,!0)},Ry.prototype.onData=function(t){this.chunks.push(t)},Ry.prototype.onEnd=function(t){0===t&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=function(t){var e,i,r,n,o,a;for(r=0,e=0,i=t.length;e<i;e++)r+=t[e].length;for(a=new Uint8Array(r),n=0,e=0,i=t.length;e<i;e++)o=t[e],a.set(o,n),n+=o.length;return a}(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},Sc.add("gz",(function(t){var e;t instanceof ArrayBuffer&&(t=new Uint8Array(t));try{e=function(t,e){var i=new Ry(e);if(i.push(t,!0),i.err)throw i.msg;return i.result}(t)}catch(i){e=t}return e}));var Ly="//mmtf.rcsb.org/v1.0/full/";bc.add("rcsb",new function(){this.getUrl=function(t){var e,i=Lo(t),r=i.name.substr(0,4);return!["pdb","cif"].includes(i.ext)||!1!==i.compressed&&"gz"!==i.compressed?"mmtf"===i.ext?e=i.base.endsWith(".bb")?"//mmtf.rcsb.org/v1.0/reduced/"+r:Ly+r:i.ext?(mc.warn("unsupported ext",i.ext),e=Ly+r):e=Ly+r:e="//files.rcsb.org/download/"+i.path,Co()+e},this.getExt=function(t){var e=Lo(t);if("mmtf"===e.ext||!e.ext)return"mmtf"}});var Oy="//pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/";function Ny(){this.getUrl=function(t){return t}}bc.add("pubchem",new function(){this.getUrl=function(t){var e,i=Lo(t),r=i.name;return i.ext&&"sdf"!==i.ext?(mc.warn("unsupported ext",i.ext),e=Oy+r+"/SDF?record_type=3d"):e=Oy+r+"/SDF?record_type=3d",Co()+e},this.getExt=function(t){var e=Lo(t);if(!e.ext||"sdf"===e.ext)return"sdf"}}),bc.add("ftp",new Ny),bc.add("http",new Ny),bc.add("https",new Ny);"undefined"==typeof window||window.Promise||(window.Promise=p)}).call(this,i(155).setImmediate)},155:function(t,e,i){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(n.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new o(n.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},i(156),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,i(48))},156:function(t,e,i){(function(t,e){!function(t,i){"use strict";if(!t.setImmediate){var r,n,o,a,s,c=1,u={},h=!1,l=t.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(t);p=p&&p.setTimeout?p:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick((function(){f(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,i=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=i,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){f(t.data)},r=function(t){o.port2.postMessage(t)}):l&&"onreadystatechange"in l.createElement("script")?(n=l.documentElement,r=function(t){var e=l.createElement("script");e.onreadystatechange=function(){f(t),e.onreadystatechange=null,n.removeChild(e),e=null},n.appendChild(e)}):r=function(t){setTimeout(f,0,t)}:(a="setImmediate$"+Math.random()+"$",s=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(a)&&f(+e.data.slice(a.length))},t.addEventListener?t.addEventListener("message",s,!1):t.attachEvent("onmessage",s),r=function(e){t.postMessage(a+e,"*")}),p.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),i=0;i<e.length;i++)e[i]=arguments[i+1];var n={callback:t,args:e};return u[c]=n,r(c),c++},p.clearImmediate=d}function d(t){delete u[t]}function f(t){if(h)setTimeout(f,0,t);else{var e=u[t];if(e){h=!0;try{!function(t){var e=t.callback,i=t.args;switch(i.length){case 0:e();break;case 1:e(i[0]);break;case 2:e(i[0],i[1]);break;case 3:e(i[0],i[1],i[2]);break;default:e.apply(void 0,i)}}(e)}finally{d(t),h=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,i(48),i(56))},157:function(t,e,i){"use strict";var r=i(158);t.exports=function(t){var e=typeof t;if("string"===e){var i=t;if(0===(t=+t)&&r(i))return!1}else if("number"!==e)return!1;return t-t<1}},158:function(t,e,i){"use strict";t.exports=function(t){for(var e,i=t.length,r=0;r<i;r++)if(((e=t.charCodeAt(r))<9||e>13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(e<8192||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}},42:function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return y}));var r=i(1),n=i.n(r),o=i(16),a=i(154),s=i(47),c=i(157),u=i.n(c);function h(t){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t){return function(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e<t.length;e++)i[e]=t[e];return i}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function p(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function d(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function f(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function m(t,e){return!e||"object"!==h(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function g(t){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function v(t,e){return(v=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var y=function(t){function e(t){var i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(i=m(this,g(e).call(this,t))).state={stage:null,orientationMatrix:null,structuresList:[]},i.ref=n.a.createRef(),i}var i,r,o;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&v(t,e)}(e,t),i=e,(r=[{key:"componentDidMount",value:function(){var t=this.props,e=t.stageParameters,i=t.width,r=t.height,n=function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?p(Object(i),!0).forEach((function(e){d(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):p(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({},e),o=new a.b(this.ref.current,n),s=o.viewerControls.getOrientation(),c=u()(i)?i+"px":i,h=u()(r)?r+"px":r;o.setSize(c,h),this.setState({stage:o,orientationMatrix:s})}},{key:"shouldComponentUpdate",value:function(t,e){var i=this.props,r=i.stageParameters,n=i.data,o=i.downloadImage,a=i.molStyles,c=i.height,u=i.width;if(null!==n&&null!==t.data){if(void 0!==e.data)return!0;var h=t.data[0].selectedValue,l=n[0].selectedValue;if(h!==l)return!0;var p=n[0].resetView;if(h===l&&!0===p)return!0;if(!0===n[0].uploaded)return!0}return!(Object(s.a)(t.molStyles,a)&&Object(s.a)(t.stageParameters,r)&&t.downloadImage===o&&Object(s.a)(t.height,c)&&Object(s.a)(t.width,u))}},{key:"componentDidUpdate",value:function(){var t=this.props,e=t.data,i=t.stageParameters,r=t.downloadImage,n=t.sideByside,o=t.height,a=t.width,s=this.state,c=s.stage,h=s.structuresList,l=u()(a)?a+"px":a,p=u()(o)?o+"px":o;c.setParameters(i),c.setSize(l,p),(void 0===r||!1===r&&"placeholder"!==e[0].selectedValue)&&(c.eachComponent((function(t){t.removeAllRepresentations()})),this.processDataFromBackend(e,h,n)),!0===r&&this.generateImage(),this.props.setProps({downloadImage:!1})}},{key:"highlightAtoms",value:function(t,e,i,r,n){""!==r&&(t.sele=e+" and @"+r,i.addRepresentation("ball+stick",t)),""!==n&&(t.sele=e+".CA and ("+n.replace(/,/g," or ")+")",i.addRepresentation("ball+stick",t))}},{key:"addMolStyle",value:function(t,e,i,r){var n=this.props.molStyles,o=l(n.representations),a=i.atoms,s=i.residues,c={sele:e,showBox:o.includes("axes+box")};":"!==e&&(c.color=r),o.forEach((function(e){var i=e;"axes+box"===i&&(i="axes"),t.addRepresentation(i,c)})),""===a&&""===s||(c.radius=n.chosenAtomsRadius,c.color=n.chosenAtomsColor,this.highlightAtoms(c,e,t,a,s))}},{key:"showStructure",value:function(t,e,i,r,n,o,s){var c=this.state,u=c.stage,h=c.orientationMatrix,l=t,p=":";if(u.viewerControls.orient(h),"ALL"===e)this.addMolStyle(t,p,r,n);else{if(p+=e,"ALL"!==i&&(p+="/0 and "+i),!0===s){var d=new a.a(p),f=t.structure.getView(d),m=(l=u.addComponentFromObject(f)).getCenter(),g=f.getPrincipalAxes();l.setRotation(g.getRotationQuaternion()),l.setPosition([0-m.x-o,0-m.y,0-m.z])}this.addMolStyle(l,p,r,n)}u.autoView()}},{key:"processDataFromBackend",value:function(t,e){for(var i=this.props.molStyles,r=this.state.stage,n=0;n<t.length;n++){var o=t[n].filename,a=n*i.molSpacingXaxis,s=i.sideByside;e.includes(o)?this.showStructure(r.getComponentsByName(o).list[0],t[n].chain,t[n].aaRange,t[n].chosen,t[n].color,a,s):this.loadData(t[n],a,s)}}},{key:"loadData",value:function(t,e,i){var r=this,n=this.state.stage,o=new Blob([t.config.input],{type:t.config.type});n.loadFile(o,{ext:t.ext,defaultRepresentation:!1}).then((function(n){n.name=t.filename,r.showStructure(n,t.chain,t.aaRange,t.chosen,t.color,e,i),r.setState((function(e){return{structuresList:e.structuresList.concat([t.filename])}}))}))}},{key:"generateImage",value:function(){var t=this.props.imageParameters;this.state.stage.makeImage({factor:1,antialias:t.antialias,trim:t.trim,transparent:t.transparent}).then((function(e){Object(a.c)(e,t.defaultFilename+".png")}))}},{key:"render",value:function(){var t=this.props.id;return n.a.createElement("div",{id:t,ref:this.ref})}}])&&f(i.prototype,r),o&&f(i,o),e}(r.Component);y.defaultProps=o.b,y.propTypes=o.c}}]);
\ No newline at end of file
diff --git a/inst/deps/bundle.js b/inst/deps/bundle.js
index 0bbfd79d7..0f7dda4b4 100644
--- a/inst/deps/bundle.js
+++ b/inst/deps/bundle.js
@@ -1 +1 @@
-window.dash_bio=function(t){function n(n){for(var e,o,a=n[0],i=n[1],u=0,s=[];u<a.length;u++)o=a[u],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&s.push(r[o][0]),r[o]=0;for(e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e]);for(h&&h(n);s.length;)s.shift()()}var e={},r={11:0};function o(t){return a.p+""+({0:"async-alignment",1:"async-circos",2:"async-ideogram",3:"async-igv",4:"async-moleculeviewer2",5:"async-moleculeviewer3",6:"async-needle",7:"async-nglmoleculeviewer",8:"async-onco",9:"async-sequence",10:"async-speck"}[t]||t)+".js"}function a(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.e=function(t){var n=[],e=r[t];if(0!==e)if(e)n.push(e[2]);else{var i=new Promise((function(n,o){e=r[t]=[n,o]}));n.push(e[2]=i);var u,s=document.createElement("script");s.charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.src=o(t);var l=new Error;u=function(n){s.onerror=s.onload=null,clearTimeout(c);var e=r[t];if(0!==e){if(e){var o=n&&("load"===n.type?"missing":n.type),a=n&&n.target&&n.target.src;l.message="Loading chunk "+t+" failed.\n("+o+": "+a+")",l.name="ChunkLoadError",l.type=o,l.request=a,e[1](l)}r[t]=void 0}};var c=setTimeout((function(){u({type:"timeout",target:s})}),12e4);s.onerror=s.onload=u,document.head.appendChild(s)}return Promise.all(n)},a.m=t,a.c=e,a.d=function(t,n,e){a.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,n){if(1&n&&(t=a(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(a.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var r in t)a.d(e,r,function(n){return t[n]}.bind(null,r));return e},a.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(n,"a",n),n},a.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},a.p="",a.oe=function(t){throw console.error(t),t};var i,u=function(){var t=document.currentScript;if(!t){for(var n=document.getElementsByTagName("script"),e=[],r=0;r<n.length;r++)e.push(n[r]);t=(e=e.filter((function(t){return!t.async&&!t.text&&!t.textContent}))).slice(-1)[0]}return t};if(Object.defineProperty(a,"p",{get:(i=u().src.split("/").slice(0,-1).join("/")+"/",function(){return i})}),void 0!==o){var s=o;o=function(t){var n=function(t){return/\/_dash-component-suites\//.test(t.src)}(u()),e=s(t);if(!n)return e;var r=e.split("/"),o=r.slice(-1)[0].split(".");return o.splice(1,0,"v0_6_0m1611814889"),r.splice(-1,1,o.join(".")),r.join("/")}}var l=window.webpackJsonpdash_bio=window.webpackJsonpdash_bio||[],c=l.push.bind(l);l.push=n,l=l.slice();for(var f=0;f<l.length;f++)n(l[f]);var h=c;return a(a.s=33)}([function(t,n,e){t.exports=e(25)()},function(t,n){t.exports=window.React},function(t,n,e){"use strict";n.a={alignmentChart:function(){return e.e(0).then(e.bind(null,36))},circos:function(){return e.e(1).then(e.bind(null,37))},ideogram:function(){return Promise.all([e.e(0),e.e(2)]).then(e.bind(null,38))},igv:function(){return Promise.all([e.e(0),e.e(3)]).then(e.bind(null,39))},molecule2dViewer:function(){return Promise.all([e.e(0),e.e(4)]).then(e.bind(null,40))},molecule3dViewer:function(){return Promise.all([e.e(0),e.e(5)]).then(e.bind(null,41))},nglmoleculeViewer:function(){return Promise.all([e.e(0),e.e(7)]).then(e.bind(null,42))},needlePlot:function(){return Promise.all([e.e(0),e.e(6)]).then(e.bind(null,45))},oncoPrint:function(){return Promise.all([e.e(0),e.e(8)]).then(e.bind(null,43))},sequenceViewer:function(){return Promise.all([e.e(0),e.e(9)]).then(e.bind(null,44))},speck:function(){return e.e(10).then(e.bind(null,46))}}},function(t,n,e){"use strict";e.d(n,"a",(function(){return o}));var r=e(4);function o(t){return function n(e){return 0===arguments.length||Object(r.a)(e)?n:t.apply(this,arguments)}}},function(t,n,e){"use strict";function r(t){return null!=t&&"object"==typeof t&&!0===t["@@functional/placeholder"]}e.d(n,"a",(function(){return r}))},function(t,n,e){"use strict";function r(t,n){return Object.prototype.hasOwnProperty.call(n,t)}e.d(n,"a",(function(){return r}))},function(t,n){t.exports={},t.exports[0]=t.exports.Xx={symbol:"Xx",name:"unknown",mass:1,radius:1,color:[1,.078,.576],number:0},t.exports[1]=t.exports.H={symbol:"H",name:"hydrogen",mass:1.00794,radius:.31,color:[1,1,1],number:1},t.exports[2]=t.exports.He={symbol:"He",name:"helium",mass:4.002602,radius:.28,color:[.851,1,1],number:2},t.exports[3]=t.exports.Li={symbol:"Li",name:"lithium",mass:6.941,radius:1.28,color:[.8,.502,1],number:3},t.exports[4]=t.exports.Be={symbol:"Be",name:"beryllium",mass:9.012182,radius:.96,color:[.761,1,0],number:4},t.exports[5]=t.exports.B={symbol:"B",name:"boron",mass:10.811,radius:.84,color:[1,.71,.71],number:5},t.exports[6]=t.exports.C={symbol:"C",name:"carbon",mass:12.0107,radius:.73,color:[.565,.565,.565],number:6},t.exports[7]=t.exports.N={symbol:"N",name:"nitrogen",mass:14.0067,radius:.71,color:[.188,.314,.973],number:7},t.exports[8]=t.exports.O={symbol:"O",name:"oxygen",mass:15.9994,radius:.66,color:[1,.051,.051],number:8},t.exports[9]=t.exports.F={symbol:"F",name:"fluorine",mass:18.9984032,radius:.57,color:[.565,.878,.314],number:9},t.exports[10]=t.exports.Ne={symbol:"Ne",name:"neon",mass:20.1797,radius:.58,color:[.702,.89,.961],number:10},t.exports[11]=t.exports.Na={symbol:"Na",name:"sodium",mass:22.98976928,radius:1.66,color:[.671,.361,.949],number:11},t.exports[12]=t.exports.Mg={symbol:"Mg",name:"magnesium",mass:24.305,radius:1.41,color:[.541,1,0],number:12},t.exports[13]=t.exports.Al={symbol:"Al",name:"aluminum",mass:26.9815386,radius:1.21,color:[.749,.651,.651],number:13},t.exports[14]=t.exports.Si={symbol:"Si",name:"silicon",mass:28.0855,radius:1.11,color:[.941,.784,.627],number:14},t.exports[15]=t.exports.P={symbol:"P",name:"phosphorus",mass:30.973762,radius:1.07,color:[1,.502,0],number:15},t.exports[16]=t.exports.S={symbol:"S",name:"sulfur",mass:32.065,radius:1.05,color:[1,1,.188],number:16},t.exports[17]=t.exports.Cl={symbol:"Cl",name:"chlorine",mass:35.453,radius:1.02,color:[.122,.941,.122],number:17},t.exports[18]=t.exports.Ar={symbol:"Ar",name:"argon",mass:39.948,radius:1.06,color:[.502,.82,.89],number:18},t.exports[19]=t.exports.K={symbol:"K",name:"potassium",mass:39.0983,radius:2.03,color:[.561,.251,.831],number:19},t.exports[20]=t.exports.Ca={symbol:"Ca",name:"calcium",mass:40.078,radius:1.76,color:[.239,1,0],number:20},t.exports[21]=t.exports.Sc={symbol:"Sc",name:"scandium",mass:44.955912,radius:1.7,color:[.902,.902,.902],number:21},t.exports[22]=t.exports.Ti={symbol:"Ti",name:"titanium",mass:47.867,radius:1.6,color:[.749,.761,.78],number:22},t.exports[23]=t.exports.V={symbol:"V",name:"vanadium",mass:50.9415,radius:1.53,color:[.651,.651,.671],number:23},t.exports[24]=t.exports.Cr={symbol:"Cr",name:"chromium",mass:51.9961,radius:1.39,color:[.541,.6,.78],number:24},t.exports[25]=t.exports.Mn={symbol:"Mn",name:"manganese",mass:54.938045,radius:1.39,color:[.611,.478,.78],number:25},t.exports[26]=t.exports.Fe={symbol:"Fe",name:"iron",mass:55.845,radius:1.32,color:[.878,.4,.2],number:26},t.exports[27]=t.exports.Co={symbol:"Co",name:"cobalt",mass:58.6934,radius:1.26,color:[.941,.565,.627],number:27},t.exports[28]=t.exports.Ni={symbol:"Ni",name:"nickel",mass:58.933195,radius:1.24,color:[.314,.816,.314],number:28},t.exports[29]=t.exports.Cu={symbol:"Cu",name:"copper",mass:63.546,radius:1.32,color:[.784,.502,.2],number:29},t.exports[30]=t.exports.Zn={symbol:"Zn",name:"zinc",mass:65.38,radius:1.22,color:[.49,.502,.69],number:30},t.exports[31]=t.exports.Ga={symbol:"Ga",name:"gallium",mass:69.723,radius:1.22,color:[.761,.561,.561],number:31},t.exports[32]=t.exports.Ge={symbol:"Ge",name:"germanium",mass:72.64,radius:1.2,color:[.4,.561,.561],number:32},t.exports[33]=t.exports.As={symbol:"As",name:"arsenic",mass:74.9216,radius:1.19,color:[.741,.502,.89],number:33},t.exports[34]=t.exports.Se={symbol:"Se",name:"selenium",mass:78.96,radius:1.2,color:[1,.631,0],number:34},t.exports[35]=t.exports.Br={symbol:"Br",name:"bromine",mass:79.904,radius:1.2,color:[.651,.161,.161],number:35},t.exports[36]=t.exports.Kr={symbol:"Kr",name:"krypton",mass:83.798,radius:1.16,color:[.361,.722,.82],number:36},t.exports[37]=t.exports.Rb={symbol:"Rb",name:"rubidium",mass:85.4678,radius:2.2,color:[.439,.18,.69],number:37},t.exports[38]=t.exports.Sr={symbol:"Sr",name:"strontium",mass:87.62,radius:1.95,color:[0,1,0],number:38},t.exports[39]=t.exports.Y={symbol:"Y",name:"yttrium",mass:88.90585,radius:1.9,color:[.58,1,1],number:39},t.exports[40]=t.exports.Zr={symbol:"Zr",name:"zirconium",mass:91.224,radius:1.75,color:[.58,.878,.878],number:40},t.exports[41]=t.exports.Nb={symbol:"Nb",name:"niobium",mass:92.90638,radius:1.64,color:[.451,.761,.788],number:41},t.exports[42]=t.exports.Mo={symbol:"Mo",name:"molybdenum",mass:95.96,radius:1.54,color:[.329,.71,.71],number:42},t.exports[43]=t.exports.Tc={symbol:"Tc",name:"technetium",mass:98,radius:1.47,color:[.231,.62,.62],number:43},t.exports[44]=t.exports.Ru={symbol:"Ru",name:"ruthenium",mass:101.07,radius:1.46,color:[.141,.561,.561],number:44},t.exports[45]=t.exports.Rh={symbol:"Rh",name:"rhodium",mass:102.9055,radius:1.42,color:[.039,.49,.549],number:45},t.exports[46]=t.exports.Pd={symbol:"Pd",name:"palladium",mass:106.42,radius:1.39,color:[0,.412,.522],number:46},t.exports[47]=t.exports.Ag={symbol:"Ag",name:"silver",mass:107.8682,radius:1.45,color:[.753,.753,.753],number:47},t.exports[48]=t.exports.Cd={symbol:"Cd",name:"cadmium",mass:112.411,radius:1.44,color:[1,.851,.561],number:48},t.exports[49]=t.exports.In={symbol:"In",name:"indium",mass:114.818,radius:1.42,color:[.651,.459,.451],number:49},t.exports[50]=t.exports.Sn={symbol:"Sn",name:"tin",mass:118.71,radius:1.39,color:[.4,.502,.502],number:50},t.exports[51]=t.exports.Sb={symbol:"Sb",name:"antimony",mass:121.76,radius:1.39,color:[.62,.388,.71],number:51},t.exports[52]=t.exports.Te={symbol:"Te",name:"tellurium",mass:127.6,radius:1.38,color:[.831,.478,0],number:52},t.exports[53]=t.exports.I={symbol:"I",name:"iodine",mass:126.9047,radius:1.39,color:[.58,0,.58],number:53},t.exports[54]=t.exports.Xe={symbol:"Xe",name:"xenon",mass:131.293,radius:1.4,color:[.259,.62,.69],number:54},t.exports[55]=t.exports.Cs={symbol:"Cs",name:"cesium",mass:132.9054519,radius:2.44,color:[.341,.09,.561],number:55},t.exports[56]=t.exports.Ba={symbol:"Ba",name:"barium",mass:137.327,radius:2.15,color:[0,.788,0],number:56},t.exports[57]=t.exports.La={symbol:"La",name:"lanthanum",mass:138.90547,radius:2.07,color:[.439,.831,1],number:57},t.exports[58]=t.exports.Ce={symbol:"Ce",name:"cerium",mass:140.116,radius:2.04,color:[1,1,.78],number:58},t.exports[59]=t.exports.Pr={symbol:"Pr",name:"praseodymium",mass:140.90765,radius:2.03,color:[.851,1,.78],number:59},t.exports[60]=t.exports.Nd={symbol:"Nd",name:"neodymium",mass:144.242,radius:2.01,color:[.78,1,.78],number:60},t.exports[61]=t.exports.Pm={symbol:"Pm",name:"promethium",mass:145,radius:1.99,color:[.639,1,.78],number:61},t.exports[62]=t.exports.Sm={symbol:"Sm",name:"samarium",mass:150.36,radius:1.98,color:[.561,1,.78],number:62},t.exports[63]=t.exports.Eu={symbol:"Eu",name:"europium",mass:151.964,radius:1.98,color:[.38,1,.78],number:63},t.exports[64]=t.exports.Gd={symbol:"Gd",name:"gadolinium",mass:157.25,radius:1.96,color:[.271,1,.78],number:64},t.exports[65]=t.exports.Tb={symbol:"Tb",name:"terbium",mass:158.92535,radius:1.94,color:[.189,1,.78],number:65},t.exports[66]=t.exports.Dy={symbol:"Dy",name:"dysprosium",mass:162.5,radius:1.92,color:[.122,1,.78],number:66},t.exports[67]=t.exports.Ho={symbol:"Ho",name:"holmium",mass:164.93032,radius:1.92,color:[0,1,.612],number:67},t.exports[68]=t.exports.Er={symbol:"Er",name:"erbium",mass:167.259,radius:1.89,color:[0,.902,.459],number:68},t.exports[69]=t.exports.Tm={symbol:"Tm",name:"thulium",mass:168.93421,radius:1.9,color:[0,.831,.322],number:69},t.exports[70]=t.exports.Yb={symbol:"Yb",name:"ytterbium",mass:173.054,radius:1.87,color:[0,.749,.22],number:70},t.exports[71]=t.exports.Lu={symbol:"Lu",name:"lutetium",mass:174.9668,radius:1.87,color:[0,.671,.141],number:71},t.exports[72]=t.exports.Hf={symbol:"Hf",name:"hafnium",mass:178.49,radius:1.75,color:[.302,.761,1],number:72},t.exports[73]=t.exports.Ta={symbol:"Ta",name:"tantalum",mass:180.94788,radius:1.7,color:[.302,.651,1],number:73},t.exports[74]=t.exports.W={symbol:"W",name:"tungsten",mass:183.84,radius:1.62,color:[.129,.58,.839],number:74},t.exports[75]=t.exports.Re={symbol:"Re",name:"rhenium",mass:186.207,radius:1.51,color:[.149,.49,.671],number:75},t.exports[76]=t.exports.Os={symbol:"Os",name:"osmium",mass:190.23,radius:1.44,color:[.149,.4,.588],number:76},t.exports[77]=t.exports.Ir={symbol:"Ir",name:"iridium",mass:192.217,radius:1.41,color:[.09,.329,.529],number:77},t.exports[78]=t.exports.Pt={symbol:"Pt",name:"platinum",mass:195.084,radius:1.36,color:[.816,.816,.878],number:78},t.exports[79]=t.exports.Au={symbol:"Au",name:"gold",mass:196.966569,radius:1.36,color:[1,.82,.137],number:79},t.exports[80]=t.exports.Hg={symbol:"Hg",name:"mercury",mass:200.59,radius:1.32,color:[.722,.722,.816],number:80},t.exports[81]=t.exports.Tl={symbol:"Tl",name:"thallium",mass:204.3833,radius:1.45,color:[.651,.329,.302],number:81},t.exports[82]=t.exports.Pb={symbol:"Pb",name:"lead",mass:207.2,radius:1.46,color:[.341,.349,.38],number:82},t.exports[83]=t.exports.Bi={symbol:"Bi",name:"bismuth",mass:208.9804,radius:1.48,color:[.62,.31,.71],number:83},t.exports[84]=t.exports.Po={symbol:"Po",name:"polonium",mass:210,radius:1.4,color:[.671,.361,0],number:84},t.exports[85]=t.exports.At={symbol:"At",name:"astatine",mass:210,radius:1.5,color:[.459,.31,.271],number:85},t.exports[86]=t.exports.Rn={symbol:"Rn",name:"radon",mass:220,radius:1.5,color:[.259,.51,.588],number:86},t.exports[87]=t.exports.Fr={symbol:"Fr",name:"francium",mass:223,radius:2.6,color:[.259,0,.4],number:87},t.exports[88]=t.exports.Ra={symbol:"Ra",name:"radium",mass:226,radius:2.21,color:[0,.49,0],number:88},t.exports[89]=t.exports.Ac={symbol:"Ac",name:"actinium",mass:227,radius:2.15,color:[.439,.671,.98],number:89},t.exports[90]=t.exports.Th={symbol:"Th",name:"thorium",mass:231.03588,radius:2.06,color:[0,.729,1],number:90},t.exports[91]=t.exports.Pa={symbol:"Pa",name:"protactinium",mass:232.03806,radius:2,color:[0,.631,1],number:91},t.exports[92]=t.exports.U={symbol:"U",name:"uranium",mass:237,radius:1.96,color:[0,.561,1],number:92},t.exports[93]=t.exports.Np={symbol:"Np",name:"neptunium",mass:238.02891,radius:1.9,color:[0,.502,1],number:93},t.exports[94]=t.exports.Pu={symbol:"Pu",name:"plutonium",mass:243,radius:1.87,color:[0,.42,1],number:94},t.exports[95]=t.exports.Am={symbol:"Am",name:"americium",mass:244,radius:1.8,color:[.329,.361,.949],number:95},t.exports[96]=t.exports.Cm={symbol:"Cm",name:"curium",mass:247,radius:1.69,color:[.471,.361,.89],number:96},t.exports[97]=t.exports.Bk={symbol:"Bk",name:"berkelium",mass:247,radius:1.66,color:[.541,.31,.89],number:97},t.exports[98]=t.exports.Cf={symbol:"Cf",name:"californium",mass:251,radius:1.68,color:[.631,.212,.831],number:98},t.exports[99]=t.exports.Es={symbol:"Es",name:"einsteinium",mass:252,radius:1.65,color:[.702,.122,.831],number:99},t.exports[100]=t.exports.Fm={symbol:"Fm",name:"fermium",mass:257,radius:1.67,color:[.702,.122,.729],number:100},t.exports[101]=t.exports.Md={symbol:"Md",name:"mendelevium",mass:258,radius:1.73,color:[.702,.051,.651],number:101},t.exports[102]=t.exports.No={symbol:"No",name:"nobelium",mass:259,radius:1.76,color:[.741,.051,.529],number:102},t.exports[103]=t.exports.Lr={symbol:"Lr",name:"lawrencium",mass:262,radius:1.61,color:[.78,0,.4],number:103},t.exports[104]=t.exports.Rf={symbol:"Rf",name:"rutherfordium",mass:261,radius:1.57,color:[.8,0,.349],number:104},t.exports[105]=t.exports.Db={symbol:"Db",name:"dubnium",mass:262,radius:1.49,color:[.82,0,.31],number:105},t.exports[106]=t.exports.Sg={symbol:"Sg",name:"seaborgium",mass:266,radius:1.43,color:[.851,0,.271],number:106},t.exports[107]=t.exports.Bh={symbol:"Bh",name:"bohrium",mass:264,radius:1.41,color:[.878,0,.22],number:107},t.exports[108]=t.exports.Hs={symbol:"Hs",name:"hassium",mass:277,radius:1.34,color:[.902,0,.18],number:108},t.exports[109]=t.exports.Mt={symbol:"Mt",name:"meitnerium",mass:268,radius:1.29,color:[.922,0,.149],number:109},t.exports[110]=t.exports.Ds={symbol:"Ds",name:"Ds",mass:271,radius:1.28,color:[.922,0,.149],number:110},t.exports[111]=t.exports.Uuu={symbol:"Uuu",name:"Uuu",mass:272,radius:1.21,color:[.922,0,.149],number:111},t.exports[112]=t.exports.Uub={symbol:"Uub",name:"Uub",mass:285,radius:1.22,color:[.922,0,.149],number:112},t.exports[113]=t.exports.Uut={symbol:"Uut",name:"Uut",mass:284,radius:1.36,color:[.922,0,.149],number:113},t.exports[114]=t.exports.Uuq={symbol:"Uuq",name:"Uuq",mass:289,radius:1.43,color:[.922,0,.149],number:114},t.exports[115]=t.exports.Uup={symbol:"Uup",name:"Uup",mass:288,radius:1.62,color:[.922,0,.149],number:115},t.exports[116]=t.exports.Uuh={symbol:"Uuh",name:"Uuh",mass:292,radius:1.75,color:[.922,0,.149],number:116},t.exports[117]=t.exports.Uus={symbol:"Uus",name:"Uus",mass:294,radius:1.65,color:[.922,0,.149],number:117},t.exports[118]=t.exports.Uuo={symbol:"Uuo",name:"Uuo",mass:296,radius:1.57,color:[.922,0,.149],number:118}},function(t,n,e){!function(t){"use strict";var e={};e.exports=n,function(t){if(!n)var n=1e-6;if(!e)var e="undefined"!=typeof Float32Array?Float32Array:Array;if(!r)var r=Math.random;var o={setMatrixArrayType:function(t){e=t}};void 0!==t&&(t.glMatrix=o);var a=Math.PI/180;o.toRadian=function(t){return t*a};var i,u={};u.create=function(){var t=new e(2);return t[0]=0,t[1]=0,t},u.clone=function(t){var n=new e(2);return n[0]=t[0],n[1]=t[1],n},u.fromValues=function(t,n){var r=new e(2);return r[0]=t,r[1]=n,r},u.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t},u.set=function(t,n,e){return t[0]=n,t[1]=e,t},u.add=function(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t},u.subtract=function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t},u.sub=u.subtract,u.multiply=function(t,n,e){return t[0]=n[0]*e[0],t[1]=n[1]*e[1],t},u.mul=u.multiply,u.divide=function(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t},u.div=u.divide,u.min=function(t,n,e){return t[0]=Math.min(n[0],e[0]),t[1]=Math.min(n[1],e[1]),t},u.max=function(t,n,e){return t[0]=Math.max(n[0],e[0]),t[1]=Math.max(n[1],e[1]),t},u.scale=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t},u.scaleAndAdd=function(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t},u.distance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1];return Math.sqrt(e*e+r*r)},u.dist=u.distance,u.squaredDistance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1];return e*e+r*r},u.sqrDist=u.squaredDistance,u.length=function(t){var n=t[0],e=t[1];return Math.sqrt(n*n+e*e)},u.len=u.length,u.squaredLength=function(t){var n=t[0],e=t[1];return n*n+e*e},u.sqrLen=u.squaredLength,u.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t},u.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t},u.normalize=function(t,n){var e=n[0],r=n[1],o=e*e+r*r;return o>0&&(o=1/Math.sqrt(o),t[0]=n[0]*o,t[1]=n[1]*o),t},u.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]},u.cross=function(t,n,e){var r=n[0]*e[1]-n[1]*e[0];return t[0]=t[1]=0,t[2]=r,t},u.lerp=function(t,n,e,r){var o=n[0],a=n[1];return t[0]=o+r*(e[0]-o),t[1]=a+r*(e[1]-a),t},u.random=function(t,n){n=n||1;var e=2*r()*Math.PI;return t[0]=Math.cos(e)*n,t[1]=Math.sin(e)*n,t},u.transformMat2=function(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[2]*o,t[1]=e[1]*r+e[3]*o,t},u.transformMat2d=function(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[2]*o+e[4],t[1]=e[1]*r+e[3]*o+e[5],t},u.transformMat3=function(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[3]*o+e[6],t[1]=e[1]*r+e[4]*o+e[7],t},u.transformMat4=function(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[4]*o+e[12],t[1]=e[1]*r+e[5]*o+e[13],t},u.forEach=(i=u.create(),function(t,n,e,r,o,a){var u,s;for(n||(n=2),e||(e=0),s=r?Math.min(r*n+e,t.length):t.length,u=e;u<s;u+=n)i[0]=t[u],i[1]=t[u+1],o(i,i,a),t[u]=i[0],t[u+1]=i[1];return t}),u.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},void 0!==t&&(t.vec2=u);var s={create:function(){var t=new e(3);return t[0]=0,t[1]=0,t[2]=0,t},clone:function(t){var n=new e(3);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n},fromValues:function(t,n,r){var o=new e(3);return o[0]=t,o[1]=n,o[2]=r,o},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t},set:function(t,n,e,r){return t[0]=n,t[1]=e,t[2]=r,t},add:function(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t},subtract:function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t}};s.sub=s.subtract,s.multiply=function(t,n,e){return t[0]=n[0]*e[0],t[1]=n[1]*e[1],t[2]=n[2]*e[2],t},s.mul=s.multiply,s.divide=function(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t},s.div=s.divide,s.min=function(t,n,e){return t[0]=Math.min(n[0],e[0]),t[1]=Math.min(n[1],e[1]),t[2]=Math.min(n[2],e[2]),t},s.max=function(t,n,e){return t[0]=Math.max(n[0],e[0]),t[1]=Math.max(n[1],e[1]),t[2]=Math.max(n[2],e[2]),t},s.scale=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t},s.scaleAndAdd=function(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t[2]=n[2]+e[2]*r,t},s.distance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2];return Math.sqrt(e*e+r*r+o*o)},s.dist=s.distance,s.squaredDistance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2];return e*e+r*r+o*o},s.sqrDist=s.squaredDistance,s.length=function(t){var n=t[0],e=t[1],r=t[2];return Math.sqrt(n*n+e*e+r*r)},s.len=s.length,s.squaredLength=function(t){var n=t[0],e=t[1],r=t[2];return n*n+e*e+r*r},s.sqrLen=s.squaredLength,s.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t},s.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t},s.normalize=function(t,n){var e=n[0],r=n[1],o=n[2],a=e*e+r*r+o*o;return a>0&&(a=1/Math.sqrt(a),t[0]=n[0]*a,t[1]=n[1]*a,t[2]=n[2]*a),t},s.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]},s.cross=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=e[0],u=e[1],s=e[2];return t[0]=o*s-a*u,t[1]=a*i-r*s,t[2]=r*u-o*i,t},s.lerp=function(t,n,e,r){var o=n[0],a=n[1],i=n[2];return t[0]=o+r*(e[0]-o),t[1]=a+r*(e[1]-a),t[2]=i+r*(e[2]-i),t},s.random=function(t,n){n=n||1;var e=2*r()*Math.PI,o=2*r()-1,a=Math.sqrt(1-o*o)*n;return t[0]=Math.cos(e)*a,t[1]=Math.sin(e)*a,t[2]=o*n,t},s.transformMat4=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=e[3]*r+e[7]*o+e[11]*a+e[15];return i=i||1,t[0]=(e[0]*r+e[4]*o+e[8]*a+e[12])/i,t[1]=(e[1]*r+e[5]*o+e[9]*a+e[13])/i,t[2]=(e[2]*r+e[6]*o+e[10]*a+e[14])/i,t},s.transformMat3=function(t,n,e){var r=n[0],o=n[1],a=n[2];return t[0]=r*e[0]+o*e[3]+a*e[6],t[1]=r*e[1]+o*e[4]+a*e[7],t[2]=r*e[2]+o*e[5]+a*e[8],t},s.transformQuat=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=e[0],u=e[1],s=e[2],l=e[3],c=l*r+u*a-s*o,f=l*o+s*r-i*a,h=l*a+i*o-u*r,p=-i*r-u*o-s*a;return t[0]=c*l+p*-i+f*-s-h*-u,t[1]=f*l+p*-u+h*-i-c*-s,t[2]=h*l+p*-s+c*-u-f*-i,t},s.rotateX=function(t,n,e,r){var o=[],a=[];return o[0]=n[0]-e[0],o[1]=n[1]-e[1],o[2]=n[2]-e[2],a[0]=o[0],a[1]=o[1]*Math.cos(r)-o[2]*Math.sin(r),a[2]=o[1]*Math.sin(r)+o[2]*Math.cos(r),t[0]=a[0]+e[0],t[1]=a[1]+e[1],t[2]=a[2]+e[2],t},s.rotateY=function(t,n,e,r){var o=[],a=[];return o[0]=n[0]-e[0],o[1]=n[1]-e[1],o[2]=n[2]-e[2],a[0]=o[2]*Math.sin(r)+o[0]*Math.cos(r),a[1]=o[1],a[2]=o[2]*Math.cos(r)-o[0]*Math.sin(r),t[0]=a[0]+e[0],t[1]=a[1]+e[1],t[2]=a[2]+e[2],t},s.rotateZ=function(t,n,e,r){var o=[],a=[];return o[0]=n[0]-e[0],o[1]=n[1]-e[1],o[2]=n[2]-e[2],a[0]=o[0]*Math.cos(r)-o[1]*Math.sin(r),a[1]=o[0]*Math.sin(r)+o[1]*Math.cos(r),a[2]=o[2],t[0]=a[0]+e[0],t[1]=a[1]+e[1],t[2]=a[2]+e[2],t},s.forEach=function(){var t=s.create();return function(n,e,r,o,a,i){var u,s;for(e||(e=3),r||(r=0),s=o?Math.min(o*e+r,n.length):n.length,u=r;u<s;u+=e)t[0]=n[u],t[1]=n[u+1],t[2]=n[u+2],a(t,t,i),n[u]=t[0],n[u+1]=t[1],n[u+2]=t[2];return n}}(),s.angle=function(t,n){var e=s.fromValues(t[0],t[1],t[2]),r=s.fromValues(n[0],n[1],n[2]);s.normalize(e,e),s.normalize(r,r);var o=s.dot(e,r);return o>1?0:Math.acos(o)},s.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},void 0!==t&&(t.vec3=s);var l={create:function(){var t=new e(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},clone:function(t){var n=new e(4);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n},fromValues:function(t,n,r,o){var a=new e(4);return a[0]=t,a[1]=n,a[2]=r,a[3]=o,a},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t},set:function(t,n,e,r,o){return t[0]=n,t[1]=e,t[2]=r,t[3]=o,t},add:function(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t[3]=n[3]+e[3],t},subtract:function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t[3]=n[3]-e[3],t}};l.sub=l.subtract,l.multiply=function(t,n,e){return t[0]=n[0]*e[0],t[1]=n[1]*e[1],t[2]=n[2]*e[2],t[3]=n[3]*e[3],t},l.mul=l.multiply,l.divide=function(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t[3]=n[3]/e[3],t},l.div=l.divide,l.min=function(t,n,e){return t[0]=Math.min(n[0],e[0]),t[1]=Math.min(n[1],e[1]),t[2]=Math.min(n[2],e[2]),t[3]=Math.min(n[3],e[3]),t},l.max=function(t,n,e){return t[0]=Math.max(n[0],e[0]),t[1]=Math.max(n[1],e[1]),t[2]=Math.max(n[2],e[2]),t[3]=Math.max(n[3],e[3]),t},l.scale=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t},l.scaleAndAdd=function(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t[2]=n[2]+e[2]*r,t[3]=n[3]+e[3]*r,t},l.distance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2],a=n[3]-t[3];return Math.sqrt(e*e+r*r+o*o+a*a)},l.dist=l.distance,l.squaredDistance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2],a=n[3]-t[3];return e*e+r*r+o*o+a*a},l.sqrDist=l.squaredDistance,l.length=function(t){var n=t[0],e=t[1],r=t[2],o=t[3];return Math.sqrt(n*n+e*e+r*r+o*o)},l.len=l.length,l.squaredLength=function(t){var n=t[0],e=t[1],r=t[2],o=t[3];return n*n+e*e+r*r+o*o},l.sqrLen=l.squaredLength,l.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=-n[3],t},l.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t[3]=1/n[3],t},l.normalize=function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e*e+r*r+o*o+a*a;return i>0&&(i=1/Math.sqrt(i),t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=n[3]*i),t},l.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]*n[3]},l.lerp=function(t,n,e,r){var o=n[0],a=n[1],i=n[2],u=n[3];return t[0]=o+r*(e[0]-o),t[1]=a+r*(e[1]-a),t[2]=i+r*(e[2]-i),t[3]=u+r*(e[3]-u),t},l.random=function(t,n){return n=n||1,t[0]=r(),t[1]=r(),t[2]=r(),t[3]=r(),l.normalize(t,t),l.scale(t,t,n),t},l.transformMat4=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3];return t[0]=e[0]*r+e[4]*o+e[8]*a+e[12]*i,t[1]=e[1]*r+e[5]*o+e[9]*a+e[13]*i,t[2]=e[2]*r+e[6]*o+e[10]*a+e[14]*i,t[3]=e[3]*r+e[7]*o+e[11]*a+e[15]*i,t},l.transformQuat=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=e[0],u=e[1],s=e[2],l=e[3],c=l*r+u*a-s*o,f=l*o+s*r-i*a,h=l*a+i*o-u*r,p=-i*r-u*o-s*a;return t[0]=c*l+p*-i+f*-s-h*-u,t[1]=f*l+p*-u+h*-i-c*-s,t[2]=h*l+p*-s+c*-u-f*-i,t},l.forEach=function(){var t=l.create();return function(n,e,r,o,a,i){var u,s;for(e||(e=4),r||(r=0),s=o?Math.min(o*e+r,n.length):n.length,u=r;u<s;u+=e)t[0]=n[u],t[1]=n[u+1],t[2]=n[u+2],t[3]=n[u+3],a(t,t,i),n[u]=t[0],n[u+1]=t[1],n[u+2]=t[2],n[u+3]=t[3];return n}}(),l.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},void 0!==t&&(t.vec4=l);var c={create:function(){var t=new e(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},clone:function(t){var n=new e(4);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},transpose:function(t,n){if(t===n){var e=n[1];t[1]=n[2],t[2]=e}else t[0]=n[0],t[1]=n[2],t[2]=n[1],t[3]=n[3];return t},invert:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e*a-o*r;return i?(i=1/i,t[0]=a*i,t[1]=-r*i,t[2]=-o*i,t[3]=e*i,t):null},adjoint:function(t,n){var e=n[0];return t[0]=n[3],t[1]=-n[1],t[2]=-n[2],t[3]=e,t},determinant:function(t){return t[0]*t[3]-t[2]*t[1]},multiply:function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=e[0],s=e[1],l=e[2],c=e[3];return t[0]=r*u+a*s,t[1]=o*u+i*s,t[2]=r*l+a*c,t[3]=o*l+i*c,t}};c.mul=c.multiply,c.rotate=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=Math.sin(e),s=Math.cos(e);return t[0]=r*s+a*u,t[1]=o*s+i*u,t[2]=r*-u+a*s,t[3]=o*-u+i*s,t},c.scale=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=e[0],s=e[1];return t[0]=r*u,t[1]=o*u,t[2]=a*s,t[3]=i*s,t},c.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},c.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2))},c.LDU=function(t,n,e,r){return t[2]=r[2]/r[0],e[0]=r[0],e[1]=r[1],e[3]=r[3]-t[2]*e[1],[t,n,e]},void 0!==t&&(t.mat2=c);var f={create:function(){var t=new e(6);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},clone:function(t){var n=new e(6);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},invert:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=e*a-r*o;return s?(s=1/s,t[0]=a*s,t[1]=-r*s,t[2]=-o*s,t[3]=e*s,t[4]=(o*u-a*i)*s,t[5]=(r*i-e*u)*s,t):null},determinant:function(t){return t[0]*t[3]-t[1]*t[2]},multiply:function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=e[0],c=e[1],f=e[2],h=e[3],p=e[4],d=e[5];return t[0]=r*l+a*c,t[1]=o*l+i*c,t[2]=r*f+a*h,t[3]=o*f+i*h,t[4]=r*p+a*d+u,t[5]=o*p+i*d+s,t}};f.mul=f.multiply,f.rotate=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=Math.sin(e),c=Math.cos(e);return t[0]=r*c+a*l,t[1]=o*c+i*l,t[2]=r*-l+a*c,t[3]=o*-l+i*c,t[4]=u,t[5]=s,t},f.scale=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=e[0],c=e[1];return t[0]=r*l,t[1]=o*l,t[2]=a*c,t[3]=i*c,t[4]=u,t[5]=s,t},f.translate=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=e[0],c=e[1];return t[0]=r,t[1]=o,t[2]=a,t[3]=i,t[4]=r*l+a*c+u,t[5]=o*l+i*c+s,t},f.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},f.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+1)},void 0!==t&&(t.mat2d=f);var h={create:function(){var t=new e(9);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},fromMat4:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[4],t[4]=n[5],t[5]=n[6],t[6]=n[8],t[7]=n[9],t[8]=n[10],t},clone:function(t){var n=new e(9);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},transpose:function(t,n){if(t===n){var e=n[1],r=n[2],o=n[5];t[1]=n[3],t[2]=n[6],t[3]=e,t[5]=n[7],t[6]=r,t[7]=o}else t[0]=n[0],t[1]=n[3],t[2]=n[6],t[3]=n[1],t[4]=n[4],t[5]=n[7],t[6]=n[2],t[7]=n[5],t[8]=n[8];return t},invert:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=n[6],l=n[7],c=n[8],f=c*i-u*l,h=-c*a+u*s,p=l*a-i*s,d=e*f+r*h+o*p;return d?(d=1/d,t[0]=f*d,t[1]=(-c*r+o*l)*d,t[2]=(u*r-o*i)*d,t[3]=h*d,t[4]=(c*e-o*s)*d,t[5]=(-u*e+o*a)*d,t[6]=p*d,t[7]=(-l*e+r*s)*d,t[8]=(i*e-r*a)*d,t):null},adjoint:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=n[6],l=n[7],c=n[8];return t[0]=i*c-u*l,t[1]=o*l-r*c,t[2]=r*u-o*i,t[3]=u*s-a*c,t[4]=e*c-o*s,t[5]=o*a-e*u,t[6]=a*l-i*s,t[7]=r*s-e*l,t[8]=e*i-r*a,t},determinant:function(t){var n=t[0],e=t[1],r=t[2],o=t[3],a=t[4],i=t[5],u=t[6],s=t[7],l=t[8];return n*(l*a-i*s)+e*(-l*o+i*u)+r*(s*o-a*u)},multiply:function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=n[6],c=n[7],f=n[8],h=e[0],p=e[1],d=e[2],m=e[3],g=e[4],v=e[5],y=e[6],b=e[7],x=e[8];return t[0]=h*r+p*i+d*l,t[1]=h*o+p*u+d*c,t[2]=h*a+p*s+d*f,t[3]=m*r+g*i+v*l,t[4]=m*o+g*u+v*c,t[5]=m*a+g*s+v*f,t[6]=y*r+b*i+x*l,t[7]=y*o+b*u+x*c,t[8]=y*a+b*s+x*f,t}};h.mul=h.multiply,h.translate=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=n[6],c=n[7],f=n[8],h=e[0],p=e[1];return t[0]=r,t[1]=o,t[2]=a,t[3]=i,t[4]=u,t[5]=s,t[6]=h*r+p*i+l,t[7]=h*o+p*u+c,t[8]=h*a+p*s+f,t},h.rotate=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=n[6],c=n[7],f=n[8],h=Math.sin(e),p=Math.cos(e);return t[0]=p*r+h*i,t[1]=p*o+h*u,t[2]=p*a+h*s,t[3]=p*i-h*r,t[4]=p*u-h*o,t[5]=p*s-h*a,t[6]=l,t[7]=c,t[8]=f,t},h.scale=function(t,n,e){var r=e[0],o=e[1];return t[0]=r*n[0],t[1]=r*n[1],t[2]=r*n[2],t[3]=o*n[3],t[4]=o*n[4],t[5]=o*n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t},h.fromMat2d=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=0,t[3]=n[2],t[4]=n[3],t[5]=0,t[6]=n[4],t[7]=n[5],t[8]=1,t},h.fromQuat=function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e+e,u=r+r,s=o+o,l=e*i,c=r*i,f=r*u,h=o*i,p=o*u,d=o*s,m=a*i,g=a*u,v=a*s;return t[0]=1-f-d,t[3]=c-v,t[6]=h+g,t[1]=c+v,t[4]=1-l-d,t[7]=p-m,t[2]=h-g,t[5]=p+m,t[8]=1-l-f,t},h.normalFromMat4=function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=n[6],l=n[7],c=n[8],f=n[9],h=n[10],p=n[11],d=n[12],m=n[13],g=n[14],v=n[15],y=e*u-r*i,b=e*s-o*i,x=e*l-a*i,M=r*s-o*u,w=r*l-a*u,_=o*l-a*s,k=c*m-f*d,S=c*g-h*d,A=c*v-p*d,E=f*g-h*m,T=f*v-p*m,R=h*v-p*g,N=y*R-b*T+x*E+M*A-w*S+_*k;return N?(N=1/N,t[0]=(u*R-s*T+l*E)*N,t[1]=(s*A-i*R-l*S)*N,t[2]=(i*T-u*A+l*k)*N,t[3]=(o*T-r*R-a*E)*N,t[4]=(e*R-o*A+a*S)*N,t[5]=(r*A-e*T-a*k)*N,t[6]=(m*_-g*w+v*M)*N,t[7]=(g*x-d*_-v*b)*N,t[8]=(d*w-m*x+v*y)*N,t):null},h.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},h.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2))},void 0!==t&&(t.mat3=h);var p={create:function(){var t=new e(16);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},clone:function(t){var n=new e(16);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},transpose:function(t,n){if(t===n){var e=n[1],r=n[2],o=n[3],a=n[6],i=n[7],u=n[11];t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=e,t[6]=n[9],t[7]=n[13],t[8]=r,t[9]=a,t[11]=n[14],t[12]=o,t[13]=i,t[14]=u}else t[0]=n[0],t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=n[1],t[5]=n[5],t[6]=n[9],t[7]=n[13],t[8]=n[2],t[9]=n[6],t[10]=n[10],t[11]=n[14],t[12]=n[3],t[13]=n[7],t[14]=n[11],t[15]=n[15];return t},invert:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=n[6],l=n[7],c=n[8],f=n[9],h=n[10],p=n[11],d=n[12],m=n[13],g=n[14],v=n[15],y=e*u-r*i,b=e*s-o*i,x=e*l-a*i,M=r*s-o*u,w=r*l-a*u,_=o*l-a*s,k=c*m-f*d,S=c*g-h*d,A=c*v-p*d,E=f*g-h*m,T=f*v-p*m,R=h*v-p*g,N=y*R-b*T+x*E+M*A-w*S+_*k;return N?(N=1/N,t[0]=(u*R-s*T+l*E)*N,t[1]=(o*T-r*R-a*E)*N,t[2]=(m*_-g*w+v*M)*N,t[3]=(h*w-f*_-p*M)*N,t[4]=(s*A-i*R-l*S)*N,t[5]=(e*R-o*A+a*S)*N,t[6]=(g*x-d*_-v*b)*N,t[7]=(c*_-h*x+p*b)*N,t[8]=(i*T-u*A+l*k)*N,t[9]=(r*A-e*T-a*k)*N,t[10]=(d*w-m*x+v*y)*N,t[11]=(f*x-c*w-p*y)*N,t[12]=(u*S-i*E-s*k)*N,t[13]=(e*E-r*S+o*k)*N,t[14]=(m*b-d*M-g*y)*N,t[15]=(c*M-f*b+h*y)*N,t):null},adjoint:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=n[6],l=n[7],c=n[8],f=n[9],h=n[10],p=n[11],d=n[12],m=n[13],g=n[14],v=n[15];return t[0]=u*(h*v-p*g)-f*(s*v-l*g)+m*(s*p-l*h),t[1]=-(r*(h*v-p*g)-f*(o*v-a*g)+m*(o*p-a*h)),t[2]=r*(s*v-l*g)-u*(o*v-a*g)+m*(o*l-a*s),t[3]=-(r*(s*p-l*h)-u*(o*p-a*h)+f*(o*l-a*s)),t[4]=-(i*(h*v-p*g)-c*(s*v-l*g)+d*(s*p-l*h)),t[5]=e*(h*v-p*g)-c*(o*v-a*g)+d*(o*p-a*h),t[6]=-(e*(s*v-l*g)-i*(o*v-a*g)+d*(o*l-a*s)),t[7]=e*(s*p-l*h)-i*(o*p-a*h)+c*(o*l-a*s),t[8]=i*(f*v-p*m)-c*(u*v-l*m)+d*(u*p-l*f),t[9]=-(e*(f*v-p*m)-c*(r*v-a*m)+d*(r*p-a*f)),t[10]=e*(u*v-l*m)-i*(r*v-a*m)+d*(r*l-a*u),t[11]=-(e*(u*p-l*f)-i*(r*p-a*f)+c*(r*l-a*u)),t[12]=-(i*(f*g-h*m)-c*(u*g-s*m)+d*(u*h-s*f)),t[13]=e*(f*g-h*m)-c*(r*g-o*m)+d*(r*h-o*f),t[14]=-(e*(u*g-s*m)-i*(r*g-o*m)+d*(r*s-o*u)),t[15]=e*(u*h-s*f)-i*(r*h-o*f)+c*(r*s-o*u),t},determinant:function(t){var n=t[0],e=t[1],r=t[2],o=t[3],a=t[4],i=t[5],u=t[6],s=t[7],l=t[8],c=t[9],f=t[10],h=t[11],p=t[12],d=t[13],m=t[14],g=t[15];return(n*i-e*a)*(f*g-h*m)-(n*u-r*a)*(c*g-h*d)+(n*s-o*a)*(c*m-f*d)+(e*u-r*i)*(l*g-h*p)-(e*s-o*i)*(l*m-f*p)+(r*s-o*u)*(l*d-c*p)},multiply:function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=n[6],c=n[7],f=n[8],h=n[9],p=n[10],d=n[11],m=n[12],g=n[13],v=n[14],y=n[15],b=e[0],x=e[1],M=e[2],w=e[3];return t[0]=b*r+x*u+M*f+w*m,t[1]=b*o+x*s+M*h+w*g,t[2]=b*a+x*l+M*p+w*v,t[3]=b*i+x*c+M*d+w*y,b=e[4],x=e[5],M=e[6],w=e[7],t[4]=b*r+x*u+M*f+w*m,t[5]=b*o+x*s+M*h+w*g,t[6]=b*a+x*l+M*p+w*v,t[7]=b*i+x*c+M*d+w*y,b=e[8],x=e[9],M=e[10],w=e[11],t[8]=b*r+x*u+M*f+w*m,t[9]=b*o+x*s+M*h+w*g,t[10]=b*a+x*l+M*p+w*v,t[11]=b*i+x*c+M*d+w*y,b=e[12],x=e[13],M=e[14],w=e[15],t[12]=b*r+x*u+M*f+w*m,t[13]=b*o+x*s+M*h+w*g,t[14]=b*a+x*l+M*p+w*v,t[15]=b*i+x*c+M*d+w*y,t}};p.mul=p.multiply,p.translate=function(t,n,e){var r,o,a,i,u,s,l,c,f,h,p,d,m=e[0],g=e[1],v=e[2];return n===t?(t[12]=n[0]*m+n[4]*g+n[8]*v+n[12],t[13]=n[1]*m+n[5]*g+n[9]*v+n[13],t[14]=n[2]*m+n[6]*g+n[10]*v+n[14],t[15]=n[3]*m+n[7]*g+n[11]*v+n[15]):(r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=n[6],c=n[7],f=n[8],h=n[9],p=n[10],d=n[11],t[0]=r,t[1]=o,t[2]=a,t[3]=i,t[4]=u,t[5]=s,t[6]=l,t[7]=c,t[8]=f,t[9]=h,t[10]=p,t[11]=d,t[12]=r*m+u*g+f*v+n[12],t[13]=o*m+s*g+h*v+n[13],t[14]=a*m+l*g+p*v+n[14],t[15]=i*m+c*g+d*v+n[15]),t},p.scale=function(t,n,e){var r=e[0],o=e[1],a=e[2];return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=n[3]*r,t[4]=n[4]*o,t[5]=n[5]*o,t[6]=n[6]*o,t[7]=n[7]*o,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=n[11]*a,t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},p.rotate=function(t,e,r,o){var a,i,u,s,l,c,f,h,p,d,m,g,v,y,b,x,M,w,_,k,S,A,E,T,R=o[0],N=o[1],P=o[2],C=Math.sqrt(R*R+N*N+P*P);return Math.abs(C)<n?null:(R*=C=1/C,N*=C,P*=C,a=Math.sin(r),u=1-(i=Math.cos(r)),s=e[0],l=e[1],c=e[2],f=e[3],h=e[4],p=e[5],d=e[6],m=e[7],g=e[8],v=e[9],y=e[10],b=e[11],x=R*R*u+i,M=N*R*u+P*a,w=P*R*u-N*a,_=R*N*u-P*a,k=N*N*u+i,S=P*N*u+R*a,A=R*P*u+N*a,E=N*P*u-R*a,T=P*P*u+i,t[0]=s*x+h*M+g*w,t[1]=l*x+p*M+v*w,t[2]=c*x+d*M+y*w,t[3]=f*x+m*M+b*w,t[4]=s*_+h*k+g*S,t[5]=l*_+p*k+v*S,t[6]=c*_+d*k+y*S,t[7]=f*_+m*k+b*S,t[8]=s*A+h*E+g*T,t[9]=l*A+p*E+v*T,t[10]=c*A+d*E+y*T,t[11]=f*A+m*E+b*T,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)},p.rotateX=function(t,n,e){var r=Math.sin(e),o=Math.cos(e),a=n[4],i=n[5],u=n[6],s=n[7],l=n[8],c=n[9],f=n[10],h=n[11];return n!==t&&(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[4]=a*o+l*r,t[5]=i*o+c*r,t[6]=u*o+f*r,t[7]=s*o+h*r,t[8]=l*o-a*r,t[9]=c*o-i*r,t[10]=f*o-u*r,t[11]=h*o-s*r,t},p.rotateY=function(t,n,e){var r=Math.sin(e),o=Math.cos(e),a=n[0],i=n[1],u=n[2],s=n[3],l=n[8],c=n[9],f=n[10],h=n[11];return n!==t&&(t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[0]=a*o-l*r,t[1]=i*o-c*r,t[2]=u*o-f*r,t[3]=s*o-h*r,t[8]=a*r+l*o,t[9]=i*r+c*o,t[10]=u*r+f*o,t[11]=s*r+h*o,t},p.rotateZ=function(t,n,e){var r=Math.sin(e),o=Math.cos(e),a=n[0],i=n[1],u=n[2],s=n[3],l=n[4],c=n[5],f=n[6],h=n[7];return n!==t&&(t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[0]=a*o+l*r,t[1]=i*o+c*r,t[2]=u*o+f*r,t[3]=s*o+h*r,t[4]=l*o-a*r,t[5]=c*o-i*r,t[6]=f*o-u*r,t[7]=h*o-s*r,t},p.fromRotationTranslation=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=r+r,s=o+o,l=a+a,c=r*u,f=r*s,h=r*l,p=o*s,d=o*l,m=a*l,g=i*u,v=i*s,y=i*l;return t[0]=1-(p+m),t[1]=f+y,t[2]=h-v,t[3]=0,t[4]=f-y,t[5]=1-(c+m),t[6]=d+g,t[7]=0,t[8]=h+v,t[9]=d-g,t[10]=1-(c+p),t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t},p.fromQuat=function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e+e,u=r+r,s=o+o,l=e*i,c=r*i,f=r*u,h=o*i,p=o*u,d=o*s,m=a*i,g=a*u,v=a*s;return t[0]=1-f-d,t[1]=c+v,t[2]=h-g,t[3]=0,t[4]=c-v,t[5]=1-l-d,t[6]=p+m,t[7]=0,t[8]=h+g,t[9]=p-m,t[10]=1-l-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},p.frustum=function(t,n,e,r,o,a,i){var u=1/(e-n),s=1/(o-r),l=1/(a-i);return t[0]=2*a*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*a*s,t[6]=0,t[7]=0,t[8]=(e+n)*u,t[9]=(o+r)*s,t[10]=(i+a)*l,t[11]=-1,t[12]=0,t[13]=0,t[14]=i*a*2*l,t[15]=0,t},p.perspective=function(t,n,e,r,o){var a=1/Math.tan(n/2),i=1/(r-o);return t[0]=a/e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(o+r)*i,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*o*r*i,t[15]=0,t},p.ortho=function(t,n,e,r,o,a,i){var u=1/(n-e),s=1/(r-o),l=1/(a-i);return t[0]=-2*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(n+e)*u,t[13]=(o+r)*s,t[14]=(i+a)*l,t[15]=1,t},p.lookAt=function(t,e,r,o){var a,i,u,s,l,c,f,h,d,m,g=e[0],v=e[1],y=e[2],b=o[0],x=o[1],M=o[2],w=r[0],_=r[1],k=r[2];return Math.abs(g-w)<n&&Math.abs(v-_)<n&&Math.abs(y-k)<n?p.identity(t):(f=g-w,h=v-_,d=y-k,a=x*(d*=m=1/Math.sqrt(f*f+h*h+d*d))-M*(h*=m),i=M*(f*=m)-b*d,u=b*h-x*f,(m=Math.sqrt(a*a+i*i+u*u))?(a*=m=1/m,i*=m,u*=m):(a=0,i=0,u=0),s=h*u-d*i,l=d*a-f*u,c=f*i-h*a,(m=Math.sqrt(s*s+l*l+c*c))?(s*=m=1/m,l*=m,c*=m):(s=0,l=0,c=0),t[0]=a,t[1]=s,t[2]=f,t[3]=0,t[4]=i,t[5]=l,t[6]=h,t[7]=0,t[8]=u,t[9]=c,t[10]=d,t[11]=0,t[12]=-(a*g+i*v+u*y),t[13]=-(s*g+l*v+c*y),t[14]=-(f*g+h*v+d*y),t[15]=1,t)},p.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},p.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2)+Math.pow(t[9],2)+Math.pow(t[10],2)+Math.pow(t[11],2)+Math.pow(t[12],2)+Math.pow(t[13],2)+Math.pow(t[14],2)+Math.pow(t[15],2))},void 0!==t&&(t.mat4=p);var d,m,g,v,y={};y.create=function(){var t=new e(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},y.rotationTo=(d=s.create(),m=s.fromValues(1,0,0),g=s.fromValues(0,1,0),function(t,n,e){var r=s.dot(n,e);return r<-.999999?(s.cross(d,m,n),s.length(d)<1e-6&&s.cross(d,g,n),s.normalize(d,d),y.setAxisAngle(t,d,Math.PI),t):r>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(s.cross(d,n,e),t[0]=d[0],t[1]=d[1],t[2]=d[2],t[3]=1+r,y.normalize(t,t))}),y.setAxes=(v=h.create(),function(t,n,e,r){return v[0]=e[0],v[3]=e[1],v[6]=e[2],v[1]=r[0],v[4]=r[1],v[7]=r[2],v[2]=-n[0],v[5]=-n[1],v[8]=-n[2],y.normalize(t,y.fromMat3(t,v))}),y.clone=l.clone,y.fromValues=l.fromValues,y.copy=l.copy,y.set=l.set,y.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},y.setAxisAngle=function(t,n,e){e*=.5;var r=Math.sin(e);return t[0]=r*n[0],t[1]=r*n[1],t[2]=r*n[2],t[3]=Math.cos(e),t},y.add=l.add,y.multiply=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=e[0],s=e[1],l=e[2],c=e[3];return t[0]=r*c+i*u+o*l-a*s,t[1]=o*c+i*s+a*u-r*l,t[2]=a*c+i*l+r*s-o*u,t[3]=i*c-r*u-o*s-a*l,t},y.mul=y.multiply,y.scale=l.scale,y.rotateX=function(t,n,e){e*=.5;var r=n[0],o=n[1],a=n[2],i=n[3],u=Math.sin(e),s=Math.cos(e);return t[0]=r*s+i*u,t[1]=o*s+a*u,t[2]=a*s-o*u,t[3]=i*s-r*u,t},y.rotateY=function(t,n,e){e*=.5;var r=n[0],o=n[1],a=n[2],i=n[3],u=Math.sin(e),s=Math.cos(e);return t[0]=r*s-a*u,t[1]=o*s+i*u,t[2]=a*s+r*u,t[3]=i*s-o*u,t},y.rotateZ=function(t,n,e){e*=.5;var r=n[0],o=n[1],a=n[2],i=n[3],u=Math.sin(e),s=Math.cos(e);return t[0]=r*s+o*u,t[1]=o*s-r*u,t[2]=a*s+i*u,t[3]=i*s-a*u,t},y.calculateW=function(t,n){var e=n[0],r=n[1],o=n[2];return t[0]=e,t[1]=r,t[2]=o,t[3]=Math.sqrt(Math.abs(1-e*e-r*r-o*o)),t},y.dot=l.dot,y.lerp=l.lerp,y.slerp=function(t,n,e,r){var o,a,i,u,s,l=n[0],c=n[1],f=n[2],h=n[3],p=e[0],d=e[1],m=e[2],g=e[3];return(a=l*p+c*d+f*m+h*g)<0&&(a=-a,p=-p,d=-d,m=-m,g=-g),1-a>1e-6?(o=Math.acos(a),i=Math.sin(o),u=Math.sin((1-r)*o)/i,s=Math.sin(r*o)/i):(u=1-r,s=r),t[0]=u*l+s*p,t[1]=u*c+s*d,t[2]=u*f+s*m,t[3]=u*h+s*g,t},y.invert=function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e*e+r*r+o*o+a*a,u=i?1/i:0;return t[0]=-e*u,t[1]=-r*u,t[2]=-o*u,t[3]=a*u,t},y.conjugate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=n[3],t},y.length=l.length,y.len=y.length,y.squaredLength=l.squaredLength,y.sqrLen=y.squaredLength,y.normalize=l.normalize,y.fromMat3=function(t,n){var e,r=n[0]+n[4]+n[8];if(r>0)e=Math.sqrt(r+1),t[3]=.5*e,e=.5/e,t[0]=(n[5]-n[7])*e,t[1]=(n[6]-n[2])*e,t[2]=(n[1]-n[3])*e;else{var o=0;n[4]>n[0]&&(o=1),n[8]>n[3*o+o]&&(o=2);var a=(o+1)%3,i=(o+2)%3;e=Math.sqrt(n[3*o+o]-n[3*a+a]-n[3*i+i]+1),t[o]=.5*e,e=.5/e,t[3]=(n[3*a+i]-n[3*i+a])*e,t[a]=(n[3*a+o]+n[3*o+a])*e,t[i]=(n[3*i+o]+n[3*o+i])*e}return t},y.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},void 0!==t&&(t.quat=y)}(e.exports)}()},function(t,n,e){"use strict";var r=e(7),o=e(6),a=e(22);function i(t,n,e){return Math.min(n,Math.max(t,e))}t.exports.new=function(){return{aspect:1,zoom:.125,translation:{x:0,y:0},atomScale:.6,relativeAtomScale:1,bondScale:.5,rotation:r.mat4.create(),ao:.75,aoRes:256,brightness:.5,outline:0,spf:32,bonds:!1,bondThreshold:1.2,bondShade:.5,atomShade:.5,resolution:768,dofStrength:0,dofPosition:.5,fxaa:1}},t.exports.center=function(t,n){for(var e=-1/0,a=1/0,i=-1/0,u=1/0,s=0;s<n.atoms.length;s++){var l=n.atoms[s],c=o[l.symbol].radius;c=2.5*t.atomScale*(1+(c-1)*t.relativeAtomScale);var f=r.vec4.fromValues(l.x,l.y,l.z,0);r.vec4.transformMat4(f,f,t.rotation),e=Math.max(e,f[0]+c),a=Math.min(a,f[0]-c),i=Math.max(i,f[1]+c),u=Math.min(u,f[1]-c)}var h=a+(e-a)/2,p=u+(i-u)/2;t.translation.x=h,t.translation.y=p;var d=Math.max(e-a,i-u);t.zoom=1/(1.01*d)},t.exports.override=function(t,n){for(var e in n)t[e]=n[e];l(t)},t.exports.clone=function(t){return s(u(t))};var u=t.exports.serialize=function(t){return JSON.stringify(t)},s=t.exports.deserialize=function(t){return(t=JSON.parse(t)).rotation=r.mat4.clone(t.rotation),t},l=t.exports.resolve=function(t){t.dofStrength=i(0,1,t.dofStrength),t.dofPosition=i(0,1,t.dofPosition),t.zoom=i(.001,2,t.zoom),t.atomScale=i(0,1,t.atomScale),t.relativeAtomScale=i(0,1,t.relativeAtomScale),t.bondScale=i(0,1,t.bondScale),t.bondShade=i(0,1,t.bondShade),t.atomShade=i(0,1,t.atomShade),t.ao=i(0,1,t.ao),t.brightness=i(0,1,t.brightness),t.outline=i(0,1,t.outline)};t.exports.translate=function(t,n,e){t.translation.x-=n/(t.resolution*t.zoom),t.translation.y+=e/(t.resolution*t.zoom),l(t)},t.exports.rotate=function(t,n,e){var o=r.mat4.create();r.mat4.rotateY(o,o,.005*n),r.mat4.rotateX(o,o,.005*e),r.mat4.multiply(t.rotation,o,t.rotation);var a=t.ao;t.ao=0,l(t),t.ao=a},t.exports.getRect=function(t){var n=1/t.zoom,e=n/t.aspect;return{bottom:-e/2+t.translation.y,top:e/2+t.translation.y,left:-n/2+t.translation.x,right:n/2+t.translation.x}},t.exports.getBondRadius=function(t){return t.bondScale*t.atomScale*(1+(a.MIN_ATOM_RADIUS-1)*t.relativeAtomScale)}},function(t,n,e){"use strict";e.d(n,"a",(function(){return a}));var r=e(3),o=e(4);function a(t){return function n(e,a){switch(arguments.length){case 0:return n;case 1:return Object(o.a)(e)?n:Object(r.a)((function(n){return t(e,n)}));default:return Object(o.a)(e)&&Object(o.a)(a)?n:Object(o.a)(e)?Object(r.a)((function(n){return t(n,a)})):Object(o.a)(a)?Object(r.a)((function(n){return t(e,n)})):t(e,a)}}}},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"c",(function(){return g})),e.d(n,"b",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.alignmentChart),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.propTypes={id:o.a.string,setProps:o.a.func,eventDatum:o.a.string,data:o.a.string,extension:o.a.string,colorscale:o.a.oneOfType([o.a.string,o.a.object]),opacity:o.a.oneOfType([o.a.number,o.a.string]),textcolor:o.a.string,textsize:o.a.oneOfType([o.a.number,o.a.string]),showlabel:o.a.bool,showid:o.a.bool,showconservation:o.a.bool,conservationcolor:o.a.string,conservationcolorscale:o.a.oneOfType([o.a.string,o.a.array]),conservationopacity:o.a.oneOfType([o.a.number,o.a.string]),conservationmethod:o.a.oneOf(["conservation","entropy"]),correctgap:o.a.bool,showgap:o.a.bool,gapcolor:o.a.string,gapcolorscale:o.a.oneOfType([o.a.string,o.a.array]),gapopacity:o.a.oneOfType([o.a.number,o.a.string]),groupbars:o.a.bool,showconsensus:o.a.bool,tilewidth:o.a.number,tileheight:o.a.number,overview:o.a.oneOf(["heatmap","slider","none"]),numtiles:o.a.number,scrollskip:o.a.number,tickstart:o.a.oneOfType([o.a.number,o.a.string]),ticksteps:o.a.oneOfType([o.a.number,o.a.string]),width:o.a.oneOfType([o.a.number,o.a.string]),height:o.a.oneOfType([o.a.number,o.a.string])},m.defaultProps={extension:"fasta",colorscale:"clustal2",opacity:null,textcolor:null,textsize:10,showlabel:!0,showid:!0,showconservation:!0,conservationcolor:null,conservationcolorscale:"Viridis",conservationopacity:null,conservationmethod:"entropy",correctgap:!0,showgap:!0,gapcolor:"grey",gapcolorscale:null,gapopacity:null,groupbars:!1,showconsensus:!0,tilewidth:16,tileheight:16,numtiles:null,overview:"heatmap",scrollskip:10,tickstart:null,ticksteps:null,width:null,height:900};var g=m.propTypes,v=m.defaultProps},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.ideogram),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.defaultProps={organism:"human",dataDir:"https://unpkg.com/ideogram@1.5.0/dist/data/bands/native/",annotationsColor:"#F00",annotationsLayout:"tracks",barWidth:3,chrHeight:400,chrMargin:10,chrWidth:10,ploidy:1,rotatable:!0,showBandLabels:!1,showChromosomeLabels:!0,showAnnotTooltip:!0,showFullyBanded:!0,showNonNuclearChromosomes:!1},m.propTypes={id:o.a.string.isRequired,style:o.a.object,setProps:o.a.func,className:o.a.string,annotationsLayout:o.a.oneOf(["tracks","histogram","overlay"]),annotations:o.a.arrayOf(o.a.shape({name:o.a.string,chr:o.a.string,start:o.a.number,stop:o.a.number})),annotationsPath:o.a.string,annotationsData:o.a.string,annotationTracks:o.a.arrayOf(o.a.object),annotationHeight:o.a.number,annotationsColor:o.a.string,histogramScaling:o.a.oneOf(["absolute","relative"]),barWidth:o.a.number,showAnnotTooltip:o.a.bool,assembly:o.a.string,brush:o.a.string,brushData:o.a.shape({start:o.a.string,end:o.a.string,extent:o.a.string}),container:o.a.string,chrHeight:o.a.number,chrMargin:o.a.number,chrWidth:o.a.number,chromosomes:o.a.oneOfType([o.a.arrayOf(o.a.string),o.a.object]),dataDir:o.a.string,organism:o.a.oneOfType([o.a.string,o.a.number]),localOrganism:o.a.object,homology:o.a.shape({chrOne:o.a.shape({organism:o.a.string.isRequired,start:o.a.arrayOf(o.a.number.isRequired),stop:o.a.arrayOf(o.a.number.isRequired)}),chrTwo:o.a.shape({organism:o.a.string.isRequired,start:o.a.arrayOf(o.a.number.isRequired),stop:o.a.arrayOf(o.a.number.isRequired)})}),perspective:o.a.oneOf(["comparative"]),fullChromosomeLabels:o.a.bool,resolution:o.a.number,filterable:o.a.bool,orientation:o.a.oneOf(["vertical","horizontal"]),ploidy:o.a.number,ploidyDesc:o.a.arrayOf(o.a.object),ancestors:o.a.object,rangeSet:o.a.arrayOf(o.a.object),rotatable:o.a.bool,rotated:o.a.bool,sex:o.a.oneOf(["male","female"]),showChromosomeLabels:o.a.bool,showBandLabels:o.a.bool,showFullyBanded:o.a.bool,showNonNuclearChromosomes:o.a.bool};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(1),o=e.n(r),a=e(2),i=e(0),u=e.n(i);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(r.lazy)(a.a.igv),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,a,i;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(a=[{key:"render",value:function(){return o.a.createElement(r.Suspense,{fallback:null},o.a.createElement(d,this.props))}}])&&c(e.prototype,a),i&&c(e,i),n}(r.Component);m.defaultProps={},m.propTypes={id:u.a.string,setProps:u.a.func,style:u.a.object,className:u.a.string,genome:u.a.string,reference:u.a.object,locus:u.a.string,minimumBases:u.a.number,tracks:u.a.array};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.molecule2dViewer),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.defaultProps={width:500,height:500,modelData:{nodes:[],links:[]}},m.propTypes={id:o.a.string,setProps:o.a.func,selectedAtomIds:o.a.arrayOf(o.a.number),width:o.a.number,height:o.a.number,modelData:o.a.shape({nodes:o.a.arrayOf(o.a.shape({id:o.a.number,atom:o.a.string})),links:o.a.arrayOf(o.a.shape({id:o.a.number,source:o.a.number|o.a.shape,target:o.a.number|o.a.shape,bond:o.a.number,strength:o.a.number,distance:o.a.number}))})};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.molecule3dViewer),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.defaultProps={selectionType:"atom",backgroundColor:"#FFFFFF",backgroundOpacity:0},m.propTypes={id:o.a.string,setProps:o.a.func,selectionType:o.a.oneOf(["atom","residue","chain"]),backgroundColor:o.a.string,backgroundOpacity:o.a.number,styles:o.a.arrayOf(o.a.shape({color:o.a.string,visualization_type:o.a.oneOf(["cartoon","sphere","stick"])})),modelData:o.a.shape({atoms:o.a.array,bonds:o.a.array}),atomLabelsShown:o.a.bool,selectedAtomIds:o.a.array,labels:o.a.array,onRenderNewData:o.a.func,onChangeSelection:o.a.func};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.needlePlot),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.propTypes={id:o.a.string,mutationData:o.a.shape({x:o.a.oneOfType([o.a.string,o.a.array]),y:o.a.oneOfType([o.a.string,o.a.array]),mutationGroups:o.a.arrayOf(o.a.string),domains:o.a.array}),xlabel:o.a.string,ylabel:o.a.string,rangeSlider:o.a.bool,needleStyle:o.a.shape({stemColor:o.a.string,stemThickness:o.a.number,stemConstHeight:o.a.bool,headSize:o.a.number,headColor:o.a.oneOfType([o.a.array,o.a.string]),headSymbol:o.a.oneOfType([o.a.array,o.a.string])}),domainStyle:o.a.shape({domainColor:o.a.array,displayMinorDomains:o.a.bool}),setProps:o.a.func},m.defaultProps={mutationData:{x:[],y:[],domains:[],mutationGroups:[]},rangeSlider:!1,needleStyle:{stemColor:"#444",stemThickness:.5,stemConstHeight:!1,headSize:5,headColor:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999","#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999","#e41a1c"],headSymbol:"circle"},domainStyle:{displayMinorDomains:!1,domainColor:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f","#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69"]}};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(1),o=e.n(r),a=e(2),i=e(0),u=e.n(i);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(r.lazy)(a.a.nglmoleculeViewer),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,a,i;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(a=[{key:"render",value:function(){return o.a.createElement(r.Suspense,{fallback:null},o.a.createElement(d,this.props))}}])&&c(e.prototype,a),i&&c(e,i),n}(r.Component);m.defaultProps={data:[{filename:"placeholder",ext:"",selectedValue:"placeholder",chain:"ALL",aaRange:"ALL",chosen:{chosenAtoms:"",chosenResidues:""},color:"red",config:{input:"",type:"text/plain"},uploaded:!1,resetView:!1}],width:"500px",height:"500px",stageParameters:{quality:"medium",backgroundColor:"white",cameraType:"perspective"},imageParameters:{antialias:!0,transparent:!0,trim:!0,defaultFilename:"dash-bio_ngl_output"},downloadImage:!1,molStyles:{representations:["cartoon","axes+box"],chosenAtomsColor:"#ffffff",chosenAtomsRadius:1,molSpacingXaxis:100,sideByside:!1}},m.propTypes={id:u.a.string,setProps:u.a.func,width:u.a.oneOfType([u.a.string,u.a.number]),height:u.a.oneOfType([u.a.string,u.a.number]),stageParameters:u.a.exact({quality:u.a.string,backgroundColor:u.a.string,cameraType:u.a.string}),imageParameters:u.a.exact({antialias:u.a.bool,transparent:u.a.bool,trim:u.a.bool,defaultFilename:u.a.string}),downloadImage:u.a.bool,pdbString:u.a.string,data:u.a.arrayOf(u.a.exact({filename:u.a.string.isRequired,ext:u.a.string,selectedValue:u.a.string.isRequired,chain:u.a.string.isRequired,aaRange:u.a.string.isRequired,color:u.a.string.isRequired,chosen:u.a.exact({residues:u.a.string.isRequired,atoms:u.a.string.isRequired}),config:u.a.exact({input:u.a.string.isRequired,type:u.a.string.isRequired}),uploaded:u.a.bool.isRequired,resetView:u.a.bool.isRequired})),molStyles:u.a.exact({representations:u.a.arrayOf(u.a.string),chosenAtomsColor:u.a.string.isRequired,chosenAtomsRadius:u.a.number.isRequired,molSpacingXaxis:u.a.number.isRequired,sideByside:u.a.bool.isRequired})};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.oncoPrint),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.propTypes={id:o.a.string,setProps:o.a.func,eventDatum:o.a.object,data:o.a.array,padding:o.a.number,colorscale:o.a.oneOfType([o.a.bool,o.a.object]),backgroundcolor:o.a.string,range:o.a.array,showlegend:o.a.bool,showoverview:o.a.bool,width:o.a.oneOfType([o.a.number,o.a.string]),height:o.a.oneOfType([o.a.number,o.a.string])},m.defaultProps={padding:.05,colorscale:null,backgroundcolor:"rgb(190, 190, 190)",range:[null,null],showlegend:!0,showoverview:!0,width:null,height:500};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.sequenceViewer),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.defaultProps={sequence:"-",showLineNumbers:!0,wrapAminoAcids:!0,charsPerLine:40,toolbar:!1,search:!0,title:"",sequenceMaxHeight:"400px",badge:!0,selection:[],coverage:[]},m.propTypes={id:o.a.string,sequence:o.a.string,showLineNumbers:o.a.bool,wrapAminoAcids:o.a.bool,charsPerLine:o.a.number,toolbar:o.a.bool,search:o.a.bool,title:o.a.string,sequenceMaxHeight:o.a.string,badge:o.a.bool,selection:function(t,n,e){if(void 0!==t[n]&&(void 0!==t[n][0]&&"number"!=typeof t[n][0]||void 0!==t[n][1]&&"number"!=typeof t[n][1]||void 0!==t[n][2]&&"string"!=typeof t[n][2]))return new Error("Invalid prop value. Selection should be an array with type [number, number, string].")},coverage:o.a.arrayOf(o.a.shape({start:o.a.number,end:o.a.number,color:o.a.string,bgcolor:o.a.string,tooltip:o.a.string,underscore:o.a.bool,onclick:o.a.func})),legend:o.a.arrayOf(o.a.shape({name:o.a.string,color:o.a.string,underscore:o.a.bool})),coverageClicked:o.a.number,mouseSelection:o.a.shape({start:o.a.number,end:o.a.number,selection:o.a.string}),subpartSelected:o.a.arrayOf(o.a.shape({start:o.a.number,end:o.a.number,sequence:o.a.string})),setProps:o.a.func};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return g})),e.d(n,"b",(function(){return v})),e.d(n,"c",(function(){return y}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2),s=e(21);function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function f(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function h(t,n){return!n||"object"!==l(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function d(t,n){return(d=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var m=Object(a.lazy)(u.a.speck),g=function(t){function n(){return c(this,n),h(this,p(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&d(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(m,this.props))}}])&&f(e.prototype,r),o&&f(e,o),n}(a.Component);g.defaultProps={view:s.speckView.new(),data:[]},g.propTypes={id:o.a.string,data:o.a.arrayOf(o.a.shape({symbol:o.a.string,x:o.a.number,y:o.a.number,z:o.a.number})),scrollZoom:o.a.bool,view:o.a.shape({aspect:o.a.number,zoom:o.a.number,translation:o.a.shape({x:o.a.number,y:o.a.number}),atomScale:o.a.number,relativeAtomScale:o.a.number,bondScale:o.a.number,rotation:o.a.shape({}),ao:o.a.number,aoRes:o.a.number,brightness:o.a.number,outline:o.a.number,spf:o.a.number,bonds:o.a.bool,bondThreshold:o.a.number,bondShade:o.a.number,atomShade:o.a.number,resolution:o.a.number,dofStrength:o.a.number,dofPosition:o.a.number,fxaa:o.a.number}),presetView:o.a.oneOf(["default","stickball","toon","licorice"]),setProps:o.a.func};var v=g.defaultProps,y=g.propTypes},function(t,n,e){"use strict";var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2),s=["CHORDS","HEATMAP","HIGHLIGHT","HISTOGRAM","LINE","SCATTER","STACK","TEXT"];function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function f(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function h(t,n){return!n||"object"!==l(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function d(t,n){return(d=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}e.d(n,"a",(function(){return g})),e.d(n,"c",(function(){return v})),e.d(n,"b",(function(){return y}));var m=Object(a.lazy)(u.a.circos),g=function(t){function n(){return c(this,n),h(this,p(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&d(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(m,this.props))}}])&&f(e.prototype,r),o&&f(e,o),n}(a.Component);g.defaultProps={config:{},size:800,tracks:[]},g.propTypes={enableDownloadSVG:o.a.bool,enableZoomPan:o.a.bool,id:o.a.string,style:o.a.object,eventDatum:o.a.object,selectEvent:o.a.object,setProps:o.a.func,layout:o.a.arrayOf(o.a.shape({len:o.a.number.isRequired,color:o.a.string.isRequired,label:o.a.string.isRequired,id:o.a.string.isRequired})).isRequired,config:o.a.object,size:o.a.number,tracks:o.a.arrayOf(o.a.shape({id:o.a.string,data:o.a.array.isRequired,config:o.a.object,type:o.a.oneOf(s),tooltipContent:o.a.oneOfType([o.a.string,o.a.shape({name:o.a.string.isRequired}),o.a.shape({source:o.a.string.isRequired,sourceID:o.a.string,target:o.a.string.isRequired,targetEnd:o.a.string.isRequired,targetID:o.a.string})]),color:o.a.oneOfType([o.a.string,o.a.shape({name:o.a.string.isRequired})])}))};var v=g.propTypes,y=g.defaultProps},function(t,n,e){var r=e(27),o=e(23),a=e(8),i=e(31),u=e(32);t.exports={speckRenderer:r,speckSystem:o,speckView:a,speckInteractions:i,speckPresetViews:u}},function(t,n,e){"use strict";for(var r=e(6),o=1/0,a=-1/0,i=0;i<=118;i++)o=Math.min(o,r[i].radius),a=Math.max(a,r[i].radius);t.exports.MIN_ATOM_RADIUS=o,t.exports.MAX_ATOM_RADIUS=a},function(t,n,e){"use strict";var r=e(7),o=e(6),a=e(22),i=(t.exports.new=function(){return{atoms:[],farAtom:void 0,bonds:[]}},t.exports.calculateBonds=function(t){var n=[],e=t.atoms.slice();e.sort((function(t,n){return t.z-n.z}));for(var i=0;i<e.length;i++)for(var u=e[i],s=i+1;s<e.length&&e[s].z<e[i].z+5*a.MAX_ATOM_RADIUS;){var l=e[s],c=r.vec3.fromValues(u.x,u.y,u.z),f=r.vec3.fromValues(l.x,l.y,l.z),h=r.vec3.distance(c,f),p=o[u.symbol],d=o[l.symbol];h<2.5*(p.radius+d.radius)&&n.push({posA:{x:u.x,y:u.y,z:u.z},posB:{x:l.x,y:l.y,z:l.z},radA:p.radius,radB:d.radius,colA:{r:p.color[0],g:p.color[1],b:p.color[2]},colB:{r:d.color[0],g:d.color[1],b:d.color[2]},cutoff:h/(p.radius+d.radius)}),s++}n.sort((function(t,n){return t.cutoff-n.cutoff})),t.bonds=n},t.exports.addAtom=function(t,n,e,r,o){t.atoms.push({symbol:n,x:e,y:r,z:o})},t.exports.getCentroid=function(t){for(var n=0,e=0,r=0,o=0;o<t.atoms.length;o++)n+=t.atoms[o].x,e+=t.atoms[o].y,r+=t.atoms[o].z;return{x:n/t.atoms.length,y:e/t.atoms.length,z:r/t.atoms.length}}),u=(t.exports.center=function(t){for(var n=i(t),e=0;e<t.atoms.length;e++){var r=t.atoms[e];r.x-=n.x,r.y-=n.y,r.z-=n.z}},t.exports.getFarAtom=function(t){if(void 0!==t.farAtom)return t.farAtom;t.farAtom=t.atoms[0];for(var n=0,e=0;e<t.atoms.length;e++){var r=t.atoms[e],a=o[r.symbol].radius,i=2.5*Math.sqrt(a*a+a*a+a*a),u=Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z)+i;u>n&&(n=u,t.farAtom=r)}return t.farAtom});t.exports.getRadius=function(t){var n=u(t),e=a.MAX_ATOM_RADIUS,r=2.5*Math.sqrt(e*e+e*e+e*e);return Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z)+r}},function(t,n,e){var o;o=function(){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}return e.m=t,e.c=n,e.p="",e(0)}([function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.rnaPlot=n.RNAGraph=void 0;var o=e(1);Object.defineProperty(n,"RNAGraph",{enumerable:!0,get:function(){return o.RNAGraph}});var a=e(3);Object.defineProperty(n,"rnaPlot",{enumerable:!0,get:function(){return a.rnaPlot}}),n.FornaContainer=function(t,n){var e=this;if(e.options={displayAllLinks:!1,labelInterval:10,applyForce:!0,chargeDistance:110,friction:.35,middleCharge:-30,otherCharge:-30,linkDistanceMultiplier:15,initialSize:null,layout:"standard-polygonal",allowPanningAndZooming:!0,transitionDuration:500,resizeSvgOnResize:!0},arguments.length>1)for(var a in n)e.options.hasOwnProperty(a)&&(e.options[a]=n[a]);null!==e.options.initialSize?(e.options.svgW=e.options.initialSize[0],e.options.svgH=e.options.initialSize[1]):(e.options.svgW=800,e.options.svgH=800),l.default.scale.category20();var u=null,s=null,p=l.default.scale.linear().domain([0,e.options.svgW]).range([0,e.options.svgW]),d=l.default.scale.linear().domain([0,e.options.svgH]).range([0,e.options.svgH]),m=e.graph={nodes:[],links:[]};function g(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function v(t){var n=t,e=t.prevNode;if(null!==e&&t.linked){var r=[-(n.x-e.x),-(n.y-e.y)],o=[-(r=[r[0]/g(r),r[1]/g(r)])[1],r[0]],a=[t.radius*r[0],t.radius*r[1]],i="M"+(a[0]+6*(r[0]+o[0])/2)+","+(a[1]+6*(r[1]+o[1])/2)+"L"+a[0]+","+a[1]+"L"+(a[0]+6*(r[0]-o[0])/2)+","+(a[1]+6*(r[1]-o[1])/2);l.default.select(this).attr("d",i)}}function y(t){return"basepair"==t.linkType||"backbone"==t.linkType||"pseudoknot"==t.linkType||"label_link"==t.linkType||"external"==t.linkType||"chain_chain"==t.linkType}function b(t,n,e){if(t.hasOwnProperty(n.num)){var r=parseFloat(t[n.num]);return isNaN(r)?t[n.num]:e(r)}return"white"}function x(){}function M(){u&&(mpos=l.default.mouse(A.node()),P.attr("x1",u.x).attr("y1",u.y).attr("x2",mpos[0]).attr("y2",mpos[1]))}function w(){u&&P.attr("class","drag_line_hidden"),C()}e.linkStrengths={pseudoknot:0,proteinChain:0,chainChain:0,intermolecule:10,external:0,other:10},e.displayParameters={displayBackground:"true",displayNumbering:"true",displayNodeOutline:"true",displayNodeLabel:"true",displayLinks:"true",displayPseudoknotLinks:"true",displayProteinLinks:"true"},e.colorScheme="structure",e.customColors={},e.animation=e.options.applyForce,e.deaf=!1,e.rnas={},e.extraLinks=[],Array.prototype.equals=function(t){if(!t)return!1;if(this.length!=t.length)return!1;for(var n=0,e=this.length;n<e;n++)if(this[n]instanceof Array&&t[n]instanceof Array){if(!this[n].equals(t[n]))return!1}else if(this[n]!=t[n])return!1;return!0},e.createInitialLayout=function(t,n){var r={sequence:"",name:"empty",positions:[],labelInterval:e.options.labelInterval,avoidOthers:!0,uids:[],circularizeExternal:!0};if(2==arguments.length)for(var a in n)r.hasOwnProperty(a)&&(r[a]=n[a]);var i=new o.RNAGraph(r.sequence,t,r.name);i.circularizeExternal=r.circularizeExternal;var u=i.recalculateElements();if(0===r.positions.length)if("naview"==e.options.layout){var s=new h.NAView,l=s.naview_xy_coordinates(i.pairtable);r.positions=[];for(var f=0;f<l.nbase;f++)r.positions.push([l.x[f],l.y[f]])}else r.positions=(0,c.simpleXyCoordinates)(u.pairtable);return u=u.elementsToJson().addUids(r.uids).addPositions("nucleotide",r.positions).addLabels(1,r.labelInterval).reinforceStems().reinforceLoops().connectFakeNodes().reassignLinkUids().breakNodesToFakeNodes()},e.addRNA=function(t,n){var r=e.createInitialLayout(t,n);if(1===arguments.length&&(n={}),"extraLinks"in n){var o=e.addExternalLinks(r,n.extraLinks);e.extraLinks=e.extraLinks.concat(o)}return"avoidOthers"in n?e.addRNAJSON(r,n.avoidOthers):e.addRNAJSON(r,!0),r},e.addExternalLinks=function(t,n){for(var e=[],r=0;r<n.length;r++){var o={linkType:"external",value:1,uid:generateUUID(),source:null,target:null};if("[object Array]"===Object.prototype.toString.call(n[r][0])){for(var a=0;a<t.nodes.length;a++)if("nucs"in t.nodes[a]&&t.nodes[a].nucs.equals(n[r][0])){o.source=t.nodes[a];break}}else for(a=0;a<t.nodes.length;a++)t.nodes[a].num==n[r][0]&&(o.source=t.nodes[a]);if("[object Array]"===Object.prototype.toString.call(n[r][1]))for(a=0;a<t.nodes.length;a++)"nucs"in t.nodes[a]&&t.nodes[a].nucs.equals(n[r][1])&&(o.target=t.nodes[a]);else for(a=0;a<t.nodes.length;a++)t.nodes[a].num==n[r][1]&&(o.target=t.nodes[a]);null!=o.source&&null!=o.target?e.push(o):console.log("ERROR: source or target of new link not found:",o,n[r])}return e},e.addRNAJSON=function(t,n){var r,o;return n&&(r=e.graph.nodes.length>0?l.default.max(e.graph.nodes.map((function(t){return t.x}))):0,o=l.default.min(t.nodes.map((function(t){return t.x}))),t.nodes.forEach((function(t){t.x+=r-o+20,t.px+=r-o}))),t.nodes.forEach((function(n){n.rna=t})),e.rnas[t.uid]=t,e.recalculateGraph(),e.update(),e.centerView(),t},e.transitionRNA=function(t,n){var r=e.options.transitionDuration,o={uids:e.graph.nodes.filter((function(t){return"nucleotide"==t.nodeType})).map((function(t){return t.uid}))},a=e.createInitialLayout(t,o),i=T.selectAll("g.gnode").data(a.nodes,Y);0===(r=e.options.transitionDuration)?i.attr("transform",(function(t){return"translate("+[t.x,t.y]+")"})):i.transition().attr("transform",(function(t){return"translate("+[t.x,t.y]+")"})).duration(r);var u=E.selectAll("line.link").data(a.links.filter(y),X),s=e.createNewNodes(i.enter()).attr("transform",(function(t){return void 0!==t.x&&void 0!==t.y?"translate("+[0,0]+")":""}));0===r?i.exit().remove():i.exit().transition().attr("transform",(function(t){return void 0!==t.x&&void 0!==t.y?"translate("+[0,0]+")":""})),i.select("path").each(v),e.graph.nodes=i.data(),e.updateStyle(),e.centerView(r),u.exit().remove(),0===r?(u.attr("x1",(function(t){return t.source.x})).attr("y1",(function(t){return t.source.y})).attr("x2",(function(t){return t.target.x})).attr("y2",(function(t){return t.target.y})),e.createNewLinks(u.enter()),e.graph.links=u.data(),e.updateStyle()):u.transition().attr("x1",(function(t){return t.source.x})).attr("y1",(function(t){return t.source.y})).attr("x2",(function(t){return t.target.x})).attr("y2",(function(t){return t.target.y})).duration(r).call((function(t,n){0===t.size()&&setTimeout(n,r);var e=0;t.each((function(){++e})).each("end",(function(){--e||n.apply(this,arguments)}))}),(function(){e.createNewLinks(u.enter()),e.graph.links=u.data(),e.updateStyle(),void 0!==n&&n()})),0===r?s.attr("transform",(function(t){return void 0!==t.x&&void 0!==t.y?"translate("+[t.x,t.y]+")":""})):s.transition().attr("transform",(function(t){return void 0!==t.x&&void 0!==t.y?"translate("+[t.x,t.y]+")":""}))},e.recalculateGraph=function(){for(var t in e.graph.nodes=[],e.graph.links=[],e.rnas)e.graph.nodes=e.graph.nodes.concat(e.rnas[t].nodes),e.graph.links=e.graph.links.concat(e.rnas[t].links);for(var n={},r=0;r<e.graph.nodes.length;r++)n[e.graph.nodes[r].uid]=e.graph.nodes[r];for(e.graph.links.forEach((function(t){t.source=n[t.source.uid],t.target=n[t.target.uid]})),r=0;r<e.extraLinks.length;r++){if(e.extraLinks[r].target.uid in n||console.log("not there:",e.extraLinks[r]),e.extraLinks[r].source=n[e.extraLinks[r].source.uid],e.extraLinks[r].target=n[e.extraLinks[r].target.uid],"intermolecule"==e.extraLinks[r].linkType){fakeLinks=e.graph.links.filter((function(t){return(t.source==e.extraLinks[r].source||t.source==e.extraLinks[r].target||t.target==e.extraLinks[r].source||t.target==e.extraLinks[r].source)&&"fake"==t.linkType}));for(var o=0;o<fakeLinks.length;o++){var a=e.graph.links.indexOf(fakeLinks[o]);e.graph.links.splice(a,1)}}m.links.push(e.extraLinks[r])}},e.addNodes=function(t){t.links.forEach((function(n){"number"==typeof n.source&&(n.source=t.nodes[n.source]),"number"==typeof n.target&&(n.target=t.nodes[n.target])})),e.graph.nodes.length>0?(maxX=l.default.max(e.graph.nodes.map((function(t){return t.x}))),maxY=l.default.max(e.graph.nodes.map((function(t){return t.y})))):(maxX=0,maxY=0),t.nodes.forEach((function(t){t.rna.uid in e.rnas||(e.rnas[t.rna.uid]=t.rna),t.x+=maxX,t.px+=maxX})),r=new o.RNAGraph("",""),r.nodes=t.nodes,r.links=t.links,e.recalculateGraph(),e.update(),e.centerView()},e.addCustomColors=function(t){e.customColors=t},e.addCustomColorsText=function(t){var n=new f.ColorScheme(t);e.customColors=n.colorsJson,e.changeColorScheme("custom")},e.clearNodes=function(){e.graph.nodes=[],e.graph.links=[],e.rnas={},e.extraLinks=[],e.update()},e.toJSON=function(){var t={rnas:e.rnas,extraLinks:e.extraLinks};return JSON.stringify(t,(function(t,n){return"rna"==t?void 0:n}),"\t")},e.fromJSON=function(t){var n,a;try{var i=JSON.parse(t);n=i.rnas,a=i.extraLinks}catch(t){throw t}for(var u in n)"rna"==n[u].type?(r=new o.RNAGraph,r.seq=n[u].seq,r.dotbracket=n[u].dotbracket,r.circular=n[u].circular,r.pairtable=n[u].pairtable,r.uid=n[u].uid,r.structName=n[u].structName,r.nodes=n[u].nodes,r.links=n[u].links,r.rnaLength=n[u].rnaLength,r.elements=n[u].elements,r.nucsToNodes=n[u].nucsToNodes,r.pseudoknotPairs=n[u].pseudoknotPairs):(r=new ProteinGraph,r.size=n[u].size,r.nodes=n[u].nodes,r.uid=n[u].uid),e.addRNAJSON(r,!1);a.forEach((function(t){e.extraLinks.push(t)})),e.recalculateGraph(),e.update()},e.setSize=function(){if(null==e.options.initialSize){var n=l.default.select(t).node().offsetHeight,r=l.default.select(t).node().offsetWidth;e.options.svgW=r,e.options.svgH=n,p.range([0,r]).domain([0,r]),d.range([0,n]).domain([0,n]),e.zoomer.x(p).y(d),e.brusher.x(p).y(d),e.centerView(),e.options.resizeSvgOnResize&&_.attr("width",r).attr("height",n)}},e.setOutlineColor=function(t){T.selectAll("g.gnode").select("[node_type=nucleotide]").style("fill",t)},e.changeColorScheme=function(t){T.selectAll("[node_type=protein]").classed("protein",!0).attr("r",(function(t){return t.radius})),T.selectAll("g.gnode"),T.selectAll("g.gnode").selectAll("circle");var n=T.selectAll("g.gnode").select("[node_type=nucleotide]");if(e.colorScheme=t,"sequence"==t){var r=l.default.scale.ordinal().range(["#dbdb8d","#98df8a","#ff9896","#aec7e8","#aec7e8"]).domain(["A","C","G","U","T"]);n.style("fill",(function(t){return r(t.name)}))}else"structure"==t?(r=l.default.scale.category10().domain(["s","m","i","e","t","h","x"]).range(["lightgreen","#ff9896","#dbdb8d","lightsalmon","lightcyan","lightblue","transparent"]),n.style("fill",(function(t){return r(t.elemType)}))):"positions"==t?n.style("fill",(function(t){return l.default.scale.linear().range(["#98df8a","#dbdb8d","#ff9896"]).interpolate(l.default.interpolateLab).domain([1,1+(t.rna.rnaLength-1)/2,t.rna.rnaLength])(t.num)})):"custom"==t&&(void 0!==e.customColors&&"domain"in e.customColors&&"range"in e.customColors&&(r=l.default.scale.linear().interpolate(l.default.interpolateLab).domain(e.customColors.domain).range(e.customColors.range)),n.style("fill",(function(t){return void 0!==e.customColors&&e.customColors.hasOwnProperty("colorValues")?e.customColors.colorValues.hasOwnProperty(t.structName)&&e.customColors.colorValues[t.structName].hasOwnProperty(t.num)?b(e.customColors.colorValues[t.structName],t,r):e.customColors.colorValues.hasOwnProperty("")?b(e.customColors.colorValues[""],t,r):"white":"white"})))},window.addEventListener("resize",e.setSize,!1),e.zoomer=l.default.behavior.zoom().scaleExtent([.1,10]).x(p).y(d).on("zoomstart",R).on("zoom",N),l.default.select(t).select("svg").remove();var _=l.default.select(t).classed("forna-container",!0).attr("tabindex",1).on("keydown.brush",B).on("keyup.brush",I).each((function(){this.focus()})).append("svg:svg").attr("width",e.options.svgW).attr("height",e.options.svgH).attr("id","plotting-area");e.options.svg=_;var k=_.append("svg:g").on("mousemove",M).on("mousedown",x).on("mouseup",w);e.options.allowPanningAndZooming&&k.call(e.zoomer);var S=k.append("g").datum((function(){return{selected:!1,previouslySelected:!1}})).attr("class","brush"),A=k.append("svg:g"),E=A.append("svg:g"),T=A.append("svg:g");function R(){var t=T.selectAll("g.gnode").selectAll(".outline_node");t.each((function(t){t.selected=!1,t.previouslySelected=!1})),t.classed("selected",!1)}function N(){A.attr("transform","translate("+l.default.event.translate+") scale("+l.default.event.scale+")")}e.brusher=l.default.svg.brush().x(p).y(d).on("brushstart",(function(t){T.selectAll("g.gnode").selectAll(".outline_node").each((function(t){t.previouslySelected=L&&t.selected}))})).on("brush",(function(){var t=T.selectAll("g.gnode").selectAll(".outline_node"),n=l.default.event.target.extent();t.classed("selected",(function(t){return t.selected=e.options.applyForce&&t.previouslySelected^(n[0][0]<=t.x&&t.x<n[1][0]&&n[0][1]<=t.y&&t.y<n[1][1])}))})).on("brushend",(function(){l.default.event.target.clear(),l.default.select(this).call(l.default.event.target)})),S.call(e.brusher).on("mousedown.brush",null).on("touchstart.brush",null).on("touchmove.brush",null).on("touchend.brush",null),S.select(".background").style("cursor","auto"),e.getBoundingBoxTransform=function(){if(0===e.graph.nodes.length)return{translate:[0,0],scale:1};var t=l.default.min(e.graph.nodes.map((function(t){return t.x}))),n=l.default.min(e.graph.nodes.map((function(t){return t.y}))),r=l.default.max(e.graph.nodes.map((function(t){return t.x})))-t,o=l.default.max(e.graph.nodes.map((function(t){return t.y})))-n,a=e.options.svgW/(r+1),i=e.options.svgH/(o+1),u=.8*Math.min(a,i),s=r*u,c=o*u;return{translate:[-t*u+(e.options.svgW-s)/2,-n*u+(e.options.svgH-c)/2],scale:u}},e.centerView=function(t){0===arguments.length&&(t=0);var n=e.getBoundingBoxTransform();null!==n&&(A.transition().attr("transform","translate("+n.translate+") scale("+n.scale+")").duration(t),e.zoomer.translate(n.translate),e.zoomer.scale(n.scale))},e.force=l.default.layout.force().charge((function(t){return"middle"==t.nodeType?e.options.middleCharge:e.options.otherCharge})).friction(e.options.friction).linkDistance((function(t){return e.options.linkDistanceMultiplier*t.value})).linkStrength((function(t){return t.linkType in e.linkStrengths?e.linkStrengths[t.linkType]:e.linkStrengths.other})).gravity(0).nodes(e.graph.nodes).links(e.graph.links).chargeDistance(e.options.chargeDistance).size([e.options.svgW,e.options.svgH]);var P=A.append("line").attr("class","drag_line").attr("x1",0).attr("y1",0).attr("x2",0).attr("y2",0);function C(){u=null,s=null}var O=!1,L=!1;function U(t){var n=T.selectAll("g.gnode");return n.filter((function(t){return t.selected}))}function D(t){l.default.event.sourceEvent.stopPropagation(),t.selected||L||T.selectAll("g.gnode").selectAll(".outline_node").classed("selected",(function(t){return t.selected=e.options.applyForce&&(t.previouslySelected=!1)})),l.default.select(this).select(".outline_node").classed("selected",(function(n){return t.previouslySelected=t.selected,t.selected=e.options.applyForce&&!0})),U().each((function(t){t.fixed|=2}))}function z(t){U().each((function(t){t.x+=l.default.event.dx,t.y+=l.default.event.dy,t.px+=l.default.event.dx,t.py+=l.default.event.dy})),e.resumeForce(),l.default.event.sourceEvent.preventDefault()}function q(t){U().each((function(t){t.fixed&=-7}))}function j(t){var n=t.radius+16,e=t.x-n,r=t.x+n,o=t.y-n,a=t.y+n;return function(n,i,u,s,l){if(n.point&&n.point!==t){var c=t.x-n.point.x,f=t.y-n.point.y,h=Math.sqrt(c*c+f*f),p=t.radius+n.point.radius;h<p&&(h=(h-p)/h*.1,t.x-=c*=h,t.y-=f*=h,n.point.x+=c,n.point.y+=f)}return i>r||s<e||u>a||l<o}}e.resumeForce=function(){e.animation&&e.force.resume()};var F=l.default.behavior.drag().on("dragstart",D).on("drag",z).on("dragend",q);function B(){if(!e.deaf&&!O){switch(l.default.event.keyCode){case 16:O=!0;break;case 17:L=!0;break;case 67:e.centerView()}(O||L)&&(k.call(e.zoomer).on("mousedown.zoom",null).on("touchstart.zoom",null).on("touchmove.zoom",null).on("touchend.zoom",null),A.selectAll("g.gnode").on("mousedown.drag",null)),L&&(S.select(".background").style("cursor","crosshair"),S.call(e.brusher))}}function I(){O=!1,L=!1,S.call(e.brusher).on("mousedown.brush",null).on("touchstart.brush",null).on("touchmove.brush",null).on("touchend.brush",null),S.select(".background").style("cursor","auto"),k.call(e.zoomer),A.selectAll("g.gnode").call(F)}l.default.select(t).on("keydown",B).on("keyup",I).on("contextmenu",(function(){l.default.event.preventDefault()}));var X=function(t){return t.uid},Y=function(t){return t.uid},V=function(t){var n=t.getPositions("nucleotide"),r=t.getPositions("label"),o=t.getUids();t.recalculateElements().elementsToJson().addPseudoknots().addPositions("nucleotide",n).addUids(o).addLabels(1,e.options.labelInterval).addPositions("label",r).reinforceStems().reinforceLoops().updateLinkUids()},H=function(t){if(index=e.graph.links.indexOf(t),index>-1){if(t.source.rna==t.target.rna){var n=t.source.rna;n.addPseudoknots(),n.pairtable[t.source.num]=0,n.pairtable[t.target.num]=0,V(n)}else extraLinkIndex=e.extraLinks.indexOf(t),e.extraLinks.splice(extraLinkIndex,1);e.recalculateGraph()}e.update()},G=function(t){O&&(t.linkType in{backbone:!0,fake:!0,fake_fake:!0,label_link:!0}||H(t))};e.addLink=function(t){t.source.rna==t.target.rna?(r=t.source.rna,r.pairtable[t.source.num]=t.target.num,r.pairtable[t.target.num]=t.source.num,V(r)):(t.linkType="intermolecule",e.extraLinks.push(t)),e.recalculateGraph(),e.update()};var W=function(t){l.default.event.defaultPrevented||(L||T.selectAll("g.gnode").selectAll(".outline_node").classed("selected",(function(t){return t.selected=e.options.applyForce&&(t.previouslySelected=!1)})),l.default.select(this).select("circle").classed("selected",t.selected=e.options.applyForce&&!t.previouslySelected))},Z=function(t){if(u){if((s=t)==u)return void C();var n={source:u,target:s,linkType:"basepair",value:1,uid:generateUUID()};for(i=0;i<e.graph.links.length;i++){if(!(e.graph.links[i].source!=u&&e.graph.links[i].target!=u&&e.graph.links[i].source!=s&&e.graph.links[i].target!=s||"basepair"!=e.graph.links[i].linkType&&"pseudoknot"!=e.graph.links[i].linkType))return;if((e.graph.links[i].source==s&&e.graph.links[i].target==u||e.graph.links[i].source==u&&e.graph.links[i].target==s)&&"backbone"==e.graph.links[i].linkType)return}if("middle"==s.nodeType||"middle"==u.nodeType||"label"==s.nodeType||"label"==u.nodeType)return;e.addLink(n)}},J=function(t){t.selected||L||T.selectAll("g.gnode").selectAll(".outline_node").classed("selected",(function(t){return t.selected=t.previouslySelected=!1})),l.default.select(this).classed("selected",(function(n){return t.previouslySelected=t.selected,t.selected=e.options.applyForce&&!0})),O&&(u=t,P.attr("class","drag_line").attr("x1",u.x).attr("y1",u.y).attr("x2",u.x).attr("y2",u.y))};e.startAnimation=function(){e.animation=!0,A.selectAll("g.gnode").call(F),e.force.start()},e.stopAnimation=function(){e.animation=!1,A.selectAll("g.gnode").on("mousedown.drag",null),e.force.stop()},e.setFriction=function(t){e.force.friction(t),e.resumeForce()},e.setCharge=function(t){e.force.charge(t),e.resumeForce()},e.setGravity=function(t){e.force.gravity(t),e.resumeForce()},e.setPseudoknotStrength=function(t){e.linkStrengths.pseudoknot=t,e.update()},e.displayBackground=function(t){e.displayParameters.displayBackground=t,e.updateStyle()},e.displayNumbering=function(t){e.displayParameters.displayNumbering=t,e.updateStyle()},e.displayNodeOutline=function(t){e.displayParameters.displayNodeOutline=t,e.updateStyle()},e.displayNodeLabel=function(t){e.displayParameters.displayNodeLabel=t,e.updateStyle()},e.displayLinks=function(t){e.displayParameters.displayLinks=t,e.updateStyle()},e.displayPseudoknotLinks=function(t){e.displayParameters.displayPseudoknotLinks=t,e.updateStyle()},e.displayProteinLinks=function(t){e.displayParameters.displayProteinLinks=t,e.updateStyle()},e.updateStyle=function(){T.selectAll("[node_type=label]").classed("transparent",!e.displayParameters.displayNumbering),T.selectAll("[label_type=label]").classed("transparent",!e.displayParameters.displayNumbering),E.selectAll("[linkType=label_link]").classed("transparent",!e.displayParameters.displayNumbering),_.selectAll("circle").classed("hidden_outline",!e.displayParameters.displayNodeOutline),T.selectAll("[label_type=nucleotide]").classed("transparent",!e.displayParameters.displayNodeLabel),_.selectAll("[link_type=real],[link_type=basepair],[link_type=backbone],[link_type=pseudoknot],[link_type=protein_chain],[link_type=chain_chain],[link_type=external]").classed("transparent",!e.displayParameters.displayLinks),_.selectAll("[link_type=pseudoknot]").classed("transparent",!e.displayParameters.displayPseudoknotLinks),_.selectAll("[link_type=protein_chain]").classed("transparent",!e.displayParameters.displayProteinLinks),E.selectAll("[link_type=fake]").classed("transparent",!e.options.displayAllLinks),E.selectAll("[link_type=fake_fake]").classed("transparent",!e.options.displayAllLinks)},e.createNewLinks=function(t){var n=t.append("svg:line");return n.append("svg:title").text(X),n.classed("link",!0).attr("x1",(function(t){return t.source.x})).attr("y1",(function(t){return t.source.y})).attr("x2",(function(t){return t.target.x})).attr("y2",(function(t){return t.target.y})).attr("link_type",(function(t){return t.linkType})).attr("class",(function(t){return l.default.select(this).attr("class")+" "+t.linkType})).attr("pointer-events",(function(t){return"fake"==t.linkType?"none":"all"})),n},e.createNewNodes=function(t){(t=t.append("g").classed("noselect",!0).classed("gnode",!0).attr("struct_name",(function(t){return t.structName})).attr("transform",(function(t){return void 0!==t.x&&void 0!==t.y?"translate("+[t.x,t.y]+")":""})).each((function(t){t.selected=t.previouslySelected=!1}))).call(F).on("mousedown",J).on("mousedrag",(function(t){})).on("mouseup",Z).attr("num",(function(t){return"n"+t.num})).attr("rnum",(function(t){return"n"+(t.rna.rnaLength-t.num+1)})).on("click",W).transition().duration(750).ease("elastic");var n=t.filter((function(t){return"label"==t.nodeType||"protein"==t.nodeType})),e=t.filter((function(t){return"nucleotide"==t.nodeType}));return n.append("svg:circle").attr("class","outline_node").attr("r",(function(t){return t.radius+1})),e.append("svg:circle").attr("class","outline_node").attr("r",(function(t){return t.radius+1})),n.append("svg:circle").attr("class","node").classed("label",(function(t){return"label"==t.nodeType})).attr("r",(function(t){return"middle"==t.nodeType?0:t.radius})).attr("node_type",(function(t){return t.nodeType})).attr("node_num",(function(t){return t.num})),e.append("svg:circle").attr("class","node").attr("node_type",(function(t){return t.nodeType})).attr("node_num",(function(t){return t.num})).attr("r",(function(t){return t.radius})).append("svg:title").text((function(t){return"nucleotide"==t.nodeType?t.structName+":"+t.num:""})),e.append("svg:path").attr("class","node").attr("node_type",(function(t){return t.nodeType})).attr("node_num",(function(t){return t.num})).append("svg:title").text((function(t){return"nucleotide"==t.nodeType?t.structName+":"+t.num:""})),t.append("text").text((function(t){return t.name})).attr("text-anchor","middle").attr("font-size",8).attr("font-weight","bold").attr("y",2.5).attr("class","node-label").attr("label_type",(function(t){return t.nodeType})).append("svg:title").text((function(t){return"nucleotide"==t.nodeType?t.structName+":"+t.num:""})),t},e.update=function(){e.force.nodes(e.graph.nodes).links(e.graph.links),e.animation&&e.force.start();var t=E.selectAll("line.link").data(e.graph.links.filter(y),X);t.attr("class","").classed("link",!0).attr("link_type",(function(t){return t.linkType})).attr("class",(function(t){return l.default.select(this).attr("class")+" "+t.linkType}));var n=t.enter();e.createNewLinks(n),t.exit().remove(),l.default.scale.category10().domain([0,1,2,3,4,5,6,7,8,9]);var r=T.selectAll("g.gnode").data(e.graph.nodes,Y),o=r.enter();e.createNewNodes(o),r.exit().remove();var a,i=e.graph.nodes.filter((function(t){return"nucleotide"==t.nodeType||"label"==t.nodeType}));a=e.displayFakeLinks?t:E.selectAll("[link_type=real],[link_type=pseudoknot],[link_type=protein_chain],[link_type=chain_chain],[link_type=label_link],[link_type=backbone],[link_type=basepair],[link_type=intermolecule],[link_type=external]"),r.selectAll("path").each(v),a.on("click",G),e.force.on("tick",(function(){for(var t=l.default.geom.quadtree(i),n=0,e=i.length;++n<e;)t.visit(j(i[n]));a.attr("x1",(function(t){return t.source.x})).attr("y1",(function(t){return t.source.y})).attr("x2",(function(t){return t.target.x})).attr("y2",(function(t){return t.target.y})),r.attr("transform",(function(t){return"translate("+[t.x,t.y]+")"})),r.select("path").each(v)})),e.changeColorScheme(e.colorScheme),e.animation&&e.force.start(),e.updateStyle()},e.setSize()},e(15);var u,s=e(17),l=(u=s)&&u.__esModule?u:{default:u},c=e(4),f=e(2),h=e(5)},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.ProteinGraph=i,n.RNAGraph=u,n.moleculesToJson=function(t){for(var n={},e=[],r=[],o=0;o<t.molecules.length;o++){var s,l=t.molecules[o];"rna"==l.type?((s=new u(l.seq,l.ss,l.header)).circularizeExternal=!0,s.elementsToJson().addPositions("nucleotide",l.positions).addLabels().reinforceStems().reinforceLoops()):"protein"==l.type&&(s=new i(l.header,l.size)),s.addUids(l.uids);for(var c=0;c<s.nodes.length;c++)n[s.nodes[c].uid]=s.nodes[c];e.push(s)}for(o=0;o<t.extraLinks.length;o++)link=t.extraLinks[o],link.source=n[link.source],link.target=n[link.target],link.uid=a(),r.push(link);return{graphs:e,extraLinks:r}};var r=e(2),o=function(t,n){return t-n};function a(){var t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(n){var e=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==n?e:3&e|8).toString(16)}))}function i(t,n,e){var r=this;r.type="protein",r.size=n,r.nodes=[{name:"P",num:1,radius:3*Math.sqrt(n),rna:r,nodeType:"protein",structName:t,elemType:"p",size:n,uid:a()}],r.links=[],r.uid=a(),r.addUids=function(t){for(var n=0;n<t.length;n++)r.nodes[n].uid=t[n];return r},r.getUids=function(){uids=[];for(var t=0;t<r.dotbracket.length;t++)uids.push(r.nodes[t].uid);return uids}}function u(t,n,e,i){var u=this;u.type="rna",u.circularizeExternal=!1,0===arguments.length?(u.seq="",u.dotbracket="",u.structName=""):(u.seq=t,u.dotbracket=n,u.structName=e),arguments.length<4&&(i=1),u.circular=!1,u.dotbracket.length>0&&"*"==u.dotbracket[u.dotbracket.length-1]&&(u.dotbracket=u.dotbracket.slice(0,u.dotbracket.length-1),u.circular=!0),u.uid=a(),u.elements=[],u.pseudoknotPairs=[],u.nucsToNodes={},u.addUids=function(t){for(var n=u.nodes.filter((function(t){return"nucleotide"==t.nodeType})),e=0;e<t.length&&e<n.length;e++)n[e].uid=t[e];return u},u.computePairtable=function(){u.pairtable=r.rnaUtilities.dotbracketToPairtable(u.dotbracket)},u.removeBreaks=function(t){for(var n=[],e=-1;(e=t.indexOf("&"))>=0;)n.push(e),t=t.substring(0,e)+"oo"+t.substring(e+1,t.length);return{targetString:t,breaks:n}};var s=u.removeBreaks(u.dotbracket);u.dotbracket=s.targetString,u.dotBracketBreaks=s.breaks,s=u.removeBreaks(u.seq),u.seq=s.targetString,u.seqBreaks=s.breaks,u.calculateStartNumberArray=function(){u.startNumberArray=[];for(var t=0;t<u.dotbracket.length;t++)u.startNumberArray.push(i),"o"==u.dotbracket[t]&&(i=-t)},u.calculateStartNumberArray(),u.rnaLength=u.dotbracket.length,(0,r.arraysEqual)(u.dotBracketBreaks,u.seqBreaks)||(console.log("WARNING: Sequence and structure breaks not equal"),console.log("WARNING: Using the breaks in the structure")),u.computePairtable(),u.addPositions=function(t,n){for(var e=u.nodes.filter((function(n){return n.nodeType==t})),r=0;r<e.length;r++)e[r].x=n[r][0],e[r].px=n[r][0],e[r].y=n[r][1],e[r].py=n[r][1];return u},u.breakNodesToFakeNodes=function(){for(var t=u.nodes.filter((function(t){return"nucleotide"==t.nodeType})),n=0;n<t.length;n++)"o"==u.dotbracket[n]&&(t[n].nodeType="middle");for(n=0;n<u.elements.length;n++){for(var e=!1,r=0;r<u.elements[n][2].length;r++)u.dotBracketBreaks.indexOf(u.elements[n][2][r])>=0&&(e=!0);e?u.elements[n][2].map((function(t){0!=t&&(u.nodes[t-1].elemType="e")})):u.elements[n][2].map((function(t){0!=t&&(u.nodes[t-1].elemType=u.elements[n][0])}))}return u},u.getPositions=function(t){for(var n=[],e=u.nodes.filter((function(n){return n.nodeType==t})),r=0;r<e.length;r++)n.push([e[r].x,e[r].y]);return n},u.getUids=function(){for(var t=[],n=0;n<u.dotbracket.length;n++)t.push(u.nodes[n].uid);return t},u.reinforceStems=function(){for(var t=u.pairtable,n=u.elements.filter((function(t){return"s"==t[0]&&t[2].length>=4})),e=0;e<n.length;e++)for(var r=n[e][2],o=r.slice(0,r.length/2),a=0;a<o.length-1;a++)u.addFakeNode([o[a],o[a+1],t[o[a+1]],t[o[a]]]);return u},u.reinforceLoops=function(){for(var t=function(t){return 0!==t&&t<=u.dotbracket.length},n=0;n<u.elements.length;n++)if("s"!=u.elements[n][0]&&(u.circularizeExternal||"e"!=u.elements[n][0])){var e=u.elements[n][2].filter(t);if("e"==u.elements[n][0]){var r={name:"",num:-3,radius:0,rna:u,nodeType:"middle",elemType:"f",nucs:[],x:u.nodes[u.rnaLength-1].x,y:u.nodes[u.rnaLength-1].y,px:u.nodes[u.rnaLength-1].px,py:u.nodes[u.rnaLength-1].py,uid:a()},o={name:"",num:-2,radius:0,rna:u,nodeType:"middle",elemType:"f",nucs:[],x:u.nodes[0].x,y:u.nodes[0].y,px:u.nodes[0].px,py:u.nodes[0].py,uid:a()};e.push(u.nodes.length+1),e.push(u.nodes.length+2),u.nodes.push(r),u.nodes.push(o)}u.addFakeNode(e)}return u},u.updateLinkUids=function(){for(var t=0;t<u.links.length;t++)u.links[t].uid=u.links[t].source.uid+u.links[t].target.uid;return u},u.addFakeNode=function(t){for(var n=6.283/(2*t.length),e=18/(2*Math.tan(n)),r="",o=0;o<t.length;o++)r+=u.nodes[t[o]-1].uid;var i={name:"",num:-1,radius:e,rna:u,nodeType:"middle",elemType:"f",nucs:t,uid:r};u.nodes.push(i);var s=0,l=0,c=0;n=3.14159*(t.length-2)/(2*t.length),e=.5/Math.cos(n);for(var f=0;f<t.length;f++)if(!(0===t[f]||t[f]>u.dotbracket.length)){u.links.push({source:u.nodes[t[f]-1],target:u.nodes[u.nodes.length-1],linkType:"fake",value:e,uid:a()}),t.length>4&&u.links.push({source:u.nodes[t[f]-1],target:u.nodes[t[(f+Math.floor(t.length/2))%t.length]-1],linkType:"fake",value:2*e,uid:a()});var h=3.14159*(t.length-2)/t.length,p=2*Math.cos(1.570795-h/2);u.links.push({source:u.nodes[t[f]-1],target:u.nodes[t[(f+2)%t.length]-1],linkType:"fake",value:p});var d=u.nodes[t[f]-1];"x"in d&&(s+=d.x,l+=d.y,c+=1)}return c>0&&(i.x=s/c,i.y=l/c,i.px=i.x,i.py=i.y),u},u.connectFakeNodes=function(){for(var t={},n=u.nodes.filter((function(t){return"middle"==t.nodeType})),e=new Set,r=1;r<=u.nodes.length;r++)t[r]=[];for(r=0;r<n.length;r++)for(var o=n[r],a=0;a<o.nucs.length;a++){for(var i=o.nucs[a],s=0;s<t[i].length;s++)if(!e.has(JSON.stringify([t[i][s].uid,o.uid].sort()))){var l=t[i][s].radius+o.radius;u.links.push({source:t[i][s],target:o,value:l/18,linkType:"fake_fake"}),e.add(JSON.stringify([t[i][s].uid,o.uid].sort()))}t[i].push(o)}return u},u.addExtraLinks=function(t){if(void 0===t)return u;for(var n=0;n<t.length;n++){var e={source:u.getNodeFromNucleotides(t[n].from),target:u.getNodeFromNucleotides(t[n].to),linkType:"extra",extraLinkType:t[n].linkType,uid:a()};u.links.push(e)}return u},u.elementsToJson=function(){var t=u.pairtable;u.elements,u.nodes=[],u.links=[];var n={};u.elements.sort();for(var e=0;e<u.elements.length;e++)for(var r=u.elements[e][2],o=0;o<r.length;o++)n[r[o]]=u.elements[e][0];for(e=1;e<=t[0];e++){var i=u.seq[e-1];(u.dotBracketBreaks.indexOf(e-1)>=0||u.dotBracketBreaks.indexOf(e-2)>=0)&&(i=""),u.nodes.push({name:i,num:e+u.startNumberArray[e-1]-1,radius:5,rna:u,nodeType:"nucleotide",structName:u.structName,elemType:n[e],uid:a(),linked:!1})}for(e=0;e<u.nodes.length;e++)u.nodes[e].prevNode=0===e?null:u.nodes[e-1],e==u.nodes.length-1?u.nodes[e].nextNode=null:u.nodes[e].nextNode=u.nodes[e+1];for(e=1;e<=t[0];e++)0!==t[e]&&u.links.push({source:u.nodes[e-1],target:u.nodes[t[e]-1],linkType:"basepair",value:1,uid:a()}),e>1&&-1===u.dotBracketBreaks.indexOf(e-1)&&-1==u.dotBracketBreaks.indexOf(e-2)&&-1==u.dotBracketBreaks.indexOf(e-3)&&(u.links.push({source:u.nodes[e-2],target:u.nodes[e-1],linkType:"backbone",value:1,uid:a()}),u.nodes[e-1].linked=!0);for(e=0;e<u.pseudoknotPairs.length;e++)u.links.push({source:u.nodes[u.pseudoknotPairs[e][0]-1],target:u.nodes[u.pseudoknotPairs[e][1]-1],linkType:"pseudoknot",value:1,uid:a()});return u.circular&&u.links.push({source:u.nodes[0],target:u.nodes[u.rnaLength-1],linkType:"backbone",value:1,uid:a()}),u},u.ptToElements=function(t,n,e,r){var a=[],i=[e-1],s=[r+1];if(e>r)return[];for(;0===t[e];e++)i.push(e);for(;0===t[r];r--)s.push(r);if(e>r){if(i.push(e),0===n)return[["e",n,i.sort(o)]];for(var l=!1,c=[],f=[],h=0;h<i.length;h++)l?f.push(i[h]):c.push(i[h]),u.dotBracketBreaks.indexOf(i[h])>=0&&(l=!0);return[["h",n,i.sort(o)]]}if(t[e]!=r){var p=i;for(h=e,p.push(h);h<=r;){for(a=a.concat(u.ptToElements(t,n,h,t[h])),p.push(t[h]),h=t[h]+1;0===t[h]&&h<=r;h++)p.push(h);p.push(h)}return p.pop(),(p=p.concat(s)).length>0&&(0===n?a.push(["e",n,p.sort(o)]):a.push(["m",n,p.sort(o)])),a}t[e]===r&&(i.push(e),s.push(r),i.concat(s).length>4&&(0===n?a.push(["e",n,i.concat(s).sort(o)]):a.push(["i",n,i.concat(s).sort(o)])));for(var d=[];t[e]===r&&e<r;)d.push(e),d.push(r),e+=1,r-=1,n+=1;return i=[e-1],s=[r+1],a.push(["s",n,d.sort(o)]),a.concat(u.ptToElements(t,n,e,r))},u.addLabels=function(t,n){if(0===arguments.length&&(t=1,n=10),1===arguments.length&&(n=10),0===n)return u;n<=0&&console.log("The label interval entered in invalid:",n);for(var e=1;e<=u.pairtable[0];e++)if(e%n==0){var r,o,i,s,l=u.nodes[e-1];1==u.rnaLength?(s=[l.x-15,l.y],i=[l.x-15,l.y]):(r=1==e?u.nodes[u.rnaLength-1]:u.nodes[e-2],o=e==u.rnaLength?u.nodes[0]:u.nodes[e],0!==u.pairtable[o.num]&&0!==u.pairtable[r.num]&&0!==u.pairtable[l.num]&&(r=o=u.nodes[u.pairtable[l.num]-1]),0===u.pairtable[l.num]||0!==u.pairtable[o.num]&&0!==u.pairtable[r.num]?(s=[o.x-l.x,o.y-l.y],i=[r.x-l.x,r.y-l.y]):(s=[l.x-o.x,l.y-o.y],i=[l.x-r.x,l.y-r.y]));var c=[s[0]+i[0],s[1]+i[1]],f=Math.sqrt(c[0]*c[0]+c[1]*c[1]),h=[c[0]/f,c[1]/f],p=[-15*h[0],-15*h[1]],d=u.nodes[e-1].x+p[0],m=u.nodes[e-1].y+p[1],g={name:e+u.startNumberArray[e-1]-1,num:-1,radius:6,rna:u,nodeType:"label",structName:u.structName,elemType:"l",x:d,y:m,px:d,py:m,uid:a()},v={source:u.nodes[e-1],target:g,value:1,linkType:"label_link",uid:a()};u.nodes.push(g),u.links.push(v)}return u},u.recalculateElements=function(){if(u.removePseudoknots(),u.elements=u.ptToElements(u.pairtable,0,1,u.dotbracket.length),u.circular&&(externalLoop=u.elements.filter((function(t){if("e"==t[0])return!0})),externalLoop.length>0)){eloop=externalLoop[0],nucs=eloop[2].sort(o),prev=nucs[0],hloop=!0,numGreater=0;for(var t=1;t<nucs.length;t++)nucs[t]-prev>1&&(numGreater+=1),prev=nucs[t];1==numGreater?eloop[0]="h":2==numGreater?eloop[0]="i":eloop[0]="m"}return u},u.reassignLinkUids=function(){for(var t=0;t<u.links.length;t++)u.links[t].uid=u.links[t].source.uid+u.links[t].target.uid;return u},u.removePseudoknots=function(){return u.pairtable.length>1&&(u.pseudoknotPairs=u.pseudoknotPairs.concat(r.rnaUtilities.removePseudoknotsFromPairtable(u.pairtable))),u},u.addPseudoknots=function(){for(var t=u.pairtable,n=u.pseudoknotPairs,e=0;e<n.length;e++)t[n[e][0]]=n[e][1],t[n[e][1]]=n[e][0];return u.pseudoknotPairs=[],u},u.addName=function(t){return void 0===t?(u.name="",u):(u.name=t,u)},u.rnaLength>0&&u.recalculateElements()}void 0===String.prototype.trim&&(String.prototype.trim=function(){return String(this).replace(/^\s+|\s+$/g,"")})},function(t,n,e){t.exports=function(t){function n(r){if(e[r])return e[r].exports;var o=e[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var e={};return n.m=t,n.c=e,n.p="",n(0)}([function(t,n,e){t.exports=e(1)},function(t,n){"use strict";function e(){var t=this;t.bracketLeft="([{<ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),t.bracketRight=")]}>abcdefghijklmnopqrstuvwxyz".split(""),t.inverseBrackets=function(t){for(var n={},e=0;e<t.length;e++)n[t[e]]=e;return n},t.maximumMatching=function(t){for(var n=t[0],e=new Array(n+1),r=0;n>=r;r++){e[r]=new Array(n+1);for(var o=r;n>=o;o++)e[r][o]=0}var a=0;for(r=n-0-1;r>0;r--)for(o=r+0+1;n>=o;o++){a=e[r][o-1];for(var i=o-0-1;i>=r;i--)t[i]===o&&(a=Math.max(a,(i>r?e[r][i-1]:0)+1+(o-i-1>0?e[i+1][o-1]:0)));e[r][o]=a}return a=e[1][n],e},t.backtrackMaximumMatching=function(n,e){var r=Array.apply(null,Array(n.length)).map((function(){return 0}));return t.mmBt(n,r,e,1,n.length-1),r},t.mmBt=function(n,e,r,o,a){var i=n[o][a];if(!(0>a-o-1)){if(n[o][a-1]==i)return void t.mmBt(n,e,r,o,a-1);for(var u=a-0-1;u>=o;u--)if(r[a]===u&&(u>o?n[o][u-1]:0)+(a-u-1>0?n[u+1][a-1]:0)+1==i)return e[u]=a,e[a]=u,u>o&&t.mmBt(n,e,r,o,u-1),void t.mmBt(n,e,r,u+1,a-1);console.log("FAILED!!!"+o+","+a+": backtracking failed!")}},t.dotbracketToPairtable=function(n){var e=Array.apply(null,new Array(n.length+1)).map(Number.prototype.valueOf,0);e[0]=n.length;for(var r={},o=0;o<t.bracketLeft.length;o++)r[o]=[];var a=t.inverseBrackets(t.bracketLeft),i=t.inverseBrackets(t.bracketRight);for(o=0;o<n.length;o++){var u=n[o],s=o+1;if("."==u||"o"==u)e[s]=0;else if(u in a)r[a[u]].push(s);else{if(!(u in i))throw"Unknown symbol in dotbracket string";var l=r[i[u]].pop();e[s]=l,e[l]=s}}for(var c in r)if(r[c].length>0)throw"Unmatched base at position "+r[c][0];return e},t.insertIntoStack=function(t,n,e){for(var r=0;t[r].length>0&&t[r][t[r].length-1]<e;)r+=1;return t[r].push(e),r},t.deleteFromStack=function(t,n){for(var e=0;0===t[e].length||t[e][t[e].length-1]!=n;)e+=1;return t[e].pop(),e},t.pairtableToDotbracket=function(n){for(var e={},r=0;r<n[0];r++)e[r]=[];var o={},a="";for(r=1;r<n[0]+1;r++){if(0!==n[r]&&n[r]in o)throw"Invalid pairtable contains duplicate entries";o[n[r]]=!0,a+=0===n[r]?".":n[r]>r?t.bracketLeft[t.insertIntoStack(e,r,n[r])]:t.bracketRight[t.deleteFromStack(e,r)]}return a},t.findUnmatched=function(n,e,r){for(var o=[],a=[],i=e,u=r,s=e;r>=s;s++)0!==n[s]&&(n[s]<e||n[s]>r)&&a.push([s,n[s]]);for(s=i;u>=s;s++){for(;0===n[s]&&u>=s;)s++;for(r=n[s];n[s]===r;)s++,r--;o=o.concat(t.findUnmatched(n,s,r))}return a.length>0&&o.push(a),o},t.removePseudoknotsFromPairtable=function(n){for(var e=t.maximumMatching(n),r=t.backtrackMaximumMatching(e,n),o=[],a=1;a<n.length;a++)n[a]<a||r[a]!=n[a]&&(o.push([a,n[a]]),n[n[a]]=0,n[a]=0);return o},t.ptToElements=function(n,e,o,a,i){var u=[],s=[o-1],l=[a+1];if(arguments.length<5&&(i=[]),o>a)return[];for(;0===n[o];o++)s.push(o);for(;0===n[a];a--)l.push(a);if(o>a){if(s.push(o),0===e)return[["e",e,s.sort(r)]];for(var c=!1,f=[],h=[],p=0;p<s.length;p++)c?h.push(s[p]):f.push(s[p]),i.indexOf(s[p])>=0&&(c=!0);return[["h",e,s.sort(r)]]}if(n[o]!=a){var d=s;for(p=o,d.push(p);a>=p;){for(u=u.concat(t.ptToElements(n,e,p,n[p],i)),d.push(n[p]),p=n[p]+1;0===n[p]&&a>=p;p++)d.push(p);d.push(p)}return d.pop(),(d=d.concat(l)).length>0&&(0===e?u.push(["e",e,d.sort(r)]):u.push(["m",e,d.sort(r)])),u}if(n[o]===a){s.push(o),l.push(a);var m=s.concat(l);m.length>4&&(0===e?u.push(["e",e,s.concat(l).sort(r)]):u.push(["i",e,s.concat(l).sort(r)]))}for(var g=[];n[o]===a&&a>o;)g.push(o),g.push(a),o+=1,a-=1,e+=1;return s=[o-1],l=[a+1],u.push(["s",e,g.sort(r)]),u.concat(t.ptToElements(n,e,o,a,i))}}Object.defineProperty(n,"__esModule",{value:!0}),n.arraysEqual=function(t,n){if(t===n)return!0;if(null===t||null===n)return!1;if(t.length!=n.length)return!1;for(var e=0;e<t.length;++e)if(t[e]!==n[e])return!1;return!0},n.RNAUtilities=e,n.ColorScheme=function(t){var n=this;return n.colorsText=t,n.parseRange=function(t){for(var n=t.split(","),e=[],r=0;r<n.length;r++){var o=n[r].split("-");if(1==o.length)e.push(parseInt(o[0]));else if(2==o.length)for(var a=parseInt(o[0]),i=parseInt(o[1]),u=a;i>=u;u++)e.push(u);else console.log("Malformed range (too many dashes):",t)}return e},n.parseColorText=function(t){for(var e=t.split("\n"),r="",o=1,a={colorValues:{"":{}},range:["white","steelblue"]},i=[],u=0;u<e.length;u++)if(">"!=e[u][0])for(var s=e[u].trim().split(/[\s]+/),l=0;l<s.length;l++)if(isNaN(s[l])){if(0===s[l].search("range")){var c=s[l].split("=")[1].split(":");a.range=[c[0],c[1]];continue}if(0==s[l].search("domain")){c=s[l].split("=")[1].split(":"),a.domain=[c[0],c[1]];continue}for(var f=s[l].split(":"),h=n.parseRange(f[0]),p=f[1],d=0;d<h.length;d++)isNaN(p)?a.colorValues[r][h[d]]=p:(a.colorValues[r][h[d]]=+p,i.push(Number(p)))}else a.colorValues[r][o]=Number(s[l]),o+=1,i.push(Number(s[l]));else r=e[u].trim().slice(1),o=1,a.colorValues[r]={};return"domain"in a||(a.domain=[Math.min.apply(null,i),Math.max.apply(null,i)]),n.colorsJson=a,n},n.normalizeColors=function(){var t;for(var e in n.colorsJson){var r=Number.MAX_VALUE,o=Number.MIN_VALUE;for(var a in n.colorsJson.colorValues[e])"number"==typeof(t=n.colorsJson.colorValues[e][a])&&(r>t&&(r=t),t>o&&(o=t));for(a in n.colorsJson.colorValues[e])"number"==typeof(t=n.colorsJson.colorValues[e][a])&&(n.colorsJson.colorValues[e][a]=(t-r)/(o-r))}return n},n.parseColorText(n.colorsText),n};var r=function(t,n){return t-n};n.rnaUtilities=new e}])},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.rnaPlot=function(){var t,n,e={width:400,height:400,nucleotideRadius:5,rnaEdgePadding:0,labelInterval:0,showNucleotideLabels:!0,startNucleotideNumber:1,bundleExternalLinks:!1};function a(a){a.each((function(a){var i=new r.RNAGraph(a.sequence,a.structure,a.name).recalculateElements().elementsToJson().addName(a.name);a.rnaGraph=i;for(var u=(new o.NAView).naview_xy_coordinates(i.pairtable),s=[],l=0;l<u.nbase;l++)s.push([u.x[l],u.y[l]]);i.addPositions("nucleotide",s).reinforceStems().reinforceLoops().addExtraLinks(a.extraLinks).addLabels(e.startNucleotideNumber,e.labelInterval);var c=function(r,o){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=d3.extent(r),u=d3.extent(o),s=30;""!=a&&(u[1]+=s),i[0]-=e.nucleotideRadius+e.rnaEdgePadding,u[0]-=e.nucleotideRadius+e.rnaEdgePadding,i[1]+=e.nucleotideRadius+e.rnaEdgePadding,u[1]+=e.nucleotideRadius+e.rnaEdgePadding;var l,c=i[1]-i[0],f=u[1]-u[0],h=c-e.width,p=f-e.height;function d(t,n,e){var r=(t.range()[1]-t.range()[0])/(t.domain()[1]-t.domain()[0]),o=(n[1]-n[0])*r,a=(e[1]-e[0]-o)/2;return{scaleFactor:r,scale:d3.scale.linear().domain(n).range([e[0]+a,e[1]-a])}}return h>p?(l=d(t=d3.scale.linear().domain(i).range([0,e.width]),u,[0,e.height]),n=l.scale):(l=d(n=d3.scale.linear().domain(u).range([0,e.height]),i,[0,e.width]),t=l.scale),t.range()[0],t.domain()[0],n.range()[0],n.domain()[0],"translate("+-(t.domain()[0]*l.scaleFactor-t.range()[0])+","+-(n.domain()[0]*l.scaleFactor-n.range()[0])+")scale("+l.scaleFactor+")"}(i.nodes.map((function(t){return t.x})),i.nodes.map((function(t){return t.y}))),f=d3.select(this).append("g").attr("transform",c),h=i.nodes.filter((function(t){return"nucleotide"==t.nodeType})),p=i.nodes.filter((function(t){return"label"==t.nodeType})),d=i.links;!function(t,n){n=n.filter((function(t){return null!==t.source&&null!==t.target})),t.selectAll(".rna-link").data(n).enter().append("svg:line").attr("x1",(function(t){return t.source.x})).attr("x2",(function(t){return t.target.x})).attr("y1",(function(t){return t.source.y})).attr("y2",(function(t){return t.target.y})).attr("link-type",(function(t){return t.linkType})).attr("extra-link-type",(function(t){return t.extraLinkType})).classed("rna-link",!0)}(f,d),function(t,n){var r=t.selectAll(".rna-base").data(n).enter().append("svg:g").attr("transform",(function(t){return"translate("+t.x+","+t.y+")"}));r.append("svg:circle").attr("r",e.nucleotideRadius).classed("rna-base",!0),e.showNucleotideLabels&&r.append("svg:text").text((function(t){return t.name})).attr("text-anchor","middle").attr("dominant-baseline","central").classed("nucleotide-label",!0).append("svg:title").text((function(t){return t.struct_name+":"+t.num}))}(f,h),function(t,n){t.selectAll(".rnaLabel").data(n).enter().append("svg:g").attr("transform",(function(t){return"translate("+t.x+","+t.y+")"})).append("svg:text").text((function(t){return t.name})).attr("text-anchor","middle").attr("font-weight","bold").attr("dominant-baseline","central").classed("number-label",!0)}(f,p),function(r,o){r.append("svg:text").attr("transform","translate("+t.invert(e.width/2)+","+n.invert(e.height)+")").attr("dy",-10).classed("rna-name",!0).text(o)}(f,a.name),e.bundleExternalLinks&&function(t,n){var e={},r=[];n=n.filter((function(t){return"correct"==t.linkType||"incorrect"==t.linkType||"extra"==t.linkType})),t.selectAll("[link-type=extra]").remove();for(var o=0;o<n.length;o++)null!==n[o].source&&null!==n[o].target&&(e[n[o].source.uid]=n[o].source,e[n[o].target.uid]=n[o].target,r.push({source:n[o].source.uid,target:n[o].target.uid,linkType:n[o].linkType,extraLinkType:n[o].extraLinkType}));var a=d3.ForceEdgeBundling().nodes(e).edges(r).compatibility_threshold(.8).step_size(.2)(),i=d3.svg.line().x((function(t){return t.x})).y((function(t){return t.y})).interpolate("linear");for(o=0;o<a.length;o++){var u=a[o];t.append("path").attr("d",i(u)).style("fill","none").attr("link-type",(function(t){return r[o].linkType})).attr("extra-link-type",(function(t){return r[o].extraLinkType})).style("stroke-opacity",.4)}}(f,d)}))}return a.width=function(t){return arguments.length?(e.width=t,a):e.width},a.height=function(t){return arguments.length?(e.height=t,a):e.height},a.showNucleotideLabels=function(t){return arguments.length?(e.showNucleotideLabels=t,a):e.showNucleotideLabels},a.rnaEdgePadding=function(t){return arguments.length?(e.rnaEdgePadding=t,a):e.rnaEdgePadding},a.nucleotideRadius=function(t){return arguments.length?(e.nucleotideRadius=t,a):e.nucleotideRadius},a.labelInterval=function(t){return arguments.length?(e.labelInterval=t,a):e.labelInterval},a.showNucleotideLabels=function(t){return arguments.length?(e.showNucleotideLabels=t,a):e.showNucleotideLabels},a.startNucleotideNumber=function(t){return arguments.length?(e.startNucleotideNumber=t,a):e.startNucleotideNumber},a.bundleExternalLinks=function(t){return arguments.length?(e.bundleExternalLinks=t,a):e.bundleExternalLinks},a},e(4);var r=e(1),o=e(5);e(2),e(11),void 0===String.prototype.trim&&(String.prototype.trim=function(){return String(this).replace(/^\s+|\s+$/g,"")})},function(t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.simpleXyCoordinates=function(t){var n,e,r,o=[],a=[];e=t[0];var i=Array.apply(null,new Array(e+5)).map(Number.prototype.valueOf,0),u=Array.apply(null,new Array(16+Math.floor(e/5))).map(Number.prototype.valueOf,0),s=Array.apply(null,new Array(16+Math.floor(e/5))).map(Number.prototype.valueOf,0),l=0,c=0,f=Math.PI/2;(function t(n,e,r){var o,a,h,p,d,m,g,v,y,b,x,M,w=2,_=0,k=0,S=Array.apply(null,new Array(3+2*Math.floor((e-n)/5))).map(Number.prototype.valueOf,0);for(o=n-1,e++;n!=e;)if((a=r[n])&&0!=n){w+=2,h=n,p=a,S[++_]=h,S[++_]=p,n=a+1,d=h,m=p,v=0;do{h++,p--,v++}while(r[h]==p&&r[h]>h);if(g=v-2,v>=2&&(i[d+1+g]+=f,i[m-1-g]+=f,i[d]+=f,i[m]+=f,v>2))for(;g>=1;g--)i[d+g]=Math.PI,i[m-g]=Math.PI;s[++c]=v,h<=p&&t(h,p,r)}else n++,w++,k++;for(M=Math.PI*(w-2)/w,S[++_]=e,y=o<0?0:o,b=1;b<=_;b++){for(x=S[b]-y,g=0;g<=x;g++)i[y+g]+=M;if(b>_)break;y=S[++b]}u[++l]=k})(0,e+1,t),u[l]-=2,r=0,o[0]=100,a[0]=100;var h=[];for(h.push([o[0],a[0]]),n=1;n<e;n++)o[n]=o[n-1]+15*Math.cos(r),a[n]=a[n-1]+15*Math.sin(r),h.push([o[n],a[n]]),r+=Math.PI-i[n+1];return h}},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.NAView=s;var r=e(6),o=e(7),a=e(9),i=e(10),u=e(8);function s(){this.ANUM=9999,this.MAXITER=500,this.bases=[],this.nbase=null,this.nregion=null,this.loop_count=null,this.root=new u.Loop,this.loops=[],this.regions=[],this.rlphead=new r.Radloop,this.lencut=.8,this.RADIUS_REDUCTION_FACTOR=1.4,this.angleinc=null,this._h=null,this.HELIX_FACTOR=.6,this.BACKBONE_DISTANCE=27}function l(){var t=new u.Loop,n=null,e=null;for(n=0;n<this.loop_count;n++){for(t=this.loops[n],e=0;e<this.loop_count;e++)this.loops[e].setMark(!1);t.setDepth(c(t))}}function c(t){var n=null,e=null,r=null;if(t.getNconnection()<=1)return 0;if(t.isMark())return-1;t.setMark(!0),n=0,e=0;for(var o=0;null!=t.getConnection(o);o++)(r=c(t.getConnection(o).getLoop()))>=0&&(1==++n?e=r:e>r&&(e=r));return t.setMark(!1),e+1}s.prototype.naview_xy_coordinates=function(t){var n,e=[],r=[];if(0===t.length||0===t[0])return 0;this.nbase=t[0],this.bases=[];for(var o=0;o<this.nbase+1;o++)this.bases.push(new i.Base);for(this.regions=[],o=0;o<this.nbase+1;o++)this.regions.push(new a.Region);for(this.read_in_bases(t),this.rlphead=null,this.find_regions(),this.loop_count=0,this.loops=[],o=0;o<this.nbase+1;o++)this.loops.push(new u.Loop);for(this.construct_loop(0),this.find_central_loop(),this.traverse_loop(this.root,null),n=0;n<this.nbase;n++)e.push(100+this.BACKBONE_DISTANCE*this.bases[n+1].getX()),r.push(100+this.BACKBONE_DISTANCE*this.bases[n+1].getY());return{nbase:this.nbase,x:e,y:r}},s.prototype.read_in_bases=function(t){var n=null,e=null;for(this.bases.push(new i.Base),this.bases[0].setMate(0),this.bases[0].setExtracted(!1),this.bases[0].setX(this.ANUM),this.bases[0].setY(this.ANUM),e=0,n=1;n<=this.nbase;n++)this.bases.push(new i.Base),this.bases[n].setExtracted(!1),this.bases[n].setX(this.ANUM),this.bases[n].setY(this.ANUM),this.bases[n].setMate(t[n]),t[n]>n&&e++;0==e&&(this.bases[1].setMate(this.nbase),this.bases[this.nbase].setMate(1))},s.prototype.find_regions=function(){var t,n=null,e=null;t=this.nbase+1;var r=[];for(n=0;n<t;n++)r.push(!1);for(this.nregion=0,n=0;n<=this.nbase;n++)if(0!=(e=this.bases[n].getMate())&&!r[n]){for(this.regions[this.nregion].setStart1(n),this.regions[this.nregion].setEnd2(e),r[n]=!0,r[e]=!0,this.bases[n].setRegion(this.regions[this.nregion]),this.bases[e].setRegion(this.regions[this.nregion]),n++,e--;n<e&&this.bases[n].getMate()==e;n++,e--)r[e]=!0,r[n]=!0,this.bases[n].setRegion(this.regions[this.nregion]),this.bases[e].setRegion(this.regions[this.nregion]);this.regions[this.nregion].setEnd1(--n),this.regions[this.nregion].setStart2(e+1),this.nregion++}},s.prototype.construct_loop=function(t){var n=null,e=null,i=new u.Loop,s=new u.Loop,l=new o.Connection,c=new a.Region,f=new r.Radloop;for((i=this.loops[this.loop_count++]).setNconnection(0),i.setDepth(0),i.setNumber(this.loop_count),i.setRadius(0),f=this.rlphead;null!=f;f=f.getNext())f.getLoopnumber()==this.loop_count&&i.setRadius(f.getRadius());n=t;do{0!=(e=this.bases[n].getMate())&&(c=this.bases[n].getRegion(),this.bases[c.getStart1()].isExtracted()||(n==c.getStart1()?(this.bases[c.getStart1()].setExtracted(!0),this.bases[c.getEnd1()].setExtracted(!0),this.bases[c.getStart2()].setExtracted(!0),this.bases[c.getEnd2()].setExtracted(!0),s=this.construct_loop(c.getEnd1()<this.nbase?c.getEnd1()+1:0)):n==c.getStart2()?(this.bases[c.getStart2()].setExtracted(!0),this.bases[c.getEnd2()].setExtracted(!0),this.bases[c.getStart1()].setExtracted(!0),this.bases[c.getEnd1()].setExtracted(!0),s=this.construct_loop(c.getEnd2()<this.nbase?c.getEnd2()+1:0)):console.log("Something went terribly wrong ...."),i.setNconnection(i.getNconnection()+1),l=new o.Connection,i.setConnection(i.getNconnection()-1,l),i.setConnection(i.getNconnection(),null),l.setLoop(s),l.setRegion(c),n==c.getStart1()?(l.setStart(c.getStart1()),l.setEnd(c.getEnd2())):(l.setStart(c.getStart2()),l.setEnd(c.getEnd1())),l.setExtruded(!1),l.setBroken(!1),s.setNconnection(s.getNconnection()+1),l=new o.Connection,s.setConnection(s.getNconnection()-1,l),s.setConnection(s.getNconnection(),null),l.setLoop(i),l.setRegion(c),n==c.getStart1()?(l.setStart(c.getStart2()),l.setEnd(c.getEnd1())):(l.setStart(c.getStart1()),l.setEnd(c.getEnd2())),l.setExtruded(!1),l.setBroken(!1)),n=e),++n>this.nbase&&(n=0)}while(n!=t);return i},s.prototype.find_central_loop=function(){var t=new u.Loop,n=null,e=null,r=null;for(l.bind(this)(),n=0,e=-1,r=0;r<this.loop_count;r++)(t=this.loops[r]).getNconnection()>n?(e=t.getDepth(),n=t.getNconnection(),this.root=t):t.getDepth()>e&&t.getNconnection()==n&&(e=t.getDepth(),this.root=t)},s.prototype.traverse_loop=function(t,n){var e,r,o,a,i,u,s,l,c,f,h,p,d,m,g,v,y,b,x,M,w,_,k,S,A,E,T,R,N,P,C,O,L,U,D,z,q,j,F,B,I,X,Y,V,H,G,W,Z,J,$,K,Q,tt,nt,et,rt,ot,at,it,ut,st,lt,ct,ft,ht,pt,dt,mt,gt,vt=0;u=2*Math.PI/(this.nbase+1),b=null,P=-1;var yt=0;for(k=0;null!=(v=t.getConnection(yt));yt++,k++)e=-Math.sin(u*v.getStart()),r=Math.cos(u*v.getStart()),o=-Math.sin(u*v.getEnd()),a=Math.cos(u*v.getEnd())-r,i=e-o,s=Math.sqrt(a*a+i*i),v.setXrad(a/s),v.setYrad(i/s),v.setAngle(Math.atan2(i,a)),v.getAngle()<0&&v.setAngle(v.getAngle()+2*Math.PI),null!=n&&n.getRegion()==v.getRegion()&&(b=v,P=k);t:for(;;){this.determine_radius(t,this.lencut),l=t.getRadius()/this.RADIUS_REDUCTION_FACTOR,null==n?c=f=0:(h=(this.bases[b.getStart()].getX()+this.bases[b.getEnd()].getX())/2,p=(this.bases[b.getStart()].getY()+this.bases[b.getEnd()].getY())/2,c=h-l*b.getXrad(),f=p-l*b.getYrad()),T=-1==P?0:P,v=t.getConnection(T),E=0,C=!1;do{if((w=T-1)<0&&(w=t.getNconnection()-1),x=t.getConnection(w),this.connected_connection(x,v)?(T=w,v=x):C=!0,++E>t.getNconnection()){for(A=-1,k=0;k<t.getNconnection();k++)(w=k+1)>=t.getNconnection()&&(w=0),v=t.getConnection(k),(ht=(y=t.getConnection(w)).getAngle()-v.getAngle())<0&&(ht+=2*Math.PI),ht>A&&(A=ht,vt=k);R=vt,(T=vt+1)>=t.getNconnection()&&(T=0),(v=t.getConnection(R)).setBroken(!0),C=!0}}while(!C);for(O=!1,G=T;!O;){for(E=0,C=!1,R=T,L=!1;!C;)if(v=t.getConnection(R),R==P&&(L=!0),(w=R+1)>=t.getNconnection()&&(w=0),y=t.getConnection(w),this.connected_connection(v,y)){if(++E>=t.getNconnection())break;R=w}else C=!0;for(k=W=Z=N=this.find_ic_middle(T,R,n,b,t),C=!1,$=0;!C;)(k=$<0?W:0==$?N:Z)>=0&&(v=t.getConnection(k),null!=n&&b==v||(0==$?(d=v.getAngle()-Math.asin(.5/l),m=v.getAngle()+Math.asin(.5/l),this.bases[v.getStart()].setX(c+l*Math.cos(d)),this.bases[v.getStart()].setY(f+l*Math.sin(d)),this.bases[v.getEnd()].setX(c+l*Math.cos(m)),this.bases[v.getEnd()].setY(f+l*Math.sin(m))):$<0?((w=k+1)>=t.getNconnection()&&(w=0),v=t.getConnection(k),y=t.getConnection(w),et=v.getXrad(),rt=v.getYrad(),ht=(v.getAngle()+y.getAngle())/2,v.getAngle()>y.getAngle()&&(ht-=Math.PI),it=Math.cos(ht),lt=Math.sin(ht),ct=-it,(S=y.getAngle()-v.getAngle())<0&&(S+=2*Math.PI),ft=v.isExtruded()?S<=Math.PI/2?2:1.5:1,this.bases[v.getEnd()].setX(this.bases[y.getStart()].getX()+ft*lt),this.bases[v.getEnd()].setY(this.bases[y.getStart()].getY()+ft*ct),this.bases[v.getStart()].setX(this.bases[v.getEnd()].getX()+rt),this.bases[v.getStart()].setY(this.bases[v.getEnd()].getY()-et)):((w=k-1)<0&&(w=t.getNconnection()-1),v=t.getConnection(w),ot=(y=t.getConnection(k)).getXrad(),at=y.getYrad(),ht=(v.getAngle()+y.getAngle())/2,v.getAngle()>y.getAngle()&&(ht-=Math.PI),it=Math.cos(ht),lt=-Math.sin(ht),ct=it,(S=y.getAngle()-v.getAngle())<0&&(S+=2*Math.PI),ft=v.isExtruded()?S<=Math.PI/2?2:1.5:1,this.bases[y.getStart()].setX(this.bases[v.getEnd()].getX()+ft*lt),this.bases[y.getStart()].setY(this.bases[v.getEnd()].getY()+ft*ct),this.bases[y.getEnd()].setX(this.bases[y.getStart()].getX()-at),this.bases[y.getEnd()].setY(this.bases[y.getStart()].getY()+ot)))),$<0?(Z==R?Z=-1:Z>=0&&++Z>=t.getNconnection()&&(Z=0),$=1):(W==T?W=-1:W>=0&&--W<0&&(W=t.getNconnection()-1),$=-1),C=-1==W&&-1==Z;if((J=R+1)>=t.getNconnection()&&(J=0),R!=T&&(T!=G||J!=G))if(v=t.getConnection(T),y=t.getConnection(R),Q=this.bases[y.getEnd()].getX()-this.bases[v.getStart()].getX(),tt=this.bases[y.getEnd()].getY()-this.bases[v.getStart()].getY(),D=this.bases[v.getStart()].getX()+Q/2,z=this.bases[v.getStart()].getY()+tt/2,F=Q/(nt=Math.sqrt(Q*Q+tt*tt)),B=tt/nt,I=c-D,X=f-z,q=(Y=(I/=nt=Math.sqrt(Q*Q+tt*tt))*F+(X/=nt)*B)*F-I,j=Y*B-X,q/=nt=Math.sqrt(q*q+j*j),j/=nt,Q=this.bases[v.getStart()].getX()-c,tt=this.bases[v.getStart()].getY()-f,(ht=Math.atan2(tt,Q))<0&&(ht+=2*Math.PI),Q=this.bases[y.getEnd()].getX()-c,tt=this.bases[y.getEnd()].getY()-f,(pt=Math.atan2(tt,Q))<0&&(pt+=2*Math.PI),pt<ht&&(pt+=2*Math.PI),V=c+(U=pt-ht>Math.PI?-1:1)*l*q,H=f+U*l*j,L)c-=V-D,f-=H-z;else for(k=T;M=(v=t.getConnection(k)).getStart(),this.bases[M].setX(this.bases[M].getX()+V-D),this.bases[M].setY(this.bases[M].getY()+H-z),M=v.getEnd(),this.bases[M].setX(this.bases[M].getX()+V-D),this.bases[M].setY(this.bases[M].getY()+H-z),k!=R;)++k>=t.getNconnection()&&(k=0);O=(T=J)==G}for(k=0;k<t.getNconnection();k++){if(v=t.getConnection(k),(w=k+1)>=t.getNconnection()&&(w=0),y=t.getConnection(w),Q=this.bases[v.getEnd()].getX()-c,tt=this.bases[v.getEnd()].getY()-f,st=Math.sqrt(Q*Q+tt*tt),(ht=Math.atan2(tt,Q))<0&&(ht+=2*Math.PI),Q=this.bases[y.getStart()].getX()-c,tt=this.bases[y.getStart()].getY()-f,ut=Math.sqrt(Q*Q+tt*tt),(pt=Math.atan2(tt,Q))<0&&(pt+=2*Math.PI),pt<ht&&(pt+=2*Math.PI),K=pt-ht,(gt=y.getAngle()-v.getAngle())<=0&&(gt+=2*Math.PI),Math.abs(K-gt)>Math.PI)if(v.isExtruded())console.log("Warning from traverse_loop. Loop "+t.getNumber()+" has crossed regions\n");else if(y.getStart()-v.getEnd()!=1){v.setExtruded(!0);continue t}if(v.isExtruded())this.construct_extruded_segment(v,y);else for((_=y.getStart()-v.getEnd())<0&&(_+=this.nbase+1),u=K/_,w=1;w<_;w++)(M=v.getEnd()+w)>this.nbase&&(M-=this.nbase+1),nt=st+(ut-st)*((g=ht+w*u)-ht)/K,this.bases[M].setX(c+nt*Math.cos(g)),this.bases[M].setY(f+nt*Math.sin(g))}break}for(k=0;k<t.getNconnection();k++)P!=k&&(v=t.getConnection(k),this.generate_region(v),this.traverse_loop(v.getLoop(),v));for(_=0,dt=0,mt=0,k=0;k<t.getNconnection();k++)if((w=k+1)>=t.getNconnection()&&(w=0),v=t.getConnection(k),y=t.getConnection(w),_+=2,dt+=this.bases[v.getStart()].getX()+this.bases[v.getEnd()].getX(),mt+=this.bases[v.getStart()].getY()+this.bases[v.getEnd()].getY(),!v.isExtruded())for(w=v.getEnd()+1;w!=y.getStart();w++)w>this.nbase&&(w-=this.nbase+1),_++,dt+=this.bases[w].getX(),mt+=this.bases[w].getY();t.setX(dt/_),t.setY(mt/_)},s.prototype.determine_radius=function(t,n){var e,r,a,i,u,s,l,c,f,h,p,d=0,m=new o.Connection,g=new o.Connection;do{for(e=1e10,u=0,i=0,c=0;c<t.getNconnection();c++)m=t.getConnection(c),(f=c+1)>=t.getNconnection()&&(f=0),g=t.getConnection(f),h=m.getEnd(),(p=g.getStart())<h&&(p+=this.nbase+1),(a=g.getAngle()-m.getAngle())<=0&&(a+=2*Math.PI),i+=a*(1/(r=m.isExtruded()?a<=Math.PI/2?2:1.5:p-h)+1),u+=a*a/r,(l=a/r)<e&&!m.isExtruded()&&r>1&&(e=l,d=c);(s=i/u)<.7071068&&(s=.7071068),e*s<n&&t.getConnection(d).setExtruded(!0)}while(e*s<n);t.getRadius()>0?s=t.getRadius():t.setRadius(s)},s.prototype.find_ic_middle=function(t,n,e,r,o){var a,i,u,s,l;for(a=0,i=-1,u=t,l=!1;!l;)a++>2*o.getNconnection()&&console.log("Infinite loop in 'find_ic_middle'"),null!=e&&o.getConnection(u)==r&&(i=u),l=u==n,++u>=o.getNconnection()&&(u=0);if(-1==i){for(s=1,u=t;s<(a+1)/2;s++)++u>=o.getNconnection()&&(u=0);i=u}return i},s.prototype.construct_extruded_segment=function(t,n){var e,r,o,a,i,u,s,l,c,f,h,p,d,m,g,v,y,b;if(e=t.getAngle(),(o=r=n.getAngle())<e&&(o+=2*Math.PI),a=(e+o)/2,d=t.getEnd(),(g=(m=n.getStart())-d)<0&&(g+=this.nbase+1),(h=n.getAngle()-t.getAngle())<0&&(h+=2*Math.PI),2==g)this.construct_circle_segment(d,m);else{i=this.bases[m].getX()-this.bases[d].getX(),u=this.bases[m].getY()-this.bases[d].getY(),i/=f=Math.sqrt(i*i+u*u),u/=f,f>=1.5&&h<=Math.PI/2&&((v=d+1)>this.nbase&&(v-=this.nbase+1),(y=m-1)<0&&(y+=this.nbase+1),this.bases[v].setX(this.bases[d].getX()+.5*i),this.bases[v].setY(this.bases[d].getY()+.5*u),this.bases[y].setX(this.bases[m].getX()-.5*i),this.bases[y].setY(this.bases[m].getY()-.5*u),d=v,m=y);do{b=!1,this.construct_circle_segment(d,m),(v=d+1)>this.nbase&&(v-=this.nbase+1),i=this.bases[v].getX()-this.bases[d].getX(),u=this.bases[v].getY()-this.bases[d].getY(),(s=Math.atan2(u,i))<0&&(s+=2*Math.PI),(p=s-e)<0&&(p+=2*Math.PI),p>Math.PI&&(b=!0),(y=m-1)<0&&(y+=this.nbase+1),i=this.bases[y].getX()-this.bases[m].getX(),u=this.bases[y].getY()-this.bases[m].getY(),(l=Math.atan2(u,i))<0&&(l+=2*Math.PI),(p=r-l)<0&&(p+=2*Math.PI),p>Math.PI&&(b=!0),b&&(c=this.minf2(a,e+.5),this.bases[v].setX(this.bases[d].getX()+Math.cos(c)),this.bases[v].setY(this.bases[d].getY()+Math.sin(c)),d=v,c=this.maxf2(a,o-.5),this.bases[y].setX(this.bases[m].getX()+Math.cos(c)),this.bases[y].setY(this.bases[m].getY()+Math.sin(c)),m=y,g-=2)}while(b&&g>1)}},s.prototype.construct_circle_segment=function(t,n){var e,r,o,a,i,u,s,l,c,f,h,p,d,m,g;if(e=this.bases[n].getX()-this.bases[t].getX(),r=this.bases[n].getY()-this.bases[t].getY(),o=Math.sqrt(e*e+r*r),(d=n-t)<0&&(d+=this.nbase+1),o>=d)for(e/=o,r/=o,m=1;m<d;m++)(g=t+m)>this.nbase&&(g-=this.nbase+1),this.bases[g].setX(this.bases[t].getX()+e*m/d),this.bases[g].setY(this.bases[t].getY()+r*m/d);else for(this.find_center_for_arc(d-1,o),e/=o,r/=o,a=this.bases[t].getX()+e*o/2,i=this.bases[t].getY()+r*o/2,u=r,s=-e,l=a+this._h*u,c=i+this._h*s,f=this.bases[t].getX()-l,h=this.bases[t].getY()-c,o=Math.sqrt(f*f+h*h),p=Math.atan2(h,f),m=1;m<d;m++)(g=t+m)>this.nbase&&(g-=this.nbase+1),this.bases[g].setX(l+o*Math.cos(p+m*this.angleinc)),this.bases[g].setY(c+o*Math.sin(p+m*this.angleinc))},s.prototype.find_center_for_arc=function(t,n){var e,r,o,a,i,u,s,l;o=-(r=(t+1)/Math.PI)-n/(t+1.000001-n),n<1&&(o=0),l=0;do{e=(r+o)/2,i=1-.5/((a=Math.sqrt(e*e+n*n/4))*a),Math.abs(i)>1&&console.log("Unexpected large magnitude discriminant = "+i+" "+a),(s=(u=Math.acos(i))*(t+1)+2*Math.acos(e/a)-2*Math.PI)>0?o=e:r=e}while(Math.abs(s)>1e-4&&++l<this.MAXITER);l>=this.MAXITER&&(noIterationFailureYet&&(console.log("Iteration failed in find_center_for_arc"),noIterationFailureYet=!1),e=0,u=0),this._h=e,this.angleinc=u},s.prototype.generate_region=function(t){var n,e,r,o,a,i;for(i=t.getRegion(),n=0,t.getStart()==i.getStart1()?(e=i.getStart1(),r=i.getEnd1()):(e=i.getStart2(),r=i.getEnd2()),(this.bases[t.getStart()].getX()>this.ANUM-100||this.bases[t.getEnd()].getX()>this.ANUM-100)&&console.log("Bad region passed to generate_region. Coordinates not defined."),o=e+1;o<=r;o++)n++,this.bases[o].setX(this.bases[t.getStart()].getX()+this.HELIX_FACTOR*n*t.getXrad()),this.bases[o].setY(this.bases[t.getStart()].getY()+this.HELIX_FACTOR*n*t.getYrad()),a=this.bases[o].getMate(),this.bases[a].setX(this.bases[t.getEnd()].getX()+this.HELIX_FACTOR*n*t.getXrad()),this.bases[a].setY(this.bases[t.getEnd()].getY()+this.HELIX_FACTOR*n*t.getYrad())},s.prototype.minf2=function(t,n){return t<n?t:n},s.prototype.maxf2=function(t,n){return t>n?t:n},s.prototype.connected_connection=function(t,n){return!!t.isExtruded()||t.getEnd()+1==n.getStart()}},function(t,n){"use strict";function e(){this.radius=null,this.loopnumber=null,this.next=null,this.prev=null}Object.defineProperty(n,"__esModule",{value:!0}),n.Radloop=e,e.prototype.getRadius=function(){return this.radius},e.prototype.setRadius=function(t){this.radius=t},e.prototype.getLoopnumber=function(){return this.loopnumber},e.prototype.setLoopnumber=function(t){this.loopnumber=t},e.prototype.getNext=function(){return this.next},e.prototype.setNext=function(t){this.next=t},e.prototype.getPrev=function(){return this.prev},e.prototype.setPrev=function(t){this.prev=t}},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.Connection=a;var r=e(8),o=e(9);function a(){this.loop=new r.Loop,this.region=new o.Region,this.start=null,this.end=null,this.xrad=null,this.yrad=null,this.angle=null,this.extruded=null,this.broken=null,this._isNull=!1}a.prototype.isNull=function(){return this._isNull},a.prototype.setNull=function(t){this._isNull=t},a.prototype.getLoop=function(){return this.loop},a.prototype.setLoop=function(t){this.loop=t},a.prototype.getRegion=function(){return this.region},a.prototype.setRegion=function(t){this.region=t},a.prototype.getStart=function(){return this.start},a.prototype.setStart=function(t){this.start=t},a.prototype.getEnd=function(){return this.end},a.prototype.setEnd=function(t){this.end=t},a.prototype.getXrad=function(){return this.xrad},a.prototype.setXrad=function(t){this.xrad=t},a.prototype.getYrad=function(){return this.yrad},a.prototype.setYrad=function(t){this.yrad=t},a.prototype.getAngle=function(){return this.angle},a.prototype.setAngle=function(t){this.angle=t},a.prototype.isExtruded=function(){return this.extruded},a.prototype.setExtruded=function(t){this.extruded=t},a.prototype.isBroken=function(){return this.broken},a.prototype.setBroken=function(t){this.broken=t}},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.Loop=o;var r=e(7);function o(){this.nconnection=null,this.connections=[],this._connections=[],this.number=null,this.depth=null,this.mark=null,this.x=null,this.y=null,this.radius=null}o.prototype.getNconnection=function(){return this.nconnection},o.prototype.setNconnection=function(t){this.nconnection=t},o.prototype.setConnection=function(t,n){null!=n?this._connections[t]=n:(this._connections[t]||(this._connections[t]=new r.Connection),this._connections[t].setNull(!0))},o.prototype.getConnection=function(t){var n=e(7);this._connections[t]||(this._connections[t]=new n);var r=this._connections[t];return r.isNull()?null:r},o.prototype.addConnection=function(t,n){this._connections.push(n)},o.prototype.getNumber=function(){return this.number},o.prototype.setNumber=function(t){this.number=t},o.prototype.getDepth=function(){return this.depth},o.prototype.setDepth=function(t){this.depth=t},o.prototype.isMark=function(){return this.mark},o.prototype.setMark=function(t){this.mark=t},o.prototype.getX=function(){return this.x},o.prototype.setX=function(t){this.x=t},o.prototype.getY=function(){return this.y},o.prototype.setY=function(t){this.y=t},o.prototype.getRadius=function(){return this.radius},o.prototype.setRadius=function(t){this.radius=t}},function(t,n){"use strict";function e(){this._start1=null,this._end1=null,this._start2=null,this._end2=null}Object.defineProperty(n,"__esModule",{value:!0}),n.Region=e,e.prototype.getStart1=function(){return this._start1},e.prototype.setStart1=function(t){this._start1=t},e.prototype.getEnd1=function(){return this._end1},e.prototype.setEnd1=function(t){this._end1=t},e.prototype.getStart2=function(){return this._start2},e.prototype.setStart2=function(t){this._start2=t},e.prototype.getEnd2=function(){return this._end2},e.prototype.setEnd2=function(t){this._end2=t}},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.Base=o;var r=e(9);function o(){this.mate=null,this.x=null,this.y=null,this.extracted=null,this.region=new r.Region}o.prototype.getMate=function(){return this.mate},o.prototype.setMate=function(t){this.mate=t},o.prototype.getX=function(){return this.x},o.prototype.setX=function(t){this.x=t},o.prototype.getY=function(){return this.y},o.prototype.setY=function(t){this.y=t},o.prototype.isExtracted=function(){return this.extracted},o.prototype.setExtracted=function(t){this.extracted=t},o.prototype.getRegion=function(){return this.region},o.prototype.setRegion=function(t){this.region=t}},function(t,n,e){var r=e(12);"string"==typeof r&&(r=[[t.id,r,""]]),e(14)(r,{}),r.locals&&(t.exports=r.locals)},function(t,n,e){(t.exports=e(13)()).push([t.id,'.forna-container .structure-background-rect {\r\n    stroke: black;\r\n    stroke-width: 5;\r\n    fill: transparent;\r\n}\r\n\r\n.forna-container circle.rna-base {\r\n  stroke: #ccc;\r\n  stroke-width: 1px;\r\n  opacity: 1;\r\n  fill: white;\r\n}\r\n\r\n.forna-container circle.rna-base.label {\r\n    stroke: transparent;\r\n    stroke-width: 0;\r\n    fill: white;\r\n}\r\n\r\n.forna-container line.link {\r\n  stroke: #999;\r\n  stroke-opacity: 0.8;\r\n  stroke-width: 2;\r\n}\r\n\r\n.forna-container line.rna-link {\r\n  stroke: #999;\r\n  stroke-opacity: 0.8;\r\n  stroke-width: 2;\r\n}\r\n\r\n.forna-container .overlay {\r\n    fill: transparent;\r\n}\r\n\r\n.forna-container .rna-name {\r\n    text-anchor: middle;\r\n    dy: -10;\r\n    font-family: Tahoma, Geneva, sans-serif;\r\n    font-size: 8pt;\r\n}\r\n\r\n.forna-container line.rna-link[link-type="backbone"] {\r\n    stroke: transparent;\r\n}\r\n\r\n.forna-container line.rna-link[link-type="basepair"] {\r\n    stroke: transparent;\r\n}\r\n\r\n.forna-container line.rna-link[link-type="fake"] {\r\n    stroke: transparent;\r\n}\r\n\r\n.forna-container line.rna-link[link-type="extra"] {\r\n    stroke: grey;\r\n}\r\n\r\n.forna-container line.rna-link[extra-link-type="correct"] {\r\n    stroke: green;\r\n}\r\n\r\n.forna-container line.rna-link[extra-link-type="incorrect"] {\r\n    stroke: green;\r\n}\r\n\r\n\r\n.forna-container path {\r\n    stroke-width: 2;\r\n}\r\n\r\n.forna-container path[extra-link-type="correct"] {\r\n    stroke: green;\r\n}\r\n\r\n.forna-container path[extra-link-type="incorrect"] {\r\n    stroke: red;\r\n}\r\n\r\n\r\n.forna-container line.basepair {\r\n  stroke: red;\r\n}\r\n\r\n.forna-container line.intermolecule {\r\n  stroke: blue;\r\n}\r\n\r\n.forna-container line.chain_chain {\r\n  stroke-dasharray: 3,3;\r\n}\r\n\r\n.forna-container line.fake {\r\n  stroke: green;\r\n}\r\n\r\n.forna-container .transparent {\r\n    fill: transparent;\r\n    stroke-width: 0;\r\n    stroke-opacity: 0;\r\n    opacity: 0;\r\n}\r\n\r\n.forna-container .d3-tip {\r\n    line-height: 1;\r\n    font-weight: bold;\r\n    padding: 6px;\r\n    background: rgba(0, 0, 0, 0.6);\r\n    color: #fff;\r\n    border-radius: 4px;\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container text.nucleotide-label {\r\n    font-size: 5.5pt;\r\n    font-weight: bold;\r\n    font-family: Tahoma, Geneva, sans-serif;\r\n    color: rgb(100,100,100);\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container text.number-label {\r\n    font-size: 5.5pt;\r\n    font-weight: bold;\r\n    font-family: Tahoma, Geneva, sans-serif;\r\n    color: rgb(100,100,100);\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container text {\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container g.gnode {\r\n\r\n}\r\n\r\n.forna-container .brush .extent {\r\n  fill-opacity: .1;\r\n  stroke: #fff;\r\n  shape-rendering: crispEdges;\r\n}\r\n\r\n.forna-container .noselect {\r\n    -webkit-touch-callout: none;\r\n    -webkit-user-select: none;\r\n    -khtml-user-select: none;\r\n    -moz-user-select: none;\r\n    -ms-user-select: none;\r\n    user-select: none;\r\n}\r\n',""])},function(t,n){t.exports=function(){var t=[];return t.toString=function(){for(var t=[],n=0;n<this.length;n++){var e=this[n];e[2]?t.push("@media "+e[2]+"{"+e[1]+"}"):t.push(e[1])}return t.join("")},t.i=function(n,e){"string"==typeof n&&(n=[[null,n,""]]);for(var r={},o=0;o<this.length;o++){var a=this[o][0];"number"==typeof a&&(r[a]=!0)}for(o=0;o<n.length;o++){var i=n[o];"number"==typeof i[0]&&r[i[0]]||(e&&!i[2]?i[2]=e:e&&(i[2]="("+i[2]+") and ("+e+")"),t.push(i))}},t}},function(t,n,e){var r={},o=function(t){var n;return function(){return void 0===n&&(n=t.apply(this,arguments)),n}},a=o((function(){return/msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase())})),i=o((function(){return document.head||document.getElementsByTagName("head")[0]})),u=null,s=0,l=[];function c(t,n){for(var e=0;e<t.length;e++){var o=t[e],a=r[o.id];if(a){a.refs++;for(var i=0;i<a.parts.length;i++)a.parts[i](o.parts[i]);for(;i<o.parts.length;i++)a.parts.push(m(o.parts[i],n))}else{var u=[];for(i=0;i<o.parts.length;i++)u.push(m(o.parts[i],n));r[o.id]={id:o.id,refs:1,parts:u}}}}function f(t){for(var n=[],e={},r=0;r<t.length;r++){var o=t[r],a=o[0],i={css:o[1],media:o[2],sourceMap:o[3]};e[a]?e[a].parts.push(i):n.push(e[a]={id:a,parts:[i]})}return n}function h(t,n){var e=i(),r=l[l.length-1];if("top"===t.insertAt)r?r.nextSibling?e.insertBefore(n,r.nextSibling):e.appendChild(n):e.insertBefore(n,e.firstChild),l.push(n);else{if("bottom"!==t.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");e.appendChild(n)}}function p(t){t.parentNode.removeChild(t);var n=l.indexOf(t);n>=0&&l.splice(n,1)}function d(t){var n=document.createElement("style");return n.type="text/css",h(t,n),n}function m(t,n){var e,r,o;if(n.singleton){var a=s++;e=u||(u=d(n)),r=y.bind(null,e,a,!1),o=y.bind(null,e,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(e=function(t){var n=document.createElement("link");return n.rel="stylesheet",h(t,n),n}(n),r=x.bind(null,e),o=function(){p(e),e.href&&URL.revokeObjectURL(e.href)}):(e=d(n),r=b.bind(null,e),o=function(){p(e)});return r(t),function(n){if(n){if(n.css===t.css&&n.media===t.media&&n.sourceMap===t.sourceMap)return;r(t=n)}else o()}}t.exports=function(t,n){void 0===(n=n||{}).singleton&&(n.singleton=a()),void 0===n.insertAt&&(n.insertAt="bottom");var e=f(t);return c(e,n),function(t){for(var o=[],a=0;a<e.length;a++){var i=e[a];(u=r[i.id]).refs--,o.push(u)}for(t&&c(f(t),n),a=0;a<o.length;a++){var u;if(0===(u=o[a]).refs){for(var s=0;s<u.parts.length;s++)u.parts[s]();delete r[u.id]}}}};var g,v=(g=[],function(t,n){return g[t]=n,g.filter(Boolean).join("\n")});function y(t,n,e,r){var o=e?"":r.css;if(t.styleSheet)t.styleSheet.cssText=v(n,o);else{var a=document.createTextNode(o),i=t.childNodes;i[n]&&t.removeChild(i[n]),i.length?t.insertBefore(a,i[n]):t.appendChild(a)}}function b(t,n){var e=n.css,r=n.media;if(r&&t.setAttribute("media",r),t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}function x(t,n){var e=n.css,r=n.sourceMap;r&&(e+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var o=new Blob([e],{type:"text/css"}),a=t.href;t.href=URL.createObjectURL(o),a&&URL.revokeObjectURL(a)}},function(t,n,e){var r=e(16);"string"==typeof r&&(r=[[t.id,r,""]]),e(14)(r,{}),r.locals&&(t.exports=r.locals)},function(t,n,e){(t.exports=e(13)()).push([t.id,".forna-container svg {\r\n  display: block;\r\n  min-width: 100%;\r\n  width: 100%;\r\n  min-height: 100%;\r\n}\r\n\r\n.forna-container circle.node {\r\n  stroke: #ccc;\r\n  stroke-width: 1px;\r\n  opacity: 1;\r\n  fill: white;\r\n}\r\n\r\n.forna-container polygon.node {\r\n  stroke: #ccc;\r\n  stroke-width: 1px;\r\n  opacity: 1;\r\n  fill: white;\r\n}\r\n\r\n.forna-container circle.node.label {\r\n    stroke: transparent;\r\n    stroke-width: 0;\r\n    fill: white;\r\n    display: inline;\r\n}\r\n\r\n.forna-container circle.outline_node {\r\n    stroke-width: 1px;\r\n    fill: red;\r\n}\r\n\r\n.forna-container circle.protein {\r\n    fill: gray;\r\n    fill-opacity: 0.5;\r\n    stroke-width: 4;\r\n}\r\n\r\n.forna-container circle.hidden_outline {\r\n    stroke-width: 0px;\r\n}\r\n\r\n\r\n.forna-container line.link {\r\n  stroke: #999;\r\n  stroke-opacity: 0.8;\r\n  stroke-width: 2;\r\n}\r\n\r\n.forna-container line.pseudoknot {\r\n    stroke: red;\r\n}\r\n\r\n.forna-container line.basepair {\r\n  stroke: red;\r\n}\r\n\r\n.forna-container line.intermolecule {\r\n  stroke: blue;\r\n}\r\n\r\n.forna-container line.chain_chain {\r\n  stroke-dasharray: 3,3;\r\n}\r\n\r\n.forna-container line.fake {\r\n  stroke: green;\r\n}\r\n\r\n.forna-container .transparent {\r\n    fill: transparent;\r\n    stroke-width: 0;\r\n    stroke-opacity: 0;\r\n    opacity: 0;\r\n    visibility: hidden;\r\n}\r\n\r\n.forna-container .drag_line {\r\n  stroke: #999;\r\n  stroke-width: 2;\r\n  pointer-events: none;\r\n}\r\n\r\n.forna-container .drag_line_hidden {\r\n  stroke: #999;\r\n  stroke-width: 0;\r\n  pointer-events: none;\r\n}\r\n\r\n.forna-container .d3-tip {\r\n    line-height: 1;\r\n    font-weight: bold;\r\n    padding: 6px;\r\n    background: rgba(0, 0, 0, 0.6);\r\n    color: #fff;\r\n    border-radius: 4px;\r\n    pointer-events: none;\r\n          }\r\n\r\n.forna-container text.node-label {\r\n    font-weight: bold;\r\n    font-family: Tahoma, Geneva, sans-serif;\r\n    color: rgb(100,100,100);\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container text {\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container g.gnode {\r\n\r\n}\r\n\r\n.forna-container circle.outline_node.selected {\r\n    visibility: visible;\r\n}\r\n\r\n.forna-container circle.outline_node {\r\n    visibility: hidden;\r\n}\r\n\r\n.forna-container .brush .extent {\r\n  fill-opacity: .1;\r\n  stroke: #fff;\r\n  shape-rendering: crispEdges;\r\n}\r\n\r\n.forna-container .noselect {\r\n    -webkit-touch-callout: none;\r\n    -webkit-user-select: none;\r\n    -khtml-user-select: none;\r\n    -moz-user-select: none;\r\n    -ms-user-select: none;\r\n    user-select: none;\r\n}\r\n",""])},function(t,n,e){var r,o;!function(){var a={version:"3.5.17"},i=[].slice,u=function(t){return i.call(t)},s=this.document;function l(t){return t&&(t.ownerDocument||t.document||t).documentElement}function c(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(s)try{u(s.documentElement.childNodes)[0].nodeType}catch(t){u=function(t){for(var n=t.length,e=new Array(n);n--;)e[n]=t[n];return e}}if(Date.now||(Date.now=function(){return+new Date}),s)try{s.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var f=this.Element.prototype,h=f.setAttribute,p=f.setAttributeNS,d=this.CSSStyleDeclaration.prototype,m=d.setProperty;f.setAttribute=function(t,n){h.call(this,t,n+"")},f.setAttributeNS=function(t,n,e){p.call(this,t,n,e+"")},d.setProperty=function(t,n,e){m.call(this,t,n+"",e)}}function g(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function v(t){return null===t?NaN:+t}function y(t){return!isNaN(t)}function b(t){return{left:function(n,e,r,o){for(arguments.length<3&&(r=0),arguments.length<4&&(o=n.length);r<o;){var a=r+o>>>1;t(n[a],e)<0?r=a+1:o=a}return r},right:function(n,e,r,o){for(arguments.length<3&&(r=0),arguments.length<4&&(o=n.length);r<o;){var a=r+o>>>1;t(n[a],e)>0?o=a:r=a+1}return r}}}a.ascending=g,a.descending=function(t,n){return n<t?-1:n>t?1:n>=t?0:NaN},a.min=function(t,n){var e,r,o=-1,a=t.length;if(1===arguments.length){for(;++o<a;)if(null!=(r=t[o])&&r>=r){e=r;break}for(;++o<a;)null!=(r=t[o])&&e>r&&(e=r)}else{for(;++o<a;)if(null!=(r=n.call(t,t[o],o))&&r>=r){e=r;break}for(;++o<a;)null!=(r=n.call(t,t[o],o))&&e>r&&(e=r)}return e},a.max=function(t,n){var e,r,o=-1,a=t.length;if(1===arguments.length){for(;++o<a;)if(null!=(r=t[o])&&r>=r){e=r;break}for(;++o<a;)null!=(r=t[o])&&r>e&&(e=r)}else{for(;++o<a;)if(null!=(r=n.call(t,t[o],o))&&r>=r){e=r;break}for(;++o<a;)null!=(r=n.call(t,t[o],o))&&r>e&&(e=r)}return e},a.extent=function(t,n){var e,r,o,a=-1,i=t.length;if(1===arguments.length){for(;++a<i;)if(null!=(r=t[a])&&r>=r){e=o=r;break}for(;++a<i;)null!=(r=t[a])&&(e>r&&(e=r),o<r&&(o=r))}else{for(;++a<i;)if(null!=(r=n.call(t,t[a],a))&&r>=r){e=o=r;break}for(;++a<i;)null!=(r=n.call(t,t[a],a))&&(e>r&&(e=r),o<r&&(o=r))}return[e,o]},a.sum=function(t,n){var e,r=0,o=t.length,a=-1;if(1===arguments.length)for(;++a<o;)y(e=+t[a])&&(r+=e);else for(;++a<o;)y(e=+n.call(t,t[a],a))&&(r+=e);return r},a.mean=function(t,n){var e,r=0,o=t.length,a=-1,i=o;if(1===arguments.length)for(;++a<o;)y(e=v(t[a]))?r+=e:--i;else for(;++a<o;)y(e=v(n.call(t,t[a],a)))?r+=e:--i;if(i)return r/i},a.quantile=function(t,n){var e=(t.length-1)*n+1,r=Math.floor(e),o=+t[r-1],a=e-r;return a?o+a*(t[r]-o):o},a.median=function(t,n){var e,r=[],o=t.length,i=-1;if(1===arguments.length)for(;++i<o;)y(e=v(t[i]))&&r.push(e);else for(;++i<o;)y(e=v(n.call(t,t[i],i)))&&r.push(e);if(r.length)return a.quantile(r.sort(g),.5)},a.variance=function(t,n){var e,r,o=t.length,a=0,i=0,u=-1,s=0;if(1===arguments.length)for(;++u<o;)y(e=v(t[u]))&&(i+=(r=e-a)*(e-(a+=r/++s)));else for(;++u<o;)y(e=v(n.call(t,t[u],u)))&&(i+=(r=e-a)*(e-(a+=r/++s)));if(s>1)return i/(s-1)},a.deviation=function(){var t=a.variance.apply(this,arguments);return t?Math.sqrt(t):t};var x=b(g);function M(t){return t.length}a.bisectLeft=x.left,a.bisect=a.bisectRight=x.right,a.bisector=function(t){return b(1===t.length?function(n,e){return g(t(n),e)}:t)},a.shuffle=function(t,n,e){(a=arguments.length)<3&&(e=t.length,a<2&&(n=0));for(var r,o,a=e-n;a;)o=Math.random()*a--|0,r=t[a+n],t[a+n]=t[o+n],t[o+n]=r;return t},a.permute=function(t,n){for(var e=n.length,r=new Array(e);e--;)r[e]=t[n[e]];return r},a.pairs=function(t){for(var n=0,e=t.length-1,r=t[0],o=new Array(e<0?0:e);n<e;)o[n]=[r,r=t[++n]];return o},a.transpose=function(t){if(!(o=t.length))return[];for(var n=-1,e=a.min(t,M),r=new Array(e);++n<e;)for(var o,i=-1,u=r[n]=new Array(o);++i<o;)u[i]=t[i][n];return r},a.zip=function(){return a.transpose(arguments)},a.keys=function(t){var n=[];for(var e in t)n.push(e);return n},a.values=function(t){var n=[];for(var e in t)n.push(t[e]);return n},a.entries=function(t){var n=[];for(var e in t)n.push({key:e,value:t[e]});return n},a.merge=function(t){for(var n,e,r,o=t.length,a=-1,i=0;++a<o;)i+=t[a].length;for(e=new Array(i);--o>=0;)for(n=(r=t[o]).length;--n>=0;)e[--i]=r[n];return e};var w=Math.abs;function _(t){for(var n=1;t*n%1;)n*=10;return n}function k(t,n){for(var e in n)Object.defineProperty(t.prototype,e,{value:n[e],enumerable:!1})}function S(){this._=Object.create(null)}function A(t){return"__proto__"==(t+="")||"\0"===t[0]?"\0"+t:t}function E(t){return"\0"===(t+="")[0]?t.slice(1):t}function T(t){return A(t)in this._}function R(t){return(t=A(t))in this._&&delete this._[t]}function N(){var t=[];for(var n in this._)t.push(E(n));return t}function P(){var t=0;for(var n in this._)++t;return t}function C(){for(var t in this._)return!1;return!0}function O(){this._=Object.create(null)}function L(t){return t}function U(t,n,e){return function(){var r=e.apply(n,arguments);return r===n?t:r}}function D(t,n){if(n in t)return n;n=n.charAt(0).toUpperCase()+n.slice(1);for(var e=0,r=z.length;e<r;++e){var o=z[e]+n;if(o in t)return o}}a.range=function(t,n,e){if(arguments.length<3&&(e=1,arguments.length<2&&(n=t,t=0)),(n-t)/e==1/0)throw new Error("infinite range");var r,o=[],a=_(w(e)),i=-1;if(t*=a,n*=a,(e*=a)<0)for(;(r=t+e*++i)>n;)o.push(r/a);else for(;(r=t+e*++i)<n;)o.push(r/a);return o},a.map=function(t,n){var e=new S;if(t instanceof S)t.forEach((function(t,n){e.set(t,n)}));else if(Array.isArray(t)){var r,o=-1,a=t.length;if(1===arguments.length)for(;++o<a;)e.set(o,t[o]);else for(;++o<a;)e.set(n.call(t,r=t[o],o),r)}else for(var i in t)e.set(i,t[i]);return e},k(S,{has:T,get:function(t){return this._[A(t)]},set:function(t,n){return this._[A(t)]=n},remove:R,keys:N,values:function(){var t=[];for(var n in this._)t.push(this._[n]);return t},entries:function(){var t=[];for(var n in this._)t.push({key:E(n),value:this._[n]});return t},size:P,empty:C,forEach:function(t){for(var n in this._)t.call(this,E(n),this._[n])}}),a.nest=function(){var t,n,e={},r=[],o=[];function i(o,a,u){if(u>=r.length)return n?n.call(e,a):t?a.sort(t):a;for(var s,l,c,f,h=-1,p=a.length,d=r[u++],m=new S;++h<p;)(f=m.get(s=d(l=a[h])))?f.push(l):m.set(s,[l]);return o?(l=o(),c=function(t,n){l.set(t,i(o,n,u))}):(l={},c=function(t,n){l[t]=i(o,n,u)}),m.forEach(c),l}return e.map=function(t,n){return i(n,t,0)},e.entries=function(t){return function t(n,e){if(e>=r.length)return n;var a=[],i=o[e++];return n.forEach((function(n,r){a.push({key:n,values:t(r,e)})})),i?a.sort((function(t,n){return i(t.key,n.key)})):a}(i(a.map,t,0),0)},e.key=function(t){return r.push(t),e},e.sortKeys=function(t){return o[r.length-1]=t,e},e.sortValues=function(n){return t=n,e},e.rollup=function(t){return n=t,e},e},a.set=function(t){var n=new O;if(t)for(var e=0,r=t.length;e<r;++e)n.add(t[e]);return n},k(O,{has:T,add:function(t){return this._[A(t+="")]=!0,t},remove:R,values:N,size:P,empty:C,forEach:function(t){for(var n in this._)t.call(this,E(n))}}),a.behavior={},a.rebind=function(t,n){for(var e,r=1,o=arguments.length;++r<o;)t[e=arguments[r]]=U(t,n,n[e]);return t};var z=["webkit","ms","moz","Moz","o","O"];function q(){}function j(){}function F(t){var n=[],e=new S;function r(){for(var e,r=n,o=-1,a=r.length;++o<a;)(e=r[o].on)&&e.apply(this,arguments);return t}return r.on=function(r,o){var a,i=e.get(r);return arguments.length<2?i&&i.on:(i&&(i.on=null,n=n.slice(0,a=n.indexOf(i)).concat(n.slice(a+1)),e.remove(r)),o&&n.push(e.set(r,{on:o})),t)},r}function B(){a.event.preventDefault()}function I(){for(var t,n=a.event;t=n.sourceEvent;)n=t;return n}function X(t){for(var n=new j,e=0,r=arguments.length;++e<r;)n[arguments[e]]=F(n);return n.of=function(e,r){return function(o){try{var i=o.sourceEvent=a.event;o.target=t,a.event=o,n[o.type].apply(e,r)}finally{a.event=i}}},n}a.dispatch=function(){for(var t=new j,n=-1,e=arguments.length;++n<e;)t[arguments[n]]=F(t);return t},j.prototype.on=function(t,n){var e=t.indexOf("."),r="";if(e>=0&&(r=t.slice(e+1),t=t.slice(0,e)),t)return arguments.length<2?this[t].on(r):this[t].on(r,n);if(2===arguments.length){if(null==n)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}},a.event=null,a.requote=function(t){return t.replace(Y,"\\$&")};var Y=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,V={}.__proto__?function(t,n){t.__proto__=n}:function(t,n){for(var e in n)t[e]=n[e]};function H(t){return V(t,J),t}var G=function(t,n){return n.querySelector(t)},W=function(t,n){return n.querySelectorAll(t)},Z=function(t,n){var e=t.matches||t[D(t,"matchesSelector")];return(Z=function(t,n){return e.call(t,n)})(t,n)};"function"==typeof Sizzle&&(G=function(t,n){return Sizzle(t,n)[0]||null},W=Sizzle,Z=Sizzle.matchesSelector),a.selection=function(){return a.select(s.documentElement)};var J=a.selection.prototype=[];function $(t){return"function"==typeof t?t:function(){return G(t,this)}}function K(t){return"function"==typeof t?t:function(){return W(t,this)}}J.select=function(t){var n,e,r,o,a=[];t=$(t);for(var i=-1,u=this.length;++i<u;){a.push(n=[]),n.parentNode=(r=this[i]).parentNode;for(var s=-1,l=r.length;++s<l;)(o=r[s])?(n.push(e=t.call(o,o.__data__,s,i)),e&&"__data__"in o&&(e.__data__=o.__data__)):n.push(null)}return H(a)},J.selectAll=function(t){var n,e,r=[];t=K(t);for(var o=-1,a=this.length;++o<a;)for(var i=this[o],s=-1,l=i.length;++s<l;)(e=i[s])&&(r.push(n=u(t.call(e,e.__data__,s,o))),n.parentNode=e);return H(r)};var Q="http://www.w3.org/1999/xhtml",tt={svg:"http://www.w3.org/2000/svg",xhtml:Q,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function nt(t,n){return t=a.ns.qualify(t),null==n?t.local?function(){this.removeAttributeNS(t.space,t.local)}:function(){this.removeAttribute(t)}:"function"==typeof n?t.local?function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}:function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}:t.local?function(){this.setAttributeNS(t.space,t.local,n)}:function(){this.setAttribute(t,n)}}function et(t){return t.trim().replace(/\s+/g," ")}function rt(t){return new RegExp("(?:^|\\s+)"+a.requote(t)+"(?:\\s+|$)","g")}function ot(t){return(t+"").trim().split(/^|\s+/)}function at(t,n){var e=(t=ot(t).map(it)).length;return"function"==typeof n?function(){for(var r=-1,o=n.apply(this,arguments);++r<e;)t[r](this,o)}:function(){for(var r=-1;++r<e;)t[r](this,n)}}function it(t){var n=rt(t);return function(e,r){if(o=e.classList)return r?o.add(t):o.remove(t);var o=e.getAttribute("class")||"";r?(n.lastIndex=0,n.test(o)||e.setAttribute("class",et(o+" "+t))):e.setAttribute("class",et(o.replace(n," ")))}}function ut(t,n,e){return null==n?function(){this.style.removeProperty(t)}:"function"==typeof n?function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}:function(){this.style.setProperty(t,n,e)}}function st(t,n){return null==n?function(){delete this[t]}:"function"==typeof n?function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}:function(){this[t]=n}}function lt(t){return"function"==typeof t?t:(t=a.ns.qualify(t)).local?function(){return this.ownerDocument.createElementNS(t.space,t.local)}:function(){var n=this.ownerDocument,e=this.namespaceURI;return e===Q&&n.documentElement.namespaceURI===Q?n.createElement(t):n.createElementNS(e,t)}}function ct(){var t=this.parentNode;t&&t.removeChild(this)}function ft(t){return{__data__:t}}function ht(t){return function(){return Z(this,t)}}function pt(t){return arguments.length||(t=g),function(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}}function dt(t,n){for(var e=0,r=t.length;e<r;e++)for(var o,a=t[e],i=0,u=a.length;i<u;i++)(o=a[i])&&n(o,i,e);return t}function mt(t){return V(t,gt),t}a.ns={prefix:tt,qualify:function(t){var n=t.indexOf(":"),e=t;return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),tt.hasOwnProperty(e)?{space:tt[e],local:t}:t}},J.attr=function(t,n){if(arguments.length<2){if("string"==typeof t){var e=this.node();return(t=a.ns.qualify(t)).local?e.getAttributeNS(t.space,t.local):e.getAttribute(t)}for(n in t)this.each(nt(n,t[n]));return this}return this.each(nt(t,n))},J.classed=function(t,n){if(arguments.length<2){if("string"==typeof t){var e=this.node(),r=(t=ot(t)).length,o=-1;if(n=e.classList){for(;++o<r;)if(!n.contains(t[o]))return!1}else for(n=e.getAttribute("class");++o<r;)if(!rt(t[o]).test(n))return!1;return!0}for(n in t)this.each(at(n,t[n]));return this}return this.each(at(t,n))},J.style=function(t,n,e){var r=arguments.length;if(r<3){if("string"!=typeof t){for(e in r<2&&(n=""),t)this.each(ut(e,t[e],n));return this}if(r<2){var o=this.node();return c(o).getComputedStyle(o,null).getPropertyValue(t)}e=""}return this.each(ut(t,n,e))},J.property=function(t,n){if(arguments.length<2){if("string"==typeof t)return this.node()[t];for(n in t)this.each(st(n,t[n]));return this}return this.each(st(t,n))},J.text=function(t){return arguments.length?this.each("function"==typeof t?function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}:null==t?function(){this.textContent=""}:function(){this.textContent=t}):this.node().textContent},J.html=function(t){return arguments.length?this.each("function"==typeof t?function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}:null==t?function(){this.innerHTML=""}:function(){this.innerHTML=t}):this.node().innerHTML},J.append=function(t){return t=lt(t),this.select((function(){return this.appendChild(t.apply(this,arguments))}))},J.insert=function(t,n){return t=lt(t),n=$(n),this.select((function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)}))},J.remove=function(){return this.each(ct)},J.data=function(t,n){var e,r,o=-1,a=this.length;if(!arguments.length){for(t=new Array(a=(e=this[0]).length);++o<a;)(r=e[o])&&(t[o]=r.__data__);return t}function i(t,e){var r,o,a,i=t.length,c=e.length,f=Math.min(i,c),h=new Array(c),p=new Array(c),d=new Array(i);if(n){var m,g=new S,v=new Array(i);for(r=-1;++r<i;)(o=t[r])&&(g.has(m=n.call(o,o.__data__,r))?d[r]=o:g.set(m,o),v[r]=m);for(r=-1;++r<c;)(o=g.get(m=n.call(e,a=e[r],r)))?!0!==o&&(h[r]=o,o.__data__=a):p[r]=ft(a),g.set(m,!0);for(r=-1;++r<i;)r in v&&!0!==g.get(v[r])&&(d[r]=t[r])}else{for(r=-1;++r<f;)o=t[r],a=e[r],o?(o.__data__=a,h[r]=o):p[r]=ft(a);for(;r<c;++r)p[r]=ft(e[r]);for(;r<i;++r)d[r]=t[r]}p.update=h,p.parentNode=h.parentNode=d.parentNode=t.parentNode,u.push(p),s.push(h),l.push(d)}var u=mt([]),s=H([]),l=H([]);if("function"==typeof t)for(;++o<a;)i(e=this[o],t.call(e,e.parentNode.__data__,o));else for(;++o<a;)i(e=this[o],t);return s.enter=function(){return u},s.exit=function(){return l},s},J.datum=function(t){return arguments.length?this.property("__data__",t):this.property("__data__")},J.filter=function(t){var n,e,r,o=[];"function"!=typeof t&&(t=ht(t));for(var a=0,i=this.length;a<i;a++){o.push(n=[]),n.parentNode=(e=this[a]).parentNode;for(var u=0,s=e.length;u<s;u++)(r=e[u])&&t.call(r,r.__data__,u,a)&&n.push(r)}return H(o)},J.order=function(){for(var t=-1,n=this.length;++t<n;)for(var e,r=this[t],o=r.length-1,a=r[o];--o>=0;)(e=r[o])&&(a&&a!==e.nextSibling&&a.parentNode.insertBefore(e,a),a=e);return this},J.sort=function(t){t=pt.apply(this,arguments);for(var n=-1,e=this.length;++n<e;)this[n].sort(t);return this.order()},J.each=function(t){return dt(this,(function(n,e,r){t.call(n,n.__data__,e,r)}))},J.call=function(t){var n=u(arguments);return t.apply(n[0]=this,n),this},J.empty=function(){return!this.node()},J.node=function(){for(var t=0,n=this.length;t<n;t++)for(var e=this[t],r=0,o=e.length;r<o;r++){var a=e[r];if(a)return a}return null},J.size=function(){var t=0;return dt(this,(function(){++t})),t};var gt=[];function vt(t){var n,e;return function(r,o,a){var i,u=t[a].update,s=u.length;for(a!=e&&(e=a,n=0),o>=n&&(n=o+1);!(i=u[n])&&++n<s;);return i}}function yt(t,n,e){var r="__on"+t,o=t.indexOf("."),i=xt;o>0&&(t=t.slice(0,o));var s=bt.get(t);function l(){var n=this[r];n&&(this.removeEventListener(t,n,n.$),delete this[r])}return s&&(t=s,i=Mt),o?n?function(){var o=i(n,u(arguments));l.call(this),this.addEventListener(t,this[r]=o,o.$=e),o._=n}:l:n?q:function(){var n,e=new RegExp("^__on([^.]+)"+a.requote(t)+"$");for(var r in this)if(n=r.match(e)){var o=this[r];this.removeEventListener(n[1],o,o.$),delete this[r]}}}a.selection.enter=mt,a.selection.enter.prototype=gt,gt.append=J.append,gt.empty=J.empty,gt.node=J.node,gt.call=J.call,gt.size=J.size,gt.select=function(t){for(var n,e,r,o,a,i=[],u=-1,s=this.length;++u<s;){r=(o=this[u]).update,i.push(n=[]),n.parentNode=o.parentNode;for(var l=-1,c=o.length;++l<c;)(a=o[l])?(n.push(r[l]=e=t.call(o.parentNode,a.__data__,l,u)),e.__data__=a.__data__):n.push(null)}return H(i)},gt.insert=function(t,n){return arguments.length<2&&(n=vt(this)),J.insert.call(this,t,n)},a.select=function(t){var n;return"string"==typeof t?(n=[G(t,s)]).parentNode=s.documentElement:(n=[t]).parentNode=l(t),H([n])},a.selectAll=function(t){var n;return"string"==typeof t?(n=u(W(t,s))).parentNode=s.documentElement:(n=u(t)).parentNode=null,H([n])},J.on=function(t,n,e){var r=arguments.length;if(r<3){if("string"!=typeof t){for(e in r<2&&(n=!1),t)this.each(yt(e,t[e],n));return this}if(r<2)return(r=this.node()["__on"+t])&&r._;e=!1}return this.each(yt(t,n,e))};var bt=a.map({mouseenter:"mouseover",mouseleave:"mouseout"});function xt(t,n){return function(e){var r=a.event;a.event=e,n[0]=this.__data__;try{t.apply(this,n)}finally{a.event=r}}}function Mt(t,n){var e=xt(t,n);return function(t){var n=t.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||e.call(this,t)}}s&&bt.forEach((function(t){"on"+t in s&&bt.remove(t)}));var wt,_t=0;function kt(t){var n=".dragsuppress-"+ ++_t,e="click"+n,r=a.select(c(t)).on("touchmove"+n,B).on("dragstart"+n,B).on("selectstart"+n,B);if(null==wt&&(wt=!("onselectstart"in t)&&D(t.style,"userSelect")),wt){var o=l(t).style,i=o[wt];o[wt]="none"}return function(t){if(r.on(n,null),wt&&(o[wt]=i),t){var a=function(){r.on(e,null)};r.on(e,(function(){B(),a()}),!0),setTimeout(a,0)}}}a.mouse=function(t){return At(t,I())};var St=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;function At(t,n){n.changedTouches&&(n=n.changedTouches[0]);var e=t.ownerSVGElement||t;if(e.createSVGPoint){var r=e.createSVGPoint();if(St<0){var o=c(t);if(o.scrollX||o.scrollY){var i=(e=a.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important"))[0][0].getScreenCTM();St=!(i.f||i.e),e.remove()}}return St?(r.x=n.pageX,r.y=n.pageY):(r.x=n.clientX,r.y=n.clientY),[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}var u=t.getBoundingClientRect();return[n.clientX-u.left-t.clientLeft,n.clientY-u.top-t.clientTop]}function Et(){return a.event.changedTouches[0].identifier}a.touch=function(t,n,e){if(arguments.length<3&&(e=n,n=I().changedTouches),n)for(var r,o=0,a=n.length;o<a;++o)if((r=n[o]).identifier===e)return At(t,r)},a.behavior.drag=function(){var t=X(o,"drag","dragstart","dragend"),n=null,e=i(q,a.mouse,c,"mousemove","mouseup"),r=i(Et,a.touch,L,"touchmove","touchend");function o(){this.on("mousedown.drag",e).on("touchstart.drag",r)}function i(e,r,o,i,u){return function(){var s,l=this,c=a.event.target.correspondingElement||a.event.target,f=l.parentNode,h=t.of(l,arguments),p=0,d=e(),m=".drag"+(null==d?"":"-"+d),g=a.select(o(c)).on(i+m,b).on(u+m,x),v=kt(c),y=r(f,d);function b(){var t,n,e=r(f,d);e&&(t=e[0]-y[0],n=e[1]-y[1],p|=t|n,y=e,h({type:"drag",x:e[0]+s[0],y:e[1]+s[1],dx:t,dy:n}))}function x(){r(f,d)&&(g.on(i+m,null).on(u+m,null),v(p),h({type:"dragend"}))}s=n?[(s=n.apply(l,arguments)).x-y[0],s.y-y[1]]:[0,0],h({type:"dragstart"})}}return o.origin=function(t){return arguments.length?(n=t,o):n},a.rebind(o,t,"on")},a.touches=function(t,n){return arguments.length<2&&(n=I().touches),n?u(n).map((function(n){var e=At(t,n);return e.identifier=n.identifier,e})):[]};var Tt=1e-6,Rt=Tt*Tt,Nt=Math.PI,Pt=2*Nt,Ct=Pt-Tt,Ot=Nt/2,Lt=Nt/180,Ut=180/Nt;function Dt(t){return t>0?1:t<0?-1:0}function zt(t,n,e){return(n[0]-t[0])*(e[1]-t[1])-(n[1]-t[1])*(e[0]-t[0])}function qt(t){return t>1?0:t<-1?Nt:Math.acos(t)}function jt(t){return t>1?Ot:t<-1?-Ot:Math.asin(t)}function Ft(t){return((t=Math.exp(t))+1/t)/2}function Bt(t){return(t=Math.sin(t/2))*t}var It=Math.SQRT2;a.interpolateZoom=function(t,n){var e,r,o=t[0],a=t[1],i=t[2],u=n[0],s=n[1],l=n[2],c=u-o,f=s-a,h=c*c+f*f;if(h<Rt)r=Math.log(l/i)/It,e=function(t){return[o+t*c,a+t*f,i*Math.exp(It*t*r)]};else{var p=Math.sqrt(h),d=(l*l-i*i+4*h)/(2*i*2*p),m=(l*l-i*i-4*h)/(2*l*2*p),g=Math.log(Math.sqrt(d*d+1)-d),v=Math.log(Math.sqrt(m*m+1)-m);r=(v-g)/It,e=function(t){var n,e=t*r,u=Ft(g),s=i/(2*p)*(u*(n=It*e+g,((n=Math.exp(2*n))-1)/(n+1))-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[o+s*c,a+s*f,i*u/Ft(It*e+g)]}}return e.duration=1e3*r,e},a.behavior.zoom=function(){var t,n,e,r,o,i,u,l,f,h={x:0,y:0,k:1},p=[960,500],d=Vt,m=250,g=0,v="mousedown.zoom",y="mousemove.zoom",b="mouseup.zoom",x="touchstart.zoom",M=X(w,"zoomstart","zoom","zoomend");function w(t){t.on(v,P).on(Yt+".zoom",O).on("dblclick.zoom",L).on(x,C)}function _(t){return[(t[0]-h.x)/h.k,(t[1]-h.y)/h.k]}function k(t){h.k=Math.max(d[0],Math.min(d[1],t))}function S(t,n){n=function(t){return[t[0]*h.k+h.x,t[1]*h.k+h.y]}(n),h.x+=t[0]-n[0],h.y+=t[1]-n[1]}function A(t,e,r,o){t.__chart__={x:h.x,y:h.y,k:h.k},k(Math.pow(2,o)),S(n=e,r),t=a.select(t),m>0&&(t=t.transition().duration(m)),t.call(w.event)}function E(){u&&u.domain(i.range().map((function(t){return(t-h.x)/h.k})).map(i.invert)),f&&f.domain(l.range().map((function(t){return(t-h.y)/h.k})).map(l.invert))}function T(t){g++||t({type:"zoomstart"})}function R(t){E(),t({type:"zoom",scale:h.k,translate:[h.x,h.y]})}function N(t){--g||(t({type:"zoomend"}),n=null)}function P(){var t=this,n=M.of(t,arguments),e=0,r=a.select(c(t)).on(y,u).on(b,s),o=_(a.mouse(t)),i=kt(t);function u(){e=1,S(a.mouse(t),o),R(n)}function s(){r.on(y,null).on(b,null),i(e),N(n)}Mu.call(t),T(n)}function C(){var t,n=this,e=M.of(n,arguments),r={},i=0,u=".zoom-"+a.event.changedTouches[0].identifier,s="touchmove"+u,l="touchend"+u,c=[],f=a.select(n),p=kt(n);function d(){var e=a.touches(n);return t=h.k,e.forEach((function(t){t.identifier in r&&(r[t.identifier]=_(t))})),e}function m(){var t=a.event.target;a.select(t).on(s,g).on(l,y),c.push(t);for(var e=a.event.changedTouches,u=0,f=e.length;u<f;++u)r[e[u].identifier]=null;var p=d(),m=Date.now();if(1===p.length){if(m-o<500){var v=p[0];A(n,v,r[v.identifier],Math.floor(Math.log(h.k)/Math.LN2)+1),B()}o=m}else if(p.length>1){v=p[0];var b=p[1],x=v[0]-b[0],M=v[1]-b[1];i=x*x+M*M}}function g(){var u,s,l,c,f=a.touches(n);Mu.call(n);for(var h=0,p=f.length;h<p;++h,c=null)if(l=f[h],c=r[l.identifier]){if(s)break;u=l,s=c}if(c){var d=(d=l[0]-u[0])*d+(d=l[1]-u[1])*d,m=i&&Math.sqrt(d/i);u=[(u[0]+l[0])/2,(u[1]+l[1])/2],s=[(s[0]+c[0])/2,(s[1]+c[1])/2],k(m*t)}o=null,S(u,s),R(e)}function y(){if(a.event.touches.length){for(var t=a.event.changedTouches,n=0,o=t.length;n<o;++n)delete r[t[n].identifier];for(var i in r)return void d()}a.selectAll(c).on(u,null),f.on(v,P).on(x,C),p(),N(e)}m(),T(e),f.on(v,null).on(x,m)}function O(){var o=M.of(this,arguments);r?clearTimeout(r):(Mu.call(this),t=_(n=e||a.mouse(this)),T(o)),r=setTimeout((function(){r=null,N(o)}),50),B(),k(Math.pow(2,.002*Xt())*h.k),S(n,t),R(o)}function L(){var t=a.mouse(this),n=Math.log(h.k)/Math.LN2;A(this,t,_(t),a.event.shiftKey?Math.ceil(n)-1:Math.floor(n)+1)}return Yt||(Yt="onwheel"in s?(Xt=function(){return-a.event.deltaY*(a.event.deltaMode?120:1)},"wheel"):"onmousewheel"in s?(Xt=function(){return a.event.wheelDelta},"mousewheel"):(Xt=function(){return-a.event.detail},"MozMousePixelScroll")),w.event=function(t){t.each((function(){var t=M.of(this,arguments),e=h;ku?a.select(this).transition().each("start.zoom",(function(){h=this.__chart__||{x:0,y:0,k:1},T(t)})).tween("zoom:zoom",(function(){var r=p[0],o=p[1],i=n?n[0]:r/2,u=n?n[1]:o/2,s=a.interpolateZoom([(i-h.x)/h.k,(u-h.y)/h.k,r/h.k],[(i-e.x)/e.k,(u-e.y)/e.k,r/e.k]);return function(n){var e=s(n),o=r/e[2];this.__chart__=h={x:i-e[0]*o,y:u-e[1]*o,k:o},R(t)}})).each("interrupt.zoom",(function(){N(t)})).each("end.zoom",(function(){N(t)})):(this.__chart__=h,T(t),R(t),N(t))}))},w.translate=function(t){return arguments.length?(h={x:+t[0],y:+t[1],k:h.k},E(),w):[h.x,h.y]},w.scale=function(t){return arguments.length?(h={x:h.x,y:h.y,k:null},k(+t),E(),w):h.k},w.scaleExtent=function(t){return arguments.length?(d=null==t?Vt:[+t[0],+t[1]],w):d},w.center=function(t){return arguments.length?(e=t&&[+t[0],+t[1]],w):e},w.size=function(t){return arguments.length?(p=t&&[+t[0],+t[1]],w):p},w.duration=function(t){return arguments.length?(m=+t,w):m},w.x=function(t){return arguments.length?(u=t,i=t.copy(),h={x:0,y:0,k:1},w):u},w.y=function(t){return arguments.length?(f=t,l=t.copy(),h={x:0,y:0,k:1},w):f},a.rebind(w,M,"on")};var Xt,Yt,Vt=[0,1/0];function Ht(){}function Gt(t,n,e){return this instanceof Gt?(this.h=+t,this.s=+n,void(this.l=+e)):arguments.length<2?t instanceof Gt?new Gt(t.h,t.s,t.l):pn(""+t,dn,Gt):new Gt(t,n,e)}a.color=Ht,Ht.prototype.toString=function(){return this.rgb()+""},a.hsl=Gt;var Wt=Gt.prototype=new Ht;function Zt(t,n,e){var r,o;function a(t){return Math.round(255*function(t){return t>360?t-=360:t<0&&(t+=360),t<60?r+(o-r)*t/60:t<180?o:t<240?r+(o-r)*(240-t)/60:r}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,n=isNaN(n)?0:n<0?0:n>1?1:n,r=2*(e=e<0?0:e>1?1:e)-(o=e<=.5?e*(1+n):e+n-e*n),new sn(a(t+120),a(t),a(t-120))}function Jt(t,n,e){return this instanceof Jt?(this.h=+t,this.c=+n,void(this.l=+e)):arguments.length<2?t instanceof Jt?new Jt(t.h,t.c,t.l):rn(t instanceof Qt?t.l:(t=mn((t=a.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new Jt(t,n,e)}Wt.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new Gt(this.h,this.s,this.l/t)},Wt.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new Gt(this.h,this.s,t*this.l)},Wt.rgb=function(){return Zt(this.h,this.s,this.l)},a.hcl=Jt;var $t=Jt.prototype=new Ht;function Kt(t,n,e){return isNaN(t)&&(t=0),isNaN(n)&&(n=0),new Qt(e,Math.cos(t*=Lt)*n,Math.sin(t)*n)}function Qt(t,n,e){return this instanceof Qt?(this.l=+t,this.a=+n,void(this.b=+e)):arguments.length<2?t instanceof Qt?new Qt(t.l,t.a,t.b):t instanceof Jt?Kt(t.h,t.c,t.l):mn((t=sn(t)).r,t.g,t.b):new Qt(t,n,e)}$t.brighter=function(t){return new Jt(this.h,this.c,Math.min(100,this.l+tn*(arguments.length?t:1)))},$t.darker=function(t){return new Jt(this.h,this.c,Math.max(0,this.l-tn*(arguments.length?t:1)))},$t.rgb=function(){return Kt(this.h,this.c,this.l).rgb()},a.lab=Qt;var tn=18,nn=Qt.prototype=new Ht;function en(t,n,e){var r=(t+16)/116,o=r+n/500,a=r-e/200;return new sn(un(3.2404542*(o=.95047*on(o))-1.5371385*(r=1*on(r))-.4985314*(a=1.08883*on(a))),un(-.969266*o+1.8760108*r+.041556*a),un(.0556434*o-.2040259*r+1.0572252*a))}function rn(t,n,e){return t>0?new Jt(Math.atan2(e,n)*Ut,Math.sqrt(n*n+e*e),t):new Jt(NaN,NaN,t)}function on(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function an(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function un(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function sn(t,n,e){return this instanceof sn?(this.r=~~t,this.g=~~n,void(this.b=~~e)):arguments.length<2?t instanceof sn?new sn(t.r,t.g,t.b):pn(""+t,sn,Zt):new sn(t,n,e)}function ln(t){return new sn(t>>16,t>>8&255,255&t)}function cn(t){return ln(t)+""}nn.brighter=function(t){return new Qt(Math.min(100,this.l+tn*(arguments.length?t:1)),this.a,this.b)},nn.darker=function(t){return new Qt(Math.max(0,this.l-tn*(arguments.length?t:1)),this.a,this.b)},nn.rgb=function(){return en(this.l,this.a,this.b)},a.rgb=sn;var fn=sn.prototype=new Ht;function hn(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function pn(t,n,e){var r,o,a,i=0,u=0,s=0;if(r=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(o=r[2].split(","),r[1]){case"hsl":return e(parseFloat(o[0]),parseFloat(o[1])/100,parseFloat(o[2])/100);case"rgb":return n(vn(o[0]),vn(o[1]),vn(o[2]))}return(a=yn.get(t))?n(a.r,a.g,a.b):(null==t||"#"!==t.charAt(0)||isNaN(a=parseInt(t.slice(1),16))||(4===t.length?(i=(3840&a)>>4,i|=i>>4,u=240&a,u|=u>>4,s=15&a,s|=s<<4):7===t.length&&(i=(16711680&a)>>16,u=(65280&a)>>8,s=255&a)),n(i,u,s))}function dn(t,n,e){var r,o,a=Math.min(t/=255,n/=255,e/=255),i=Math.max(t,n,e),u=i-a,s=(i+a)/2;return u?(o=s<.5?u/(i+a):u/(2-i-a),r=t==i?(n-e)/u+(n<e?6:0):n==i?(e-t)/u+2:(t-n)/u+4,r*=60):(r=NaN,o=s>0&&s<1?0:r),new Gt(r,o,s)}function mn(t,n,e){var r=an((.4124564*(t=gn(t))+.3575761*(n=gn(n))+.1804375*(e=gn(e)))/.95047),o=an((.2126729*t+.7151522*n+.072175*e)/1);return Qt(116*o-16,500*(r-o),200*(o-an((.0193339*t+.119192*n+.9503041*e)/1.08883)))}function gn(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function vn(t){var n=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*n):n}fn.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var n=this.r,e=this.g,r=this.b,o=30;return n||e||r?(n&&n<o&&(n=o),e&&e<o&&(e=o),r&&r<o&&(r=o),new sn(Math.min(255,n/t),Math.min(255,e/t),Math.min(255,r/t))):new sn(o,o,o)},fn.darker=function(t){return new sn((t=Math.pow(.7,arguments.length?t:1))*this.r,t*this.g,t*this.b)},fn.hsl=function(){return dn(this.r,this.g,this.b)},fn.toString=function(){return"#"+hn(this.r)+hn(this.g)+hn(this.b)};var yn=a.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});function bn(t){return"function"==typeof t?t:function(){return t}}function xn(t){return function(n,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),Mn(n,e,t,r)}}function Mn(t,n,e,r){var o={},i=a.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,c=null;function f(){var t,n=l.status;if(!n&&function(t){var n=t.responseType;return n&&"text"!==n?t.response:t.responseText}(l)||n>=200&&n<300||304===n){try{t=e.call(o,l)}catch(t){return void i.error.call(o,t)}i.load.call(o,t)}else i.error.call(o,l)}return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=f:l.onreadystatechange=function(){l.readyState>3&&f()},l.onprogress=function(t){var n=a.event;a.event=t;try{i.progress.call(o,l)}finally{a.event=n}},o.header=function(t,n){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==n?delete s[t]:s[t]=n+"",o)},o.mimeType=function(t){return arguments.length?(n=null==t?null:t+"",o):n},o.responseType=function(t){return arguments.length?(c=t,o):c},o.response=function(t){return e=t,o},["get","post"].forEach((function(t){o[t]=function(){return o.send.apply(o,[t].concat(u(arguments)))}})),o.send=function(e,r,a){if(2===arguments.length&&"function"==typeof r&&(a=r,r=null),l.open(e,t,!0),null==n||"accept"in s||(s.accept=n+",*/*"),l.setRequestHeader)for(var u in s)l.setRequestHeader(u,s[u]);return null!=n&&l.overrideMimeType&&l.overrideMimeType(n),null!=c&&(l.responseType=c),null!=a&&o.on("error",a).on("load",(function(t){a(null,t)})),i.beforesend.call(o,l),l.send(null==r?null:r),o},o.abort=function(){return l.abort(),o},a.rebind(o,i,"on"),null==r?o:o.get(function(t){return 1===t.length?function(n,e){t(null==n?e:null)}:t}(r))}yn.forEach((function(t,n){yn.set(t,ln(n))})),a.functor=bn,a.xhr=xn(L),a.dsv=function(t,n){var e=new RegExp('["'+t+"\n]"),r=t.charCodeAt(0);function o(t,e,r){arguments.length<3&&(r=e,e=null);var o=Mn(t,n,null==e?a:i(e),r);return o.row=function(t){return arguments.length?o.response(null==(e=t)?a:i(t)):e},o}function a(t){return o.parse(t.responseText)}function i(t){return function(n){return o.parse(n.responseText,t)}}function u(n){return n.map(s).join(t)}function s(t){return e.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}return o.parse=function(t,n){var e;return o.parseRows(t,(function(t,r){if(e)return e(t,r-1);var o=new Function("d","return {"+t.map((function(t,n){return JSON.stringify(t)+": d["+n+"]"})).join(",")+"}");e=n?function(t,e){return n(o(t),e)}:o}))},o.parseRows=function(t,n){var e,o,a={},i={},u=[],s=t.length,l=0,c=0;function f(){if(l>=s)return i;if(o)return o=!1,a;var n=l;if(34===t.charCodeAt(n)){for(var e=n;e++<s;)if(34===t.charCodeAt(e)){if(34!==t.charCodeAt(e+1))break;++e}return l=e+2,13===(u=t.charCodeAt(e+1))?(o=!0,10===t.charCodeAt(e+2)&&++l):10===u&&(o=!0),t.slice(n+1,e).replace(/""/g,'"')}for(;l<s;){var u,c=1;if(10===(u=t.charCodeAt(l++)))o=!0;else if(13===u)o=!0,10===t.charCodeAt(l)&&(++l,++c);else if(u!==r)continue;return t.slice(n,l-c)}return t.slice(n)}for(;(e=f())!==i;){for(var h=[];e!==a&&e!==i;)h.push(e),e=f();n&&null==(h=n(h,c++))||u.push(h)}return u},o.format=function(n){if(Array.isArray(n[0]))return o.formatRows(n);var e=new O,r=[];return n.forEach((function(t){for(var n in t)e.has(n)||r.push(e.add(n))})),[r.map(s).join(t)].concat(n.map((function(n){return r.map((function(t){return s(n[t])})).join(t)}))).join("\n")},o.formatRows=function(t){return t.map(u).join("\n")},o},a.csv=a.dsv(",","text/csv"),a.tsv=a.dsv("\t","text/tab-separated-values");var wn,_n,kn,Sn,An=this[D(this,"requestAnimationFrame")]||function(t){setTimeout(t,17)};function En(t,n,e){var r=arguments.length;r<2&&(n=0),r<3&&(e=Date.now());var o=e+n,a={c:t,t:o,n:null};return _n?_n.n=a:wn=a,_n=a,kn||(Sn=clearTimeout(Sn),kn=1,An(Tn)),a}function Tn(){var t=Rn(),n=Nn()-t;n>24?(isFinite(n)&&(clearTimeout(Sn),Sn=setTimeout(Tn,n)),kn=0):(kn=1,An(Tn))}function Rn(){for(var t=Date.now(),n=wn;n;)t>=n.t&&n.c(t-n.t)&&(n.c=null),n=n.n;return t}function Nn(){for(var t,n=wn,e=1/0;n;)n.c?(n.t<e&&(e=n.t),n=(t=n).n):n=t?t.n=n.n:wn=n.n;return _n=t,e}function Pn(t,n){return n-(t?Math.ceil(Math.log(t)/Math.LN10):1)}a.timer=function(){En.apply(this,arguments)},a.timer.flush=function(){Rn(),Nn()},a.round=function(t,n){return n?Math.round(t*(n=Math.pow(10,n)))/n:Math.round(t)};var Cn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map((function(t,n){var e=Math.pow(10,3*w(8-n));return{scale:n>8?function(t){return t/e}:function(t){return t*e},symbol:t}}));function On(t){var n=t.decimal,e=t.thousands,r=t.grouping,o=t.currency,i=r&&e?function(t,n){for(var o=t.length,a=[],i=0,u=r[0],s=0;o>0&&u>0&&(s+u+1>n&&(u=Math.max(1,n-s)),a.push(t.substring(o-=u,o+u)),!((s+=u+1)>n));)u=r[i=(i+1)%r.length];return a.reverse().join(e)}:L;return function(t){var e=Ln.exec(t),r=e[1]||" ",u=e[2]||">",s=e[3]||"-",l=e[4]||"",c=e[5],f=+e[6],h=e[7],p=e[8],d=e[9],m=1,g="",v="",y=!1,b=!0;switch(p&&(p=+p.substring(1)),(c||"0"===r&&"="===u)&&(c=r="0",u="="),d){case"n":h=!0,d="g";break;case"%":m=100,v="%",d="f";break;case"p":m=100,v="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(g="0"+d.toLowerCase());case"c":b=!1;case"d":y=!0,p=0;break;case"s":m=-1,d="r"}"$"===l&&(g=o[0],v=o[1]),"r"!=d||p||(d="g"),null!=p&&("g"==d?p=Math.max(1,Math.min(21,p)):"e"!=d&&"f"!=d||(p=Math.max(0,Math.min(20,p)))),d=Un.get(d)||Dn;var x=c&&h;return function(t){var e=v;if(y&&t%1)return"";var o=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(m<0){var l=a.formatPrefix(t,p);t=l.scale(t),e=l.symbol+v}else t*=m;var M,w,_=(t=d(t,p)).lastIndexOf(".");if(_<0){var k=b?t.lastIndexOf("e"):-1;k<0?(M=t,w=""):(M=t.substring(0,k),w=t.substring(k))}else M=t.substring(0,_),w=n+t.substring(_+1);!c&&h&&(M=i(M,1/0));var S=g.length+M.length+w.length+(x?0:o.length),A=S<f?new Array(S=f-S+1).join(r):"";return x&&(M=i(A+M,A.length?f-w.length:1/0)),o+=g,t=M+w,("<"===u?o+t+A:">"===u?A+o+t:"^"===u?A.substring(0,S>>=1)+o+t+A.substring(S):o+(x?t:A+t))+e}}}a.formatPrefix=function(t,n){var e=0;return(t=+t)&&(t<0&&(t*=-1),n&&(t=a.round(t,Pn(t,n))),e=1+Math.floor(1e-12+Math.log(t)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((e-1)/3)))),Cn[8+e/3]};var Ln=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Un=a.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,n){return t.toPrecision(n)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},r:function(t,n){return(t=a.round(t,Pn(t,n))).toFixed(Math.max(0,Math.min(20,Pn(t*(1+1e-15),n))))}});function Dn(t){return t+""}var zn=a.time={},qn=Date;function jn(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}jn.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){Fn.setUTCDate.apply(this._,arguments)},setDay:function(){Fn.setUTCDay.apply(this._,arguments)},setFullYear:function(){Fn.setUTCFullYear.apply(this._,arguments)},setHours:function(){Fn.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Fn.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Fn.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Fn.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Fn.setUTCSeconds.apply(this._,arguments)},setTime:function(){Fn.setTime.apply(this._,arguments)}};var Fn=Date.prototype;function Bn(t,n,e){function r(n){var e=t(n),r=a(e,1);return n-e<r-n?e:r}function o(e){return n(e=t(new qn(e-1)),1),e}function a(t,e){return n(t=new qn(+t),e),t}function i(t,r,a){var i=o(t),u=[];if(a>1)for(;i<r;)e(i)%a||u.push(new Date(+i)),n(i,1);else for(;i<r;)u.push(new Date(+i)),n(i,1);return u}t.floor=t,t.round=r,t.ceil=o,t.offset=a,t.range=i;var u=t.utc=In(t);return u.floor=u,u.round=In(r),u.ceil=In(o),u.offset=In(a),u.range=function(t,n,e){try{qn=jn;var r=new jn;return r._=t,i(r,n,e)}finally{qn=Date}},t}function In(t){return function(n,e){try{qn=jn;var r=new jn;return r._=n,t(r,e)._}finally{qn=Date}}}function Xn(t){var n=t.dateTime,e=t.date,r=t.time,o=t.periods,i=t.days,u=t.shortDays,s=t.months,l=t.shortMonths;function c(t){var n=t.length;function e(e){for(var r,o,a,i=[],u=-1,s=0;++u<n;)37===t.charCodeAt(u)&&(i.push(t.slice(s,u)),null!=(o=Yn[r=t.charAt(++u)])&&(r=t.charAt(++u)),(a=M[r])&&(r=a(e,null==o?"e"===r?" ":"0":o)),i.push(r),s=u+1);return i.push(t.slice(s,u)),i.join("")}return e.parse=function(n){var e={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null};if(f(e,t,n,0)!=n.length)return null;"p"in e&&(e.H=e.H%12+12*e.p);var r=null!=e.Z&&qn!==jn,o=new(r?jn:qn);return"j"in e?o.setFullYear(e.y,0,e.j):"W"in e||"U"in e?("w"in e||(e.w="W"in e?1:0),o.setFullYear(e.y,0,1),o.setFullYear(e.y,0,"W"in e?(e.w+6)%7+7*e.W-(o.getDay()+5)%7:e.w+7*e.U-(o.getDay()+6)%7)):o.setFullYear(e.y,e.m,e.d),o.setHours(e.H+(e.Z/100|0),e.M+e.Z%100,e.S,e.L),r?o._:o},e.toString=function(){return t},e}function f(t,n,e,r){for(var o,a,i,u=0,s=n.length,l=e.length;u<s;){if(r>=l)return-1;if(37===(o=n.charCodeAt(u++))){if(i=n.charAt(u++),!(a=w[i in Yn?n.charAt(u++):i])||(r=a(t,e,r))<0)return-1}else if(o!=e.charCodeAt(r++))return-1}return r}c.utc=function(t){var n=c(t);function e(t){try{var e=new(qn=jn);return e._=t,n(e)}finally{qn=Date}}return e.parse=function(t){try{qn=jn;var e=n.parse(t);return e&&e._}finally{qn=Date}},e.toString=n.toString,e},c.multi=c.utc.multi=fe;var h=a.map(),p=Wn(i),d=Zn(i),m=Wn(u),g=Zn(u),v=Wn(s),y=Zn(s),b=Wn(l),x=Zn(l);o.forEach((function(t,n){h.set(t.toLowerCase(),n)}));var M={a:function(t){return u[t.getDay()]},A:function(t){return i[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:c(n),d:function(t,n){return Gn(t.getDate(),n,2)},e:function(t,n){return Gn(t.getDate(),n,2)},H:function(t,n){return Gn(t.getHours(),n,2)},I:function(t,n){return Gn(t.getHours()%12||12,n,2)},j:function(t,n){return Gn(1+zn.dayOfYear(t),n,3)},L:function(t,n){return Gn(t.getMilliseconds(),n,3)},m:function(t,n){return Gn(t.getMonth()+1,n,2)},M:function(t,n){return Gn(t.getMinutes(),n,2)},p:function(t){return o[+(t.getHours()>=12)]},S:function(t,n){return Gn(t.getSeconds(),n,2)},U:function(t,n){return Gn(zn.sundayOfYear(t),n,2)},w:function(t){return t.getDay()},W:function(t,n){return Gn(zn.mondayOfYear(t),n,2)},x:c(e),X:c(r),y:function(t,n){return Gn(t.getFullYear()%100,n,2)},Y:function(t,n){return Gn(t.getFullYear()%1e4,n,4)},Z:le,"%":function(){return"%"}},w={a:function(t,n,e){m.lastIndex=0;var r=m.exec(n.slice(e));return r?(t.w=g.get(r[0].toLowerCase()),e+r[0].length):-1},A:function(t,n,e){p.lastIndex=0;var r=p.exec(n.slice(e));return r?(t.w=d.get(r[0].toLowerCase()),e+r[0].length):-1},b:function(t,n,e){b.lastIndex=0;var r=b.exec(n.slice(e));return r?(t.m=x.get(r[0].toLowerCase()),e+r[0].length):-1},B:function(t,n,e){v.lastIndex=0;var r=v.exec(n.slice(e));return r?(t.m=y.get(r[0].toLowerCase()),e+r[0].length):-1},c:function(t,n,e){return f(t,M.c.toString(),n,e)},d:re,e:re,H:ae,I:ae,j:oe,L:se,m:ee,M:ie,p:function(t,n,e){var r=h.get(n.slice(e,e+=2).toLowerCase());return null==r?-1:(t.p=r,e)},S:ue,U:$n,w:Jn,W:Kn,x:function(t,n,e){return f(t,M.x.toString(),n,e)},X:function(t,n,e){return f(t,M.X.toString(),n,e)},y:te,Y:Qn,Z:ne,"%":ce};return c}zn.year=Bn((function(t){return(t=zn.day(t)).setMonth(0,1),t}),(function(t,n){t.setFullYear(t.getFullYear()+n)}),(function(t){return t.getFullYear()})),zn.years=zn.year.range,zn.years.utc=zn.year.utc.range,zn.day=Bn((function(t){var n=new qn(2e3,0);return n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),n}),(function(t,n){t.setDate(t.getDate()+n)}),(function(t){return t.getDate()-1})),zn.days=zn.day.range,zn.days.utc=zn.day.utc.range,zn.dayOfYear=function(t){var n=zn.year(t);return Math.floor((t-n-6e4*(t.getTimezoneOffset()-n.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(t,n){n=7-n;var e=zn[t]=Bn((function(t){return(t=zn.day(t)).setDate(t.getDate()-(t.getDay()+n)%7),t}),(function(t,n){t.setDate(t.getDate()+7*Math.floor(n))}),(function(t){var e=zn.year(t).getDay();return Math.floor((zn.dayOfYear(t)+(e+n)%7)/7)-(e!==n)}));zn[t+"s"]=e.range,zn[t+"s"].utc=e.utc.range,zn[t+"OfYear"]=function(t){var e=zn.year(t).getDay();return Math.floor((zn.dayOfYear(t)+(e+n)%7)/7)}})),zn.week=zn.sunday,zn.weeks=zn.sunday.range,zn.weeks.utc=zn.sunday.utc.range,zn.weekOfYear=zn.sundayOfYear;var Yn={"-":"",_:" ",0:"0"},Vn=/^\s*\d+/,Hn=/^%/;function Gn(t,n,e){var r=t<0?"-":"",o=(r?-t:t)+"",a=o.length;return r+(a<e?new Array(e-a+1).join(n)+o:o)}function Wn(t){return new RegExp("^(?:"+t.map(a.requote).join("|")+")","i")}function Zn(t){for(var n=new S,e=-1,r=t.length;++e<r;)n.set(t[e].toLowerCase(),e);return n}function Jn(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function $n(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e));return r?(t.U=+r[0],e+r[0].length):-1}function Kn(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e));return r?(t.W=+r[0],e+r[0].length):-1}function Qn(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function te(t,n,e){Vn.lastIndex=0;var r,o=Vn.exec(n.slice(e,e+2));return o?(t.y=(r=+o[0])+(r>68?1900:2e3),e+o[0].length):-1}function ne(t,n,e){return/^[+-]\d{4}$/.test(n=n.slice(e,e+5))?(t.Z=-n,e+5):-1}function ee(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function re(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function oe(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+3));return r?(t.j=+r[0],e+r[0].length):-1}function ae(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function ie(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function ue(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function se(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function le(t){var n=t.getTimezoneOffset(),e=n>0?"-":"+",r=w(n)/60|0,o=w(n)%60;return e+Gn(r,"0",2)+Gn(o,"0",2)}function ce(t,n,e){Hn.lastIndex=0;var r=Hn.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function fe(t){for(var n=t.length,e=-1;++e<n;)t[e][0]=this(t[e][0]);return function(n){for(var e=0,r=t[e];!r[1](n);)r=t[++e];return r[0](n)}}a.locale=function(t){return{numberFormat:On(t),timeFormat:Xn(t)}};var he=a.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function pe(){}a.format=he.numberFormat,a.geo={},pe.prototype={s:0,t:0,add:function(t){me(t,this.t,de),me(de.s,this.s,this),this.s?this.t+=de.t:this.s=de.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var de=new pe;function me(t,n,e){var r=e.s=t+n,o=r-t,a=r-o;e.t=t-a+(n-o)}function ge(t,n){t&&ye.hasOwnProperty(t.type)&&ye[t.type](t,n)}a.geo.stream=function(t,n){t&&ve.hasOwnProperty(t.type)?ve[t.type](t,n):ge(t,n)};var ve={Feature:function(t,n){ge(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,o=e.length;++r<o;)ge(e[r].geometry,n)}},ye={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,o=e.length;++r<o;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){be(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,o=e.length;++r<o;)be(e[r],n,0)},Polygon:function(t,n){xe(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,o=e.length;++r<o;)xe(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,o=e.length;++r<o;)ge(e[r],n)}};function be(t,n,e){var r,o=-1,a=t.length-e;for(n.lineStart();++o<a;)r=t[o],n.point(r[0],r[1],r[2]);n.lineEnd()}function xe(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)be(t[e],n,1);n.polygonEnd()}a.geo.area=function(t){return Me=0,a.geo.stream(t,Le),Me};var Me,we,_e,ke,Se,Ae,Ee,Te,Re,Ne,Pe,Ce,Oe=new pe,Le={sphere:function(){Me+=4*Nt},point:q,lineStart:q,lineEnd:q,polygonStart:function(){Oe.reset(),Le.lineStart=Ue},polygonEnd:function(){var t=2*Oe;Me+=t<0?4*Nt+t:t,Le.lineStart=Le.lineEnd=Le.point=q}};function Ue(){var t,n,e,r,o;function a(t,n){n=n*Lt/2+Nt/4;var a=(t*=Lt)-e,i=a>=0?1:-1,u=i*a,s=Math.cos(n),l=Math.sin(n),c=o*l,f=r*s+c*Math.cos(u),h=c*i*Math.sin(u);Oe.add(Math.atan2(h,f)),e=t,r=s,o=l}Le.point=function(i,u){Le.point=a,e=(t=i)*Lt,r=Math.cos(u=(n=u)*Lt/2+Nt/4),o=Math.sin(u)},Le.lineEnd=function(){a(t,n)}}function De(t){var n=t[0],e=t[1],r=Math.cos(e);return[r*Math.cos(n),r*Math.sin(n),Math.sin(e)]}function ze(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function qe(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function je(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function Fe(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function Be(t){var n=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}function Ie(t){return[Math.atan2(t[1],t[0]),jt(t[2])]}function Xe(t,n){return w(t[0]-n[0])<Tt&&w(t[1]-n[1])<Tt}a.geo.bounds=function(){var t,n,e,r,o,i,u,s,l,c,f,h={point:p,lineStart:m,lineEnd:g,polygonStart:function(){h.point=v,h.lineStart=y,h.lineEnd=b,l=0,Le.polygonStart()},polygonEnd:function(){Le.polygonEnd(),h.point=p,h.lineStart=m,h.lineEnd=g,Oe<0?(t=-(e=180),n=-(r=90)):l>Tt?r=90:l<-Tt&&(n=-90),f[0]=t,f[1]=e}};function p(o,a){c.push(f=[t=o,e=o]),a<n&&(n=a),a>r&&(r=a)}function d(a,i){var u=De([a*Lt,i*Lt]);if(s){var l=qe(s,u),c=qe([l[1],-l[0],0],l);Be(c),c=Ie(c);var f=a-o,h=f>0?1:-1,d=c[0]*Ut*h,m=w(f)>180;if(m^(h*o<d&&d<h*a))(g=c[1]*Ut)>r&&(r=g);else if(m^(h*o<(d=(d+360)%360-180)&&d<h*a)){var g;(g=-c[1]*Ut)<n&&(n=g)}else i<n&&(n=i),i>r&&(r=i);m?a<o?x(t,a)>x(t,e)&&(e=a):x(a,e)>x(t,e)&&(t=a):e>=t?(a<t&&(t=a),a>e&&(e=a)):a>o?x(t,a)>x(t,e)&&(e=a):x(a,e)>x(t,e)&&(t=a)}else p(a,i);s=u,o=a}function m(){h.point=d}function g(){f[0]=t,f[1]=e,h.point=p,s=null}function v(t,n){if(s){var e=t-o;l+=w(e)>180?e+(e>0?360:-360):e}else i=t,u=n;Le.point(t,n),d(t,n)}function y(){Le.lineStart()}function b(){v(i,u),Le.lineEnd(),w(l)>Tt&&(t=-(e=180)),f[0]=t,f[1]=e,s=null}function x(t,n){return(n-=t)<0?n+360:n}function M(t,n){return t[0]-n[0]}function _(t,n){return n[0]<=n[1]?n[0]<=t&&t<=n[1]:t<n[0]||n[1]<t}return function(o){if(r=e=-(t=n=1/0),c=[],a.geo.stream(o,h),l=c.length){c.sort(M);for(var i=1,u=[m=c[0]];i<l;++i)_((p=c[i])[0],m)||_(p[1],m)?(x(m[0],p[1])>x(m[0],m[1])&&(m[1]=p[1]),x(p[0],m[1])>x(m[0],m[1])&&(m[0]=p[0])):u.push(m=p);for(var s,l,p,d=-1/0,m=(i=0,u[l=u.length-1]);i<=l;m=p,++i)p=u[i],(s=x(m[1],p[0]))>d&&(d=s,t=p[0],e=m[1])}return c=f=null,t===1/0||n===1/0?[[NaN,NaN],[NaN,NaN]]:[[t,n],[e,r]]}}(),a.geo.centroid=function(t){we=_e=ke=Se=Ae=Ee=Te=Re=Ne=Pe=Ce=0,a.geo.stream(t,Ye);var n=Ne,e=Pe,r=Ce,o=n*n+e*e+r*r;return o<Rt&&(n=Ee,e=Te,r=Re,_e<Tt&&(n=ke,e=Se,r=Ae),(o=n*n+e*e+r*r)<Rt)?[NaN,NaN]:[Math.atan2(e,n)*Ut,jt(r/Math.sqrt(o))*Ut]};var Ye={sphere:q,point:Ve,lineStart:Ge,lineEnd:We,polygonStart:function(){Ye.lineStart=Ze},polygonEnd:function(){Ye.lineStart=Ge}};function Ve(t,n){t*=Lt;var e=Math.cos(n*=Lt);He(e*Math.cos(t),e*Math.sin(t),Math.sin(n))}function He(t,n,e){++we,ke+=(t-ke)/we,Se+=(n-Se)/we,Ae+=(e-Ae)/we}function Ge(){var t,n,e;function r(r,o){r*=Lt;var a=Math.cos(o*=Lt),i=a*Math.cos(r),u=a*Math.sin(r),s=Math.sin(o),l=Math.atan2(Math.sqrt((l=n*s-e*u)*l+(l=e*i-t*s)*l+(l=t*u-n*i)*l),t*i+n*u+e*s);_e+=l,Ee+=l*(t+(t=i)),Te+=l*(n+(n=u)),Re+=l*(e+(e=s)),He(t,n,e)}Ye.point=function(o,a){o*=Lt;var i=Math.cos(a*=Lt);t=i*Math.cos(o),n=i*Math.sin(o),e=Math.sin(a),Ye.point=r,He(t,n,e)}}function We(){Ye.point=Ve}function Ze(){var t,n,e,r,o;function a(t,n){t*=Lt;var a=Math.cos(n*=Lt),i=a*Math.cos(t),u=a*Math.sin(t),s=Math.sin(n),l=r*s-o*u,c=o*i-e*s,f=e*u-r*i,h=Math.sqrt(l*l+c*c+f*f),p=e*i+r*u+o*s,d=h&&-qt(p)/h,m=Math.atan2(h,p);Ne+=d*l,Pe+=d*c,Ce+=d*f,_e+=m,Ee+=m*(e+(e=i)),Te+=m*(r+(r=u)),Re+=m*(o+(o=s)),He(e,r,o)}Ye.point=function(i,u){t=i,n=u,Ye.point=a,i*=Lt;var s=Math.cos(u*=Lt);e=s*Math.cos(i),r=s*Math.sin(i),o=Math.sin(u),He(e,r,o)},Ye.lineEnd=function(){a(t,n),Ye.lineEnd=We,Ye.point=Ve}}function Je(t,n){function e(e,r){return e=t(e,r),n(e[0],e[1])}return t.invert&&n.invert&&(e.invert=function(e,r){return(e=n.invert(e,r))&&t.invert(e[0],e[1])}),e}function $e(){return!0}function Ke(t,n,e,r,o){var a=[],i=[];if(t.forEach((function(t){if(!((n=t.length-1)<=0)){var n,e=t[0],r=t[n];if(Xe(e,r)){o.lineStart();for(var u=0;u<n;++u)o.point((e=t[u])[0],e[1]);o.lineEnd()}else{var s=new tr(e,t,null,!0),l=new tr(e,null,s,!1);s.o=l,a.push(s),i.push(l),s=new tr(r,t,null,!1),l=new tr(r,null,s,!0),s.o=l,a.push(s),i.push(l)}}})),i.sort(n),Qe(a),Qe(i),a.length){for(var u=0,s=e,l=i.length;u<l;++u)i[u].e=s=!s;for(var c,f,h=a[0];;){for(var p=h,d=!0;p.v;)if((p=p.n)===h)return;c=p.z,o.lineStart();do{if(p.v=p.o.v=!0,p.e){if(d)for(u=0,l=c.length;u<l;++u)o.point((f=c[u])[0],f[1]);else r(p.x,p.n.x,1,o);p=p.n}else{if(d)for(u=(c=p.p.z).length-1;u>=0;--u)o.point((f=c[u])[0],f[1]);else r(p.x,p.p.x,-1,o);p=p.p}c=(p=p.o).z,d=!d}while(!p.v);o.lineEnd()}}}function Qe(t){if(n=t.length){for(var n,e,r=0,o=t[0];++r<n;)o.n=e=t[r],e.p=o,o=e;o.n=e=t[0],e.p=o}}function tr(t,n,e,r){this.x=t,this.z=n,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function nr(t,n,e,r){return function(o,i){var u,s=n(i),l=o.invert(r[0],r[1]),c={point:f,lineStart:p,lineEnd:d,polygonStart:function(){c.point=x,c.lineStart=M,c.lineEnd=w,u=[],m=[]},polygonEnd:function(){c.point=f,c.lineStart=p,c.lineEnd=d,u=a.merge(u);var t=function(t,n){var e=t[0],r=t[1],o=[Math.sin(e),-Math.cos(e),0],a=0,i=0;Oe.reset();for(var u=0,s=n.length;u<s;++u){var l=n[u],c=l.length;if(c)for(var f=l[0],h=f[0],p=f[1]/2+Nt/4,d=Math.sin(p),m=Math.cos(p),g=1;;){g===c&&(g=0);var v=(t=l[g])[0],y=t[1]/2+Nt/4,b=Math.sin(y),x=Math.cos(y),M=v-h,w=M>=0?1:-1,_=w*M,k=_>Nt,S=d*b;if(Oe.add(Math.atan2(S*w*Math.sin(_),m*x+S*Math.cos(_))),a+=k?M+w*Pt:M,k^h>=e^v>=e){var A=qe(De(f),De(t));Be(A);var E=qe(o,A);Be(E);var T=(k^M>=0?-1:1)*jt(E[2]);(r>T||r===T&&(A[0]||A[1]))&&(i+=k^M>=0?1:-1)}if(!g++)break;h=v,d=b,m=x,f=t}}return(a<-Tt||a<Tt&&Oe<-Tt)^1&i}(l,m);u.length?(b||(i.polygonStart(),b=!0),Ke(u,or,t,e,i)):t&&(b||(i.polygonStart(),b=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),b&&(i.polygonEnd(),b=!1),u=m=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function f(n,e){var r=o(n,e);t(n=r[0],e=r[1])&&i.point(n,e)}function h(t,n){var e=o(t,n);s.point(e[0],e[1])}function p(){c.point=h,s.lineStart()}function d(){c.point=f,s.lineEnd()}var m,g,v=rr(),y=n(v),b=!1;function x(t,n){g.push([t,n]);var e=o(t,n);y.point(e[0],e[1])}function M(){y.lineStart(),g=[]}function w(){x(g[0][0],g[0][1]),y.lineEnd();var t,n=y.clean(),e=v.buffer(),r=e.length;if(g.pop(),m.push(g),g=null,r)if(1&n){var o,a=-1;if((r=(t=e[0]).length-1)>0){for(b||(i.polygonStart(),b=!0),i.lineStart();++a<r;)i.point((o=t[a])[0],o[1]);i.lineEnd()}}else r>1&&2&n&&e.push(e.pop().concat(e.shift())),u.push(e.filter(er))}return c}}function er(t){return t.length>1}function rr(){var t,n=[];return{lineStart:function(){n.push(t=[])},point:function(n,e){t.push([n,e])},lineEnd:q,buffer:function(){var e=n;return n=[],t=null,e},rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))}}}function or(t,n){return((t=t.x)[0]<0?t[1]-Ot-Tt:Ot-t[1])-((n=n.x)[0]<0?n[1]-Ot-Tt:Ot-n[1])}var ar=nr($e,(function(t){var n,e=NaN,r=NaN,o=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(a,i){var u=a>0?Nt:-Nt,s=w(a-e);w(s-Nt)<Tt?(t.point(e,r=(r+i)/2>0?Ot:-Ot),t.point(o,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(a,r),n=0):o!==u&&s>=Nt&&(w(e-o)<Tt&&(e-=o*Tt),w(a-u)<Tt&&(a-=u*Tt),r=function(t,n,e,r){var o,a,i=Math.sin(t-e);return w(i)>Tt?Math.atan((Math.sin(n)*(a=Math.cos(r))*Math.sin(e)-Math.sin(r)*(o=Math.cos(n))*Math.sin(t))/(o*a*i)):(n+r)/2}(e,r,a,i),t.point(o,r),t.lineEnd(),t.lineStart(),t.point(u,r),n=0),t.point(e=a,r=i),o=u},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}}),(function(t,n,e,r){var o;if(null==t)o=e*Ot,r.point(-Nt,o),r.point(0,o),r.point(Nt,o),r.point(Nt,0),r.point(Nt,-o),r.point(0,-o),r.point(-Nt,-o),r.point(-Nt,0),r.point(-Nt,o);else if(w(t[0]-n[0])>Tt){var a=t[0]<n[0]?Nt:-Nt;o=e*a/2,r.point(-a,o),r.point(0,o),r.point(a,o)}else r.point(n[0],n[1])}),[-Nt,-Nt/2]);function ir(t){var n=Math.cos(t),e=n>0,r=w(n)>Tt;return nr(o,(function(t){var n,u,s,l,c;return{lineStart:function(){l=s=!1,c=1},point:function(f,h){var p,d=[f,h],m=o(f,h),g=e?m?0:i(f,h):m?i(f+(f<0?Nt:-Nt),h):0;if(!n&&(l=s=m)&&t.lineStart(),m!==s&&(p=a(n,d),(Xe(n,p)||Xe(d,p))&&(d[0]+=Tt,d[1]+=Tt,m=o(d[0],d[1]))),m!==s)c=0,m?(t.lineStart(),p=a(d,n),t.point(p[0],p[1])):(p=a(n,d),t.point(p[0],p[1]),t.lineEnd()),n=p;else if(r&&n&&e^m){var v;g&u||!(v=a(d,n,!0))||(c=0,e?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1])))}!m||n&&Xe(n,d)||t.point(d[0],d[1]),n=d,s=m,u=g},lineEnd:function(){s&&t.lineEnd(),n=null},clean:function(){return c|(l&&s)<<1}}}),Ir(t,6*Lt),e?[0,-t]:[-Nt,t-Nt]);function o(t,e){return Math.cos(t)*Math.cos(e)>n}function a(t,e,r){var o=[1,0,0],a=qe(De(t),De(e)),i=ze(a,a),u=a[0],s=i-u*u;if(!s)return!r&&t;var l=n*i/s,c=-n*u/s,f=qe(o,a),h=Fe(o,l);je(h,Fe(a,c));var p=f,d=ze(h,p),m=ze(p,p),g=d*d-m*(ze(h,h)-1);if(!(g<0)){var v=Math.sqrt(g),y=Fe(p,(-d-v)/m);if(je(y,h),y=Ie(y),!r)return y;var b,x=t[0],M=e[0],_=t[1],k=e[1];M<x&&(b=x,x=M,M=b);var S=M-x,A=w(S-Nt)<Tt;if(!A&&k<_&&(b=_,_=k,k=b),A||S<Tt?A?_+k>0^y[1]<(w(y[0]-x)<Tt?_:k):_<=y[1]&&y[1]<=k:S>Nt^(x<=y[0]&&y[0]<=M)){var E=Fe(p,(-d+v)/m);return je(E,h),[y,Ie(E)]}}}function i(n,r){var o=e?t:Nt-t,a=0;return n<-o?a|=1:n>o&&(a|=2),r<-o?a|=4:r>o&&(a|=8),a}}function ur(t,n,e,r){return function(o){var a,i=o.a,u=o.b,s=i.x,l=i.y,c=0,f=1,h=u.x-s,p=u.y-l;if(a=t-s,h||!(a>0)){if(a/=h,h<0){if(a<c)return;a<f&&(f=a)}else if(h>0){if(a>f)return;a>c&&(c=a)}if(a=e-s,h||!(a<0)){if(a/=h,h<0){if(a>f)return;a>c&&(c=a)}else if(h>0){if(a<c)return;a<f&&(f=a)}if(a=n-l,p||!(a>0)){if(a/=p,p<0){if(a<c)return;a<f&&(f=a)}else if(p>0){if(a>f)return;a>c&&(c=a)}if(a=r-l,p||!(a<0)){if(a/=p,p<0){if(a>f)return;a>c&&(c=a)}else if(p>0){if(a<c)return;a<f&&(f=a)}return c>0&&(o.a={x:s+c*h,y:l+c*p}),f<1&&(o.b={x:s+f*h,y:l+f*p}),o}}}}}}function sr(t,n,e,r){return function(s){var l,c,f,h,p,d,m,g,v,y,b,x=s,M=rr(),w=ur(t,n,e,r),_={point:A,lineStart:function(){_.point=E,c&&c.push(f=[]),y=!0,v=!1,m=g=NaN},lineEnd:function(){l&&(E(h,p),d&&v&&M.rejoin(),l.push(M.buffer())),_.point=A,v&&s.lineEnd()},polygonStart:function(){s=M,l=[],c=[],b=!0},polygonEnd:function(){s=x,l=a.merge(l);var n=function(t){for(var n=0,e=c.length,r=t[1],o=0;o<e;++o)for(var a,i=1,u=c[o],s=u.length,l=u[0];i<s;++i)a=u[i],l[1]<=r?a[1]>r&&zt(l,a,t)>0&&++n:a[1]<=r&&zt(l,a,t)<0&&--n,l=a;return 0!==n}([t,r]),e=b&&n,o=l.length;(e||o)&&(s.polygonStart(),e&&(s.lineStart(),k(null,null,1,s),s.lineEnd()),o&&Ke(l,i,n,k,s),s.polygonEnd()),l=c=f=null}};function k(a,i,s,l){var c=0,f=0;if(null==a||(c=o(a,s))!==(f=o(i,s))||u(a,i)<0^s>0)do{l.point(0===c||3===c?t:e,c>1?r:n)}while((c=(c+s+4)%4)!==f);else l.point(i[0],i[1])}function S(o,a){return t<=o&&o<=e&&n<=a&&a<=r}function A(t,n){S(t,n)&&s.point(t,n)}function E(t,n){var e=S(t=Math.max(-1e9,Math.min(1e9,t)),n=Math.max(-1e9,Math.min(1e9,n)));if(c&&f.push([t,n]),y)h=t,p=n,d=e,y=!1,e&&(s.lineStart(),s.point(t,n));else if(e&&v)s.point(t,n);else{var r={a:{x:m,y:g},b:{x:t,y:n}};w(r)?(v||(s.lineStart(),s.point(r.a.x,r.a.y)),s.point(r.b.x,r.b.y),e||s.lineEnd(),b=!1):e&&(s.lineStart(),s.point(t,n),b=!1)}m=t,g=n,v=e}return _};function o(r,o){return w(r[0]-t)<Tt?o>0?0:3:w(r[0]-e)<Tt?o>0?2:1:w(r[1]-n)<Tt?o>0?1:0:o>0?3:2}function i(t,n){return u(t.x,n.x)}function u(t,n){var e=o(t,1),r=o(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}}function lr(t){var n=0,e=Nt/3,r=Lr(t),o=r(n,e);return o.parallels=function(t){return arguments.length?r(n=t[0]*Nt/180,e=t[1]*Nt/180):[n/Nt*180,e/Nt*180]},o}function cr(t,n){var e=Math.sin(t),r=(e+Math.sin(n))/2,o=1+e*(2*r-e),a=Math.sqrt(o)/r;function i(t,n){var e=Math.sqrt(o-2*r*Math.sin(n))/r;return[e*Math.sin(t*=r),a-e*Math.cos(t)]}return i.invert=function(t,n){var e=a-n;return[Math.atan2(t,e)/r,jt((o-(t*t+e*e)*r*r)/(2*r))]},i}a.geo.clipExtent=function(){var t,n,e,r,o,a,i={stream:function(t){return o&&(o.valid=!1),(o=a(t)).valid=!0,o},extent:function(u){return arguments.length?(a=sr(t=+u[0][0],n=+u[0][1],e=+u[1][0],r=+u[1][1]),o&&(o.valid=!1,o=null),i):[[t,n],[e,r]]}};return i.extent([[0,0],[960,500]])},(a.geo.conicEqualArea=function(){return lr(cr)}).raw=cr,a.geo.albers=function(){return a.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},a.geo.albersUsa=function(){var t,n,e,r,o=a.geo.albers(),i=a.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),u=a.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),s={point:function(n,e){t=[n,e]}};function l(o){var a=o[0],i=o[1];return t=null,n(a,i),t||(e(a,i),t)||r(a,i),t}return l.invert=function(t){var n=o.scale(),e=o.translate(),r=(t[0]-e[0])/n,a=(t[1]-e[1])/n;return(a>=.12&&a<.234&&r>=-.425&&r<-.214?i:a>=.166&&a<.234&&r>=-.214&&r<-.115?u:o).invert(t)},l.stream=function(t){var n=o.stream(t),e=i.stream(t),r=u.stream(t);return{point:function(t,o){n.point(t,o),e.point(t,o),r.point(t,o)},sphere:function(){n.sphere(),e.sphere(),r.sphere()},lineStart:function(){n.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){n.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){n.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){n.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},l.precision=function(t){return arguments.length?(o.precision(t),i.precision(t),u.precision(t),l):o.precision()},l.scale=function(t){return arguments.length?(o.scale(t),i.scale(.35*t),u.scale(t),l.translate(o.translate())):o.scale()},l.translate=function(t){if(!arguments.length)return o.translate();var a=o.scale(),c=+t[0],f=+t[1];return n=o.translate(t).clipExtent([[c-.455*a,f-.238*a],[c+.455*a,f+.238*a]]).stream(s).point,e=i.translate([c-.307*a,f+.201*a]).clipExtent([[c-.425*a+Tt,f+.12*a+Tt],[c-.214*a-Tt,f+.234*a-Tt]]).stream(s).point,r=u.translate([c-.205*a,f+.212*a]).clipExtent([[c-.214*a+Tt,f+.166*a+Tt],[c-.115*a-Tt,f+.234*a-Tt]]).stream(s).point,l},l.scale(1070)};var fr,hr,pr,dr,mr,gr,vr={point:q,lineStart:q,lineEnd:q,polygonStart:function(){hr=0,vr.lineStart=yr},polygonEnd:function(){vr.lineStart=vr.lineEnd=vr.point=q,fr+=w(hr/2)}};function yr(){var t,n,e,r;function o(t,n){hr+=r*t-e*n,e=t,r=n}vr.point=function(a,i){vr.point=o,t=e=a,n=r=i},vr.lineEnd=function(){o(t,n)}}var br={point:function(t,n){t<pr&&(pr=t),t>mr&&(mr=t),n<dr&&(dr=n),n>gr&&(gr=n)},lineStart:q,lineEnd:q,polygonStart:q,polygonEnd:q};function xr(){var t=Mr(4.5),n=[],e={point:r,lineStart:function(){e.point=o},lineEnd:i,polygonStart:function(){e.lineEnd=u},polygonEnd:function(){e.lineEnd=i,e.point=r},pointRadius:function(n){return t=Mr(n),e},result:function(){if(n.length){var t=n.join("");return n=[],t}}};function r(e,r){n.push("M",e,",",r,t)}function o(t,r){n.push("M",t,",",r),e.point=a}function a(t,e){n.push("L",t,",",e)}function i(){e.point=r}function u(){n.push("Z")}return e}function Mr(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}var wr,_r={point:kr,lineStart:Sr,lineEnd:Ar,polygonStart:function(){_r.lineStart=Er},polygonEnd:function(){_r.point=kr,_r.lineStart=Sr,_r.lineEnd=Ar}};function kr(t,n){ke+=t,Se+=n,++Ae}function Sr(){var t,n;function e(e,r){var o=e-t,a=r-n,i=Math.sqrt(o*o+a*a);Ee+=i*(t+e)/2,Te+=i*(n+r)/2,Re+=i,kr(t=e,n=r)}_r.point=function(r,o){_r.point=e,kr(t=r,n=o)}}function Ar(){_r.point=kr}function Er(){var t,n,e,r;function o(t,n){var o=t-e,a=n-r,i=Math.sqrt(o*o+a*a);Ee+=i*(e+t)/2,Te+=i*(r+n)/2,Re+=i,Ne+=(i=r*t-e*n)*(e+t),Pe+=i*(r+n),Ce+=3*i,kr(e=t,r=n)}_r.point=function(a,i){_r.point=o,kr(t=e=a,n=r=i)},_r.lineEnd=function(){o(t,n)}}function Tr(t){var n=4.5,e={point:r,lineStart:function(){e.point=o},lineEnd:i,polygonStart:function(){e.lineEnd=u},polygonEnd:function(){e.lineEnd=i,e.point=r},pointRadius:function(t){return n=t,e},result:q};function r(e,r){t.moveTo(e+n,r),t.arc(e,r,n,0,Pt)}function o(n,r){t.moveTo(n,r),e.point=a}function a(n,e){t.lineTo(n,e)}function i(){e.point=r}function u(){t.closePath()}return e}function Rr(t){var n=.5,e=Math.cos(30*Lt),r=16;function o(t){return(r?i:a)(t)}function a(n){return Cr(n,(function(e,r){e=t(e,r),n.point(e[0],e[1])}))}function i(n){var e,o,a,i,s,l,c,f,h,p,d,m,g={point:v,lineStart:y,lineEnd:x,polygonStart:function(){n.polygonStart(),g.lineStart=M},polygonEnd:function(){n.polygonEnd(),g.lineStart=y}};function v(e,r){e=t(e,r),n.point(e[0],e[1])}function y(){f=NaN,g.point=b,n.lineStart()}function b(e,o){var a=De([e,o]),i=t(e,o);u(f,h,c,p,d,m,f=i[0],h=i[1],c=e,p=a[0],d=a[1],m=a[2],r,n),n.point(f,h)}function x(){g.point=v,n.lineEnd()}function M(){y(),g.point=w,g.lineEnd=_}function w(t,n){b(e=t,n),o=f,a=h,i=p,s=d,l=m,g.point=b}function _(){u(f,h,c,p,d,m,o,a,e,i,s,l,r,n),g.lineEnd=x,x()}return g}function u(r,o,a,i,s,l,c,f,h,p,d,m,g,v){var y=c-r,b=f-o,x=y*y+b*b;if(x>4*n&&g--){var M=i+p,_=s+d,k=l+m,S=Math.sqrt(M*M+_*_+k*k),A=Math.asin(k/=S),E=w(w(k)-1)<Tt||w(a-h)<Tt?(a+h)/2:Math.atan2(_,M),T=t(E,A),R=T[0],N=T[1],P=R-r,C=N-o,O=b*P-y*C;(O*O/x>n||w((y*P+b*C)/x-.5)>.3||i*p+s*d+l*m<e)&&(u(r,o,a,i,s,l,R,N,E,M/=S,_/=S,k,g,v),v.point(R,N),u(R,N,E,M,_,k,c,f,h,p,d,m,g,v))}}return o.precision=function(t){return arguments.length?(r=(n=t*t)>0&&16,o):Math.sqrt(n)},o}function Nr(t){var n=Rr((function(n,e){return t([n*Ut,e*Ut])}));return function(t){return Ur(n(t))}}function Pr(t){this.stream=t}function Cr(t,n){return{point:n,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function Or(t){return Lr((function(){return t}))()}function Lr(t){var n,e,r,o,i,u,s=Rr((function(t,e){return[(t=n(t,e))[0]*l+o,i-t[1]*l]})),l=150,c=480,f=250,h=0,p=0,d=0,m=0,g=0,v=ar,y=L,b=null,x=null;function M(t){return[(t=r(t[0]*Lt,t[1]*Lt))[0]*l+o,i-t[1]*l]}function w(t){return(t=r.invert((t[0]-o)/l,(i-t[1])/l))&&[t[0]*Ut,t[1]*Ut]}function _(){r=Je(e=qr(d,m,g),n);var t=n(h,p);return o=c-t[0]*l,i=f+t[1]*l,k()}function k(){return u&&(u.valid=!1,u=null),M}return M.stream=function(t){return u&&(u.valid=!1),(u=Ur(v(e,s(y(t))))).valid=!0,u},M.clipAngle=function(t){return arguments.length?(v=null==t?(b=t,ar):ir((b=+t)*Lt),k()):b},M.clipExtent=function(t){return arguments.length?(x=t,y=t?sr(t[0][0],t[0][1],t[1][0],t[1][1]):L,k()):x},M.scale=function(t){return arguments.length?(l=+t,_()):l},M.translate=function(t){return arguments.length?(c=+t[0],f=+t[1],_()):[c,f]},M.center=function(t){return arguments.length?(h=t[0]%360*Lt,p=t[1]%360*Lt,_()):[h*Ut,p*Ut]},M.rotate=function(t){return arguments.length?(d=t[0]%360*Lt,m=t[1]%360*Lt,g=t.length>2?t[2]%360*Lt:0,_()):[d*Ut,m*Ut,g*Ut]},a.rebind(M,s,"precision"),function(){return n=t.apply(this,arguments),M.invert=n.invert&&w,_()}}function Ur(t){return Cr(t,(function(n,e){t.point(n*Lt,e*Lt)}))}function Dr(t,n){return[t,n]}function zr(t,n){return[t>Nt?t-Pt:t<-Nt?t+Pt:t,n]}function qr(t,n,e){return t?n||e?Je(Fr(t),Br(n,e)):Fr(t):n||e?Br(n,e):zr}function jr(t){return function(n,e){return[(n+=t)>Nt?n-Pt:n<-Nt?n+Pt:n,e]}}function Fr(t){var n=jr(t);return n.invert=jr(-t),n}function Br(t,n){var e=Math.cos(t),r=Math.sin(t),o=Math.cos(n),a=Math.sin(n);function i(t,n){var i=Math.cos(n),u=Math.cos(t)*i,s=Math.sin(t)*i,l=Math.sin(n),c=l*e+u*r;return[Math.atan2(s*o-c*a,u*e-l*r),jt(c*o+s*a)]}return i.invert=function(t,n){var i=Math.cos(n),u=Math.cos(t)*i,s=Math.sin(t)*i,l=Math.sin(n),c=l*o-s*a;return[Math.atan2(s*o+l*a,u*e+c*r),jt(c*e-u*r)]},i}function Ir(t,n){var e=Math.cos(t),r=Math.sin(t);return function(o,a,i,u){var s=i*n;null!=o?(o=Xr(e,o),a=Xr(e,a),(i>0?o<a:o>a)&&(o+=i*Pt)):(o=t+i*Pt,a=t-.5*s);for(var l,c=o;i>0?c>a:c<a;c-=s)u.point((l=Ie([e,-r*Math.cos(c),-r*Math.sin(c)]))[0],l[1])}}function Xr(t,n){var e=De(n);e[0]-=t,Be(e);var r=qt(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-Tt)%(2*Math.PI)}function Yr(t,n,e){var r=a.range(t,n-Tt,e).concat(n);return function(t){return r.map((function(n){return[t,n]}))}}function Vr(t,n,e){var r=a.range(t,n-Tt,e).concat(n);return function(t){return r.map((function(n){return[n,t]}))}}function Hr(t){return t.source}function Gr(t){return t.target}a.geo.path=function(){var t,n,e,r,o,i=4.5;function u(t){return t&&("function"==typeof i&&r.pointRadius(+i.apply(this,arguments)),o&&o.valid||(o=e(r)),a.geo.stream(t,o)),r.result()}function s(){return o=null,u}return u.area=function(t){return fr=0,a.geo.stream(t,e(vr)),fr},u.centroid=function(t){return ke=Se=Ae=Ee=Te=Re=Ne=Pe=Ce=0,a.geo.stream(t,e(_r)),Ce?[Ne/Ce,Pe/Ce]:Re?[Ee/Re,Te/Re]:Ae?[ke/Ae,Se/Ae]:[NaN,NaN]},u.bounds=function(t){return mr=gr=-(pr=dr=1/0),a.geo.stream(t,e(br)),[[pr,dr],[mr,gr]]},u.projection=function(n){return arguments.length?(e=(t=n)?n.stream||Nr(n):L,s()):t},u.context=function(t){return arguments.length?(r=null==(n=t)?new xr:new Tr(t),"function"!=typeof i&&r.pointRadius(i),s()):n},u.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(r.pointRadius(+t),+t),u):i},u.projection(a.geo.albersUsa()).context(null)},a.geo.transform=function(t){return{stream:function(n){var e=new Pr(n);for(var r in t)e[r]=t[r];return e}}},Pr.prototype={point:function(t,n){this.stream.point(t,n)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},a.geo.projection=Or,a.geo.projectionMutator=Lr,(a.geo.equirectangular=function(){return Or(Dr)}).raw=Dr.invert=Dr,a.geo.rotation=function(t){function n(n){return(n=t(n[0]*Lt,n[1]*Lt))[0]*=Ut,n[1]*=Ut,n}return t=qr(t[0]%360*Lt,t[1]*Lt,t.length>2?t[2]*Lt:0),n.invert=function(n){return(n=t.invert(n[0]*Lt,n[1]*Lt))[0]*=Ut,n[1]*=Ut,n},n},zr.invert=Dr,a.geo.circle=function(){var t,n,e=[0,0],r=6;function o(){var t="function"==typeof e?e.apply(this,arguments):e,r=qr(-t[0]*Lt,-t[1]*Lt,0).invert,o=[];return n(null,null,1,{point:function(t,n){o.push(t=r(t,n)),t[0]*=Ut,t[1]*=Ut}}),{type:"Polygon",coordinates:[o]}}return o.origin=function(t){return arguments.length?(e=t,o):e},o.angle=function(e){return arguments.length?(n=Ir((t=+e)*Lt,r*Lt),o):t},o.precision=function(e){return arguments.length?(n=Ir(t*Lt,(r=+e)*Lt),o):r},o.angle(90)},a.geo.distance=function(t,n){var e,r=(n[0]-t[0])*Lt,o=t[1]*Lt,a=n[1]*Lt,i=Math.sin(r),u=Math.cos(r),s=Math.sin(o),l=Math.cos(o),c=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((e=f*i)*e+(e=l*c-s*f*u)*e),s*c+l*f*u)},a.geo.graticule=function(){var t,n,e,r,o,i,u,s,l,c,f,h,p=10,d=p,m=90,g=360,v=2.5;function y(){return{type:"MultiLineString",coordinates:b()}}function b(){return a.range(Math.ceil(r/m)*m,e,m).map(f).concat(a.range(Math.ceil(s/g)*g,u,g).map(h)).concat(a.range(Math.ceil(n/p)*p,t,p).filter((function(t){return w(t%m)>Tt})).map(l)).concat(a.range(Math.ceil(i/d)*d,o,d).filter((function(t){return w(t%g)>Tt})).map(c))}return y.lines=function(){return b().map((function(t){return{type:"LineString",coordinates:t}}))},y.outline=function(){return{type:"Polygon",coordinates:[f(r).concat(h(u).slice(1),f(e).reverse().slice(1),h(s).reverse().slice(1))]}},y.extent=function(t){return arguments.length?y.majorExtent(t).minorExtent(t):y.minorExtent()},y.majorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],s=+t[0][1],u=+t[1][1],r>e&&(t=r,r=e,e=t),s>u&&(t=s,s=u,u=t),y.precision(v)):[[r,s],[e,u]]},y.minorExtent=function(e){return arguments.length?(n=+e[0][0],t=+e[1][0],i=+e[0][1],o=+e[1][1],n>t&&(e=n,n=t,t=e),i>o&&(e=i,i=o,o=e),y.precision(v)):[[n,i],[t,o]]},y.step=function(t){return arguments.length?y.majorStep(t).minorStep(t):y.minorStep()},y.majorStep=function(t){return arguments.length?(m=+t[0],g=+t[1],y):[m,g]},y.minorStep=function(t){return arguments.length?(p=+t[0],d=+t[1],y):[p,d]},y.precision=function(a){return arguments.length?(v=+a,l=Yr(i,o,90),c=Vr(n,t,v),f=Yr(s,u,90),h=Vr(r,e,v),y):v},y.majorExtent([[-180,-90+Tt],[180,90-Tt]]).minorExtent([[-180,-80-Tt],[180,80+Tt]])},a.geo.greatArc=function(){var t,n,e=Hr,r=Gr;function o(){return{type:"LineString",coordinates:[t||e.apply(this,arguments),n||r.apply(this,arguments)]}}return o.distance=function(){return a.geo.distance(t||e.apply(this,arguments),n||r.apply(this,arguments))},o.source=function(n){return arguments.length?(e=n,t="function"==typeof n?null:n,o):e},o.target=function(t){return arguments.length?(r=t,n="function"==typeof t?null:t,o):r},o.precision=function(){return arguments.length?o:0},o},a.geo.interpolate=function(t,n){return e=t[0]*Lt,r=t[1]*Lt,o=n[0]*Lt,a=n[1]*Lt,i=Math.cos(r),u=Math.sin(r),s=Math.cos(a),l=Math.sin(a),c=i*Math.cos(e),f=i*Math.sin(e),h=s*Math.cos(o),p=s*Math.sin(o),d=2*Math.asin(Math.sqrt(Bt(a-r)+i*s*Bt(o-e))),m=1/Math.sin(d),(g=d?function(t){var n=Math.sin(t*=d)*m,e=Math.sin(d-t)*m,r=e*c+n*h,o=e*f+n*p,a=e*u+n*l;return[Math.atan2(o,r)*Ut,Math.atan2(a,Math.sqrt(r*r+o*o))*Ut]}:function(){return[e*Ut,r*Ut]}).distance=d,g;var e,r,o,a,i,u,s,l,c,f,h,p,d,m,g},a.geo.length=function(t){return wr=0,a.geo.stream(t,Wr),wr};var Wr={sphere:q,point:q,lineStart:function(){var t,n,e;function r(r,o){var a=Math.sin(o*=Lt),i=Math.cos(o),u=w((r*=Lt)-t),s=Math.cos(u);wr+=Math.atan2(Math.sqrt((u=i*Math.sin(u))*u+(u=e*a-n*i*s)*u),n*a+e*i*s),t=r,n=a,e=i}Wr.point=function(o,a){t=o*Lt,n=Math.sin(a*=Lt),e=Math.cos(a),Wr.point=r},Wr.lineEnd=function(){Wr.point=Wr.lineEnd=q}},lineEnd:q,polygonStart:q,polygonEnd:q};function Zr(t,n){function e(n,e){var r=Math.cos(n),o=Math.cos(e),a=t(r*o);return[a*o*Math.sin(n),a*Math.sin(e)]}return e.invert=function(t,e){var r=Math.sqrt(t*t+e*e),o=n(r),a=Math.sin(o),i=Math.cos(o);return[Math.atan2(t*a,r*i),Math.asin(r&&e*a/r)]},e}var Jr=Zr((function(t){return Math.sqrt(2/(1+t))}),(function(t){return 2*Math.asin(t/2)}));(a.geo.azimuthalEqualArea=function(){return Or(Jr)}).raw=Jr;var $r=Zr((function(t){var n=Math.acos(t);return n&&n/Math.sin(n)}),L);function Kr(t,n){var e=Math.cos(t),r=function(t){return Math.tan(Nt/4+t/2)},o=t===n?Math.sin(t):Math.log(e/Math.cos(n))/Math.log(r(n)/r(t)),a=e*Math.pow(r(t),o)/o;if(!o)return no;function i(t,n){a>0?n<-Ot+Tt&&(n=-Ot+Tt):n>Ot-Tt&&(n=Ot-Tt);var e=a/Math.pow(r(n),o);return[e*Math.sin(o*t),a-e*Math.cos(o*t)]}return i.invert=function(t,n){var e=a-n,r=Dt(o)*Math.sqrt(t*t+e*e);return[Math.atan2(t,e)/o,2*Math.atan(Math.pow(a/r,1/o))-Ot]},i}function Qr(t,n){var e=Math.cos(t),r=t===n?Math.sin(t):(e-Math.cos(n))/(n-t),o=e/r+t;if(w(r)<Tt)return Dr;function a(t,n){var e=o-n;return[e*Math.sin(r*t),o-e*Math.cos(r*t)]}return a.invert=function(t,n){var e=o-n;return[Math.atan2(t,e)/r,o-Dt(r)*Math.sqrt(t*t+e*e)]},a}(a.geo.azimuthalEquidistant=function(){return Or($r)}).raw=$r,(a.geo.conicConformal=function(){return lr(Kr)}).raw=Kr,(a.geo.conicEquidistant=function(){return lr(Qr)}).raw=Qr;var to=Zr((function(t){return 1/t}),Math.atan);function no(t,n){return[t,Math.log(Math.tan(Nt/4+n/2))]}function eo(t){var n,e=Or(t),r=e.scale,o=e.translate,a=e.clipExtent;return e.scale=function(){var t=r.apply(e,arguments);return t===e?n?e.clipExtent(null):e:t},e.translate=function(){var t=o.apply(e,arguments);return t===e?n?e.clipExtent(null):e:t},e.clipExtent=function(t){var i=a.apply(e,arguments);if(i===e){if(n=null==t){var u=Nt*r(),s=o();a([[s[0]-u,s[1]-u],[s[0]+u,s[1]+u]])}}else n&&(i=null);return i},e.clipExtent(null)}(a.geo.gnomonic=function(){return Or(to)}).raw=to,no.invert=function(t,n){return[t,2*Math.atan(Math.exp(n))-Ot]},(a.geo.mercator=function(){return eo(no)}).raw=no;var ro=Zr((function(){return 1}),Math.asin);(a.geo.orthographic=function(){return Or(ro)}).raw=ro;var oo=Zr((function(t){return 1/(1+t)}),(function(t){return 2*Math.atan(t)}));function ao(t,n){return[Math.log(Math.tan(Nt/4+n/2)),-t]}function io(t){return t[0]}function uo(t){return t[1]}function so(t){for(var n=t.length,e=[0,1],r=2,o=2;o<n;o++){for(;r>1&&zt(t[e[r-2]],t[e[r-1]],t[o])<=0;)--r;e[r++]=o}return e.slice(0,r)}function lo(t,n){return t[0]-n[0]||t[1]-n[1]}(a.geo.stereographic=function(){return Or(oo)}).raw=oo,ao.invert=function(t,n){return[-n,2*Math.atan(Math.exp(t))-Ot]},(a.geo.transverseMercator=function(){var t=eo(ao),n=t.center,e=t.rotate;return t.center=function(t){return t?n([-t[1],t[0]]):[(t=n())[1],-t[0]]},t.rotate=function(t){return t?e([t[0],t[1],t.length>2?t[2]+90:90]):[(t=e())[0],t[1],t[2]-90]},e([0,0,90])}).raw=ao,a.geom={},a.geom.hull=function(t){var n=io,e=uo;if(arguments.length)return r(t);function r(t){if(t.length<3)return[];var r,o=bn(n),a=bn(e),i=t.length,u=[],s=[];for(r=0;r<i;r++)u.push([+o.call(this,t[r],r),+a.call(this,t[r],r),r]);for(u.sort(lo),r=0;r<i;r++)s.push([u[r][0],-u[r][1]]);var l=so(u),c=so(s),f=c[0]===l[0],h=c[c.length-1]===l[l.length-1],p=[];for(r=l.length-1;r>=0;--r)p.push(t[u[l[r]][2]]);for(r=+f;r<c.length-h;++r)p.push(t[u[c[r]][2]]);return p}return r.x=function(t){return arguments.length?(n=t,r):n},r.y=function(t){return arguments.length?(e=t,r):e},r},a.geom.polygon=function(t){return V(t,co),t};var co=a.geom.polygon.prototype=[];function fo(t,n,e){return(e[0]-n[0])*(t[1]-n[1])<(e[1]-n[1])*(t[0]-n[0])}function ho(t,n,e,r){var o=t[0],a=e[0],i=n[0]-o,u=r[0]-a,s=t[1],l=e[1],c=n[1]-s,f=r[1]-l,h=(u*(s-l)-f*(o-a))/(f*i-u*c);return[o+h*i,s+h*c]}function po(t){var n=t[0],e=t[t.length-1];return!(n[0]-e[0]||n[1]-e[1])}co.area=function(){for(var t,n=-1,e=this.length,r=this[e-1],o=0;++n<e;)t=r,r=this[n],o+=t[1]*r[0]-t[0]*r[1];return.5*o},co.centroid=function(t){var n,e,r=-1,o=this.length,a=0,i=0,u=this[o-1];for(arguments.length||(t=-1/(6*this.area()));++r<o;)n=u,u=this[r],e=n[0]*u[1]-u[0]*n[1],a+=(n[0]+u[0])*e,i+=(n[1]+u[1])*e;return[a*t,i*t]},co.clip=function(t){for(var n,e,r,o,a,i,u=po(t),s=-1,l=this.length-po(this),c=this[l-1];++s<l;){for(n=t.slice(),t.length=0,o=this[s],a=n[(r=n.length-u)-1],e=-1;++e<r;)fo(i=n[e],c,o)?(fo(a,c,o)||t.push(ho(a,i,c,o)),t.push(i)):fo(a,c,o)&&t.push(ho(a,i,c,o)),a=i;u&&t.push(t[0]),c=o}return t};var mo,go,vo,yo,bo,xo=[],Mo=[];function wo(){Fo(this),this.edge=this.site=this.circle=null}function _o(t){var n=xo.pop()||new wo;return n.site=t,n}function ko(t){Oo(t),vo.remove(t),xo.push(t),Fo(t)}function So(t){var n=t.circle,e=n.x,r=n.cy,o={x:e,y:r},a=t.P,i=t.N,u=[t];ko(t);for(var s=a;s.circle&&w(e-s.circle.x)<Tt&&w(r-s.circle.cy)<Tt;)a=s.P,u.unshift(s),ko(s),s=a;u.unshift(s),Oo(s);for(var l=i;l.circle&&w(e-l.circle.x)<Tt&&w(r-l.circle.cy)<Tt;)i=l.N,u.push(l),ko(l),l=i;u.push(l),Oo(l);var c,f=u.length;for(c=1;c<f;++c)l=u[c],s=u[c-1],zo(l.edge,s.site,l.site,o);s=u[0],(l=u[f-1]).edge=Do(s.site,l.site,null,o),Co(s),Co(l)}function Ao(t){for(var n,e,r,o,a=t.x,i=t.y,u=vo._;u;)if((r=Eo(u,i)-a)>Tt)u=u.L;else{if(!((o=a-To(u,i))>Tt)){r>-Tt?(n=u.P,e=u):o>-Tt?(n=u,e=u.N):n=e=u;break}if(!u.R){n=u;break}u=u.R}var s=_o(t);if(vo.insert(n,s),n||e){if(n===e)return Oo(n),e=_o(n.site),vo.insert(s,e),s.edge=e.edge=Do(n.site,s.site),Co(n),void Co(e);if(e){Oo(n),Oo(e);var l=n.site,c=l.x,f=l.y,h=t.x-c,p=t.y-f,d=e.site,m=d.x-c,g=d.y-f,v=2*(h*g-p*m),y=h*h+p*p,b=m*m+g*g,x={x:(g*y-p*b)/v+c,y:(h*b-m*y)/v+f};zo(e.edge,l,d,x),s.edge=Do(l,t,null,x),e.edge=Do(t,d,null,x),Co(n),Co(e)}else s.edge=Do(n.site,s.site)}}function Eo(t,n){var e=t.site,r=e.x,o=e.y,a=o-n;if(!a)return r;var i=t.P;if(!i)return-1/0;var u=(e=i.site).x,s=e.y,l=s-n;if(!l)return u;var c=u-r,f=1/a-1/l,h=c/l;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*l)-s+l/2+o-a/2)))/f+r:(r+u)/2}function To(t,n){var e=t.N;if(e)return Eo(e,n);var r=t.site;return r.y===n?r.x:1/0}function Ro(t){this.site=t,this.edges=[]}function No(t,n){return n.angle-t.angle}function Po(){Fo(this),this.x=this.y=this.arc=this.site=this.cy=null}function Co(t){var n=t.P,e=t.N;if(n&&e){var r=n.site,o=t.site,a=e.site;if(r!==a){var i=o.x,u=o.y,s=r.x-i,l=r.y-u,c=a.x-i,f=2*(s*(g=a.y-u)-l*c);if(!(f>=-Rt)){var h=s*s+l*l,p=c*c+g*g,d=(g*h-l*p)/f,m=(s*p-c*h)/f,g=m+u,v=Mo.pop()||new Po;v.arc=t,v.site=o,v.x=d+i,v.y=g+Math.sqrt(d*d+m*m),v.cy=g,t.circle=v;for(var y=null,b=bo._;b;)if(v.y<b.y||v.y===b.y&&v.x<=b.x){if(!b.L){y=b.P;break}b=b.L}else{if(!b.R){y=b;break}b=b.R}bo.insert(y,v),y||(yo=v)}}}}function Oo(t){var n=t.circle;n&&(n.P||(yo=n.N),bo.remove(n),Mo.push(n),Fo(n),t.circle=null)}function Lo(t,n){var e=t.b;if(e)return!0;var r,o,a=t.a,i=n[0][0],u=n[1][0],s=n[0][1],l=n[1][1],c=t.l,f=t.r,h=c.x,p=c.y,d=f.x,m=f.y,g=(h+d)/2,v=(p+m)/2;if(m===p){if(g<i||g>=u)return;if(h>d){if(a){if(a.y>=l)return}else a={x:g,y:s};e={x:g,y:l}}else{if(a){if(a.y<s)return}else a={x:g,y:l};e={x:g,y:s}}}else if(o=v-(r=(h-d)/(m-p))*g,r<-1||r>1)if(h>d){if(a){if(a.y>=l)return}else a={x:(s-o)/r,y:s};e={x:(l-o)/r,y:l}}else{if(a){if(a.y<s)return}else a={x:(l-o)/r,y:l};e={x:(s-o)/r,y:s}}else if(p<m){if(a){if(a.x>=u)return}else a={x:i,y:r*i+o};e={x:u,y:r*u+o}}else{if(a){if(a.x<i)return}else a={x:u,y:r*u+o};e={x:i,y:r*i+o}}return t.a=a,t.b=e,!0}function Uo(t,n){this.l=t,this.r=n,this.a=this.b=null}function Do(t,n,e,r){var o=new Uo(t,n);return mo.push(o),e&&zo(o,t,n,e),r&&zo(o,n,t,r),go[t.i].edges.push(new qo(o,t,n)),go[n.i].edges.push(new qo(o,n,t)),o}function zo(t,n,e,r){t.a||t.b?t.l===e?t.b=r:t.a=r:(t.a=r,t.l=n,t.r=e)}function qo(t,n,e){var r=t.a,o=t.b;this.edge=t,this.site=n,this.angle=e?Math.atan2(e.y-n.y,e.x-n.x):t.l===n?Math.atan2(o.x-r.x,r.y-o.y):Math.atan2(r.x-o.x,o.y-r.y)}function jo(){this._=null}function Fo(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function Bo(t,n){var e=n,r=n.R,o=e.U;o?o.L===e?o.L=r:o.R=r:t._=r,r.U=o,e.U=r,e.R=r.L,e.R&&(e.R.U=e),r.L=e}function Io(t,n){var e=n,r=n.L,o=e.U;o?o.L===e?o.L=r:o.R=r:t._=r,r.U=o,e.U=r,e.L=r.R,e.L&&(e.L.U=e),r.R=e}function Xo(t){for(;t.L;)t=t.L;return t}function Yo(t,n){var e,r,o,a=t.sort(Vo).pop();for(mo=[],go=new Array(t.length),vo=new jo,bo=new jo;;)if(o=yo,a&&(!o||a.y<o.y||a.y===o.y&&a.x<o.x))a.x===e&&a.y===r||(go[a.i]=new Ro(a),Ao(a),e=a.x,r=a.y),a=t.pop();else{if(!o)break;So(o.arc)}n&&(function(t){for(var n,e=mo,r=ur(t[0][0],t[0][1],t[1][0],t[1][1]),o=e.length;o--;)(!Lo(n=e[o],t)||!r(n)||w(n.a.x-n.b.x)<Tt&&w(n.a.y-n.b.y)<Tt)&&(n.a=n.b=null,e.splice(o,1))}(n),function(t){for(var n,e,r,o,a,i,u,s,l,c,f=t[0][0],h=t[1][0],p=t[0][1],d=t[1][1],m=go,g=m.length;g--;)if((a=m[g])&&a.prepare())for(s=(u=a.edges).length,i=0;i<s;)r=(c=u[i].end()).x,o=c.y,n=(l=u[++i%s].start()).x,e=l.y,(w(r-n)>Tt||w(o-e)>Tt)&&(u.splice(i,0,new qo((v=a.site,y=c,b=w(r-f)<Tt&&d-o>Tt?{x:f,y:w(n-f)<Tt?e:d}:w(o-d)<Tt&&h-r>Tt?{x:w(e-d)<Tt?n:h,y:d}:w(r-h)<Tt&&o-p>Tt?{x:h,y:w(n-h)<Tt?e:p}:w(o-p)<Tt&&r-f>Tt?{x:w(e-p)<Tt?n:f,y:p}:null,x=void 0,(x=new Uo(v,null)).a=y,x.b=b,mo.push(x),x),a.site,null)),++s);var v,y,b,x}(n));var i={cells:go,edges:mo};return vo=bo=mo=go=null,i}function Vo(t,n){return n.y-t.y||n.x-t.x}Ro.prototype.prepare=function(){for(var t,n=this.edges,e=n.length;e--;)(t=n[e].edge).b&&t.a||n.splice(e,1);return n.sort(No),n.length},qo.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}},jo.prototype={insert:function(t,n){var e,r,o;if(t){if(n.P=t,n.N=t.N,t.N&&(t.N.P=n),t.N=n,t.R){for(t=t.R;t.L;)t=t.L;t.L=n}else t.R=n;e=t}else this._?(t=Xo(this._),n.P=null,n.N=t,t.P=t.L=n,e=t):(n.P=n.N=null,this._=n,e=null);for(n.L=n.R=null,n.U=e,n.C=!0,t=n;e&&e.C;)e===(r=e.U).L?(o=r.R)&&o.C?(e.C=o.C=!1,r.C=!0,t=r):(t===e.R&&(Bo(this,e),e=(t=e).U),e.C=!1,r.C=!0,Io(this,r)):(o=r.L)&&o.C?(e.C=o.C=!1,r.C=!0,t=r):(t===e.L&&(Io(this,e),e=(t=e).U),e.C=!1,r.C=!0,Bo(this,r)),e=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var n,e,r,o=t.U,a=t.L,i=t.R;if(e=a?i?Xo(i):a:i,o?o.L===t?o.L=e:o.R=e:this._=e,a&&i?(r=e.C,e.C=t.C,e.L=a,a.U=e,e!==i?(o=e.U,e.U=t.U,t=e.R,o.L=t,e.R=i,i.U=e):(e.U=o,o=e,t=e.R)):(r=t.C,t=e),t&&(t.U=o),!r)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===o.L){if((n=o.R).C&&(n.C=!1,o.C=!0,Bo(this,o),n=o.R),n.L&&n.L.C||n.R&&n.R.C){n.R&&n.R.C||(n.L.C=!1,n.C=!0,Io(this,n),n=o.R),n.C=o.C,o.C=n.R.C=!1,Bo(this,o),t=this._;break}}else if((n=o.L).C&&(n.C=!1,o.C=!0,Io(this,o),n=o.L),n.L&&n.L.C||n.R&&n.R.C){n.L&&n.L.C||(n.R.C=!1,n.C=!0,Bo(this,n),n=o.L),n.C=o.C,o.C=n.L.C=!1,Io(this,o),t=this._;break}n.C=!0,t=o,o=o.U}while(!t.C);t&&(t.C=!1)}}},a.geom.voronoi=function(t){var n=io,e=uo,r=n,o=e,a=Ho;if(t)return i(t);function i(t){var n=new Array(t.length),e=a[0][0],r=a[0][1],o=a[1][0],i=a[1][1];return Yo(u(t),a).cells.forEach((function(a,u){var s=a.edges,l=a.site;(n[u]=s.length?s.map((function(t){var n=t.start();return[n.x,n.y]})):l.x>=e&&l.x<=o&&l.y>=r&&l.y<=i?[[e,i],[o,i],[o,r],[e,r]]:[]).point=t[u]})),n}function u(t){return t.map((function(t,n){return{x:Math.round(r(t,n)/Tt)*Tt,y:Math.round(o(t,n)/Tt)*Tt,i:n}}))}return i.links=function(t){return Yo(u(t)).edges.filter((function(t){return t.l&&t.r})).map((function(n){return{source:t[n.l.i],target:t[n.r.i]}}))},i.triangles=function(t){var n=[];return Yo(u(t)).cells.forEach((function(e,r){for(var o,a=e.site,i=e.edges.sort(No),u=-1,s=i.length,l=i[s-1].edge,c=l.l===a?l.r:l.l;++u<s;)o=c,c=(l=i[u].edge).l===a?l.r:l.l,r<o.i&&r<c.i&&Go(a,o,c)<0&&n.push([t[r],t[o.i],t[c.i]])})),n},i.x=function(t){return arguments.length?(r=bn(n=t),i):n},i.y=function(t){return arguments.length?(o=bn(e=t),i):e},i.clipExtent=function(t){return arguments.length?(a=null==t?Ho:t,i):a===Ho?null:a},i.size=function(t){return arguments.length?i.clipExtent(t&&[[0,0],t]):a===Ho?null:a&&a[1]},i};var Ho=[[-1e6,-1e6],[1e6,1e6]];function Go(t,n,e){return(t.x-e.x)*(n.y-t.y)-(t.x-n.x)*(e.y-t.y)}function Wo(t){return t.x}function Zo(t){return t.y}function Jo(t,n,e,r,o,a){if(!t(n,e,r,o,a)){var i=.5*(e+o),u=.5*(r+a),s=n.nodes;s[0]&&Jo(t,s[0],e,r,i,u),s[1]&&Jo(t,s[1],i,r,o,u),s[2]&&Jo(t,s[2],e,u,i,a),s[3]&&Jo(t,s[3],i,u,o,a)}}function $o(t,n,e,r,o,a,i){var u,s=1/0;return function t(l,c,f,h,p){if(!(c>a||f>i||h<r||p<o)){if(d=l.point){var d,m=n-l.x,g=e-l.y,v=m*m+g*g;if(v<s){var y=Math.sqrt(s=v);r=n-y,o=e-y,a=n+y,i=e+y,u=d}}for(var b=l.nodes,x=.5*(c+h),M=.5*(f+p),w=(e>=M)<<1|n>=x,_=w+4;w<_;++w)if(l=b[3&w])switch(3&w){case 0:t(l,c,f,x,M);break;case 1:t(l,x,f,h,M);break;case 2:t(l,c,M,x,p);break;case 3:t(l,x,M,h,p)}}}(t,r,o,a,i),u}function Ko(t,n){t=a.rgb(t),n=a.rgb(n);var e=t.r,r=t.g,o=t.b,i=n.r-e,u=n.g-r,s=n.b-o;return function(t){return"#"+hn(Math.round(e+i*t))+hn(Math.round(r+u*t))+hn(Math.round(o+s*t))}}function Qo(t,n){var e,r={},o={};for(e in t)e in n?r[e]=oa(t[e],n[e]):o[e]=t[e];for(e in n)e in t||(o[e]=n[e]);return function(t){for(e in r)o[e]=r[e](t);return o}}function ta(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}function na(t,n){var e,r,o,a=ea.lastIndex=ra.lastIndex=0,i=-1,u=[],s=[];for(t+="",n+="";(e=ea.exec(t))&&(r=ra.exec(n));)(o=r.index)>a&&(o=n.slice(a,o),u[i]?u[i]+=o:u[++i]=o),(e=e[0])===(r=r[0])?u[i]?u[i]+=r:u[++i]=r:(u[++i]=null,s.push({i:i,x:ta(e,r)})),a=ra.lastIndex;return a<n.length&&(o=n.slice(a),u[i]?u[i]+=o:u[++i]=o),u.length<2?s[0]?(n=s[0].x,function(t){return n(t)+""}):function(){return n}:(n=s.length,function(t){for(var e,r=0;r<n;++r)u[(e=s[r]).i]=e.x(t);return u.join("")})}a.geom.delaunay=function(t){return a.geom.voronoi().triangles(t)},a.geom.quadtree=function(t,n,e,r,o){var a,i=io,u=uo;if(a=arguments.length)return i=Wo,u=Zo,3===a&&(o=e,r=n,e=n=0),s(t);function s(t){var s,l,c,f,h,p,d,m,g,v=bn(i),y=bn(u);if(null!=n)p=n,d=e,m=r,g=o;else if(m=g=-(p=d=1/0),l=[],c=[],h=t.length,a)for(f=0;f<h;++f)(s=t[f]).x<p&&(p=s.x),s.y<d&&(d=s.y),s.x>m&&(m=s.x),s.y>g&&(g=s.y),l.push(s.x),c.push(s.y);else for(f=0;f<h;++f){var b=+v(s=t[f],f),x=+y(s,f);b<p&&(p=b),x<d&&(d=x),b>m&&(m=b),x>g&&(g=x),l.push(b),c.push(x)}var M=m-p,_=g-d;function k(t,n,e,r,o,a,i,u){if(!isNaN(e)&&!isNaN(r))if(t.leaf){var s=t.x,l=t.y;if(null!=s)if(w(s-e)+w(l-r)<.01)S(t,n,e,r,o,a,i,u);else{var c=t.point;t.x=t.y=t.point=null,S(t,c,s,l,o,a,i,u),S(t,n,e,r,o,a,i,u)}else t.x=e,t.y=r,t.point=n}else S(t,n,e,r,o,a,i,u)}function S(t,n,e,r,o,a,i,u){var s=.5*(o+i),l=.5*(a+u),c=e>=s,f=r>=l,h=f<<1|c;t.leaf=!1,c?o=s:i=s,f?a=l:u=l,k(t=t.nodes[h]||(t.nodes[h]={leaf:!0,nodes:[],point:null,x:null,y:null}),n,e,r,o,a,i,u)}M>_?g=d+M:m=p+_;var A={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){k(A,t,+v(t,++f),+y(t,f),p,d,m,g)},visit:function(t){Jo(t,A,p,d,m,g)},find:function(t){return $o(A,t[0],t[1],p,d,m,g)}};if(f=-1,null==n){for(;++f<h;)k(A,t[f],l[f],c[f],p,d,m,g);--f}else t.forEach(A.add);return l=c=t=s=null,A}return s.x=function(t){return arguments.length?(i=t,s):i},s.y=function(t){return arguments.length?(u=t,s):u},s.extent=function(t){return arguments.length?(null==t?n=e=r=o=null:(n=+t[0][0],e=+t[0][1],r=+t[1][0],o=+t[1][1]),s):null==n?null:[[n,e],[r,o]]},s.size=function(t){return arguments.length?(null==t?n=e=r=o=null:(n=e=0,r=+t[0],o=+t[1]),s):null==n?null:[r-n,o-e]},s},a.interpolateRgb=Ko,a.interpolateObject=Qo,a.interpolateNumber=ta,a.interpolateString=na;var ea=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ra=new RegExp(ea.source,"g");function oa(t,n){for(var e,r=a.interpolators.length;--r>=0&&!(e=a.interpolators[r](t,n)););return e}function aa(t,n){var e,r=[],o=[],a=t.length,i=n.length,u=Math.min(t.length,n.length);for(e=0;e<u;++e)r.push(oa(t[e],n[e]));for(;e<a;++e)o[e]=t[e];for(;e<i;++e)o[e]=n[e];return function(t){for(e=0;e<u;++e)o[e]=r[e](t);return o}}a.interpolate=oa,a.interpolators=[function(t,n){var e=typeof n;return("string"===e?yn.has(n.toLowerCase())||/^(#|rgb\(|hsl\()/i.test(n)?Ko:na:n instanceof Ht?Ko:Array.isArray(n)?aa:"object"===e&&isNaN(n)?Qo:ta)(t,n)}],a.interpolateArray=aa;var ia=function(){return L},ua=a.map({linear:ia,poly:function(t){return function(n){return Math.pow(n,t)}},quad:function(){return ha},cubic:function(){return pa},sin:function(){return ma},exp:function(){return ga},circle:function(){return va},elastic:function(t,n){var e;return arguments.length<2&&(n=.45),arguments.length?e=n/Pt*Math.asin(1/t):(t=1,e=n/4),function(r){return 1+t*Math.pow(2,-10*r)*Math.sin((r-e)*Pt/n)}},back:function(t){return t||(t=1.70158),function(n){return n*n*((t+1)*n-t)}},bounce:function(){return ya}}),sa=a.map({in:L,out:ca,"in-out":fa,"out-in":function(t){return fa(ca(t))}});function la(t){return function(n){return n<=0?0:n>=1?1:t(n)}}function ca(t){return function(n){return 1-t(1-n)}}function fa(t){return function(n){return.5*(n<.5?t(2*n):2-t(2-2*n))}}function ha(t){return t*t}function pa(t){return t*t*t}function da(t){if(t<=0)return 0;if(t>=1)return 1;var n=t*t,e=n*t;return 4*(t<.5?e:3*(t-n)+e-.75)}function ma(t){return 1-Math.cos(t*Ot)}function ga(t){return Math.pow(2,10*(t-1))}function va(t){return 1-Math.sqrt(1-t*t)}function ya(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function ba(t,n){return n-=t,function(e){return Math.round(t+n*e)}}function xa(t){var n=[t.a,t.b],e=[t.c,t.d],r=wa(n),o=Ma(n,e),a=wa(function(t,n,e){return t[0]+=e*n[0],t[1]+=e*n[1],t}(e,n,-o))||0;n[0]*e[1]<e[0]*n[1]&&(n[0]*=-1,n[1]*=-1,r*=-1,o*=-1),this.rotate=(r?Math.atan2(n[1],n[0]):Math.atan2(-e[0],e[1]))*Ut,this.translate=[t.e,t.f],this.scale=[r,a],this.skew=a?Math.atan2(o,a)*Ut:0}function Ma(t,n){return t[0]*n[0]+t[1]*n[1]}function wa(t){var n=Math.sqrt(Ma(t,t));return n&&(t[0]/=n,t[1]/=n),n}a.ease=function(t){var n=t.indexOf("-"),e=n>=0?t.slice(0,n):t,r=n>=0?t.slice(n+1):"in";return e=ua.get(e)||ia,la((r=sa.get(r)||L)(e.apply(null,i.call(arguments,1))))},a.interpolateHcl=function(t,n){t=a.hcl(t),n=a.hcl(n);var e=t.h,r=t.c,o=t.l,i=n.h-e,u=n.c-r,s=n.l-o;return isNaN(u)&&(u=0,r=isNaN(r)?n.c:r),isNaN(i)?(i=0,e=isNaN(e)?n.h:e):i>180?i-=360:i<-180&&(i+=360),function(t){return Kt(e+i*t,r+u*t,o+s*t)+""}},a.interpolateHsl=function(t,n){t=a.hsl(t),n=a.hsl(n);var e=t.h,r=t.s,o=t.l,i=n.h-e,u=n.s-r,s=n.l-o;return isNaN(u)&&(u=0,r=isNaN(r)?n.s:r),isNaN(i)?(i=0,e=isNaN(e)?n.h:e):i>180?i-=360:i<-180&&(i+=360),function(t){return Zt(e+i*t,r+u*t,o+s*t)+""}},a.interpolateLab=function(t,n){t=a.lab(t),n=a.lab(n);var e=t.l,r=t.a,o=t.b,i=n.l-e,u=n.a-r,s=n.b-o;return function(t){return en(e+i*t,r+u*t,o+s*t)+""}},a.interpolateRound=ba,a.transform=function(t){var n=s.createElementNS(a.ns.prefix.svg,"g");return(a.transform=function(t){if(null!=t){n.setAttribute("transform",t);var e=n.transform.baseVal.consolidate()}return new xa(e?e.matrix:_a)})(t)},xa.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var _a={a:1,b:0,c:0,d:1,e:0,f:0};function ka(t){return t.length?t.pop()+",":""}function Sa(t,n){var e=[],r=[];return t=a.transform(t),n=a.transform(n),function(t,n,e,r){if(t[0]!==n[0]||t[1]!==n[1]){var o=e.push("translate(",null,",",null,")");r.push({i:o-4,x:ta(t[0],n[0])},{i:o-2,x:ta(t[1],n[1])})}else(n[0]||n[1])&&e.push("translate("+n+")")}(t.translate,n.translate,e,r),function(t,n,e,r){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),r.push({i:e.push(ka(e)+"rotate(",null,")")-2,x:ta(t,n)})):n&&e.push(ka(e)+"rotate("+n+")")}(t.rotate,n.rotate,e,r),function(t,n,e,r){t!==n?r.push({i:e.push(ka(e)+"skewX(",null,")")-2,x:ta(t,n)}):n&&e.push(ka(e)+"skewX("+n+")")}(t.skew,n.skew,e,r),function(t,n,e,r){if(t[0]!==n[0]||t[1]!==n[1]){var o=e.push(ka(e)+"scale(",null,",",null,")");r.push({i:o-4,x:ta(t[0],n[0])},{i:o-2,x:ta(t[1],n[1])})}else 1===n[0]&&1===n[1]||e.push(ka(e)+"scale("+n+")")}(t.scale,n.scale,e,r),t=n=null,function(t){for(var n,o=-1,a=r.length;++o<a;)e[(n=r[o]).i]=n.x(t);return e.join("")}}function Aa(t,n){return n=(n-=t=+t)||1/n,function(e){return(e-t)/n}}function Ea(t,n){return n=(n-=t=+t)||1/n,function(e){return Math.max(0,Math.min(1,(e-t)/n))}}function Ta(t){for(var n=t.source,e=t.target,r=function(t,n){if(t===n)return t;for(var e=Ra(t),r=Ra(n),o=e.pop(),a=r.pop(),i=null;o===a;)i=o,o=e.pop(),a=r.pop();return i}(n,e),o=[n];n!==r;)n=n.parent,o.push(n);for(var a=o.length;e!==r;)o.splice(a,0,e),e=e.parent;return o}function Ra(t){for(var n=[],e=t.parent;null!=e;)n.push(t),t=e,e=e.parent;return n.push(t),n}function Na(t){t.fixed|=2}function Pa(t){t.fixed&=-7}function Ca(t){t.fixed|=4,t.px=t.x,t.py=t.y}function Oa(t){t.fixed&=-5}a.interpolateTransform=Sa,a.layout={},a.layout.bundle=function(){return function(t){for(var n=[],e=-1,r=t.length;++e<r;)n.push(Ta(t[e]));return n}},a.layout.chord=function(){var t,n,e,r,o,i,u,s={},l=0;function c(){var s,c,h,p,d,m={},g=[],v=a.range(r),y=[];for(t=[],n=[],s=0,p=-1;++p<r;){for(c=0,d=-1;++d<r;)c+=e[p][d];g.push(c),y.push(a.range(r)),s+=c}for(o&&v.sort((function(t,n){return o(g[t],g[n])})),i&&y.forEach((function(t,n){t.sort((function(t,r){return i(e[n][t],e[n][r])}))})),s=(Pt-l*r)/s,c=0,p=-1;++p<r;){for(h=c,d=-1;++d<r;){var b=v[p],x=y[b][d],M=e[b][x],w=c,_=c+=M*s;m[b+"-"+x]={index:b,subindex:x,startAngle:w,endAngle:_,value:M}}n[b]={index:b,startAngle:h,endAngle:c,value:g[b]},c+=l}for(p=-1;++p<r;)for(d=p-1;++d<r;){var k=m[p+"-"+d],S=m[d+"-"+p];(k.value||S.value)&&t.push(k.value<S.value?{source:S,target:k}:{source:k,target:S})}u&&f()}function f(){t.sort((function(t,n){return u((t.source.value+t.target.value)/2,(n.source.value+n.target.value)/2)}))}return s.matrix=function(o){return arguments.length?(r=(e=o)&&e.length,t=n=null,s):e},s.padding=function(e){return arguments.length?(l=e,t=n=null,s):l},s.sortGroups=function(e){return arguments.length?(o=e,t=n=null,s):o},s.sortSubgroups=function(n){return arguments.length?(i=n,t=null,s):i},s.sortChords=function(n){return arguments.length?(u=n,t&&f(),s):u},s.chords=function(){return t||c(),t},s.groups=function(){return n||c(),n},s},a.layout.force=function(){var t,n,e,r,o,i,u={},s=a.dispatch("start","tick","end"),l=[1,1],c=.9,f=La,h=Ua,p=-30,d=Da,m=.1,g=.64,v=[],y=[];function b(t){return function(n,e,r,o){if(n.point!==t){var a=n.cx-t.x,i=n.cy-t.y,u=o-e,s=a*a+i*i;if(u*u/g<s){if(s<d){var l=n.charge/s;t.px-=a*l,t.py-=i*l}return!0}n.point&&s&&s<d&&(l=n.pointCharge/s,t.px-=a*l,t.py-=i*l)}return!n.charge}}function x(t){t.px=a.event.x,t.py=a.event.y,u.resume()}return u.tick=function(){if((e*=.99)<.005)return t=null,s.end({type:"end",alpha:e=0}),!0;var n,u,f,h,d,g,x,M,w,_=v.length,k=y.length;for(u=0;u<k;++u)h=(f=y[u]).source,(g=(M=(d=f.target).x-h.x)*M+(w=d.y-h.y)*w)&&(M*=g=e*o[u]*((g=Math.sqrt(g))-r[u])/g,w*=g,d.x-=M*(x=h.weight+d.weight?h.weight/(h.weight+d.weight):.5),d.y-=w*x,h.x+=M*(x=1-x),h.y+=w*x);if((x=e*m)&&(M=l[0]/2,w=l[1]/2,u=-1,x))for(;++u<_;)(f=v[u]).x+=(M-f.x)*x,f.y+=(w-f.y)*x;if(p)for(function t(n,e,r){var o=0,a=0;if(n.charge=0,!n.leaf)for(var i,u=n.nodes,s=u.length,l=-1;++l<s;)null!=(i=u[l])&&(t(i,e,r),n.charge+=i.charge,o+=i.charge*i.cx,a+=i.charge*i.cy);if(n.point){n.leaf||(n.point.x+=Math.random()-.5,n.point.y+=Math.random()-.5);var c=e*r[n.point.index];n.charge+=n.pointCharge=c,o+=c*n.point.x,a+=c*n.point.y}n.cx=o/n.charge,n.cy=a/n.charge}(n=a.geom.quadtree(v),e,i),u=-1;++u<_;)(f=v[u]).fixed||n.visit(b(f));for(u=-1;++u<_;)(f=v[u]).fixed?(f.x=f.px,f.y=f.py):(f.x-=(f.px-(f.px=f.x))*c,f.y-=(f.py-(f.py=f.y))*c);s.tick({type:"tick",alpha:e})},u.nodes=function(t){return arguments.length?(v=t,u):v},u.links=function(t){return arguments.length?(y=t,u):y},u.size=function(t){return arguments.length?(l=t,u):l},u.linkDistance=function(t){return arguments.length?(f="function"==typeof t?t:+t,u):f},u.distance=u.linkDistance,u.linkStrength=function(t){return arguments.length?(h="function"==typeof t?t:+t,u):h},u.friction=function(t){return arguments.length?(c=+t,u):c},u.charge=function(t){return arguments.length?(p="function"==typeof t?t:+t,u):p},u.chargeDistance=function(t){return arguments.length?(d=t*t,u):Math.sqrt(d)},u.gravity=function(t){return arguments.length?(m=+t,u):m},u.theta=function(t){return arguments.length?(g=t*t,u):Math.sqrt(g)},u.alpha=function(n){return arguments.length?(n=+n,e?n>0?e=n:(t.c=null,t.t=NaN,t=null,s.end({type:"end",alpha:e=0})):n>0&&(s.start({type:"start",alpha:e=n}),t=En(u.tick)),u):e},u.start=function(){var t,n,e,a=v.length,s=y.length,c=l[0],d=l[1];for(t=0;t<a;++t)(e=v[t]).index=t,e.weight=0;for(t=0;t<s;++t)"number"==typeof(e=y[t]).source&&(e.source=v[e.source]),"number"==typeof e.target&&(e.target=v[e.target]),++e.source.weight,++e.target.weight;for(t=0;t<a;++t)e=v[t],isNaN(e.x)&&(e.x=m("x",c)),isNaN(e.y)&&(e.y=m("y",d)),isNaN(e.px)&&(e.px=e.x),isNaN(e.py)&&(e.py=e.y);if(r=[],"function"==typeof f)for(t=0;t<s;++t)r[t]=+f.call(this,y[t],t);else for(t=0;t<s;++t)r[t]=f;if(o=[],"function"==typeof h)for(t=0;t<s;++t)o[t]=+h.call(this,y[t],t);else for(t=0;t<s;++t)o[t]=h;if(i=[],"function"==typeof p)for(t=0;t<a;++t)i[t]=+p.call(this,v[t],t);else for(t=0;t<a;++t)i[t]=p;function m(e,r){if(!n){for(n=new Array(a),l=0;l<a;++l)n[l]=[];for(l=0;l<s;++l){var o=y[l];n[o.source.index].push(o.target),n[o.target.index].push(o.source)}}for(var i,u=n[t],l=-1,c=u.length;++l<c;)if(!isNaN(i=u[l][e]))return i;return Math.random()*r}return u.resume()},u.resume=function(){return u.alpha(.1)},u.stop=function(){return u.alpha(0)},u.drag=function(){if(n||(n=a.behavior.drag().origin(L).on("dragstart.force",Na).on("drag.force",x).on("dragend.force",Pa)),!arguments.length)return n;this.on("mouseover.force",Ca).on("mouseout.force",Oa).call(n)},a.rebind(u,s,"on")};var La=20,Ua=1,Da=1/0;function za(t,n){return a.rebind(t,n,"sort","children","value"),t.nodes=t,t.links=Xa,t}function qa(t,n){for(var e=[t];null!=(t=e.pop());)if(n(t),(o=t.children)&&(r=o.length))for(var r,o;--r>=0;)e.push(o[r])}function ja(t,n){for(var e=[t],r=[];null!=(t=e.pop());)if(r.push(t),(a=t.children)&&(o=a.length))for(var o,a,i=-1;++i<o;)e.push(a[i]);for(;null!=(t=r.pop());)n(t)}function Fa(t){return t.children}function Ba(t){return t.value}function Ia(t,n){return n.value-t.value}function Xa(t){return a.merge(t.map((function(t){return(t.children||[]).map((function(n){return{source:t,target:n}}))})))}a.layout.hierarchy=function(){var t=Ia,n=Fa,e=Ba;function r(o){var a,i=[o],u=[];for(o.depth=0;null!=(a=i.pop());)if(u.push(a),(l=n.call(r,a,a.depth))&&(s=l.length)){for(var s,l,c;--s>=0;)i.push(c=l[s]),c.parent=a,c.depth=a.depth+1;e&&(a.value=0),a.children=l}else e&&(a.value=+e.call(r,a,a.depth)||0),delete a.children;return ja(o,(function(n){var r,o;t&&(r=n.children)&&r.sort(t),e&&(o=n.parent)&&(o.value+=n.value)})),u}return r.sort=function(n){return arguments.length?(t=n,r):t},r.children=function(t){return arguments.length?(n=t,r):n},r.value=function(t){return arguments.length?(e=t,r):e},r.revalue=function(t){return e&&(qa(t,(function(t){t.children&&(t.value=0)})),ja(t,(function(t){var n;t.children||(t.value=+e.call(r,t,t.depth)||0),(n=t.parent)&&(n.value+=t.value)}))),t},r},a.layout.partition=function(){var t=a.layout.hierarchy(),n=[1,1];function e(e,r){var o=t.call(this,e,r);return function t(n,e,r,o){var a=n.children;if(n.x=e,n.y=n.depth*o,n.dx=r,n.dy=o,a&&(i=a.length)){var i,u,s,l=-1;for(r=n.value?r/n.value:0;++l<i;)t(u=a[l],e,s=u.value*r,o),e+=s}}(o[0],0,n[0],n[1]/function t(n){var e=n.children,r=0;if(e&&(o=e.length))for(var o,a=-1;++a<o;)r=Math.max(r,t(e[a]));return 1+r}(o[0])),o}return e.size=function(t){return arguments.length?(n=t,e):n},za(e,t)},a.layout.pie=function(){var t=Number,n=Ya,e=0,r=Pt,o=0;function i(u){var s,l=u.length,c=u.map((function(n,e){return+t.call(i,n,e)})),f=+("function"==typeof e?e.apply(this,arguments):e),h=("function"==typeof r?r.apply(this,arguments):r)-f,p=Math.min(Math.abs(h)/l,+("function"==typeof o?o.apply(this,arguments):o)),d=p*(h<0?-1:1),m=a.sum(c),g=m?(h-l*d)/m:0,v=a.range(l),y=[];return null!=n&&v.sort(n===Ya?function(t,n){return c[n]-c[t]}:function(t,e){return n(u[t],u[e])}),v.forEach((function(t){y[t]={data:u[t],value:s=c[t],startAngle:f,endAngle:f+=s*g+d,padAngle:p}})),y}return i.value=function(n){return arguments.length?(t=n,i):t},i.sort=function(t){return arguments.length?(n=t,i):n},i.startAngle=function(t){return arguments.length?(e=t,i):e},i.endAngle=function(t){return arguments.length?(r=t,i):r},i.padAngle=function(t){return arguments.length?(o=t,i):o},i};var Ya={};function Va(t){return t.x}function Ha(t){return t.y}function Ga(t,n,e){t.y0=n,t.y=e}a.layout.stack=function(){var t=L,n=Ja,e=$a,r=Ga,o=Va,i=Ha;function u(s,l){if(!(p=s.length))return s;var c=s.map((function(n,e){return t.call(u,n,e)})),f=c.map((function(t){return t.map((function(t,n){return[o.call(u,t,n),i.call(u,t,n)]}))})),h=n.call(u,f,l);c=a.permute(c,h),f=a.permute(f,h);var p,d,m,g,v=e.call(u,f,l),y=c[0].length;for(m=0;m<y;++m)for(r.call(u,c[0][m],g=v[m],f[0][m][1]),d=1;d<p;++d)r.call(u,c[d][m],g+=f[d-1][m][1],f[d][m][1]);return s}return u.values=function(n){return arguments.length?(t=n,u):t},u.order=function(t){return arguments.length?(n="function"==typeof t?t:Wa.get(t)||Ja,u):n},u.offset=function(t){return arguments.length?(e="function"==typeof t?t:Za.get(t)||$a,u):e},u.x=function(t){return arguments.length?(o=t,u):o},u.y=function(t){return arguments.length?(i=t,u):i},u.out=function(t){return arguments.length?(r=t,u):r},u};var Wa=a.map({"inside-out":function(t){var n,e,r=t.length,o=t.map(Ka),i=t.map(Qa),u=a.range(r).sort((function(t,n){return o[t]-o[n]})),s=0,l=0,c=[],f=[];for(n=0;n<r;++n)e=u[n],s<l?(s+=i[e],c.push(e)):(l+=i[e],f.push(e));return f.reverse().concat(c)},reverse:function(t){return a.range(t.length).reverse()},default:Ja}),Za=a.map({silhouette:function(t){var n,e,r,o=t.length,a=t[0].length,i=[],u=0,s=[];for(e=0;e<a;++e){for(n=0,r=0;n<o;n++)r+=t[n][e][1];r>u&&(u=r),i.push(r)}for(e=0;e<a;++e)s[e]=(u-i[e])/2;return s},wiggle:function(t){var n,e,r,o,a,i,u,s,l,c=t.length,f=t[0],h=f.length,p=[];for(p[0]=s=l=0,e=1;e<h;++e){for(n=0,o=0;n<c;++n)o+=t[n][e][1];for(n=0,a=0,u=f[e][0]-f[e-1][0];n<c;++n){for(r=0,i=(t[n][e][1]-t[n][e-1][1])/(2*u);r<n;++r)i+=(t[r][e][1]-t[r][e-1][1])/u;a+=i*t[n][e][1]}p[e]=s-=o?a/o*u:0,s<l&&(l=s)}for(e=0;e<h;++e)p[e]-=l;return p},expand:function(t){var n,e,r,o=t.length,a=t[0].length,i=1/o,u=[];for(e=0;e<a;++e){for(n=0,r=0;n<o;n++)r+=t[n][e][1];if(r)for(n=0;n<o;n++)t[n][e][1]/=r;else for(n=0;n<o;n++)t[n][e][1]=i}for(e=0;e<a;++e)u[e]=0;return u},zero:$a});function Ja(t){return a.range(t.length)}function $a(t){for(var n=-1,e=t[0].length,r=[];++n<e;)r[n]=0;return r}function Ka(t){for(var n,e=1,r=0,o=t[0][1],a=t.length;e<a;++e)(n=t[e][1])>o&&(r=e,o=n);return r}function Qa(t){return t.reduce(ti,0)}function ti(t,n){return t+n[1]}function ni(t,n){return ei(t,Math.ceil(Math.log(n.length)/Math.LN2+1))}function ei(t,n){for(var e=-1,r=+t[0],o=(t[1]-r)/n,a=[];++e<=n;)a[e]=o*e+r;return a}function ri(t){return[a.min(t),a.max(t)]}function oi(t,n){return t.value-n.value}function ai(t,n){var e=t._pack_next;t._pack_next=n,n._pack_prev=t,n._pack_next=e,e._pack_prev=n}function ii(t,n){t._pack_next=n,n._pack_prev=t}function ui(t,n){var e=n.x-t.x,r=n.y-t.y,o=t.r+n.r;return.999*o*o>e*e+r*r}function si(t){if((n=t.children)&&(s=n.length)){var n,e,r,o,a,i,u,s,l=1/0,c=-1/0,f=1/0,h=-1/0;if(n.forEach(li),(e=n[0]).x=-e.r,e.y=0,b(e),s>1&&((r=n[1]).x=r.r,r.y=0,b(r),s>2))for(fi(e,r,o=n[2]),b(o),ai(e,o),e._pack_prev=o,ai(o,r),r=e._pack_next,a=3;a<s;a++){fi(e,r,o=n[a]);var p=0,d=1,m=1;for(i=r._pack_next;i!==r;i=i._pack_next,d++)if(ui(i,o)){p=1;break}if(1==p)for(u=e._pack_prev;u!==i._pack_prev&&!ui(u,o);u=u._pack_prev,m++);p?(d<m||d==m&&r.r<e.r?ii(e,r=i):ii(e=u,r),a--):(ai(e,o),r=o,b(o))}var g=(l+c)/2,v=(f+h)/2,y=0;for(a=0;a<s;a++)(o=n[a]).x-=g,o.y-=v,y=Math.max(y,o.r+Math.sqrt(o.x*o.x+o.y*o.y));t.r=y,n.forEach(ci)}function b(t){l=Math.min(t.x-t.r,l),c=Math.max(t.x+t.r,c),f=Math.min(t.y-t.r,f),h=Math.max(t.y+t.r,h)}}function li(t){t._pack_next=t._pack_prev=t}function ci(t){delete t._pack_next,delete t._pack_prev}function fi(t,n,e){var r=t.r+e.r,o=n.x-t.x,a=n.y-t.y;if(r&&(o||a)){var i=n.r+e.r,u=o*o+a*a,s=.5+((r*=r)-(i*=i))/(2*u),l=Math.sqrt(Math.max(0,2*i*(r+u)-(r-=u)*r-i*i))/(2*u);e.x=t.x+s*o+l*a,e.y=t.y+s*a-l*o}else e.x=t.x+r,e.y=t.y}function hi(t,n){return t.parent==n.parent?1:2}function pi(t){var n=t.children;return n.length?n[0]:t.t}function di(t){var n,e=t.children;return(n=e.length)?e[n-1]:t.t}function mi(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function gi(t,n,e){return t.a.parent===n.parent?t.a:e}function vi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function yi(t,n){var e=t.x+n[3],r=t.y+n[0],o=t.dx-n[1]-n[3],a=t.dy-n[0]-n[2];return o<0&&(e+=o/2,o=0),a<0&&(r+=a/2,a=0),{x:e,y:r,dx:o,dy:a}}function bi(t){var n=t[0],e=t[t.length-1];return n<e?[n,e]:[e,n]}function xi(t){return t.rangeExtent?t.rangeExtent():bi(t.range())}function Mi(t,n,e,r){var o=e(t[0],t[1]),a=r(n[0],n[1]);return function(t){return a(o(t))}}function wi(t,n){var e,r=0,o=t.length-1,a=t[r],i=t[o];return i<a&&(e=r,r=o,o=e,e=a,a=i,i=e),t[r]=n.floor(a),t[o]=n.ceil(i),t}function _i(t){return t?{floor:function(n){return Math.floor(n/t)*t},ceil:function(n){return Math.ceil(n/t)*t}}:ki}a.layout.histogram=function(){var t=!0,n=Number,e=ri,r=ni;function o(o,i){for(var u,s,l=[],c=o.map(n,this),f=e.call(this,c,i),h=r.call(this,f,c,i),p=(i=-1,c.length),d=h.length-1,m=t?1:1/p;++i<d;)(u=l[i]=[]).dx=h[i+1]-(u.x=h[i]),u.y=0;if(d>0)for(i=-1;++i<p;)(s=c[i])>=f[0]&&s<=f[1]&&((u=l[a.bisect(h,s,1,d)-1]).y+=m,u.push(o[i]));return l}return o.value=function(t){return arguments.length?(n=t,o):n},o.range=function(t){return arguments.length?(e=bn(t),o):e},o.bins=function(t){return arguments.length?(r="number"==typeof t?function(n){return ei(n,t)}:bn(t),o):r},o.frequency=function(n){return arguments.length?(t=!!n,o):t},o},a.layout.pack=function(){var t,n=a.layout.hierarchy().sort(oi),e=0,r=[1,1];function o(o,a){var i=n.call(this,o,a),u=i[0],s=r[0],l=r[1],c=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(u.x=u.y=0,ja(u,(function(t){t.r=+c(t.value)})),ja(u,si),e){var f=e*(t?1:Math.max(2*u.r/s,2*u.r/l))/2;ja(u,(function(t){t.r+=f})),ja(u,si),ja(u,(function(t){t.r-=f}))}return function t(n,e,r,o){var a=n.children;if(n.x=e+=o*n.x,n.y=r+=o*n.y,n.r*=o,a)for(var i=-1,u=a.length;++i<u;)t(a[i],e,r,o)}(u,s/2,l/2,t?1:1/Math.max(2*u.r/s,2*u.r/l)),i}return o.size=function(t){return arguments.length?(r=t,o):r},o.radius=function(n){return arguments.length?(t=null==n||"function"==typeof n?n:+n,o):t},o.padding=function(t){return arguments.length?(e=+t,o):e},za(o,n)},a.layout.tree=function(){var t=a.layout.hierarchy().sort(null).value(null),n=hi,e=[1,1],r=null;function o(o,a){var l=t.call(this,o,a),c=l[0],f=function(t){for(var n,e={A:null,children:[t]},r=[e];null!=(n=r.pop());)for(var o,a=n.children,i=0,u=a.length;i<u;++i)r.push((a[i]=o={_:a[i],parent:n,children:(o=a[i].children)&&o.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:i}).a=o);return e.children[0]}(c);if(ja(f,i),f.parent.m=-f.z,qa(f,u),r)qa(c,s);else{var h=c,p=c,d=c;qa(c,(function(t){t.x<h.x&&(h=t),t.x>p.x&&(p=t),t.depth>d.depth&&(d=t)}));var m=n(h,p)/2-h.x,g=e[0]/(p.x+n(p,h)/2+m),v=e[1]/(d.depth||1);qa(c,(function(t){t.x=(t.x+m)*g,t.y=t.depth*v}))}return l}function i(t){var e=t.children,r=t.parent.children,o=t.i?r[t.i-1]:null;if(e.length){!function(t){for(var n,e=0,r=0,o=t.children,a=o.length;--a>=0;)(n=o[a]).z+=e,n.m+=e,e+=n.s+(r+=n.c)}(t);var a=(e[0].z+e[e.length-1].z)/2;o?(t.z=o.z+n(t._,o._),t.m=t.z-a):t.z=a}else o&&(t.z=o.z+n(t._,o._));t.parent.A=function(t,e,r){if(e){for(var o,a=t,i=t,u=e,s=a.parent.children[0],l=a.m,c=i.m,f=u.m,h=s.m;u=di(u),a=pi(a),u&&a;)s=pi(s),(i=di(i)).a=t,(o=u.z+f-a.z-l+n(u._,a._))>0&&(mi(gi(u,t,r),t,o),l+=o,c+=o),f+=u.m,l+=a.m,h+=s.m,c+=i.m;u&&!di(i)&&(i.t=u,i.m+=f-c),a&&!pi(s)&&(s.t=a,s.m+=l-h,r=t)}return r}(t,o,t.parent.A||r[0])}function u(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=e[0],t.y=t.depth*e[1]}return o.separation=function(t){return arguments.length?(n=t,o):n},o.size=function(t){return arguments.length?(r=null==(e=t)?s:null,o):r?null:e},o.nodeSize=function(t){return arguments.length?(r=null==(e=t)?null:s,o):r?e:null},za(o,t)},a.layout.cluster=function(){var t=a.layout.hierarchy().sort(null).value(null),n=hi,e=[1,1],r=!1;function o(o,i){var u,s=t.call(this,o,i),l=s[0],c=0;ja(l,(function(t){var e=t.children;e&&e.length?(t.x=function(t){return t.reduce((function(t,n){return t+n.x}),0)/t.length}(e),t.y=function(t){return 1+a.max(t,(function(t){return t.y}))}(e)):(t.x=u?c+=n(t,u):0,t.y=0,u=t)}));var f=function t(n){var e=n.children;return e&&e.length?t(e[0]):n}(l),h=function t(n){var e,r=n.children;return r&&(e=r.length)?t(r[e-1]):n}(l),p=f.x-n(f,h)/2,d=h.x+n(h,f)/2;return ja(l,r?function(t){t.x=(t.x-l.x)*e[0],t.y=(l.y-t.y)*e[1]}:function(t){t.x=(t.x-p)/(d-p)*e[0],t.y=(1-(l.y?t.y/l.y:1))*e[1]}),s}return o.separation=function(t){return arguments.length?(n=t,o):n},o.size=function(t){return arguments.length?(r=null==(e=t),o):r?null:e},o.nodeSize=function(t){return arguments.length?(r=null!=(e=t),o):r?e:null},za(o,t)},a.layout.treemap=function(){var t,n=a.layout.hierarchy(),e=Math.round,r=[1,1],o=null,i=vi,u=!1,s="squarify",l=.5*(1+Math.sqrt(5));function c(t,n){for(var e,r,o=-1,a=t.length;++o<a;)r=(e=t[o]).value*(n<0?0:n),e.area=isNaN(r)||r<=0?0:r}function f(t){var n=t.children;if(n&&n.length){var e,r,o,a=i(t),u=[],l=n.slice(),h=1/0,m="slice"===s?a.dx:"dice"===s?a.dy:"slice-dice"===s?1&t.depth?a.dy:a.dx:Math.min(a.dx,a.dy);for(c(l,a.dx*a.dy/t.value),u.area=0;(o=l.length)>0;)u.push(e=l[o-1]),u.area+=e.area,"squarify"!==s||(r=p(u,m))<=h?(l.pop(),h=r):(u.area-=u.pop().area,d(u,m,a,!1),m=Math.min(a.dx,a.dy),u.length=u.area=0,h=1/0);u.length&&(d(u,m,a,!0),u.length=u.area=0),n.forEach(f)}}function h(t){var n=t.children;if(n&&n.length){var e,r=i(t),o=n.slice(),a=[];for(c(o,r.dx*r.dy/t.value),a.area=0;e=o.pop();)a.push(e),a.area+=e.area,null!=e.z&&(d(a,e.z?r.dx:r.dy,r,!o.length),a.length=a.area=0);n.forEach(h)}}function p(t,n){for(var e,r=t.area,o=0,a=1/0,i=-1,u=t.length;++i<u;)(e=t[i].area)&&(e<a&&(a=e),e>o&&(o=e));return n*=n,(r*=r)?Math.max(n*o*l/r,r/(n*a*l)):1/0}function d(t,n,r,o){var a,i=-1,u=t.length,s=r.x,l=r.y,c=n?e(t.area/n):0;if(n==r.dx){for((o||c>r.dy)&&(c=r.dy);++i<u;)(a=t[i]).x=s,a.y=l,a.dy=c,s+=a.dx=Math.min(r.x+r.dx-s,c?e(a.area/c):0);a.z=!0,a.dx+=r.x+r.dx-s,r.y+=c,r.dy-=c}else{for((o||c>r.dx)&&(c=r.dx);++i<u;)(a=t[i]).x=s,a.y=l,a.dx=c,l+=a.dy=Math.min(r.y+r.dy-l,c?e(a.area/c):0);a.z=!1,a.dy+=r.y+r.dy-l,r.x+=c,r.dx-=c}}function m(e){var o=t||n(e),a=o[0];return a.x=a.y=0,a.value?(a.dx=r[0],a.dy=r[1]):a.dx=a.dy=0,t&&n.revalue(a),c([a],a.dx*a.dy/a.value),(t?h:f)(a),u&&(t=o),o}return m.size=function(t){return arguments.length?(r=t,m):r},m.padding=function(t){if(!arguments.length)return o;function n(n){var e=t.call(m,n,n.depth);return null==e?vi(n):yi(n,"number"==typeof e?[e,e,e,e]:e)}function e(n){return yi(n,t)}var r;return i=null==(o=t)?vi:"function"==(r=typeof t)?n:"number"===r?(t=[t,t,t,t],e):e,m},m.round=function(t){return arguments.length?(e=t?Math.round:Number,m):e!=Number},m.sticky=function(n){return arguments.length?(u=n,t=null,m):u},m.ratio=function(t){return arguments.length?(l=t,m):l},m.mode=function(t){return arguments.length?(s=t+"",m):s},za(m,n)},a.random={normal:function(t,n){var e=arguments.length;return e<2&&(n=1),e<1&&(t=0),function(){var e,r,o;do{o=(e=2*Math.random()-1)*e+(r=2*Math.random()-1)*r}while(!o||o>1);return t+n*e*Math.sqrt(-2*Math.log(o)/o)}},logNormal:function(){var t=a.random.normal.apply(a,arguments);return function(){return Math.exp(t())}},bates:function(t){var n=a.random.irwinHall(t);return function(){return n()/t}},irwinHall:function(t){return function(){for(var n=0,e=0;e<t;e++)n+=Math.random();return n}}},a.scale={};var ki={floor:L,ceil:L};function Si(t,n,e,r){var o=[],i=[],u=0,s=Math.min(t.length,n.length)-1;for(t[s]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++u<=s;)o.push(e(t[u-1],t[u])),i.push(r(n[u-1],n[u]));return function(n){var e=a.bisect(t,n,1,s)-1;return i[e](o[e](n))}}function Ai(t,n){return a.rebind(t,n,"range","rangeRound","interpolate","clamp")}function Ei(t,n){return wi(t,_i(Ti(t,n)[2])),wi(t,_i(Ti(t,n)[2])),t}function Ti(t,n){null==n&&(n=10);var e=bi(t),r=e[1]-e[0],o=Math.pow(10,Math.floor(Math.log(r/n)/Math.LN10)),a=n/r*o;return a<=.15?o*=10:a<=.35?o*=5:a<=.75&&(o*=2),e[0]=Math.ceil(e[0]/o)*o,e[1]=Math.floor(e[1]/o)*o+.5*o,e[2]=o,e}function Ri(t,n){return a.range.apply(a,Ti(t,n))}function Ni(t,n,e){var r=Ti(t,n);if(e){var o=Ln.exec(e);if(o.shift(),"s"===o[8]){var i=a.formatPrefix(Math.max(w(r[0]),w(r[1])));return o[7]||(o[7]="."+Ci(i.scale(r[2]))),o[8]="f",e=a.format(o.join("")),function(t){return e(i.scale(t))+i.symbol}}o[7]||(o[7]="."+function(t,n){var e=Ci(n[2]);return t in Pi?Math.abs(e-Ci(Math.max(w(n[0]),w(n[1]))))+ +("e"!==t):e-2*("%"===t)}(o[8],r)),e=o.join("")}else e=",."+Ci(r[2])+"f";return a.format(e)}a.scale.linear=function(){return function t(n,e,r,o){var a,i;function u(){var t=Math.min(n.length,e.length)>2?Si:Mi,u=o?Ea:Aa;return a=t(n,e,u,r),i=t(e,n,u,oa),s}function s(t){return a(t)}return s.invert=function(t){return i(t)},s.domain=function(t){return arguments.length?(n=t.map(Number),u()):n},s.range=function(t){return arguments.length?(e=t,u()):e},s.rangeRound=function(t){return s.range(t).interpolate(ba)},s.clamp=function(t){return arguments.length?(o=t,u()):o},s.interpolate=function(t){return arguments.length?(r=t,u()):r},s.ticks=function(t){return Ri(n,t)},s.tickFormat=function(t,e){return Ni(n,t,e)},s.nice=function(t){return Ei(n,t),u()},s.copy=function(){return t(n,e,r,o)},u()}([0,1],[0,1],oa,!1)};var Pi={s:1,g:1,p:1,r:1,e:1};function Ci(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}a.scale.log=function(){return function t(n,e,r,o){function i(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function u(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function s(t){return n(i(t))}return s.invert=function(t){return u(n.invert(t))},s.domain=function(t){return arguments.length?(r=t[0]>=0,n.domain((o=t.map(Number)).map(i)),s):o},s.base=function(t){return arguments.length?(e=+t,n.domain(o.map(i)),s):e},s.nice=function(){var t=wi(o.map(i),r?Math:Li);return n.domain(t),o=t.map(u),s},s.ticks=function(){var t=bi(o),n=[],a=t[0],s=t[1],l=Math.floor(i(a)),c=Math.ceil(i(s)),f=e%1?2:e;if(isFinite(c-l)){if(r){for(;l<c;l++)for(var h=1;h<f;h++)n.push(u(l)*h);n.push(u(l))}else for(n.push(u(l));l++<c;)for(h=f-1;h>0;h--)n.push(u(l)*h);for(l=0;n[l]<a;l++);for(c=n.length;n[c-1]>s;c--);n=n.slice(l,c)}return n},s.tickFormat=function(t,n){if(!arguments.length)return Oi;arguments.length<2?n=Oi:"function"!=typeof n&&(n=a.format(n));var r=Math.max(1,e*t/s.ticks().length);return function(t){var o=t/u(Math.round(i(t)));return o*e<e-.5&&(o*=e),o<=r?n(t):""}},s.copy=function(){return t(n.copy(),e,r,o)},Ai(s,n)}(a.scale.linear().domain([0,1]),10,!0,[1,10])};var Oi=a.format(".0e"),Li={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};function Ui(t){return function(n){return n<0?-Math.pow(-n,t):Math.pow(n,t)}}a.scale.pow=function(){return function t(n,e,r){var o=Ui(e),a=Ui(1/e);function i(t){return n(o(t))}return i.invert=function(t){return a(n.invert(t))},i.domain=function(t){return arguments.length?(n.domain((r=t.map(Number)).map(o)),i):r},i.ticks=function(t){return Ri(r,t)},i.tickFormat=function(t,n){return Ni(r,t,n)},i.nice=function(t){return i.domain(Ei(r,t))},i.exponent=function(t){return arguments.length?(o=Ui(e=t),a=Ui(1/e),n.domain(r.map(o)),i):e},i.copy=function(){return t(n.copy(),e,r)},Ai(i,n)}(a.scale.linear(),1,[0,1])},a.scale.sqrt=function(){return a.scale.pow().exponent(.5)},a.scale.ordinal=function(){return function t(n,e){var r,o,i;function u(t){return o[((r.get(t)||("range"===e.t?r.set(t,n.push(t)):NaN))-1)%o.length]}function s(t,e){return a.range(n.length).map((function(n){return t+e*n}))}return u.domain=function(t){if(!arguments.length)return n;n=[],r=new S;for(var o,a=-1,i=t.length;++a<i;)r.has(o=t[a])||r.set(o,n.push(o));return u[e.t].apply(u,e.a)},u.range=function(t){return arguments.length?(o=t,i=0,e={t:"range",a:arguments},u):o},u.rangePoints=function(t,r){arguments.length<2&&(r=0);var a=t[0],l=t[1],c=n.length<2?(a=(a+l)/2,0):(l-a)/(n.length-1+r);return o=s(a+c*r/2,c),i=0,e={t:"rangePoints",a:arguments},u},u.rangeRoundPoints=function(t,r){arguments.length<2&&(r=0);var a=t[0],l=t[1],c=n.length<2?(a=l=Math.round((a+l)/2),0):(l-a)/(n.length-1+r)|0;return o=s(a+Math.round(c*r/2+(l-a-(n.length-1+r)*c)/2),c),i=0,e={t:"rangeRoundPoints",a:arguments},u},u.rangeBands=function(t,r,a){arguments.length<2&&(r=0),arguments.length<3&&(a=r);var l=t[1]<t[0],c=t[l-0],f=t[1-l],h=(f-c)/(n.length-r+2*a);return o=s(c+h*a,h),l&&o.reverse(),i=h*(1-r),e={t:"rangeBands",a:arguments},u},u.rangeRoundBands=function(t,r,a){arguments.length<2&&(r=0),arguments.length<3&&(a=r);var l=t[1]<t[0],c=t[l-0],f=t[1-l],h=Math.floor((f-c)/(n.length-r+2*a));return o=s(c+Math.round((f-c-(n.length-r)*h)/2),h),l&&o.reverse(),i=Math.round(h*(1-r)),e={t:"rangeRoundBands",a:arguments},u},u.rangeBand=function(){return i},u.rangeExtent=function(){return bi(e.a[0])},u.copy=function(){return t(n,e)},u.domain(n)}([],{t:"range",a:[[]]})},a.scale.category10=function(){return a.scale.ordinal().range(Di)},a.scale.category20=function(){return a.scale.ordinal().range(zi)},a.scale.category20b=function(){return a.scale.ordinal().range(qi)},a.scale.category20c=function(){return a.scale.ordinal().range(ji)};var Di=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(cn),zi=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(cn),qi=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(cn),ji=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(cn);function Fi(){return 0}a.scale.quantile=function(){return function t(n,e){var r;function o(){var t=0,o=e.length;for(r=[];++t<o;)r[t-1]=a.quantile(n,t/o);return i}function i(t){if(!isNaN(t=+t))return e[a.bisect(r,t)]}return i.domain=function(t){return arguments.length?(n=t.map(v).filter(y).sort(g),o()):n},i.range=function(t){return arguments.length?(e=t,o()):e},i.quantiles=function(){return r},i.invertExtent=function(t){return(t=e.indexOf(t))<0?[NaN,NaN]:[t>0?r[t-1]:n[0],t<r.length?r[t]:n[n.length-1]]},i.copy=function(){return t(n,e)},o()}([],[])},a.scale.quantize=function(){return function t(n,e,r){var o,a;function i(t){return r[Math.max(0,Math.min(a,Math.floor(o*(t-n))))]}function u(){return o=r.length/(e-n),a=r.length-1,i}return i.domain=function(t){return arguments.length?(n=+t[0],e=+t[t.length-1],u()):[n,e]},i.range=function(t){return arguments.length?(r=t,u()):r},i.invertExtent=function(t){return[t=(t=r.indexOf(t))<0?NaN:t/o+n,t+1/o]},i.copy=function(){return t(n,e,r)},u()}(0,1,[0,1])},a.scale.threshold=function(){return function t(n,e){function r(t){if(t<=t)return e[a.bisect(n,t)]}return r.domain=function(t){return arguments.length?(n=t,r):n},r.range=function(t){return arguments.length?(e=t,r):e},r.invertExtent=function(t){return t=e.indexOf(t),[n[t-1],n[t]]},r.copy=function(){return t(n,e)},r}([.5],[0,1])},a.scale.identity=function(){return function t(n){function e(t){return+t}return e.invert=e,e.domain=e.range=function(t){return arguments.length?(n=t.map(e),e):n},e.ticks=function(t){return Ri(n,t)},e.tickFormat=function(t,e){return Ni(n,t,e)},e.copy=function(){return t(n)},e}([0,1])},a.svg={},a.svg.arc=function(){var t=Ii,n=Xi,e=Fi,r=Bi,o=Yi,a=Vi,i=Hi;function u(){var u=Math.max(0,+t.apply(this,arguments)),l=Math.max(0,+n.apply(this,arguments)),c=o.apply(this,arguments)-Ot,f=a.apply(this,arguments)-Ot,h=Math.abs(f-c),p=c>f?0:1;if(l<u&&(d=l,l=u,u=d),h>=Ct)return s(l,p)+(u?s(u,1-p):"")+"Z";var d,m,g,v,y,b,x,M,w,_,k,S,A=0,E=0,T=[];if((v=(+i.apply(this,arguments)||0)/2)&&(g=r===Bi?Math.sqrt(u*u+l*l):+r.apply(this,arguments),p||(E*=-1),l&&(E=jt(g/l*Math.sin(v))),u&&(A=jt(g/u*Math.sin(v)))),l){y=l*Math.cos(c+E),b=l*Math.sin(c+E),x=l*Math.cos(f-E),M=l*Math.sin(f-E);var R=Math.abs(f-c-2*E)<=Nt?0:1;if(E&&Gi(y,b,x,M)===p^R){var N=(c+f)/2;y=l*Math.cos(N),b=l*Math.sin(N),x=M=null}}else y=b=0;if(u){w=u*Math.cos(f-A),_=u*Math.sin(f-A),k=u*Math.cos(c+A),S=u*Math.sin(c+A);var P=Math.abs(c-f+2*A)<=Nt?0:1;if(A&&Gi(w,_,k,S)===1-p^P){var C=(c+f)/2;w=u*Math.cos(C),_=u*Math.sin(C),k=S=null}}else w=_=0;if(h>Tt&&(d=Math.min(Math.abs(l-u)/2,+e.apply(this,arguments)))>.001){m=u<l^p?0:1;var O=d,L=d;if(h<Nt){var U=null==k?[w,_]:null==x?[y,b]:ho([y,b],[k,S],[x,M],[w,_]),D=y-U[0],z=b-U[1],q=x-U[0],j=M-U[1],F=1/Math.sin(Math.acos((D*q+z*j)/(Math.sqrt(D*D+z*z)*Math.sqrt(q*q+j*j)))/2),B=Math.sqrt(U[0]*U[0]+U[1]*U[1]);L=Math.min(d,(u-B)/(F-1)),O=Math.min(d,(l-B)/(F+1))}if(null!=x){var I=Wi(null==k?[w,_]:[k,S],[y,b],l,O,p),X=Wi([x,M],[w,_],l,O,p);d===O?T.push("M",I[0],"A",O,",",O," 0 0,",m," ",I[1],"A",l,",",l," 0 ",1-p^Gi(I[1][0],I[1][1],X[1][0],X[1][1]),",",p," ",X[1],"A",O,",",O," 0 0,",m," ",X[0]):T.push("M",I[0],"A",O,",",O," 0 1,",m," ",X[0])}else T.push("M",y,",",b);if(null!=k){var Y=Wi([y,b],[k,S],u,-L,p),V=Wi([w,_],null==x?[y,b]:[x,M],u,-L,p);d===L?T.push("L",V[0],"A",L,",",L," 0 0,",m," ",V[1],"A",u,",",u," 0 ",p^Gi(V[1][0],V[1][1],Y[1][0],Y[1][1]),",",1-p," ",Y[1],"A",L,",",L," 0 0,",m," ",Y[0]):T.push("L",V[0],"A",L,",",L," 0 0,",m," ",Y[0])}else T.push("L",w,",",_)}else T.push("M",y,",",b),null!=x&&T.push("A",l,",",l," 0 ",R,",",p," ",x,",",M),T.push("L",w,",",_),null!=k&&T.push("A",u,",",u," 0 ",P,",",1-p," ",k,",",S);return T.push("Z"),T.join("")}function s(t,n){return"M0,"+t+"A"+t+","+t+" 0 1,"+n+" 0,"+-t+"A"+t+","+t+" 0 1,"+n+" 0,"+t}return u.innerRadius=function(n){return arguments.length?(t=bn(n),u):t},u.outerRadius=function(t){return arguments.length?(n=bn(t),u):n},u.cornerRadius=function(t){return arguments.length?(e=bn(t),u):e},u.padRadius=function(t){return arguments.length?(r=t==Bi?Bi:bn(t),u):r},u.startAngle=function(t){return arguments.length?(o=bn(t),u):o},u.endAngle=function(t){return arguments.length?(a=bn(t),u):a},u.padAngle=function(t){return arguments.length?(i=bn(t),u):i},u.centroid=function(){var e=(+t.apply(this,arguments)+ +n.apply(this,arguments))/2,r=(+o.apply(this,arguments)+ +a.apply(this,arguments))/2-Ot;return[Math.cos(r)*e,Math.sin(r)*e]},u};var Bi="auto";function Ii(t){return t.innerRadius}function Xi(t){return t.outerRadius}function Yi(t){return t.startAngle}function Vi(t){return t.endAngle}function Hi(t){return t&&t.padAngle}function Gi(t,n,e,r){return(t-e)*n-(n-r)*t>0?0:1}function Wi(t,n,e,r,o){var a=t[0]-n[0],i=t[1]-n[1],u=(o?r:-r)/Math.sqrt(a*a+i*i),s=u*i,l=-u*a,c=t[0]+s,f=t[1]+l,h=n[0]+s,p=n[1]+l,d=(c+h)/2,m=(f+p)/2,g=h-c,v=p-f,y=g*g+v*v,b=e-r,x=c*p-h*f,M=(v<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*v-g*M)/y,_=(-x*g-v*M)/y,k=(x*v+g*M)/y,S=(-x*g+v*M)/y,A=w-d,E=_-m,T=k-d,R=S-m;return A*A+E*E>T*T+R*R&&(w=k,_=S),[[w-s,_-l],[w*e/b,_*e/b]]}function Zi(t){var n=io,e=uo,r=$e,o=$i,a=o.key,i=.7;function u(a){var u,s=[],l=[],c=-1,f=a.length,h=bn(n),p=bn(e);function d(){s.push("M",o(t(l),i))}for(;++c<f;)r.call(this,u=a[c],c)?l.push([+h.call(this,u,c),+p.call(this,u,c)]):l.length&&(d(),l=[]);return l.length&&d(),s.length?s.join(""):null}return u.x=function(t){return arguments.length?(n=t,u):n},u.y=function(t){return arguments.length?(e=t,u):e},u.defined=function(t){return arguments.length?(r=t,u):r},u.interpolate=function(t){return arguments.length?(a="function"==typeof t?o=t:(o=Ji.get(t)||$i).key,u):a},u.tension=function(t){return arguments.length?(i=t,u):i},u}a.svg.line=function(){return Zi(L)};var Ji=a.map({linear:$i,"linear-closed":Ki,step:function(t){for(var n=0,e=t.length,r=t[0],o=[r[0],",",r[1]];++n<e;)o.push("H",(r[0]+(r=t[n])[0])/2,"V",r[1]);return e>1&&o.push("H",r[0]),o.join("")},"step-before":Qi,"step-after":tu,basis:ru,"basis-open":function(t){if(t.length<4)return $i(t);for(var n,e=[],r=-1,o=t.length,a=[0],i=[0];++r<3;)n=t[r],a.push(n[0]),i.push(n[1]);for(e.push(ou(uu,a)+","+ou(uu,i)),--r;++r<o;)n=t[r],a.shift(),a.push(n[0]),i.shift(),i.push(n[1]),su(e,a,i);return e.join("")},"basis-closed":function(t){for(var n,e,r=-1,o=t.length,a=o+4,i=[],u=[];++r<4;)e=t[r%o],i.push(e[0]),u.push(e[1]);for(n=[ou(uu,i),",",ou(uu,u)],--r;++r<a;)e=t[r%o],i.shift(),i.push(e[0]),u.shift(),u.push(e[1]),su(n,i,u);return n.join("")},bundle:function(t,n){var e=t.length-1;if(e)for(var r,o,a=t[0][0],i=t[0][1],u=t[e][0]-a,s=t[e][1]-i,l=-1;++l<=e;)r=t[l],o=l/e,r[0]=n*r[0]+(1-n)*(a+o*u),r[1]=n*r[1]+(1-n)*(i+o*s);return ru(t)},cardinal:function(t,n){return t.length<3?$i(t):t[0]+nu(t,eu(t,n))},"cardinal-open":function(t,n){return t.length<4?$i(t):t[1]+nu(t.slice(1,-1),eu(t,n))},"cardinal-closed":function(t,n){return t.length<3?Ki(t):t[0]+nu((t.push(t[0]),t),eu([t[t.length-2]].concat(t,[t[1]]),n))},monotone:function(t){return t.length<3?$i(t):t[0]+nu(t,function(t){for(var n,e,r,o,a=[],i=function(t){for(var n=0,e=t.length-1,r=[],o=t[0],a=t[1],i=r[0]=lu(o,a);++n<e;)r[n]=(i+(i=lu(o=a,a=t[n+1])))/2;return r[n]=i,r}(t),u=-1,s=t.length-1;++u<s;)n=lu(t[u],t[u+1]),w(n)<Tt?i[u]=i[u+1]=0:(e=i[u]/n,r=i[u+1]/n,(o=e*e+r*r)>9&&(o=3*n/Math.sqrt(o),i[u]=o*e,i[u+1]=o*r));for(u=-1;++u<=s;)o=(t[Math.min(s,u+1)][0]-t[Math.max(0,u-1)][0])/(6*(1+i[u]*i[u])),a.push([o||0,i[u]*o||0]);return a}(t))}});function $i(t){return t.length>1?t.join("L"):t+"Z"}function Ki(t){return t.join("L")+"Z"}function Qi(t){for(var n=0,e=t.length,r=t[0],o=[r[0],",",r[1]];++n<e;)o.push("V",(r=t[n])[1],"H",r[0]);return o.join("")}function tu(t){for(var n=0,e=t.length,r=t[0],o=[r[0],",",r[1]];++n<e;)o.push("H",(r=t[n])[0],"V",r[1]);return o.join("")}function nu(t,n){if(n.length<1||t.length!=n.length&&t.length!=n.length+2)return $i(t);var e=t.length!=n.length,r="",o=t[0],a=t[1],i=n[0],u=i,s=1;if(e&&(r+="Q"+(a[0]-2*i[0]/3)+","+(a[1]-2*i[1]/3)+","+a[0]+","+a[1],o=t[1],s=2),n.length>1){u=n[1],a=t[s],s++,r+="C"+(o[0]+i[0])+","+(o[1]+i[1])+","+(a[0]-u[0])+","+(a[1]-u[1])+","+a[0]+","+a[1];for(var l=2;l<n.length;l++,s++)a=t[s],u=n[l],r+="S"+(a[0]-u[0])+","+(a[1]-u[1])+","+a[0]+","+a[1]}if(e){var c=t[s];r+="Q"+(a[0]+2*u[0]/3)+","+(a[1]+2*u[1]/3)+","+c[0]+","+c[1]}return r}function eu(t,n){for(var e,r=[],o=(1-n)/2,a=t[0],i=t[1],u=1,s=t.length;++u<s;)e=a,a=i,i=t[u],r.push([o*(i[0]-e[0]),o*(i[1]-e[1])]);return r}function ru(t){if(t.length<3)return $i(t);var n=1,e=t.length,r=t[0],o=r[0],a=r[1],i=[o,o,o,(r=t[1])[0]],u=[a,a,a,r[1]],s=[o,",",a,"L",ou(uu,i),",",ou(uu,u)];for(t.push(t[e-1]);++n<=e;)r=t[n],i.shift(),i.push(r[0]),u.shift(),u.push(r[1]),su(s,i,u);return t.pop(),s.push("L",r),s.join("")}function ou(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]*n[3]}Ji.forEach((function(t,n){n.key=t,n.closed=/-closed$/.test(t)}));var au=[0,2/3,1/3,0],iu=[0,1/3,2/3,0],uu=[0,1/6,2/3,1/6];function su(t,n,e){t.push("C",ou(au,n),",",ou(au,e),",",ou(iu,n),",",ou(iu,e),",",ou(uu,n),",",ou(uu,e))}function lu(t,n){return(n[1]-t[1])/(n[0]-t[0])}function cu(t){for(var n,e,r,o=-1,a=t.length;++o<a;)e=(n=t[o])[0],r=n[1]-Ot,n[0]=e*Math.cos(r),n[1]=e*Math.sin(r);return t}function fu(t){var n=io,e=io,r=0,o=uo,a=$e,i=$i,u=i.key,s=i,l="L",c=.7;function f(u){var f,h,p,d=[],m=[],g=[],v=-1,y=u.length,b=bn(n),x=bn(r),M=n===e?function(){return h}:bn(e),w=r===o?function(){return p}:bn(o);function _(){d.push("M",i(t(g),c),l,s(t(m.reverse()),c),"Z")}for(;++v<y;)a.call(this,f=u[v],v)?(m.push([h=+b.call(this,f,v),p=+x.call(this,f,v)]),g.push([+M.call(this,f,v),+w.call(this,f,v)])):m.length&&(_(),m=[],g=[]);return m.length&&_(),d.length?d.join(""):null}return f.x=function(t){return arguments.length?(n=e=t,f):e},f.x0=function(t){return arguments.length?(n=t,f):n},f.x1=function(t){return arguments.length?(e=t,f):e},f.y=function(t){return arguments.length?(r=o=t,f):o},f.y0=function(t){return arguments.length?(r=t,f):r},f.y1=function(t){return arguments.length?(o=t,f):o},f.defined=function(t){return arguments.length?(a=t,f):a},f.interpolate=function(t){return arguments.length?(u="function"==typeof t?i=t:(i=Ji.get(t)||$i).key,s=i.reverse||i,l=i.closed?"M":"L",f):u},f.tension=function(t){return arguments.length?(c=t,f):c},f}function hu(t){return t.radius}function pu(t){return[t.x,t.y]}function du(t){return function(){var n=t.apply(this,arguments),e=n[0],r=n[1]-Ot;return[e*Math.cos(r),e*Math.sin(r)]}}function mu(){return 64}function gu(){return"circle"}function vu(t){var n=Math.sqrt(t/Nt);return"M0,"+n+"A"+n+","+n+" 0 1,1 0,"+-n+"A"+n+","+n+" 0 1,1 0,"+n+"Z"}a.svg.line.radial=function(){var t=Zi(cu);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},Qi.reverse=tu,tu.reverse=Qi,a.svg.area=function(){return fu(L)},a.svg.area.radial=function(){var t=fu(cu);return t.radius=t.x,delete t.x,t.innerRadius=t.x0,delete t.x0,t.outerRadius=t.x1,delete t.x1,t.angle=t.y,delete t.y,t.startAngle=t.y0,delete t.y0,t.endAngle=t.y1,delete t.y1,t},a.svg.chord=function(){var t=Hr,n=Gr,e=hu,r=Yi,o=Vi;function a(e,r){var o=i(this,t,e,r),a=i(this,n,e,r);return"M"+o.p0+u(o.r,o.p1,o.a1-o.a0)+(function(t,n){return t.a0==n.a0&&t.a1==n.a1}(o,a)?s(o.r,o.p1,o.r,o.p0):s(o.r,o.p1,a.r,a.p0)+u(a.r,a.p1,a.a1-a.a0)+s(a.r,a.p1,o.r,o.p0))+"Z"}function i(t,n,a,i){var u=n.call(t,a,i),s=e.call(t,u,i),l=r.call(t,u,i)-Ot,c=o.call(t,u,i)-Ot;return{r:s,a0:l,a1:c,p0:[s*Math.cos(l),s*Math.sin(l)],p1:[s*Math.cos(c),s*Math.sin(c)]}}function u(t,n,e){return"A"+t+","+t+" 0 "+ +(e>Nt)+",1 "+n}function s(t,n,e,r){return"Q 0,0 "+r}return a.radius=function(t){return arguments.length?(e=bn(t),a):e},a.source=function(n){return arguments.length?(t=bn(n),a):t},a.target=function(t){return arguments.length?(n=bn(t),a):n},a.startAngle=function(t){return arguments.length?(r=bn(t),a):r},a.endAngle=function(t){return arguments.length?(o=bn(t),a):o},a},a.svg.diagonal=function(){var t=Hr,n=Gr,e=pu;function r(r,o){var a=t.call(this,r,o),i=n.call(this,r,o),u=(a.y+i.y)/2,s=[a,{x:a.x,y:u},{x:i.x,y:u},i];return"M"+(s=s.map(e))[0]+"C"+s[1]+" "+s[2]+" "+s[3]}return r.source=function(n){return arguments.length?(t=bn(n),r):t},r.target=function(t){return arguments.length?(n=bn(t),r):n},r.projection=function(t){return arguments.length?(e=t,r):e},r},a.svg.diagonal.radial=function(){var t=a.svg.diagonal(),n=pu,e=t.projection;return t.projection=function(t){return arguments.length?e(du(n=t)):n},t},a.svg.symbol=function(){var t=gu,n=mu;function e(e,r){return(yu.get(t.call(this,e,r))||vu)(n.call(this,e,r))}return e.type=function(n){return arguments.length?(t=bn(n),e):t},e.size=function(t){return arguments.length?(n=bn(t),e):n},e};var yu=a.map({circle:vu,cross:function(t){var n=Math.sqrt(t/5)/2;return"M"+-3*n+","+-n+"H"+-n+"V"+-3*n+"H"+n+"V"+-n+"H"+3*n+"V"+n+"H"+n+"V"+3*n+"H"+-n+"V"+n+"H"+-3*n+"Z"},diamond:function(t){var n=Math.sqrt(t/(2*xu)),e=n*xu;return"M0,"+-n+"L"+e+",0 0,"+n+" "+-e+",0Z"},square:function(t){var n=Math.sqrt(t)/2;return"M"+-n+","+-n+"L"+n+","+-n+" "+n+","+n+" "+-n+","+n+"Z"},"triangle-down":function(t){var n=Math.sqrt(t/bu),e=n*bu/2;return"M0,"+e+"L"+n+","+-e+" "+-n+","+-e+"Z"},"triangle-up":function(t){var n=Math.sqrt(t/bu),e=n*bu/2;return"M0,"+-e+"L"+n+","+e+" "+-n+","+e+"Z"}});a.svg.symbolTypes=yu.keys();var bu=Math.sqrt(3),xu=Math.tan(30*Lt);J.transition=function(t){for(var n,e,r=ku||++Eu,o=Nu(t),a=[],i=Su||{time:Date.now(),ease:da,delay:0,duration:250},u=-1,s=this.length;++u<s;){a.push(n=[]);for(var l=this[u],c=-1,f=l.length;++c<f;)(e=l[c])&&Pu(e,c,o,r,i),n.push(e)}return _u(a,o,r)},J.interrupt=function(t){return this.each(null==t?Mu:wu(Nu(t)))};var Mu=wu(Nu());function wu(t){return function(){var n,e,r;(n=this[t])&&(r=n[e=n.active])&&(r.timer.c=null,r.timer.t=NaN,--n.count?delete n[e]:delete this[t],n.active+=.5,r.event&&r.event.interrupt.call(this,this.__data__,r.index))}}function _u(t,n,e){return V(t,Au),t.namespace=n,t.id=e,t}var ku,Su,Au=[],Eu=0;function Tu(t,n,e,r){var o=t.id,a=t.namespace;return dt(t,"function"==typeof e?function(t,i,u){t[a][o].tween.set(n,r(e.call(t,t.__data__,i,u)))}:(e=r(e),function(t){t[a][o].tween.set(n,e)}))}function Ru(t){return null==t&&(t=""),function(){this.textContent=t}}function Nu(t){return null==t?"__transition__":"__transition_"+t+"__"}function Pu(t,n,e,r,o){var a,i,u,s,l,c=t[e]||(t[e]={active:0,count:0}),f=c[r];function h(e){var o=c.active,h=c[o];for(var d in h&&(h.timer.c=null,h.timer.t=NaN,--c.count,delete c[o],h.event&&h.event.interrupt.call(t,t.__data__,h.index)),c)if(+d<r){var m=c[d];m.timer.c=null,m.timer.t=NaN,--c.count,delete c[d]}i.c=p,En((function(){return i.c&&p(e||1)&&(i.c=null,i.t=NaN),1}),0,a),c.active=r,f.event&&f.event.start.call(t,t.__data__,n),l=[],f.tween.forEach((function(e,r){(r=r.call(t,t.__data__,n))&&l.push(r)})),s=f.ease,u=f.duration}function p(o){for(var a=o/u,i=s(a),h=l.length;h>0;)l[--h].call(t,i);if(a>=1)return f.event&&f.event.end.call(t,t.__data__,n),--c.count?delete c[r]:delete t[e],1}f||(a=o.time,i=En((function(t){var n=f.delay;if(i.t=n+a,n<=t)return h(t-n);i.c=h}),0,a),f=c[r]={tween:new S,time:a,timer:i,delay:o.delay,duration:o.duration,ease:o.ease,index:n},o=null,++c.count)}Au.call=J.call,Au.empty=J.empty,Au.node=J.node,Au.size=J.size,a.transition=function(t,n){return t&&t.transition?ku?t.transition(n):t:a.selection().transition(t)},a.transition.prototype=Au,Au.select=function(t){var n,e,r,o=this.id,a=this.namespace,i=[];t=$(t);for(var u=-1,s=this.length;++u<s;){i.push(n=[]);for(var l=this[u],c=-1,f=l.length;++c<f;)(r=l[c])&&(e=t.call(r,r.__data__,c,u))?("__data__"in r&&(e.__data__=r.__data__),Pu(e,c,a,o,r[a][o]),n.push(e)):n.push(null)}return _u(i,a,o)},Au.selectAll=function(t){var n,e,r,o,a,i=this.id,u=this.namespace,s=[];t=K(t);for(var l=-1,c=this.length;++l<c;)for(var f=this[l],h=-1,p=f.length;++h<p;)if(r=f[h]){a=r[u][i],e=t.call(r,r.__data__,h,l),s.push(n=[]);for(var d=-1,m=e.length;++d<m;)(o=e[d])&&Pu(o,d,u,i,a),n.push(o)}return _u(s,u,i)},Au.filter=function(t){var n,e,r=[];"function"!=typeof t&&(t=ht(t));for(var o=0,a=this.length;o<a;o++){r.push(n=[]);for(var i,u=0,s=(i=this[o]).length;u<s;u++)(e=i[u])&&t.call(e,e.__data__,u,o)&&n.push(e)}return _u(r,this.namespace,this.id)},Au.tween=function(t,n){var e=this.id,r=this.namespace;return arguments.length<2?this.node()[r][e].tween.get(t):dt(this,null==n?function(n){n[r][e].tween.remove(t)}:function(o){o[r][e].tween.set(t,n)})},Au.attr=function(t,n){if(arguments.length<2){for(n in t)this.attr(n,t[n]);return this}var e="transform"==t?Sa:oa,r=a.ns.qualify(t);function o(){this.removeAttribute(r)}function i(){this.removeAttributeNS(r.space,r.local)}function u(t){return null==t?o:(t+="",function(){var n,o=this.getAttribute(r);return o!==t&&(n=e(o,t),function(t){this.setAttribute(r,n(t))})})}function s(t){return null==t?i:(t+="",function(){var n,o=this.getAttributeNS(r.space,r.local);return o!==t&&(n=e(o,t),function(t){this.setAttributeNS(r.space,r.local,n(t))})})}return Tu(this,"attr."+t,n,r.local?s:u)},Au.attrTween=function(t,n){var e=a.ns.qualify(t);return this.tween("attr."+t,e.local?function(t,r){var o=n.call(this,t,r,this.getAttributeNS(e.space,e.local));return o&&function(t){this.setAttributeNS(e.space,e.local,o(t))}}:function(t,r){var o=n.call(this,t,r,this.getAttribute(e));return o&&function(t){this.setAttribute(e,o(t))}})},Au.style=function(t,n,e){var r=arguments.length;if(r<3){if("string"!=typeof t){for(e in r<2&&(n=""),t)this.style(e,t[e],n);return this}e=""}function o(){this.style.removeProperty(t)}function a(n){return null==n?o:(n+="",function(){var r,o=c(this).getComputedStyle(this,null).getPropertyValue(t);return o!==n&&(r=oa(o,n),function(n){this.style.setProperty(t,r(n),e)})})}return Tu(this,"style."+t,n,a)},Au.styleTween=function(t,n,e){function r(r,o){var a=n.call(this,r,o,c(this).getComputedStyle(this,null).getPropertyValue(t));return a&&function(n){this.style.setProperty(t,a(n),e)}}return arguments.length<3&&(e=""),this.tween("style."+t,r)},Au.text=function(t){return Tu(this,"text",t,Ru)},Au.remove=function(){var t=this.namespace;return this.each("end.transition",(function(){var n;this[t].count<2&&(n=this.parentNode)&&n.removeChild(this)}))},Au.ease=function(t){var n=this.id,e=this.namespace;return arguments.length<1?this.node()[e][n].ease:("function"!=typeof t&&(t=a.ease.apply(a,arguments)),dt(this,(function(r){r[e][n].ease=t})))},Au.delay=function(t){var n=this.id,e=this.namespace;return arguments.length<1?this.node()[e][n].delay:dt(this,"function"==typeof t?function(r,o,a){r[e][n].delay=+t.call(r,r.__data__,o,a)}:(t=+t,function(r){r[e][n].delay=t}))},Au.duration=function(t){var n=this.id,e=this.namespace;return arguments.length<1?this.node()[e][n].duration:dt(this,"function"==typeof t?function(r,o,a){r[e][n].duration=Math.max(1,t.call(r,r.__data__,o,a))}:(t=Math.max(1,t),function(r){r[e][n].duration=t}))},Au.each=function(t,n){var e=this.id,r=this.namespace;if(arguments.length<2){var o=Su,i=ku;try{ku=e,dt(this,(function(n,o,a){Su=n[r][e],t.call(n,n.__data__,o,a)}))}finally{Su=o,ku=i}}else dt(this,(function(o){var i=o[r][e];(i.event||(i.event=a.dispatch("start","end","interrupt"))).on(t,n)}));return this},Au.transition=function(){for(var t,n,e,r=this.id,o=++Eu,a=this.namespace,i=[],u=0,s=this.length;u<s;u++){i.push(t=[]);for(var l,c=0,f=(l=this[u]).length;c<f;c++)(n=l[c])&&Pu(n,c,a,o,{time:(e=n[a][r]).time,ease:e.ease,delay:e.delay+e.duration,duration:e.duration}),t.push(n)}return _u(i,a,o)},a.svg.axis=function(){var t,n=a.scale.linear(),e=Cu,r=6,o=6,i=3,s=[10],l=null;function c(u){u.each((function(){var u,c=a.select(this),f=this.__chart__||n,h=this.__chart__=n.copy(),p=null==l?h.ticks?h.ticks.apply(h,s):h.domain():l,d=null==t?h.tickFormat?h.tickFormat.apply(h,s):L:t,m=c.selectAll(".tick").data(p,h),g=m.enter().insert("g",".domain").attr("class","tick").style("opacity",Tt),v=a.transition(m.exit()).style("opacity",Tt).remove(),y=a.transition(m.order()).style("opacity",1),b=Math.max(r,0)+i,x=xi(h),M=c.selectAll(".domain").data([0]),w=(M.enter().append("path").attr("class","domain"),a.transition(M));g.append("line"),g.append("text");var _,k,S,A,E=g.select("line"),T=y.select("line"),R=m.select("text").text(d),N=g.select("text"),P=y.select("text"),C="top"===e||"left"===e?-1:1;if("bottom"===e||"top"===e?(u=Lu,_="x",S="y",k="x2",A="y2",R.attr("dy",C<0?"0em":".71em").style("text-anchor","middle"),w.attr("d","M"+x[0]+","+C*o+"V0H"+x[1]+"V"+C*o)):(u=Uu,_="y",S="x",k="y2",A="x2",R.attr("dy",".32em").style("text-anchor",C<0?"end":"start"),w.attr("d","M"+C*o+","+x[0]+"H0V"+x[1]+"H"+C*o)),E.attr(A,C*r),N.attr(S,C*b),T.attr(k,0).attr(A,C*r),P.attr(_,0).attr(S,C*b),h.rangeBand){var O=h,U=O.rangeBand()/2;f=h=function(t){return O(t)+U}}else f.rangeBand?f=h:v.call(u,h,f);g.call(u,f,h),y.call(u,h,h)}))}return c.scale=function(t){return arguments.length?(n=t,c):n},c.orient=function(t){return arguments.length?(e=t in Ou?t+"":Cu,c):e},c.ticks=function(){return arguments.length?(s=u(arguments),c):s},c.tickValues=function(t){return arguments.length?(l=t,c):l},c.tickFormat=function(n){return arguments.length?(t=n,c):t},c.tickSize=function(t){var n=arguments.length;return n?(r=+t,o=+arguments[n-1],c):r},c.innerTickSize=function(t){return arguments.length?(r=+t,c):r},c.outerTickSize=function(t){return arguments.length?(o=+t,c):o},c.tickPadding=function(t){return arguments.length?(i=+t,c):i},c.tickSubdivide=function(){return arguments.length&&c},c};var Cu="bottom",Ou={top:1,right:1,bottom:1,left:1};function Lu(t,n,e){t.attr("transform",(function(t){var r=n(t);return"translate("+(isFinite(r)?r:e(t))+",0)"}))}function Uu(t,n,e){t.attr("transform",(function(t){var r=n(t);return"translate(0,"+(isFinite(r)?r:e(t))+")"}))}a.svg.brush=function(){var t,n,e=X(h,"brushstart","brush","brushend"),r=null,o=null,i=[0,0],u=[0,0],s=!0,l=!0,f=zu[0];function h(t){t.each((function(){var t=a.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",g).on("touchstart.brush",g),n=t.selectAll(".background").data([0]);n.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),t.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var e=t.selectAll(".resize").data(f,L);e.exit().remove(),e.enter().append("g").attr("class",(function(t){return"resize "+t})).style("cursor",(function(t){return Du[t]})).append("rect").attr("x",(function(t){return/[ew]$/.test(t)?-3:null})).attr("y",(function(t){return/^[ns]/.test(t)?-3:null})).attr("width",6).attr("height",6).style("visibility","hidden"),e.style("display",h.empty()?"none":null);var i,u=a.transition(t),s=a.transition(n);r&&(i=xi(r),s.attr("x",i[0]).attr("width",i[1]-i[0]),d(u)),o&&(i=xi(o),s.attr("y",i[0]).attr("height",i[1]-i[0]),m(u)),p(u)}))}function p(t){t.selectAll(".resize").attr("transform",(function(t){return"translate("+i[+/e$/.test(t)]+","+u[+/^s/.test(t)]+")"}))}function d(t){t.select(".extent").attr("x",i[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",i[1]-i[0])}function m(t){t.select(".extent").attr("y",u[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",u[1]-u[0])}function g(){var f,g,v=this,y=a.select(a.event.target),b=e.of(v,arguments),x=a.select(v),M=y.datum(),w=!/^(n|s)$/.test(M)&&r,_=!/^(e|w)$/.test(M)&&o,k=y.classed("extent"),S=kt(v),A=a.mouse(v),E=a.select(c(v)).on("keydown.brush",N).on("keyup.brush",P);if(a.event.changedTouches?E.on("touchmove.brush",C).on("touchend.brush",L):E.on("mousemove.brush",C).on("mouseup.brush",L),x.interrupt().selectAll("*").interrupt(),k)A[0]=i[0]-A[0],A[1]=u[0]-A[1];else if(M){var T=+/w$/.test(M),R=+/^n/.test(M);g=[i[1-T]-A[0],u[1-R]-A[1]],A[0]=i[T],A[1]=u[R]}else a.event.altKey&&(f=A.slice());function N(){32==a.event.keyCode&&(k||(f=null,A[0]-=i[1],A[1]-=u[1],k=2),B())}function P(){32==a.event.keyCode&&2==k&&(A[0]+=i[1],A[1]+=u[1],k=0,B())}function C(){var t=a.mouse(v),n=!1;g&&(t[0]+=g[0],t[1]+=g[1]),k||(a.event.altKey?(f||(f=[(i[0]+i[1])/2,(u[0]+u[1])/2]),A[0]=i[+(t[0]<f[0])],A[1]=u[+(t[1]<f[1])]):f=null),w&&O(t,r,0)&&(d(x),n=!0),_&&O(t,o,1)&&(m(x),n=!0),n&&(p(x),b({type:"brush",mode:k?"move":"resize"}))}function O(e,r,o){var a,c,h=xi(r),p=h[0],d=h[1],m=A[o],g=o?u:i,v=g[1]-g[0];if(k&&(p-=m,d-=v+m),a=(o?l:s)?Math.max(p,Math.min(d,e[o])):e[o],k?c=(a+=m)+v:(f&&(m=Math.max(p,Math.min(d,2*f[o]-a))),m<a?(c=a,a=m):c=m),g[0]!=a||g[1]!=c)return o?n=null:t=null,g[0]=a,g[1]=c,!0}function L(){C(),x.style("pointer-events","all").selectAll(".resize").style("display",h.empty()?"none":null),a.select("body").style("cursor",null),E.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),S(),b({type:"brushend"})}x.style("pointer-events","none").selectAll(".resize").style("display",null),a.select("body").style("cursor",y.style("cursor")),b({type:"brushstart"}),C()}return h.event=function(r){r.each((function(){var r=e.of(this,arguments),o={x:i,y:u,i:t,j:n},s=this.__chart__||o;this.__chart__=o,ku?a.select(this).transition().each("start.brush",(function(){t=s.i,n=s.j,i=s.x,u=s.y,r({type:"brushstart"})})).tween("brush:brush",(function(){var e=aa(i,o.x),a=aa(u,o.y);return t=n=null,function(t){i=o.x=e(t),u=o.y=a(t),r({type:"brush",mode:"resize"})}})).each("end.brush",(function(){t=o.i,n=o.j,r({type:"brush",mode:"resize"}),r({type:"brushend"})})):(r({type:"brushstart"}),r({type:"brush",mode:"resize"}),r({type:"brushend"}))}))},h.x=function(t){return arguments.length?(f=zu[!(r=t)<<1|!o],h):r},h.y=function(t){return arguments.length?(f=zu[!r<<1|!(o=t)],h):o},h.clamp=function(t){return arguments.length?(r&&o?(s=!!t[0],l=!!t[1]):r?s=!!t:o&&(l=!!t),h):r&&o?[s,l]:r?s:o?l:null},h.extent=function(e){var a,s,l,c,f;return arguments.length?(r&&(a=e[0],s=e[1],o&&(a=a[0],s=s[0]),t=[a,s],r.invert&&(a=r(a),s=r(s)),s<a&&(f=a,a=s,s=f),a==i[0]&&s==i[1]||(i=[a,s])),o&&(l=e[0],c=e[1],r&&(l=l[1],c=c[1]),n=[l,c],o.invert&&(l=o(l),c=o(c)),c<l&&(f=l,l=c,c=f),l==u[0]&&c==u[1]||(u=[l,c])),h):(r&&(t?(a=t[0],s=t[1]):(a=i[0],s=i[1],r.invert&&(a=r.invert(a),s=r.invert(s)),s<a&&(f=a,a=s,s=f))),o&&(n?(l=n[0],c=n[1]):(l=u[0],c=u[1],o.invert&&(l=o.invert(l),c=o.invert(c)),c<l&&(f=l,l=c,c=f))),r&&o?[[a,l],[s,c]]:r?[a,s]:o&&[l,c])},h.clear=function(){return h.empty()||(i=[0,0],u=[0,0],t=n=null),h},h.empty=function(){return!!r&&i[0]==i[1]||!!o&&u[0]==u[1]},a.rebind(h,e,"on")};var Du={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},zu=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],qu=zn.format=he.timeFormat,ju=qu.utc,Fu=ju("%Y-%m-%dT%H:%M:%S.%LZ");function Bu(t){return t.toISOString()}function Iu(t,n,e){function r(n){return t(n)}function o(t,e){var r=(t[1]-t[0])/e,o=a.bisect(Yu,r);return o==Yu.length?[n.year,Ti(t.map((function(t){return t/31536e6})),e)[2]]:o?n[r/Yu[o-1]<Yu[o]/r?o-1:o]:[Gu,Ti(t,e)[2]]}return r.invert=function(n){return Xu(t.invert(n))},r.domain=function(n){return arguments.length?(t.domain(n),r):t.domain().map(Xu)},r.nice=function(t,n){var e=r.domain(),a=bi(e),i=null==t?o(a,10):"number"==typeof t&&o(a,t);function u(e){return!isNaN(e)&&!t.range(e,Xu(+e+1),n).length}return i&&(t=i[0],n=i[1]),r.domain(wi(e,n>1?{floor:function(n){for(;u(n=t.floor(n));)n=Xu(n-1);return n},ceil:function(n){for(;u(n=t.ceil(n));)n=Xu(+n+1);return n}}:t))},r.ticks=function(t,n){var e=bi(r.domain()),a=null==t?o(e,10):"number"==typeof t?o(e,t):!t.range&&[{range:t},n];return a&&(t=a[0],n=a[1]),t.range(e[0],Xu(+e[1]+1),n<1?1:n)},r.tickFormat=function(){return e},r.copy=function(){return Iu(t.copy(),n,e)},Ai(r,t)}function Xu(t){return new Date(t)}qu.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Bu:Fu,Bu.parse=function(t){var n=new Date(t);return isNaN(n)?null:n},Bu.toString=Fu.toString,zn.second=Bn((function(t){return new qn(1e3*Math.floor(t/1e3))}),(function(t,n){t.setTime(t.getTime()+1e3*Math.floor(n))}),(function(t){return t.getSeconds()})),zn.seconds=zn.second.range,zn.seconds.utc=zn.second.utc.range,zn.minute=Bn((function(t){return new qn(6e4*Math.floor(t/6e4))}),(function(t,n){t.setTime(t.getTime()+6e4*Math.floor(n))}),(function(t){return t.getMinutes()})),zn.minutes=zn.minute.range,zn.minutes.utc=zn.minute.utc.range,zn.hour=Bn((function(t){var n=t.getTimezoneOffset()/60;return new qn(36e5*(Math.floor(t/36e5-n)+n))}),(function(t,n){t.setTime(t.getTime()+36e5*Math.floor(n))}),(function(t){return t.getHours()})),zn.hours=zn.hour.range,zn.hours.utc=zn.hour.utc.range,zn.month=Bn((function(t){return(t=zn.day(t)).setDate(1),t}),(function(t,n){t.setMonth(t.getMonth()+n)}),(function(t){return t.getMonth()})),zn.months=zn.month.range,zn.months.utc=zn.month.utc.range;var Yu=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Vu=[[zn.second,1],[zn.second,5],[zn.second,15],[zn.second,30],[zn.minute,1],[zn.minute,5],[zn.minute,15],[zn.minute,30],[zn.hour,1],[zn.hour,3],[zn.hour,6],[zn.hour,12],[zn.day,1],[zn.day,2],[zn.week,1],[zn.month,1],[zn.month,3],[zn.year,1]],Hu=qu.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",$e]]),Gu={range:function(t,n,e){return a.range(Math.ceil(t/e)*e,+n,e).map(Xu)},floor:L,ceil:L};Vu.year=zn.year,zn.scale=function(){return Iu(a.scale.linear(),Vu,Hu)};var Wu=Vu.map((function(t){return[t[0].utc,t[1]]})),Zu=ju.multi([[".%L",function(t){return t.getUTCMilliseconds()}],[":%S",function(t){return t.getUTCSeconds()}],["%I:%M",function(t){return t.getUTCMinutes()}],["%I %p",function(t){return t.getUTCHours()}],["%a %d",function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],["%b %d",function(t){return 1!=t.getUTCDate()}],["%B",function(t){return t.getUTCMonth()}],["%Y",$e]]);function Ju(t){return JSON.parse(t.responseText)}function $u(t){var n=s.createRange();return n.selectNode(s.body),n.createContextualFragment(t.responseText)}Wu.year=zn.year.utc,zn.scale.utc=function(){return Iu(a.scale.linear(),Wu,Zu)},a.text=xn((function(t){return t.responseText})),a.json=function(t,n){return Mn(t,"application/json",Ju,n)},a.html=function(t,n){return Mn(t,"text/html",$u,n)},a.xml=xn((function(t){return t.responseXML})),this.d3=a,void 0===(o="function"==typeof(r=a)?r.call(n,e,n,t):r)||(t.exports=o)}()}])},t.exports=o()},function(t,n,e){"use strict";var r=e(26);function o(){}t.exports=function(){function t(t,n,e,o,a,i){if(i!==r){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function n(){return t}t.isRequired=t;var e={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:n,element:t,instanceOf:n,node:t,objectOf:n,oneOf:n,oneOfType:n,shape:n,exact:n};return e.checkPropTypes=o,e.PropTypes=e,e}},function(t,n,e){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,n,e){"use strict";var r=e(7),o=e(28),a=e(29),i=e(6),u=e(8),s=e(23),l=e(30);function c(t,n){return n=n.split("// __split__"),new o.Program(t,n[0],n[1])}t.exports=function(t,n,e){var f,h,p,d,m,g,v,y,b,x,M,w,_,k,S,A,E,T,R,N,P,C,O,L,U,D,z,q=this,j=null,F=null,B=null,I=null,X=null,Y=null,V=0,H=!1,G=!1;function W(t){p.viewport(0,0,e,e);var o=u.clone(t);o.zoom=1/f,o.translation.x=0,o.translation.y=0;for(var a=r.mat4.create(),i=0;i<3;i++){var s=r.vec3.random(r.vec3.create(),1);r.mat4.rotate(a,a,10*Math.random(),s)}o.rotation=r.mat4.multiply(r.mat4.create(),a,o.rotation),E.bind(),p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT);var l=u.getRect(o),c=r.mat4.create();r.mat4.ortho(c,l.left,l.right,l.bottom,l.top,0,f);var h=r.mat4.create();r.mat4.lookAt(h,[0,0,0],[0,0,-1],[0,1,0]);var d=r.mat4.create();r.mat4.translate(d,d,[0,0,-f/2]),r.mat4.multiply(d,d,o.rotation),P.setUniform("uProjection","Matrix4fv",!1,c),P.setUniform("uView","Matrix4fv",!1,h),P.setUniform("uModel","Matrix4fv",!1,d),P.setUniform("uBottomLeft","2fv",[l.left,l.bottom]),P.setUniform("uTopRight","2fv",[l.right,l.top]),P.setUniform("uAtomScale","1f",2.5*o.atomScale),P.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),P.setUniform("uRes","1f",e),P.setUniform("uDepth","1f",f),P.setUniform("uMode","1i",0),P.setUniform("uAtomShade","1f",t.atomShade),j.render(),t.bonds&&null!=F&&(C.setUniform("uProjection","Matrix4fv",!1,c),C.setUniform("uView","Matrix4fv",!1,h),C.setUniform("uModel","Matrix4fv",!1,d),C.setUniform("uRotation","Matrix4fv",!1,o.rotation),C.setUniform("uDepth","1f",f),C.setUniform("uBottomLeft","2fv",[l.left,l.bottom]),C.setUniform("uTopRight","2fv",[l.right,l.top]),C.setUniform("uRes","1f",e),C.setUniform("uBondRadius","1f",2.5*u.getBondRadius(t)),C.setUniform("uBondShade","1f",t.bondShade),C.setUniform("uAtomScale","1f",2.5*t.atomScale),C.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),C.setUniform("uMode","1i",0),F.render()),p.viewport(0,0,n,n);var y=u.getRect(t),x=u.getRect(o),M=r.mat4.invert(r.mat4.create(),a);T.bind(),p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT),O.setUniform("uSceneDepth","1i",g.index),O.setUniform("uSceneNormal","1i",m.index),O.setUniform("uRandRotDepth","1i",v.index),O.setUniform("uAccumulator","1i",b.index),O.setUniform("uSceneBottomLeft","2fv",[y.left,y.bottom]),O.setUniform("uSceneTopRight","2fv",[y.right,y.top]),O.setUniform("uRotBottomLeft","2fv",[x.left,x.bottom]),O.setUniform("uRotTopRight","2fv",[x.right,x.top]),O.setUniform("uRes","1f",n),O.setUniform("uDepth","1f",f),O.setUniform("uRot","Matrix4fv",!1,a),O.setUniform("uInvRot","Matrix4fv",!1,M),O.setUniform("uSampleCount","1i",V),B.render(),b.activate(),b.bind(),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGBA,0,0,n,n,0)}q.getAOProgress=function(){return V/1024},q.initialize=function(){t.width=t.height=n,(p=t.getContext("webgl")).enable(p.DEPTH_TEST),p.enable(p.CULL_FACE),p.clearColor(0,0,0,0),p.clearDepth(1),p.viewport(0,0,n,n),window.gl=p,o.getExtensions(p,["EXT_frag_depth","WEBGL_depth_texture"]),q.createTextures(),P=c(p,l.shaders.atom),C=c(p,l.shaders.bond),z=c(p,l.shaders["textured-quad"]),O=c(p,l.shaders.accumulator),L=c(p,l.shaders.ao),U=c(p,l.shaders.fxaa),D=c(p,l.shaders.dof);var e=[-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0],r=o.buildAttribs(p,{aPosition:3});r.aPosition.buffer.set(new Float32Array(e));var a=e.length/9;new o.Renderable(p,z,r,a),B=new o.Renderable(p,O,r,a),I=new o.Renderable(p,L,r,a),Y=new o.Renderable(p,U,r,a),X=new o.Renderable(p,D,r,a),0},q.createTextures=function(){y=new o.Texture(p,0,null,e,e),v=new o.Texture(p,1,null,e,e,{internalFormat:p.DEPTH_COMPONENT,format:p.DEPTH_COMPONENT,type:p.UNSIGNED_SHORT}),E=new o.Framebuffer(p,[y],v),d=new o.Texture(p,2,null,n,n),m=new o.Texture(p,3,null,n,n),g=new o.Texture(p,4,null,n,n,{internalFormat:p.DEPTH_COMPONENT,format:p.DEPTH_COMPONENT,type:p.UNSIGNED_SHORT}),S=new o.Framebuffer(p,[d],g),A=new o.Framebuffer(p,[m],g),b=new o.Texture(p,5,null,n,n),x=new o.Texture(p,6,null,n,n),T=new o.Framebuffer(p,[x]),k=new o.Texture(p,7,null,n,n),N=new o.Framebuffer(p,[k]),M=new o.Texture(p,8,null,n,n),w=new o.Texture(p,9,null,n,n),R=new o.Framebuffer(p,[w]),_=new o.Texture(p,10,null,n,n),new o.Framebuffer(p,[_])},q.setResolution=function(r,o){e=o,n=r,t.width=t.height=n,p.viewport(0,0,n,n),q.createTextures()},q.setSystem=function(t,n){function e(t){for(var n=[],e=0;e<36;e++)n.push.apply(n,t);return n}h=t;for(var r=o.buildAttribs(p,{aImposter:3,aPosition:3,aRadius:1,aColor:3}),u=[],s=[],l=[],c=[],f=0;f<h.atoms.length;f++){u.push.apply(u,a.position);var d=h.atoms[f];s.push.apply(s,e([d.x,d.y,d.z])),l.push.apply(l,e([i[d.symbol].radius]));var m=i[d.symbol].color;c.push.apply(c,e([m[0],m[1],m[2]]))}r.aImposter.buffer.set(new Float32Array(u)),r.aPosition.buffer.set(new Float32Array(s)),r.aRadius.buffer.set(new Float32Array(l)),r.aColor.buffer.set(new Float32Array(c));var g=u.length/9;if(j=new o.Renderable(p,P,r,g),n.bonds&&(F=null,h.bonds.length>0)){r=o.buildAttribs(p,{aImposter:3,aPosA:3,aPosB:3,aRadA:1,aRadB:1,aColA:3,aColB:3}),u=[];var v=[],y=[],b=[],x=[],M=[],w=[];for(f=0;f<h.bonds.length;f++){var _=h.bonds[f];if(_.cutoff>n.bondThreshold)break;u.push.apply(u,a.position),v.push.apply(v,e([_.posA.x,_.posA.y,_.posA.z])),y.push.apply(y,e([_.posB.x,_.posB.y,_.posB.z])),b.push.apply(b,e([_.radA])),x.push.apply(x,e([_.radB])),M.push.apply(M,e([_.colA.r,_.colA.g,_.colA.b])),w.push.apply(w,e([_.colB.r,_.colB.g,_.colB.b]))}r.aImposter.buffer.set(new Float32Array(u)),r.aPosA.buffer.set(new Float32Array(v)),r.aPosB.buffer.set(new Float32Array(y)),r.aRadA.buffer.set(new Float32Array(b)),r.aRadB.buffer.set(new Float32Array(x)),r.aColA.buffer.set(new Float32Array(M)),r.aColB.buffer.set(new Float32Array(w));g=u.length/9;F=new o.Renderable(p,C,r,g)}},q.reset=function(){V=0,H=!1,G=!1,b.reset(),x.reset()},q.render=function(t){if(void 0!==h&&null!=j){if(f=2*s.getRadius(h),H)if(G)for(var e=0;e<t.spf&&!(V>1024);e++)W(t),V++;else!function(t){G=!0,p.viewport(0,0,n,n),A.bind(),p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT);var e=u.getRect(t),o=r.mat4.create();r.mat4.ortho(o,e.left,e.right,e.bottom,e.top,0,f);var a=r.mat4.create();r.mat4.lookAt(a,[0,0,0],[0,0,-1],[0,1,0]);var i=r.mat4.create();r.mat4.translate(i,i,[0,0,-f/2]),r.mat4.multiply(i,i,t.rotation),P.setUniform("uProjection","Matrix4fv",!1,o),P.setUniform("uView","Matrix4fv",!1,a),P.setUniform("uModel","Matrix4fv",!1,i),P.setUniform("uBottomLeft","2fv",[e.left,e.bottom]),P.setUniform("uTopRight","2fv",[e.right,e.top]),P.setUniform("uAtomScale","1f",2.5*t.atomScale),P.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),P.setUniform("uRes","1f",n),P.setUniform("uDepth","1f",f),P.setUniform("uMode","1i",1),P.setUniform("uAtomShade","1f",t.atomShade),j.render(),t.bonds&&null!=F&&(A.bind(),C.setUniform("uProjection","Matrix4fv",!1,o),C.setUniform("uView","Matrix4fv",!1,a),C.setUniform("uModel","Matrix4fv",!1,i),C.setUniform("uRotation","Matrix4fv",!1,t.rotation),C.setUniform("uDepth","1f",f),C.setUniform("uBottomLeft","2fv",[e.left,e.bottom]),C.setUniform("uTopRight","2fv",[e.right,e.top]),C.setUniform("uRes","1f",n),C.setUniform("uBondRadius","1f",2.5*u.getBondRadius(t)),C.setUniform("uBondShade","1f",t.bondShade),C.setUniform("uAtomScale","1f",2.5*t.atomScale),C.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),C.setUniform("uMode","1i",1),F.render())}(t);else!function(t){H=!0,p.viewport(0,0,n,n),S.bind(),p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT);var e=u.getRect(t),o=r.mat4.create();r.mat4.ortho(o,e.left,e.right,e.bottom,e.top,0,f);var a=r.mat4.create();r.mat4.lookAt(a,[0,0,0],[0,0,-1],[0,1,0]);var i=r.mat4.create();r.mat4.translate(i,i,[0,0,-f/2]),r.mat4.multiply(i,i,t.rotation),P.setUniform("uProjection","Matrix4fv",!1,o),P.setUniform("uView","Matrix4fv",!1,a),P.setUniform("uModel","Matrix4fv",!1,i),P.setUniform("uBottomLeft","2fv",[e.left,e.bottom]),P.setUniform("uTopRight","2fv",[e.right,e.top]),P.setUniform("uAtomScale","1f",2.5*t.atomScale),P.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),P.setUniform("uRes","1f",n),P.setUniform("uDepth","1f",f),P.setUniform("uMode","1i",0),P.setUniform("uAtomShade","1f",t.atomShade),j.render(),t.bonds&&null!=F&&(S.bind(),C.setUniform("uProjection","Matrix4fv",!1,o),C.setUniform("uView","Matrix4fv",!1,a),C.setUniform("uModel","Matrix4fv",!1,i),C.setUniform("uRotation","Matrix4fv",!1,t.rotation),C.setUniform("uDepth","1f",f),C.setUniform("uBottomLeft","2fv",[e.left,e.bottom]),C.setUniform("uTopRight","2fv",[e.right,e.top]),C.setUniform("uRes","1f",n),C.setUniform("uBondRadius","1f",2.5*u.getBondRadius(t)),C.setUniform("uBondShade","1f",t.bondShade),C.setUniform("uAtomScale","1f",2.5*t.atomScale),C.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),C.setUniform("uMode","1i",0),F.render())}(t);!function(t){p.viewport(0,0,n,n),t.fxaa>0||t.dofStrength>0?N.bind():p.bindFramebuffer(p.FRAMEBUFFER,null);if(p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT),L.setUniform("uSceneColor","1i",d.index),L.setUniform("uSceneDepth","1i",g.index),L.setUniform("uAccumulatorOut","1i",x.index),L.setUniform("uRes","1f",n),L.setUniform("uAO","1f",2*t.ao),L.setUniform("uBrightness","1f",2*t.brightness),L.setUniform("uOutlineStrength","1f",t.outline),I.render(),t.fxaa>0){t.dofStrength>0?R.bind():p.bindFramebuffer(p.FRAMEBUFFER,null);for(var e=0;e<t.fxaa;e++)p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT),0==e?U.setUniform("uTexture","1i",k.index):U.setUniform("uTexture","1i",M.index),U.setUniform("uRes","1f",n),Y.render(),M.activate(),M.bind(),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGBA,0,0,n,n,0)}t.dofStrength>0&&(p.bindFramebuffer(p.FRAMEBUFFER,null),p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT),t.fxaa>0?D.setUniform("uColor","1i",M.index):D.setUniform("uColor","1i",k.index),D.setUniform("uDepth","1i",g.index),D.setUniform("uDOFPosition","1f",t.dofPosition),D.setUniform("uDOFStrength","1f",t.dofStrength),D.setUniform("uRes","1f",n),X.render())}(t)}},q.initialize()}},function(t,n){function e(t){var n=this;n.initialize=function(){n.buffer=t.createBuffer()},n.bind=function(){t.bindBuffer(t.ARRAY_BUFFER,n.buffer)},n.set=function(e){n.bind(),t.bufferData(t.ARRAY_BUFFER,e,t.STATIC_DRAW)},n.initialize()}t.exports.buildAttribs=function(t,n){var r={};for(var o in n)r[o]={buffer:new e(t),size:n[o]};return r},t.exports.getExtensions=function(t,n){for(var e={},r=0;r<n.length;r++){var o=t.getExtension(n[r]);if(null===o)throw"Extension "+n[r]+" not available.";e[n[r]]=o}return e},t.exports.Framebuffer=function(t,n,e,r){var o=this;o.initialize=function(){if(o.fb=t.createFramebuffer(),o.bind(),n.length>1){for(var a=[],i=0;i<n.length;i++)a.push(r["COLOR_ATTACHMENT"+i+"_WEBGL"]);r.drawBuffersWEBGL(a);for(i=0;i<n.length;i++)t.framebufferTexture2D(t.FRAMEBUFFER,r["COLOR_ATTACHMENT"+i+"_WEBGL"],t.TEXTURE_2D,n[i].texture,0)}else t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n[0].texture,0);void 0!==e&&t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,e.texture,0)},o.bind=function(){t.bindFramebuffer(t.FRAMEBUFFER,o.fb)},o.initialize()},t.exports.Texture=function(t,n,e,r,o,a){(a=a||{}).target=a.target||t.TEXTURE_2D,a.mag=a.mag||t.NEAREST,a.min=a.min||t.NEAREST,a.wraps=a.wraps||t.CLAMP_TO_EDGE,a.wrapt=a.wrapt||t.CLAMP_TO_EDGE,a.internalFormat=a.internalFormat||t.RGBA,a.format=a.format||t.RGBA,a.type=a.type||t.UNSIGNED_BYTE;var i=this;i.initialize=function(){i.index=n,i.activate(),i.texture=t.createTexture(),i.bind(),t.texParameteri(a.target,t.TEXTURE_MAG_FILTER,a.mag),t.texParameteri(a.target,t.TEXTURE_MIN_FILTER,a.min),t.texParameteri(a.target,t.TEXTURE_WRAP_S,a.wraps),t.texParameteri(a.target,t.TEXTURE_WRAP_T,a.wrapt),t.texImage2D(a.target,0,a.internalFormat,r,o,0,a.format,a.type,e)},i.bind=function(){t.bindTexture(a.target,i.texture)},i.activate=function(){t.activeTexture(t.TEXTURE0+i.index)},i.reset=function(){i.activate(),i.bind(),t.texImage2D(a.target,0,a.internalFormat,r,o,0,a.format,a.type,e)},i.initialize()},t.exports.GLBuffer=e,t.exports.Renderable=function(t,n,e,r){var o=this;o.primitiveCount=r,o.initialize=function(){},o.render=function(){for(name in n.use(),e){var a=e[name].buffer,i=e[name].size;try{var u=n.attribs[name].location}catch(t){throw console.log("Could not find location for",name),t}a.bind(),t.enableVertexAttribArray(u),t.vertexAttribPointer(u,i,t.FLOAT,!1,0,0)}for(name in t.drawArrays(t.TRIANGLES,0,3*r),o.buffers)t.disableVertexAttribArray(n.attributes[name].location)},o.initialize()},t.exports.InstancedRenderable=function(t,n,e,r,o){var a=this;a.initialize=function(){},a.render=function(){for(name in n.use(),e){var i=e[name].buffer,u=e[name].size;try{var s=n.attribs[name].location}catch(t){throw console.log("Could not find location for",name),t}i.bind(),t.enableVertexAttribArray(s),t.vertexAttribPointer(s,u,t.FLOAT,!1,0,0),o.vertexAttribDivisorANGLE(s,e[name].divisor)}for(name in o.drawArraysInstancedANGLE(t.TRIANGLES,0,36,r),a.buffers)t.disableVertexAttribArray(n.attributes[name].location)},a.initialize()},t.exports.Program=function(t,n,e){var r=this;r.initialize=function(){r.program=r.compileProgram(n,e),r.attribs=r.gatherAttribs(),r.uniforms=r.gatherUniforms()},r.use=function(){t.useProgram(r.program)},r.compileProgram=function(n,e){var o=r.compileShader(n,t.VERTEX_SHADER),a=r.compileShader(e,t.FRAGMENT_SHADER),i=t.createProgram();if(t.attachShader(i,o),t.attachShader(i,a),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS))throw console.log(t.getProgramInfoLog(i)),"Failed to compile program.";return i},r.compileShader=function(n,e){var r=t.createShader(e);if(t.shaderSource(r,n),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(r),a=parseInt(o.split(":")[2]),i=n.split("\n");for(var u in i){var s=parseInt(u);console.log(s+"  "+i[u]),u==a-1&&console.warn(o)}throw typeString=e==t.VERTEX_SHADER?"vertex":"fragment","Failed to compile "+typeString+" shader."}return r},r.setUniform=function(n,e,o){var a=Array.prototype.slice.call(arguments,2);r.use();try{var i=r.uniforms[n].location}catch(t){throw console.log(n),t}t["uniform"+e].apply(t,[i].concat(a))},r.gatherUniforms=function(){for(var n={},e=t.getProgramParameter(r.program,t.ACTIVE_UNIFORMS),o=0;o<e;o++){var a=t.getActiveUniform(r.program,o);n[a.name]={name:a.name,location:t.getUniformLocation(r.program,a.name),type:a.type,size:a.size}}return n},r.gatherAttribs=function(){for(var n={},e=t.getProgramParameter(r.program,t.ACTIVE_ATTRIBUTES),o=0;o<e;o++){var a=t.getActiveAttrib(r.program,o);n[a.name]={name:a.name,location:t.getAttribLocation(r.program,a.name),type:a.type,size:a.size}}return n},r.initialize()}},function(t,n){var e=-1;t.exports={position:[e,e,e,e,e,1,e,1,1,e,e,e,e,1,1,e,1,e,1,e,1,1,e,e,1,1,e,1,e,1,1,1,e,1,1,1,e,e,e,1,e,e,1,e,1,e,e,e,1,e,1,e,e,1,e,1,1,1,1,1,1,1,e,e,1,1,1,1,e,e,1,e,1,e,e,e,e,e,e,1,e,1,e,e,e,1,e,1,1,e,e,e,1,1,e,1,1,1,1,e,e,1,1,1,1,e,1,1],normal:[e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1]}},function(t,n,e){"use strict";var r={accumulator:"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uSceneDepth;\nuniform sampler2D uSceneNormal;\nuniform sampler2D uRandRotDepth;\nuniform sampler2D uAccumulator;\nuniform mat4 uRot;\nuniform mat4 uInvRot;\nuniform vec2 uSceneBottomLeft;\nuniform vec2 uSceneTopRight;\nuniform vec2 uRotBottomLeft;\nuniform vec2 uRotTopRight;\nuniform float uDepth;\nuniform float uRes;\nuniform int uSampleCount;\n\nvoid main() {\n\n    float dScene = texture2D(uSceneDepth, gl_FragCoord.xy/uRes).r;\n\n    vec3 r = vec3(uSceneBottomLeft + (gl_FragCoord.xy/uRes) * (uSceneTopRight - uSceneBottomLeft), 0.0);\n\n    r.z = -(dScene - 0.5) * uDepth;\n    r = vec3(uRot * vec4(r, 1));\n    float depth = -r.z/uDepth + 0.5;\n\n    vec2 p = (r.xy - uRotBottomLeft)/(uRotTopRight - uRotBottomLeft);\n\n    float dRandRot = texture2D(uRandRotDepth, p).r;\n\n    float ao = step(dRandRot, depth * 0.99);\n\n    vec3 normal = texture2D(uSceneNormal, gl_FragCoord.xy/uRes).rgb * 2.0 - 1.0;\n    vec3 dir = vec3(uInvRot * vec4(0, 0, 1, 0));\n    float mag = dot(dir, normal);\n    float sampled = step(0.0, mag);\n\n    ao *= sampled;\n\n    vec4 acc = texture2D(uAccumulator, gl_FragCoord.xy/uRes);\n\n    if (uSampleCount < 256) {\n        acc.r += ao/255.0;\n    } else if (uSampleCount < 512) {\n        acc.g += ao/255.0;\n    } else if (uSampleCount < 768) {\n        acc.b += ao/255.0;\n    } else {\n        acc.a += ao/255.0;\n    }\n        \n    gl_FragColor = acc;\n\n}\n",ao:"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uSceneColor;\nuniform sampler2D uSceneDepth;\nuniform sampler2D uAccumulatorOut;\nuniform float uRes;\nuniform float uAO;\nuniform float uBrightness;\nuniform float uOutlineStrength;\n\nvoid main() {\n    vec2 p = gl_FragCoord.xy/uRes;\n    vec4 sceneColor = texture2D(uSceneColor, p);\n    if (uOutlineStrength > 0.0) {\n        float depth = texture2D(uSceneDepth, p).r;\n        float r = 1.0/511.0;\n        float d0 = abs(texture2D(uSceneDepth, p + vec2(-r,  0)).r - depth);\n        float d1 = abs(texture2D(uSceneDepth, p + vec2( r,  0)).r - depth);\n        float d2 = abs(texture2D(uSceneDepth, p + vec2( 0, -r)).r - depth);\n        float d3 = abs(texture2D(uSceneDepth, p + vec2( 0,  r)).r - depth);\n        float d = max(d0, d1);\n        d = max(d, d2);\n        d = max(d, d3);\n        sceneColor.rgb *= pow(1.0 - d, uOutlineStrength * 32.0);\n        sceneColor.a = max(step(0.003, d), sceneColor.a);\n    }\n    vec4 dAccum = texture2D(uAccumulatorOut, p);\n    float shade = max(0.0, 1.0 - (dAccum.r + dAccum.g + dAccum.b + dAccum.a) * 0.25 * uAO);\n    shade = pow(shade, 2.0);\n    gl_FragColor = vec4(uBrightness * sceneColor.rgb * shade, sceneColor.a);\n}\n",atom:"#version 100\nprecision highp float;\n\nattribute vec3 aImposter;\nattribute vec3 aPosition;\nattribute float aRadius;\nattribute vec3 aColor;\n\nuniform mat4 uView;\nuniform mat4 uProjection;\nuniform mat4 uModel;\nuniform float uAtomScale;\nuniform float uRelativeAtomScale;\nuniform float uAtomShade;\n\nvarying vec3 vColor;\nvarying vec3 vPosition;\nvarying float vRadius;\n\nvoid main() {\n    vRadius = uAtomScale * (1.0 + (aRadius - 1.0) * uRelativeAtomScale);\n    gl_Position = uProjection * uView * uModel * vec4(vRadius * aImposter + aPosition, 1.0);\n    vColor = mix(aColor, vec3(1,1,1), uAtomShade);\n    vPosition = vec3(uModel * vec4(aPosition, 1));\n}\n\n\n// __split__\n\n\n#version 100\n#extension GL_EXT_frag_depth: enable\nprecision highp float;\n\nuniform vec2 uBottomLeft;\nuniform vec2 uTopRight;\nuniform float uRes;\nuniform float uDepth;\nuniform int uMode;\n\nvarying vec3 vPosition;\nvarying float vRadius;\nvarying vec3 vColor;\n\nvec2 res = vec2(uRes, uRes);\n\nfloat raySphereIntersect(vec3 r0, vec3 rd) {\n    float a = dot(rd, rd);\n    vec3 s0_r0 = r0 - vPosition;\n    float b = 2.0 * dot(rd, s0_r0);\n    float c = dot(s0_r0, s0_r0) - (vRadius * vRadius);\n    float disc = b*b - 4.0*a*c;\n    if (disc <= 0.0) {\n        return -1.0;\n    }\n    return (-b - sqrt(disc))/(2.0*a);\n}\n\nvoid main() {\n    vec3 r0 = vec3(uBottomLeft + (gl_FragCoord.xy/res) * (uTopRight - uBottomLeft), 0.0);\n    vec3 rd = vec3(0, 0, -1);\n    float t = raySphereIntersect(r0, rd);\n    if (t < 0.0) {\n        discard;\n    }\n    vec3 coord = r0 + rd * t;\n    vec3 normal = normalize(coord - vPosition);\n    if (uMode == 0) {\n        gl_FragColor = vec4(vColor, 1);\n    } else if (uMode == 1) {\n        gl_FragColor = vec4(normal * 0.5 + 0.5, 1.0);\n    }\n    gl_FragDepthEXT = -coord.z/uDepth;\n}\n",blur:"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uTexture;\nuniform float uRes;\nuniform int leftRight;\n\nvoid main() {\n    vec2 dir;\n    if (leftRight == 1) {\n        dir = vec2(1,0)/uRes;\n    } else {\n        dir = vec2(0,1)/uRes;\n    }\n    const int range = 16;\n    vec4 sample = vec4(0,0,0,0);\n    for (int i = -range; i <= range; i++) {\n        vec2 p = gl_FragCoord.xy/uRes + dir * float(i);\n        sample += texture2D(uTexture, p);\n    }\n    sample /= float(range) * 2.0 + 1.0;\n    gl_FragColor = sample;\n}\n",bond:"#version 100\nprecision highp float;\n\nattribute vec3 aImposter;\nattribute vec3 aPosA;\nattribute vec3 aPosB;\nattribute float aRadA;\nattribute float aRadB;\nattribute vec3 aColA;\nattribute vec3 aColB;\n\nuniform mat4 uView;\nuniform mat4 uProjection;\nuniform mat4 uModel;\nuniform mat4 uRotation;\nuniform float uBondRadius;\nuniform float uAtomScale;\nuniform float uRelativeAtomScale;\n\nvarying vec3 vNormal;\nvarying vec3 vPosA, vPosB;\nvarying float vRadA, vRadB;\nvarying vec3 vColA, vColB;\nvarying float vRadius;\n\nmat3 alignVector(vec3 a, vec3 b) {\n    vec3 v = cross(a, b);\n    float s = length(v);\n    float c = dot(a, b);\n    mat3 I = mat3(\n        1, 0, 0,\n        0, 1, 0,\n        0, 0, 1\n    );\n    mat3 vx = mat3(\n        0, v.z, -v.y,\n        -v.z, 0, v.x,\n        v.y, -v.x, 0\n    );\n    return I + vx + vx * vx * ((1.0 - c) / (s * s));\n}\n\nvoid main() {\n    vRadius = uBondRadius;\n    vec3 pos = vec3(aImposter);\n    // Scale the box in x and z to be bond-radius.\n    pos = pos * vec3(vRadius, 1, vRadius);\n    // Shift the origin-centered cube so that the bottom is at the origin.\n    pos = pos + vec3(0, 1, 0);\n    // Stretch the box in y so that it is the length of the bond.\n    pos = pos * vec3(1, length(aPosA - aPosB) * 0.5, 1);\n    // Find the rotation that aligns vec3(0, 1, 0) with vec3(uPosB - uPosA) and apply it.\n    vec3 a = normalize(vec3(-0.000001, 1.000001, 0.000001));\n    vec3 b = normalize(aPosB - aPosA);\n    mat3 R = alignVector(a, b);\n    pos = R * pos;\n    // Shift the cube so that the bottom is centered at the middle of atom A.\n    pos = pos + aPosA;\n\n    vec4 position = uModel * vec4(pos, 1);\n    gl_Position = uProjection * uView * position;\n    vPosA = aPosA;\n    vPosB = aPosB;\n    vRadA = uAtomScale * (1.0 + (aRadA - 1.0) * uRelativeAtomScale);\n    vRadB = uAtomScale * (1.0 + (aRadB - 1.0) * uRelativeAtomScale);\n    vColA = aColA;\n    vColB = aColB;\n}\n\n\n// __split__\n\n\n#version 100\n#extension GL_EXT_frag_depth: enable\nprecision highp float;\n\nuniform mat4 uRotation;\nuniform vec2 uBottomLeft;\nuniform vec2 uTopRight;\nuniform float uDepth;\nuniform float uRes;\nuniform float uBondShade;\nuniform int uMode;\n\nvarying vec3 vPosA, vPosB;\nvarying float vRadA, vRadB;\nvarying vec3 vColA, vColB;\nvarying float vRadius;\n\nmat3 alignVector(vec3 a, vec3 b) {\n    vec3 v = cross(a, b);\n    float s = length(v);\n    float c = dot(a, b);\n    mat3 I = mat3(\n        1, 0, 0,\n        0, 1, 0,\n        0, 0, 1\n    );\n    mat3 vx = mat3(\n        0, v.z, -v.y,\n        -v.z, 0, v.x,\n        v.y, -v.x, 0\n    );\n    return I + vx + vx * vx * ((1.0 - c) / (s * s));\n}\n\nvoid main() {\n\n    vec2 res = vec2(uRes, uRes);\n    vec3 r0 = vec3(uBottomLeft + (gl_FragCoord.xy/res) * (uTopRight - uBottomLeft), uDepth/2.0);\n    vec3 rd = vec3(0, 0, -1);\n\n    vec3 i = normalize(vPosB - vPosA);\n         i = vec3(uRotation * vec4(i, 0));\n    vec3 j = normalize(vec3(-0.000001, 1.000001, 0.000001));\n    mat3 R = alignVector(i, j);\n\n    vec3 r0p = r0 - vec3(uRotation * vec4(vPosA, 0));\n    r0p = R * r0p;\n    vec3 rdp = R * rd;\n\n    float a = dot(rdp.xz, rdp.xz);\n    float b = 2.0 * dot(rdp.xz, r0p.xz);\n    float c = dot(r0p.xz, r0p.xz) - vRadius*vRadius;\n    float disc = b*b - 4.0*a*c;\n    if (disc <= 0.0) {\n        discard;\n    }\n    float t = (-b - sqrt(disc))/(2.0*a);\n    if (t < 0.0) {\n        discard;\n    }\n\n    vec3 coord = r0p + rdp * t;\n    if (coord.y < 0.0 || coord.y > length(vPosA - vPosB)) {\n        discard;\n    }\n\n    vec3 color;\n    if (coord.y < vRadA + 0.5 * (length(vPosA - vPosB) - (vRadA + vRadB))) {\n        color = vColA;\n    } else {\n        color = vColB;\n    }\n\n    color = mix(color, vec3(1,1,1), uBondShade);\n\n    R = alignVector(j, i);\n    vec3 normal = normalize(R * vec3(coord.x, 0, coord.z));\n\n    coord = r0 + rd * t;\n    if (uMode == 0) {\n        gl_FragColor = vec4(color, 1);\n    } else if (uMode == 1) {\n        gl_FragColor = vec4(normal * 0.5 + 0.5, 1.0);\n    }\n    gl_FragDepthEXT = -(coord.z - uDepth/2.0)/uDepth;\n}\n",dof:"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uColor;\nuniform sampler2D uDepth;\nuniform float uRes;\nuniform float uDOFPosition;\nuniform float uDOFStrength;\nuniform int leftRight;\n\nvoid main() {\n\n    vec2 samples[64];\n    samples[0] = vec2(0.857612, 0.019885);\n    samples[1] = vec2(0.563809, -0.028071);\n    samples[2] = vec2(0.825599, -0.346856);\n    samples[3] = vec2(0.126584, -0.380959);\n    samples[4] = vec2(0.782948, 0.594322);\n    samples[5] = vec2(0.292148, -0.543265);\n    samples[6] = vec2(0.130700, 0.330220);\n    samples[7] = vec2(0.236088, 0.159604);\n    samples[8] = vec2(-0.305259, 0.810505);\n    samples[9] = vec2(0.269616, 0.923026);\n    samples[10] = vec2(0.484486, 0.371845);\n    samples[11] = vec2(-0.638057, 0.080447);\n    samples[12] = vec2(0.199629, 0.667280);\n    samples[13] = vec2(-0.861043, -0.370583);\n    samples[14] = vec2(-0.040652, -0.996174);\n    samples[15] = vec2(0.330458, -0.282111);\n    samples[16] = vec2(0.647795, -0.214354);\n    samples[17] = vec2(0.030422, -0.189908);\n    samples[18] = vec2(0.177430, -0.721124);\n    samples[19] = vec2(-0.461163, -0.327434);\n    samples[20] = vec2(-0.410012, -0.734504);\n    samples[21] = vec2(-0.616334, -0.626069);\n    samples[22] = vec2(0.590759, -0.726479);\n    samples[23] = vec2(-0.590794, 0.805365);\n    samples[24] = vec2(-0.924561, -0.163739);\n    samples[25] = vec2(-0.323028, 0.526960);\n    samples[26] = vec2(0.642128, 0.752577);\n    samples[27] = vec2(0.173625, -0.952386);\n    samples[28] = vec2(0.759014, 0.330311);\n    samples[29] = vec2(-0.360526, -0.032013);\n    samples[30] = vec2(-0.035320, 0.968156);\n    samples[31] = vec2(0.585478, -0.431068);\n    samples[32] = vec2(-0.244766, -0.906947);\n    samples[33] = vec2(-0.853096, 0.184615);\n    samples[34] = vec2(-0.089061, 0.104648);\n    samples[35] = vec2(-0.437613, 0.285308);\n    samples[36] = vec2(-0.654098, 0.379841);\n    samples[37] = vec2(-0.128663, 0.456572);\n    samples[38] = vec2(0.015980, -0.568170);\n    samples[39] = vec2(-0.043966, -0.771940);\n    samples[40] = vec2(0.346512, -0.071238);\n    samples[41] = vec2(-0.207921, -0.209121);\n    samples[42] = vec2(-0.624075, -0.189224);\n    samples[43] = vec2(-0.120618, 0.689339);\n    samples[44] = vec2(-0.664679, -0.410200);\n    samples[45] = vec2(0.371945, -0.880573);\n    samples[46] = vec2(-0.743251, 0.629998);\n    samples[47] = vec2(-0.191926, -0.413946);\n    samples[48] = vec2(0.449574, 0.833373);\n    samples[49] = vec2(0.299587, 0.449113);\n    samples[50] = vec2(-0.900432, 0.399319);\n    samples[51] = vec2(0.762613, -0.544796);\n    samples[52] = vec2(0.606462, 0.174233);\n    samples[53] = vec2(0.962185, -0.167019);\n    samples[54] = vec2(0.960990, 0.249552);\n    samples[55] = vec2(0.570397, 0.559146);\n    samples[56] = vec2(-0.537514, 0.555019);\n    samples[57] = vec2(0.108491, -0.003232);\n    samples[58] = vec2(-0.237693, -0.615428);\n    samples[59] = vec2(-0.217313, 0.261084);\n    samples[60] = vec2(-0.998966, 0.025692);\n    samples[61] = vec2(-0.418554, -0.527508);\n    samples[62] = vec2(-0.822629, -0.567797);\n    samples[63] = vec2(0.061945, 0.522105);\n\n    float invRes = 1.0/uRes;\n    vec2 coord = gl_FragCoord.xy * invRes;\n\n    float strength = uDOFStrength * uRes/768.0;\n\n    float depth = texture2D(uDepth, coord).r;\n    float range = uDOFPosition - depth;\n    float scale = abs(range);\n\n    vec4 sample = texture2D(uColor, coord);\n    float count = 1.0;\n    for(int i = 0; i < 64; i++) {\n        vec2 p = samples[i];\n        p = coord + scale * 64.0 * strength * p * invRes;\n        float d = texture2D(uDepth, p).r;\n        float r = uDOFPosition - d;\n        float s = abs(r);\n        sample += texture2D(uColor, p) * s;\n        count += s;\n    }\n\n    gl_FragColor = sample/count;\n}",fxaa:"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uTexture;\nuniform float uRes;\n\nvoid main() {\n    float FXAA_SPAN_MAX = 8.0;\n    float FXAA_REDUCE_MUL = 1.0/8.0;\n    float FXAA_REDUCE_MIN = 1.0/128.0;\n\n    vec2 texCoords = gl_FragCoord.xy/uRes;\n\n    vec4 rgbNW = texture2D(uTexture, texCoords + (vec2(-1.0, -1.0) / uRes));\n    vec4 rgbNE = texture2D(uTexture, texCoords + (vec2(1.0, -1.0) / uRes));\n    vec4 rgbSW = texture2D(uTexture, texCoords + (vec2(-1.0, 1.0) / uRes));\n    vec4 rgbSE = texture2D(uTexture, texCoords + (vec2(1.0, 1.0) / uRes));\n    vec4 rgbM  = texture2D(uTexture, texCoords);\n\n    vec4 luma = vec4(0.299, 0.587, 0.114, 1.0);\n    float lumaNW = dot(rgbNW, luma);\n    float lumaNE = dot(rgbNE, luma);\n    float lumaSW = dot(rgbSW, luma);\n    float lumaSE = dot(rgbSE, luma);\n    float lumaM  = dot(rgbM,  luma);\n\n    float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n    float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n    vec2 dir;\n    dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n    dir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n    float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n    float rcpDirMin = 1.0/(min(abs(dir.x), abs(dir.y)) + dirReduce);\n\n    dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) / uRes;\n\n    vec4 rgbA = (1.0/2.0) * \n        (texture2D(uTexture, texCoords.xy + dir * (1.0/3.0 - 0.5)) + \n         texture2D(uTexture, texCoords.xy + dir * (2.0/3.0 - 0.5)));\n    vec4 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * \n        (texture2D(uTexture, texCoords.xy + dir * (0.0/3.0 - 0.5)) +\n         texture2D(uTexture, texCoords.xy + dir * (3.0/3.0 - 0.5)));\n    float lumaB = dot(rgbB, luma);\n\n    if((lumaB < lumaMin) || (lumaB > lumaMax)){\n        gl_FragColor = rgbA;\n    } else {\n        gl_FragColor = rgbB;\n    }\n\n}","textured-quad":"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uTexture;\nuniform float uRes;\n\nvoid main() {\n    gl_FragColor = texture2D(uTexture, gl_FragCoord.xy/uRes);\n}\n"};t.exports={shaders:r}},function(t,n,e){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=e(8);t.exports=function(t){if(arguments.length>1)throw"Error: The Speck Interactions module has changed!";if(0===arguments.length||"object"!==r(t))throw"Error: Arguments not provided to interactions";var n=void 0===t.scrollZoom||t.scrollZoom,e=t.container,a=t.getRotation,i=t.setRotation,u=t.getTranslation,s=t.setTranslation,l=t.getZoom,c=t.setZoom,f=t.refreshView,h={buttonDown:!1,shiftDown:!1,lastX:0,lastY:0};function p(t){0===t.button&&(h={buttonDown:!0,shiftDown:h.shiftDown,lastX:t.clientX,lastY:t.clientY})}function d(t){if(0===t.button){if(!h.buttonDown)return;h.buttonDown=!1}}function m(t){h.shiftDown=t.shiftKey}function g(t){if(h.buttonDown&&0!==t.buttons){t.preventDefault();var n=t.clientX-h.lastX,e=t.clientY-h.lastY;if(0!==n||0!==e){if(h.lastX=t.clientX,h.lastY=t.clientY,h.shiftDown){var r=u(),c=.001/l();s({x:r.x-n*c,y:r.y+e*c})}else{var p={rotation:new Float32Array(a())};o.rotate(p,n,e),i(p.rotation)}f()}}}function v(t){t.preventDefault(),c(l()*(t.deltaY<0?1/.9:.9)),f()}function y(){e.removeEventListener("mousedown",p),window.removeEventListener("mouseup",d),window.removeEventListener("keydown",m),window.removeEventListener("keyup",m),window.removeEventListener("mousemove",g),e.removeEventListener("wheel",v)}return e.addEventListener("mousedown",p),window.addEventListener("mouseup",d),window.addEventListener("keydown",m),window.addEventListener("keyup",m),window.addEventListener("mousemove",g),n&&e.addEventListener("wheel",v),y}},function(t,n){t.exports={default:{atomScale:.6,relativeAtomScale:1,bondScale:.5,ao:.75,aoRes:256,brightness:.5,outline:0,spf:32,bonds:!1,bondThreshold:1.2,bondShade:.5,atomShade:.5,dofStrength:0,dofPosition:.5,fxaa:1},stickball:{atomScale:.24,relativeAtomScale:.64,bondScale:.5,bonds:!0,bondThreshold:1.2},toon:{ao:0,spf:0,brightness:.5,outline:1},licorice:{atomScale:.1,relativeAtomScale:0,bondScale:1,bonds:!0,bondThreshold:1.2}}},function(t,n,e){"use strict";e.r(n);var r=e(10),o=e(20),a=e(1),i=e.n(a),u=e(0),s=e.n(u),l=e(24),c=e(47);function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function h(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function d(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function m(t,n){return(m=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var g=function(t){function n(t){var e;return function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n),(e=function(t,n){return!n||"object"!==f(n)&&"function"!=typeof n?d(t):n}(this,p(n).call(this,t))).renderNewSequences=e.renderNewSequences.bind(d(e)),e.containerRef=i.a.createRef(),e}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&m(t,n)}(n,t),e=n,(r=[{key:"componentDidMount",value:function(){var t=this.props,n=t.height,e=t.width,r=t.nodeFillColor,o=t.colorScheme,a=t.customColors,i=t.allowPanningAndZooming;this._fornaContainer=new l.FornaContainer(this.containerRef.current,{initialSize:[e,n],allowPanningAndZooming:i}),this._fornaContainer.addCustomColors(a),this._fornaContainer.changeColorScheme(o),this.renderNewSequences(),void 0!==r&&this._fornaContainer.setOutlineColor(r)}},{key:"componentDidUpdate",value:function(){this.renderNewSequences()}},{key:"renderNewSequences",value:function(){var t=this,n=this.props.sequences;this._fornaContainer&&(this._fornaContainer.clearNodes(),n.forEach((function(n){var e=Object.assign({},n.options,{sequence:n.sequence,structure:n.structure});t._fornaContainer.addRNA(n.structure,e)})))}},{key:"shouldComponentUpdate",value:function(t){var n=this.props,e=n.sequences,r=n.colorScheme;return!c.a(e,t.sequences)||(this._fornaContainer.addCustomColors(t.customColors),this._fornaContainer.changeColorScheme(r),void 0!==t.nodeFillColor&&this._fornaContainer.setOutlineColor(t.nodeFillColor),!1)}},{key:"render",value:function(){return i.a.createElement("div",{id:this.props.id,ref:this.containerRef,style:{outline:"none"}})}}])&&h(e.prototype,r),o&&h(e,o),n}(a.Component);g.propTypes={id:s.a.string,height:s.a.number,width:s.a.number,sequences:s.a.arrayOf(s.a.exact({sequence:s.a.string.isRequired,structure:s.a.string.isRequired,options:s.a.exact({applyForce:s.a.bool,circularizeExternal:s.a.bool,labelInterval:s.a.number,name:s.a.string,avoidOthers:s.a.bool})})),nodeFillColor:s.a.string,colorScheme:s.a.oneOf(["sequence","structure","positions","custom"]),customColors:s.a.exact({domain:s.a.arrayOf(s.a.number),range:s.a.arrayOf(s.a.string),colorValues:s.a.objectOf(s.a.objectOf(s.a.oneOfType([s.a.string,s.a.number])))}),allowPanningAndZooming:s.a.bool,setProps:s.a.func},g.defaultProps={height:500,width:300,sequences:[],allowPanningAndZooming:!0,colorScheme:"sequence"};var v=e(11),y=e(12),b=e(13),x=e(14),M=e(15),w=e(16),_=e(17),k=e(18),S=e(19);e.d(n,"AlignmentChart",(function(){return r.a})),e.d(n,"Circos",(function(){return o.a})),e.d(n,"FornaContainer",(function(){return g})),e.d(n,"Ideogram",(function(){return v.a})),e.d(n,"Igv",(function(){return y.a})),e.d(n,"Molecule2dViewer",(function(){return b.a})),e.d(n,"Molecule3dViewer",(function(){return x.a})),e.d(n,"NeedlePlot",(function(){return M.a})),e.d(n,"NglMoleculeViewer",(function(){return w.a})),e.d(n,"OncoPrint",(function(){return _.a})),e.d(n,"SequenceViewer",(function(){return k.a})),e.d(n,"Speck",(function(){return S.a}))},,function(t,n){t.exports=window.ReactDOM},,,,,,,,,,,,function(t,n,e){"use strict";var r=e(9);function o(t){for(var n,e=[];!(n=t.next()).done;)e.push(n.value);return e}function a(t,n,e){for(var r=0,o=e.length;r<o;){if(t(n,e[r]))return!0;r+=1}return!1}var i=e(5);var u="function"==typeof Object.is?Object.is:function(t,n){return t===n?0!==t||1/t==1/n:t!=t&&n!=n},s=e(3),l=Object.prototype.toString,c=function(){return"[object Arguments]"===l.call(arguments)?function(t){return"[object Arguments]"===l.call(t)}:function(t){return Object(i.a)("callee",t)}}(),f=!{toString:null}.propertyIsEnumerable("toString"),h=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],p=function(){return arguments.propertyIsEnumerable("length")}(),d=function(t,n){for(var e=0;e<t.length;){if(t[e]===n)return!0;e+=1}return!1},m="function"!=typeof Object.keys||p?Object(s.a)((function(t){if(Object(t)!==t)return[];var n,e,r=[],o=p&&c(t);for(n in t)!Object(i.a)(n,t)||o&&"length"===n||(r[r.length]=n);if(f)for(e=h.length-1;e>=0;)n=h[e],Object(i.a)(n,t)&&!d(r,n)&&(r[r.length]=n),e-=1;return r})):Object(s.a)((function(t){return Object(t)!==t?[]:Object.keys(t)})),g=Object(s.a)((function(t){return null===t?"Null":void 0===t?"Undefined":Object.prototype.toString.call(t).slice(8,-1)}));function v(t,n,e,r){var i=o(t);function u(t,n){return y(t,n,e.slice(),r.slice())}return!a((function(t,n){return!a(u,n,t)}),o(n),i)}function y(t,n,e,r){if(u(t,n))return!0;var o,a,s=g(t);if(s!==g(n))return!1;if(null==t||null==n)return!1;if("function"==typeof t["fantasy-land/equals"]||"function"==typeof n["fantasy-land/equals"])return"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](n)&&"function"==typeof n["fantasy-land/equals"]&&n["fantasy-land/equals"](t);if("function"==typeof t.equals||"function"==typeof n.equals)return"function"==typeof t.equals&&t.equals(n)&&"function"==typeof n.equals&&n.equals(t);switch(s){case"Arguments":case"Array":case"Object":if("function"==typeof t.constructor&&"Promise"===(o=t.constructor,null==(a=String(o).match(/^function (\w*)/))?"":a[1]))return t===n;break;case"Boolean":case"Number":case"String":if(typeof t!=typeof n||!u(t.valueOf(),n.valueOf()))return!1;break;case"Date":if(!u(t.valueOf(),n.valueOf()))return!1;break;case"Error":return t.name===n.name&&t.message===n.message;case"RegExp":if(t.source!==n.source||t.global!==n.global||t.ignoreCase!==n.ignoreCase||t.multiline!==n.multiline||t.sticky!==n.sticky||t.unicode!==n.unicode)return!1}for(var l=e.length-1;l>=0;){if(e[l]===t)return r[l]===n;l-=1}switch(s){case"Map":return t.size===n.size&&v(t.entries(),n.entries(),e.concat([t]),r.concat([n]));case"Set":return t.size===n.size&&v(t.values(),n.values(),e.concat([t]),r.concat([n]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var c=m(t);if(c.length!==m(n).length)return!1;var f=e.concat([t]),h=r.concat([n]);for(l=c.length-1;l>=0;){var p=c[l];if(!Object(i.a)(p,n)||!y(n[p],t[p],f,h))return!1;l-=1}return!0}var b=Object(r.a)((function(t,n){return y(t,n,[],[])}));n.a=b}]);
\ No newline at end of file
+window.dash_bio=function(t){function n(n){for(var e,o,a=n[0],i=n[1],u=0,s=[];u<a.length;u++)o=a[u],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&s.push(r[o][0]),r[o]=0;for(e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e]);for(h&&h(n);s.length;)s.shift()()}var e={},r={11:0};function o(t){return a.p+""+({0:"async-alignment",1:"async-circos",2:"async-ideogram",3:"async-igv",4:"async-moleculeviewer2",5:"async-moleculeviewer3",6:"async-needle",7:"async-nglmoleculeviewer",8:"async-onco",9:"async-sequence",10:"async-speck"}[t]||t)+".js"}function a(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.e=function(t){var n=[],e=r[t];if(0!==e)if(e)n.push(e[2]);else{var i=new Promise((function(n,o){e=r[t]=[n,o]}));n.push(e[2]=i);var u,s=document.createElement("script");s.charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.src=o(t);var l=new Error;u=function(n){s.onerror=s.onload=null,clearTimeout(c);var e=r[t];if(0!==e){if(e){var o=n&&("load"===n.type?"missing":n.type),a=n&&n.target&&n.target.src;l.message="Loading chunk "+t+" failed.\n("+o+": "+a+")",l.name="ChunkLoadError",l.type=o,l.request=a,e[1](l)}r[t]=void 0}};var c=setTimeout((function(){u({type:"timeout",target:s})}),12e4);s.onerror=s.onload=u,document.head.appendChild(s)}return Promise.all(n)},a.m=t,a.c=e,a.d=function(t,n,e){a.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,n){if(1&n&&(t=a(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(a.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var r in t)a.d(e,r,function(n){return t[n]}.bind(null,r));return e},a.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(n,"a",n),n},a.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},a.p="",a.oe=function(t){throw console.error(t),t};var i,u=function(){var t=document.currentScript;if(!t){for(var n=document.getElementsByTagName("script"),e=[],r=0;r<n.length;r++)e.push(n[r]);t=(e=e.filter((function(t){return!t.async&&!t.text&&!t.textContent}))).slice(-1)[0]}return t};if(Object.defineProperty(a,"p",{get:(i=u().src.split("/").slice(0,-1).join("/")+"/",function(){return i})}),void 0!==o){var s=o;o=function(t){var n=function(t){return/\/_dash-component-suites\//.test(t.src)}(u()),e=s(t);if(!n)return e;var r=e.split("/"),o=r.slice(-1)[0].split(".");return o.splice(1,0,"v0_6_1m1613375614"),r.splice(-1,1,o.join(".")),r.join("/")}}var l=window.webpackJsonpdash_bio=window.webpackJsonpdash_bio||[],c=l.push.bind(l);l.push=n,l=l.slice();for(var f=0;f<l.length;f++)n(l[f]);var h=c;return a(a.s=33)}([function(t,n,e){t.exports=e(25)()},function(t,n){t.exports=window.React},function(t,n,e){"use strict";n.a={alignmentChart:function(){return e.e(0).then(e.bind(null,36))},circos:function(){return e.e(1).then(e.bind(null,37))},ideogram:function(){return Promise.all([e.e(0),e.e(2)]).then(e.bind(null,38))},igv:function(){return Promise.all([e.e(0),e.e(3)]).then(e.bind(null,39))},molecule2dViewer:function(){return Promise.all([e.e(0),e.e(4)]).then(e.bind(null,40))},molecule3dViewer:function(){return Promise.all([e.e(0),e.e(5)]).then(e.bind(null,41))},nglmoleculeViewer:function(){return Promise.all([e.e(0),e.e(7)]).then(e.bind(null,42))},needlePlot:function(){return Promise.all([e.e(0),e.e(6)]).then(e.bind(null,45))},oncoPrint:function(){return Promise.all([e.e(0),e.e(8)]).then(e.bind(null,43))},sequenceViewer:function(){return Promise.all([e.e(0),e.e(9)]).then(e.bind(null,44))},speck:function(){return e.e(10).then(e.bind(null,46))}}},function(t,n,e){"use strict";e.d(n,"a",(function(){return o}));var r=e(4);function o(t){return function n(e){return 0===arguments.length||Object(r.a)(e)?n:t.apply(this,arguments)}}},function(t,n,e){"use strict";function r(t){return null!=t&&"object"==typeof t&&!0===t["@@functional/placeholder"]}e.d(n,"a",(function(){return r}))},function(t,n,e){"use strict";function r(t,n){return Object.prototype.hasOwnProperty.call(n,t)}e.d(n,"a",(function(){return r}))},function(t,n){t.exports={},t.exports[0]=t.exports.Xx={symbol:"Xx",name:"unknown",mass:1,radius:1,color:[1,.078,.576],number:0},t.exports[1]=t.exports.H={symbol:"H",name:"hydrogen",mass:1.00794,radius:.31,color:[1,1,1],number:1},t.exports[2]=t.exports.He={symbol:"He",name:"helium",mass:4.002602,radius:.28,color:[.851,1,1],number:2},t.exports[3]=t.exports.Li={symbol:"Li",name:"lithium",mass:6.941,radius:1.28,color:[.8,.502,1],number:3},t.exports[4]=t.exports.Be={symbol:"Be",name:"beryllium",mass:9.012182,radius:.96,color:[.761,1,0],number:4},t.exports[5]=t.exports.B={symbol:"B",name:"boron",mass:10.811,radius:.84,color:[1,.71,.71],number:5},t.exports[6]=t.exports.C={symbol:"C",name:"carbon",mass:12.0107,radius:.73,color:[.565,.565,.565],number:6},t.exports[7]=t.exports.N={symbol:"N",name:"nitrogen",mass:14.0067,radius:.71,color:[.188,.314,.973],number:7},t.exports[8]=t.exports.O={symbol:"O",name:"oxygen",mass:15.9994,radius:.66,color:[1,.051,.051],number:8},t.exports[9]=t.exports.F={symbol:"F",name:"fluorine",mass:18.9984032,radius:.57,color:[.565,.878,.314],number:9},t.exports[10]=t.exports.Ne={symbol:"Ne",name:"neon",mass:20.1797,radius:.58,color:[.702,.89,.961],number:10},t.exports[11]=t.exports.Na={symbol:"Na",name:"sodium",mass:22.98976928,radius:1.66,color:[.671,.361,.949],number:11},t.exports[12]=t.exports.Mg={symbol:"Mg",name:"magnesium",mass:24.305,radius:1.41,color:[.541,1,0],number:12},t.exports[13]=t.exports.Al={symbol:"Al",name:"aluminum",mass:26.9815386,radius:1.21,color:[.749,.651,.651],number:13},t.exports[14]=t.exports.Si={symbol:"Si",name:"silicon",mass:28.0855,radius:1.11,color:[.941,.784,.627],number:14},t.exports[15]=t.exports.P={symbol:"P",name:"phosphorus",mass:30.973762,radius:1.07,color:[1,.502,0],number:15},t.exports[16]=t.exports.S={symbol:"S",name:"sulfur",mass:32.065,radius:1.05,color:[1,1,.188],number:16},t.exports[17]=t.exports.Cl={symbol:"Cl",name:"chlorine",mass:35.453,radius:1.02,color:[.122,.941,.122],number:17},t.exports[18]=t.exports.Ar={symbol:"Ar",name:"argon",mass:39.948,radius:1.06,color:[.502,.82,.89],number:18},t.exports[19]=t.exports.K={symbol:"K",name:"potassium",mass:39.0983,radius:2.03,color:[.561,.251,.831],number:19},t.exports[20]=t.exports.Ca={symbol:"Ca",name:"calcium",mass:40.078,radius:1.76,color:[.239,1,0],number:20},t.exports[21]=t.exports.Sc={symbol:"Sc",name:"scandium",mass:44.955912,radius:1.7,color:[.902,.902,.902],number:21},t.exports[22]=t.exports.Ti={symbol:"Ti",name:"titanium",mass:47.867,radius:1.6,color:[.749,.761,.78],number:22},t.exports[23]=t.exports.V={symbol:"V",name:"vanadium",mass:50.9415,radius:1.53,color:[.651,.651,.671],number:23},t.exports[24]=t.exports.Cr={symbol:"Cr",name:"chromium",mass:51.9961,radius:1.39,color:[.541,.6,.78],number:24},t.exports[25]=t.exports.Mn={symbol:"Mn",name:"manganese",mass:54.938045,radius:1.39,color:[.611,.478,.78],number:25},t.exports[26]=t.exports.Fe={symbol:"Fe",name:"iron",mass:55.845,radius:1.32,color:[.878,.4,.2],number:26},t.exports[27]=t.exports.Co={symbol:"Co",name:"cobalt",mass:58.6934,radius:1.26,color:[.941,.565,.627],number:27},t.exports[28]=t.exports.Ni={symbol:"Ni",name:"nickel",mass:58.933195,radius:1.24,color:[.314,.816,.314],number:28},t.exports[29]=t.exports.Cu={symbol:"Cu",name:"copper",mass:63.546,radius:1.32,color:[.784,.502,.2],number:29},t.exports[30]=t.exports.Zn={symbol:"Zn",name:"zinc",mass:65.38,radius:1.22,color:[.49,.502,.69],number:30},t.exports[31]=t.exports.Ga={symbol:"Ga",name:"gallium",mass:69.723,radius:1.22,color:[.761,.561,.561],number:31},t.exports[32]=t.exports.Ge={symbol:"Ge",name:"germanium",mass:72.64,radius:1.2,color:[.4,.561,.561],number:32},t.exports[33]=t.exports.As={symbol:"As",name:"arsenic",mass:74.9216,radius:1.19,color:[.741,.502,.89],number:33},t.exports[34]=t.exports.Se={symbol:"Se",name:"selenium",mass:78.96,radius:1.2,color:[1,.631,0],number:34},t.exports[35]=t.exports.Br={symbol:"Br",name:"bromine",mass:79.904,radius:1.2,color:[.651,.161,.161],number:35},t.exports[36]=t.exports.Kr={symbol:"Kr",name:"krypton",mass:83.798,radius:1.16,color:[.361,.722,.82],number:36},t.exports[37]=t.exports.Rb={symbol:"Rb",name:"rubidium",mass:85.4678,radius:2.2,color:[.439,.18,.69],number:37},t.exports[38]=t.exports.Sr={symbol:"Sr",name:"strontium",mass:87.62,radius:1.95,color:[0,1,0],number:38},t.exports[39]=t.exports.Y={symbol:"Y",name:"yttrium",mass:88.90585,radius:1.9,color:[.58,1,1],number:39},t.exports[40]=t.exports.Zr={symbol:"Zr",name:"zirconium",mass:91.224,radius:1.75,color:[.58,.878,.878],number:40},t.exports[41]=t.exports.Nb={symbol:"Nb",name:"niobium",mass:92.90638,radius:1.64,color:[.451,.761,.788],number:41},t.exports[42]=t.exports.Mo={symbol:"Mo",name:"molybdenum",mass:95.96,radius:1.54,color:[.329,.71,.71],number:42},t.exports[43]=t.exports.Tc={symbol:"Tc",name:"technetium",mass:98,radius:1.47,color:[.231,.62,.62],number:43},t.exports[44]=t.exports.Ru={symbol:"Ru",name:"ruthenium",mass:101.07,radius:1.46,color:[.141,.561,.561],number:44},t.exports[45]=t.exports.Rh={symbol:"Rh",name:"rhodium",mass:102.9055,radius:1.42,color:[.039,.49,.549],number:45},t.exports[46]=t.exports.Pd={symbol:"Pd",name:"palladium",mass:106.42,radius:1.39,color:[0,.412,.522],number:46},t.exports[47]=t.exports.Ag={symbol:"Ag",name:"silver",mass:107.8682,radius:1.45,color:[.753,.753,.753],number:47},t.exports[48]=t.exports.Cd={symbol:"Cd",name:"cadmium",mass:112.411,radius:1.44,color:[1,.851,.561],number:48},t.exports[49]=t.exports.In={symbol:"In",name:"indium",mass:114.818,radius:1.42,color:[.651,.459,.451],number:49},t.exports[50]=t.exports.Sn={symbol:"Sn",name:"tin",mass:118.71,radius:1.39,color:[.4,.502,.502],number:50},t.exports[51]=t.exports.Sb={symbol:"Sb",name:"antimony",mass:121.76,radius:1.39,color:[.62,.388,.71],number:51},t.exports[52]=t.exports.Te={symbol:"Te",name:"tellurium",mass:127.6,radius:1.38,color:[.831,.478,0],number:52},t.exports[53]=t.exports.I={symbol:"I",name:"iodine",mass:126.9047,radius:1.39,color:[.58,0,.58],number:53},t.exports[54]=t.exports.Xe={symbol:"Xe",name:"xenon",mass:131.293,radius:1.4,color:[.259,.62,.69],number:54},t.exports[55]=t.exports.Cs={symbol:"Cs",name:"cesium",mass:132.9054519,radius:2.44,color:[.341,.09,.561],number:55},t.exports[56]=t.exports.Ba={symbol:"Ba",name:"barium",mass:137.327,radius:2.15,color:[0,.788,0],number:56},t.exports[57]=t.exports.La={symbol:"La",name:"lanthanum",mass:138.90547,radius:2.07,color:[.439,.831,1],number:57},t.exports[58]=t.exports.Ce={symbol:"Ce",name:"cerium",mass:140.116,radius:2.04,color:[1,1,.78],number:58},t.exports[59]=t.exports.Pr={symbol:"Pr",name:"praseodymium",mass:140.90765,radius:2.03,color:[.851,1,.78],number:59},t.exports[60]=t.exports.Nd={symbol:"Nd",name:"neodymium",mass:144.242,radius:2.01,color:[.78,1,.78],number:60},t.exports[61]=t.exports.Pm={symbol:"Pm",name:"promethium",mass:145,radius:1.99,color:[.639,1,.78],number:61},t.exports[62]=t.exports.Sm={symbol:"Sm",name:"samarium",mass:150.36,radius:1.98,color:[.561,1,.78],number:62},t.exports[63]=t.exports.Eu={symbol:"Eu",name:"europium",mass:151.964,radius:1.98,color:[.38,1,.78],number:63},t.exports[64]=t.exports.Gd={symbol:"Gd",name:"gadolinium",mass:157.25,radius:1.96,color:[.271,1,.78],number:64},t.exports[65]=t.exports.Tb={symbol:"Tb",name:"terbium",mass:158.92535,radius:1.94,color:[.189,1,.78],number:65},t.exports[66]=t.exports.Dy={symbol:"Dy",name:"dysprosium",mass:162.5,radius:1.92,color:[.122,1,.78],number:66},t.exports[67]=t.exports.Ho={symbol:"Ho",name:"holmium",mass:164.93032,radius:1.92,color:[0,1,.612],number:67},t.exports[68]=t.exports.Er={symbol:"Er",name:"erbium",mass:167.259,radius:1.89,color:[0,.902,.459],number:68},t.exports[69]=t.exports.Tm={symbol:"Tm",name:"thulium",mass:168.93421,radius:1.9,color:[0,.831,.322],number:69},t.exports[70]=t.exports.Yb={symbol:"Yb",name:"ytterbium",mass:173.054,radius:1.87,color:[0,.749,.22],number:70},t.exports[71]=t.exports.Lu={symbol:"Lu",name:"lutetium",mass:174.9668,radius:1.87,color:[0,.671,.141],number:71},t.exports[72]=t.exports.Hf={symbol:"Hf",name:"hafnium",mass:178.49,radius:1.75,color:[.302,.761,1],number:72},t.exports[73]=t.exports.Ta={symbol:"Ta",name:"tantalum",mass:180.94788,radius:1.7,color:[.302,.651,1],number:73},t.exports[74]=t.exports.W={symbol:"W",name:"tungsten",mass:183.84,radius:1.62,color:[.129,.58,.839],number:74},t.exports[75]=t.exports.Re={symbol:"Re",name:"rhenium",mass:186.207,radius:1.51,color:[.149,.49,.671],number:75},t.exports[76]=t.exports.Os={symbol:"Os",name:"osmium",mass:190.23,radius:1.44,color:[.149,.4,.588],number:76},t.exports[77]=t.exports.Ir={symbol:"Ir",name:"iridium",mass:192.217,radius:1.41,color:[.09,.329,.529],number:77},t.exports[78]=t.exports.Pt={symbol:"Pt",name:"platinum",mass:195.084,radius:1.36,color:[.816,.816,.878],number:78},t.exports[79]=t.exports.Au={symbol:"Au",name:"gold",mass:196.966569,radius:1.36,color:[1,.82,.137],number:79},t.exports[80]=t.exports.Hg={symbol:"Hg",name:"mercury",mass:200.59,radius:1.32,color:[.722,.722,.816],number:80},t.exports[81]=t.exports.Tl={symbol:"Tl",name:"thallium",mass:204.3833,radius:1.45,color:[.651,.329,.302],number:81},t.exports[82]=t.exports.Pb={symbol:"Pb",name:"lead",mass:207.2,radius:1.46,color:[.341,.349,.38],number:82},t.exports[83]=t.exports.Bi={symbol:"Bi",name:"bismuth",mass:208.9804,radius:1.48,color:[.62,.31,.71],number:83},t.exports[84]=t.exports.Po={symbol:"Po",name:"polonium",mass:210,radius:1.4,color:[.671,.361,0],number:84},t.exports[85]=t.exports.At={symbol:"At",name:"astatine",mass:210,radius:1.5,color:[.459,.31,.271],number:85},t.exports[86]=t.exports.Rn={symbol:"Rn",name:"radon",mass:220,radius:1.5,color:[.259,.51,.588],number:86},t.exports[87]=t.exports.Fr={symbol:"Fr",name:"francium",mass:223,radius:2.6,color:[.259,0,.4],number:87},t.exports[88]=t.exports.Ra={symbol:"Ra",name:"radium",mass:226,radius:2.21,color:[0,.49,0],number:88},t.exports[89]=t.exports.Ac={symbol:"Ac",name:"actinium",mass:227,radius:2.15,color:[.439,.671,.98],number:89},t.exports[90]=t.exports.Th={symbol:"Th",name:"thorium",mass:231.03588,radius:2.06,color:[0,.729,1],number:90},t.exports[91]=t.exports.Pa={symbol:"Pa",name:"protactinium",mass:232.03806,radius:2,color:[0,.631,1],number:91},t.exports[92]=t.exports.U={symbol:"U",name:"uranium",mass:237,radius:1.96,color:[0,.561,1],number:92},t.exports[93]=t.exports.Np={symbol:"Np",name:"neptunium",mass:238.02891,radius:1.9,color:[0,.502,1],number:93},t.exports[94]=t.exports.Pu={symbol:"Pu",name:"plutonium",mass:243,radius:1.87,color:[0,.42,1],number:94},t.exports[95]=t.exports.Am={symbol:"Am",name:"americium",mass:244,radius:1.8,color:[.329,.361,.949],number:95},t.exports[96]=t.exports.Cm={symbol:"Cm",name:"curium",mass:247,radius:1.69,color:[.471,.361,.89],number:96},t.exports[97]=t.exports.Bk={symbol:"Bk",name:"berkelium",mass:247,radius:1.66,color:[.541,.31,.89],number:97},t.exports[98]=t.exports.Cf={symbol:"Cf",name:"californium",mass:251,radius:1.68,color:[.631,.212,.831],number:98},t.exports[99]=t.exports.Es={symbol:"Es",name:"einsteinium",mass:252,radius:1.65,color:[.702,.122,.831],number:99},t.exports[100]=t.exports.Fm={symbol:"Fm",name:"fermium",mass:257,radius:1.67,color:[.702,.122,.729],number:100},t.exports[101]=t.exports.Md={symbol:"Md",name:"mendelevium",mass:258,radius:1.73,color:[.702,.051,.651],number:101},t.exports[102]=t.exports.No={symbol:"No",name:"nobelium",mass:259,radius:1.76,color:[.741,.051,.529],number:102},t.exports[103]=t.exports.Lr={symbol:"Lr",name:"lawrencium",mass:262,radius:1.61,color:[.78,0,.4],number:103},t.exports[104]=t.exports.Rf={symbol:"Rf",name:"rutherfordium",mass:261,radius:1.57,color:[.8,0,.349],number:104},t.exports[105]=t.exports.Db={symbol:"Db",name:"dubnium",mass:262,radius:1.49,color:[.82,0,.31],number:105},t.exports[106]=t.exports.Sg={symbol:"Sg",name:"seaborgium",mass:266,radius:1.43,color:[.851,0,.271],number:106},t.exports[107]=t.exports.Bh={symbol:"Bh",name:"bohrium",mass:264,radius:1.41,color:[.878,0,.22],number:107},t.exports[108]=t.exports.Hs={symbol:"Hs",name:"hassium",mass:277,radius:1.34,color:[.902,0,.18],number:108},t.exports[109]=t.exports.Mt={symbol:"Mt",name:"meitnerium",mass:268,radius:1.29,color:[.922,0,.149],number:109},t.exports[110]=t.exports.Ds={symbol:"Ds",name:"Ds",mass:271,radius:1.28,color:[.922,0,.149],number:110},t.exports[111]=t.exports.Uuu={symbol:"Uuu",name:"Uuu",mass:272,radius:1.21,color:[.922,0,.149],number:111},t.exports[112]=t.exports.Uub={symbol:"Uub",name:"Uub",mass:285,radius:1.22,color:[.922,0,.149],number:112},t.exports[113]=t.exports.Uut={symbol:"Uut",name:"Uut",mass:284,radius:1.36,color:[.922,0,.149],number:113},t.exports[114]=t.exports.Uuq={symbol:"Uuq",name:"Uuq",mass:289,radius:1.43,color:[.922,0,.149],number:114},t.exports[115]=t.exports.Uup={symbol:"Uup",name:"Uup",mass:288,radius:1.62,color:[.922,0,.149],number:115},t.exports[116]=t.exports.Uuh={symbol:"Uuh",name:"Uuh",mass:292,radius:1.75,color:[.922,0,.149],number:116},t.exports[117]=t.exports.Uus={symbol:"Uus",name:"Uus",mass:294,radius:1.65,color:[.922,0,.149],number:117},t.exports[118]=t.exports.Uuo={symbol:"Uuo",name:"Uuo",mass:296,radius:1.57,color:[.922,0,.149],number:118}},function(t,n,e){!function(t){"use strict";var e={};e.exports=n,function(t){if(!n)var n=1e-6;if(!e)var e="undefined"!=typeof Float32Array?Float32Array:Array;if(!r)var r=Math.random;var o={setMatrixArrayType:function(t){e=t}};void 0!==t&&(t.glMatrix=o);var a=Math.PI/180;o.toRadian=function(t){return t*a};var i,u={};u.create=function(){var t=new e(2);return t[0]=0,t[1]=0,t},u.clone=function(t){var n=new e(2);return n[0]=t[0],n[1]=t[1],n},u.fromValues=function(t,n){var r=new e(2);return r[0]=t,r[1]=n,r},u.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t},u.set=function(t,n,e){return t[0]=n,t[1]=e,t},u.add=function(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t},u.subtract=function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t},u.sub=u.subtract,u.multiply=function(t,n,e){return t[0]=n[0]*e[0],t[1]=n[1]*e[1],t},u.mul=u.multiply,u.divide=function(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t},u.div=u.divide,u.min=function(t,n,e){return t[0]=Math.min(n[0],e[0]),t[1]=Math.min(n[1],e[1]),t},u.max=function(t,n,e){return t[0]=Math.max(n[0],e[0]),t[1]=Math.max(n[1],e[1]),t},u.scale=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t},u.scaleAndAdd=function(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t},u.distance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1];return Math.sqrt(e*e+r*r)},u.dist=u.distance,u.squaredDistance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1];return e*e+r*r},u.sqrDist=u.squaredDistance,u.length=function(t){var n=t[0],e=t[1];return Math.sqrt(n*n+e*e)},u.len=u.length,u.squaredLength=function(t){var n=t[0],e=t[1];return n*n+e*e},u.sqrLen=u.squaredLength,u.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t},u.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t},u.normalize=function(t,n){var e=n[0],r=n[1],o=e*e+r*r;return o>0&&(o=1/Math.sqrt(o),t[0]=n[0]*o,t[1]=n[1]*o),t},u.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]},u.cross=function(t,n,e){var r=n[0]*e[1]-n[1]*e[0];return t[0]=t[1]=0,t[2]=r,t},u.lerp=function(t,n,e,r){var o=n[0],a=n[1];return t[0]=o+r*(e[0]-o),t[1]=a+r*(e[1]-a),t},u.random=function(t,n){n=n||1;var e=2*r()*Math.PI;return t[0]=Math.cos(e)*n,t[1]=Math.sin(e)*n,t},u.transformMat2=function(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[2]*o,t[1]=e[1]*r+e[3]*o,t},u.transformMat2d=function(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[2]*o+e[4],t[1]=e[1]*r+e[3]*o+e[5],t},u.transformMat3=function(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[3]*o+e[6],t[1]=e[1]*r+e[4]*o+e[7],t},u.transformMat4=function(t,n,e){var r=n[0],o=n[1];return t[0]=e[0]*r+e[4]*o+e[12],t[1]=e[1]*r+e[5]*o+e[13],t},u.forEach=(i=u.create(),function(t,n,e,r,o,a){var u,s;for(n||(n=2),e||(e=0),s=r?Math.min(r*n+e,t.length):t.length,u=e;u<s;u+=n)i[0]=t[u],i[1]=t[u+1],o(i,i,a),t[u]=i[0],t[u+1]=i[1];return t}),u.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},void 0!==t&&(t.vec2=u);var s={create:function(){var t=new e(3);return t[0]=0,t[1]=0,t[2]=0,t},clone:function(t){var n=new e(3);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n},fromValues:function(t,n,r){var o=new e(3);return o[0]=t,o[1]=n,o[2]=r,o},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t},set:function(t,n,e,r){return t[0]=n,t[1]=e,t[2]=r,t},add:function(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t},subtract:function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t}};s.sub=s.subtract,s.multiply=function(t,n,e){return t[0]=n[0]*e[0],t[1]=n[1]*e[1],t[2]=n[2]*e[2],t},s.mul=s.multiply,s.divide=function(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t},s.div=s.divide,s.min=function(t,n,e){return t[0]=Math.min(n[0],e[0]),t[1]=Math.min(n[1],e[1]),t[2]=Math.min(n[2],e[2]),t},s.max=function(t,n,e){return t[0]=Math.max(n[0],e[0]),t[1]=Math.max(n[1],e[1]),t[2]=Math.max(n[2],e[2]),t},s.scale=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t},s.scaleAndAdd=function(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t[2]=n[2]+e[2]*r,t},s.distance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2];return Math.sqrt(e*e+r*r+o*o)},s.dist=s.distance,s.squaredDistance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2];return e*e+r*r+o*o},s.sqrDist=s.squaredDistance,s.length=function(t){var n=t[0],e=t[1],r=t[2];return Math.sqrt(n*n+e*e+r*r)},s.len=s.length,s.squaredLength=function(t){var n=t[0],e=t[1],r=t[2];return n*n+e*e+r*r},s.sqrLen=s.squaredLength,s.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t},s.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t},s.normalize=function(t,n){var e=n[0],r=n[1],o=n[2],a=e*e+r*r+o*o;return a>0&&(a=1/Math.sqrt(a),t[0]=n[0]*a,t[1]=n[1]*a,t[2]=n[2]*a),t},s.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]},s.cross=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=e[0],u=e[1],s=e[2];return t[0]=o*s-a*u,t[1]=a*i-r*s,t[2]=r*u-o*i,t},s.lerp=function(t,n,e,r){var o=n[0],a=n[1],i=n[2];return t[0]=o+r*(e[0]-o),t[1]=a+r*(e[1]-a),t[2]=i+r*(e[2]-i),t},s.random=function(t,n){n=n||1;var e=2*r()*Math.PI,o=2*r()-1,a=Math.sqrt(1-o*o)*n;return t[0]=Math.cos(e)*a,t[1]=Math.sin(e)*a,t[2]=o*n,t},s.transformMat4=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=e[3]*r+e[7]*o+e[11]*a+e[15];return i=i||1,t[0]=(e[0]*r+e[4]*o+e[8]*a+e[12])/i,t[1]=(e[1]*r+e[5]*o+e[9]*a+e[13])/i,t[2]=(e[2]*r+e[6]*o+e[10]*a+e[14])/i,t},s.transformMat3=function(t,n,e){var r=n[0],o=n[1],a=n[2];return t[0]=r*e[0]+o*e[3]+a*e[6],t[1]=r*e[1]+o*e[4]+a*e[7],t[2]=r*e[2]+o*e[5]+a*e[8],t},s.transformQuat=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=e[0],u=e[1],s=e[2],l=e[3],c=l*r+u*a-s*o,f=l*o+s*r-i*a,h=l*a+i*o-u*r,p=-i*r-u*o-s*a;return t[0]=c*l+p*-i+f*-s-h*-u,t[1]=f*l+p*-u+h*-i-c*-s,t[2]=h*l+p*-s+c*-u-f*-i,t},s.rotateX=function(t,n,e,r){var o=[],a=[];return o[0]=n[0]-e[0],o[1]=n[1]-e[1],o[2]=n[2]-e[2],a[0]=o[0],a[1]=o[1]*Math.cos(r)-o[2]*Math.sin(r),a[2]=o[1]*Math.sin(r)+o[2]*Math.cos(r),t[0]=a[0]+e[0],t[1]=a[1]+e[1],t[2]=a[2]+e[2],t},s.rotateY=function(t,n,e,r){var o=[],a=[];return o[0]=n[0]-e[0],o[1]=n[1]-e[1],o[2]=n[2]-e[2],a[0]=o[2]*Math.sin(r)+o[0]*Math.cos(r),a[1]=o[1],a[2]=o[2]*Math.cos(r)-o[0]*Math.sin(r),t[0]=a[0]+e[0],t[1]=a[1]+e[1],t[2]=a[2]+e[2],t},s.rotateZ=function(t,n,e,r){var o=[],a=[];return o[0]=n[0]-e[0],o[1]=n[1]-e[1],o[2]=n[2]-e[2],a[0]=o[0]*Math.cos(r)-o[1]*Math.sin(r),a[1]=o[0]*Math.sin(r)+o[1]*Math.cos(r),a[2]=o[2],t[0]=a[0]+e[0],t[1]=a[1]+e[1],t[2]=a[2]+e[2],t},s.forEach=function(){var t=s.create();return function(n,e,r,o,a,i){var u,s;for(e||(e=3),r||(r=0),s=o?Math.min(o*e+r,n.length):n.length,u=r;u<s;u+=e)t[0]=n[u],t[1]=n[u+1],t[2]=n[u+2],a(t,t,i),n[u]=t[0],n[u+1]=t[1],n[u+2]=t[2];return n}}(),s.angle=function(t,n){var e=s.fromValues(t[0],t[1],t[2]),r=s.fromValues(n[0],n[1],n[2]);s.normalize(e,e),s.normalize(r,r);var o=s.dot(e,r);return o>1?0:Math.acos(o)},s.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},void 0!==t&&(t.vec3=s);var l={create:function(){var t=new e(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},clone:function(t){var n=new e(4);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n},fromValues:function(t,n,r,o){var a=new e(4);return a[0]=t,a[1]=n,a[2]=r,a[3]=o,a},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t},set:function(t,n,e,r,o){return t[0]=n,t[1]=e,t[2]=r,t[3]=o,t},add:function(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t[3]=n[3]+e[3],t},subtract:function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t[3]=n[3]-e[3],t}};l.sub=l.subtract,l.multiply=function(t,n,e){return t[0]=n[0]*e[0],t[1]=n[1]*e[1],t[2]=n[2]*e[2],t[3]=n[3]*e[3],t},l.mul=l.multiply,l.divide=function(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t[3]=n[3]/e[3],t},l.div=l.divide,l.min=function(t,n,e){return t[0]=Math.min(n[0],e[0]),t[1]=Math.min(n[1],e[1]),t[2]=Math.min(n[2],e[2]),t[3]=Math.min(n[3],e[3]),t},l.max=function(t,n,e){return t[0]=Math.max(n[0],e[0]),t[1]=Math.max(n[1],e[1]),t[2]=Math.max(n[2],e[2]),t[3]=Math.max(n[3],e[3]),t},l.scale=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t},l.scaleAndAdd=function(t,n,e,r){return t[0]=n[0]+e[0]*r,t[1]=n[1]+e[1]*r,t[2]=n[2]+e[2]*r,t[3]=n[3]+e[3]*r,t},l.distance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2],a=n[3]-t[3];return Math.sqrt(e*e+r*r+o*o+a*a)},l.dist=l.distance,l.squaredDistance=function(t,n){var e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2],a=n[3]-t[3];return e*e+r*r+o*o+a*a},l.sqrDist=l.squaredDistance,l.length=function(t){var n=t[0],e=t[1],r=t[2],o=t[3];return Math.sqrt(n*n+e*e+r*r+o*o)},l.len=l.length,l.squaredLength=function(t){var n=t[0],e=t[1],r=t[2],o=t[3];return n*n+e*e+r*r+o*o},l.sqrLen=l.squaredLength,l.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=-n[3],t},l.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t[3]=1/n[3],t},l.normalize=function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e*e+r*r+o*o+a*a;return i>0&&(i=1/Math.sqrt(i),t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=n[3]*i),t},l.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]*n[3]},l.lerp=function(t,n,e,r){var o=n[0],a=n[1],i=n[2],u=n[3];return t[0]=o+r*(e[0]-o),t[1]=a+r*(e[1]-a),t[2]=i+r*(e[2]-i),t[3]=u+r*(e[3]-u),t},l.random=function(t,n){return n=n||1,t[0]=r(),t[1]=r(),t[2]=r(),t[3]=r(),l.normalize(t,t),l.scale(t,t,n),t},l.transformMat4=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3];return t[0]=e[0]*r+e[4]*o+e[8]*a+e[12]*i,t[1]=e[1]*r+e[5]*o+e[9]*a+e[13]*i,t[2]=e[2]*r+e[6]*o+e[10]*a+e[14]*i,t[3]=e[3]*r+e[7]*o+e[11]*a+e[15]*i,t},l.transformQuat=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=e[0],u=e[1],s=e[2],l=e[3],c=l*r+u*a-s*o,f=l*o+s*r-i*a,h=l*a+i*o-u*r,p=-i*r-u*o-s*a;return t[0]=c*l+p*-i+f*-s-h*-u,t[1]=f*l+p*-u+h*-i-c*-s,t[2]=h*l+p*-s+c*-u-f*-i,t},l.forEach=function(){var t=l.create();return function(n,e,r,o,a,i){var u,s;for(e||(e=4),r||(r=0),s=o?Math.min(o*e+r,n.length):n.length,u=r;u<s;u+=e)t[0]=n[u],t[1]=n[u+1],t[2]=n[u+2],t[3]=n[u+3],a(t,t,i),n[u]=t[0],n[u+1]=t[1],n[u+2]=t[2],n[u+3]=t[3];return n}}(),l.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},void 0!==t&&(t.vec4=l);var c={create:function(){var t=new e(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},clone:function(t){var n=new e(4);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},transpose:function(t,n){if(t===n){var e=n[1];t[1]=n[2],t[2]=e}else t[0]=n[0],t[1]=n[2],t[2]=n[1],t[3]=n[3];return t},invert:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e*a-o*r;return i?(i=1/i,t[0]=a*i,t[1]=-r*i,t[2]=-o*i,t[3]=e*i,t):null},adjoint:function(t,n){var e=n[0];return t[0]=n[3],t[1]=-n[1],t[2]=-n[2],t[3]=e,t},determinant:function(t){return t[0]*t[3]-t[2]*t[1]},multiply:function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=e[0],s=e[1],l=e[2],c=e[3];return t[0]=r*u+a*s,t[1]=o*u+i*s,t[2]=r*l+a*c,t[3]=o*l+i*c,t}};c.mul=c.multiply,c.rotate=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=Math.sin(e),s=Math.cos(e);return t[0]=r*s+a*u,t[1]=o*s+i*u,t[2]=r*-u+a*s,t[3]=o*-u+i*s,t},c.scale=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=e[0],s=e[1];return t[0]=r*u,t[1]=o*u,t[2]=a*s,t[3]=i*s,t},c.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},c.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2))},c.LDU=function(t,n,e,r){return t[2]=r[2]/r[0],e[0]=r[0],e[1]=r[1],e[3]=r[3]-t[2]*e[1],[t,n,e]},void 0!==t&&(t.mat2=c);var f={create:function(){var t=new e(6);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},clone:function(t){var n=new e(6);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},invert:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=e*a-r*o;return s?(s=1/s,t[0]=a*s,t[1]=-r*s,t[2]=-o*s,t[3]=e*s,t[4]=(o*u-a*i)*s,t[5]=(r*i-e*u)*s,t):null},determinant:function(t){return t[0]*t[3]-t[1]*t[2]},multiply:function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=e[0],c=e[1],f=e[2],h=e[3],p=e[4],d=e[5];return t[0]=r*l+a*c,t[1]=o*l+i*c,t[2]=r*f+a*h,t[3]=o*f+i*h,t[4]=r*p+a*d+u,t[5]=o*p+i*d+s,t}};f.mul=f.multiply,f.rotate=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=Math.sin(e),c=Math.cos(e);return t[0]=r*c+a*l,t[1]=o*c+i*l,t[2]=r*-l+a*c,t[3]=o*-l+i*c,t[4]=u,t[5]=s,t},f.scale=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=e[0],c=e[1];return t[0]=r*l,t[1]=o*l,t[2]=a*c,t[3]=i*c,t[4]=u,t[5]=s,t},f.translate=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=e[0],c=e[1];return t[0]=r,t[1]=o,t[2]=a,t[3]=i,t[4]=r*l+a*c+u,t[5]=o*l+i*c+s,t},f.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},f.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+1)},void 0!==t&&(t.mat2d=f);var h={create:function(){var t=new e(9);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},fromMat4:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[4],t[4]=n[5],t[5]=n[6],t[6]=n[8],t[7]=n[9],t[8]=n[10],t},clone:function(t){var n=new e(9);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},transpose:function(t,n){if(t===n){var e=n[1],r=n[2],o=n[5];t[1]=n[3],t[2]=n[6],t[3]=e,t[5]=n[7],t[6]=r,t[7]=o}else t[0]=n[0],t[1]=n[3],t[2]=n[6],t[3]=n[1],t[4]=n[4],t[5]=n[7],t[6]=n[2],t[7]=n[5],t[8]=n[8];return t},invert:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=n[6],l=n[7],c=n[8],f=c*i-u*l,h=-c*a+u*s,p=l*a-i*s,d=e*f+r*h+o*p;return d?(d=1/d,t[0]=f*d,t[1]=(-c*r+o*l)*d,t[2]=(u*r-o*i)*d,t[3]=h*d,t[4]=(c*e-o*s)*d,t[5]=(-u*e+o*a)*d,t[6]=p*d,t[7]=(-l*e+r*s)*d,t[8]=(i*e-r*a)*d,t):null},adjoint:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=n[6],l=n[7],c=n[8];return t[0]=i*c-u*l,t[1]=o*l-r*c,t[2]=r*u-o*i,t[3]=u*s-a*c,t[4]=e*c-o*s,t[5]=o*a-e*u,t[6]=a*l-i*s,t[7]=r*s-e*l,t[8]=e*i-r*a,t},determinant:function(t){var n=t[0],e=t[1],r=t[2],o=t[3],a=t[4],i=t[5],u=t[6],s=t[7],l=t[8];return n*(l*a-i*s)+e*(-l*o+i*u)+r*(s*o-a*u)},multiply:function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=n[6],c=n[7],f=n[8],h=e[0],p=e[1],d=e[2],m=e[3],g=e[4],v=e[5],y=e[6],b=e[7],x=e[8];return t[0]=h*r+p*i+d*l,t[1]=h*o+p*u+d*c,t[2]=h*a+p*s+d*f,t[3]=m*r+g*i+v*l,t[4]=m*o+g*u+v*c,t[5]=m*a+g*s+v*f,t[6]=y*r+b*i+x*l,t[7]=y*o+b*u+x*c,t[8]=y*a+b*s+x*f,t}};h.mul=h.multiply,h.translate=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=n[6],c=n[7],f=n[8],h=e[0],p=e[1];return t[0]=r,t[1]=o,t[2]=a,t[3]=i,t[4]=u,t[5]=s,t[6]=h*r+p*i+l,t[7]=h*o+p*u+c,t[8]=h*a+p*s+f,t},h.rotate=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=n[6],c=n[7],f=n[8],h=Math.sin(e),p=Math.cos(e);return t[0]=p*r+h*i,t[1]=p*o+h*u,t[2]=p*a+h*s,t[3]=p*i-h*r,t[4]=p*u-h*o,t[5]=p*s-h*a,t[6]=l,t[7]=c,t[8]=f,t},h.scale=function(t,n,e){var r=e[0],o=e[1];return t[0]=r*n[0],t[1]=r*n[1],t[2]=r*n[2],t[3]=o*n[3],t[4]=o*n[4],t[5]=o*n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t},h.fromMat2d=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=0,t[3]=n[2],t[4]=n[3],t[5]=0,t[6]=n[4],t[7]=n[5],t[8]=1,t},h.fromQuat=function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e+e,u=r+r,s=o+o,l=e*i,c=r*i,f=r*u,h=o*i,p=o*u,d=o*s,m=a*i,g=a*u,v=a*s;return t[0]=1-f-d,t[3]=c-v,t[6]=h+g,t[1]=c+v,t[4]=1-l-d,t[7]=p-m,t[2]=h-g,t[5]=p+m,t[8]=1-l-f,t},h.normalFromMat4=function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=n[6],l=n[7],c=n[8],f=n[9],h=n[10],p=n[11],d=n[12],m=n[13],g=n[14],v=n[15],y=e*u-r*i,b=e*s-o*i,x=e*l-a*i,M=r*s-o*u,w=r*l-a*u,_=o*l-a*s,k=c*m-f*d,S=c*g-h*d,A=c*v-p*d,E=f*g-h*m,T=f*v-p*m,R=h*v-p*g,N=y*R-b*T+x*E+M*A-w*S+_*k;return N?(N=1/N,t[0]=(u*R-s*T+l*E)*N,t[1]=(s*A-i*R-l*S)*N,t[2]=(i*T-u*A+l*k)*N,t[3]=(o*T-r*R-a*E)*N,t[4]=(e*R-o*A+a*S)*N,t[5]=(r*A-e*T-a*k)*N,t[6]=(m*_-g*w+v*M)*N,t[7]=(g*x-d*_-v*b)*N,t[8]=(d*w-m*x+v*y)*N,t):null},h.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},h.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2))},void 0!==t&&(t.mat3=h);var p={create:function(){var t=new e(16);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},clone:function(t){var n=new e(16);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},copy:function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},transpose:function(t,n){if(t===n){var e=n[1],r=n[2],o=n[3],a=n[6],i=n[7],u=n[11];t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=e,t[6]=n[9],t[7]=n[13],t[8]=r,t[9]=a,t[11]=n[14],t[12]=o,t[13]=i,t[14]=u}else t[0]=n[0],t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=n[1],t[5]=n[5],t[6]=n[9],t[7]=n[13],t[8]=n[2],t[9]=n[6],t[10]=n[10],t[11]=n[14],t[12]=n[3],t[13]=n[7],t[14]=n[11],t[15]=n[15];return t},invert:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=n[6],l=n[7],c=n[8],f=n[9],h=n[10],p=n[11],d=n[12],m=n[13],g=n[14],v=n[15],y=e*u-r*i,b=e*s-o*i,x=e*l-a*i,M=r*s-o*u,w=r*l-a*u,_=o*l-a*s,k=c*m-f*d,S=c*g-h*d,A=c*v-p*d,E=f*g-h*m,T=f*v-p*m,R=h*v-p*g,N=y*R-b*T+x*E+M*A-w*S+_*k;return N?(N=1/N,t[0]=(u*R-s*T+l*E)*N,t[1]=(o*T-r*R-a*E)*N,t[2]=(m*_-g*w+v*M)*N,t[3]=(h*w-f*_-p*M)*N,t[4]=(s*A-i*R-l*S)*N,t[5]=(e*R-o*A+a*S)*N,t[6]=(g*x-d*_-v*b)*N,t[7]=(c*_-h*x+p*b)*N,t[8]=(i*T-u*A+l*k)*N,t[9]=(r*A-e*T-a*k)*N,t[10]=(d*w-m*x+v*y)*N,t[11]=(f*x-c*w-p*y)*N,t[12]=(u*S-i*E-s*k)*N,t[13]=(e*E-r*S+o*k)*N,t[14]=(m*b-d*M-g*y)*N,t[15]=(c*M-f*b+h*y)*N,t):null},adjoint:function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],s=n[6],l=n[7],c=n[8],f=n[9],h=n[10],p=n[11],d=n[12],m=n[13],g=n[14],v=n[15];return t[0]=u*(h*v-p*g)-f*(s*v-l*g)+m*(s*p-l*h),t[1]=-(r*(h*v-p*g)-f*(o*v-a*g)+m*(o*p-a*h)),t[2]=r*(s*v-l*g)-u*(o*v-a*g)+m*(o*l-a*s),t[3]=-(r*(s*p-l*h)-u*(o*p-a*h)+f*(o*l-a*s)),t[4]=-(i*(h*v-p*g)-c*(s*v-l*g)+d*(s*p-l*h)),t[5]=e*(h*v-p*g)-c*(o*v-a*g)+d*(o*p-a*h),t[6]=-(e*(s*v-l*g)-i*(o*v-a*g)+d*(o*l-a*s)),t[7]=e*(s*p-l*h)-i*(o*p-a*h)+c*(o*l-a*s),t[8]=i*(f*v-p*m)-c*(u*v-l*m)+d*(u*p-l*f),t[9]=-(e*(f*v-p*m)-c*(r*v-a*m)+d*(r*p-a*f)),t[10]=e*(u*v-l*m)-i*(r*v-a*m)+d*(r*l-a*u),t[11]=-(e*(u*p-l*f)-i*(r*p-a*f)+c*(r*l-a*u)),t[12]=-(i*(f*g-h*m)-c*(u*g-s*m)+d*(u*h-s*f)),t[13]=e*(f*g-h*m)-c*(r*g-o*m)+d*(r*h-o*f),t[14]=-(e*(u*g-s*m)-i*(r*g-o*m)+d*(r*s-o*u)),t[15]=e*(u*h-s*f)-i*(r*h-o*f)+c*(r*s-o*u),t},determinant:function(t){var n=t[0],e=t[1],r=t[2],o=t[3],a=t[4],i=t[5],u=t[6],s=t[7],l=t[8],c=t[9],f=t[10],h=t[11],p=t[12],d=t[13],m=t[14],g=t[15];return(n*i-e*a)*(f*g-h*m)-(n*u-r*a)*(c*g-h*d)+(n*s-o*a)*(c*m-f*d)+(e*u-r*i)*(l*g-h*p)-(e*s-o*i)*(l*m-f*p)+(r*s-o*u)*(l*d-c*p)},multiply:function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=n[6],c=n[7],f=n[8],h=n[9],p=n[10],d=n[11],m=n[12],g=n[13],v=n[14],y=n[15],b=e[0],x=e[1],M=e[2],w=e[3];return t[0]=b*r+x*u+M*f+w*m,t[1]=b*o+x*s+M*h+w*g,t[2]=b*a+x*l+M*p+w*v,t[3]=b*i+x*c+M*d+w*y,b=e[4],x=e[5],M=e[6],w=e[7],t[4]=b*r+x*u+M*f+w*m,t[5]=b*o+x*s+M*h+w*g,t[6]=b*a+x*l+M*p+w*v,t[7]=b*i+x*c+M*d+w*y,b=e[8],x=e[9],M=e[10],w=e[11],t[8]=b*r+x*u+M*f+w*m,t[9]=b*o+x*s+M*h+w*g,t[10]=b*a+x*l+M*p+w*v,t[11]=b*i+x*c+M*d+w*y,b=e[12],x=e[13],M=e[14],w=e[15],t[12]=b*r+x*u+M*f+w*m,t[13]=b*o+x*s+M*h+w*g,t[14]=b*a+x*l+M*p+w*v,t[15]=b*i+x*c+M*d+w*y,t}};p.mul=p.multiply,p.translate=function(t,n,e){var r,o,a,i,u,s,l,c,f,h,p,d,m=e[0],g=e[1],v=e[2];return n===t?(t[12]=n[0]*m+n[4]*g+n[8]*v+n[12],t[13]=n[1]*m+n[5]*g+n[9]*v+n[13],t[14]=n[2]*m+n[6]*g+n[10]*v+n[14],t[15]=n[3]*m+n[7]*g+n[11]*v+n[15]):(r=n[0],o=n[1],a=n[2],i=n[3],u=n[4],s=n[5],l=n[6],c=n[7],f=n[8],h=n[9],p=n[10],d=n[11],t[0]=r,t[1]=o,t[2]=a,t[3]=i,t[4]=u,t[5]=s,t[6]=l,t[7]=c,t[8]=f,t[9]=h,t[10]=p,t[11]=d,t[12]=r*m+u*g+f*v+n[12],t[13]=o*m+s*g+h*v+n[13],t[14]=a*m+l*g+p*v+n[14],t[15]=i*m+c*g+d*v+n[15]),t},p.scale=function(t,n,e){var r=e[0],o=e[1],a=e[2];return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=n[3]*r,t[4]=n[4]*o,t[5]=n[5]*o,t[6]=n[6]*o,t[7]=n[7]*o,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=n[11]*a,t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},p.rotate=function(t,e,r,o){var a,i,u,s,l,c,f,h,p,d,m,g,v,y,b,x,M,w,_,k,S,A,E,T,R=o[0],N=o[1],P=o[2],C=Math.sqrt(R*R+N*N+P*P);return Math.abs(C)<n?null:(R*=C=1/C,N*=C,P*=C,a=Math.sin(r),u=1-(i=Math.cos(r)),s=e[0],l=e[1],c=e[2],f=e[3],h=e[4],p=e[5],d=e[6],m=e[7],g=e[8],v=e[9],y=e[10],b=e[11],x=R*R*u+i,M=N*R*u+P*a,w=P*R*u-N*a,_=R*N*u-P*a,k=N*N*u+i,S=P*N*u+R*a,A=R*P*u+N*a,E=N*P*u-R*a,T=P*P*u+i,t[0]=s*x+h*M+g*w,t[1]=l*x+p*M+v*w,t[2]=c*x+d*M+y*w,t[3]=f*x+m*M+b*w,t[4]=s*_+h*k+g*S,t[5]=l*_+p*k+v*S,t[6]=c*_+d*k+y*S,t[7]=f*_+m*k+b*S,t[8]=s*A+h*E+g*T,t[9]=l*A+p*E+v*T,t[10]=c*A+d*E+y*T,t[11]=f*A+m*E+b*T,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)},p.rotateX=function(t,n,e){var r=Math.sin(e),o=Math.cos(e),a=n[4],i=n[5],u=n[6],s=n[7],l=n[8],c=n[9],f=n[10],h=n[11];return n!==t&&(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[4]=a*o+l*r,t[5]=i*o+c*r,t[6]=u*o+f*r,t[7]=s*o+h*r,t[8]=l*o-a*r,t[9]=c*o-i*r,t[10]=f*o-u*r,t[11]=h*o-s*r,t},p.rotateY=function(t,n,e){var r=Math.sin(e),o=Math.cos(e),a=n[0],i=n[1],u=n[2],s=n[3],l=n[8],c=n[9],f=n[10],h=n[11];return n!==t&&(t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[0]=a*o-l*r,t[1]=i*o-c*r,t[2]=u*o-f*r,t[3]=s*o-h*r,t[8]=a*r+l*o,t[9]=i*r+c*o,t[10]=u*r+f*o,t[11]=s*r+h*o,t},p.rotateZ=function(t,n,e){var r=Math.sin(e),o=Math.cos(e),a=n[0],i=n[1],u=n[2],s=n[3],l=n[4],c=n[5],f=n[6],h=n[7];return n!==t&&(t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[0]=a*o+l*r,t[1]=i*o+c*r,t[2]=u*o+f*r,t[3]=s*o+h*r,t[4]=l*o-a*r,t[5]=c*o-i*r,t[6]=f*o-u*r,t[7]=h*o-s*r,t},p.fromRotationTranslation=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=r+r,s=o+o,l=a+a,c=r*u,f=r*s,h=r*l,p=o*s,d=o*l,m=a*l,g=i*u,v=i*s,y=i*l;return t[0]=1-(p+m),t[1]=f+y,t[2]=h-v,t[3]=0,t[4]=f-y,t[5]=1-(c+m),t[6]=d+g,t[7]=0,t[8]=h+v,t[9]=d-g,t[10]=1-(c+p),t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t},p.fromQuat=function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e+e,u=r+r,s=o+o,l=e*i,c=r*i,f=r*u,h=o*i,p=o*u,d=o*s,m=a*i,g=a*u,v=a*s;return t[0]=1-f-d,t[1]=c+v,t[2]=h-g,t[3]=0,t[4]=c-v,t[5]=1-l-d,t[6]=p+m,t[7]=0,t[8]=h+g,t[9]=p-m,t[10]=1-l-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},p.frustum=function(t,n,e,r,o,a,i){var u=1/(e-n),s=1/(o-r),l=1/(a-i);return t[0]=2*a*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*a*s,t[6]=0,t[7]=0,t[8]=(e+n)*u,t[9]=(o+r)*s,t[10]=(i+a)*l,t[11]=-1,t[12]=0,t[13]=0,t[14]=i*a*2*l,t[15]=0,t},p.perspective=function(t,n,e,r,o){var a=1/Math.tan(n/2),i=1/(r-o);return t[0]=a/e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(o+r)*i,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*o*r*i,t[15]=0,t},p.ortho=function(t,n,e,r,o,a,i){var u=1/(n-e),s=1/(r-o),l=1/(a-i);return t[0]=-2*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(n+e)*u,t[13]=(o+r)*s,t[14]=(i+a)*l,t[15]=1,t},p.lookAt=function(t,e,r,o){var a,i,u,s,l,c,f,h,d,m,g=e[0],v=e[1],y=e[2],b=o[0],x=o[1],M=o[2],w=r[0],_=r[1],k=r[2];return Math.abs(g-w)<n&&Math.abs(v-_)<n&&Math.abs(y-k)<n?p.identity(t):(f=g-w,h=v-_,d=y-k,a=x*(d*=m=1/Math.sqrt(f*f+h*h+d*d))-M*(h*=m),i=M*(f*=m)-b*d,u=b*h-x*f,(m=Math.sqrt(a*a+i*i+u*u))?(a*=m=1/m,i*=m,u*=m):(a=0,i=0,u=0),s=h*u-d*i,l=d*a-f*u,c=f*i-h*a,(m=Math.sqrt(s*s+l*l+c*c))?(s*=m=1/m,l*=m,c*=m):(s=0,l=0,c=0),t[0]=a,t[1]=s,t[2]=f,t[3]=0,t[4]=i,t[5]=l,t[6]=h,t[7]=0,t[8]=u,t[9]=c,t[10]=d,t[11]=0,t[12]=-(a*g+i*v+u*y),t[13]=-(s*g+l*v+c*y),t[14]=-(f*g+h*v+d*y),t[15]=1,t)},p.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},p.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2)+Math.pow(t[9],2)+Math.pow(t[10],2)+Math.pow(t[11],2)+Math.pow(t[12],2)+Math.pow(t[13],2)+Math.pow(t[14],2)+Math.pow(t[15],2))},void 0!==t&&(t.mat4=p);var d,m,g,v,y={};y.create=function(){var t=new e(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},y.rotationTo=(d=s.create(),m=s.fromValues(1,0,0),g=s.fromValues(0,1,0),function(t,n,e){var r=s.dot(n,e);return r<-.999999?(s.cross(d,m,n),s.length(d)<1e-6&&s.cross(d,g,n),s.normalize(d,d),y.setAxisAngle(t,d,Math.PI),t):r>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(s.cross(d,n,e),t[0]=d[0],t[1]=d[1],t[2]=d[2],t[3]=1+r,y.normalize(t,t))}),y.setAxes=(v=h.create(),function(t,n,e,r){return v[0]=e[0],v[3]=e[1],v[6]=e[2],v[1]=r[0],v[4]=r[1],v[7]=r[2],v[2]=-n[0],v[5]=-n[1],v[8]=-n[2],y.normalize(t,y.fromMat3(t,v))}),y.clone=l.clone,y.fromValues=l.fromValues,y.copy=l.copy,y.set=l.set,y.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},y.setAxisAngle=function(t,n,e){e*=.5;var r=Math.sin(e);return t[0]=r*n[0],t[1]=r*n[1],t[2]=r*n[2],t[3]=Math.cos(e),t},y.add=l.add,y.multiply=function(t,n,e){var r=n[0],o=n[1],a=n[2],i=n[3],u=e[0],s=e[1],l=e[2],c=e[3];return t[0]=r*c+i*u+o*l-a*s,t[1]=o*c+i*s+a*u-r*l,t[2]=a*c+i*l+r*s-o*u,t[3]=i*c-r*u-o*s-a*l,t},y.mul=y.multiply,y.scale=l.scale,y.rotateX=function(t,n,e){e*=.5;var r=n[0],o=n[1],a=n[2],i=n[3],u=Math.sin(e),s=Math.cos(e);return t[0]=r*s+i*u,t[1]=o*s+a*u,t[2]=a*s-o*u,t[3]=i*s-r*u,t},y.rotateY=function(t,n,e){e*=.5;var r=n[0],o=n[1],a=n[2],i=n[3],u=Math.sin(e),s=Math.cos(e);return t[0]=r*s-a*u,t[1]=o*s+i*u,t[2]=a*s+r*u,t[3]=i*s-o*u,t},y.rotateZ=function(t,n,e){e*=.5;var r=n[0],o=n[1],a=n[2],i=n[3],u=Math.sin(e),s=Math.cos(e);return t[0]=r*s+o*u,t[1]=o*s-r*u,t[2]=a*s+i*u,t[3]=i*s-a*u,t},y.calculateW=function(t,n){var e=n[0],r=n[1],o=n[2];return t[0]=e,t[1]=r,t[2]=o,t[3]=Math.sqrt(Math.abs(1-e*e-r*r-o*o)),t},y.dot=l.dot,y.lerp=l.lerp,y.slerp=function(t,n,e,r){var o,a,i,u,s,l=n[0],c=n[1],f=n[2],h=n[3],p=e[0],d=e[1],m=e[2],g=e[3];return(a=l*p+c*d+f*m+h*g)<0&&(a=-a,p=-p,d=-d,m=-m,g=-g),1-a>1e-6?(o=Math.acos(a),i=Math.sin(o),u=Math.sin((1-r)*o)/i,s=Math.sin(r*o)/i):(u=1-r,s=r),t[0]=u*l+s*p,t[1]=u*c+s*d,t[2]=u*f+s*m,t[3]=u*h+s*g,t},y.invert=function(t,n){var e=n[0],r=n[1],o=n[2],a=n[3],i=e*e+r*r+o*o+a*a,u=i?1/i:0;return t[0]=-e*u,t[1]=-r*u,t[2]=-o*u,t[3]=a*u,t},y.conjugate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=n[3],t},y.length=l.length,y.len=y.length,y.squaredLength=l.squaredLength,y.sqrLen=y.squaredLength,y.normalize=l.normalize,y.fromMat3=function(t,n){var e,r=n[0]+n[4]+n[8];if(r>0)e=Math.sqrt(r+1),t[3]=.5*e,e=.5/e,t[0]=(n[5]-n[7])*e,t[1]=(n[6]-n[2])*e,t[2]=(n[1]-n[3])*e;else{var o=0;n[4]>n[0]&&(o=1),n[8]>n[3*o+o]&&(o=2);var a=(o+1)%3,i=(o+2)%3;e=Math.sqrt(n[3*o+o]-n[3*a+a]-n[3*i+i]+1),t[o]=.5*e,e=.5/e,t[3]=(n[3*a+i]-n[3*i+a])*e,t[a]=(n[3*a+o]+n[3*o+a])*e,t[i]=(n[3*i+o]+n[3*o+i])*e}return t},y.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},void 0!==t&&(t.quat=y)}(e.exports)}()},function(t,n,e){"use strict";var r=e(7),o=e(6),a=e(22);function i(t,n,e){return Math.min(n,Math.max(t,e))}t.exports.new=function(){return{aspect:1,zoom:.125,translation:{x:0,y:0},atomScale:.6,relativeAtomScale:1,bondScale:.5,rotation:r.mat4.create(),ao:.75,aoRes:256,brightness:.5,outline:0,spf:32,bonds:!1,bondThreshold:1.2,bondShade:.5,atomShade:.5,resolution:768,dofStrength:0,dofPosition:.5,fxaa:1}},t.exports.center=function(t,n){for(var e=-1/0,a=1/0,i=-1/0,u=1/0,s=0;s<n.atoms.length;s++){var l=n.atoms[s],c=o[l.symbol].radius;c=2.5*t.atomScale*(1+(c-1)*t.relativeAtomScale);var f=r.vec4.fromValues(l.x,l.y,l.z,0);r.vec4.transformMat4(f,f,t.rotation),e=Math.max(e,f[0]+c),a=Math.min(a,f[0]-c),i=Math.max(i,f[1]+c),u=Math.min(u,f[1]-c)}var h=a+(e-a)/2,p=u+(i-u)/2;t.translation.x=h,t.translation.y=p;var d=Math.max(e-a,i-u);t.zoom=1/(1.01*d)},t.exports.override=function(t,n){for(var e in n)t[e]=n[e];l(t)},t.exports.clone=function(t){return s(u(t))};var u=t.exports.serialize=function(t){return JSON.stringify(t)},s=t.exports.deserialize=function(t){return(t=JSON.parse(t)).rotation=r.mat4.clone(t.rotation),t},l=t.exports.resolve=function(t){t.dofStrength=i(0,1,t.dofStrength),t.dofPosition=i(0,1,t.dofPosition),t.zoom=i(.001,2,t.zoom),t.atomScale=i(0,1,t.atomScale),t.relativeAtomScale=i(0,1,t.relativeAtomScale),t.bondScale=i(0,1,t.bondScale),t.bondShade=i(0,1,t.bondShade),t.atomShade=i(0,1,t.atomShade),t.ao=i(0,1,t.ao),t.brightness=i(0,1,t.brightness),t.outline=i(0,1,t.outline)};t.exports.translate=function(t,n,e){t.translation.x-=n/(t.resolution*t.zoom),t.translation.y+=e/(t.resolution*t.zoom),l(t)},t.exports.rotate=function(t,n,e){var o=r.mat4.create();r.mat4.rotateY(o,o,.005*n),r.mat4.rotateX(o,o,.005*e),r.mat4.multiply(t.rotation,o,t.rotation);var a=t.ao;t.ao=0,l(t),t.ao=a},t.exports.getRect=function(t){var n=1/t.zoom,e=n/t.aspect;return{bottom:-e/2+t.translation.y,top:e/2+t.translation.y,left:-n/2+t.translation.x,right:n/2+t.translation.x}},t.exports.getBondRadius=function(t){return t.bondScale*t.atomScale*(1+(a.MIN_ATOM_RADIUS-1)*t.relativeAtomScale)}},function(t,n,e){"use strict";e.d(n,"a",(function(){return a}));var r=e(3),o=e(4);function a(t){return function n(e,a){switch(arguments.length){case 0:return n;case 1:return Object(o.a)(e)?n:Object(r.a)((function(n){return t(e,n)}));default:return Object(o.a)(e)&&Object(o.a)(a)?n:Object(o.a)(e)?Object(r.a)((function(n){return t(n,a)})):Object(o.a)(a)?Object(r.a)((function(n){return t(e,n)})):t(e,a)}}}},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"c",(function(){return g})),e.d(n,"b",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.alignmentChart),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.propTypes={id:o.a.string,setProps:o.a.func,eventDatum:o.a.string,data:o.a.string,extension:o.a.string,colorscale:o.a.oneOfType([o.a.string,o.a.object]),opacity:o.a.oneOfType([o.a.number,o.a.string]),textcolor:o.a.string,textsize:o.a.oneOfType([o.a.number,o.a.string]),showlabel:o.a.bool,showid:o.a.bool,showconservation:o.a.bool,conservationcolor:o.a.string,conservationcolorscale:o.a.oneOfType([o.a.string,o.a.array]),conservationopacity:o.a.oneOfType([o.a.number,o.a.string]),conservationmethod:o.a.oneOf(["conservation","entropy"]),correctgap:o.a.bool,showgap:o.a.bool,gapcolor:o.a.string,gapcolorscale:o.a.oneOfType([o.a.string,o.a.array]),gapopacity:o.a.oneOfType([o.a.number,o.a.string]),groupbars:o.a.bool,showconsensus:o.a.bool,tilewidth:o.a.number,tileheight:o.a.number,overview:o.a.oneOf(["heatmap","slider","none"]),numtiles:o.a.number,scrollskip:o.a.number,tickstart:o.a.oneOfType([o.a.number,o.a.string]),ticksteps:o.a.oneOfType([o.a.number,o.a.string]),width:o.a.oneOfType([o.a.number,o.a.string]),height:o.a.oneOfType([o.a.number,o.a.string])},m.defaultProps={extension:"fasta",colorscale:"clustal2",opacity:null,textcolor:null,textsize:10,showlabel:!0,showid:!0,showconservation:!0,conservationcolor:null,conservationcolorscale:"Viridis",conservationopacity:null,conservationmethod:"entropy",correctgap:!0,showgap:!0,gapcolor:"grey",gapcolorscale:null,gapopacity:null,groupbars:!1,showconsensus:!0,tilewidth:16,tileheight:16,numtiles:null,overview:"heatmap",scrollskip:10,tickstart:null,ticksteps:null,width:null,height:900};var g=m.propTypes,v=m.defaultProps},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.ideogram),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.defaultProps={organism:"human",dataDir:"https://unpkg.com/ideogram@1.5.0/dist/data/bands/native/",annotationsColor:"#F00",annotationsLayout:"tracks",barWidth:3,chrHeight:400,chrMargin:10,chrWidth:10,ploidy:1,rotatable:!0,showBandLabels:!1,showChromosomeLabels:!0,showAnnotTooltip:!0,showFullyBanded:!0,showNonNuclearChromosomes:!1},m.propTypes={id:o.a.string.isRequired,style:o.a.object,setProps:o.a.func,className:o.a.string,annotationsLayout:o.a.oneOf(["tracks","histogram","overlay"]),annotations:o.a.arrayOf(o.a.shape({name:o.a.string,chr:o.a.string,start:o.a.number,stop:o.a.number})),annotationsPath:o.a.string,annotationsData:o.a.string,annotationTracks:o.a.arrayOf(o.a.object),annotationHeight:o.a.number,annotationsColor:o.a.string,histogramScaling:o.a.oneOf(["absolute","relative"]),barWidth:o.a.number,showAnnotTooltip:o.a.bool,assembly:o.a.string,brush:o.a.string,brushData:o.a.shape({start:o.a.string,end:o.a.string,extent:o.a.string}),container:o.a.string,chrHeight:o.a.number,chrMargin:o.a.number,chrWidth:o.a.number,chromosomes:o.a.oneOfType([o.a.arrayOf(o.a.string),o.a.object]),dataDir:o.a.string,organism:o.a.oneOfType([o.a.string,o.a.number]),localOrganism:o.a.object,homology:o.a.shape({chrOne:o.a.shape({organism:o.a.string.isRequired,start:o.a.arrayOf(o.a.number.isRequired),stop:o.a.arrayOf(o.a.number.isRequired)}),chrTwo:o.a.shape({organism:o.a.string.isRequired,start:o.a.arrayOf(o.a.number.isRequired),stop:o.a.arrayOf(o.a.number.isRequired)})}),perspective:o.a.oneOf(["comparative"]),fullChromosomeLabels:o.a.bool,resolution:o.a.number,filterable:o.a.bool,orientation:o.a.oneOf(["vertical","horizontal"]),ploidy:o.a.number,ploidyDesc:o.a.arrayOf(o.a.object),ancestors:o.a.object,rangeSet:o.a.arrayOf(o.a.object),rotatable:o.a.bool,rotated:o.a.bool,sex:o.a.oneOf(["male","female"]),showChromosomeLabels:o.a.bool,showBandLabels:o.a.bool,showFullyBanded:o.a.bool,showNonNuclearChromosomes:o.a.bool};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(1),o=e.n(r),a=e(2),i=e(0),u=e.n(i);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(r.lazy)(a.a.igv),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,a,i;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(a=[{key:"render",value:function(){return o.a.createElement(r.Suspense,{fallback:null},o.a.createElement(d,this.props))}}])&&c(e.prototype,a),i&&c(e,i),n}(r.Component);m.defaultProps={},m.propTypes={id:u.a.string,setProps:u.a.func,style:u.a.object,className:u.a.string,genome:u.a.string,reference:u.a.object,locus:u.a.string,minimumBases:u.a.number,tracks:u.a.array};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.molecule2dViewer),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.defaultProps={width:500,height:500,modelData:{nodes:[],links:[]}},m.propTypes={id:o.a.string,setProps:o.a.func,selectedAtomIds:o.a.arrayOf(o.a.number),width:o.a.number,height:o.a.number,modelData:o.a.shape({nodes:o.a.arrayOf(o.a.shape({id:o.a.number,atom:o.a.string})),links:o.a.arrayOf(o.a.shape({id:o.a.number,source:o.a.number|o.a.shape,target:o.a.number|o.a.shape,bond:o.a.number,strength:o.a.number,distance:o.a.number}))})};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.molecule3dViewer),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.defaultProps={selectionType:"atom",backgroundColor:"#FFFFFF",backgroundOpacity:0},m.propTypes={id:o.a.string,setProps:o.a.func,selectionType:o.a.oneOf(["atom","residue","chain"]),backgroundColor:o.a.string,backgroundOpacity:o.a.number,styles:o.a.arrayOf(o.a.shape({color:o.a.string,visualization_type:o.a.oneOf(["cartoon","sphere","stick"])})),modelData:o.a.shape({atoms:o.a.array,bonds:o.a.array}),atomLabelsShown:o.a.bool,selectedAtomIds:o.a.array,labels:o.a.array,onRenderNewData:o.a.func,onChangeSelection:o.a.func};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.needlePlot),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.propTypes={id:o.a.string,mutationData:o.a.shape({x:o.a.oneOfType([o.a.string,o.a.array]),y:o.a.oneOfType([o.a.string,o.a.array]),mutationGroups:o.a.arrayOf(o.a.string),domains:o.a.array}),xlabel:o.a.string,ylabel:o.a.string,rangeSlider:o.a.bool,needleStyle:o.a.shape({stemColor:o.a.string,stemThickness:o.a.number,stemConstHeight:o.a.bool,headSize:o.a.number,headColor:o.a.oneOfType([o.a.array,o.a.string]),headSymbol:o.a.oneOfType([o.a.array,o.a.string])}),domainStyle:o.a.shape({domainColor:o.a.array,displayMinorDomains:o.a.bool}),setProps:o.a.func},m.defaultProps={mutationData:{x:[],y:[],domains:[],mutationGroups:[]},rangeSlider:!1,needleStyle:{stemColor:"#444",stemThickness:.5,stemConstHeight:!1,headSize:5,headColor:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999","#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999","#e41a1c"],headSymbol:"circle"},domainStyle:{displayMinorDomains:!1,domainColor:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f","#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69"]}};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(1),o=e.n(r),a=e(2),i=e(0),u=e.n(i);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(r.lazy)(a.a.nglmoleculeViewer),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,a,i;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(a=[{key:"render",value:function(){return o.a.createElement(r.Suspense,{fallback:null},o.a.createElement(d,this.props))}}])&&c(e.prototype,a),i&&c(e,i),n}(r.Component);m.defaultProps={data:[{filename:"placeholder",ext:"",selectedValue:"placeholder",chain:"ALL",aaRange:"ALL",chosen:{chosenAtoms:"",chosenResidues:""},color:"red",config:{input:"",type:"text/plain"},uploaded:!1,resetView:!1}],width:"600px",height:"600px",stageParameters:{quality:"medium",backgroundColor:"white",cameraType:"perspective"},imageParameters:{antialias:!0,transparent:!0,trim:!0,defaultFilename:"dash-bio_ngl_output"},downloadImage:!1,molStyles:{representations:["cartoon","axes+box"],chosenAtomsColor:"#ffffff",chosenAtomsRadius:1,molSpacingXaxis:100,sideByside:!1}},m.propTypes={id:u.a.string,setProps:u.a.func,width:u.a.oneOfType([u.a.string,u.a.number]),height:u.a.oneOfType([u.a.string,u.a.number]),stageParameters:u.a.exact({quality:u.a.string,backgroundColor:u.a.string,cameraType:u.a.string}),imageParameters:u.a.exact({antialias:u.a.bool,transparent:u.a.bool,trim:u.a.bool,defaultFilename:u.a.string}),downloadImage:u.a.bool,pdbString:u.a.string,data:u.a.arrayOf(u.a.exact({filename:u.a.string.isRequired,ext:u.a.string,selectedValue:u.a.string.isRequired,chain:u.a.string.isRequired,aaRange:u.a.string.isRequired,color:u.a.string.isRequired,chosen:u.a.exact({residues:u.a.string.isRequired,atoms:u.a.string.isRequired}),config:u.a.exact({input:u.a.string.isRequired,type:u.a.string.isRequired}),uploaded:u.a.bool.isRequired,resetView:u.a.bool.isRequired})),molStyles:u.a.exact({representations:u.a.arrayOf(u.a.string),chosenAtomsColor:u.a.string.isRequired,chosenAtomsRadius:u.a.number.isRequired,molSpacingXaxis:u.a.number.isRequired,sideByside:u.a.bool.isRequired})};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.oncoPrint),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.propTypes={id:o.a.string,setProps:o.a.func,eventDatum:o.a.object,data:o.a.array,padding:o.a.number,colorscale:o.a.oneOfType([o.a.bool,o.a.object]),backgroundcolor:o.a.string,range:o.a.array,showlegend:o.a.bool,showoverview:o.a.bool,width:o.a.oneOfType([o.a.number,o.a.string]),height:o.a.oneOfType([o.a.number,o.a.string])},m.defaultProps={padding:.05,colorscale:null,backgroundcolor:"rgb(190, 190, 190)",range:[null,null],showlegend:!0,showoverview:!0,width:null,height:500};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return m})),e.d(n,"b",(function(){return g})),e.d(n,"c",(function(){return v}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==s(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,n){return(p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=Object(a.lazy)(u.a.sequenceViewer),m=function(t){function n(){return l(this,n),f(this,h(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&p(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(d,this.props))}}])&&c(e.prototype,r),o&&c(e,o),n}(a.Component);m.defaultProps={sequence:"-",showLineNumbers:!0,wrapAminoAcids:!0,charsPerLine:40,toolbar:!1,search:!0,title:"",sequenceMaxHeight:"400px",badge:!0,selection:[],coverage:[]},m.propTypes={id:o.a.string,sequence:o.a.string,showLineNumbers:o.a.bool,wrapAminoAcids:o.a.bool,charsPerLine:o.a.number,toolbar:o.a.bool,search:o.a.bool,title:o.a.string,sequenceMaxHeight:o.a.string,badge:o.a.bool,selection:function(t,n,e){if(void 0!==t[n]&&(void 0!==t[n][0]&&"number"!=typeof t[n][0]||void 0!==t[n][1]&&"number"!=typeof t[n][1]||void 0!==t[n][2]&&"string"!=typeof t[n][2]))return new Error("Invalid prop value. Selection should be an array with type [number, number, string].")},coverage:o.a.arrayOf(o.a.shape({start:o.a.number,end:o.a.number,color:o.a.string,bgcolor:o.a.string,tooltip:o.a.string,underscore:o.a.bool,onclick:o.a.func})),legend:o.a.arrayOf(o.a.shape({name:o.a.string,color:o.a.string,underscore:o.a.bool})),coverageClicked:o.a.number,mouseSelection:o.a.shape({start:o.a.number,end:o.a.number,selection:o.a.string}),subpartSelected:o.a.arrayOf(o.a.shape({start:o.a.number,end:o.a.number,sequence:o.a.string})),setProps:o.a.func};var g=m.defaultProps,v=m.propTypes},function(t,n,e){"use strict";e.d(n,"a",(function(){return g})),e.d(n,"b",(function(){return v})),e.d(n,"c",(function(){return y}));var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2),s=e(21);function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function f(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function h(t,n){return!n||"object"!==l(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function d(t,n){return(d=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var m=Object(a.lazy)(u.a.speck),g=function(t){function n(){return c(this,n),h(this,p(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&d(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(m,this.props))}}])&&f(e.prototype,r),o&&f(e,o),n}(a.Component);g.defaultProps={view:s.speckView.new(),data:[]},g.propTypes={id:o.a.string,data:o.a.arrayOf(o.a.shape({symbol:o.a.string,x:o.a.number,y:o.a.number,z:o.a.number})),scrollZoom:o.a.bool,view:o.a.shape({aspect:o.a.number,zoom:o.a.number,translation:o.a.shape({x:o.a.number,y:o.a.number}),atomScale:o.a.number,relativeAtomScale:o.a.number,bondScale:o.a.number,rotation:o.a.shape({}),ao:o.a.number,aoRes:o.a.number,brightness:o.a.number,outline:o.a.number,spf:o.a.number,bonds:o.a.bool,bondThreshold:o.a.number,bondShade:o.a.number,atomShade:o.a.number,resolution:o.a.number,dofStrength:o.a.number,dofPosition:o.a.number,fxaa:o.a.number}),presetView:o.a.oneOf(["default","stickball","toon","licorice"]),setProps:o.a.func};var v=g.defaultProps,y=g.propTypes},function(t,n,e){"use strict";var r=e(0),o=e.n(r),a=e(1),i=e.n(a),u=e(2),s=["CHORDS","HEATMAP","HIGHLIGHT","HISTOGRAM","LINE","SCATTER","STACK","TEXT"];function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function f(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function h(t,n){return!n||"object"!==l(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function d(t,n){return(d=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}e.d(n,"a",(function(){return g})),e.d(n,"c",(function(){return v})),e.d(n,"b",(function(){return y}));var m=Object(a.lazy)(u.a.circos),g=function(t){function n(){return c(this,n),h(this,p(n).apply(this,arguments))}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&d(t,n)}(n,t),e=n,(r=[{key:"render",value:function(){return i.a.createElement(a.Suspense,{fallback:null},i.a.createElement(m,this.props))}}])&&f(e.prototype,r),o&&f(e,o),n}(a.Component);g.defaultProps={config:{},size:800,tracks:[]},g.propTypes={enableDownloadSVG:o.a.bool,enableZoomPan:o.a.bool,id:o.a.string,style:o.a.object,eventDatum:o.a.object,selectEvent:o.a.object,setProps:o.a.func,layout:o.a.arrayOf(o.a.shape({len:o.a.number.isRequired,color:o.a.string.isRequired,label:o.a.string.isRequired,id:o.a.string.isRequired})).isRequired,config:o.a.object,size:o.a.number,tracks:o.a.arrayOf(o.a.shape({id:o.a.string,data:o.a.array.isRequired,config:o.a.object,type:o.a.oneOf(s),tooltipContent:o.a.oneOfType([o.a.string,o.a.shape({name:o.a.string.isRequired}),o.a.shape({source:o.a.string.isRequired,sourceID:o.a.string,target:o.a.string.isRequired,targetEnd:o.a.string.isRequired,targetID:o.a.string})]),color:o.a.oneOfType([o.a.string,o.a.shape({name:o.a.string.isRequired})])}))};var v=g.propTypes,y=g.defaultProps},function(t,n,e){var r=e(27),o=e(23),a=e(8),i=e(31),u=e(32);t.exports={speckRenderer:r,speckSystem:o,speckView:a,speckInteractions:i,speckPresetViews:u}},function(t,n,e){"use strict";for(var r=e(6),o=1/0,a=-1/0,i=0;i<=118;i++)o=Math.min(o,r[i].radius),a=Math.max(a,r[i].radius);t.exports.MIN_ATOM_RADIUS=o,t.exports.MAX_ATOM_RADIUS=a},function(t,n,e){"use strict";var r=e(7),o=e(6),a=e(22),i=(t.exports.new=function(){return{atoms:[],farAtom:void 0,bonds:[]}},t.exports.calculateBonds=function(t){var n=[],e=t.atoms.slice();e.sort((function(t,n){return t.z-n.z}));for(var i=0;i<e.length;i++)for(var u=e[i],s=i+1;s<e.length&&e[s].z<e[i].z+5*a.MAX_ATOM_RADIUS;){var l=e[s],c=r.vec3.fromValues(u.x,u.y,u.z),f=r.vec3.fromValues(l.x,l.y,l.z),h=r.vec3.distance(c,f),p=o[u.symbol],d=o[l.symbol];h<2.5*(p.radius+d.radius)&&n.push({posA:{x:u.x,y:u.y,z:u.z},posB:{x:l.x,y:l.y,z:l.z},radA:p.radius,radB:d.radius,colA:{r:p.color[0],g:p.color[1],b:p.color[2]},colB:{r:d.color[0],g:d.color[1],b:d.color[2]},cutoff:h/(p.radius+d.radius)}),s++}n.sort((function(t,n){return t.cutoff-n.cutoff})),t.bonds=n},t.exports.addAtom=function(t,n,e,r,o){t.atoms.push({symbol:n,x:e,y:r,z:o})},t.exports.getCentroid=function(t){for(var n=0,e=0,r=0,o=0;o<t.atoms.length;o++)n+=t.atoms[o].x,e+=t.atoms[o].y,r+=t.atoms[o].z;return{x:n/t.atoms.length,y:e/t.atoms.length,z:r/t.atoms.length}}),u=(t.exports.center=function(t){for(var n=i(t),e=0;e<t.atoms.length;e++){var r=t.atoms[e];r.x-=n.x,r.y-=n.y,r.z-=n.z}},t.exports.getFarAtom=function(t){if(void 0!==t.farAtom)return t.farAtom;t.farAtom=t.atoms[0];for(var n=0,e=0;e<t.atoms.length;e++){var r=t.atoms[e],a=o[r.symbol].radius,i=2.5*Math.sqrt(a*a+a*a+a*a),u=Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z)+i;u>n&&(n=u,t.farAtom=r)}return t.farAtom});t.exports.getRadius=function(t){var n=u(t),e=a.MAX_ATOM_RADIUS,r=2.5*Math.sqrt(e*e+e*e+e*e);return Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z)+r}},function(t,n,e){var o;o=function(){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}return e.m=t,e.c=n,e.p="",e(0)}([function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.rnaPlot=n.RNAGraph=void 0;var o=e(1);Object.defineProperty(n,"RNAGraph",{enumerable:!0,get:function(){return o.RNAGraph}});var a=e(3);Object.defineProperty(n,"rnaPlot",{enumerable:!0,get:function(){return a.rnaPlot}}),n.FornaContainer=function(t,n){var e=this;if(e.options={displayAllLinks:!1,labelInterval:10,applyForce:!0,chargeDistance:110,friction:.35,middleCharge:-30,otherCharge:-30,linkDistanceMultiplier:15,initialSize:null,layout:"standard-polygonal",allowPanningAndZooming:!0,transitionDuration:500,resizeSvgOnResize:!0},arguments.length>1)for(var a in n)e.options.hasOwnProperty(a)&&(e.options[a]=n[a]);null!==e.options.initialSize?(e.options.svgW=e.options.initialSize[0],e.options.svgH=e.options.initialSize[1]):(e.options.svgW=800,e.options.svgH=800),l.default.scale.category20();var u=null,s=null,p=l.default.scale.linear().domain([0,e.options.svgW]).range([0,e.options.svgW]),d=l.default.scale.linear().domain([0,e.options.svgH]).range([0,e.options.svgH]),m=e.graph={nodes:[],links:[]};function g(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function v(t){var n=t,e=t.prevNode;if(null!==e&&t.linked){var r=[-(n.x-e.x),-(n.y-e.y)],o=[-(r=[r[0]/g(r),r[1]/g(r)])[1],r[0]],a=[t.radius*r[0],t.radius*r[1]],i="M"+(a[0]+6*(r[0]+o[0])/2)+","+(a[1]+6*(r[1]+o[1])/2)+"L"+a[0]+","+a[1]+"L"+(a[0]+6*(r[0]-o[0])/2)+","+(a[1]+6*(r[1]-o[1])/2);l.default.select(this).attr("d",i)}}function y(t){return"basepair"==t.linkType||"backbone"==t.linkType||"pseudoknot"==t.linkType||"label_link"==t.linkType||"external"==t.linkType||"chain_chain"==t.linkType}function b(t,n,e){if(t.hasOwnProperty(n.num)){var r=parseFloat(t[n.num]);return isNaN(r)?t[n.num]:e(r)}return"white"}function x(){}function M(){u&&(mpos=l.default.mouse(A.node()),P.attr("x1",u.x).attr("y1",u.y).attr("x2",mpos[0]).attr("y2",mpos[1]))}function w(){u&&P.attr("class","drag_line_hidden"),C()}e.linkStrengths={pseudoknot:0,proteinChain:0,chainChain:0,intermolecule:10,external:0,other:10},e.displayParameters={displayBackground:"true",displayNumbering:"true",displayNodeOutline:"true",displayNodeLabel:"true",displayLinks:"true",displayPseudoknotLinks:"true",displayProteinLinks:"true"},e.colorScheme="structure",e.customColors={},e.animation=e.options.applyForce,e.deaf=!1,e.rnas={},e.extraLinks=[],Array.prototype.equals=function(t){if(!t)return!1;if(this.length!=t.length)return!1;for(var n=0,e=this.length;n<e;n++)if(this[n]instanceof Array&&t[n]instanceof Array){if(!this[n].equals(t[n]))return!1}else if(this[n]!=t[n])return!1;return!0},e.createInitialLayout=function(t,n){var r={sequence:"",name:"empty",positions:[],labelInterval:e.options.labelInterval,avoidOthers:!0,uids:[],circularizeExternal:!0};if(2==arguments.length)for(var a in n)r.hasOwnProperty(a)&&(r[a]=n[a]);var i=new o.RNAGraph(r.sequence,t,r.name);i.circularizeExternal=r.circularizeExternal;var u=i.recalculateElements();if(0===r.positions.length)if("naview"==e.options.layout){var s=new h.NAView,l=s.naview_xy_coordinates(i.pairtable);r.positions=[];for(var f=0;f<l.nbase;f++)r.positions.push([l.x[f],l.y[f]])}else r.positions=(0,c.simpleXyCoordinates)(u.pairtable);return u=u.elementsToJson().addUids(r.uids).addPositions("nucleotide",r.positions).addLabels(1,r.labelInterval).reinforceStems().reinforceLoops().connectFakeNodes().reassignLinkUids().breakNodesToFakeNodes()},e.addRNA=function(t,n){var r=e.createInitialLayout(t,n);if(1===arguments.length&&(n={}),"extraLinks"in n){var o=e.addExternalLinks(r,n.extraLinks);e.extraLinks=e.extraLinks.concat(o)}return"avoidOthers"in n?e.addRNAJSON(r,n.avoidOthers):e.addRNAJSON(r,!0),r},e.addExternalLinks=function(t,n){for(var e=[],r=0;r<n.length;r++){var o={linkType:"external",value:1,uid:generateUUID(),source:null,target:null};if("[object Array]"===Object.prototype.toString.call(n[r][0])){for(var a=0;a<t.nodes.length;a++)if("nucs"in t.nodes[a]&&t.nodes[a].nucs.equals(n[r][0])){o.source=t.nodes[a];break}}else for(a=0;a<t.nodes.length;a++)t.nodes[a].num==n[r][0]&&(o.source=t.nodes[a]);if("[object Array]"===Object.prototype.toString.call(n[r][1]))for(a=0;a<t.nodes.length;a++)"nucs"in t.nodes[a]&&t.nodes[a].nucs.equals(n[r][1])&&(o.target=t.nodes[a]);else for(a=0;a<t.nodes.length;a++)t.nodes[a].num==n[r][1]&&(o.target=t.nodes[a]);null!=o.source&&null!=o.target?e.push(o):console.log("ERROR: source or target of new link not found:",o,n[r])}return e},e.addRNAJSON=function(t,n){var r,o;return n&&(r=e.graph.nodes.length>0?l.default.max(e.graph.nodes.map((function(t){return t.x}))):0,o=l.default.min(t.nodes.map((function(t){return t.x}))),t.nodes.forEach((function(t){t.x+=r-o+20,t.px+=r-o}))),t.nodes.forEach((function(n){n.rna=t})),e.rnas[t.uid]=t,e.recalculateGraph(),e.update(),e.centerView(),t},e.transitionRNA=function(t,n){var r=e.options.transitionDuration,o={uids:e.graph.nodes.filter((function(t){return"nucleotide"==t.nodeType})).map((function(t){return t.uid}))},a=e.createInitialLayout(t,o),i=T.selectAll("g.gnode").data(a.nodes,Y);0===(r=e.options.transitionDuration)?i.attr("transform",(function(t){return"translate("+[t.x,t.y]+")"})):i.transition().attr("transform",(function(t){return"translate("+[t.x,t.y]+")"})).duration(r);var u=E.selectAll("line.link").data(a.links.filter(y),X),s=e.createNewNodes(i.enter()).attr("transform",(function(t){return void 0!==t.x&&void 0!==t.y?"translate("+[0,0]+")":""}));0===r?i.exit().remove():i.exit().transition().attr("transform",(function(t){return void 0!==t.x&&void 0!==t.y?"translate("+[0,0]+")":""})),i.select("path").each(v),e.graph.nodes=i.data(),e.updateStyle(),e.centerView(r),u.exit().remove(),0===r?(u.attr("x1",(function(t){return t.source.x})).attr("y1",(function(t){return t.source.y})).attr("x2",(function(t){return t.target.x})).attr("y2",(function(t){return t.target.y})),e.createNewLinks(u.enter()),e.graph.links=u.data(),e.updateStyle()):u.transition().attr("x1",(function(t){return t.source.x})).attr("y1",(function(t){return t.source.y})).attr("x2",(function(t){return t.target.x})).attr("y2",(function(t){return t.target.y})).duration(r).call((function(t,n){0===t.size()&&setTimeout(n,r);var e=0;t.each((function(){++e})).each("end",(function(){--e||n.apply(this,arguments)}))}),(function(){e.createNewLinks(u.enter()),e.graph.links=u.data(),e.updateStyle(),void 0!==n&&n()})),0===r?s.attr("transform",(function(t){return void 0!==t.x&&void 0!==t.y?"translate("+[t.x,t.y]+")":""})):s.transition().attr("transform",(function(t){return void 0!==t.x&&void 0!==t.y?"translate("+[t.x,t.y]+")":""}))},e.recalculateGraph=function(){for(var t in e.graph.nodes=[],e.graph.links=[],e.rnas)e.graph.nodes=e.graph.nodes.concat(e.rnas[t].nodes),e.graph.links=e.graph.links.concat(e.rnas[t].links);for(var n={},r=0;r<e.graph.nodes.length;r++)n[e.graph.nodes[r].uid]=e.graph.nodes[r];for(e.graph.links.forEach((function(t){t.source=n[t.source.uid],t.target=n[t.target.uid]})),r=0;r<e.extraLinks.length;r++){if(e.extraLinks[r].target.uid in n||console.log("not there:",e.extraLinks[r]),e.extraLinks[r].source=n[e.extraLinks[r].source.uid],e.extraLinks[r].target=n[e.extraLinks[r].target.uid],"intermolecule"==e.extraLinks[r].linkType){fakeLinks=e.graph.links.filter((function(t){return(t.source==e.extraLinks[r].source||t.source==e.extraLinks[r].target||t.target==e.extraLinks[r].source||t.target==e.extraLinks[r].source)&&"fake"==t.linkType}));for(var o=0;o<fakeLinks.length;o++){var a=e.graph.links.indexOf(fakeLinks[o]);e.graph.links.splice(a,1)}}m.links.push(e.extraLinks[r])}},e.addNodes=function(t){t.links.forEach((function(n){"number"==typeof n.source&&(n.source=t.nodes[n.source]),"number"==typeof n.target&&(n.target=t.nodes[n.target])})),e.graph.nodes.length>0?(maxX=l.default.max(e.graph.nodes.map((function(t){return t.x}))),maxY=l.default.max(e.graph.nodes.map((function(t){return t.y})))):(maxX=0,maxY=0),t.nodes.forEach((function(t){t.rna.uid in e.rnas||(e.rnas[t.rna.uid]=t.rna),t.x+=maxX,t.px+=maxX})),r=new o.RNAGraph("",""),r.nodes=t.nodes,r.links=t.links,e.recalculateGraph(),e.update(),e.centerView()},e.addCustomColors=function(t){e.customColors=t},e.addCustomColorsText=function(t){var n=new f.ColorScheme(t);e.customColors=n.colorsJson,e.changeColorScheme("custom")},e.clearNodes=function(){e.graph.nodes=[],e.graph.links=[],e.rnas={},e.extraLinks=[],e.update()},e.toJSON=function(){var t={rnas:e.rnas,extraLinks:e.extraLinks};return JSON.stringify(t,(function(t,n){return"rna"==t?void 0:n}),"\t")},e.fromJSON=function(t){var n,a;try{var i=JSON.parse(t);n=i.rnas,a=i.extraLinks}catch(t){throw t}for(var u in n)"rna"==n[u].type?(r=new o.RNAGraph,r.seq=n[u].seq,r.dotbracket=n[u].dotbracket,r.circular=n[u].circular,r.pairtable=n[u].pairtable,r.uid=n[u].uid,r.structName=n[u].structName,r.nodes=n[u].nodes,r.links=n[u].links,r.rnaLength=n[u].rnaLength,r.elements=n[u].elements,r.nucsToNodes=n[u].nucsToNodes,r.pseudoknotPairs=n[u].pseudoknotPairs):(r=new ProteinGraph,r.size=n[u].size,r.nodes=n[u].nodes,r.uid=n[u].uid),e.addRNAJSON(r,!1);a.forEach((function(t){e.extraLinks.push(t)})),e.recalculateGraph(),e.update()},e.setSize=function(){if(null==e.options.initialSize){var n=l.default.select(t).node().offsetHeight,r=l.default.select(t).node().offsetWidth;e.options.svgW=r,e.options.svgH=n,p.range([0,r]).domain([0,r]),d.range([0,n]).domain([0,n]),e.zoomer.x(p).y(d),e.brusher.x(p).y(d),e.centerView(),e.options.resizeSvgOnResize&&_.attr("width",r).attr("height",n)}},e.setOutlineColor=function(t){T.selectAll("g.gnode").select("[node_type=nucleotide]").style("fill",t)},e.changeColorScheme=function(t){T.selectAll("[node_type=protein]").classed("protein",!0).attr("r",(function(t){return t.radius})),T.selectAll("g.gnode"),T.selectAll("g.gnode").selectAll("circle");var n=T.selectAll("g.gnode").select("[node_type=nucleotide]");if(e.colorScheme=t,"sequence"==t){var r=l.default.scale.ordinal().range(["#dbdb8d","#98df8a","#ff9896","#aec7e8","#aec7e8"]).domain(["A","C","G","U","T"]);n.style("fill",(function(t){return r(t.name)}))}else"structure"==t?(r=l.default.scale.category10().domain(["s","m","i","e","t","h","x"]).range(["lightgreen","#ff9896","#dbdb8d","lightsalmon","lightcyan","lightblue","transparent"]),n.style("fill",(function(t){return r(t.elemType)}))):"positions"==t?n.style("fill",(function(t){return l.default.scale.linear().range(["#98df8a","#dbdb8d","#ff9896"]).interpolate(l.default.interpolateLab).domain([1,1+(t.rna.rnaLength-1)/2,t.rna.rnaLength])(t.num)})):"custom"==t&&(void 0!==e.customColors&&"domain"in e.customColors&&"range"in e.customColors&&(r=l.default.scale.linear().interpolate(l.default.interpolateLab).domain(e.customColors.domain).range(e.customColors.range)),n.style("fill",(function(t){return void 0!==e.customColors&&e.customColors.hasOwnProperty("colorValues")?e.customColors.colorValues.hasOwnProperty(t.structName)&&e.customColors.colorValues[t.structName].hasOwnProperty(t.num)?b(e.customColors.colorValues[t.structName],t,r):e.customColors.colorValues.hasOwnProperty("")?b(e.customColors.colorValues[""],t,r):"white":"white"})))},window.addEventListener("resize",e.setSize,!1),e.zoomer=l.default.behavior.zoom().scaleExtent([.1,10]).x(p).y(d).on("zoomstart",R).on("zoom",N),l.default.select(t).select("svg").remove();var _=l.default.select(t).classed("forna-container",!0).attr("tabindex",1).on("keydown.brush",B).on("keyup.brush",I).each((function(){this.focus()})).append("svg:svg").attr("width",e.options.svgW).attr("height",e.options.svgH).attr("id","plotting-area");e.options.svg=_;var k=_.append("svg:g").on("mousemove",M).on("mousedown",x).on("mouseup",w);e.options.allowPanningAndZooming&&k.call(e.zoomer);var S=k.append("g").datum((function(){return{selected:!1,previouslySelected:!1}})).attr("class","brush"),A=k.append("svg:g"),E=A.append("svg:g"),T=A.append("svg:g");function R(){var t=T.selectAll("g.gnode").selectAll(".outline_node");t.each((function(t){t.selected=!1,t.previouslySelected=!1})),t.classed("selected",!1)}function N(){A.attr("transform","translate("+l.default.event.translate+") scale("+l.default.event.scale+")")}e.brusher=l.default.svg.brush().x(p).y(d).on("brushstart",(function(t){T.selectAll("g.gnode").selectAll(".outline_node").each((function(t){t.previouslySelected=L&&t.selected}))})).on("brush",(function(){var t=T.selectAll("g.gnode").selectAll(".outline_node"),n=l.default.event.target.extent();t.classed("selected",(function(t){return t.selected=e.options.applyForce&&t.previouslySelected^(n[0][0]<=t.x&&t.x<n[1][0]&&n[0][1]<=t.y&&t.y<n[1][1])}))})).on("brushend",(function(){l.default.event.target.clear(),l.default.select(this).call(l.default.event.target)})),S.call(e.brusher).on("mousedown.brush",null).on("touchstart.brush",null).on("touchmove.brush",null).on("touchend.brush",null),S.select(".background").style("cursor","auto"),e.getBoundingBoxTransform=function(){if(0===e.graph.nodes.length)return{translate:[0,0],scale:1};var t=l.default.min(e.graph.nodes.map((function(t){return t.x}))),n=l.default.min(e.graph.nodes.map((function(t){return t.y}))),r=l.default.max(e.graph.nodes.map((function(t){return t.x})))-t,o=l.default.max(e.graph.nodes.map((function(t){return t.y})))-n,a=e.options.svgW/(r+1),i=e.options.svgH/(o+1),u=.8*Math.min(a,i),s=r*u,c=o*u;return{translate:[-t*u+(e.options.svgW-s)/2,-n*u+(e.options.svgH-c)/2],scale:u}},e.centerView=function(t){0===arguments.length&&(t=0);var n=e.getBoundingBoxTransform();null!==n&&(A.transition().attr("transform","translate("+n.translate+") scale("+n.scale+")").duration(t),e.zoomer.translate(n.translate),e.zoomer.scale(n.scale))},e.force=l.default.layout.force().charge((function(t){return"middle"==t.nodeType?e.options.middleCharge:e.options.otherCharge})).friction(e.options.friction).linkDistance((function(t){return e.options.linkDistanceMultiplier*t.value})).linkStrength((function(t){return t.linkType in e.linkStrengths?e.linkStrengths[t.linkType]:e.linkStrengths.other})).gravity(0).nodes(e.graph.nodes).links(e.graph.links).chargeDistance(e.options.chargeDistance).size([e.options.svgW,e.options.svgH]);var P=A.append("line").attr("class","drag_line").attr("x1",0).attr("y1",0).attr("x2",0).attr("y2",0);function C(){u=null,s=null}var O=!1,L=!1;function U(t){var n=T.selectAll("g.gnode");return n.filter((function(t){return t.selected}))}function D(t){l.default.event.sourceEvent.stopPropagation(),t.selected||L||T.selectAll("g.gnode").selectAll(".outline_node").classed("selected",(function(t){return t.selected=e.options.applyForce&&(t.previouslySelected=!1)})),l.default.select(this).select(".outline_node").classed("selected",(function(n){return t.previouslySelected=t.selected,t.selected=e.options.applyForce&&!0})),U().each((function(t){t.fixed|=2}))}function z(t){U().each((function(t){t.x+=l.default.event.dx,t.y+=l.default.event.dy,t.px+=l.default.event.dx,t.py+=l.default.event.dy})),e.resumeForce(),l.default.event.sourceEvent.preventDefault()}function q(t){U().each((function(t){t.fixed&=-7}))}function j(t){var n=t.radius+16,e=t.x-n,r=t.x+n,o=t.y-n,a=t.y+n;return function(n,i,u,s,l){if(n.point&&n.point!==t){var c=t.x-n.point.x,f=t.y-n.point.y,h=Math.sqrt(c*c+f*f),p=t.radius+n.point.radius;h<p&&(h=(h-p)/h*.1,t.x-=c*=h,t.y-=f*=h,n.point.x+=c,n.point.y+=f)}return i>r||s<e||u>a||l<o}}e.resumeForce=function(){e.animation&&e.force.resume()};var F=l.default.behavior.drag().on("dragstart",D).on("drag",z).on("dragend",q);function B(){if(!e.deaf&&!O){switch(l.default.event.keyCode){case 16:O=!0;break;case 17:L=!0;break;case 67:e.centerView()}(O||L)&&(k.call(e.zoomer).on("mousedown.zoom",null).on("touchstart.zoom",null).on("touchmove.zoom",null).on("touchend.zoom",null),A.selectAll("g.gnode").on("mousedown.drag",null)),L&&(S.select(".background").style("cursor","crosshair"),S.call(e.brusher))}}function I(){O=!1,L=!1,S.call(e.brusher).on("mousedown.brush",null).on("touchstart.brush",null).on("touchmove.brush",null).on("touchend.brush",null),S.select(".background").style("cursor","auto"),k.call(e.zoomer),A.selectAll("g.gnode").call(F)}l.default.select(t).on("keydown",B).on("keyup",I).on("contextmenu",(function(){l.default.event.preventDefault()}));var X=function(t){return t.uid},Y=function(t){return t.uid},V=function(t){var n=t.getPositions("nucleotide"),r=t.getPositions("label"),o=t.getUids();t.recalculateElements().elementsToJson().addPseudoknots().addPositions("nucleotide",n).addUids(o).addLabels(1,e.options.labelInterval).addPositions("label",r).reinforceStems().reinforceLoops().updateLinkUids()},H=function(t){if(index=e.graph.links.indexOf(t),index>-1){if(t.source.rna==t.target.rna){var n=t.source.rna;n.addPseudoknots(),n.pairtable[t.source.num]=0,n.pairtable[t.target.num]=0,V(n)}else extraLinkIndex=e.extraLinks.indexOf(t),e.extraLinks.splice(extraLinkIndex,1);e.recalculateGraph()}e.update()},G=function(t){O&&(t.linkType in{backbone:!0,fake:!0,fake_fake:!0,label_link:!0}||H(t))};e.addLink=function(t){t.source.rna==t.target.rna?(r=t.source.rna,r.pairtable[t.source.num]=t.target.num,r.pairtable[t.target.num]=t.source.num,V(r)):(t.linkType="intermolecule",e.extraLinks.push(t)),e.recalculateGraph(),e.update()};var W=function(t){l.default.event.defaultPrevented||(L||T.selectAll("g.gnode").selectAll(".outline_node").classed("selected",(function(t){return t.selected=e.options.applyForce&&(t.previouslySelected=!1)})),l.default.select(this).select("circle").classed("selected",t.selected=e.options.applyForce&&!t.previouslySelected))},Z=function(t){if(u){if((s=t)==u)return void C();var n={source:u,target:s,linkType:"basepair",value:1,uid:generateUUID()};for(i=0;i<e.graph.links.length;i++){if(!(e.graph.links[i].source!=u&&e.graph.links[i].target!=u&&e.graph.links[i].source!=s&&e.graph.links[i].target!=s||"basepair"!=e.graph.links[i].linkType&&"pseudoknot"!=e.graph.links[i].linkType))return;if((e.graph.links[i].source==s&&e.graph.links[i].target==u||e.graph.links[i].source==u&&e.graph.links[i].target==s)&&"backbone"==e.graph.links[i].linkType)return}if("middle"==s.nodeType||"middle"==u.nodeType||"label"==s.nodeType||"label"==u.nodeType)return;e.addLink(n)}},J=function(t){t.selected||L||T.selectAll("g.gnode").selectAll(".outline_node").classed("selected",(function(t){return t.selected=t.previouslySelected=!1})),l.default.select(this).classed("selected",(function(n){return t.previouslySelected=t.selected,t.selected=e.options.applyForce&&!0})),O&&(u=t,P.attr("class","drag_line").attr("x1",u.x).attr("y1",u.y).attr("x2",u.x).attr("y2",u.y))};e.startAnimation=function(){e.animation=!0,A.selectAll("g.gnode").call(F),e.force.start()},e.stopAnimation=function(){e.animation=!1,A.selectAll("g.gnode").on("mousedown.drag",null),e.force.stop()},e.setFriction=function(t){e.force.friction(t),e.resumeForce()},e.setCharge=function(t){e.force.charge(t),e.resumeForce()},e.setGravity=function(t){e.force.gravity(t),e.resumeForce()},e.setPseudoknotStrength=function(t){e.linkStrengths.pseudoknot=t,e.update()},e.displayBackground=function(t){e.displayParameters.displayBackground=t,e.updateStyle()},e.displayNumbering=function(t){e.displayParameters.displayNumbering=t,e.updateStyle()},e.displayNodeOutline=function(t){e.displayParameters.displayNodeOutline=t,e.updateStyle()},e.displayNodeLabel=function(t){e.displayParameters.displayNodeLabel=t,e.updateStyle()},e.displayLinks=function(t){e.displayParameters.displayLinks=t,e.updateStyle()},e.displayPseudoknotLinks=function(t){e.displayParameters.displayPseudoknotLinks=t,e.updateStyle()},e.displayProteinLinks=function(t){e.displayParameters.displayProteinLinks=t,e.updateStyle()},e.updateStyle=function(){T.selectAll("[node_type=label]").classed("transparent",!e.displayParameters.displayNumbering),T.selectAll("[label_type=label]").classed("transparent",!e.displayParameters.displayNumbering),E.selectAll("[linkType=label_link]").classed("transparent",!e.displayParameters.displayNumbering),_.selectAll("circle").classed("hidden_outline",!e.displayParameters.displayNodeOutline),T.selectAll("[label_type=nucleotide]").classed("transparent",!e.displayParameters.displayNodeLabel),_.selectAll("[link_type=real],[link_type=basepair],[link_type=backbone],[link_type=pseudoknot],[link_type=protein_chain],[link_type=chain_chain],[link_type=external]").classed("transparent",!e.displayParameters.displayLinks),_.selectAll("[link_type=pseudoknot]").classed("transparent",!e.displayParameters.displayPseudoknotLinks),_.selectAll("[link_type=protein_chain]").classed("transparent",!e.displayParameters.displayProteinLinks),E.selectAll("[link_type=fake]").classed("transparent",!e.options.displayAllLinks),E.selectAll("[link_type=fake_fake]").classed("transparent",!e.options.displayAllLinks)},e.createNewLinks=function(t){var n=t.append("svg:line");return n.append("svg:title").text(X),n.classed("link",!0).attr("x1",(function(t){return t.source.x})).attr("y1",(function(t){return t.source.y})).attr("x2",(function(t){return t.target.x})).attr("y2",(function(t){return t.target.y})).attr("link_type",(function(t){return t.linkType})).attr("class",(function(t){return l.default.select(this).attr("class")+" "+t.linkType})).attr("pointer-events",(function(t){return"fake"==t.linkType?"none":"all"})),n},e.createNewNodes=function(t){(t=t.append("g").classed("noselect",!0).classed("gnode",!0).attr("struct_name",(function(t){return t.structName})).attr("transform",(function(t){return void 0!==t.x&&void 0!==t.y?"translate("+[t.x,t.y]+")":""})).each((function(t){t.selected=t.previouslySelected=!1}))).call(F).on("mousedown",J).on("mousedrag",(function(t){})).on("mouseup",Z).attr("num",(function(t){return"n"+t.num})).attr("rnum",(function(t){return"n"+(t.rna.rnaLength-t.num+1)})).on("click",W).transition().duration(750).ease("elastic");var n=t.filter((function(t){return"label"==t.nodeType||"protein"==t.nodeType})),e=t.filter((function(t){return"nucleotide"==t.nodeType}));return n.append("svg:circle").attr("class","outline_node").attr("r",(function(t){return t.radius+1})),e.append("svg:circle").attr("class","outline_node").attr("r",(function(t){return t.radius+1})),n.append("svg:circle").attr("class","node").classed("label",(function(t){return"label"==t.nodeType})).attr("r",(function(t){return"middle"==t.nodeType?0:t.radius})).attr("node_type",(function(t){return t.nodeType})).attr("node_num",(function(t){return t.num})),e.append("svg:circle").attr("class","node").attr("node_type",(function(t){return t.nodeType})).attr("node_num",(function(t){return t.num})).attr("r",(function(t){return t.radius})).append("svg:title").text((function(t){return"nucleotide"==t.nodeType?t.structName+":"+t.num:""})),e.append("svg:path").attr("class","node").attr("node_type",(function(t){return t.nodeType})).attr("node_num",(function(t){return t.num})).append("svg:title").text((function(t){return"nucleotide"==t.nodeType?t.structName+":"+t.num:""})),t.append("text").text((function(t){return t.name})).attr("text-anchor","middle").attr("font-size",8).attr("font-weight","bold").attr("y",2.5).attr("class","node-label").attr("label_type",(function(t){return t.nodeType})).append("svg:title").text((function(t){return"nucleotide"==t.nodeType?t.structName+":"+t.num:""})),t},e.update=function(){e.force.nodes(e.graph.nodes).links(e.graph.links),e.animation&&e.force.start();var t=E.selectAll("line.link").data(e.graph.links.filter(y),X);t.attr("class","").classed("link",!0).attr("link_type",(function(t){return t.linkType})).attr("class",(function(t){return l.default.select(this).attr("class")+" "+t.linkType}));var n=t.enter();e.createNewLinks(n),t.exit().remove(),l.default.scale.category10().domain([0,1,2,3,4,5,6,7,8,9]);var r=T.selectAll("g.gnode").data(e.graph.nodes,Y),o=r.enter();e.createNewNodes(o),r.exit().remove();var a,i=e.graph.nodes.filter((function(t){return"nucleotide"==t.nodeType||"label"==t.nodeType}));a=e.displayFakeLinks?t:E.selectAll("[link_type=real],[link_type=pseudoknot],[link_type=protein_chain],[link_type=chain_chain],[link_type=label_link],[link_type=backbone],[link_type=basepair],[link_type=intermolecule],[link_type=external]"),r.selectAll("path").each(v),a.on("click",G),e.force.on("tick",(function(){for(var t=l.default.geom.quadtree(i),n=0,e=i.length;++n<e;)t.visit(j(i[n]));a.attr("x1",(function(t){return t.source.x})).attr("y1",(function(t){return t.source.y})).attr("x2",(function(t){return t.target.x})).attr("y2",(function(t){return t.target.y})),r.attr("transform",(function(t){return"translate("+[t.x,t.y]+")"})),r.select("path").each(v)})),e.changeColorScheme(e.colorScheme),e.animation&&e.force.start(),e.updateStyle()},e.setSize()},e(15);var u,s=e(17),l=(u=s)&&u.__esModule?u:{default:u},c=e(4),f=e(2),h=e(5)},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.ProteinGraph=i,n.RNAGraph=u,n.moleculesToJson=function(t){for(var n={},e=[],r=[],o=0;o<t.molecules.length;o++){var s,l=t.molecules[o];"rna"==l.type?((s=new u(l.seq,l.ss,l.header)).circularizeExternal=!0,s.elementsToJson().addPositions("nucleotide",l.positions).addLabels().reinforceStems().reinforceLoops()):"protein"==l.type&&(s=new i(l.header,l.size)),s.addUids(l.uids);for(var c=0;c<s.nodes.length;c++)n[s.nodes[c].uid]=s.nodes[c];e.push(s)}for(o=0;o<t.extraLinks.length;o++)link=t.extraLinks[o],link.source=n[link.source],link.target=n[link.target],link.uid=a(),r.push(link);return{graphs:e,extraLinks:r}};var r=e(2),o=function(t,n){return t-n};function a(){var t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(n){var e=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==n?e:3&e|8).toString(16)}))}function i(t,n,e){var r=this;r.type="protein",r.size=n,r.nodes=[{name:"P",num:1,radius:3*Math.sqrt(n),rna:r,nodeType:"protein",structName:t,elemType:"p",size:n,uid:a()}],r.links=[],r.uid=a(),r.addUids=function(t){for(var n=0;n<t.length;n++)r.nodes[n].uid=t[n];return r},r.getUids=function(){uids=[];for(var t=0;t<r.dotbracket.length;t++)uids.push(r.nodes[t].uid);return uids}}function u(t,n,e,i){var u=this;u.type="rna",u.circularizeExternal=!1,0===arguments.length?(u.seq="",u.dotbracket="",u.structName=""):(u.seq=t,u.dotbracket=n,u.structName=e),arguments.length<4&&(i=1),u.circular=!1,u.dotbracket.length>0&&"*"==u.dotbracket[u.dotbracket.length-1]&&(u.dotbracket=u.dotbracket.slice(0,u.dotbracket.length-1),u.circular=!0),u.uid=a(),u.elements=[],u.pseudoknotPairs=[],u.nucsToNodes={},u.addUids=function(t){for(var n=u.nodes.filter((function(t){return"nucleotide"==t.nodeType})),e=0;e<t.length&&e<n.length;e++)n[e].uid=t[e];return u},u.computePairtable=function(){u.pairtable=r.rnaUtilities.dotbracketToPairtable(u.dotbracket)},u.removeBreaks=function(t){for(var n=[],e=-1;(e=t.indexOf("&"))>=0;)n.push(e),t=t.substring(0,e)+"oo"+t.substring(e+1,t.length);return{targetString:t,breaks:n}};var s=u.removeBreaks(u.dotbracket);u.dotbracket=s.targetString,u.dotBracketBreaks=s.breaks,s=u.removeBreaks(u.seq),u.seq=s.targetString,u.seqBreaks=s.breaks,u.calculateStartNumberArray=function(){u.startNumberArray=[];for(var t=0;t<u.dotbracket.length;t++)u.startNumberArray.push(i),"o"==u.dotbracket[t]&&(i=-t)},u.calculateStartNumberArray(),u.rnaLength=u.dotbracket.length,(0,r.arraysEqual)(u.dotBracketBreaks,u.seqBreaks)||(console.log("WARNING: Sequence and structure breaks not equal"),console.log("WARNING: Using the breaks in the structure")),u.computePairtable(),u.addPositions=function(t,n){for(var e=u.nodes.filter((function(n){return n.nodeType==t})),r=0;r<e.length;r++)e[r].x=n[r][0],e[r].px=n[r][0],e[r].y=n[r][1],e[r].py=n[r][1];return u},u.breakNodesToFakeNodes=function(){for(var t=u.nodes.filter((function(t){return"nucleotide"==t.nodeType})),n=0;n<t.length;n++)"o"==u.dotbracket[n]&&(t[n].nodeType="middle");for(n=0;n<u.elements.length;n++){for(var e=!1,r=0;r<u.elements[n][2].length;r++)u.dotBracketBreaks.indexOf(u.elements[n][2][r])>=0&&(e=!0);e?u.elements[n][2].map((function(t){0!=t&&(u.nodes[t-1].elemType="e")})):u.elements[n][2].map((function(t){0!=t&&(u.nodes[t-1].elemType=u.elements[n][0])}))}return u},u.getPositions=function(t){for(var n=[],e=u.nodes.filter((function(n){return n.nodeType==t})),r=0;r<e.length;r++)n.push([e[r].x,e[r].y]);return n},u.getUids=function(){for(var t=[],n=0;n<u.dotbracket.length;n++)t.push(u.nodes[n].uid);return t},u.reinforceStems=function(){for(var t=u.pairtable,n=u.elements.filter((function(t){return"s"==t[0]&&t[2].length>=4})),e=0;e<n.length;e++)for(var r=n[e][2],o=r.slice(0,r.length/2),a=0;a<o.length-1;a++)u.addFakeNode([o[a],o[a+1],t[o[a+1]],t[o[a]]]);return u},u.reinforceLoops=function(){for(var t=function(t){return 0!==t&&t<=u.dotbracket.length},n=0;n<u.elements.length;n++)if("s"!=u.elements[n][0]&&(u.circularizeExternal||"e"!=u.elements[n][0])){var e=u.elements[n][2].filter(t);if("e"==u.elements[n][0]){var r={name:"",num:-3,radius:0,rna:u,nodeType:"middle",elemType:"f",nucs:[],x:u.nodes[u.rnaLength-1].x,y:u.nodes[u.rnaLength-1].y,px:u.nodes[u.rnaLength-1].px,py:u.nodes[u.rnaLength-1].py,uid:a()},o={name:"",num:-2,radius:0,rna:u,nodeType:"middle",elemType:"f",nucs:[],x:u.nodes[0].x,y:u.nodes[0].y,px:u.nodes[0].px,py:u.nodes[0].py,uid:a()};e.push(u.nodes.length+1),e.push(u.nodes.length+2),u.nodes.push(r),u.nodes.push(o)}u.addFakeNode(e)}return u},u.updateLinkUids=function(){for(var t=0;t<u.links.length;t++)u.links[t].uid=u.links[t].source.uid+u.links[t].target.uid;return u},u.addFakeNode=function(t){for(var n=6.283/(2*t.length),e=18/(2*Math.tan(n)),r="",o=0;o<t.length;o++)r+=u.nodes[t[o]-1].uid;var i={name:"",num:-1,radius:e,rna:u,nodeType:"middle",elemType:"f",nucs:t,uid:r};u.nodes.push(i);var s=0,l=0,c=0;n=3.14159*(t.length-2)/(2*t.length),e=.5/Math.cos(n);for(var f=0;f<t.length;f++)if(!(0===t[f]||t[f]>u.dotbracket.length)){u.links.push({source:u.nodes[t[f]-1],target:u.nodes[u.nodes.length-1],linkType:"fake",value:e,uid:a()}),t.length>4&&u.links.push({source:u.nodes[t[f]-1],target:u.nodes[t[(f+Math.floor(t.length/2))%t.length]-1],linkType:"fake",value:2*e,uid:a()});var h=3.14159*(t.length-2)/t.length,p=2*Math.cos(1.570795-h/2);u.links.push({source:u.nodes[t[f]-1],target:u.nodes[t[(f+2)%t.length]-1],linkType:"fake",value:p});var d=u.nodes[t[f]-1];"x"in d&&(s+=d.x,l+=d.y,c+=1)}return c>0&&(i.x=s/c,i.y=l/c,i.px=i.x,i.py=i.y),u},u.connectFakeNodes=function(){for(var t={},n=u.nodes.filter((function(t){return"middle"==t.nodeType})),e=new Set,r=1;r<=u.nodes.length;r++)t[r]=[];for(r=0;r<n.length;r++)for(var o=n[r],a=0;a<o.nucs.length;a++){for(var i=o.nucs[a],s=0;s<t[i].length;s++)if(!e.has(JSON.stringify([t[i][s].uid,o.uid].sort()))){var l=t[i][s].radius+o.radius;u.links.push({source:t[i][s],target:o,value:l/18,linkType:"fake_fake"}),e.add(JSON.stringify([t[i][s].uid,o.uid].sort()))}t[i].push(o)}return u},u.addExtraLinks=function(t){if(void 0===t)return u;for(var n=0;n<t.length;n++){var e={source:u.getNodeFromNucleotides(t[n].from),target:u.getNodeFromNucleotides(t[n].to),linkType:"extra",extraLinkType:t[n].linkType,uid:a()};u.links.push(e)}return u},u.elementsToJson=function(){var t=u.pairtable;u.elements,u.nodes=[],u.links=[];var n={};u.elements.sort();for(var e=0;e<u.elements.length;e++)for(var r=u.elements[e][2],o=0;o<r.length;o++)n[r[o]]=u.elements[e][0];for(e=1;e<=t[0];e++){var i=u.seq[e-1];(u.dotBracketBreaks.indexOf(e-1)>=0||u.dotBracketBreaks.indexOf(e-2)>=0)&&(i=""),u.nodes.push({name:i,num:e+u.startNumberArray[e-1]-1,radius:5,rna:u,nodeType:"nucleotide",structName:u.structName,elemType:n[e],uid:a(),linked:!1})}for(e=0;e<u.nodes.length;e++)u.nodes[e].prevNode=0===e?null:u.nodes[e-1],e==u.nodes.length-1?u.nodes[e].nextNode=null:u.nodes[e].nextNode=u.nodes[e+1];for(e=1;e<=t[0];e++)0!==t[e]&&u.links.push({source:u.nodes[e-1],target:u.nodes[t[e]-1],linkType:"basepair",value:1,uid:a()}),e>1&&-1===u.dotBracketBreaks.indexOf(e-1)&&-1==u.dotBracketBreaks.indexOf(e-2)&&-1==u.dotBracketBreaks.indexOf(e-3)&&(u.links.push({source:u.nodes[e-2],target:u.nodes[e-1],linkType:"backbone",value:1,uid:a()}),u.nodes[e-1].linked=!0);for(e=0;e<u.pseudoknotPairs.length;e++)u.links.push({source:u.nodes[u.pseudoknotPairs[e][0]-1],target:u.nodes[u.pseudoknotPairs[e][1]-1],linkType:"pseudoknot",value:1,uid:a()});return u.circular&&u.links.push({source:u.nodes[0],target:u.nodes[u.rnaLength-1],linkType:"backbone",value:1,uid:a()}),u},u.ptToElements=function(t,n,e,r){var a=[],i=[e-1],s=[r+1];if(e>r)return[];for(;0===t[e];e++)i.push(e);for(;0===t[r];r--)s.push(r);if(e>r){if(i.push(e),0===n)return[["e",n,i.sort(o)]];for(var l=!1,c=[],f=[],h=0;h<i.length;h++)l?f.push(i[h]):c.push(i[h]),u.dotBracketBreaks.indexOf(i[h])>=0&&(l=!0);return[["h",n,i.sort(o)]]}if(t[e]!=r){var p=i;for(h=e,p.push(h);h<=r;){for(a=a.concat(u.ptToElements(t,n,h,t[h])),p.push(t[h]),h=t[h]+1;0===t[h]&&h<=r;h++)p.push(h);p.push(h)}return p.pop(),(p=p.concat(s)).length>0&&(0===n?a.push(["e",n,p.sort(o)]):a.push(["m",n,p.sort(o)])),a}t[e]===r&&(i.push(e),s.push(r),i.concat(s).length>4&&(0===n?a.push(["e",n,i.concat(s).sort(o)]):a.push(["i",n,i.concat(s).sort(o)])));for(var d=[];t[e]===r&&e<r;)d.push(e),d.push(r),e+=1,r-=1,n+=1;return i=[e-1],s=[r+1],a.push(["s",n,d.sort(o)]),a.concat(u.ptToElements(t,n,e,r))},u.addLabels=function(t,n){if(0===arguments.length&&(t=1,n=10),1===arguments.length&&(n=10),0===n)return u;n<=0&&console.log("The label interval entered in invalid:",n);for(var e=1;e<=u.pairtable[0];e++)if(e%n==0){var r,o,i,s,l=u.nodes[e-1];1==u.rnaLength?(s=[l.x-15,l.y],i=[l.x-15,l.y]):(r=1==e?u.nodes[u.rnaLength-1]:u.nodes[e-2],o=e==u.rnaLength?u.nodes[0]:u.nodes[e],0!==u.pairtable[o.num]&&0!==u.pairtable[r.num]&&0!==u.pairtable[l.num]&&(r=o=u.nodes[u.pairtable[l.num]-1]),0===u.pairtable[l.num]||0!==u.pairtable[o.num]&&0!==u.pairtable[r.num]?(s=[o.x-l.x,o.y-l.y],i=[r.x-l.x,r.y-l.y]):(s=[l.x-o.x,l.y-o.y],i=[l.x-r.x,l.y-r.y]));var c=[s[0]+i[0],s[1]+i[1]],f=Math.sqrt(c[0]*c[0]+c[1]*c[1]),h=[c[0]/f,c[1]/f],p=[-15*h[0],-15*h[1]],d=u.nodes[e-1].x+p[0],m=u.nodes[e-1].y+p[1],g={name:e+u.startNumberArray[e-1]-1,num:-1,radius:6,rna:u,nodeType:"label",structName:u.structName,elemType:"l",x:d,y:m,px:d,py:m,uid:a()},v={source:u.nodes[e-1],target:g,value:1,linkType:"label_link",uid:a()};u.nodes.push(g),u.links.push(v)}return u},u.recalculateElements=function(){if(u.removePseudoknots(),u.elements=u.ptToElements(u.pairtable,0,1,u.dotbracket.length),u.circular&&(externalLoop=u.elements.filter((function(t){if("e"==t[0])return!0})),externalLoop.length>0)){eloop=externalLoop[0],nucs=eloop[2].sort(o),prev=nucs[0],hloop=!0,numGreater=0;for(var t=1;t<nucs.length;t++)nucs[t]-prev>1&&(numGreater+=1),prev=nucs[t];1==numGreater?eloop[0]="h":2==numGreater?eloop[0]="i":eloop[0]="m"}return u},u.reassignLinkUids=function(){for(var t=0;t<u.links.length;t++)u.links[t].uid=u.links[t].source.uid+u.links[t].target.uid;return u},u.removePseudoknots=function(){return u.pairtable.length>1&&(u.pseudoknotPairs=u.pseudoknotPairs.concat(r.rnaUtilities.removePseudoknotsFromPairtable(u.pairtable))),u},u.addPseudoknots=function(){for(var t=u.pairtable,n=u.pseudoknotPairs,e=0;e<n.length;e++)t[n[e][0]]=n[e][1],t[n[e][1]]=n[e][0];return u.pseudoknotPairs=[],u},u.addName=function(t){return void 0===t?(u.name="",u):(u.name=t,u)},u.rnaLength>0&&u.recalculateElements()}void 0===String.prototype.trim&&(String.prototype.trim=function(){return String(this).replace(/^\s+|\s+$/g,"")})},function(t,n,e){t.exports=function(t){function n(r){if(e[r])return e[r].exports;var o=e[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var e={};return n.m=t,n.c=e,n.p="",n(0)}([function(t,n,e){t.exports=e(1)},function(t,n){"use strict";function e(){var t=this;t.bracketLeft="([{<ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),t.bracketRight=")]}>abcdefghijklmnopqrstuvwxyz".split(""),t.inverseBrackets=function(t){for(var n={},e=0;e<t.length;e++)n[t[e]]=e;return n},t.maximumMatching=function(t){for(var n=t[0],e=new Array(n+1),r=0;n>=r;r++){e[r]=new Array(n+1);for(var o=r;n>=o;o++)e[r][o]=0}var a=0;for(r=n-0-1;r>0;r--)for(o=r+0+1;n>=o;o++){a=e[r][o-1];for(var i=o-0-1;i>=r;i--)t[i]===o&&(a=Math.max(a,(i>r?e[r][i-1]:0)+1+(o-i-1>0?e[i+1][o-1]:0)));e[r][o]=a}return a=e[1][n],e},t.backtrackMaximumMatching=function(n,e){var r=Array.apply(null,Array(n.length)).map((function(){return 0}));return t.mmBt(n,r,e,1,n.length-1),r},t.mmBt=function(n,e,r,o,a){var i=n[o][a];if(!(0>a-o-1)){if(n[o][a-1]==i)return void t.mmBt(n,e,r,o,a-1);for(var u=a-0-1;u>=o;u--)if(r[a]===u&&(u>o?n[o][u-1]:0)+(a-u-1>0?n[u+1][a-1]:0)+1==i)return e[u]=a,e[a]=u,u>o&&t.mmBt(n,e,r,o,u-1),void t.mmBt(n,e,r,u+1,a-1);console.log("FAILED!!!"+o+","+a+": backtracking failed!")}},t.dotbracketToPairtable=function(n){var e=Array.apply(null,new Array(n.length+1)).map(Number.prototype.valueOf,0);e[0]=n.length;for(var r={},o=0;o<t.bracketLeft.length;o++)r[o]=[];var a=t.inverseBrackets(t.bracketLeft),i=t.inverseBrackets(t.bracketRight);for(o=0;o<n.length;o++){var u=n[o],s=o+1;if("."==u||"o"==u)e[s]=0;else if(u in a)r[a[u]].push(s);else{if(!(u in i))throw"Unknown symbol in dotbracket string";var l=r[i[u]].pop();e[s]=l,e[l]=s}}for(var c in r)if(r[c].length>0)throw"Unmatched base at position "+r[c][0];return e},t.insertIntoStack=function(t,n,e){for(var r=0;t[r].length>0&&t[r][t[r].length-1]<e;)r+=1;return t[r].push(e),r},t.deleteFromStack=function(t,n){for(var e=0;0===t[e].length||t[e][t[e].length-1]!=n;)e+=1;return t[e].pop(),e},t.pairtableToDotbracket=function(n){for(var e={},r=0;r<n[0];r++)e[r]=[];var o={},a="";for(r=1;r<n[0]+1;r++){if(0!==n[r]&&n[r]in o)throw"Invalid pairtable contains duplicate entries";o[n[r]]=!0,a+=0===n[r]?".":n[r]>r?t.bracketLeft[t.insertIntoStack(e,r,n[r])]:t.bracketRight[t.deleteFromStack(e,r)]}return a},t.findUnmatched=function(n,e,r){for(var o=[],a=[],i=e,u=r,s=e;r>=s;s++)0!==n[s]&&(n[s]<e||n[s]>r)&&a.push([s,n[s]]);for(s=i;u>=s;s++){for(;0===n[s]&&u>=s;)s++;for(r=n[s];n[s]===r;)s++,r--;o=o.concat(t.findUnmatched(n,s,r))}return a.length>0&&o.push(a),o},t.removePseudoknotsFromPairtable=function(n){for(var e=t.maximumMatching(n),r=t.backtrackMaximumMatching(e,n),o=[],a=1;a<n.length;a++)n[a]<a||r[a]!=n[a]&&(o.push([a,n[a]]),n[n[a]]=0,n[a]=0);return o},t.ptToElements=function(n,e,o,a,i){var u=[],s=[o-1],l=[a+1];if(arguments.length<5&&(i=[]),o>a)return[];for(;0===n[o];o++)s.push(o);for(;0===n[a];a--)l.push(a);if(o>a){if(s.push(o),0===e)return[["e",e,s.sort(r)]];for(var c=!1,f=[],h=[],p=0;p<s.length;p++)c?h.push(s[p]):f.push(s[p]),i.indexOf(s[p])>=0&&(c=!0);return[["h",e,s.sort(r)]]}if(n[o]!=a){var d=s;for(p=o,d.push(p);a>=p;){for(u=u.concat(t.ptToElements(n,e,p,n[p],i)),d.push(n[p]),p=n[p]+1;0===n[p]&&a>=p;p++)d.push(p);d.push(p)}return d.pop(),(d=d.concat(l)).length>0&&(0===e?u.push(["e",e,d.sort(r)]):u.push(["m",e,d.sort(r)])),u}if(n[o]===a){s.push(o),l.push(a);var m=s.concat(l);m.length>4&&(0===e?u.push(["e",e,s.concat(l).sort(r)]):u.push(["i",e,s.concat(l).sort(r)]))}for(var g=[];n[o]===a&&a>o;)g.push(o),g.push(a),o+=1,a-=1,e+=1;return s=[o-1],l=[a+1],u.push(["s",e,g.sort(r)]),u.concat(t.ptToElements(n,e,o,a,i))}}Object.defineProperty(n,"__esModule",{value:!0}),n.arraysEqual=function(t,n){if(t===n)return!0;if(null===t||null===n)return!1;if(t.length!=n.length)return!1;for(var e=0;e<t.length;++e)if(t[e]!==n[e])return!1;return!0},n.RNAUtilities=e,n.ColorScheme=function(t){var n=this;return n.colorsText=t,n.parseRange=function(t){for(var n=t.split(","),e=[],r=0;r<n.length;r++){var o=n[r].split("-");if(1==o.length)e.push(parseInt(o[0]));else if(2==o.length)for(var a=parseInt(o[0]),i=parseInt(o[1]),u=a;i>=u;u++)e.push(u);else console.log("Malformed range (too many dashes):",t)}return e},n.parseColorText=function(t){for(var e=t.split("\n"),r="",o=1,a={colorValues:{"":{}},range:["white","steelblue"]},i=[],u=0;u<e.length;u++)if(">"!=e[u][0])for(var s=e[u].trim().split(/[\s]+/),l=0;l<s.length;l++)if(isNaN(s[l])){if(0===s[l].search("range")){var c=s[l].split("=")[1].split(":");a.range=[c[0],c[1]];continue}if(0==s[l].search("domain")){c=s[l].split("=")[1].split(":"),a.domain=[c[0],c[1]];continue}for(var f=s[l].split(":"),h=n.parseRange(f[0]),p=f[1],d=0;d<h.length;d++)isNaN(p)?a.colorValues[r][h[d]]=p:(a.colorValues[r][h[d]]=+p,i.push(Number(p)))}else a.colorValues[r][o]=Number(s[l]),o+=1,i.push(Number(s[l]));else r=e[u].trim().slice(1),o=1,a.colorValues[r]={};return"domain"in a||(a.domain=[Math.min.apply(null,i),Math.max.apply(null,i)]),n.colorsJson=a,n},n.normalizeColors=function(){var t;for(var e in n.colorsJson){var r=Number.MAX_VALUE,o=Number.MIN_VALUE;for(var a in n.colorsJson.colorValues[e])"number"==typeof(t=n.colorsJson.colorValues[e][a])&&(r>t&&(r=t),t>o&&(o=t));for(a in n.colorsJson.colorValues[e])"number"==typeof(t=n.colorsJson.colorValues[e][a])&&(n.colorsJson.colorValues[e][a]=(t-r)/(o-r))}return n},n.parseColorText(n.colorsText),n};var r=function(t,n){return t-n};n.rnaUtilities=new e}])},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.rnaPlot=function(){var t,n,e={width:400,height:400,nucleotideRadius:5,rnaEdgePadding:0,labelInterval:0,showNucleotideLabels:!0,startNucleotideNumber:1,bundleExternalLinks:!1};function a(a){a.each((function(a){var i=new r.RNAGraph(a.sequence,a.structure,a.name).recalculateElements().elementsToJson().addName(a.name);a.rnaGraph=i;for(var u=(new o.NAView).naview_xy_coordinates(i.pairtable),s=[],l=0;l<u.nbase;l++)s.push([u.x[l],u.y[l]]);i.addPositions("nucleotide",s).reinforceStems().reinforceLoops().addExtraLinks(a.extraLinks).addLabels(e.startNucleotideNumber,e.labelInterval);var c=function(r,o){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=d3.extent(r),u=d3.extent(o),s=30;""!=a&&(u[1]+=s),i[0]-=e.nucleotideRadius+e.rnaEdgePadding,u[0]-=e.nucleotideRadius+e.rnaEdgePadding,i[1]+=e.nucleotideRadius+e.rnaEdgePadding,u[1]+=e.nucleotideRadius+e.rnaEdgePadding;var l,c=i[1]-i[0],f=u[1]-u[0],h=c-e.width,p=f-e.height;function d(t,n,e){var r=(t.range()[1]-t.range()[0])/(t.domain()[1]-t.domain()[0]),o=(n[1]-n[0])*r,a=(e[1]-e[0]-o)/2;return{scaleFactor:r,scale:d3.scale.linear().domain(n).range([e[0]+a,e[1]-a])}}return h>p?(l=d(t=d3.scale.linear().domain(i).range([0,e.width]),u,[0,e.height]),n=l.scale):(l=d(n=d3.scale.linear().domain(u).range([0,e.height]),i,[0,e.width]),t=l.scale),t.range()[0],t.domain()[0],n.range()[0],n.domain()[0],"translate("+-(t.domain()[0]*l.scaleFactor-t.range()[0])+","+-(n.domain()[0]*l.scaleFactor-n.range()[0])+")scale("+l.scaleFactor+")"}(i.nodes.map((function(t){return t.x})),i.nodes.map((function(t){return t.y}))),f=d3.select(this).append("g").attr("transform",c),h=i.nodes.filter((function(t){return"nucleotide"==t.nodeType})),p=i.nodes.filter((function(t){return"label"==t.nodeType})),d=i.links;!function(t,n){n=n.filter((function(t){return null!==t.source&&null!==t.target})),t.selectAll(".rna-link").data(n).enter().append("svg:line").attr("x1",(function(t){return t.source.x})).attr("x2",(function(t){return t.target.x})).attr("y1",(function(t){return t.source.y})).attr("y2",(function(t){return t.target.y})).attr("link-type",(function(t){return t.linkType})).attr("extra-link-type",(function(t){return t.extraLinkType})).classed("rna-link",!0)}(f,d),function(t,n){var r=t.selectAll(".rna-base").data(n).enter().append("svg:g").attr("transform",(function(t){return"translate("+t.x+","+t.y+")"}));r.append("svg:circle").attr("r",e.nucleotideRadius).classed("rna-base",!0),e.showNucleotideLabels&&r.append("svg:text").text((function(t){return t.name})).attr("text-anchor","middle").attr("dominant-baseline","central").classed("nucleotide-label",!0).append("svg:title").text((function(t){return t.struct_name+":"+t.num}))}(f,h),function(t,n){t.selectAll(".rnaLabel").data(n).enter().append("svg:g").attr("transform",(function(t){return"translate("+t.x+","+t.y+")"})).append("svg:text").text((function(t){return t.name})).attr("text-anchor","middle").attr("font-weight","bold").attr("dominant-baseline","central").classed("number-label",!0)}(f,p),function(r,o){r.append("svg:text").attr("transform","translate("+t.invert(e.width/2)+","+n.invert(e.height)+")").attr("dy",-10).classed("rna-name",!0).text(o)}(f,a.name),e.bundleExternalLinks&&function(t,n){var e={},r=[];n=n.filter((function(t){return"correct"==t.linkType||"incorrect"==t.linkType||"extra"==t.linkType})),t.selectAll("[link-type=extra]").remove();for(var o=0;o<n.length;o++)null!==n[o].source&&null!==n[o].target&&(e[n[o].source.uid]=n[o].source,e[n[o].target.uid]=n[o].target,r.push({source:n[o].source.uid,target:n[o].target.uid,linkType:n[o].linkType,extraLinkType:n[o].extraLinkType}));var a=d3.ForceEdgeBundling().nodes(e).edges(r).compatibility_threshold(.8).step_size(.2)(),i=d3.svg.line().x((function(t){return t.x})).y((function(t){return t.y})).interpolate("linear");for(o=0;o<a.length;o++){var u=a[o];t.append("path").attr("d",i(u)).style("fill","none").attr("link-type",(function(t){return r[o].linkType})).attr("extra-link-type",(function(t){return r[o].extraLinkType})).style("stroke-opacity",.4)}}(f,d)}))}return a.width=function(t){return arguments.length?(e.width=t,a):e.width},a.height=function(t){return arguments.length?(e.height=t,a):e.height},a.showNucleotideLabels=function(t){return arguments.length?(e.showNucleotideLabels=t,a):e.showNucleotideLabels},a.rnaEdgePadding=function(t){return arguments.length?(e.rnaEdgePadding=t,a):e.rnaEdgePadding},a.nucleotideRadius=function(t){return arguments.length?(e.nucleotideRadius=t,a):e.nucleotideRadius},a.labelInterval=function(t){return arguments.length?(e.labelInterval=t,a):e.labelInterval},a.showNucleotideLabels=function(t){return arguments.length?(e.showNucleotideLabels=t,a):e.showNucleotideLabels},a.startNucleotideNumber=function(t){return arguments.length?(e.startNucleotideNumber=t,a):e.startNucleotideNumber},a.bundleExternalLinks=function(t){return arguments.length?(e.bundleExternalLinks=t,a):e.bundleExternalLinks},a},e(4);var r=e(1),o=e(5);e(2),e(11),void 0===String.prototype.trim&&(String.prototype.trim=function(){return String(this).replace(/^\s+|\s+$/g,"")})},function(t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.simpleXyCoordinates=function(t){var n,e,r,o=[],a=[];e=t[0];var i=Array.apply(null,new Array(e+5)).map(Number.prototype.valueOf,0),u=Array.apply(null,new Array(16+Math.floor(e/5))).map(Number.prototype.valueOf,0),s=Array.apply(null,new Array(16+Math.floor(e/5))).map(Number.prototype.valueOf,0),l=0,c=0,f=Math.PI/2;(function t(n,e,r){var o,a,h,p,d,m,g,v,y,b,x,M,w=2,_=0,k=0,S=Array.apply(null,new Array(3+2*Math.floor((e-n)/5))).map(Number.prototype.valueOf,0);for(o=n-1,e++;n!=e;)if((a=r[n])&&0!=n){w+=2,h=n,p=a,S[++_]=h,S[++_]=p,n=a+1,d=h,m=p,v=0;do{h++,p--,v++}while(r[h]==p&&r[h]>h);if(g=v-2,v>=2&&(i[d+1+g]+=f,i[m-1-g]+=f,i[d]+=f,i[m]+=f,v>2))for(;g>=1;g--)i[d+g]=Math.PI,i[m-g]=Math.PI;s[++c]=v,h<=p&&t(h,p,r)}else n++,w++,k++;for(M=Math.PI*(w-2)/w,S[++_]=e,y=o<0?0:o,b=1;b<=_;b++){for(x=S[b]-y,g=0;g<=x;g++)i[y+g]+=M;if(b>_)break;y=S[++b]}u[++l]=k})(0,e+1,t),u[l]-=2,r=0,o[0]=100,a[0]=100;var h=[];for(h.push([o[0],a[0]]),n=1;n<e;n++)o[n]=o[n-1]+15*Math.cos(r),a[n]=a[n-1]+15*Math.sin(r),h.push([o[n],a[n]]),r+=Math.PI-i[n+1];return h}},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.NAView=s;var r=e(6),o=e(7),a=e(9),i=e(10),u=e(8);function s(){this.ANUM=9999,this.MAXITER=500,this.bases=[],this.nbase=null,this.nregion=null,this.loop_count=null,this.root=new u.Loop,this.loops=[],this.regions=[],this.rlphead=new r.Radloop,this.lencut=.8,this.RADIUS_REDUCTION_FACTOR=1.4,this.angleinc=null,this._h=null,this.HELIX_FACTOR=.6,this.BACKBONE_DISTANCE=27}function l(){var t=new u.Loop,n=null,e=null;for(n=0;n<this.loop_count;n++){for(t=this.loops[n],e=0;e<this.loop_count;e++)this.loops[e].setMark(!1);t.setDepth(c(t))}}function c(t){var n=null,e=null,r=null;if(t.getNconnection()<=1)return 0;if(t.isMark())return-1;t.setMark(!0),n=0,e=0;for(var o=0;null!=t.getConnection(o);o++)(r=c(t.getConnection(o).getLoop()))>=0&&(1==++n?e=r:e>r&&(e=r));return t.setMark(!1),e+1}s.prototype.naview_xy_coordinates=function(t){var n,e=[],r=[];if(0===t.length||0===t[0])return 0;this.nbase=t[0],this.bases=[];for(var o=0;o<this.nbase+1;o++)this.bases.push(new i.Base);for(this.regions=[],o=0;o<this.nbase+1;o++)this.regions.push(new a.Region);for(this.read_in_bases(t),this.rlphead=null,this.find_regions(),this.loop_count=0,this.loops=[],o=0;o<this.nbase+1;o++)this.loops.push(new u.Loop);for(this.construct_loop(0),this.find_central_loop(),this.traverse_loop(this.root,null),n=0;n<this.nbase;n++)e.push(100+this.BACKBONE_DISTANCE*this.bases[n+1].getX()),r.push(100+this.BACKBONE_DISTANCE*this.bases[n+1].getY());return{nbase:this.nbase,x:e,y:r}},s.prototype.read_in_bases=function(t){var n=null,e=null;for(this.bases.push(new i.Base),this.bases[0].setMate(0),this.bases[0].setExtracted(!1),this.bases[0].setX(this.ANUM),this.bases[0].setY(this.ANUM),e=0,n=1;n<=this.nbase;n++)this.bases.push(new i.Base),this.bases[n].setExtracted(!1),this.bases[n].setX(this.ANUM),this.bases[n].setY(this.ANUM),this.bases[n].setMate(t[n]),t[n]>n&&e++;0==e&&(this.bases[1].setMate(this.nbase),this.bases[this.nbase].setMate(1))},s.prototype.find_regions=function(){var t,n=null,e=null;t=this.nbase+1;var r=[];for(n=0;n<t;n++)r.push(!1);for(this.nregion=0,n=0;n<=this.nbase;n++)if(0!=(e=this.bases[n].getMate())&&!r[n]){for(this.regions[this.nregion].setStart1(n),this.regions[this.nregion].setEnd2(e),r[n]=!0,r[e]=!0,this.bases[n].setRegion(this.regions[this.nregion]),this.bases[e].setRegion(this.regions[this.nregion]),n++,e--;n<e&&this.bases[n].getMate()==e;n++,e--)r[e]=!0,r[n]=!0,this.bases[n].setRegion(this.regions[this.nregion]),this.bases[e].setRegion(this.regions[this.nregion]);this.regions[this.nregion].setEnd1(--n),this.regions[this.nregion].setStart2(e+1),this.nregion++}},s.prototype.construct_loop=function(t){var n=null,e=null,i=new u.Loop,s=new u.Loop,l=new o.Connection,c=new a.Region,f=new r.Radloop;for((i=this.loops[this.loop_count++]).setNconnection(0),i.setDepth(0),i.setNumber(this.loop_count),i.setRadius(0),f=this.rlphead;null!=f;f=f.getNext())f.getLoopnumber()==this.loop_count&&i.setRadius(f.getRadius());n=t;do{0!=(e=this.bases[n].getMate())&&(c=this.bases[n].getRegion(),this.bases[c.getStart1()].isExtracted()||(n==c.getStart1()?(this.bases[c.getStart1()].setExtracted(!0),this.bases[c.getEnd1()].setExtracted(!0),this.bases[c.getStart2()].setExtracted(!0),this.bases[c.getEnd2()].setExtracted(!0),s=this.construct_loop(c.getEnd1()<this.nbase?c.getEnd1()+1:0)):n==c.getStart2()?(this.bases[c.getStart2()].setExtracted(!0),this.bases[c.getEnd2()].setExtracted(!0),this.bases[c.getStart1()].setExtracted(!0),this.bases[c.getEnd1()].setExtracted(!0),s=this.construct_loop(c.getEnd2()<this.nbase?c.getEnd2()+1:0)):console.log("Something went terribly wrong ...."),i.setNconnection(i.getNconnection()+1),l=new o.Connection,i.setConnection(i.getNconnection()-1,l),i.setConnection(i.getNconnection(),null),l.setLoop(s),l.setRegion(c),n==c.getStart1()?(l.setStart(c.getStart1()),l.setEnd(c.getEnd2())):(l.setStart(c.getStart2()),l.setEnd(c.getEnd1())),l.setExtruded(!1),l.setBroken(!1),s.setNconnection(s.getNconnection()+1),l=new o.Connection,s.setConnection(s.getNconnection()-1,l),s.setConnection(s.getNconnection(),null),l.setLoop(i),l.setRegion(c),n==c.getStart1()?(l.setStart(c.getStart2()),l.setEnd(c.getEnd1())):(l.setStart(c.getStart1()),l.setEnd(c.getEnd2())),l.setExtruded(!1),l.setBroken(!1)),n=e),++n>this.nbase&&(n=0)}while(n!=t);return i},s.prototype.find_central_loop=function(){var t=new u.Loop,n=null,e=null,r=null;for(l.bind(this)(),n=0,e=-1,r=0;r<this.loop_count;r++)(t=this.loops[r]).getNconnection()>n?(e=t.getDepth(),n=t.getNconnection(),this.root=t):t.getDepth()>e&&t.getNconnection()==n&&(e=t.getDepth(),this.root=t)},s.prototype.traverse_loop=function(t,n){var e,r,o,a,i,u,s,l,c,f,h,p,d,m,g,v,y,b,x,M,w,_,k,S,A,E,T,R,N,P,C,O,L,U,D,z,q,j,F,B,I,X,Y,V,H,G,W,Z,J,$,K,Q,tt,nt,et,rt,ot,at,it,ut,st,lt,ct,ft,ht,pt,dt,mt,gt,vt=0;u=2*Math.PI/(this.nbase+1),b=null,P=-1;var yt=0;for(k=0;null!=(v=t.getConnection(yt));yt++,k++)e=-Math.sin(u*v.getStart()),r=Math.cos(u*v.getStart()),o=-Math.sin(u*v.getEnd()),a=Math.cos(u*v.getEnd())-r,i=e-o,s=Math.sqrt(a*a+i*i),v.setXrad(a/s),v.setYrad(i/s),v.setAngle(Math.atan2(i,a)),v.getAngle()<0&&v.setAngle(v.getAngle()+2*Math.PI),null!=n&&n.getRegion()==v.getRegion()&&(b=v,P=k);t:for(;;){this.determine_radius(t,this.lencut),l=t.getRadius()/this.RADIUS_REDUCTION_FACTOR,null==n?c=f=0:(h=(this.bases[b.getStart()].getX()+this.bases[b.getEnd()].getX())/2,p=(this.bases[b.getStart()].getY()+this.bases[b.getEnd()].getY())/2,c=h-l*b.getXrad(),f=p-l*b.getYrad()),T=-1==P?0:P,v=t.getConnection(T),E=0,C=!1;do{if((w=T-1)<0&&(w=t.getNconnection()-1),x=t.getConnection(w),this.connected_connection(x,v)?(T=w,v=x):C=!0,++E>t.getNconnection()){for(A=-1,k=0;k<t.getNconnection();k++)(w=k+1)>=t.getNconnection()&&(w=0),v=t.getConnection(k),(ht=(y=t.getConnection(w)).getAngle()-v.getAngle())<0&&(ht+=2*Math.PI),ht>A&&(A=ht,vt=k);R=vt,(T=vt+1)>=t.getNconnection()&&(T=0),(v=t.getConnection(R)).setBroken(!0),C=!0}}while(!C);for(O=!1,G=T;!O;){for(E=0,C=!1,R=T,L=!1;!C;)if(v=t.getConnection(R),R==P&&(L=!0),(w=R+1)>=t.getNconnection()&&(w=0),y=t.getConnection(w),this.connected_connection(v,y)){if(++E>=t.getNconnection())break;R=w}else C=!0;for(k=W=Z=N=this.find_ic_middle(T,R,n,b,t),C=!1,$=0;!C;)(k=$<0?W:0==$?N:Z)>=0&&(v=t.getConnection(k),null!=n&&b==v||(0==$?(d=v.getAngle()-Math.asin(.5/l),m=v.getAngle()+Math.asin(.5/l),this.bases[v.getStart()].setX(c+l*Math.cos(d)),this.bases[v.getStart()].setY(f+l*Math.sin(d)),this.bases[v.getEnd()].setX(c+l*Math.cos(m)),this.bases[v.getEnd()].setY(f+l*Math.sin(m))):$<0?((w=k+1)>=t.getNconnection()&&(w=0),v=t.getConnection(k),y=t.getConnection(w),et=v.getXrad(),rt=v.getYrad(),ht=(v.getAngle()+y.getAngle())/2,v.getAngle()>y.getAngle()&&(ht-=Math.PI),it=Math.cos(ht),lt=Math.sin(ht),ct=-it,(S=y.getAngle()-v.getAngle())<0&&(S+=2*Math.PI),ft=v.isExtruded()?S<=Math.PI/2?2:1.5:1,this.bases[v.getEnd()].setX(this.bases[y.getStart()].getX()+ft*lt),this.bases[v.getEnd()].setY(this.bases[y.getStart()].getY()+ft*ct),this.bases[v.getStart()].setX(this.bases[v.getEnd()].getX()+rt),this.bases[v.getStart()].setY(this.bases[v.getEnd()].getY()-et)):((w=k-1)<0&&(w=t.getNconnection()-1),v=t.getConnection(w),ot=(y=t.getConnection(k)).getXrad(),at=y.getYrad(),ht=(v.getAngle()+y.getAngle())/2,v.getAngle()>y.getAngle()&&(ht-=Math.PI),it=Math.cos(ht),lt=-Math.sin(ht),ct=it,(S=y.getAngle()-v.getAngle())<0&&(S+=2*Math.PI),ft=v.isExtruded()?S<=Math.PI/2?2:1.5:1,this.bases[y.getStart()].setX(this.bases[v.getEnd()].getX()+ft*lt),this.bases[y.getStart()].setY(this.bases[v.getEnd()].getY()+ft*ct),this.bases[y.getEnd()].setX(this.bases[y.getStart()].getX()-at),this.bases[y.getEnd()].setY(this.bases[y.getStart()].getY()+ot)))),$<0?(Z==R?Z=-1:Z>=0&&++Z>=t.getNconnection()&&(Z=0),$=1):(W==T?W=-1:W>=0&&--W<0&&(W=t.getNconnection()-1),$=-1),C=-1==W&&-1==Z;if((J=R+1)>=t.getNconnection()&&(J=0),R!=T&&(T!=G||J!=G))if(v=t.getConnection(T),y=t.getConnection(R),Q=this.bases[y.getEnd()].getX()-this.bases[v.getStart()].getX(),tt=this.bases[y.getEnd()].getY()-this.bases[v.getStart()].getY(),D=this.bases[v.getStart()].getX()+Q/2,z=this.bases[v.getStart()].getY()+tt/2,F=Q/(nt=Math.sqrt(Q*Q+tt*tt)),B=tt/nt,I=c-D,X=f-z,q=(Y=(I/=nt=Math.sqrt(Q*Q+tt*tt))*F+(X/=nt)*B)*F-I,j=Y*B-X,q/=nt=Math.sqrt(q*q+j*j),j/=nt,Q=this.bases[v.getStart()].getX()-c,tt=this.bases[v.getStart()].getY()-f,(ht=Math.atan2(tt,Q))<0&&(ht+=2*Math.PI),Q=this.bases[y.getEnd()].getX()-c,tt=this.bases[y.getEnd()].getY()-f,(pt=Math.atan2(tt,Q))<0&&(pt+=2*Math.PI),pt<ht&&(pt+=2*Math.PI),V=c+(U=pt-ht>Math.PI?-1:1)*l*q,H=f+U*l*j,L)c-=V-D,f-=H-z;else for(k=T;M=(v=t.getConnection(k)).getStart(),this.bases[M].setX(this.bases[M].getX()+V-D),this.bases[M].setY(this.bases[M].getY()+H-z),M=v.getEnd(),this.bases[M].setX(this.bases[M].getX()+V-D),this.bases[M].setY(this.bases[M].getY()+H-z),k!=R;)++k>=t.getNconnection()&&(k=0);O=(T=J)==G}for(k=0;k<t.getNconnection();k++){if(v=t.getConnection(k),(w=k+1)>=t.getNconnection()&&(w=0),y=t.getConnection(w),Q=this.bases[v.getEnd()].getX()-c,tt=this.bases[v.getEnd()].getY()-f,st=Math.sqrt(Q*Q+tt*tt),(ht=Math.atan2(tt,Q))<0&&(ht+=2*Math.PI),Q=this.bases[y.getStart()].getX()-c,tt=this.bases[y.getStart()].getY()-f,ut=Math.sqrt(Q*Q+tt*tt),(pt=Math.atan2(tt,Q))<0&&(pt+=2*Math.PI),pt<ht&&(pt+=2*Math.PI),K=pt-ht,(gt=y.getAngle()-v.getAngle())<=0&&(gt+=2*Math.PI),Math.abs(K-gt)>Math.PI)if(v.isExtruded())console.log("Warning from traverse_loop. Loop "+t.getNumber()+" has crossed regions\n");else if(y.getStart()-v.getEnd()!=1){v.setExtruded(!0);continue t}if(v.isExtruded())this.construct_extruded_segment(v,y);else for((_=y.getStart()-v.getEnd())<0&&(_+=this.nbase+1),u=K/_,w=1;w<_;w++)(M=v.getEnd()+w)>this.nbase&&(M-=this.nbase+1),nt=st+(ut-st)*((g=ht+w*u)-ht)/K,this.bases[M].setX(c+nt*Math.cos(g)),this.bases[M].setY(f+nt*Math.sin(g))}break}for(k=0;k<t.getNconnection();k++)P!=k&&(v=t.getConnection(k),this.generate_region(v),this.traverse_loop(v.getLoop(),v));for(_=0,dt=0,mt=0,k=0;k<t.getNconnection();k++)if((w=k+1)>=t.getNconnection()&&(w=0),v=t.getConnection(k),y=t.getConnection(w),_+=2,dt+=this.bases[v.getStart()].getX()+this.bases[v.getEnd()].getX(),mt+=this.bases[v.getStart()].getY()+this.bases[v.getEnd()].getY(),!v.isExtruded())for(w=v.getEnd()+1;w!=y.getStart();w++)w>this.nbase&&(w-=this.nbase+1),_++,dt+=this.bases[w].getX(),mt+=this.bases[w].getY();t.setX(dt/_),t.setY(mt/_)},s.prototype.determine_radius=function(t,n){var e,r,a,i,u,s,l,c,f,h,p,d=0,m=new o.Connection,g=new o.Connection;do{for(e=1e10,u=0,i=0,c=0;c<t.getNconnection();c++)m=t.getConnection(c),(f=c+1)>=t.getNconnection()&&(f=0),g=t.getConnection(f),h=m.getEnd(),(p=g.getStart())<h&&(p+=this.nbase+1),(a=g.getAngle()-m.getAngle())<=0&&(a+=2*Math.PI),i+=a*(1/(r=m.isExtruded()?a<=Math.PI/2?2:1.5:p-h)+1),u+=a*a/r,(l=a/r)<e&&!m.isExtruded()&&r>1&&(e=l,d=c);(s=i/u)<.7071068&&(s=.7071068),e*s<n&&t.getConnection(d).setExtruded(!0)}while(e*s<n);t.getRadius()>0?s=t.getRadius():t.setRadius(s)},s.prototype.find_ic_middle=function(t,n,e,r,o){var a,i,u,s,l;for(a=0,i=-1,u=t,l=!1;!l;)a++>2*o.getNconnection()&&console.log("Infinite loop in 'find_ic_middle'"),null!=e&&o.getConnection(u)==r&&(i=u),l=u==n,++u>=o.getNconnection()&&(u=0);if(-1==i){for(s=1,u=t;s<(a+1)/2;s++)++u>=o.getNconnection()&&(u=0);i=u}return i},s.prototype.construct_extruded_segment=function(t,n){var e,r,o,a,i,u,s,l,c,f,h,p,d,m,g,v,y,b;if(e=t.getAngle(),(o=r=n.getAngle())<e&&(o+=2*Math.PI),a=(e+o)/2,d=t.getEnd(),(g=(m=n.getStart())-d)<0&&(g+=this.nbase+1),(h=n.getAngle()-t.getAngle())<0&&(h+=2*Math.PI),2==g)this.construct_circle_segment(d,m);else{i=this.bases[m].getX()-this.bases[d].getX(),u=this.bases[m].getY()-this.bases[d].getY(),i/=f=Math.sqrt(i*i+u*u),u/=f,f>=1.5&&h<=Math.PI/2&&((v=d+1)>this.nbase&&(v-=this.nbase+1),(y=m-1)<0&&(y+=this.nbase+1),this.bases[v].setX(this.bases[d].getX()+.5*i),this.bases[v].setY(this.bases[d].getY()+.5*u),this.bases[y].setX(this.bases[m].getX()-.5*i),this.bases[y].setY(this.bases[m].getY()-.5*u),d=v,m=y);do{b=!1,this.construct_circle_segment(d,m),(v=d+1)>this.nbase&&(v-=this.nbase+1),i=this.bases[v].getX()-this.bases[d].getX(),u=this.bases[v].getY()-this.bases[d].getY(),(s=Math.atan2(u,i))<0&&(s+=2*Math.PI),(p=s-e)<0&&(p+=2*Math.PI),p>Math.PI&&(b=!0),(y=m-1)<0&&(y+=this.nbase+1),i=this.bases[y].getX()-this.bases[m].getX(),u=this.bases[y].getY()-this.bases[m].getY(),(l=Math.atan2(u,i))<0&&(l+=2*Math.PI),(p=r-l)<0&&(p+=2*Math.PI),p>Math.PI&&(b=!0),b&&(c=this.minf2(a,e+.5),this.bases[v].setX(this.bases[d].getX()+Math.cos(c)),this.bases[v].setY(this.bases[d].getY()+Math.sin(c)),d=v,c=this.maxf2(a,o-.5),this.bases[y].setX(this.bases[m].getX()+Math.cos(c)),this.bases[y].setY(this.bases[m].getY()+Math.sin(c)),m=y,g-=2)}while(b&&g>1)}},s.prototype.construct_circle_segment=function(t,n){var e,r,o,a,i,u,s,l,c,f,h,p,d,m,g;if(e=this.bases[n].getX()-this.bases[t].getX(),r=this.bases[n].getY()-this.bases[t].getY(),o=Math.sqrt(e*e+r*r),(d=n-t)<0&&(d+=this.nbase+1),o>=d)for(e/=o,r/=o,m=1;m<d;m++)(g=t+m)>this.nbase&&(g-=this.nbase+1),this.bases[g].setX(this.bases[t].getX()+e*m/d),this.bases[g].setY(this.bases[t].getY()+r*m/d);else for(this.find_center_for_arc(d-1,o),e/=o,r/=o,a=this.bases[t].getX()+e*o/2,i=this.bases[t].getY()+r*o/2,u=r,s=-e,l=a+this._h*u,c=i+this._h*s,f=this.bases[t].getX()-l,h=this.bases[t].getY()-c,o=Math.sqrt(f*f+h*h),p=Math.atan2(h,f),m=1;m<d;m++)(g=t+m)>this.nbase&&(g-=this.nbase+1),this.bases[g].setX(l+o*Math.cos(p+m*this.angleinc)),this.bases[g].setY(c+o*Math.sin(p+m*this.angleinc))},s.prototype.find_center_for_arc=function(t,n){var e,r,o,a,i,u,s,l;o=-(r=(t+1)/Math.PI)-n/(t+1.000001-n),n<1&&(o=0),l=0;do{e=(r+o)/2,i=1-.5/((a=Math.sqrt(e*e+n*n/4))*a),Math.abs(i)>1&&console.log("Unexpected large magnitude discriminant = "+i+" "+a),(s=(u=Math.acos(i))*(t+1)+2*Math.acos(e/a)-2*Math.PI)>0?o=e:r=e}while(Math.abs(s)>1e-4&&++l<this.MAXITER);l>=this.MAXITER&&(noIterationFailureYet&&(console.log("Iteration failed in find_center_for_arc"),noIterationFailureYet=!1),e=0,u=0),this._h=e,this.angleinc=u},s.prototype.generate_region=function(t){var n,e,r,o,a,i;for(i=t.getRegion(),n=0,t.getStart()==i.getStart1()?(e=i.getStart1(),r=i.getEnd1()):(e=i.getStart2(),r=i.getEnd2()),(this.bases[t.getStart()].getX()>this.ANUM-100||this.bases[t.getEnd()].getX()>this.ANUM-100)&&console.log("Bad region passed to generate_region. Coordinates not defined."),o=e+1;o<=r;o++)n++,this.bases[o].setX(this.bases[t.getStart()].getX()+this.HELIX_FACTOR*n*t.getXrad()),this.bases[o].setY(this.bases[t.getStart()].getY()+this.HELIX_FACTOR*n*t.getYrad()),a=this.bases[o].getMate(),this.bases[a].setX(this.bases[t.getEnd()].getX()+this.HELIX_FACTOR*n*t.getXrad()),this.bases[a].setY(this.bases[t.getEnd()].getY()+this.HELIX_FACTOR*n*t.getYrad())},s.prototype.minf2=function(t,n){return t<n?t:n},s.prototype.maxf2=function(t,n){return t>n?t:n},s.prototype.connected_connection=function(t,n){return!!t.isExtruded()||t.getEnd()+1==n.getStart()}},function(t,n){"use strict";function e(){this.radius=null,this.loopnumber=null,this.next=null,this.prev=null}Object.defineProperty(n,"__esModule",{value:!0}),n.Radloop=e,e.prototype.getRadius=function(){return this.radius},e.prototype.setRadius=function(t){this.radius=t},e.prototype.getLoopnumber=function(){return this.loopnumber},e.prototype.setLoopnumber=function(t){this.loopnumber=t},e.prototype.getNext=function(){return this.next},e.prototype.setNext=function(t){this.next=t},e.prototype.getPrev=function(){return this.prev},e.prototype.setPrev=function(t){this.prev=t}},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.Connection=a;var r=e(8),o=e(9);function a(){this.loop=new r.Loop,this.region=new o.Region,this.start=null,this.end=null,this.xrad=null,this.yrad=null,this.angle=null,this.extruded=null,this.broken=null,this._isNull=!1}a.prototype.isNull=function(){return this._isNull},a.prototype.setNull=function(t){this._isNull=t},a.prototype.getLoop=function(){return this.loop},a.prototype.setLoop=function(t){this.loop=t},a.prototype.getRegion=function(){return this.region},a.prototype.setRegion=function(t){this.region=t},a.prototype.getStart=function(){return this.start},a.prototype.setStart=function(t){this.start=t},a.prototype.getEnd=function(){return this.end},a.prototype.setEnd=function(t){this.end=t},a.prototype.getXrad=function(){return this.xrad},a.prototype.setXrad=function(t){this.xrad=t},a.prototype.getYrad=function(){return this.yrad},a.prototype.setYrad=function(t){this.yrad=t},a.prototype.getAngle=function(){return this.angle},a.prototype.setAngle=function(t){this.angle=t},a.prototype.isExtruded=function(){return this.extruded},a.prototype.setExtruded=function(t){this.extruded=t},a.prototype.isBroken=function(){return this.broken},a.prototype.setBroken=function(t){this.broken=t}},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.Loop=o;var r=e(7);function o(){this.nconnection=null,this.connections=[],this._connections=[],this.number=null,this.depth=null,this.mark=null,this.x=null,this.y=null,this.radius=null}o.prototype.getNconnection=function(){return this.nconnection},o.prototype.setNconnection=function(t){this.nconnection=t},o.prototype.setConnection=function(t,n){null!=n?this._connections[t]=n:(this._connections[t]||(this._connections[t]=new r.Connection),this._connections[t].setNull(!0))},o.prototype.getConnection=function(t){var n=e(7);this._connections[t]||(this._connections[t]=new n);var r=this._connections[t];return r.isNull()?null:r},o.prototype.addConnection=function(t,n){this._connections.push(n)},o.prototype.getNumber=function(){return this.number},o.prototype.setNumber=function(t){this.number=t},o.prototype.getDepth=function(){return this.depth},o.prototype.setDepth=function(t){this.depth=t},o.prototype.isMark=function(){return this.mark},o.prototype.setMark=function(t){this.mark=t},o.prototype.getX=function(){return this.x},o.prototype.setX=function(t){this.x=t},o.prototype.getY=function(){return this.y},o.prototype.setY=function(t){this.y=t},o.prototype.getRadius=function(){return this.radius},o.prototype.setRadius=function(t){this.radius=t}},function(t,n){"use strict";function e(){this._start1=null,this._end1=null,this._start2=null,this._end2=null}Object.defineProperty(n,"__esModule",{value:!0}),n.Region=e,e.prototype.getStart1=function(){return this._start1},e.prototype.setStart1=function(t){this._start1=t},e.prototype.getEnd1=function(){return this._end1},e.prototype.setEnd1=function(t){this._end1=t},e.prototype.getStart2=function(){return this._start2},e.prototype.setStart2=function(t){this._start2=t},e.prototype.getEnd2=function(){return this._end2},e.prototype.setEnd2=function(t){this._end2=t}},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.Base=o;var r=e(9);function o(){this.mate=null,this.x=null,this.y=null,this.extracted=null,this.region=new r.Region}o.prototype.getMate=function(){return this.mate},o.prototype.setMate=function(t){this.mate=t},o.prototype.getX=function(){return this.x},o.prototype.setX=function(t){this.x=t},o.prototype.getY=function(){return this.y},o.prototype.setY=function(t){this.y=t},o.prototype.isExtracted=function(){return this.extracted},o.prototype.setExtracted=function(t){this.extracted=t},o.prototype.getRegion=function(){return this.region},o.prototype.setRegion=function(t){this.region=t}},function(t,n,e){var r=e(12);"string"==typeof r&&(r=[[t.id,r,""]]),e(14)(r,{}),r.locals&&(t.exports=r.locals)},function(t,n,e){(t.exports=e(13)()).push([t.id,'.forna-container .structure-background-rect {\r\n    stroke: black;\r\n    stroke-width: 5;\r\n    fill: transparent;\r\n}\r\n\r\n.forna-container circle.rna-base {\r\n  stroke: #ccc;\r\n  stroke-width: 1px;\r\n  opacity: 1;\r\n  fill: white;\r\n}\r\n\r\n.forna-container circle.rna-base.label {\r\n    stroke: transparent;\r\n    stroke-width: 0;\r\n    fill: white;\r\n}\r\n\r\n.forna-container line.link {\r\n  stroke: #999;\r\n  stroke-opacity: 0.8;\r\n  stroke-width: 2;\r\n}\r\n\r\n.forna-container line.rna-link {\r\n  stroke: #999;\r\n  stroke-opacity: 0.8;\r\n  stroke-width: 2;\r\n}\r\n\r\n.forna-container .overlay {\r\n    fill: transparent;\r\n}\r\n\r\n.forna-container .rna-name {\r\n    text-anchor: middle;\r\n    dy: -10;\r\n    font-family: Tahoma, Geneva, sans-serif;\r\n    font-size: 8pt;\r\n}\r\n\r\n.forna-container line.rna-link[link-type="backbone"] {\r\n    stroke: transparent;\r\n}\r\n\r\n.forna-container line.rna-link[link-type="basepair"] {\r\n    stroke: transparent;\r\n}\r\n\r\n.forna-container line.rna-link[link-type="fake"] {\r\n    stroke: transparent;\r\n}\r\n\r\n.forna-container line.rna-link[link-type="extra"] {\r\n    stroke: grey;\r\n}\r\n\r\n.forna-container line.rna-link[extra-link-type="correct"] {\r\n    stroke: green;\r\n}\r\n\r\n.forna-container line.rna-link[extra-link-type="incorrect"] {\r\n    stroke: green;\r\n}\r\n\r\n\r\n.forna-container path {\r\n    stroke-width: 2;\r\n}\r\n\r\n.forna-container path[extra-link-type="correct"] {\r\n    stroke: green;\r\n}\r\n\r\n.forna-container path[extra-link-type="incorrect"] {\r\n    stroke: red;\r\n}\r\n\r\n\r\n.forna-container line.basepair {\r\n  stroke: red;\r\n}\r\n\r\n.forna-container line.intermolecule {\r\n  stroke: blue;\r\n}\r\n\r\n.forna-container line.chain_chain {\r\n  stroke-dasharray: 3,3;\r\n}\r\n\r\n.forna-container line.fake {\r\n  stroke: green;\r\n}\r\n\r\n.forna-container .transparent {\r\n    fill: transparent;\r\n    stroke-width: 0;\r\n    stroke-opacity: 0;\r\n    opacity: 0;\r\n}\r\n\r\n.forna-container .d3-tip {\r\n    line-height: 1;\r\n    font-weight: bold;\r\n    padding: 6px;\r\n    background: rgba(0, 0, 0, 0.6);\r\n    color: #fff;\r\n    border-radius: 4px;\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container text.nucleotide-label {\r\n    font-size: 5.5pt;\r\n    font-weight: bold;\r\n    font-family: Tahoma, Geneva, sans-serif;\r\n    color: rgb(100,100,100);\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container text.number-label {\r\n    font-size: 5.5pt;\r\n    font-weight: bold;\r\n    font-family: Tahoma, Geneva, sans-serif;\r\n    color: rgb(100,100,100);\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container text {\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container g.gnode {\r\n\r\n}\r\n\r\n.forna-container .brush .extent {\r\n  fill-opacity: .1;\r\n  stroke: #fff;\r\n  shape-rendering: crispEdges;\r\n}\r\n\r\n.forna-container .noselect {\r\n    -webkit-touch-callout: none;\r\n    -webkit-user-select: none;\r\n    -khtml-user-select: none;\r\n    -moz-user-select: none;\r\n    -ms-user-select: none;\r\n    user-select: none;\r\n}\r\n',""])},function(t,n){t.exports=function(){var t=[];return t.toString=function(){for(var t=[],n=0;n<this.length;n++){var e=this[n];e[2]?t.push("@media "+e[2]+"{"+e[1]+"}"):t.push(e[1])}return t.join("")},t.i=function(n,e){"string"==typeof n&&(n=[[null,n,""]]);for(var r={},o=0;o<this.length;o++){var a=this[o][0];"number"==typeof a&&(r[a]=!0)}for(o=0;o<n.length;o++){var i=n[o];"number"==typeof i[0]&&r[i[0]]||(e&&!i[2]?i[2]=e:e&&(i[2]="("+i[2]+") and ("+e+")"),t.push(i))}},t}},function(t,n,e){var r={},o=function(t){var n;return function(){return void 0===n&&(n=t.apply(this,arguments)),n}},a=o((function(){return/msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase())})),i=o((function(){return document.head||document.getElementsByTagName("head")[0]})),u=null,s=0,l=[];function c(t,n){for(var e=0;e<t.length;e++){var o=t[e],a=r[o.id];if(a){a.refs++;for(var i=0;i<a.parts.length;i++)a.parts[i](o.parts[i]);for(;i<o.parts.length;i++)a.parts.push(m(o.parts[i],n))}else{var u=[];for(i=0;i<o.parts.length;i++)u.push(m(o.parts[i],n));r[o.id]={id:o.id,refs:1,parts:u}}}}function f(t){for(var n=[],e={},r=0;r<t.length;r++){var o=t[r],a=o[0],i={css:o[1],media:o[2],sourceMap:o[3]};e[a]?e[a].parts.push(i):n.push(e[a]={id:a,parts:[i]})}return n}function h(t,n){var e=i(),r=l[l.length-1];if("top"===t.insertAt)r?r.nextSibling?e.insertBefore(n,r.nextSibling):e.appendChild(n):e.insertBefore(n,e.firstChild),l.push(n);else{if("bottom"!==t.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");e.appendChild(n)}}function p(t){t.parentNode.removeChild(t);var n=l.indexOf(t);n>=0&&l.splice(n,1)}function d(t){var n=document.createElement("style");return n.type="text/css",h(t,n),n}function m(t,n){var e,r,o;if(n.singleton){var a=s++;e=u||(u=d(n)),r=y.bind(null,e,a,!1),o=y.bind(null,e,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(e=function(t){var n=document.createElement("link");return n.rel="stylesheet",h(t,n),n}(n),r=x.bind(null,e),o=function(){p(e),e.href&&URL.revokeObjectURL(e.href)}):(e=d(n),r=b.bind(null,e),o=function(){p(e)});return r(t),function(n){if(n){if(n.css===t.css&&n.media===t.media&&n.sourceMap===t.sourceMap)return;r(t=n)}else o()}}t.exports=function(t,n){void 0===(n=n||{}).singleton&&(n.singleton=a()),void 0===n.insertAt&&(n.insertAt="bottom");var e=f(t);return c(e,n),function(t){for(var o=[],a=0;a<e.length;a++){var i=e[a];(u=r[i.id]).refs--,o.push(u)}for(t&&c(f(t),n),a=0;a<o.length;a++){var u;if(0===(u=o[a]).refs){for(var s=0;s<u.parts.length;s++)u.parts[s]();delete r[u.id]}}}};var g,v=(g=[],function(t,n){return g[t]=n,g.filter(Boolean).join("\n")});function y(t,n,e,r){var o=e?"":r.css;if(t.styleSheet)t.styleSheet.cssText=v(n,o);else{var a=document.createTextNode(o),i=t.childNodes;i[n]&&t.removeChild(i[n]),i.length?t.insertBefore(a,i[n]):t.appendChild(a)}}function b(t,n){var e=n.css,r=n.media;if(r&&t.setAttribute("media",r),t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}function x(t,n){var e=n.css,r=n.sourceMap;r&&(e+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var o=new Blob([e],{type:"text/css"}),a=t.href;t.href=URL.createObjectURL(o),a&&URL.revokeObjectURL(a)}},function(t,n,e){var r=e(16);"string"==typeof r&&(r=[[t.id,r,""]]),e(14)(r,{}),r.locals&&(t.exports=r.locals)},function(t,n,e){(t.exports=e(13)()).push([t.id,".forna-container svg {\r\n  display: block;\r\n  min-width: 100%;\r\n  width: 100%;\r\n  min-height: 100%;\r\n}\r\n\r\n.forna-container circle.node {\r\n  stroke: #ccc;\r\n  stroke-width: 1px;\r\n  opacity: 1;\r\n  fill: white;\r\n}\r\n\r\n.forna-container polygon.node {\r\n  stroke: #ccc;\r\n  stroke-width: 1px;\r\n  opacity: 1;\r\n  fill: white;\r\n}\r\n\r\n.forna-container circle.node.label {\r\n    stroke: transparent;\r\n    stroke-width: 0;\r\n    fill: white;\r\n    display: inline;\r\n}\r\n\r\n.forna-container circle.outline_node {\r\n    stroke-width: 1px;\r\n    fill: red;\r\n}\r\n\r\n.forna-container circle.protein {\r\n    fill: gray;\r\n    fill-opacity: 0.5;\r\n    stroke-width: 4;\r\n}\r\n\r\n.forna-container circle.hidden_outline {\r\n    stroke-width: 0px;\r\n}\r\n\r\n\r\n.forna-container line.link {\r\n  stroke: #999;\r\n  stroke-opacity: 0.8;\r\n  stroke-width: 2;\r\n}\r\n\r\n.forna-container line.pseudoknot {\r\n    stroke: red;\r\n}\r\n\r\n.forna-container line.basepair {\r\n  stroke: red;\r\n}\r\n\r\n.forna-container line.intermolecule {\r\n  stroke: blue;\r\n}\r\n\r\n.forna-container line.chain_chain {\r\n  stroke-dasharray: 3,3;\r\n}\r\n\r\n.forna-container line.fake {\r\n  stroke: green;\r\n}\r\n\r\n.forna-container .transparent {\r\n    fill: transparent;\r\n    stroke-width: 0;\r\n    stroke-opacity: 0;\r\n    opacity: 0;\r\n    visibility: hidden;\r\n}\r\n\r\n.forna-container .drag_line {\r\n  stroke: #999;\r\n  stroke-width: 2;\r\n  pointer-events: none;\r\n}\r\n\r\n.forna-container .drag_line_hidden {\r\n  stroke: #999;\r\n  stroke-width: 0;\r\n  pointer-events: none;\r\n}\r\n\r\n.forna-container .d3-tip {\r\n    line-height: 1;\r\n    font-weight: bold;\r\n    padding: 6px;\r\n    background: rgba(0, 0, 0, 0.6);\r\n    color: #fff;\r\n    border-radius: 4px;\r\n    pointer-events: none;\r\n          }\r\n\r\n.forna-container text.node-label {\r\n    font-weight: bold;\r\n    font-family: Tahoma, Geneva, sans-serif;\r\n    color: rgb(100,100,100);\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container text {\r\n    pointer-events: none;\r\n}\r\n\r\n.forna-container g.gnode {\r\n\r\n}\r\n\r\n.forna-container circle.outline_node.selected {\r\n    visibility: visible;\r\n}\r\n\r\n.forna-container circle.outline_node {\r\n    visibility: hidden;\r\n}\r\n\r\n.forna-container .brush .extent {\r\n  fill-opacity: .1;\r\n  stroke: #fff;\r\n  shape-rendering: crispEdges;\r\n}\r\n\r\n.forna-container .noselect {\r\n    -webkit-touch-callout: none;\r\n    -webkit-user-select: none;\r\n    -khtml-user-select: none;\r\n    -moz-user-select: none;\r\n    -ms-user-select: none;\r\n    user-select: none;\r\n}\r\n",""])},function(t,n,e){var r,o;!function(){var a={version:"3.5.17"},i=[].slice,u=function(t){return i.call(t)},s=this.document;function l(t){return t&&(t.ownerDocument||t.document||t).documentElement}function c(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(s)try{u(s.documentElement.childNodes)[0].nodeType}catch(t){u=function(t){for(var n=t.length,e=new Array(n);n--;)e[n]=t[n];return e}}if(Date.now||(Date.now=function(){return+new Date}),s)try{s.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var f=this.Element.prototype,h=f.setAttribute,p=f.setAttributeNS,d=this.CSSStyleDeclaration.prototype,m=d.setProperty;f.setAttribute=function(t,n){h.call(this,t,n+"")},f.setAttributeNS=function(t,n,e){p.call(this,t,n,e+"")},d.setProperty=function(t,n,e){m.call(this,t,n+"",e)}}function g(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function v(t){return null===t?NaN:+t}function y(t){return!isNaN(t)}function b(t){return{left:function(n,e,r,o){for(arguments.length<3&&(r=0),arguments.length<4&&(o=n.length);r<o;){var a=r+o>>>1;t(n[a],e)<0?r=a+1:o=a}return r},right:function(n,e,r,o){for(arguments.length<3&&(r=0),arguments.length<4&&(o=n.length);r<o;){var a=r+o>>>1;t(n[a],e)>0?o=a:r=a+1}return r}}}a.ascending=g,a.descending=function(t,n){return n<t?-1:n>t?1:n>=t?0:NaN},a.min=function(t,n){var e,r,o=-1,a=t.length;if(1===arguments.length){for(;++o<a;)if(null!=(r=t[o])&&r>=r){e=r;break}for(;++o<a;)null!=(r=t[o])&&e>r&&(e=r)}else{for(;++o<a;)if(null!=(r=n.call(t,t[o],o))&&r>=r){e=r;break}for(;++o<a;)null!=(r=n.call(t,t[o],o))&&e>r&&(e=r)}return e},a.max=function(t,n){var e,r,o=-1,a=t.length;if(1===arguments.length){for(;++o<a;)if(null!=(r=t[o])&&r>=r){e=r;break}for(;++o<a;)null!=(r=t[o])&&r>e&&(e=r)}else{for(;++o<a;)if(null!=(r=n.call(t,t[o],o))&&r>=r){e=r;break}for(;++o<a;)null!=(r=n.call(t,t[o],o))&&r>e&&(e=r)}return e},a.extent=function(t,n){var e,r,o,a=-1,i=t.length;if(1===arguments.length){for(;++a<i;)if(null!=(r=t[a])&&r>=r){e=o=r;break}for(;++a<i;)null!=(r=t[a])&&(e>r&&(e=r),o<r&&(o=r))}else{for(;++a<i;)if(null!=(r=n.call(t,t[a],a))&&r>=r){e=o=r;break}for(;++a<i;)null!=(r=n.call(t,t[a],a))&&(e>r&&(e=r),o<r&&(o=r))}return[e,o]},a.sum=function(t,n){var e,r=0,o=t.length,a=-1;if(1===arguments.length)for(;++a<o;)y(e=+t[a])&&(r+=e);else for(;++a<o;)y(e=+n.call(t,t[a],a))&&(r+=e);return r},a.mean=function(t,n){var e,r=0,o=t.length,a=-1,i=o;if(1===arguments.length)for(;++a<o;)y(e=v(t[a]))?r+=e:--i;else for(;++a<o;)y(e=v(n.call(t,t[a],a)))?r+=e:--i;if(i)return r/i},a.quantile=function(t,n){var e=(t.length-1)*n+1,r=Math.floor(e),o=+t[r-1],a=e-r;return a?o+a*(t[r]-o):o},a.median=function(t,n){var e,r=[],o=t.length,i=-1;if(1===arguments.length)for(;++i<o;)y(e=v(t[i]))&&r.push(e);else for(;++i<o;)y(e=v(n.call(t,t[i],i)))&&r.push(e);if(r.length)return a.quantile(r.sort(g),.5)},a.variance=function(t,n){var e,r,o=t.length,a=0,i=0,u=-1,s=0;if(1===arguments.length)for(;++u<o;)y(e=v(t[u]))&&(i+=(r=e-a)*(e-(a+=r/++s)));else for(;++u<o;)y(e=v(n.call(t,t[u],u)))&&(i+=(r=e-a)*(e-(a+=r/++s)));if(s>1)return i/(s-1)},a.deviation=function(){var t=a.variance.apply(this,arguments);return t?Math.sqrt(t):t};var x=b(g);function M(t){return t.length}a.bisectLeft=x.left,a.bisect=a.bisectRight=x.right,a.bisector=function(t){return b(1===t.length?function(n,e){return g(t(n),e)}:t)},a.shuffle=function(t,n,e){(a=arguments.length)<3&&(e=t.length,a<2&&(n=0));for(var r,o,a=e-n;a;)o=Math.random()*a--|0,r=t[a+n],t[a+n]=t[o+n],t[o+n]=r;return t},a.permute=function(t,n){for(var e=n.length,r=new Array(e);e--;)r[e]=t[n[e]];return r},a.pairs=function(t){for(var n=0,e=t.length-1,r=t[0],o=new Array(e<0?0:e);n<e;)o[n]=[r,r=t[++n]];return o},a.transpose=function(t){if(!(o=t.length))return[];for(var n=-1,e=a.min(t,M),r=new Array(e);++n<e;)for(var o,i=-1,u=r[n]=new Array(o);++i<o;)u[i]=t[i][n];return r},a.zip=function(){return a.transpose(arguments)},a.keys=function(t){var n=[];for(var e in t)n.push(e);return n},a.values=function(t){var n=[];for(var e in t)n.push(t[e]);return n},a.entries=function(t){var n=[];for(var e in t)n.push({key:e,value:t[e]});return n},a.merge=function(t){for(var n,e,r,o=t.length,a=-1,i=0;++a<o;)i+=t[a].length;for(e=new Array(i);--o>=0;)for(n=(r=t[o]).length;--n>=0;)e[--i]=r[n];return e};var w=Math.abs;function _(t){for(var n=1;t*n%1;)n*=10;return n}function k(t,n){for(var e in n)Object.defineProperty(t.prototype,e,{value:n[e],enumerable:!1})}function S(){this._=Object.create(null)}function A(t){return"__proto__"==(t+="")||"\0"===t[0]?"\0"+t:t}function E(t){return"\0"===(t+="")[0]?t.slice(1):t}function T(t){return A(t)in this._}function R(t){return(t=A(t))in this._&&delete this._[t]}function N(){var t=[];for(var n in this._)t.push(E(n));return t}function P(){var t=0;for(var n in this._)++t;return t}function C(){for(var t in this._)return!1;return!0}function O(){this._=Object.create(null)}function L(t){return t}function U(t,n,e){return function(){var r=e.apply(n,arguments);return r===n?t:r}}function D(t,n){if(n in t)return n;n=n.charAt(0).toUpperCase()+n.slice(1);for(var e=0,r=z.length;e<r;++e){var o=z[e]+n;if(o in t)return o}}a.range=function(t,n,e){if(arguments.length<3&&(e=1,arguments.length<2&&(n=t,t=0)),(n-t)/e==1/0)throw new Error("infinite range");var r,o=[],a=_(w(e)),i=-1;if(t*=a,n*=a,(e*=a)<0)for(;(r=t+e*++i)>n;)o.push(r/a);else for(;(r=t+e*++i)<n;)o.push(r/a);return o},a.map=function(t,n){var e=new S;if(t instanceof S)t.forEach((function(t,n){e.set(t,n)}));else if(Array.isArray(t)){var r,o=-1,a=t.length;if(1===arguments.length)for(;++o<a;)e.set(o,t[o]);else for(;++o<a;)e.set(n.call(t,r=t[o],o),r)}else for(var i in t)e.set(i,t[i]);return e},k(S,{has:T,get:function(t){return this._[A(t)]},set:function(t,n){return this._[A(t)]=n},remove:R,keys:N,values:function(){var t=[];for(var n in this._)t.push(this._[n]);return t},entries:function(){var t=[];for(var n in this._)t.push({key:E(n),value:this._[n]});return t},size:P,empty:C,forEach:function(t){for(var n in this._)t.call(this,E(n),this._[n])}}),a.nest=function(){var t,n,e={},r=[],o=[];function i(o,a,u){if(u>=r.length)return n?n.call(e,a):t?a.sort(t):a;for(var s,l,c,f,h=-1,p=a.length,d=r[u++],m=new S;++h<p;)(f=m.get(s=d(l=a[h])))?f.push(l):m.set(s,[l]);return o?(l=o(),c=function(t,n){l.set(t,i(o,n,u))}):(l={},c=function(t,n){l[t]=i(o,n,u)}),m.forEach(c),l}return e.map=function(t,n){return i(n,t,0)},e.entries=function(t){return function t(n,e){if(e>=r.length)return n;var a=[],i=o[e++];return n.forEach((function(n,r){a.push({key:n,values:t(r,e)})})),i?a.sort((function(t,n){return i(t.key,n.key)})):a}(i(a.map,t,0),0)},e.key=function(t){return r.push(t),e},e.sortKeys=function(t){return o[r.length-1]=t,e},e.sortValues=function(n){return t=n,e},e.rollup=function(t){return n=t,e},e},a.set=function(t){var n=new O;if(t)for(var e=0,r=t.length;e<r;++e)n.add(t[e]);return n},k(O,{has:T,add:function(t){return this._[A(t+="")]=!0,t},remove:R,values:N,size:P,empty:C,forEach:function(t){for(var n in this._)t.call(this,E(n))}}),a.behavior={},a.rebind=function(t,n){for(var e,r=1,o=arguments.length;++r<o;)t[e=arguments[r]]=U(t,n,n[e]);return t};var z=["webkit","ms","moz","Moz","o","O"];function q(){}function j(){}function F(t){var n=[],e=new S;function r(){for(var e,r=n,o=-1,a=r.length;++o<a;)(e=r[o].on)&&e.apply(this,arguments);return t}return r.on=function(r,o){var a,i=e.get(r);return arguments.length<2?i&&i.on:(i&&(i.on=null,n=n.slice(0,a=n.indexOf(i)).concat(n.slice(a+1)),e.remove(r)),o&&n.push(e.set(r,{on:o})),t)},r}function B(){a.event.preventDefault()}function I(){for(var t,n=a.event;t=n.sourceEvent;)n=t;return n}function X(t){for(var n=new j,e=0,r=arguments.length;++e<r;)n[arguments[e]]=F(n);return n.of=function(e,r){return function(o){try{var i=o.sourceEvent=a.event;o.target=t,a.event=o,n[o.type].apply(e,r)}finally{a.event=i}}},n}a.dispatch=function(){for(var t=new j,n=-1,e=arguments.length;++n<e;)t[arguments[n]]=F(t);return t},j.prototype.on=function(t,n){var e=t.indexOf("."),r="";if(e>=0&&(r=t.slice(e+1),t=t.slice(0,e)),t)return arguments.length<2?this[t].on(r):this[t].on(r,n);if(2===arguments.length){if(null==n)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}},a.event=null,a.requote=function(t){return t.replace(Y,"\\$&")};var Y=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,V={}.__proto__?function(t,n){t.__proto__=n}:function(t,n){for(var e in n)t[e]=n[e]};function H(t){return V(t,J),t}var G=function(t,n){return n.querySelector(t)},W=function(t,n){return n.querySelectorAll(t)},Z=function(t,n){var e=t.matches||t[D(t,"matchesSelector")];return(Z=function(t,n){return e.call(t,n)})(t,n)};"function"==typeof Sizzle&&(G=function(t,n){return Sizzle(t,n)[0]||null},W=Sizzle,Z=Sizzle.matchesSelector),a.selection=function(){return a.select(s.documentElement)};var J=a.selection.prototype=[];function $(t){return"function"==typeof t?t:function(){return G(t,this)}}function K(t){return"function"==typeof t?t:function(){return W(t,this)}}J.select=function(t){var n,e,r,o,a=[];t=$(t);for(var i=-1,u=this.length;++i<u;){a.push(n=[]),n.parentNode=(r=this[i]).parentNode;for(var s=-1,l=r.length;++s<l;)(o=r[s])?(n.push(e=t.call(o,o.__data__,s,i)),e&&"__data__"in o&&(e.__data__=o.__data__)):n.push(null)}return H(a)},J.selectAll=function(t){var n,e,r=[];t=K(t);for(var o=-1,a=this.length;++o<a;)for(var i=this[o],s=-1,l=i.length;++s<l;)(e=i[s])&&(r.push(n=u(t.call(e,e.__data__,s,o))),n.parentNode=e);return H(r)};var Q="http://www.w3.org/1999/xhtml",tt={svg:"http://www.w3.org/2000/svg",xhtml:Q,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function nt(t,n){return t=a.ns.qualify(t),null==n?t.local?function(){this.removeAttributeNS(t.space,t.local)}:function(){this.removeAttribute(t)}:"function"==typeof n?t.local?function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}:function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}:t.local?function(){this.setAttributeNS(t.space,t.local,n)}:function(){this.setAttribute(t,n)}}function et(t){return t.trim().replace(/\s+/g," ")}function rt(t){return new RegExp("(?:^|\\s+)"+a.requote(t)+"(?:\\s+|$)","g")}function ot(t){return(t+"").trim().split(/^|\s+/)}function at(t,n){var e=(t=ot(t).map(it)).length;return"function"==typeof n?function(){for(var r=-1,o=n.apply(this,arguments);++r<e;)t[r](this,o)}:function(){for(var r=-1;++r<e;)t[r](this,n)}}function it(t){var n=rt(t);return function(e,r){if(o=e.classList)return r?o.add(t):o.remove(t);var o=e.getAttribute("class")||"";r?(n.lastIndex=0,n.test(o)||e.setAttribute("class",et(o+" "+t))):e.setAttribute("class",et(o.replace(n," ")))}}function ut(t,n,e){return null==n?function(){this.style.removeProperty(t)}:"function"==typeof n?function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}:function(){this.style.setProperty(t,n,e)}}function st(t,n){return null==n?function(){delete this[t]}:"function"==typeof n?function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}:function(){this[t]=n}}function lt(t){return"function"==typeof t?t:(t=a.ns.qualify(t)).local?function(){return this.ownerDocument.createElementNS(t.space,t.local)}:function(){var n=this.ownerDocument,e=this.namespaceURI;return e===Q&&n.documentElement.namespaceURI===Q?n.createElement(t):n.createElementNS(e,t)}}function ct(){var t=this.parentNode;t&&t.removeChild(this)}function ft(t){return{__data__:t}}function ht(t){return function(){return Z(this,t)}}function pt(t){return arguments.length||(t=g),function(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}}function dt(t,n){for(var e=0,r=t.length;e<r;e++)for(var o,a=t[e],i=0,u=a.length;i<u;i++)(o=a[i])&&n(o,i,e);return t}function mt(t){return V(t,gt),t}a.ns={prefix:tt,qualify:function(t){var n=t.indexOf(":"),e=t;return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),tt.hasOwnProperty(e)?{space:tt[e],local:t}:t}},J.attr=function(t,n){if(arguments.length<2){if("string"==typeof t){var e=this.node();return(t=a.ns.qualify(t)).local?e.getAttributeNS(t.space,t.local):e.getAttribute(t)}for(n in t)this.each(nt(n,t[n]));return this}return this.each(nt(t,n))},J.classed=function(t,n){if(arguments.length<2){if("string"==typeof t){var e=this.node(),r=(t=ot(t)).length,o=-1;if(n=e.classList){for(;++o<r;)if(!n.contains(t[o]))return!1}else for(n=e.getAttribute("class");++o<r;)if(!rt(t[o]).test(n))return!1;return!0}for(n in t)this.each(at(n,t[n]));return this}return this.each(at(t,n))},J.style=function(t,n,e){var r=arguments.length;if(r<3){if("string"!=typeof t){for(e in r<2&&(n=""),t)this.each(ut(e,t[e],n));return this}if(r<2){var o=this.node();return c(o).getComputedStyle(o,null).getPropertyValue(t)}e=""}return this.each(ut(t,n,e))},J.property=function(t,n){if(arguments.length<2){if("string"==typeof t)return this.node()[t];for(n in t)this.each(st(n,t[n]));return this}return this.each(st(t,n))},J.text=function(t){return arguments.length?this.each("function"==typeof t?function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}:null==t?function(){this.textContent=""}:function(){this.textContent=t}):this.node().textContent},J.html=function(t){return arguments.length?this.each("function"==typeof t?function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}:null==t?function(){this.innerHTML=""}:function(){this.innerHTML=t}):this.node().innerHTML},J.append=function(t){return t=lt(t),this.select((function(){return this.appendChild(t.apply(this,arguments))}))},J.insert=function(t,n){return t=lt(t),n=$(n),this.select((function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)}))},J.remove=function(){return this.each(ct)},J.data=function(t,n){var e,r,o=-1,a=this.length;if(!arguments.length){for(t=new Array(a=(e=this[0]).length);++o<a;)(r=e[o])&&(t[o]=r.__data__);return t}function i(t,e){var r,o,a,i=t.length,c=e.length,f=Math.min(i,c),h=new Array(c),p=new Array(c),d=new Array(i);if(n){var m,g=new S,v=new Array(i);for(r=-1;++r<i;)(o=t[r])&&(g.has(m=n.call(o,o.__data__,r))?d[r]=o:g.set(m,o),v[r]=m);for(r=-1;++r<c;)(o=g.get(m=n.call(e,a=e[r],r)))?!0!==o&&(h[r]=o,o.__data__=a):p[r]=ft(a),g.set(m,!0);for(r=-1;++r<i;)r in v&&!0!==g.get(v[r])&&(d[r]=t[r])}else{for(r=-1;++r<f;)o=t[r],a=e[r],o?(o.__data__=a,h[r]=o):p[r]=ft(a);for(;r<c;++r)p[r]=ft(e[r]);for(;r<i;++r)d[r]=t[r]}p.update=h,p.parentNode=h.parentNode=d.parentNode=t.parentNode,u.push(p),s.push(h),l.push(d)}var u=mt([]),s=H([]),l=H([]);if("function"==typeof t)for(;++o<a;)i(e=this[o],t.call(e,e.parentNode.__data__,o));else for(;++o<a;)i(e=this[o],t);return s.enter=function(){return u},s.exit=function(){return l},s},J.datum=function(t){return arguments.length?this.property("__data__",t):this.property("__data__")},J.filter=function(t){var n,e,r,o=[];"function"!=typeof t&&(t=ht(t));for(var a=0,i=this.length;a<i;a++){o.push(n=[]),n.parentNode=(e=this[a]).parentNode;for(var u=0,s=e.length;u<s;u++)(r=e[u])&&t.call(r,r.__data__,u,a)&&n.push(r)}return H(o)},J.order=function(){for(var t=-1,n=this.length;++t<n;)for(var e,r=this[t],o=r.length-1,a=r[o];--o>=0;)(e=r[o])&&(a&&a!==e.nextSibling&&a.parentNode.insertBefore(e,a),a=e);return this},J.sort=function(t){t=pt.apply(this,arguments);for(var n=-1,e=this.length;++n<e;)this[n].sort(t);return this.order()},J.each=function(t){return dt(this,(function(n,e,r){t.call(n,n.__data__,e,r)}))},J.call=function(t){var n=u(arguments);return t.apply(n[0]=this,n),this},J.empty=function(){return!this.node()},J.node=function(){for(var t=0,n=this.length;t<n;t++)for(var e=this[t],r=0,o=e.length;r<o;r++){var a=e[r];if(a)return a}return null},J.size=function(){var t=0;return dt(this,(function(){++t})),t};var gt=[];function vt(t){var n,e;return function(r,o,a){var i,u=t[a].update,s=u.length;for(a!=e&&(e=a,n=0),o>=n&&(n=o+1);!(i=u[n])&&++n<s;);return i}}function yt(t,n,e){var r="__on"+t,o=t.indexOf("."),i=xt;o>0&&(t=t.slice(0,o));var s=bt.get(t);function l(){var n=this[r];n&&(this.removeEventListener(t,n,n.$),delete this[r])}return s&&(t=s,i=Mt),o?n?function(){var o=i(n,u(arguments));l.call(this),this.addEventListener(t,this[r]=o,o.$=e),o._=n}:l:n?q:function(){var n,e=new RegExp("^__on([^.]+)"+a.requote(t)+"$");for(var r in this)if(n=r.match(e)){var o=this[r];this.removeEventListener(n[1],o,o.$),delete this[r]}}}a.selection.enter=mt,a.selection.enter.prototype=gt,gt.append=J.append,gt.empty=J.empty,gt.node=J.node,gt.call=J.call,gt.size=J.size,gt.select=function(t){for(var n,e,r,o,a,i=[],u=-1,s=this.length;++u<s;){r=(o=this[u]).update,i.push(n=[]),n.parentNode=o.parentNode;for(var l=-1,c=o.length;++l<c;)(a=o[l])?(n.push(r[l]=e=t.call(o.parentNode,a.__data__,l,u)),e.__data__=a.__data__):n.push(null)}return H(i)},gt.insert=function(t,n){return arguments.length<2&&(n=vt(this)),J.insert.call(this,t,n)},a.select=function(t){var n;return"string"==typeof t?(n=[G(t,s)]).parentNode=s.documentElement:(n=[t]).parentNode=l(t),H([n])},a.selectAll=function(t){var n;return"string"==typeof t?(n=u(W(t,s))).parentNode=s.documentElement:(n=u(t)).parentNode=null,H([n])},J.on=function(t,n,e){var r=arguments.length;if(r<3){if("string"!=typeof t){for(e in r<2&&(n=!1),t)this.each(yt(e,t[e],n));return this}if(r<2)return(r=this.node()["__on"+t])&&r._;e=!1}return this.each(yt(t,n,e))};var bt=a.map({mouseenter:"mouseover",mouseleave:"mouseout"});function xt(t,n){return function(e){var r=a.event;a.event=e,n[0]=this.__data__;try{t.apply(this,n)}finally{a.event=r}}}function Mt(t,n){var e=xt(t,n);return function(t){var n=t.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||e.call(this,t)}}s&&bt.forEach((function(t){"on"+t in s&&bt.remove(t)}));var wt,_t=0;function kt(t){var n=".dragsuppress-"+ ++_t,e="click"+n,r=a.select(c(t)).on("touchmove"+n,B).on("dragstart"+n,B).on("selectstart"+n,B);if(null==wt&&(wt=!("onselectstart"in t)&&D(t.style,"userSelect")),wt){var o=l(t).style,i=o[wt];o[wt]="none"}return function(t){if(r.on(n,null),wt&&(o[wt]=i),t){var a=function(){r.on(e,null)};r.on(e,(function(){B(),a()}),!0),setTimeout(a,0)}}}a.mouse=function(t){return At(t,I())};var St=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;function At(t,n){n.changedTouches&&(n=n.changedTouches[0]);var e=t.ownerSVGElement||t;if(e.createSVGPoint){var r=e.createSVGPoint();if(St<0){var o=c(t);if(o.scrollX||o.scrollY){var i=(e=a.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important"))[0][0].getScreenCTM();St=!(i.f||i.e),e.remove()}}return St?(r.x=n.pageX,r.y=n.pageY):(r.x=n.clientX,r.y=n.clientY),[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}var u=t.getBoundingClientRect();return[n.clientX-u.left-t.clientLeft,n.clientY-u.top-t.clientTop]}function Et(){return a.event.changedTouches[0].identifier}a.touch=function(t,n,e){if(arguments.length<3&&(e=n,n=I().changedTouches),n)for(var r,o=0,a=n.length;o<a;++o)if((r=n[o]).identifier===e)return At(t,r)},a.behavior.drag=function(){var t=X(o,"drag","dragstart","dragend"),n=null,e=i(q,a.mouse,c,"mousemove","mouseup"),r=i(Et,a.touch,L,"touchmove","touchend");function o(){this.on("mousedown.drag",e).on("touchstart.drag",r)}function i(e,r,o,i,u){return function(){var s,l=this,c=a.event.target.correspondingElement||a.event.target,f=l.parentNode,h=t.of(l,arguments),p=0,d=e(),m=".drag"+(null==d?"":"-"+d),g=a.select(o(c)).on(i+m,b).on(u+m,x),v=kt(c),y=r(f,d);function b(){var t,n,e=r(f,d);e&&(t=e[0]-y[0],n=e[1]-y[1],p|=t|n,y=e,h({type:"drag",x:e[0]+s[0],y:e[1]+s[1],dx:t,dy:n}))}function x(){r(f,d)&&(g.on(i+m,null).on(u+m,null),v(p),h({type:"dragend"}))}s=n?[(s=n.apply(l,arguments)).x-y[0],s.y-y[1]]:[0,0],h({type:"dragstart"})}}return o.origin=function(t){return arguments.length?(n=t,o):n},a.rebind(o,t,"on")},a.touches=function(t,n){return arguments.length<2&&(n=I().touches),n?u(n).map((function(n){var e=At(t,n);return e.identifier=n.identifier,e})):[]};var Tt=1e-6,Rt=Tt*Tt,Nt=Math.PI,Pt=2*Nt,Ct=Pt-Tt,Ot=Nt/2,Lt=Nt/180,Ut=180/Nt;function Dt(t){return t>0?1:t<0?-1:0}function zt(t,n,e){return(n[0]-t[0])*(e[1]-t[1])-(n[1]-t[1])*(e[0]-t[0])}function qt(t){return t>1?0:t<-1?Nt:Math.acos(t)}function jt(t){return t>1?Ot:t<-1?-Ot:Math.asin(t)}function Ft(t){return((t=Math.exp(t))+1/t)/2}function Bt(t){return(t=Math.sin(t/2))*t}var It=Math.SQRT2;a.interpolateZoom=function(t,n){var e,r,o=t[0],a=t[1],i=t[2],u=n[0],s=n[1],l=n[2],c=u-o,f=s-a,h=c*c+f*f;if(h<Rt)r=Math.log(l/i)/It,e=function(t){return[o+t*c,a+t*f,i*Math.exp(It*t*r)]};else{var p=Math.sqrt(h),d=(l*l-i*i+4*h)/(2*i*2*p),m=(l*l-i*i-4*h)/(2*l*2*p),g=Math.log(Math.sqrt(d*d+1)-d),v=Math.log(Math.sqrt(m*m+1)-m);r=(v-g)/It,e=function(t){var n,e=t*r,u=Ft(g),s=i/(2*p)*(u*(n=It*e+g,((n=Math.exp(2*n))-1)/(n+1))-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[o+s*c,a+s*f,i*u/Ft(It*e+g)]}}return e.duration=1e3*r,e},a.behavior.zoom=function(){var t,n,e,r,o,i,u,l,f,h={x:0,y:0,k:1},p=[960,500],d=Vt,m=250,g=0,v="mousedown.zoom",y="mousemove.zoom",b="mouseup.zoom",x="touchstart.zoom",M=X(w,"zoomstart","zoom","zoomend");function w(t){t.on(v,P).on(Yt+".zoom",O).on("dblclick.zoom",L).on(x,C)}function _(t){return[(t[0]-h.x)/h.k,(t[1]-h.y)/h.k]}function k(t){h.k=Math.max(d[0],Math.min(d[1],t))}function S(t,n){n=function(t){return[t[0]*h.k+h.x,t[1]*h.k+h.y]}(n),h.x+=t[0]-n[0],h.y+=t[1]-n[1]}function A(t,e,r,o){t.__chart__={x:h.x,y:h.y,k:h.k},k(Math.pow(2,o)),S(n=e,r),t=a.select(t),m>0&&(t=t.transition().duration(m)),t.call(w.event)}function E(){u&&u.domain(i.range().map((function(t){return(t-h.x)/h.k})).map(i.invert)),f&&f.domain(l.range().map((function(t){return(t-h.y)/h.k})).map(l.invert))}function T(t){g++||t({type:"zoomstart"})}function R(t){E(),t({type:"zoom",scale:h.k,translate:[h.x,h.y]})}function N(t){--g||(t({type:"zoomend"}),n=null)}function P(){var t=this,n=M.of(t,arguments),e=0,r=a.select(c(t)).on(y,u).on(b,s),o=_(a.mouse(t)),i=kt(t);function u(){e=1,S(a.mouse(t),o),R(n)}function s(){r.on(y,null).on(b,null),i(e),N(n)}Mu.call(t),T(n)}function C(){var t,n=this,e=M.of(n,arguments),r={},i=0,u=".zoom-"+a.event.changedTouches[0].identifier,s="touchmove"+u,l="touchend"+u,c=[],f=a.select(n),p=kt(n);function d(){var e=a.touches(n);return t=h.k,e.forEach((function(t){t.identifier in r&&(r[t.identifier]=_(t))})),e}function m(){var t=a.event.target;a.select(t).on(s,g).on(l,y),c.push(t);for(var e=a.event.changedTouches,u=0,f=e.length;u<f;++u)r[e[u].identifier]=null;var p=d(),m=Date.now();if(1===p.length){if(m-o<500){var v=p[0];A(n,v,r[v.identifier],Math.floor(Math.log(h.k)/Math.LN2)+1),B()}o=m}else if(p.length>1){v=p[0];var b=p[1],x=v[0]-b[0],M=v[1]-b[1];i=x*x+M*M}}function g(){var u,s,l,c,f=a.touches(n);Mu.call(n);for(var h=0,p=f.length;h<p;++h,c=null)if(l=f[h],c=r[l.identifier]){if(s)break;u=l,s=c}if(c){var d=(d=l[0]-u[0])*d+(d=l[1]-u[1])*d,m=i&&Math.sqrt(d/i);u=[(u[0]+l[0])/2,(u[1]+l[1])/2],s=[(s[0]+c[0])/2,(s[1]+c[1])/2],k(m*t)}o=null,S(u,s),R(e)}function y(){if(a.event.touches.length){for(var t=a.event.changedTouches,n=0,o=t.length;n<o;++n)delete r[t[n].identifier];for(var i in r)return void d()}a.selectAll(c).on(u,null),f.on(v,P).on(x,C),p(),N(e)}m(),T(e),f.on(v,null).on(x,m)}function O(){var o=M.of(this,arguments);r?clearTimeout(r):(Mu.call(this),t=_(n=e||a.mouse(this)),T(o)),r=setTimeout((function(){r=null,N(o)}),50),B(),k(Math.pow(2,.002*Xt())*h.k),S(n,t),R(o)}function L(){var t=a.mouse(this),n=Math.log(h.k)/Math.LN2;A(this,t,_(t),a.event.shiftKey?Math.ceil(n)-1:Math.floor(n)+1)}return Yt||(Yt="onwheel"in s?(Xt=function(){return-a.event.deltaY*(a.event.deltaMode?120:1)},"wheel"):"onmousewheel"in s?(Xt=function(){return a.event.wheelDelta},"mousewheel"):(Xt=function(){return-a.event.detail},"MozMousePixelScroll")),w.event=function(t){t.each((function(){var t=M.of(this,arguments),e=h;ku?a.select(this).transition().each("start.zoom",(function(){h=this.__chart__||{x:0,y:0,k:1},T(t)})).tween("zoom:zoom",(function(){var r=p[0],o=p[1],i=n?n[0]:r/2,u=n?n[1]:o/2,s=a.interpolateZoom([(i-h.x)/h.k,(u-h.y)/h.k,r/h.k],[(i-e.x)/e.k,(u-e.y)/e.k,r/e.k]);return function(n){var e=s(n),o=r/e[2];this.__chart__=h={x:i-e[0]*o,y:u-e[1]*o,k:o},R(t)}})).each("interrupt.zoom",(function(){N(t)})).each("end.zoom",(function(){N(t)})):(this.__chart__=h,T(t),R(t),N(t))}))},w.translate=function(t){return arguments.length?(h={x:+t[0],y:+t[1],k:h.k},E(),w):[h.x,h.y]},w.scale=function(t){return arguments.length?(h={x:h.x,y:h.y,k:null},k(+t),E(),w):h.k},w.scaleExtent=function(t){return arguments.length?(d=null==t?Vt:[+t[0],+t[1]],w):d},w.center=function(t){return arguments.length?(e=t&&[+t[0],+t[1]],w):e},w.size=function(t){return arguments.length?(p=t&&[+t[0],+t[1]],w):p},w.duration=function(t){return arguments.length?(m=+t,w):m},w.x=function(t){return arguments.length?(u=t,i=t.copy(),h={x:0,y:0,k:1},w):u},w.y=function(t){return arguments.length?(f=t,l=t.copy(),h={x:0,y:0,k:1},w):f},a.rebind(w,M,"on")};var Xt,Yt,Vt=[0,1/0];function Ht(){}function Gt(t,n,e){return this instanceof Gt?(this.h=+t,this.s=+n,void(this.l=+e)):arguments.length<2?t instanceof Gt?new Gt(t.h,t.s,t.l):pn(""+t,dn,Gt):new Gt(t,n,e)}a.color=Ht,Ht.prototype.toString=function(){return this.rgb()+""},a.hsl=Gt;var Wt=Gt.prototype=new Ht;function Zt(t,n,e){var r,o;function a(t){return Math.round(255*function(t){return t>360?t-=360:t<0&&(t+=360),t<60?r+(o-r)*t/60:t<180?o:t<240?r+(o-r)*(240-t)/60:r}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,n=isNaN(n)?0:n<0?0:n>1?1:n,r=2*(e=e<0?0:e>1?1:e)-(o=e<=.5?e*(1+n):e+n-e*n),new sn(a(t+120),a(t),a(t-120))}function Jt(t,n,e){return this instanceof Jt?(this.h=+t,this.c=+n,void(this.l=+e)):arguments.length<2?t instanceof Jt?new Jt(t.h,t.c,t.l):rn(t instanceof Qt?t.l:(t=mn((t=a.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new Jt(t,n,e)}Wt.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new Gt(this.h,this.s,this.l/t)},Wt.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new Gt(this.h,this.s,t*this.l)},Wt.rgb=function(){return Zt(this.h,this.s,this.l)},a.hcl=Jt;var $t=Jt.prototype=new Ht;function Kt(t,n,e){return isNaN(t)&&(t=0),isNaN(n)&&(n=0),new Qt(e,Math.cos(t*=Lt)*n,Math.sin(t)*n)}function Qt(t,n,e){return this instanceof Qt?(this.l=+t,this.a=+n,void(this.b=+e)):arguments.length<2?t instanceof Qt?new Qt(t.l,t.a,t.b):t instanceof Jt?Kt(t.h,t.c,t.l):mn((t=sn(t)).r,t.g,t.b):new Qt(t,n,e)}$t.brighter=function(t){return new Jt(this.h,this.c,Math.min(100,this.l+tn*(arguments.length?t:1)))},$t.darker=function(t){return new Jt(this.h,this.c,Math.max(0,this.l-tn*(arguments.length?t:1)))},$t.rgb=function(){return Kt(this.h,this.c,this.l).rgb()},a.lab=Qt;var tn=18,nn=Qt.prototype=new Ht;function en(t,n,e){var r=(t+16)/116,o=r+n/500,a=r-e/200;return new sn(un(3.2404542*(o=.95047*on(o))-1.5371385*(r=1*on(r))-.4985314*(a=1.08883*on(a))),un(-.969266*o+1.8760108*r+.041556*a),un(.0556434*o-.2040259*r+1.0572252*a))}function rn(t,n,e){return t>0?new Jt(Math.atan2(e,n)*Ut,Math.sqrt(n*n+e*e),t):new Jt(NaN,NaN,t)}function on(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function an(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function un(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function sn(t,n,e){return this instanceof sn?(this.r=~~t,this.g=~~n,void(this.b=~~e)):arguments.length<2?t instanceof sn?new sn(t.r,t.g,t.b):pn(""+t,sn,Zt):new sn(t,n,e)}function ln(t){return new sn(t>>16,t>>8&255,255&t)}function cn(t){return ln(t)+""}nn.brighter=function(t){return new Qt(Math.min(100,this.l+tn*(arguments.length?t:1)),this.a,this.b)},nn.darker=function(t){return new Qt(Math.max(0,this.l-tn*(arguments.length?t:1)),this.a,this.b)},nn.rgb=function(){return en(this.l,this.a,this.b)},a.rgb=sn;var fn=sn.prototype=new Ht;function hn(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function pn(t,n,e){var r,o,a,i=0,u=0,s=0;if(r=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(o=r[2].split(","),r[1]){case"hsl":return e(parseFloat(o[0]),parseFloat(o[1])/100,parseFloat(o[2])/100);case"rgb":return n(vn(o[0]),vn(o[1]),vn(o[2]))}return(a=yn.get(t))?n(a.r,a.g,a.b):(null==t||"#"!==t.charAt(0)||isNaN(a=parseInt(t.slice(1),16))||(4===t.length?(i=(3840&a)>>4,i|=i>>4,u=240&a,u|=u>>4,s=15&a,s|=s<<4):7===t.length&&(i=(16711680&a)>>16,u=(65280&a)>>8,s=255&a)),n(i,u,s))}function dn(t,n,e){var r,o,a=Math.min(t/=255,n/=255,e/=255),i=Math.max(t,n,e),u=i-a,s=(i+a)/2;return u?(o=s<.5?u/(i+a):u/(2-i-a),r=t==i?(n-e)/u+(n<e?6:0):n==i?(e-t)/u+2:(t-n)/u+4,r*=60):(r=NaN,o=s>0&&s<1?0:r),new Gt(r,o,s)}function mn(t,n,e){var r=an((.4124564*(t=gn(t))+.3575761*(n=gn(n))+.1804375*(e=gn(e)))/.95047),o=an((.2126729*t+.7151522*n+.072175*e)/1);return Qt(116*o-16,500*(r-o),200*(o-an((.0193339*t+.119192*n+.9503041*e)/1.08883)))}function gn(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function vn(t){var n=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*n):n}fn.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var n=this.r,e=this.g,r=this.b,o=30;return n||e||r?(n&&n<o&&(n=o),e&&e<o&&(e=o),r&&r<o&&(r=o),new sn(Math.min(255,n/t),Math.min(255,e/t),Math.min(255,r/t))):new sn(o,o,o)},fn.darker=function(t){return new sn((t=Math.pow(.7,arguments.length?t:1))*this.r,t*this.g,t*this.b)},fn.hsl=function(){return dn(this.r,this.g,this.b)},fn.toString=function(){return"#"+hn(this.r)+hn(this.g)+hn(this.b)};var yn=a.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});function bn(t){return"function"==typeof t?t:function(){return t}}function xn(t){return function(n,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),Mn(n,e,t,r)}}function Mn(t,n,e,r){var o={},i=a.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,c=null;function f(){var t,n=l.status;if(!n&&function(t){var n=t.responseType;return n&&"text"!==n?t.response:t.responseText}(l)||n>=200&&n<300||304===n){try{t=e.call(o,l)}catch(t){return void i.error.call(o,t)}i.load.call(o,t)}else i.error.call(o,l)}return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=f:l.onreadystatechange=function(){l.readyState>3&&f()},l.onprogress=function(t){var n=a.event;a.event=t;try{i.progress.call(o,l)}finally{a.event=n}},o.header=function(t,n){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==n?delete s[t]:s[t]=n+"",o)},o.mimeType=function(t){return arguments.length?(n=null==t?null:t+"",o):n},o.responseType=function(t){return arguments.length?(c=t,o):c},o.response=function(t){return e=t,o},["get","post"].forEach((function(t){o[t]=function(){return o.send.apply(o,[t].concat(u(arguments)))}})),o.send=function(e,r,a){if(2===arguments.length&&"function"==typeof r&&(a=r,r=null),l.open(e,t,!0),null==n||"accept"in s||(s.accept=n+",*/*"),l.setRequestHeader)for(var u in s)l.setRequestHeader(u,s[u]);return null!=n&&l.overrideMimeType&&l.overrideMimeType(n),null!=c&&(l.responseType=c),null!=a&&o.on("error",a).on("load",(function(t){a(null,t)})),i.beforesend.call(o,l),l.send(null==r?null:r),o},o.abort=function(){return l.abort(),o},a.rebind(o,i,"on"),null==r?o:o.get(function(t){return 1===t.length?function(n,e){t(null==n?e:null)}:t}(r))}yn.forEach((function(t,n){yn.set(t,ln(n))})),a.functor=bn,a.xhr=xn(L),a.dsv=function(t,n){var e=new RegExp('["'+t+"\n]"),r=t.charCodeAt(0);function o(t,e,r){arguments.length<3&&(r=e,e=null);var o=Mn(t,n,null==e?a:i(e),r);return o.row=function(t){return arguments.length?o.response(null==(e=t)?a:i(t)):e},o}function a(t){return o.parse(t.responseText)}function i(t){return function(n){return o.parse(n.responseText,t)}}function u(n){return n.map(s).join(t)}function s(t){return e.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}return o.parse=function(t,n){var e;return o.parseRows(t,(function(t,r){if(e)return e(t,r-1);var o=new Function("d","return {"+t.map((function(t,n){return JSON.stringify(t)+": d["+n+"]"})).join(",")+"}");e=n?function(t,e){return n(o(t),e)}:o}))},o.parseRows=function(t,n){var e,o,a={},i={},u=[],s=t.length,l=0,c=0;function f(){if(l>=s)return i;if(o)return o=!1,a;var n=l;if(34===t.charCodeAt(n)){for(var e=n;e++<s;)if(34===t.charCodeAt(e)){if(34!==t.charCodeAt(e+1))break;++e}return l=e+2,13===(u=t.charCodeAt(e+1))?(o=!0,10===t.charCodeAt(e+2)&&++l):10===u&&(o=!0),t.slice(n+1,e).replace(/""/g,'"')}for(;l<s;){var u,c=1;if(10===(u=t.charCodeAt(l++)))o=!0;else if(13===u)o=!0,10===t.charCodeAt(l)&&(++l,++c);else if(u!==r)continue;return t.slice(n,l-c)}return t.slice(n)}for(;(e=f())!==i;){for(var h=[];e!==a&&e!==i;)h.push(e),e=f();n&&null==(h=n(h,c++))||u.push(h)}return u},o.format=function(n){if(Array.isArray(n[0]))return o.formatRows(n);var e=new O,r=[];return n.forEach((function(t){for(var n in t)e.has(n)||r.push(e.add(n))})),[r.map(s).join(t)].concat(n.map((function(n){return r.map((function(t){return s(n[t])})).join(t)}))).join("\n")},o.formatRows=function(t){return t.map(u).join("\n")},o},a.csv=a.dsv(",","text/csv"),a.tsv=a.dsv("\t","text/tab-separated-values");var wn,_n,kn,Sn,An=this[D(this,"requestAnimationFrame")]||function(t){setTimeout(t,17)};function En(t,n,e){var r=arguments.length;r<2&&(n=0),r<3&&(e=Date.now());var o=e+n,a={c:t,t:o,n:null};return _n?_n.n=a:wn=a,_n=a,kn||(Sn=clearTimeout(Sn),kn=1,An(Tn)),a}function Tn(){var t=Rn(),n=Nn()-t;n>24?(isFinite(n)&&(clearTimeout(Sn),Sn=setTimeout(Tn,n)),kn=0):(kn=1,An(Tn))}function Rn(){for(var t=Date.now(),n=wn;n;)t>=n.t&&n.c(t-n.t)&&(n.c=null),n=n.n;return t}function Nn(){for(var t,n=wn,e=1/0;n;)n.c?(n.t<e&&(e=n.t),n=(t=n).n):n=t?t.n=n.n:wn=n.n;return _n=t,e}function Pn(t,n){return n-(t?Math.ceil(Math.log(t)/Math.LN10):1)}a.timer=function(){En.apply(this,arguments)},a.timer.flush=function(){Rn(),Nn()},a.round=function(t,n){return n?Math.round(t*(n=Math.pow(10,n)))/n:Math.round(t)};var Cn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map((function(t,n){var e=Math.pow(10,3*w(8-n));return{scale:n>8?function(t){return t/e}:function(t){return t*e},symbol:t}}));function On(t){var n=t.decimal,e=t.thousands,r=t.grouping,o=t.currency,i=r&&e?function(t,n){for(var o=t.length,a=[],i=0,u=r[0],s=0;o>0&&u>0&&(s+u+1>n&&(u=Math.max(1,n-s)),a.push(t.substring(o-=u,o+u)),!((s+=u+1)>n));)u=r[i=(i+1)%r.length];return a.reverse().join(e)}:L;return function(t){var e=Ln.exec(t),r=e[1]||" ",u=e[2]||">",s=e[3]||"-",l=e[4]||"",c=e[5],f=+e[6],h=e[7],p=e[8],d=e[9],m=1,g="",v="",y=!1,b=!0;switch(p&&(p=+p.substring(1)),(c||"0"===r&&"="===u)&&(c=r="0",u="="),d){case"n":h=!0,d="g";break;case"%":m=100,v="%",d="f";break;case"p":m=100,v="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(g="0"+d.toLowerCase());case"c":b=!1;case"d":y=!0,p=0;break;case"s":m=-1,d="r"}"$"===l&&(g=o[0],v=o[1]),"r"!=d||p||(d="g"),null!=p&&("g"==d?p=Math.max(1,Math.min(21,p)):"e"!=d&&"f"!=d||(p=Math.max(0,Math.min(20,p)))),d=Un.get(d)||Dn;var x=c&&h;return function(t){var e=v;if(y&&t%1)return"";var o=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(m<0){var l=a.formatPrefix(t,p);t=l.scale(t),e=l.symbol+v}else t*=m;var M,w,_=(t=d(t,p)).lastIndexOf(".");if(_<0){var k=b?t.lastIndexOf("e"):-1;k<0?(M=t,w=""):(M=t.substring(0,k),w=t.substring(k))}else M=t.substring(0,_),w=n+t.substring(_+1);!c&&h&&(M=i(M,1/0));var S=g.length+M.length+w.length+(x?0:o.length),A=S<f?new Array(S=f-S+1).join(r):"";return x&&(M=i(A+M,A.length?f-w.length:1/0)),o+=g,t=M+w,("<"===u?o+t+A:">"===u?A+o+t:"^"===u?A.substring(0,S>>=1)+o+t+A.substring(S):o+(x?t:A+t))+e}}}a.formatPrefix=function(t,n){var e=0;return(t=+t)&&(t<0&&(t*=-1),n&&(t=a.round(t,Pn(t,n))),e=1+Math.floor(1e-12+Math.log(t)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((e-1)/3)))),Cn[8+e/3]};var Ln=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Un=a.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,n){return t.toPrecision(n)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},r:function(t,n){return(t=a.round(t,Pn(t,n))).toFixed(Math.max(0,Math.min(20,Pn(t*(1+1e-15),n))))}});function Dn(t){return t+""}var zn=a.time={},qn=Date;function jn(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}jn.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){Fn.setUTCDate.apply(this._,arguments)},setDay:function(){Fn.setUTCDay.apply(this._,arguments)},setFullYear:function(){Fn.setUTCFullYear.apply(this._,arguments)},setHours:function(){Fn.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Fn.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Fn.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Fn.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Fn.setUTCSeconds.apply(this._,arguments)},setTime:function(){Fn.setTime.apply(this._,arguments)}};var Fn=Date.prototype;function Bn(t,n,e){function r(n){var e=t(n),r=a(e,1);return n-e<r-n?e:r}function o(e){return n(e=t(new qn(e-1)),1),e}function a(t,e){return n(t=new qn(+t),e),t}function i(t,r,a){var i=o(t),u=[];if(a>1)for(;i<r;)e(i)%a||u.push(new Date(+i)),n(i,1);else for(;i<r;)u.push(new Date(+i)),n(i,1);return u}t.floor=t,t.round=r,t.ceil=o,t.offset=a,t.range=i;var u=t.utc=In(t);return u.floor=u,u.round=In(r),u.ceil=In(o),u.offset=In(a),u.range=function(t,n,e){try{qn=jn;var r=new jn;return r._=t,i(r,n,e)}finally{qn=Date}},t}function In(t){return function(n,e){try{qn=jn;var r=new jn;return r._=n,t(r,e)._}finally{qn=Date}}}function Xn(t){var n=t.dateTime,e=t.date,r=t.time,o=t.periods,i=t.days,u=t.shortDays,s=t.months,l=t.shortMonths;function c(t){var n=t.length;function e(e){for(var r,o,a,i=[],u=-1,s=0;++u<n;)37===t.charCodeAt(u)&&(i.push(t.slice(s,u)),null!=(o=Yn[r=t.charAt(++u)])&&(r=t.charAt(++u)),(a=M[r])&&(r=a(e,null==o?"e"===r?" ":"0":o)),i.push(r),s=u+1);return i.push(t.slice(s,u)),i.join("")}return e.parse=function(n){var e={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null};if(f(e,t,n,0)!=n.length)return null;"p"in e&&(e.H=e.H%12+12*e.p);var r=null!=e.Z&&qn!==jn,o=new(r?jn:qn);return"j"in e?o.setFullYear(e.y,0,e.j):"W"in e||"U"in e?("w"in e||(e.w="W"in e?1:0),o.setFullYear(e.y,0,1),o.setFullYear(e.y,0,"W"in e?(e.w+6)%7+7*e.W-(o.getDay()+5)%7:e.w+7*e.U-(o.getDay()+6)%7)):o.setFullYear(e.y,e.m,e.d),o.setHours(e.H+(e.Z/100|0),e.M+e.Z%100,e.S,e.L),r?o._:o},e.toString=function(){return t},e}function f(t,n,e,r){for(var o,a,i,u=0,s=n.length,l=e.length;u<s;){if(r>=l)return-1;if(37===(o=n.charCodeAt(u++))){if(i=n.charAt(u++),!(a=w[i in Yn?n.charAt(u++):i])||(r=a(t,e,r))<0)return-1}else if(o!=e.charCodeAt(r++))return-1}return r}c.utc=function(t){var n=c(t);function e(t){try{var e=new(qn=jn);return e._=t,n(e)}finally{qn=Date}}return e.parse=function(t){try{qn=jn;var e=n.parse(t);return e&&e._}finally{qn=Date}},e.toString=n.toString,e},c.multi=c.utc.multi=fe;var h=a.map(),p=Wn(i),d=Zn(i),m=Wn(u),g=Zn(u),v=Wn(s),y=Zn(s),b=Wn(l),x=Zn(l);o.forEach((function(t,n){h.set(t.toLowerCase(),n)}));var M={a:function(t){return u[t.getDay()]},A:function(t){return i[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:c(n),d:function(t,n){return Gn(t.getDate(),n,2)},e:function(t,n){return Gn(t.getDate(),n,2)},H:function(t,n){return Gn(t.getHours(),n,2)},I:function(t,n){return Gn(t.getHours()%12||12,n,2)},j:function(t,n){return Gn(1+zn.dayOfYear(t),n,3)},L:function(t,n){return Gn(t.getMilliseconds(),n,3)},m:function(t,n){return Gn(t.getMonth()+1,n,2)},M:function(t,n){return Gn(t.getMinutes(),n,2)},p:function(t){return o[+(t.getHours()>=12)]},S:function(t,n){return Gn(t.getSeconds(),n,2)},U:function(t,n){return Gn(zn.sundayOfYear(t),n,2)},w:function(t){return t.getDay()},W:function(t,n){return Gn(zn.mondayOfYear(t),n,2)},x:c(e),X:c(r),y:function(t,n){return Gn(t.getFullYear()%100,n,2)},Y:function(t,n){return Gn(t.getFullYear()%1e4,n,4)},Z:le,"%":function(){return"%"}},w={a:function(t,n,e){m.lastIndex=0;var r=m.exec(n.slice(e));return r?(t.w=g.get(r[0].toLowerCase()),e+r[0].length):-1},A:function(t,n,e){p.lastIndex=0;var r=p.exec(n.slice(e));return r?(t.w=d.get(r[0].toLowerCase()),e+r[0].length):-1},b:function(t,n,e){b.lastIndex=0;var r=b.exec(n.slice(e));return r?(t.m=x.get(r[0].toLowerCase()),e+r[0].length):-1},B:function(t,n,e){v.lastIndex=0;var r=v.exec(n.slice(e));return r?(t.m=y.get(r[0].toLowerCase()),e+r[0].length):-1},c:function(t,n,e){return f(t,M.c.toString(),n,e)},d:re,e:re,H:ae,I:ae,j:oe,L:se,m:ee,M:ie,p:function(t,n,e){var r=h.get(n.slice(e,e+=2).toLowerCase());return null==r?-1:(t.p=r,e)},S:ue,U:$n,w:Jn,W:Kn,x:function(t,n,e){return f(t,M.x.toString(),n,e)},X:function(t,n,e){return f(t,M.X.toString(),n,e)},y:te,Y:Qn,Z:ne,"%":ce};return c}zn.year=Bn((function(t){return(t=zn.day(t)).setMonth(0,1),t}),(function(t,n){t.setFullYear(t.getFullYear()+n)}),(function(t){return t.getFullYear()})),zn.years=zn.year.range,zn.years.utc=zn.year.utc.range,zn.day=Bn((function(t){var n=new qn(2e3,0);return n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),n}),(function(t,n){t.setDate(t.getDate()+n)}),(function(t){return t.getDate()-1})),zn.days=zn.day.range,zn.days.utc=zn.day.utc.range,zn.dayOfYear=function(t){var n=zn.year(t);return Math.floor((t-n-6e4*(t.getTimezoneOffset()-n.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach((function(t,n){n=7-n;var e=zn[t]=Bn((function(t){return(t=zn.day(t)).setDate(t.getDate()-(t.getDay()+n)%7),t}),(function(t,n){t.setDate(t.getDate()+7*Math.floor(n))}),(function(t){var e=zn.year(t).getDay();return Math.floor((zn.dayOfYear(t)+(e+n)%7)/7)-(e!==n)}));zn[t+"s"]=e.range,zn[t+"s"].utc=e.utc.range,zn[t+"OfYear"]=function(t){var e=zn.year(t).getDay();return Math.floor((zn.dayOfYear(t)+(e+n)%7)/7)}})),zn.week=zn.sunday,zn.weeks=zn.sunday.range,zn.weeks.utc=zn.sunday.utc.range,zn.weekOfYear=zn.sundayOfYear;var Yn={"-":"",_:" ",0:"0"},Vn=/^\s*\d+/,Hn=/^%/;function Gn(t,n,e){var r=t<0?"-":"",o=(r?-t:t)+"",a=o.length;return r+(a<e?new Array(e-a+1).join(n)+o:o)}function Wn(t){return new RegExp("^(?:"+t.map(a.requote).join("|")+")","i")}function Zn(t){for(var n=new S,e=-1,r=t.length;++e<r;)n.set(t[e].toLowerCase(),e);return n}function Jn(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function $n(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e));return r?(t.U=+r[0],e+r[0].length):-1}function Kn(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e));return r?(t.W=+r[0],e+r[0].length):-1}function Qn(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function te(t,n,e){Vn.lastIndex=0;var r,o=Vn.exec(n.slice(e,e+2));return o?(t.y=(r=+o[0])+(r>68?1900:2e3),e+o[0].length):-1}function ne(t,n,e){return/^[+-]\d{4}$/.test(n=n.slice(e,e+5))?(t.Z=-n,e+5):-1}function ee(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function re(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function oe(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+3));return r?(t.j=+r[0],e+r[0].length):-1}function ae(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function ie(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function ue(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function se(t,n,e){Vn.lastIndex=0;var r=Vn.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function le(t){var n=t.getTimezoneOffset(),e=n>0?"-":"+",r=w(n)/60|0,o=w(n)%60;return e+Gn(r,"0",2)+Gn(o,"0",2)}function ce(t,n,e){Hn.lastIndex=0;var r=Hn.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function fe(t){for(var n=t.length,e=-1;++e<n;)t[e][0]=this(t[e][0]);return function(n){for(var e=0,r=t[e];!r[1](n);)r=t[++e];return r[0](n)}}a.locale=function(t){return{numberFormat:On(t),timeFormat:Xn(t)}};var he=a.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function pe(){}a.format=he.numberFormat,a.geo={},pe.prototype={s:0,t:0,add:function(t){me(t,this.t,de),me(de.s,this.s,this),this.s?this.t+=de.t:this.s=de.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var de=new pe;function me(t,n,e){var r=e.s=t+n,o=r-t,a=r-o;e.t=t-a+(n-o)}function ge(t,n){t&&ye.hasOwnProperty(t.type)&&ye[t.type](t,n)}a.geo.stream=function(t,n){t&&ve.hasOwnProperty(t.type)?ve[t.type](t,n):ge(t,n)};var ve={Feature:function(t,n){ge(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,o=e.length;++r<o;)ge(e[r].geometry,n)}},ye={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,o=e.length;++r<o;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){be(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,o=e.length;++r<o;)be(e[r],n,0)},Polygon:function(t,n){xe(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,o=e.length;++r<o;)xe(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,o=e.length;++r<o;)ge(e[r],n)}};function be(t,n,e){var r,o=-1,a=t.length-e;for(n.lineStart();++o<a;)r=t[o],n.point(r[0],r[1],r[2]);n.lineEnd()}function xe(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)be(t[e],n,1);n.polygonEnd()}a.geo.area=function(t){return Me=0,a.geo.stream(t,Le),Me};var Me,we,_e,ke,Se,Ae,Ee,Te,Re,Ne,Pe,Ce,Oe=new pe,Le={sphere:function(){Me+=4*Nt},point:q,lineStart:q,lineEnd:q,polygonStart:function(){Oe.reset(),Le.lineStart=Ue},polygonEnd:function(){var t=2*Oe;Me+=t<0?4*Nt+t:t,Le.lineStart=Le.lineEnd=Le.point=q}};function Ue(){var t,n,e,r,o;function a(t,n){n=n*Lt/2+Nt/4;var a=(t*=Lt)-e,i=a>=0?1:-1,u=i*a,s=Math.cos(n),l=Math.sin(n),c=o*l,f=r*s+c*Math.cos(u),h=c*i*Math.sin(u);Oe.add(Math.atan2(h,f)),e=t,r=s,o=l}Le.point=function(i,u){Le.point=a,e=(t=i)*Lt,r=Math.cos(u=(n=u)*Lt/2+Nt/4),o=Math.sin(u)},Le.lineEnd=function(){a(t,n)}}function De(t){var n=t[0],e=t[1],r=Math.cos(e);return[r*Math.cos(n),r*Math.sin(n),Math.sin(e)]}function ze(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function qe(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function je(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function Fe(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function Be(t){var n=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}function Ie(t){return[Math.atan2(t[1],t[0]),jt(t[2])]}function Xe(t,n){return w(t[0]-n[0])<Tt&&w(t[1]-n[1])<Tt}a.geo.bounds=function(){var t,n,e,r,o,i,u,s,l,c,f,h={point:p,lineStart:m,lineEnd:g,polygonStart:function(){h.point=v,h.lineStart=y,h.lineEnd=b,l=0,Le.polygonStart()},polygonEnd:function(){Le.polygonEnd(),h.point=p,h.lineStart=m,h.lineEnd=g,Oe<0?(t=-(e=180),n=-(r=90)):l>Tt?r=90:l<-Tt&&(n=-90),f[0]=t,f[1]=e}};function p(o,a){c.push(f=[t=o,e=o]),a<n&&(n=a),a>r&&(r=a)}function d(a,i){var u=De([a*Lt,i*Lt]);if(s){var l=qe(s,u),c=qe([l[1],-l[0],0],l);Be(c),c=Ie(c);var f=a-o,h=f>0?1:-1,d=c[0]*Ut*h,m=w(f)>180;if(m^(h*o<d&&d<h*a))(g=c[1]*Ut)>r&&(r=g);else if(m^(h*o<(d=(d+360)%360-180)&&d<h*a)){var g;(g=-c[1]*Ut)<n&&(n=g)}else i<n&&(n=i),i>r&&(r=i);m?a<o?x(t,a)>x(t,e)&&(e=a):x(a,e)>x(t,e)&&(t=a):e>=t?(a<t&&(t=a),a>e&&(e=a)):a>o?x(t,a)>x(t,e)&&(e=a):x(a,e)>x(t,e)&&(t=a)}else p(a,i);s=u,o=a}function m(){h.point=d}function g(){f[0]=t,f[1]=e,h.point=p,s=null}function v(t,n){if(s){var e=t-o;l+=w(e)>180?e+(e>0?360:-360):e}else i=t,u=n;Le.point(t,n),d(t,n)}function y(){Le.lineStart()}function b(){v(i,u),Le.lineEnd(),w(l)>Tt&&(t=-(e=180)),f[0]=t,f[1]=e,s=null}function x(t,n){return(n-=t)<0?n+360:n}function M(t,n){return t[0]-n[0]}function _(t,n){return n[0]<=n[1]?n[0]<=t&&t<=n[1]:t<n[0]||n[1]<t}return function(o){if(r=e=-(t=n=1/0),c=[],a.geo.stream(o,h),l=c.length){c.sort(M);for(var i=1,u=[m=c[0]];i<l;++i)_((p=c[i])[0],m)||_(p[1],m)?(x(m[0],p[1])>x(m[0],m[1])&&(m[1]=p[1]),x(p[0],m[1])>x(m[0],m[1])&&(m[0]=p[0])):u.push(m=p);for(var s,l,p,d=-1/0,m=(i=0,u[l=u.length-1]);i<=l;m=p,++i)p=u[i],(s=x(m[1],p[0]))>d&&(d=s,t=p[0],e=m[1])}return c=f=null,t===1/0||n===1/0?[[NaN,NaN],[NaN,NaN]]:[[t,n],[e,r]]}}(),a.geo.centroid=function(t){we=_e=ke=Se=Ae=Ee=Te=Re=Ne=Pe=Ce=0,a.geo.stream(t,Ye);var n=Ne,e=Pe,r=Ce,o=n*n+e*e+r*r;return o<Rt&&(n=Ee,e=Te,r=Re,_e<Tt&&(n=ke,e=Se,r=Ae),(o=n*n+e*e+r*r)<Rt)?[NaN,NaN]:[Math.atan2(e,n)*Ut,jt(r/Math.sqrt(o))*Ut]};var Ye={sphere:q,point:Ve,lineStart:Ge,lineEnd:We,polygonStart:function(){Ye.lineStart=Ze},polygonEnd:function(){Ye.lineStart=Ge}};function Ve(t,n){t*=Lt;var e=Math.cos(n*=Lt);He(e*Math.cos(t),e*Math.sin(t),Math.sin(n))}function He(t,n,e){++we,ke+=(t-ke)/we,Se+=(n-Se)/we,Ae+=(e-Ae)/we}function Ge(){var t,n,e;function r(r,o){r*=Lt;var a=Math.cos(o*=Lt),i=a*Math.cos(r),u=a*Math.sin(r),s=Math.sin(o),l=Math.atan2(Math.sqrt((l=n*s-e*u)*l+(l=e*i-t*s)*l+(l=t*u-n*i)*l),t*i+n*u+e*s);_e+=l,Ee+=l*(t+(t=i)),Te+=l*(n+(n=u)),Re+=l*(e+(e=s)),He(t,n,e)}Ye.point=function(o,a){o*=Lt;var i=Math.cos(a*=Lt);t=i*Math.cos(o),n=i*Math.sin(o),e=Math.sin(a),Ye.point=r,He(t,n,e)}}function We(){Ye.point=Ve}function Ze(){var t,n,e,r,o;function a(t,n){t*=Lt;var a=Math.cos(n*=Lt),i=a*Math.cos(t),u=a*Math.sin(t),s=Math.sin(n),l=r*s-o*u,c=o*i-e*s,f=e*u-r*i,h=Math.sqrt(l*l+c*c+f*f),p=e*i+r*u+o*s,d=h&&-qt(p)/h,m=Math.atan2(h,p);Ne+=d*l,Pe+=d*c,Ce+=d*f,_e+=m,Ee+=m*(e+(e=i)),Te+=m*(r+(r=u)),Re+=m*(o+(o=s)),He(e,r,o)}Ye.point=function(i,u){t=i,n=u,Ye.point=a,i*=Lt;var s=Math.cos(u*=Lt);e=s*Math.cos(i),r=s*Math.sin(i),o=Math.sin(u),He(e,r,o)},Ye.lineEnd=function(){a(t,n),Ye.lineEnd=We,Ye.point=Ve}}function Je(t,n){function e(e,r){return e=t(e,r),n(e[0],e[1])}return t.invert&&n.invert&&(e.invert=function(e,r){return(e=n.invert(e,r))&&t.invert(e[0],e[1])}),e}function $e(){return!0}function Ke(t,n,e,r,o){var a=[],i=[];if(t.forEach((function(t){if(!((n=t.length-1)<=0)){var n,e=t[0],r=t[n];if(Xe(e,r)){o.lineStart();for(var u=0;u<n;++u)o.point((e=t[u])[0],e[1]);o.lineEnd()}else{var s=new tr(e,t,null,!0),l=new tr(e,null,s,!1);s.o=l,a.push(s),i.push(l),s=new tr(r,t,null,!1),l=new tr(r,null,s,!0),s.o=l,a.push(s),i.push(l)}}})),i.sort(n),Qe(a),Qe(i),a.length){for(var u=0,s=e,l=i.length;u<l;++u)i[u].e=s=!s;for(var c,f,h=a[0];;){for(var p=h,d=!0;p.v;)if((p=p.n)===h)return;c=p.z,o.lineStart();do{if(p.v=p.o.v=!0,p.e){if(d)for(u=0,l=c.length;u<l;++u)o.point((f=c[u])[0],f[1]);else r(p.x,p.n.x,1,o);p=p.n}else{if(d)for(u=(c=p.p.z).length-1;u>=0;--u)o.point((f=c[u])[0],f[1]);else r(p.x,p.p.x,-1,o);p=p.p}c=(p=p.o).z,d=!d}while(!p.v);o.lineEnd()}}}function Qe(t){if(n=t.length){for(var n,e,r=0,o=t[0];++r<n;)o.n=e=t[r],e.p=o,o=e;o.n=e=t[0],e.p=o}}function tr(t,n,e,r){this.x=t,this.z=n,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function nr(t,n,e,r){return function(o,i){var u,s=n(i),l=o.invert(r[0],r[1]),c={point:f,lineStart:p,lineEnd:d,polygonStart:function(){c.point=x,c.lineStart=M,c.lineEnd=w,u=[],m=[]},polygonEnd:function(){c.point=f,c.lineStart=p,c.lineEnd=d,u=a.merge(u);var t=function(t,n){var e=t[0],r=t[1],o=[Math.sin(e),-Math.cos(e),0],a=0,i=0;Oe.reset();for(var u=0,s=n.length;u<s;++u){var l=n[u],c=l.length;if(c)for(var f=l[0],h=f[0],p=f[1]/2+Nt/4,d=Math.sin(p),m=Math.cos(p),g=1;;){g===c&&(g=0);var v=(t=l[g])[0],y=t[1]/2+Nt/4,b=Math.sin(y),x=Math.cos(y),M=v-h,w=M>=0?1:-1,_=w*M,k=_>Nt,S=d*b;if(Oe.add(Math.atan2(S*w*Math.sin(_),m*x+S*Math.cos(_))),a+=k?M+w*Pt:M,k^h>=e^v>=e){var A=qe(De(f),De(t));Be(A);var E=qe(o,A);Be(E);var T=(k^M>=0?-1:1)*jt(E[2]);(r>T||r===T&&(A[0]||A[1]))&&(i+=k^M>=0?1:-1)}if(!g++)break;h=v,d=b,m=x,f=t}}return(a<-Tt||a<Tt&&Oe<-Tt)^1&i}(l,m);u.length?(b||(i.polygonStart(),b=!0),Ke(u,or,t,e,i)):t&&(b||(i.polygonStart(),b=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),b&&(i.polygonEnd(),b=!1),u=m=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function f(n,e){var r=o(n,e);t(n=r[0],e=r[1])&&i.point(n,e)}function h(t,n){var e=o(t,n);s.point(e[0],e[1])}function p(){c.point=h,s.lineStart()}function d(){c.point=f,s.lineEnd()}var m,g,v=rr(),y=n(v),b=!1;function x(t,n){g.push([t,n]);var e=o(t,n);y.point(e[0],e[1])}function M(){y.lineStart(),g=[]}function w(){x(g[0][0],g[0][1]),y.lineEnd();var t,n=y.clean(),e=v.buffer(),r=e.length;if(g.pop(),m.push(g),g=null,r)if(1&n){var o,a=-1;if((r=(t=e[0]).length-1)>0){for(b||(i.polygonStart(),b=!0),i.lineStart();++a<r;)i.point((o=t[a])[0],o[1]);i.lineEnd()}}else r>1&&2&n&&e.push(e.pop().concat(e.shift())),u.push(e.filter(er))}return c}}function er(t){return t.length>1}function rr(){var t,n=[];return{lineStart:function(){n.push(t=[])},point:function(n,e){t.push([n,e])},lineEnd:q,buffer:function(){var e=n;return n=[],t=null,e},rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))}}}function or(t,n){return((t=t.x)[0]<0?t[1]-Ot-Tt:Ot-t[1])-((n=n.x)[0]<0?n[1]-Ot-Tt:Ot-n[1])}var ar=nr($e,(function(t){var n,e=NaN,r=NaN,o=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(a,i){var u=a>0?Nt:-Nt,s=w(a-e);w(s-Nt)<Tt?(t.point(e,r=(r+i)/2>0?Ot:-Ot),t.point(o,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(a,r),n=0):o!==u&&s>=Nt&&(w(e-o)<Tt&&(e-=o*Tt),w(a-u)<Tt&&(a-=u*Tt),r=function(t,n,e,r){var o,a,i=Math.sin(t-e);return w(i)>Tt?Math.atan((Math.sin(n)*(a=Math.cos(r))*Math.sin(e)-Math.sin(r)*(o=Math.cos(n))*Math.sin(t))/(o*a*i)):(n+r)/2}(e,r,a,i),t.point(o,r),t.lineEnd(),t.lineStart(),t.point(u,r),n=0),t.point(e=a,r=i),o=u},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}}),(function(t,n,e,r){var o;if(null==t)o=e*Ot,r.point(-Nt,o),r.point(0,o),r.point(Nt,o),r.point(Nt,0),r.point(Nt,-o),r.point(0,-o),r.point(-Nt,-o),r.point(-Nt,0),r.point(-Nt,o);else if(w(t[0]-n[0])>Tt){var a=t[0]<n[0]?Nt:-Nt;o=e*a/2,r.point(-a,o),r.point(0,o),r.point(a,o)}else r.point(n[0],n[1])}),[-Nt,-Nt/2]);function ir(t){var n=Math.cos(t),e=n>0,r=w(n)>Tt;return nr(o,(function(t){var n,u,s,l,c;return{lineStart:function(){l=s=!1,c=1},point:function(f,h){var p,d=[f,h],m=o(f,h),g=e?m?0:i(f,h):m?i(f+(f<0?Nt:-Nt),h):0;if(!n&&(l=s=m)&&t.lineStart(),m!==s&&(p=a(n,d),(Xe(n,p)||Xe(d,p))&&(d[0]+=Tt,d[1]+=Tt,m=o(d[0],d[1]))),m!==s)c=0,m?(t.lineStart(),p=a(d,n),t.point(p[0],p[1])):(p=a(n,d),t.point(p[0],p[1]),t.lineEnd()),n=p;else if(r&&n&&e^m){var v;g&u||!(v=a(d,n,!0))||(c=0,e?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1])))}!m||n&&Xe(n,d)||t.point(d[0],d[1]),n=d,s=m,u=g},lineEnd:function(){s&&t.lineEnd(),n=null},clean:function(){return c|(l&&s)<<1}}}),Ir(t,6*Lt),e?[0,-t]:[-Nt,t-Nt]);function o(t,e){return Math.cos(t)*Math.cos(e)>n}function a(t,e,r){var o=[1,0,0],a=qe(De(t),De(e)),i=ze(a,a),u=a[0],s=i-u*u;if(!s)return!r&&t;var l=n*i/s,c=-n*u/s,f=qe(o,a),h=Fe(o,l);je(h,Fe(a,c));var p=f,d=ze(h,p),m=ze(p,p),g=d*d-m*(ze(h,h)-1);if(!(g<0)){var v=Math.sqrt(g),y=Fe(p,(-d-v)/m);if(je(y,h),y=Ie(y),!r)return y;var b,x=t[0],M=e[0],_=t[1],k=e[1];M<x&&(b=x,x=M,M=b);var S=M-x,A=w(S-Nt)<Tt;if(!A&&k<_&&(b=_,_=k,k=b),A||S<Tt?A?_+k>0^y[1]<(w(y[0]-x)<Tt?_:k):_<=y[1]&&y[1]<=k:S>Nt^(x<=y[0]&&y[0]<=M)){var E=Fe(p,(-d+v)/m);return je(E,h),[y,Ie(E)]}}}function i(n,r){var o=e?t:Nt-t,a=0;return n<-o?a|=1:n>o&&(a|=2),r<-o?a|=4:r>o&&(a|=8),a}}function ur(t,n,e,r){return function(o){var a,i=o.a,u=o.b,s=i.x,l=i.y,c=0,f=1,h=u.x-s,p=u.y-l;if(a=t-s,h||!(a>0)){if(a/=h,h<0){if(a<c)return;a<f&&(f=a)}else if(h>0){if(a>f)return;a>c&&(c=a)}if(a=e-s,h||!(a<0)){if(a/=h,h<0){if(a>f)return;a>c&&(c=a)}else if(h>0){if(a<c)return;a<f&&(f=a)}if(a=n-l,p||!(a>0)){if(a/=p,p<0){if(a<c)return;a<f&&(f=a)}else if(p>0){if(a>f)return;a>c&&(c=a)}if(a=r-l,p||!(a<0)){if(a/=p,p<0){if(a>f)return;a>c&&(c=a)}else if(p>0){if(a<c)return;a<f&&(f=a)}return c>0&&(o.a={x:s+c*h,y:l+c*p}),f<1&&(o.b={x:s+f*h,y:l+f*p}),o}}}}}}function sr(t,n,e,r){return function(s){var l,c,f,h,p,d,m,g,v,y,b,x=s,M=rr(),w=ur(t,n,e,r),_={point:A,lineStart:function(){_.point=E,c&&c.push(f=[]),y=!0,v=!1,m=g=NaN},lineEnd:function(){l&&(E(h,p),d&&v&&M.rejoin(),l.push(M.buffer())),_.point=A,v&&s.lineEnd()},polygonStart:function(){s=M,l=[],c=[],b=!0},polygonEnd:function(){s=x,l=a.merge(l);var n=function(t){for(var n=0,e=c.length,r=t[1],o=0;o<e;++o)for(var a,i=1,u=c[o],s=u.length,l=u[0];i<s;++i)a=u[i],l[1]<=r?a[1]>r&&zt(l,a,t)>0&&++n:a[1]<=r&&zt(l,a,t)<0&&--n,l=a;return 0!==n}([t,r]),e=b&&n,o=l.length;(e||o)&&(s.polygonStart(),e&&(s.lineStart(),k(null,null,1,s),s.lineEnd()),o&&Ke(l,i,n,k,s),s.polygonEnd()),l=c=f=null}};function k(a,i,s,l){var c=0,f=0;if(null==a||(c=o(a,s))!==(f=o(i,s))||u(a,i)<0^s>0)do{l.point(0===c||3===c?t:e,c>1?r:n)}while((c=(c+s+4)%4)!==f);else l.point(i[0],i[1])}function S(o,a){return t<=o&&o<=e&&n<=a&&a<=r}function A(t,n){S(t,n)&&s.point(t,n)}function E(t,n){var e=S(t=Math.max(-1e9,Math.min(1e9,t)),n=Math.max(-1e9,Math.min(1e9,n)));if(c&&f.push([t,n]),y)h=t,p=n,d=e,y=!1,e&&(s.lineStart(),s.point(t,n));else if(e&&v)s.point(t,n);else{var r={a:{x:m,y:g},b:{x:t,y:n}};w(r)?(v||(s.lineStart(),s.point(r.a.x,r.a.y)),s.point(r.b.x,r.b.y),e||s.lineEnd(),b=!1):e&&(s.lineStart(),s.point(t,n),b=!1)}m=t,g=n,v=e}return _};function o(r,o){return w(r[0]-t)<Tt?o>0?0:3:w(r[0]-e)<Tt?o>0?2:1:w(r[1]-n)<Tt?o>0?1:0:o>0?3:2}function i(t,n){return u(t.x,n.x)}function u(t,n){var e=o(t,1),r=o(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}}function lr(t){var n=0,e=Nt/3,r=Lr(t),o=r(n,e);return o.parallels=function(t){return arguments.length?r(n=t[0]*Nt/180,e=t[1]*Nt/180):[n/Nt*180,e/Nt*180]},o}function cr(t,n){var e=Math.sin(t),r=(e+Math.sin(n))/2,o=1+e*(2*r-e),a=Math.sqrt(o)/r;function i(t,n){var e=Math.sqrt(o-2*r*Math.sin(n))/r;return[e*Math.sin(t*=r),a-e*Math.cos(t)]}return i.invert=function(t,n){var e=a-n;return[Math.atan2(t,e)/r,jt((o-(t*t+e*e)*r*r)/(2*r))]},i}a.geo.clipExtent=function(){var t,n,e,r,o,a,i={stream:function(t){return o&&(o.valid=!1),(o=a(t)).valid=!0,o},extent:function(u){return arguments.length?(a=sr(t=+u[0][0],n=+u[0][1],e=+u[1][0],r=+u[1][1]),o&&(o.valid=!1,o=null),i):[[t,n],[e,r]]}};return i.extent([[0,0],[960,500]])},(a.geo.conicEqualArea=function(){return lr(cr)}).raw=cr,a.geo.albers=function(){return a.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},a.geo.albersUsa=function(){var t,n,e,r,o=a.geo.albers(),i=a.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),u=a.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),s={point:function(n,e){t=[n,e]}};function l(o){var a=o[0],i=o[1];return t=null,n(a,i),t||(e(a,i),t)||r(a,i),t}return l.invert=function(t){var n=o.scale(),e=o.translate(),r=(t[0]-e[0])/n,a=(t[1]-e[1])/n;return(a>=.12&&a<.234&&r>=-.425&&r<-.214?i:a>=.166&&a<.234&&r>=-.214&&r<-.115?u:o).invert(t)},l.stream=function(t){var n=o.stream(t),e=i.stream(t),r=u.stream(t);return{point:function(t,o){n.point(t,o),e.point(t,o),r.point(t,o)},sphere:function(){n.sphere(),e.sphere(),r.sphere()},lineStart:function(){n.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){n.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){n.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){n.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},l.precision=function(t){return arguments.length?(o.precision(t),i.precision(t),u.precision(t),l):o.precision()},l.scale=function(t){return arguments.length?(o.scale(t),i.scale(.35*t),u.scale(t),l.translate(o.translate())):o.scale()},l.translate=function(t){if(!arguments.length)return o.translate();var a=o.scale(),c=+t[0],f=+t[1];return n=o.translate(t).clipExtent([[c-.455*a,f-.238*a],[c+.455*a,f+.238*a]]).stream(s).point,e=i.translate([c-.307*a,f+.201*a]).clipExtent([[c-.425*a+Tt,f+.12*a+Tt],[c-.214*a-Tt,f+.234*a-Tt]]).stream(s).point,r=u.translate([c-.205*a,f+.212*a]).clipExtent([[c-.214*a+Tt,f+.166*a+Tt],[c-.115*a-Tt,f+.234*a-Tt]]).stream(s).point,l},l.scale(1070)};var fr,hr,pr,dr,mr,gr,vr={point:q,lineStart:q,lineEnd:q,polygonStart:function(){hr=0,vr.lineStart=yr},polygonEnd:function(){vr.lineStart=vr.lineEnd=vr.point=q,fr+=w(hr/2)}};function yr(){var t,n,e,r;function o(t,n){hr+=r*t-e*n,e=t,r=n}vr.point=function(a,i){vr.point=o,t=e=a,n=r=i},vr.lineEnd=function(){o(t,n)}}var br={point:function(t,n){t<pr&&(pr=t),t>mr&&(mr=t),n<dr&&(dr=n),n>gr&&(gr=n)},lineStart:q,lineEnd:q,polygonStart:q,polygonEnd:q};function xr(){var t=Mr(4.5),n=[],e={point:r,lineStart:function(){e.point=o},lineEnd:i,polygonStart:function(){e.lineEnd=u},polygonEnd:function(){e.lineEnd=i,e.point=r},pointRadius:function(n){return t=Mr(n),e},result:function(){if(n.length){var t=n.join("");return n=[],t}}};function r(e,r){n.push("M",e,",",r,t)}function o(t,r){n.push("M",t,",",r),e.point=a}function a(t,e){n.push("L",t,",",e)}function i(){e.point=r}function u(){n.push("Z")}return e}function Mr(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}var wr,_r={point:kr,lineStart:Sr,lineEnd:Ar,polygonStart:function(){_r.lineStart=Er},polygonEnd:function(){_r.point=kr,_r.lineStart=Sr,_r.lineEnd=Ar}};function kr(t,n){ke+=t,Se+=n,++Ae}function Sr(){var t,n;function e(e,r){var o=e-t,a=r-n,i=Math.sqrt(o*o+a*a);Ee+=i*(t+e)/2,Te+=i*(n+r)/2,Re+=i,kr(t=e,n=r)}_r.point=function(r,o){_r.point=e,kr(t=r,n=o)}}function Ar(){_r.point=kr}function Er(){var t,n,e,r;function o(t,n){var o=t-e,a=n-r,i=Math.sqrt(o*o+a*a);Ee+=i*(e+t)/2,Te+=i*(r+n)/2,Re+=i,Ne+=(i=r*t-e*n)*(e+t),Pe+=i*(r+n),Ce+=3*i,kr(e=t,r=n)}_r.point=function(a,i){_r.point=o,kr(t=e=a,n=r=i)},_r.lineEnd=function(){o(t,n)}}function Tr(t){var n=4.5,e={point:r,lineStart:function(){e.point=o},lineEnd:i,polygonStart:function(){e.lineEnd=u},polygonEnd:function(){e.lineEnd=i,e.point=r},pointRadius:function(t){return n=t,e},result:q};function r(e,r){t.moveTo(e+n,r),t.arc(e,r,n,0,Pt)}function o(n,r){t.moveTo(n,r),e.point=a}function a(n,e){t.lineTo(n,e)}function i(){e.point=r}function u(){t.closePath()}return e}function Rr(t){var n=.5,e=Math.cos(30*Lt),r=16;function o(t){return(r?i:a)(t)}function a(n){return Cr(n,(function(e,r){e=t(e,r),n.point(e[0],e[1])}))}function i(n){var e,o,a,i,s,l,c,f,h,p,d,m,g={point:v,lineStart:y,lineEnd:x,polygonStart:function(){n.polygonStart(),g.lineStart=M},polygonEnd:function(){n.polygonEnd(),g.lineStart=y}};function v(e,r){e=t(e,r),n.point(e[0],e[1])}function y(){f=NaN,g.point=b,n.lineStart()}function b(e,o){var a=De([e,o]),i=t(e,o);u(f,h,c,p,d,m,f=i[0],h=i[1],c=e,p=a[0],d=a[1],m=a[2],r,n),n.point(f,h)}function x(){g.point=v,n.lineEnd()}function M(){y(),g.point=w,g.lineEnd=_}function w(t,n){b(e=t,n),o=f,a=h,i=p,s=d,l=m,g.point=b}function _(){u(f,h,c,p,d,m,o,a,e,i,s,l,r,n),g.lineEnd=x,x()}return g}function u(r,o,a,i,s,l,c,f,h,p,d,m,g,v){var y=c-r,b=f-o,x=y*y+b*b;if(x>4*n&&g--){var M=i+p,_=s+d,k=l+m,S=Math.sqrt(M*M+_*_+k*k),A=Math.asin(k/=S),E=w(w(k)-1)<Tt||w(a-h)<Tt?(a+h)/2:Math.atan2(_,M),T=t(E,A),R=T[0],N=T[1],P=R-r,C=N-o,O=b*P-y*C;(O*O/x>n||w((y*P+b*C)/x-.5)>.3||i*p+s*d+l*m<e)&&(u(r,o,a,i,s,l,R,N,E,M/=S,_/=S,k,g,v),v.point(R,N),u(R,N,E,M,_,k,c,f,h,p,d,m,g,v))}}return o.precision=function(t){return arguments.length?(r=(n=t*t)>0&&16,o):Math.sqrt(n)},o}function Nr(t){var n=Rr((function(n,e){return t([n*Ut,e*Ut])}));return function(t){return Ur(n(t))}}function Pr(t){this.stream=t}function Cr(t,n){return{point:n,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function Or(t){return Lr((function(){return t}))()}function Lr(t){var n,e,r,o,i,u,s=Rr((function(t,e){return[(t=n(t,e))[0]*l+o,i-t[1]*l]})),l=150,c=480,f=250,h=0,p=0,d=0,m=0,g=0,v=ar,y=L,b=null,x=null;function M(t){return[(t=r(t[0]*Lt,t[1]*Lt))[0]*l+o,i-t[1]*l]}function w(t){return(t=r.invert((t[0]-o)/l,(i-t[1])/l))&&[t[0]*Ut,t[1]*Ut]}function _(){r=Je(e=qr(d,m,g),n);var t=n(h,p);return o=c-t[0]*l,i=f+t[1]*l,k()}function k(){return u&&(u.valid=!1,u=null),M}return M.stream=function(t){return u&&(u.valid=!1),(u=Ur(v(e,s(y(t))))).valid=!0,u},M.clipAngle=function(t){return arguments.length?(v=null==t?(b=t,ar):ir((b=+t)*Lt),k()):b},M.clipExtent=function(t){return arguments.length?(x=t,y=t?sr(t[0][0],t[0][1],t[1][0],t[1][1]):L,k()):x},M.scale=function(t){return arguments.length?(l=+t,_()):l},M.translate=function(t){return arguments.length?(c=+t[0],f=+t[1],_()):[c,f]},M.center=function(t){return arguments.length?(h=t[0]%360*Lt,p=t[1]%360*Lt,_()):[h*Ut,p*Ut]},M.rotate=function(t){return arguments.length?(d=t[0]%360*Lt,m=t[1]%360*Lt,g=t.length>2?t[2]%360*Lt:0,_()):[d*Ut,m*Ut,g*Ut]},a.rebind(M,s,"precision"),function(){return n=t.apply(this,arguments),M.invert=n.invert&&w,_()}}function Ur(t){return Cr(t,(function(n,e){t.point(n*Lt,e*Lt)}))}function Dr(t,n){return[t,n]}function zr(t,n){return[t>Nt?t-Pt:t<-Nt?t+Pt:t,n]}function qr(t,n,e){return t?n||e?Je(Fr(t),Br(n,e)):Fr(t):n||e?Br(n,e):zr}function jr(t){return function(n,e){return[(n+=t)>Nt?n-Pt:n<-Nt?n+Pt:n,e]}}function Fr(t){var n=jr(t);return n.invert=jr(-t),n}function Br(t,n){var e=Math.cos(t),r=Math.sin(t),o=Math.cos(n),a=Math.sin(n);function i(t,n){var i=Math.cos(n),u=Math.cos(t)*i,s=Math.sin(t)*i,l=Math.sin(n),c=l*e+u*r;return[Math.atan2(s*o-c*a,u*e-l*r),jt(c*o+s*a)]}return i.invert=function(t,n){var i=Math.cos(n),u=Math.cos(t)*i,s=Math.sin(t)*i,l=Math.sin(n),c=l*o-s*a;return[Math.atan2(s*o+l*a,u*e+c*r),jt(c*e-u*r)]},i}function Ir(t,n){var e=Math.cos(t),r=Math.sin(t);return function(o,a,i,u){var s=i*n;null!=o?(o=Xr(e,o),a=Xr(e,a),(i>0?o<a:o>a)&&(o+=i*Pt)):(o=t+i*Pt,a=t-.5*s);for(var l,c=o;i>0?c>a:c<a;c-=s)u.point((l=Ie([e,-r*Math.cos(c),-r*Math.sin(c)]))[0],l[1])}}function Xr(t,n){var e=De(n);e[0]-=t,Be(e);var r=qt(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-Tt)%(2*Math.PI)}function Yr(t,n,e){var r=a.range(t,n-Tt,e).concat(n);return function(t){return r.map((function(n){return[t,n]}))}}function Vr(t,n,e){var r=a.range(t,n-Tt,e).concat(n);return function(t){return r.map((function(n){return[n,t]}))}}function Hr(t){return t.source}function Gr(t){return t.target}a.geo.path=function(){var t,n,e,r,o,i=4.5;function u(t){return t&&("function"==typeof i&&r.pointRadius(+i.apply(this,arguments)),o&&o.valid||(o=e(r)),a.geo.stream(t,o)),r.result()}function s(){return o=null,u}return u.area=function(t){return fr=0,a.geo.stream(t,e(vr)),fr},u.centroid=function(t){return ke=Se=Ae=Ee=Te=Re=Ne=Pe=Ce=0,a.geo.stream(t,e(_r)),Ce?[Ne/Ce,Pe/Ce]:Re?[Ee/Re,Te/Re]:Ae?[ke/Ae,Se/Ae]:[NaN,NaN]},u.bounds=function(t){return mr=gr=-(pr=dr=1/0),a.geo.stream(t,e(br)),[[pr,dr],[mr,gr]]},u.projection=function(n){return arguments.length?(e=(t=n)?n.stream||Nr(n):L,s()):t},u.context=function(t){return arguments.length?(r=null==(n=t)?new xr:new Tr(t),"function"!=typeof i&&r.pointRadius(i),s()):n},u.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(r.pointRadius(+t),+t),u):i},u.projection(a.geo.albersUsa()).context(null)},a.geo.transform=function(t){return{stream:function(n){var e=new Pr(n);for(var r in t)e[r]=t[r];return e}}},Pr.prototype={point:function(t,n){this.stream.point(t,n)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},a.geo.projection=Or,a.geo.projectionMutator=Lr,(a.geo.equirectangular=function(){return Or(Dr)}).raw=Dr.invert=Dr,a.geo.rotation=function(t){function n(n){return(n=t(n[0]*Lt,n[1]*Lt))[0]*=Ut,n[1]*=Ut,n}return t=qr(t[0]%360*Lt,t[1]*Lt,t.length>2?t[2]*Lt:0),n.invert=function(n){return(n=t.invert(n[0]*Lt,n[1]*Lt))[0]*=Ut,n[1]*=Ut,n},n},zr.invert=Dr,a.geo.circle=function(){var t,n,e=[0,0],r=6;function o(){var t="function"==typeof e?e.apply(this,arguments):e,r=qr(-t[0]*Lt,-t[1]*Lt,0).invert,o=[];return n(null,null,1,{point:function(t,n){o.push(t=r(t,n)),t[0]*=Ut,t[1]*=Ut}}),{type:"Polygon",coordinates:[o]}}return o.origin=function(t){return arguments.length?(e=t,o):e},o.angle=function(e){return arguments.length?(n=Ir((t=+e)*Lt,r*Lt),o):t},o.precision=function(e){return arguments.length?(n=Ir(t*Lt,(r=+e)*Lt),o):r},o.angle(90)},a.geo.distance=function(t,n){var e,r=(n[0]-t[0])*Lt,o=t[1]*Lt,a=n[1]*Lt,i=Math.sin(r),u=Math.cos(r),s=Math.sin(o),l=Math.cos(o),c=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((e=f*i)*e+(e=l*c-s*f*u)*e),s*c+l*f*u)},a.geo.graticule=function(){var t,n,e,r,o,i,u,s,l,c,f,h,p=10,d=p,m=90,g=360,v=2.5;function y(){return{type:"MultiLineString",coordinates:b()}}function b(){return a.range(Math.ceil(r/m)*m,e,m).map(f).concat(a.range(Math.ceil(s/g)*g,u,g).map(h)).concat(a.range(Math.ceil(n/p)*p,t,p).filter((function(t){return w(t%m)>Tt})).map(l)).concat(a.range(Math.ceil(i/d)*d,o,d).filter((function(t){return w(t%g)>Tt})).map(c))}return y.lines=function(){return b().map((function(t){return{type:"LineString",coordinates:t}}))},y.outline=function(){return{type:"Polygon",coordinates:[f(r).concat(h(u).slice(1),f(e).reverse().slice(1),h(s).reverse().slice(1))]}},y.extent=function(t){return arguments.length?y.majorExtent(t).minorExtent(t):y.minorExtent()},y.majorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],s=+t[0][1],u=+t[1][1],r>e&&(t=r,r=e,e=t),s>u&&(t=s,s=u,u=t),y.precision(v)):[[r,s],[e,u]]},y.minorExtent=function(e){return arguments.length?(n=+e[0][0],t=+e[1][0],i=+e[0][1],o=+e[1][1],n>t&&(e=n,n=t,t=e),i>o&&(e=i,i=o,o=e),y.precision(v)):[[n,i],[t,o]]},y.step=function(t){return arguments.length?y.majorStep(t).minorStep(t):y.minorStep()},y.majorStep=function(t){return arguments.length?(m=+t[0],g=+t[1],y):[m,g]},y.minorStep=function(t){return arguments.length?(p=+t[0],d=+t[1],y):[p,d]},y.precision=function(a){return arguments.length?(v=+a,l=Yr(i,o,90),c=Vr(n,t,v),f=Yr(s,u,90),h=Vr(r,e,v),y):v},y.majorExtent([[-180,-90+Tt],[180,90-Tt]]).minorExtent([[-180,-80-Tt],[180,80+Tt]])},a.geo.greatArc=function(){var t,n,e=Hr,r=Gr;function o(){return{type:"LineString",coordinates:[t||e.apply(this,arguments),n||r.apply(this,arguments)]}}return o.distance=function(){return a.geo.distance(t||e.apply(this,arguments),n||r.apply(this,arguments))},o.source=function(n){return arguments.length?(e=n,t="function"==typeof n?null:n,o):e},o.target=function(t){return arguments.length?(r=t,n="function"==typeof t?null:t,o):r},o.precision=function(){return arguments.length?o:0},o},a.geo.interpolate=function(t,n){return e=t[0]*Lt,r=t[1]*Lt,o=n[0]*Lt,a=n[1]*Lt,i=Math.cos(r),u=Math.sin(r),s=Math.cos(a),l=Math.sin(a),c=i*Math.cos(e),f=i*Math.sin(e),h=s*Math.cos(o),p=s*Math.sin(o),d=2*Math.asin(Math.sqrt(Bt(a-r)+i*s*Bt(o-e))),m=1/Math.sin(d),(g=d?function(t){var n=Math.sin(t*=d)*m,e=Math.sin(d-t)*m,r=e*c+n*h,o=e*f+n*p,a=e*u+n*l;return[Math.atan2(o,r)*Ut,Math.atan2(a,Math.sqrt(r*r+o*o))*Ut]}:function(){return[e*Ut,r*Ut]}).distance=d,g;var e,r,o,a,i,u,s,l,c,f,h,p,d,m,g},a.geo.length=function(t){return wr=0,a.geo.stream(t,Wr),wr};var Wr={sphere:q,point:q,lineStart:function(){var t,n,e;function r(r,o){var a=Math.sin(o*=Lt),i=Math.cos(o),u=w((r*=Lt)-t),s=Math.cos(u);wr+=Math.atan2(Math.sqrt((u=i*Math.sin(u))*u+(u=e*a-n*i*s)*u),n*a+e*i*s),t=r,n=a,e=i}Wr.point=function(o,a){t=o*Lt,n=Math.sin(a*=Lt),e=Math.cos(a),Wr.point=r},Wr.lineEnd=function(){Wr.point=Wr.lineEnd=q}},lineEnd:q,polygonStart:q,polygonEnd:q};function Zr(t,n){function e(n,e){var r=Math.cos(n),o=Math.cos(e),a=t(r*o);return[a*o*Math.sin(n),a*Math.sin(e)]}return e.invert=function(t,e){var r=Math.sqrt(t*t+e*e),o=n(r),a=Math.sin(o),i=Math.cos(o);return[Math.atan2(t*a,r*i),Math.asin(r&&e*a/r)]},e}var Jr=Zr((function(t){return Math.sqrt(2/(1+t))}),(function(t){return 2*Math.asin(t/2)}));(a.geo.azimuthalEqualArea=function(){return Or(Jr)}).raw=Jr;var $r=Zr((function(t){var n=Math.acos(t);return n&&n/Math.sin(n)}),L);function Kr(t,n){var e=Math.cos(t),r=function(t){return Math.tan(Nt/4+t/2)},o=t===n?Math.sin(t):Math.log(e/Math.cos(n))/Math.log(r(n)/r(t)),a=e*Math.pow(r(t),o)/o;if(!o)return no;function i(t,n){a>0?n<-Ot+Tt&&(n=-Ot+Tt):n>Ot-Tt&&(n=Ot-Tt);var e=a/Math.pow(r(n),o);return[e*Math.sin(o*t),a-e*Math.cos(o*t)]}return i.invert=function(t,n){var e=a-n,r=Dt(o)*Math.sqrt(t*t+e*e);return[Math.atan2(t,e)/o,2*Math.atan(Math.pow(a/r,1/o))-Ot]},i}function Qr(t,n){var e=Math.cos(t),r=t===n?Math.sin(t):(e-Math.cos(n))/(n-t),o=e/r+t;if(w(r)<Tt)return Dr;function a(t,n){var e=o-n;return[e*Math.sin(r*t),o-e*Math.cos(r*t)]}return a.invert=function(t,n){var e=o-n;return[Math.atan2(t,e)/r,o-Dt(r)*Math.sqrt(t*t+e*e)]},a}(a.geo.azimuthalEquidistant=function(){return Or($r)}).raw=$r,(a.geo.conicConformal=function(){return lr(Kr)}).raw=Kr,(a.geo.conicEquidistant=function(){return lr(Qr)}).raw=Qr;var to=Zr((function(t){return 1/t}),Math.atan);function no(t,n){return[t,Math.log(Math.tan(Nt/4+n/2))]}function eo(t){var n,e=Or(t),r=e.scale,o=e.translate,a=e.clipExtent;return e.scale=function(){var t=r.apply(e,arguments);return t===e?n?e.clipExtent(null):e:t},e.translate=function(){var t=o.apply(e,arguments);return t===e?n?e.clipExtent(null):e:t},e.clipExtent=function(t){var i=a.apply(e,arguments);if(i===e){if(n=null==t){var u=Nt*r(),s=o();a([[s[0]-u,s[1]-u],[s[0]+u,s[1]+u]])}}else n&&(i=null);return i},e.clipExtent(null)}(a.geo.gnomonic=function(){return Or(to)}).raw=to,no.invert=function(t,n){return[t,2*Math.atan(Math.exp(n))-Ot]},(a.geo.mercator=function(){return eo(no)}).raw=no;var ro=Zr((function(){return 1}),Math.asin);(a.geo.orthographic=function(){return Or(ro)}).raw=ro;var oo=Zr((function(t){return 1/(1+t)}),(function(t){return 2*Math.atan(t)}));function ao(t,n){return[Math.log(Math.tan(Nt/4+n/2)),-t]}function io(t){return t[0]}function uo(t){return t[1]}function so(t){for(var n=t.length,e=[0,1],r=2,o=2;o<n;o++){for(;r>1&&zt(t[e[r-2]],t[e[r-1]],t[o])<=0;)--r;e[r++]=o}return e.slice(0,r)}function lo(t,n){return t[0]-n[0]||t[1]-n[1]}(a.geo.stereographic=function(){return Or(oo)}).raw=oo,ao.invert=function(t,n){return[-n,2*Math.atan(Math.exp(t))-Ot]},(a.geo.transverseMercator=function(){var t=eo(ao),n=t.center,e=t.rotate;return t.center=function(t){return t?n([-t[1],t[0]]):[(t=n())[1],-t[0]]},t.rotate=function(t){return t?e([t[0],t[1],t.length>2?t[2]+90:90]):[(t=e())[0],t[1],t[2]-90]},e([0,0,90])}).raw=ao,a.geom={},a.geom.hull=function(t){var n=io,e=uo;if(arguments.length)return r(t);function r(t){if(t.length<3)return[];var r,o=bn(n),a=bn(e),i=t.length,u=[],s=[];for(r=0;r<i;r++)u.push([+o.call(this,t[r],r),+a.call(this,t[r],r),r]);for(u.sort(lo),r=0;r<i;r++)s.push([u[r][0],-u[r][1]]);var l=so(u),c=so(s),f=c[0]===l[0],h=c[c.length-1]===l[l.length-1],p=[];for(r=l.length-1;r>=0;--r)p.push(t[u[l[r]][2]]);for(r=+f;r<c.length-h;++r)p.push(t[u[c[r]][2]]);return p}return r.x=function(t){return arguments.length?(n=t,r):n},r.y=function(t){return arguments.length?(e=t,r):e},r},a.geom.polygon=function(t){return V(t,co),t};var co=a.geom.polygon.prototype=[];function fo(t,n,e){return(e[0]-n[0])*(t[1]-n[1])<(e[1]-n[1])*(t[0]-n[0])}function ho(t,n,e,r){var o=t[0],a=e[0],i=n[0]-o,u=r[0]-a,s=t[1],l=e[1],c=n[1]-s,f=r[1]-l,h=(u*(s-l)-f*(o-a))/(f*i-u*c);return[o+h*i,s+h*c]}function po(t){var n=t[0],e=t[t.length-1];return!(n[0]-e[0]||n[1]-e[1])}co.area=function(){for(var t,n=-1,e=this.length,r=this[e-1],o=0;++n<e;)t=r,r=this[n],o+=t[1]*r[0]-t[0]*r[1];return.5*o},co.centroid=function(t){var n,e,r=-1,o=this.length,a=0,i=0,u=this[o-1];for(arguments.length||(t=-1/(6*this.area()));++r<o;)n=u,u=this[r],e=n[0]*u[1]-u[0]*n[1],a+=(n[0]+u[0])*e,i+=(n[1]+u[1])*e;return[a*t,i*t]},co.clip=function(t){for(var n,e,r,o,a,i,u=po(t),s=-1,l=this.length-po(this),c=this[l-1];++s<l;){for(n=t.slice(),t.length=0,o=this[s],a=n[(r=n.length-u)-1],e=-1;++e<r;)fo(i=n[e],c,o)?(fo(a,c,o)||t.push(ho(a,i,c,o)),t.push(i)):fo(a,c,o)&&t.push(ho(a,i,c,o)),a=i;u&&t.push(t[0]),c=o}return t};var mo,go,vo,yo,bo,xo=[],Mo=[];function wo(){Fo(this),this.edge=this.site=this.circle=null}function _o(t){var n=xo.pop()||new wo;return n.site=t,n}function ko(t){Oo(t),vo.remove(t),xo.push(t),Fo(t)}function So(t){var n=t.circle,e=n.x,r=n.cy,o={x:e,y:r},a=t.P,i=t.N,u=[t];ko(t);for(var s=a;s.circle&&w(e-s.circle.x)<Tt&&w(r-s.circle.cy)<Tt;)a=s.P,u.unshift(s),ko(s),s=a;u.unshift(s),Oo(s);for(var l=i;l.circle&&w(e-l.circle.x)<Tt&&w(r-l.circle.cy)<Tt;)i=l.N,u.push(l),ko(l),l=i;u.push(l),Oo(l);var c,f=u.length;for(c=1;c<f;++c)l=u[c],s=u[c-1],zo(l.edge,s.site,l.site,o);s=u[0],(l=u[f-1]).edge=Do(s.site,l.site,null,o),Co(s),Co(l)}function Ao(t){for(var n,e,r,o,a=t.x,i=t.y,u=vo._;u;)if((r=Eo(u,i)-a)>Tt)u=u.L;else{if(!((o=a-To(u,i))>Tt)){r>-Tt?(n=u.P,e=u):o>-Tt?(n=u,e=u.N):n=e=u;break}if(!u.R){n=u;break}u=u.R}var s=_o(t);if(vo.insert(n,s),n||e){if(n===e)return Oo(n),e=_o(n.site),vo.insert(s,e),s.edge=e.edge=Do(n.site,s.site),Co(n),void Co(e);if(e){Oo(n),Oo(e);var l=n.site,c=l.x,f=l.y,h=t.x-c,p=t.y-f,d=e.site,m=d.x-c,g=d.y-f,v=2*(h*g-p*m),y=h*h+p*p,b=m*m+g*g,x={x:(g*y-p*b)/v+c,y:(h*b-m*y)/v+f};zo(e.edge,l,d,x),s.edge=Do(l,t,null,x),e.edge=Do(t,d,null,x),Co(n),Co(e)}else s.edge=Do(n.site,s.site)}}function Eo(t,n){var e=t.site,r=e.x,o=e.y,a=o-n;if(!a)return r;var i=t.P;if(!i)return-1/0;var u=(e=i.site).x,s=e.y,l=s-n;if(!l)return u;var c=u-r,f=1/a-1/l,h=c/l;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*l)-s+l/2+o-a/2)))/f+r:(r+u)/2}function To(t,n){var e=t.N;if(e)return Eo(e,n);var r=t.site;return r.y===n?r.x:1/0}function Ro(t){this.site=t,this.edges=[]}function No(t,n){return n.angle-t.angle}function Po(){Fo(this),this.x=this.y=this.arc=this.site=this.cy=null}function Co(t){var n=t.P,e=t.N;if(n&&e){var r=n.site,o=t.site,a=e.site;if(r!==a){var i=o.x,u=o.y,s=r.x-i,l=r.y-u,c=a.x-i,f=2*(s*(g=a.y-u)-l*c);if(!(f>=-Rt)){var h=s*s+l*l,p=c*c+g*g,d=(g*h-l*p)/f,m=(s*p-c*h)/f,g=m+u,v=Mo.pop()||new Po;v.arc=t,v.site=o,v.x=d+i,v.y=g+Math.sqrt(d*d+m*m),v.cy=g,t.circle=v;for(var y=null,b=bo._;b;)if(v.y<b.y||v.y===b.y&&v.x<=b.x){if(!b.L){y=b.P;break}b=b.L}else{if(!b.R){y=b;break}b=b.R}bo.insert(y,v),y||(yo=v)}}}}function Oo(t){var n=t.circle;n&&(n.P||(yo=n.N),bo.remove(n),Mo.push(n),Fo(n),t.circle=null)}function Lo(t,n){var e=t.b;if(e)return!0;var r,o,a=t.a,i=n[0][0],u=n[1][0],s=n[0][1],l=n[1][1],c=t.l,f=t.r,h=c.x,p=c.y,d=f.x,m=f.y,g=(h+d)/2,v=(p+m)/2;if(m===p){if(g<i||g>=u)return;if(h>d){if(a){if(a.y>=l)return}else a={x:g,y:s};e={x:g,y:l}}else{if(a){if(a.y<s)return}else a={x:g,y:l};e={x:g,y:s}}}else if(o=v-(r=(h-d)/(m-p))*g,r<-1||r>1)if(h>d){if(a){if(a.y>=l)return}else a={x:(s-o)/r,y:s};e={x:(l-o)/r,y:l}}else{if(a){if(a.y<s)return}else a={x:(l-o)/r,y:l};e={x:(s-o)/r,y:s}}else if(p<m){if(a){if(a.x>=u)return}else a={x:i,y:r*i+o};e={x:u,y:r*u+o}}else{if(a){if(a.x<i)return}else a={x:u,y:r*u+o};e={x:i,y:r*i+o}}return t.a=a,t.b=e,!0}function Uo(t,n){this.l=t,this.r=n,this.a=this.b=null}function Do(t,n,e,r){var o=new Uo(t,n);return mo.push(o),e&&zo(o,t,n,e),r&&zo(o,n,t,r),go[t.i].edges.push(new qo(o,t,n)),go[n.i].edges.push(new qo(o,n,t)),o}function zo(t,n,e,r){t.a||t.b?t.l===e?t.b=r:t.a=r:(t.a=r,t.l=n,t.r=e)}function qo(t,n,e){var r=t.a,o=t.b;this.edge=t,this.site=n,this.angle=e?Math.atan2(e.y-n.y,e.x-n.x):t.l===n?Math.atan2(o.x-r.x,r.y-o.y):Math.atan2(r.x-o.x,o.y-r.y)}function jo(){this._=null}function Fo(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function Bo(t,n){var e=n,r=n.R,o=e.U;o?o.L===e?o.L=r:o.R=r:t._=r,r.U=o,e.U=r,e.R=r.L,e.R&&(e.R.U=e),r.L=e}function Io(t,n){var e=n,r=n.L,o=e.U;o?o.L===e?o.L=r:o.R=r:t._=r,r.U=o,e.U=r,e.L=r.R,e.L&&(e.L.U=e),r.R=e}function Xo(t){for(;t.L;)t=t.L;return t}function Yo(t,n){var e,r,o,a=t.sort(Vo).pop();for(mo=[],go=new Array(t.length),vo=new jo,bo=new jo;;)if(o=yo,a&&(!o||a.y<o.y||a.y===o.y&&a.x<o.x))a.x===e&&a.y===r||(go[a.i]=new Ro(a),Ao(a),e=a.x,r=a.y),a=t.pop();else{if(!o)break;So(o.arc)}n&&(function(t){for(var n,e=mo,r=ur(t[0][0],t[0][1],t[1][0],t[1][1]),o=e.length;o--;)(!Lo(n=e[o],t)||!r(n)||w(n.a.x-n.b.x)<Tt&&w(n.a.y-n.b.y)<Tt)&&(n.a=n.b=null,e.splice(o,1))}(n),function(t){for(var n,e,r,o,a,i,u,s,l,c,f=t[0][0],h=t[1][0],p=t[0][1],d=t[1][1],m=go,g=m.length;g--;)if((a=m[g])&&a.prepare())for(s=(u=a.edges).length,i=0;i<s;)r=(c=u[i].end()).x,o=c.y,n=(l=u[++i%s].start()).x,e=l.y,(w(r-n)>Tt||w(o-e)>Tt)&&(u.splice(i,0,new qo((v=a.site,y=c,b=w(r-f)<Tt&&d-o>Tt?{x:f,y:w(n-f)<Tt?e:d}:w(o-d)<Tt&&h-r>Tt?{x:w(e-d)<Tt?n:h,y:d}:w(r-h)<Tt&&o-p>Tt?{x:h,y:w(n-h)<Tt?e:p}:w(o-p)<Tt&&r-f>Tt?{x:w(e-p)<Tt?n:f,y:p}:null,x=void 0,(x=new Uo(v,null)).a=y,x.b=b,mo.push(x),x),a.site,null)),++s);var v,y,b,x}(n));var i={cells:go,edges:mo};return vo=bo=mo=go=null,i}function Vo(t,n){return n.y-t.y||n.x-t.x}Ro.prototype.prepare=function(){for(var t,n=this.edges,e=n.length;e--;)(t=n[e].edge).b&&t.a||n.splice(e,1);return n.sort(No),n.length},qo.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}},jo.prototype={insert:function(t,n){var e,r,o;if(t){if(n.P=t,n.N=t.N,t.N&&(t.N.P=n),t.N=n,t.R){for(t=t.R;t.L;)t=t.L;t.L=n}else t.R=n;e=t}else this._?(t=Xo(this._),n.P=null,n.N=t,t.P=t.L=n,e=t):(n.P=n.N=null,this._=n,e=null);for(n.L=n.R=null,n.U=e,n.C=!0,t=n;e&&e.C;)e===(r=e.U).L?(o=r.R)&&o.C?(e.C=o.C=!1,r.C=!0,t=r):(t===e.R&&(Bo(this,e),e=(t=e).U),e.C=!1,r.C=!0,Io(this,r)):(o=r.L)&&o.C?(e.C=o.C=!1,r.C=!0,t=r):(t===e.L&&(Io(this,e),e=(t=e).U),e.C=!1,r.C=!0,Bo(this,r)),e=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var n,e,r,o=t.U,a=t.L,i=t.R;if(e=a?i?Xo(i):a:i,o?o.L===t?o.L=e:o.R=e:this._=e,a&&i?(r=e.C,e.C=t.C,e.L=a,a.U=e,e!==i?(o=e.U,e.U=t.U,t=e.R,o.L=t,e.R=i,i.U=e):(e.U=o,o=e,t=e.R)):(r=t.C,t=e),t&&(t.U=o),!r)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===o.L){if((n=o.R).C&&(n.C=!1,o.C=!0,Bo(this,o),n=o.R),n.L&&n.L.C||n.R&&n.R.C){n.R&&n.R.C||(n.L.C=!1,n.C=!0,Io(this,n),n=o.R),n.C=o.C,o.C=n.R.C=!1,Bo(this,o),t=this._;break}}else if((n=o.L).C&&(n.C=!1,o.C=!0,Io(this,o),n=o.L),n.L&&n.L.C||n.R&&n.R.C){n.L&&n.L.C||(n.R.C=!1,n.C=!0,Bo(this,n),n=o.L),n.C=o.C,o.C=n.L.C=!1,Io(this,o),t=this._;break}n.C=!0,t=o,o=o.U}while(!t.C);t&&(t.C=!1)}}},a.geom.voronoi=function(t){var n=io,e=uo,r=n,o=e,a=Ho;if(t)return i(t);function i(t){var n=new Array(t.length),e=a[0][0],r=a[0][1],o=a[1][0],i=a[1][1];return Yo(u(t),a).cells.forEach((function(a,u){var s=a.edges,l=a.site;(n[u]=s.length?s.map((function(t){var n=t.start();return[n.x,n.y]})):l.x>=e&&l.x<=o&&l.y>=r&&l.y<=i?[[e,i],[o,i],[o,r],[e,r]]:[]).point=t[u]})),n}function u(t){return t.map((function(t,n){return{x:Math.round(r(t,n)/Tt)*Tt,y:Math.round(o(t,n)/Tt)*Tt,i:n}}))}return i.links=function(t){return Yo(u(t)).edges.filter((function(t){return t.l&&t.r})).map((function(n){return{source:t[n.l.i],target:t[n.r.i]}}))},i.triangles=function(t){var n=[];return Yo(u(t)).cells.forEach((function(e,r){for(var o,a=e.site,i=e.edges.sort(No),u=-1,s=i.length,l=i[s-1].edge,c=l.l===a?l.r:l.l;++u<s;)o=c,c=(l=i[u].edge).l===a?l.r:l.l,r<o.i&&r<c.i&&Go(a,o,c)<0&&n.push([t[r],t[o.i],t[c.i]])})),n},i.x=function(t){return arguments.length?(r=bn(n=t),i):n},i.y=function(t){return arguments.length?(o=bn(e=t),i):e},i.clipExtent=function(t){return arguments.length?(a=null==t?Ho:t,i):a===Ho?null:a},i.size=function(t){return arguments.length?i.clipExtent(t&&[[0,0],t]):a===Ho?null:a&&a[1]},i};var Ho=[[-1e6,-1e6],[1e6,1e6]];function Go(t,n,e){return(t.x-e.x)*(n.y-t.y)-(t.x-n.x)*(e.y-t.y)}function Wo(t){return t.x}function Zo(t){return t.y}function Jo(t,n,e,r,o,a){if(!t(n,e,r,o,a)){var i=.5*(e+o),u=.5*(r+a),s=n.nodes;s[0]&&Jo(t,s[0],e,r,i,u),s[1]&&Jo(t,s[1],i,r,o,u),s[2]&&Jo(t,s[2],e,u,i,a),s[3]&&Jo(t,s[3],i,u,o,a)}}function $o(t,n,e,r,o,a,i){var u,s=1/0;return function t(l,c,f,h,p){if(!(c>a||f>i||h<r||p<o)){if(d=l.point){var d,m=n-l.x,g=e-l.y,v=m*m+g*g;if(v<s){var y=Math.sqrt(s=v);r=n-y,o=e-y,a=n+y,i=e+y,u=d}}for(var b=l.nodes,x=.5*(c+h),M=.5*(f+p),w=(e>=M)<<1|n>=x,_=w+4;w<_;++w)if(l=b[3&w])switch(3&w){case 0:t(l,c,f,x,M);break;case 1:t(l,x,f,h,M);break;case 2:t(l,c,M,x,p);break;case 3:t(l,x,M,h,p)}}}(t,r,o,a,i),u}function Ko(t,n){t=a.rgb(t),n=a.rgb(n);var e=t.r,r=t.g,o=t.b,i=n.r-e,u=n.g-r,s=n.b-o;return function(t){return"#"+hn(Math.round(e+i*t))+hn(Math.round(r+u*t))+hn(Math.round(o+s*t))}}function Qo(t,n){var e,r={},o={};for(e in t)e in n?r[e]=oa(t[e],n[e]):o[e]=t[e];for(e in n)e in t||(o[e]=n[e]);return function(t){for(e in r)o[e]=r[e](t);return o}}function ta(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}function na(t,n){var e,r,o,a=ea.lastIndex=ra.lastIndex=0,i=-1,u=[],s=[];for(t+="",n+="";(e=ea.exec(t))&&(r=ra.exec(n));)(o=r.index)>a&&(o=n.slice(a,o),u[i]?u[i]+=o:u[++i]=o),(e=e[0])===(r=r[0])?u[i]?u[i]+=r:u[++i]=r:(u[++i]=null,s.push({i:i,x:ta(e,r)})),a=ra.lastIndex;return a<n.length&&(o=n.slice(a),u[i]?u[i]+=o:u[++i]=o),u.length<2?s[0]?(n=s[0].x,function(t){return n(t)+""}):function(){return n}:(n=s.length,function(t){for(var e,r=0;r<n;++r)u[(e=s[r]).i]=e.x(t);return u.join("")})}a.geom.delaunay=function(t){return a.geom.voronoi().triangles(t)},a.geom.quadtree=function(t,n,e,r,o){var a,i=io,u=uo;if(a=arguments.length)return i=Wo,u=Zo,3===a&&(o=e,r=n,e=n=0),s(t);function s(t){var s,l,c,f,h,p,d,m,g,v=bn(i),y=bn(u);if(null!=n)p=n,d=e,m=r,g=o;else if(m=g=-(p=d=1/0),l=[],c=[],h=t.length,a)for(f=0;f<h;++f)(s=t[f]).x<p&&(p=s.x),s.y<d&&(d=s.y),s.x>m&&(m=s.x),s.y>g&&(g=s.y),l.push(s.x),c.push(s.y);else for(f=0;f<h;++f){var b=+v(s=t[f],f),x=+y(s,f);b<p&&(p=b),x<d&&(d=x),b>m&&(m=b),x>g&&(g=x),l.push(b),c.push(x)}var M=m-p,_=g-d;function k(t,n,e,r,o,a,i,u){if(!isNaN(e)&&!isNaN(r))if(t.leaf){var s=t.x,l=t.y;if(null!=s)if(w(s-e)+w(l-r)<.01)S(t,n,e,r,o,a,i,u);else{var c=t.point;t.x=t.y=t.point=null,S(t,c,s,l,o,a,i,u),S(t,n,e,r,o,a,i,u)}else t.x=e,t.y=r,t.point=n}else S(t,n,e,r,o,a,i,u)}function S(t,n,e,r,o,a,i,u){var s=.5*(o+i),l=.5*(a+u),c=e>=s,f=r>=l,h=f<<1|c;t.leaf=!1,c?o=s:i=s,f?a=l:u=l,k(t=t.nodes[h]||(t.nodes[h]={leaf:!0,nodes:[],point:null,x:null,y:null}),n,e,r,o,a,i,u)}M>_?g=d+M:m=p+_;var A={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){k(A,t,+v(t,++f),+y(t,f),p,d,m,g)},visit:function(t){Jo(t,A,p,d,m,g)},find:function(t){return $o(A,t[0],t[1],p,d,m,g)}};if(f=-1,null==n){for(;++f<h;)k(A,t[f],l[f],c[f],p,d,m,g);--f}else t.forEach(A.add);return l=c=t=s=null,A}return s.x=function(t){return arguments.length?(i=t,s):i},s.y=function(t){return arguments.length?(u=t,s):u},s.extent=function(t){return arguments.length?(null==t?n=e=r=o=null:(n=+t[0][0],e=+t[0][1],r=+t[1][0],o=+t[1][1]),s):null==n?null:[[n,e],[r,o]]},s.size=function(t){return arguments.length?(null==t?n=e=r=o=null:(n=e=0,r=+t[0],o=+t[1]),s):null==n?null:[r-n,o-e]},s},a.interpolateRgb=Ko,a.interpolateObject=Qo,a.interpolateNumber=ta,a.interpolateString=na;var ea=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ra=new RegExp(ea.source,"g");function oa(t,n){for(var e,r=a.interpolators.length;--r>=0&&!(e=a.interpolators[r](t,n)););return e}function aa(t,n){var e,r=[],o=[],a=t.length,i=n.length,u=Math.min(t.length,n.length);for(e=0;e<u;++e)r.push(oa(t[e],n[e]));for(;e<a;++e)o[e]=t[e];for(;e<i;++e)o[e]=n[e];return function(t){for(e=0;e<u;++e)o[e]=r[e](t);return o}}a.interpolate=oa,a.interpolators=[function(t,n){var e=typeof n;return("string"===e?yn.has(n.toLowerCase())||/^(#|rgb\(|hsl\()/i.test(n)?Ko:na:n instanceof Ht?Ko:Array.isArray(n)?aa:"object"===e&&isNaN(n)?Qo:ta)(t,n)}],a.interpolateArray=aa;var ia=function(){return L},ua=a.map({linear:ia,poly:function(t){return function(n){return Math.pow(n,t)}},quad:function(){return ha},cubic:function(){return pa},sin:function(){return ma},exp:function(){return ga},circle:function(){return va},elastic:function(t,n){var e;return arguments.length<2&&(n=.45),arguments.length?e=n/Pt*Math.asin(1/t):(t=1,e=n/4),function(r){return 1+t*Math.pow(2,-10*r)*Math.sin((r-e)*Pt/n)}},back:function(t){return t||(t=1.70158),function(n){return n*n*((t+1)*n-t)}},bounce:function(){return ya}}),sa=a.map({in:L,out:ca,"in-out":fa,"out-in":function(t){return fa(ca(t))}});function la(t){return function(n){return n<=0?0:n>=1?1:t(n)}}function ca(t){return function(n){return 1-t(1-n)}}function fa(t){return function(n){return.5*(n<.5?t(2*n):2-t(2-2*n))}}function ha(t){return t*t}function pa(t){return t*t*t}function da(t){if(t<=0)return 0;if(t>=1)return 1;var n=t*t,e=n*t;return 4*(t<.5?e:3*(t-n)+e-.75)}function ma(t){return 1-Math.cos(t*Ot)}function ga(t){return Math.pow(2,10*(t-1))}function va(t){return 1-Math.sqrt(1-t*t)}function ya(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function ba(t,n){return n-=t,function(e){return Math.round(t+n*e)}}function xa(t){var n=[t.a,t.b],e=[t.c,t.d],r=wa(n),o=Ma(n,e),a=wa(function(t,n,e){return t[0]+=e*n[0],t[1]+=e*n[1],t}(e,n,-o))||0;n[0]*e[1]<e[0]*n[1]&&(n[0]*=-1,n[1]*=-1,r*=-1,o*=-1),this.rotate=(r?Math.atan2(n[1],n[0]):Math.atan2(-e[0],e[1]))*Ut,this.translate=[t.e,t.f],this.scale=[r,a],this.skew=a?Math.atan2(o,a)*Ut:0}function Ma(t,n){return t[0]*n[0]+t[1]*n[1]}function wa(t){var n=Math.sqrt(Ma(t,t));return n&&(t[0]/=n,t[1]/=n),n}a.ease=function(t){var n=t.indexOf("-"),e=n>=0?t.slice(0,n):t,r=n>=0?t.slice(n+1):"in";return e=ua.get(e)||ia,la((r=sa.get(r)||L)(e.apply(null,i.call(arguments,1))))},a.interpolateHcl=function(t,n){t=a.hcl(t),n=a.hcl(n);var e=t.h,r=t.c,o=t.l,i=n.h-e,u=n.c-r,s=n.l-o;return isNaN(u)&&(u=0,r=isNaN(r)?n.c:r),isNaN(i)?(i=0,e=isNaN(e)?n.h:e):i>180?i-=360:i<-180&&(i+=360),function(t){return Kt(e+i*t,r+u*t,o+s*t)+""}},a.interpolateHsl=function(t,n){t=a.hsl(t),n=a.hsl(n);var e=t.h,r=t.s,o=t.l,i=n.h-e,u=n.s-r,s=n.l-o;return isNaN(u)&&(u=0,r=isNaN(r)?n.s:r),isNaN(i)?(i=0,e=isNaN(e)?n.h:e):i>180?i-=360:i<-180&&(i+=360),function(t){return Zt(e+i*t,r+u*t,o+s*t)+""}},a.interpolateLab=function(t,n){t=a.lab(t),n=a.lab(n);var e=t.l,r=t.a,o=t.b,i=n.l-e,u=n.a-r,s=n.b-o;return function(t){return en(e+i*t,r+u*t,o+s*t)+""}},a.interpolateRound=ba,a.transform=function(t){var n=s.createElementNS(a.ns.prefix.svg,"g");return(a.transform=function(t){if(null!=t){n.setAttribute("transform",t);var e=n.transform.baseVal.consolidate()}return new xa(e?e.matrix:_a)})(t)},xa.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var _a={a:1,b:0,c:0,d:1,e:0,f:0};function ka(t){return t.length?t.pop()+",":""}function Sa(t,n){var e=[],r=[];return t=a.transform(t),n=a.transform(n),function(t,n,e,r){if(t[0]!==n[0]||t[1]!==n[1]){var o=e.push("translate(",null,",",null,")");r.push({i:o-4,x:ta(t[0],n[0])},{i:o-2,x:ta(t[1],n[1])})}else(n[0]||n[1])&&e.push("translate("+n+")")}(t.translate,n.translate,e,r),function(t,n,e,r){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),r.push({i:e.push(ka(e)+"rotate(",null,")")-2,x:ta(t,n)})):n&&e.push(ka(e)+"rotate("+n+")")}(t.rotate,n.rotate,e,r),function(t,n,e,r){t!==n?r.push({i:e.push(ka(e)+"skewX(",null,")")-2,x:ta(t,n)}):n&&e.push(ka(e)+"skewX("+n+")")}(t.skew,n.skew,e,r),function(t,n,e,r){if(t[0]!==n[0]||t[1]!==n[1]){var o=e.push(ka(e)+"scale(",null,",",null,")");r.push({i:o-4,x:ta(t[0],n[0])},{i:o-2,x:ta(t[1],n[1])})}else 1===n[0]&&1===n[1]||e.push(ka(e)+"scale("+n+")")}(t.scale,n.scale,e,r),t=n=null,function(t){for(var n,o=-1,a=r.length;++o<a;)e[(n=r[o]).i]=n.x(t);return e.join("")}}function Aa(t,n){return n=(n-=t=+t)||1/n,function(e){return(e-t)/n}}function Ea(t,n){return n=(n-=t=+t)||1/n,function(e){return Math.max(0,Math.min(1,(e-t)/n))}}function Ta(t){for(var n=t.source,e=t.target,r=function(t,n){if(t===n)return t;for(var e=Ra(t),r=Ra(n),o=e.pop(),a=r.pop(),i=null;o===a;)i=o,o=e.pop(),a=r.pop();return i}(n,e),o=[n];n!==r;)n=n.parent,o.push(n);for(var a=o.length;e!==r;)o.splice(a,0,e),e=e.parent;return o}function Ra(t){for(var n=[],e=t.parent;null!=e;)n.push(t),t=e,e=e.parent;return n.push(t),n}function Na(t){t.fixed|=2}function Pa(t){t.fixed&=-7}function Ca(t){t.fixed|=4,t.px=t.x,t.py=t.y}function Oa(t){t.fixed&=-5}a.interpolateTransform=Sa,a.layout={},a.layout.bundle=function(){return function(t){for(var n=[],e=-1,r=t.length;++e<r;)n.push(Ta(t[e]));return n}},a.layout.chord=function(){var t,n,e,r,o,i,u,s={},l=0;function c(){var s,c,h,p,d,m={},g=[],v=a.range(r),y=[];for(t=[],n=[],s=0,p=-1;++p<r;){for(c=0,d=-1;++d<r;)c+=e[p][d];g.push(c),y.push(a.range(r)),s+=c}for(o&&v.sort((function(t,n){return o(g[t],g[n])})),i&&y.forEach((function(t,n){t.sort((function(t,r){return i(e[n][t],e[n][r])}))})),s=(Pt-l*r)/s,c=0,p=-1;++p<r;){for(h=c,d=-1;++d<r;){var b=v[p],x=y[b][d],M=e[b][x],w=c,_=c+=M*s;m[b+"-"+x]={index:b,subindex:x,startAngle:w,endAngle:_,value:M}}n[b]={index:b,startAngle:h,endAngle:c,value:g[b]},c+=l}for(p=-1;++p<r;)for(d=p-1;++d<r;){var k=m[p+"-"+d],S=m[d+"-"+p];(k.value||S.value)&&t.push(k.value<S.value?{source:S,target:k}:{source:k,target:S})}u&&f()}function f(){t.sort((function(t,n){return u((t.source.value+t.target.value)/2,(n.source.value+n.target.value)/2)}))}return s.matrix=function(o){return arguments.length?(r=(e=o)&&e.length,t=n=null,s):e},s.padding=function(e){return arguments.length?(l=e,t=n=null,s):l},s.sortGroups=function(e){return arguments.length?(o=e,t=n=null,s):o},s.sortSubgroups=function(n){return arguments.length?(i=n,t=null,s):i},s.sortChords=function(n){return arguments.length?(u=n,t&&f(),s):u},s.chords=function(){return t||c(),t},s.groups=function(){return n||c(),n},s},a.layout.force=function(){var t,n,e,r,o,i,u={},s=a.dispatch("start","tick","end"),l=[1,1],c=.9,f=La,h=Ua,p=-30,d=Da,m=.1,g=.64,v=[],y=[];function b(t){return function(n,e,r,o){if(n.point!==t){var a=n.cx-t.x,i=n.cy-t.y,u=o-e,s=a*a+i*i;if(u*u/g<s){if(s<d){var l=n.charge/s;t.px-=a*l,t.py-=i*l}return!0}n.point&&s&&s<d&&(l=n.pointCharge/s,t.px-=a*l,t.py-=i*l)}return!n.charge}}function x(t){t.px=a.event.x,t.py=a.event.y,u.resume()}return u.tick=function(){if((e*=.99)<.005)return t=null,s.end({type:"end",alpha:e=0}),!0;var n,u,f,h,d,g,x,M,w,_=v.length,k=y.length;for(u=0;u<k;++u)h=(f=y[u]).source,(g=(M=(d=f.target).x-h.x)*M+(w=d.y-h.y)*w)&&(M*=g=e*o[u]*((g=Math.sqrt(g))-r[u])/g,w*=g,d.x-=M*(x=h.weight+d.weight?h.weight/(h.weight+d.weight):.5),d.y-=w*x,h.x+=M*(x=1-x),h.y+=w*x);if((x=e*m)&&(M=l[0]/2,w=l[1]/2,u=-1,x))for(;++u<_;)(f=v[u]).x+=(M-f.x)*x,f.y+=(w-f.y)*x;if(p)for(function t(n,e,r){var o=0,a=0;if(n.charge=0,!n.leaf)for(var i,u=n.nodes,s=u.length,l=-1;++l<s;)null!=(i=u[l])&&(t(i,e,r),n.charge+=i.charge,o+=i.charge*i.cx,a+=i.charge*i.cy);if(n.point){n.leaf||(n.point.x+=Math.random()-.5,n.point.y+=Math.random()-.5);var c=e*r[n.point.index];n.charge+=n.pointCharge=c,o+=c*n.point.x,a+=c*n.point.y}n.cx=o/n.charge,n.cy=a/n.charge}(n=a.geom.quadtree(v),e,i),u=-1;++u<_;)(f=v[u]).fixed||n.visit(b(f));for(u=-1;++u<_;)(f=v[u]).fixed?(f.x=f.px,f.y=f.py):(f.x-=(f.px-(f.px=f.x))*c,f.y-=(f.py-(f.py=f.y))*c);s.tick({type:"tick",alpha:e})},u.nodes=function(t){return arguments.length?(v=t,u):v},u.links=function(t){return arguments.length?(y=t,u):y},u.size=function(t){return arguments.length?(l=t,u):l},u.linkDistance=function(t){return arguments.length?(f="function"==typeof t?t:+t,u):f},u.distance=u.linkDistance,u.linkStrength=function(t){return arguments.length?(h="function"==typeof t?t:+t,u):h},u.friction=function(t){return arguments.length?(c=+t,u):c},u.charge=function(t){return arguments.length?(p="function"==typeof t?t:+t,u):p},u.chargeDistance=function(t){return arguments.length?(d=t*t,u):Math.sqrt(d)},u.gravity=function(t){return arguments.length?(m=+t,u):m},u.theta=function(t){return arguments.length?(g=t*t,u):Math.sqrt(g)},u.alpha=function(n){return arguments.length?(n=+n,e?n>0?e=n:(t.c=null,t.t=NaN,t=null,s.end({type:"end",alpha:e=0})):n>0&&(s.start({type:"start",alpha:e=n}),t=En(u.tick)),u):e},u.start=function(){var t,n,e,a=v.length,s=y.length,c=l[0],d=l[1];for(t=0;t<a;++t)(e=v[t]).index=t,e.weight=0;for(t=0;t<s;++t)"number"==typeof(e=y[t]).source&&(e.source=v[e.source]),"number"==typeof e.target&&(e.target=v[e.target]),++e.source.weight,++e.target.weight;for(t=0;t<a;++t)e=v[t],isNaN(e.x)&&(e.x=m("x",c)),isNaN(e.y)&&(e.y=m("y",d)),isNaN(e.px)&&(e.px=e.x),isNaN(e.py)&&(e.py=e.y);if(r=[],"function"==typeof f)for(t=0;t<s;++t)r[t]=+f.call(this,y[t],t);else for(t=0;t<s;++t)r[t]=f;if(o=[],"function"==typeof h)for(t=0;t<s;++t)o[t]=+h.call(this,y[t],t);else for(t=0;t<s;++t)o[t]=h;if(i=[],"function"==typeof p)for(t=0;t<a;++t)i[t]=+p.call(this,v[t],t);else for(t=0;t<a;++t)i[t]=p;function m(e,r){if(!n){for(n=new Array(a),l=0;l<a;++l)n[l]=[];for(l=0;l<s;++l){var o=y[l];n[o.source.index].push(o.target),n[o.target.index].push(o.source)}}for(var i,u=n[t],l=-1,c=u.length;++l<c;)if(!isNaN(i=u[l][e]))return i;return Math.random()*r}return u.resume()},u.resume=function(){return u.alpha(.1)},u.stop=function(){return u.alpha(0)},u.drag=function(){if(n||(n=a.behavior.drag().origin(L).on("dragstart.force",Na).on("drag.force",x).on("dragend.force",Pa)),!arguments.length)return n;this.on("mouseover.force",Ca).on("mouseout.force",Oa).call(n)},a.rebind(u,s,"on")};var La=20,Ua=1,Da=1/0;function za(t,n){return a.rebind(t,n,"sort","children","value"),t.nodes=t,t.links=Xa,t}function qa(t,n){for(var e=[t];null!=(t=e.pop());)if(n(t),(o=t.children)&&(r=o.length))for(var r,o;--r>=0;)e.push(o[r])}function ja(t,n){for(var e=[t],r=[];null!=(t=e.pop());)if(r.push(t),(a=t.children)&&(o=a.length))for(var o,a,i=-1;++i<o;)e.push(a[i]);for(;null!=(t=r.pop());)n(t)}function Fa(t){return t.children}function Ba(t){return t.value}function Ia(t,n){return n.value-t.value}function Xa(t){return a.merge(t.map((function(t){return(t.children||[]).map((function(n){return{source:t,target:n}}))})))}a.layout.hierarchy=function(){var t=Ia,n=Fa,e=Ba;function r(o){var a,i=[o],u=[];for(o.depth=0;null!=(a=i.pop());)if(u.push(a),(l=n.call(r,a,a.depth))&&(s=l.length)){for(var s,l,c;--s>=0;)i.push(c=l[s]),c.parent=a,c.depth=a.depth+1;e&&(a.value=0),a.children=l}else e&&(a.value=+e.call(r,a,a.depth)||0),delete a.children;return ja(o,(function(n){var r,o;t&&(r=n.children)&&r.sort(t),e&&(o=n.parent)&&(o.value+=n.value)})),u}return r.sort=function(n){return arguments.length?(t=n,r):t},r.children=function(t){return arguments.length?(n=t,r):n},r.value=function(t){return arguments.length?(e=t,r):e},r.revalue=function(t){return e&&(qa(t,(function(t){t.children&&(t.value=0)})),ja(t,(function(t){var n;t.children||(t.value=+e.call(r,t,t.depth)||0),(n=t.parent)&&(n.value+=t.value)}))),t},r},a.layout.partition=function(){var t=a.layout.hierarchy(),n=[1,1];function e(e,r){var o=t.call(this,e,r);return function t(n,e,r,o){var a=n.children;if(n.x=e,n.y=n.depth*o,n.dx=r,n.dy=o,a&&(i=a.length)){var i,u,s,l=-1;for(r=n.value?r/n.value:0;++l<i;)t(u=a[l],e,s=u.value*r,o),e+=s}}(o[0],0,n[0],n[1]/function t(n){var e=n.children,r=0;if(e&&(o=e.length))for(var o,a=-1;++a<o;)r=Math.max(r,t(e[a]));return 1+r}(o[0])),o}return e.size=function(t){return arguments.length?(n=t,e):n},za(e,t)},a.layout.pie=function(){var t=Number,n=Ya,e=0,r=Pt,o=0;function i(u){var s,l=u.length,c=u.map((function(n,e){return+t.call(i,n,e)})),f=+("function"==typeof e?e.apply(this,arguments):e),h=("function"==typeof r?r.apply(this,arguments):r)-f,p=Math.min(Math.abs(h)/l,+("function"==typeof o?o.apply(this,arguments):o)),d=p*(h<0?-1:1),m=a.sum(c),g=m?(h-l*d)/m:0,v=a.range(l),y=[];return null!=n&&v.sort(n===Ya?function(t,n){return c[n]-c[t]}:function(t,e){return n(u[t],u[e])}),v.forEach((function(t){y[t]={data:u[t],value:s=c[t],startAngle:f,endAngle:f+=s*g+d,padAngle:p}})),y}return i.value=function(n){return arguments.length?(t=n,i):t},i.sort=function(t){return arguments.length?(n=t,i):n},i.startAngle=function(t){return arguments.length?(e=t,i):e},i.endAngle=function(t){return arguments.length?(r=t,i):r},i.padAngle=function(t){return arguments.length?(o=t,i):o},i};var Ya={};function Va(t){return t.x}function Ha(t){return t.y}function Ga(t,n,e){t.y0=n,t.y=e}a.layout.stack=function(){var t=L,n=Ja,e=$a,r=Ga,o=Va,i=Ha;function u(s,l){if(!(p=s.length))return s;var c=s.map((function(n,e){return t.call(u,n,e)})),f=c.map((function(t){return t.map((function(t,n){return[o.call(u,t,n),i.call(u,t,n)]}))})),h=n.call(u,f,l);c=a.permute(c,h),f=a.permute(f,h);var p,d,m,g,v=e.call(u,f,l),y=c[0].length;for(m=0;m<y;++m)for(r.call(u,c[0][m],g=v[m],f[0][m][1]),d=1;d<p;++d)r.call(u,c[d][m],g+=f[d-1][m][1],f[d][m][1]);return s}return u.values=function(n){return arguments.length?(t=n,u):t},u.order=function(t){return arguments.length?(n="function"==typeof t?t:Wa.get(t)||Ja,u):n},u.offset=function(t){return arguments.length?(e="function"==typeof t?t:Za.get(t)||$a,u):e},u.x=function(t){return arguments.length?(o=t,u):o},u.y=function(t){return arguments.length?(i=t,u):i},u.out=function(t){return arguments.length?(r=t,u):r},u};var Wa=a.map({"inside-out":function(t){var n,e,r=t.length,o=t.map(Ka),i=t.map(Qa),u=a.range(r).sort((function(t,n){return o[t]-o[n]})),s=0,l=0,c=[],f=[];for(n=0;n<r;++n)e=u[n],s<l?(s+=i[e],c.push(e)):(l+=i[e],f.push(e));return f.reverse().concat(c)},reverse:function(t){return a.range(t.length).reverse()},default:Ja}),Za=a.map({silhouette:function(t){var n,e,r,o=t.length,a=t[0].length,i=[],u=0,s=[];for(e=0;e<a;++e){for(n=0,r=0;n<o;n++)r+=t[n][e][1];r>u&&(u=r),i.push(r)}for(e=0;e<a;++e)s[e]=(u-i[e])/2;return s},wiggle:function(t){var n,e,r,o,a,i,u,s,l,c=t.length,f=t[0],h=f.length,p=[];for(p[0]=s=l=0,e=1;e<h;++e){for(n=0,o=0;n<c;++n)o+=t[n][e][1];for(n=0,a=0,u=f[e][0]-f[e-1][0];n<c;++n){for(r=0,i=(t[n][e][1]-t[n][e-1][1])/(2*u);r<n;++r)i+=(t[r][e][1]-t[r][e-1][1])/u;a+=i*t[n][e][1]}p[e]=s-=o?a/o*u:0,s<l&&(l=s)}for(e=0;e<h;++e)p[e]-=l;return p},expand:function(t){var n,e,r,o=t.length,a=t[0].length,i=1/o,u=[];for(e=0;e<a;++e){for(n=0,r=0;n<o;n++)r+=t[n][e][1];if(r)for(n=0;n<o;n++)t[n][e][1]/=r;else for(n=0;n<o;n++)t[n][e][1]=i}for(e=0;e<a;++e)u[e]=0;return u},zero:$a});function Ja(t){return a.range(t.length)}function $a(t){for(var n=-1,e=t[0].length,r=[];++n<e;)r[n]=0;return r}function Ka(t){for(var n,e=1,r=0,o=t[0][1],a=t.length;e<a;++e)(n=t[e][1])>o&&(r=e,o=n);return r}function Qa(t){return t.reduce(ti,0)}function ti(t,n){return t+n[1]}function ni(t,n){return ei(t,Math.ceil(Math.log(n.length)/Math.LN2+1))}function ei(t,n){for(var e=-1,r=+t[0],o=(t[1]-r)/n,a=[];++e<=n;)a[e]=o*e+r;return a}function ri(t){return[a.min(t),a.max(t)]}function oi(t,n){return t.value-n.value}function ai(t,n){var e=t._pack_next;t._pack_next=n,n._pack_prev=t,n._pack_next=e,e._pack_prev=n}function ii(t,n){t._pack_next=n,n._pack_prev=t}function ui(t,n){var e=n.x-t.x,r=n.y-t.y,o=t.r+n.r;return.999*o*o>e*e+r*r}function si(t){if((n=t.children)&&(s=n.length)){var n,e,r,o,a,i,u,s,l=1/0,c=-1/0,f=1/0,h=-1/0;if(n.forEach(li),(e=n[0]).x=-e.r,e.y=0,b(e),s>1&&((r=n[1]).x=r.r,r.y=0,b(r),s>2))for(fi(e,r,o=n[2]),b(o),ai(e,o),e._pack_prev=o,ai(o,r),r=e._pack_next,a=3;a<s;a++){fi(e,r,o=n[a]);var p=0,d=1,m=1;for(i=r._pack_next;i!==r;i=i._pack_next,d++)if(ui(i,o)){p=1;break}if(1==p)for(u=e._pack_prev;u!==i._pack_prev&&!ui(u,o);u=u._pack_prev,m++);p?(d<m||d==m&&r.r<e.r?ii(e,r=i):ii(e=u,r),a--):(ai(e,o),r=o,b(o))}var g=(l+c)/2,v=(f+h)/2,y=0;for(a=0;a<s;a++)(o=n[a]).x-=g,o.y-=v,y=Math.max(y,o.r+Math.sqrt(o.x*o.x+o.y*o.y));t.r=y,n.forEach(ci)}function b(t){l=Math.min(t.x-t.r,l),c=Math.max(t.x+t.r,c),f=Math.min(t.y-t.r,f),h=Math.max(t.y+t.r,h)}}function li(t){t._pack_next=t._pack_prev=t}function ci(t){delete t._pack_next,delete t._pack_prev}function fi(t,n,e){var r=t.r+e.r,o=n.x-t.x,a=n.y-t.y;if(r&&(o||a)){var i=n.r+e.r,u=o*o+a*a,s=.5+((r*=r)-(i*=i))/(2*u),l=Math.sqrt(Math.max(0,2*i*(r+u)-(r-=u)*r-i*i))/(2*u);e.x=t.x+s*o+l*a,e.y=t.y+s*a-l*o}else e.x=t.x+r,e.y=t.y}function hi(t,n){return t.parent==n.parent?1:2}function pi(t){var n=t.children;return n.length?n[0]:t.t}function di(t){var n,e=t.children;return(n=e.length)?e[n-1]:t.t}function mi(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function gi(t,n,e){return t.a.parent===n.parent?t.a:e}function vi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function yi(t,n){var e=t.x+n[3],r=t.y+n[0],o=t.dx-n[1]-n[3],a=t.dy-n[0]-n[2];return o<0&&(e+=o/2,o=0),a<0&&(r+=a/2,a=0),{x:e,y:r,dx:o,dy:a}}function bi(t){var n=t[0],e=t[t.length-1];return n<e?[n,e]:[e,n]}function xi(t){return t.rangeExtent?t.rangeExtent():bi(t.range())}function Mi(t,n,e,r){var o=e(t[0],t[1]),a=r(n[0],n[1]);return function(t){return a(o(t))}}function wi(t,n){var e,r=0,o=t.length-1,a=t[r],i=t[o];return i<a&&(e=r,r=o,o=e,e=a,a=i,i=e),t[r]=n.floor(a),t[o]=n.ceil(i),t}function _i(t){return t?{floor:function(n){return Math.floor(n/t)*t},ceil:function(n){return Math.ceil(n/t)*t}}:ki}a.layout.histogram=function(){var t=!0,n=Number,e=ri,r=ni;function o(o,i){for(var u,s,l=[],c=o.map(n,this),f=e.call(this,c,i),h=r.call(this,f,c,i),p=(i=-1,c.length),d=h.length-1,m=t?1:1/p;++i<d;)(u=l[i]=[]).dx=h[i+1]-(u.x=h[i]),u.y=0;if(d>0)for(i=-1;++i<p;)(s=c[i])>=f[0]&&s<=f[1]&&((u=l[a.bisect(h,s,1,d)-1]).y+=m,u.push(o[i]));return l}return o.value=function(t){return arguments.length?(n=t,o):n},o.range=function(t){return arguments.length?(e=bn(t),o):e},o.bins=function(t){return arguments.length?(r="number"==typeof t?function(n){return ei(n,t)}:bn(t),o):r},o.frequency=function(n){return arguments.length?(t=!!n,o):t},o},a.layout.pack=function(){var t,n=a.layout.hierarchy().sort(oi),e=0,r=[1,1];function o(o,a){var i=n.call(this,o,a),u=i[0],s=r[0],l=r[1],c=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(u.x=u.y=0,ja(u,(function(t){t.r=+c(t.value)})),ja(u,si),e){var f=e*(t?1:Math.max(2*u.r/s,2*u.r/l))/2;ja(u,(function(t){t.r+=f})),ja(u,si),ja(u,(function(t){t.r-=f}))}return function t(n,e,r,o){var a=n.children;if(n.x=e+=o*n.x,n.y=r+=o*n.y,n.r*=o,a)for(var i=-1,u=a.length;++i<u;)t(a[i],e,r,o)}(u,s/2,l/2,t?1:1/Math.max(2*u.r/s,2*u.r/l)),i}return o.size=function(t){return arguments.length?(r=t,o):r},o.radius=function(n){return arguments.length?(t=null==n||"function"==typeof n?n:+n,o):t},o.padding=function(t){return arguments.length?(e=+t,o):e},za(o,n)},a.layout.tree=function(){var t=a.layout.hierarchy().sort(null).value(null),n=hi,e=[1,1],r=null;function o(o,a){var l=t.call(this,o,a),c=l[0],f=function(t){for(var n,e={A:null,children:[t]},r=[e];null!=(n=r.pop());)for(var o,a=n.children,i=0,u=a.length;i<u;++i)r.push((a[i]=o={_:a[i],parent:n,children:(o=a[i].children)&&o.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:i}).a=o);return e.children[0]}(c);if(ja(f,i),f.parent.m=-f.z,qa(f,u),r)qa(c,s);else{var h=c,p=c,d=c;qa(c,(function(t){t.x<h.x&&(h=t),t.x>p.x&&(p=t),t.depth>d.depth&&(d=t)}));var m=n(h,p)/2-h.x,g=e[0]/(p.x+n(p,h)/2+m),v=e[1]/(d.depth||1);qa(c,(function(t){t.x=(t.x+m)*g,t.y=t.depth*v}))}return l}function i(t){var e=t.children,r=t.parent.children,o=t.i?r[t.i-1]:null;if(e.length){!function(t){for(var n,e=0,r=0,o=t.children,a=o.length;--a>=0;)(n=o[a]).z+=e,n.m+=e,e+=n.s+(r+=n.c)}(t);var a=(e[0].z+e[e.length-1].z)/2;o?(t.z=o.z+n(t._,o._),t.m=t.z-a):t.z=a}else o&&(t.z=o.z+n(t._,o._));t.parent.A=function(t,e,r){if(e){for(var o,a=t,i=t,u=e,s=a.parent.children[0],l=a.m,c=i.m,f=u.m,h=s.m;u=di(u),a=pi(a),u&&a;)s=pi(s),(i=di(i)).a=t,(o=u.z+f-a.z-l+n(u._,a._))>0&&(mi(gi(u,t,r),t,o),l+=o,c+=o),f+=u.m,l+=a.m,h+=s.m,c+=i.m;u&&!di(i)&&(i.t=u,i.m+=f-c),a&&!pi(s)&&(s.t=a,s.m+=l-h,r=t)}return r}(t,o,t.parent.A||r[0])}function u(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=e[0],t.y=t.depth*e[1]}return o.separation=function(t){return arguments.length?(n=t,o):n},o.size=function(t){return arguments.length?(r=null==(e=t)?s:null,o):r?null:e},o.nodeSize=function(t){return arguments.length?(r=null==(e=t)?null:s,o):r?e:null},za(o,t)},a.layout.cluster=function(){var t=a.layout.hierarchy().sort(null).value(null),n=hi,e=[1,1],r=!1;function o(o,i){var u,s=t.call(this,o,i),l=s[0],c=0;ja(l,(function(t){var e=t.children;e&&e.length?(t.x=function(t){return t.reduce((function(t,n){return t+n.x}),0)/t.length}(e),t.y=function(t){return 1+a.max(t,(function(t){return t.y}))}(e)):(t.x=u?c+=n(t,u):0,t.y=0,u=t)}));var f=function t(n){var e=n.children;return e&&e.length?t(e[0]):n}(l),h=function t(n){var e,r=n.children;return r&&(e=r.length)?t(r[e-1]):n}(l),p=f.x-n(f,h)/2,d=h.x+n(h,f)/2;return ja(l,r?function(t){t.x=(t.x-l.x)*e[0],t.y=(l.y-t.y)*e[1]}:function(t){t.x=(t.x-p)/(d-p)*e[0],t.y=(1-(l.y?t.y/l.y:1))*e[1]}),s}return o.separation=function(t){return arguments.length?(n=t,o):n},o.size=function(t){return arguments.length?(r=null==(e=t),o):r?null:e},o.nodeSize=function(t){return arguments.length?(r=null!=(e=t),o):r?e:null},za(o,t)},a.layout.treemap=function(){var t,n=a.layout.hierarchy(),e=Math.round,r=[1,1],o=null,i=vi,u=!1,s="squarify",l=.5*(1+Math.sqrt(5));function c(t,n){for(var e,r,o=-1,a=t.length;++o<a;)r=(e=t[o]).value*(n<0?0:n),e.area=isNaN(r)||r<=0?0:r}function f(t){var n=t.children;if(n&&n.length){var e,r,o,a=i(t),u=[],l=n.slice(),h=1/0,m="slice"===s?a.dx:"dice"===s?a.dy:"slice-dice"===s?1&t.depth?a.dy:a.dx:Math.min(a.dx,a.dy);for(c(l,a.dx*a.dy/t.value),u.area=0;(o=l.length)>0;)u.push(e=l[o-1]),u.area+=e.area,"squarify"!==s||(r=p(u,m))<=h?(l.pop(),h=r):(u.area-=u.pop().area,d(u,m,a,!1),m=Math.min(a.dx,a.dy),u.length=u.area=0,h=1/0);u.length&&(d(u,m,a,!0),u.length=u.area=0),n.forEach(f)}}function h(t){var n=t.children;if(n&&n.length){var e,r=i(t),o=n.slice(),a=[];for(c(o,r.dx*r.dy/t.value),a.area=0;e=o.pop();)a.push(e),a.area+=e.area,null!=e.z&&(d(a,e.z?r.dx:r.dy,r,!o.length),a.length=a.area=0);n.forEach(h)}}function p(t,n){for(var e,r=t.area,o=0,a=1/0,i=-1,u=t.length;++i<u;)(e=t[i].area)&&(e<a&&(a=e),e>o&&(o=e));return n*=n,(r*=r)?Math.max(n*o*l/r,r/(n*a*l)):1/0}function d(t,n,r,o){var a,i=-1,u=t.length,s=r.x,l=r.y,c=n?e(t.area/n):0;if(n==r.dx){for((o||c>r.dy)&&(c=r.dy);++i<u;)(a=t[i]).x=s,a.y=l,a.dy=c,s+=a.dx=Math.min(r.x+r.dx-s,c?e(a.area/c):0);a.z=!0,a.dx+=r.x+r.dx-s,r.y+=c,r.dy-=c}else{for((o||c>r.dx)&&(c=r.dx);++i<u;)(a=t[i]).x=s,a.y=l,a.dx=c,l+=a.dy=Math.min(r.y+r.dy-l,c?e(a.area/c):0);a.z=!1,a.dy+=r.y+r.dy-l,r.x+=c,r.dx-=c}}function m(e){var o=t||n(e),a=o[0];return a.x=a.y=0,a.value?(a.dx=r[0],a.dy=r[1]):a.dx=a.dy=0,t&&n.revalue(a),c([a],a.dx*a.dy/a.value),(t?h:f)(a),u&&(t=o),o}return m.size=function(t){return arguments.length?(r=t,m):r},m.padding=function(t){if(!arguments.length)return o;function n(n){var e=t.call(m,n,n.depth);return null==e?vi(n):yi(n,"number"==typeof e?[e,e,e,e]:e)}function e(n){return yi(n,t)}var r;return i=null==(o=t)?vi:"function"==(r=typeof t)?n:"number"===r?(t=[t,t,t,t],e):e,m},m.round=function(t){return arguments.length?(e=t?Math.round:Number,m):e!=Number},m.sticky=function(n){return arguments.length?(u=n,t=null,m):u},m.ratio=function(t){return arguments.length?(l=t,m):l},m.mode=function(t){return arguments.length?(s=t+"",m):s},za(m,n)},a.random={normal:function(t,n){var e=arguments.length;return e<2&&(n=1),e<1&&(t=0),function(){var e,r,o;do{o=(e=2*Math.random()-1)*e+(r=2*Math.random()-1)*r}while(!o||o>1);return t+n*e*Math.sqrt(-2*Math.log(o)/o)}},logNormal:function(){var t=a.random.normal.apply(a,arguments);return function(){return Math.exp(t())}},bates:function(t){var n=a.random.irwinHall(t);return function(){return n()/t}},irwinHall:function(t){return function(){for(var n=0,e=0;e<t;e++)n+=Math.random();return n}}},a.scale={};var ki={floor:L,ceil:L};function Si(t,n,e,r){var o=[],i=[],u=0,s=Math.min(t.length,n.length)-1;for(t[s]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++u<=s;)o.push(e(t[u-1],t[u])),i.push(r(n[u-1],n[u]));return function(n){var e=a.bisect(t,n,1,s)-1;return i[e](o[e](n))}}function Ai(t,n){return a.rebind(t,n,"range","rangeRound","interpolate","clamp")}function Ei(t,n){return wi(t,_i(Ti(t,n)[2])),wi(t,_i(Ti(t,n)[2])),t}function Ti(t,n){null==n&&(n=10);var e=bi(t),r=e[1]-e[0],o=Math.pow(10,Math.floor(Math.log(r/n)/Math.LN10)),a=n/r*o;return a<=.15?o*=10:a<=.35?o*=5:a<=.75&&(o*=2),e[0]=Math.ceil(e[0]/o)*o,e[1]=Math.floor(e[1]/o)*o+.5*o,e[2]=o,e}function Ri(t,n){return a.range.apply(a,Ti(t,n))}function Ni(t,n,e){var r=Ti(t,n);if(e){var o=Ln.exec(e);if(o.shift(),"s"===o[8]){var i=a.formatPrefix(Math.max(w(r[0]),w(r[1])));return o[7]||(o[7]="."+Ci(i.scale(r[2]))),o[8]="f",e=a.format(o.join("")),function(t){return e(i.scale(t))+i.symbol}}o[7]||(o[7]="."+function(t,n){var e=Ci(n[2]);return t in Pi?Math.abs(e-Ci(Math.max(w(n[0]),w(n[1]))))+ +("e"!==t):e-2*("%"===t)}(o[8],r)),e=o.join("")}else e=",."+Ci(r[2])+"f";return a.format(e)}a.scale.linear=function(){return function t(n,e,r,o){var a,i;function u(){var t=Math.min(n.length,e.length)>2?Si:Mi,u=o?Ea:Aa;return a=t(n,e,u,r),i=t(e,n,u,oa),s}function s(t){return a(t)}return s.invert=function(t){return i(t)},s.domain=function(t){return arguments.length?(n=t.map(Number),u()):n},s.range=function(t){return arguments.length?(e=t,u()):e},s.rangeRound=function(t){return s.range(t).interpolate(ba)},s.clamp=function(t){return arguments.length?(o=t,u()):o},s.interpolate=function(t){return arguments.length?(r=t,u()):r},s.ticks=function(t){return Ri(n,t)},s.tickFormat=function(t,e){return Ni(n,t,e)},s.nice=function(t){return Ei(n,t),u()},s.copy=function(){return t(n,e,r,o)},u()}([0,1],[0,1],oa,!1)};var Pi={s:1,g:1,p:1,r:1,e:1};function Ci(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}a.scale.log=function(){return function t(n,e,r,o){function i(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function u(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function s(t){return n(i(t))}return s.invert=function(t){return u(n.invert(t))},s.domain=function(t){return arguments.length?(r=t[0]>=0,n.domain((o=t.map(Number)).map(i)),s):o},s.base=function(t){return arguments.length?(e=+t,n.domain(o.map(i)),s):e},s.nice=function(){var t=wi(o.map(i),r?Math:Li);return n.domain(t),o=t.map(u),s},s.ticks=function(){var t=bi(o),n=[],a=t[0],s=t[1],l=Math.floor(i(a)),c=Math.ceil(i(s)),f=e%1?2:e;if(isFinite(c-l)){if(r){for(;l<c;l++)for(var h=1;h<f;h++)n.push(u(l)*h);n.push(u(l))}else for(n.push(u(l));l++<c;)for(h=f-1;h>0;h--)n.push(u(l)*h);for(l=0;n[l]<a;l++);for(c=n.length;n[c-1]>s;c--);n=n.slice(l,c)}return n},s.tickFormat=function(t,n){if(!arguments.length)return Oi;arguments.length<2?n=Oi:"function"!=typeof n&&(n=a.format(n));var r=Math.max(1,e*t/s.ticks().length);return function(t){var o=t/u(Math.round(i(t)));return o*e<e-.5&&(o*=e),o<=r?n(t):""}},s.copy=function(){return t(n.copy(),e,r,o)},Ai(s,n)}(a.scale.linear().domain([0,1]),10,!0,[1,10])};var Oi=a.format(".0e"),Li={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};function Ui(t){return function(n){return n<0?-Math.pow(-n,t):Math.pow(n,t)}}a.scale.pow=function(){return function t(n,e,r){var o=Ui(e),a=Ui(1/e);function i(t){return n(o(t))}return i.invert=function(t){return a(n.invert(t))},i.domain=function(t){return arguments.length?(n.domain((r=t.map(Number)).map(o)),i):r},i.ticks=function(t){return Ri(r,t)},i.tickFormat=function(t,n){return Ni(r,t,n)},i.nice=function(t){return i.domain(Ei(r,t))},i.exponent=function(t){return arguments.length?(o=Ui(e=t),a=Ui(1/e),n.domain(r.map(o)),i):e},i.copy=function(){return t(n.copy(),e,r)},Ai(i,n)}(a.scale.linear(),1,[0,1])},a.scale.sqrt=function(){return a.scale.pow().exponent(.5)},a.scale.ordinal=function(){return function t(n,e){var r,o,i;function u(t){return o[((r.get(t)||("range"===e.t?r.set(t,n.push(t)):NaN))-1)%o.length]}function s(t,e){return a.range(n.length).map((function(n){return t+e*n}))}return u.domain=function(t){if(!arguments.length)return n;n=[],r=new S;for(var o,a=-1,i=t.length;++a<i;)r.has(o=t[a])||r.set(o,n.push(o));return u[e.t].apply(u,e.a)},u.range=function(t){return arguments.length?(o=t,i=0,e={t:"range",a:arguments},u):o},u.rangePoints=function(t,r){arguments.length<2&&(r=0);var a=t[0],l=t[1],c=n.length<2?(a=(a+l)/2,0):(l-a)/(n.length-1+r);return o=s(a+c*r/2,c),i=0,e={t:"rangePoints",a:arguments},u},u.rangeRoundPoints=function(t,r){arguments.length<2&&(r=0);var a=t[0],l=t[1],c=n.length<2?(a=l=Math.round((a+l)/2),0):(l-a)/(n.length-1+r)|0;return o=s(a+Math.round(c*r/2+(l-a-(n.length-1+r)*c)/2),c),i=0,e={t:"rangeRoundPoints",a:arguments},u},u.rangeBands=function(t,r,a){arguments.length<2&&(r=0),arguments.length<3&&(a=r);var l=t[1]<t[0],c=t[l-0],f=t[1-l],h=(f-c)/(n.length-r+2*a);return o=s(c+h*a,h),l&&o.reverse(),i=h*(1-r),e={t:"rangeBands",a:arguments},u},u.rangeRoundBands=function(t,r,a){arguments.length<2&&(r=0),arguments.length<3&&(a=r);var l=t[1]<t[0],c=t[l-0],f=t[1-l],h=Math.floor((f-c)/(n.length-r+2*a));return o=s(c+Math.round((f-c-(n.length-r)*h)/2),h),l&&o.reverse(),i=Math.round(h*(1-r)),e={t:"rangeRoundBands",a:arguments},u},u.rangeBand=function(){return i},u.rangeExtent=function(){return bi(e.a[0])},u.copy=function(){return t(n,e)},u.domain(n)}([],{t:"range",a:[[]]})},a.scale.category10=function(){return a.scale.ordinal().range(Di)},a.scale.category20=function(){return a.scale.ordinal().range(zi)},a.scale.category20b=function(){return a.scale.ordinal().range(qi)},a.scale.category20c=function(){return a.scale.ordinal().range(ji)};var Di=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(cn),zi=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(cn),qi=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(cn),ji=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(cn);function Fi(){return 0}a.scale.quantile=function(){return function t(n,e){var r;function o(){var t=0,o=e.length;for(r=[];++t<o;)r[t-1]=a.quantile(n,t/o);return i}function i(t){if(!isNaN(t=+t))return e[a.bisect(r,t)]}return i.domain=function(t){return arguments.length?(n=t.map(v).filter(y).sort(g),o()):n},i.range=function(t){return arguments.length?(e=t,o()):e},i.quantiles=function(){return r},i.invertExtent=function(t){return(t=e.indexOf(t))<0?[NaN,NaN]:[t>0?r[t-1]:n[0],t<r.length?r[t]:n[n.length-1]]},i.copy=function(){return t(n,e)},o()}([],[])},a.scale.quantize=function(){return function t(n,e,r){var o,a;function i(t){return r[Math.max(0,Math.min(a,Math.floor(o*(t-n))))]}function u(){return o=r.length/(e-n),a=r.length-1,i}return i.domain=function(t){return arguments.length?(n=+t[0],e=+t[t.length-1],u()):[n,e]},i.range=function(t){return arguments.length?(r=t,u()):r},i.invertExtent=function(t){return[t=(t=r.indexOf(t))<0?NaN:t/o+n,t+1/o]},i.copy=function(){return t(n,e,r)},u()}(0,1,[0,1])},a.scale.threshold=function(){return function t(n,e){function r(t){if(t<=t)return e[a.bisect(n,t)]}return r.domain=function(t){return arguments.length?(n=t,r):n},r.range=function(t){return arguments.length?(e=t,r):e},r.invertExtent=function(t){return t=e.indexOf(t),[n[t-1],n[t]]},r.copy=function(){return t(n,e)},r}([.5],[0,1])},a.scale.identity=function(){return function t(n){function e(t){return+t}return e.invert=e,e.domain=e.range=function(t){return arguments.length?(n=t.map(e),e):n},e.ticks=function(t){return Ri(n,t)},e.tickFormat=function(t,e){return Ni(n,t,e)},e.copy=function(){return t(n)},e}([0,1])},a.svg={},a.svg.arc=function(){var t=Ii,n=Xi,e=Fi,r=Bi,o=Yi,a=Vi,i=Hi;function u(){var u=Math.max(0,+t.apply(this,arguments)),l=Math.max(0,+n.apply(this,arguments)),c=o.apply(this,arguments)-Ot,f=a.apply(this,arguments)-Ot,h=Math.abs(f-c),p=c>f?0:1;if(l<u&&(d=l,l=u,u=d),h>=Ct)return s(l,p)+(u?s(u,1-p):"")+"Z";var d,m,g,v,y,b,x,M,w,_,k,S,A=0,E=0,T=[];if((v=(+i.apply(this,arguments)||0)/2)&&(g=r===Bi?Math.sqrt(u*u+l*l):+r.apply(this,arguments),p||(E*=-1),l&&(E=jt(g/l*Math.sin(v))),u&&(A=jt(g/u*Math.sin(v)))),l){y=l*Math.cos(c+E),b=l*Math.sin(c+E),x=l*Math.cos(f-E),M=l*Math.sin(f-E);var R=Math.abs(f-c-2*E)<=Nt?0:1;if(E&&Gi(y,b,x,M)===p^R){var N=(c+f)/2;y=l*Math.cos(N),b=l*Math.sin(N),x=M=null}}else y=b=0;if(u){w=u*Math.cos(f-A),_=u*Math.sin(f-A),k=u*Math.cos(c+A),S=u*Math.sin(c+A);var P=Math.abs(c-f+2*A)<=Nt?0:1;if(A&&Gi(w,_,k,S)===1-p^P){var C=(c+f)/2;w=u*Math.cos(C),_=u*Math.sin(C),k=S=null}}else w=_=0;if(h>Tt&&(d=Math.min(Math.abs(l-u)/2,+e.apply(this,arguments)))>.001){m=u<l^p?0:1;var O=d,L=d;if(h<Nt){var U=null==k?[w,_]:null==x?[y,b]:ho([y,b],[k,S],[x,M],[w,_]),D=y-U[0],z=b-U[1],q=x-U[0],j=M-U[1],F=1/Math.sin(Math.acos((D*q+z*j)/(Math.sqrt(D*D+z*z)*Math.sqrt(q*q+j*j)))/2),B=Math.sqrt(U[0]*U[0]+U[1]*U[1]);L=Math.min(d,(u-B)/(F-1)),O=Math.min(d,(l-B)/(F+1))}if(null!=x){var I=Wi(null==k?[w,_]:[k,S],[y,b],l,O,p),X=Wi([x,M],[w,_],l,O,p);d===O?T.push("M",I[0],"A",O,",",O," 0 0,",m," ",I[1],"A",l,",",l," 0 ",1-p^Gi(I[1][0],I[1][1],X[1][0],X[1][1]),",",p," ",X[1],"A",O,",",O," 0 0,",m," ",X[0]):T.push("M",I[0],"A",O,",",O," 0 1,",m," ",X[0])}else T.push("M",y,",",b);if(null!=k){var Y=Wi([y,b],[k,S],u,-L,p),V=Wi([w,_],null==x?[y,b]:[x,M],u,-L,p);d===L?T.push("L",V[0],"A",L,",",L," 0 0,",m," ",V[1],"A",u,",",u," 0 ",p^Gi(V[1][0],V[1][1],Y[1][0],Y[1][1]),",",1-p," ",Y[1],"A",L,",",L," 0 0,",m," ",Y[0]):T.push("L",V[0],"A",L,",",L," 0 0,",m," ",Y[0])}else T.push("L",w,",",_)}else T.push("M",y,",",b),null!=x&&T.push("A",l,",",l," 0 ",R,",",p," ",x,",",M),T.push("L",w,",",_),null!=k&&T.push("A",u,",",u," 0 ",P,",",1-p," ",k,",",S);return T.push("Z"),T.join("")}function s(t,n){return"M0,"+t+"A"+t+","+t+" 0 1,"+n+" 0,"+-t+"A"+t+","+t+" 0 1,"+n+" 0,"+t}return u.innerRadius=function(n){return arguments.length?(t=bn(n),u):t},u.outerRadius=function(t){return arguments.length?(n=bn(t),u):n},u.cornerRadius=function(t){return arguments.length?(e=bn(t),u):e},u.padRadius=function(t){return arguments.length?(r=t==Bi?Bi:bn(t),u):r},u.startAngle=function(t){return arguments.length?(o=bn(t),u):o},u.endAngle=function(t){return arguments.length?(a=bn(t),u):a},u.padAngle=function(t){return arguments.length?(i=bn(t),u):i},u.centroid=function(){var e=(+t.apply(this,arguments)+ +n.apply(this,arguments))/2,r=(+o.apply(this,arguments)+ +a.apply(this,arguments))/2-Ot;return[Math.cos(r)*e,Math.sin(r)*e]},u};var Bi="auto";function Ii(t){return t.innerRadius}function Xi(t){return t.outerRadius}function Yi(t){return t.startAngle}function Vi(t){return t.endAngle}function Hi(t){return t&&t.padAngle}function Gi(t,n,e,r){return(t-e)*n-(n-r)*t>0?0:1}function Wi(t,n,e,r,o){var a=t[0]-n[0],i=t[1]-n[1],u=(o?r:-r)/Math.sqrt(a*a+i*i),s=u*i,l=-u*a,c=t[0]+s,f=t[1]+l,h=n[0]+s,p=n[1]+l,d=(c+h)/2,m=(f+p)/2,g=h-c,v=p-f,y=g*g+v*v,b=e-r,x=c*p-h*f,M=(v<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*v-g*M)/y,_=(-x*g-v*M)/y,k=(x*v+g*M)/y,S=(-x*g+v*M)/y,A=w-d,E=_-m,T=k-d,R=S-m;return A*A+E*E>T*T+R*R&&(w=k,_=S),[[w-s,_-l],[w*e/b,_*e/b]]}function Zi(t){var n=io,e=uo,r=$e,o=$i,a=o.key,i=.7;function u(a){var u,s=[],l=[],c=-1,f=a.length,h=bn(n),p=bn(e);function d(){s.push("M",o(t(l),i))}for(;++c<f;)r.call(this,u=a[c],c)?l.push([+h.call(this,u,c),+p.call(this,u,c)]):l.length&&(d(),l=[]);return l.length&&d(),s.length?s.join(""):null}return u.x=function(t){return arguments.length?(n=t,u):n},u.y=function(t){return arguments.length?(e=t,u):e},u.defined=function(t){return arguments.length?(r=t,u):r},u.interpolate=function(t){return arguments.length?(a="function"==typeof t?o=t:(o=Ji.get(t)||$i).key,u):a},u.tension=function(t){return arguments.length?(i=t,u):i},u}a.svg.line=function(){return Zi(L)};var Ji=a.map({linear:$i,"linear-closed":Ki,step:function(t){for(var n=0,e=t.length,r=t[0],o=[r[0],",",r[1]];++n<e;)o.push("H",(r[0]+(r=t[n])[0])/2,"V",r[1]);return e>1&&o.push("H",r[0]),o.join("")},"step-before":Qi,"step-after":tu,basis:ru,"basis-open":function(t){if(t.length<4)return $i(t);for(var n,e=[],r=-1,o=t.length,a=[0],i=[0];++r<3;)n=t[r],a.push(n[0]),i.push(n[1]);for(e.push(ou(uu,a)+","+ou(uu,i)),--r;++r<o;)n=t[r],a.shift(),a.push(n[0]),i.shift(),i.push(n[1]),su(e,a,i);return e.join("")},"basis-closed":function(t){for(var n,e,r=-1,o=t.length,a=o+4,i=[],u=[];++r<4;)e=t[r%o],i.push(e[0]),u.push(e[1]);for(n=[ou(uu,i),",",ou(uu,u)],--r;++r<a;)e=t[r%o],i.shift(),i.push(e[0]),u.shift(),u.push(e[1]),su(n,i,u);return n.join("")},bundle:function(t,n){var e=t.length-1;if(e)for(var r,o,a=t[0][0],i=t[0][1],u=t[e][0]-a,s=t[e][1]-i,l=-1;++l<=e;)r=t[l],o=l/e,r[0]=n*r[0]+(1-n)*(a+o*u),r[1]=n*r[1]+(1-n)*(i+o*s);return ru(t)},cardinal:function(t,n){return t.length<3?$i(t):t[0]+nu(t,eu(t,n))},"cardinal-open":function(t,n){return t.length<4?$i(t):t[1]+nu(t.slice(1,-1),eu(t,n))},"cardinal-closed":function(t,n){return t.length<3?Ki(t):t[0]+nu((t.push(t[0]),t),eu([t[t.length-2]].concat(t,[t[1]]),n))},monotone:function(t){return t.length<3?$i(t):t[0]+nu(t,function(t){for(var n,e,r,o,a=[],i=function(t){for(var n=0,e=t.length-1,r=[],o=t[0],a=t[1],i=r[0]=lu(o,a);++n<e;)r[n]=(i+(i=lu(o=a,a=t[n+1])))/2;return r[n]=i,r}(t),u=-1,s=t.length-1;++u<s;)n=lu(t[u],t[u+1]),w(n)<Tt?i[u]=i[u+1]=0:(e=i[u]/n,r=i[u+1]/n,(o=e*e+r*r)>9&&(o=3*n/Math.sqrt(o),i[u]=o*e,i[u+1]=o*r));for(u=-1;++u<=s;)o=(t[Math.min(s,u+1)][0]-t[Math.max(0,u-1)][0])/(6*(1+i[u]*i[u])),a.push([o||0,i[u]*o||0]);return a}(t))}});function $i(t){return t.length>1?t.join("L"):t+"Z"}function Ki(t){return t.join("L")+"Z"}function Qi(t){for(var n=0,e=t.length,r=t[0],o=[r[0],",",r[1]];++n<e;)o.push("V",(r=t[n])[1],"H",r[0]);return o.join("")}function tu(t){for(var n=0,e=t.length,r=t[0],o=[r[0],",",r[1]];++n<e;)o.push("H",(r=t[n])[0],"V",r[1]);return o.join("")}function nu(t,n){if(n.length<1||t.length!=n.length&&t.length!=n.length+2)return $i(t);var e=t.length!=n.length,r="",o=t[0],a=t[1],i=n[0],u=i,s=1;if(e&&(r+="Q"+(a[0]-2*i[0]/3)+","+(a[1]-2*i[1]/3)+","+a[0]+","+a[1],o=t[1],s=2),n.length>1){u=n[1],a=t[s],s++,r+="C"+(o[0]+i[0])+","+(o[1]+i[1])+","+(a[0]-u[0])+","+(a[1]-u[1])+","+a[0]+","+a[1];for(var l=2;l<n.length;l++,s++)a=t[s],u=n[l],r+="S"+(a[0]-u[0])+","+(a[1]-u[1])+","+a[0]+","+a[1]}if(e){var c=t[s];r+="Q"+(a[0]+2*u[0]/3)+","+(a[1]+2*u[1]/3)+","+c[0]+","+c[1]}return r}function eu(t,n){for(var e,r=[],o=(1-n)/2,a=t[0],i=t[1],u=1,s=t.length;++u<s;)e=a,a=i,i=t[u],r.push([o*(i[0]-e[0]),o*(i[1]-e[1])]);return r}function ru(t){if(t.length<3)return $i(t);var n=1,e=t.length,r=t[0],o=r[0],a=r[1],i=[o,o,o,(r=t[1])[0]],u=[a,a,a,r[1]],s=[o,",",a,"L",ou(uu,i),",",ou(uu,u)];for(t.push(t[e-1]);++n<=e;)r=t[n],i.shift(),i.push(r[0]),u.shift(),u.push(r[1]),su(s,i,u);return t.pop(),s.push("L",r),s.join("")}function ou(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]*n[3]}Ji.forEach((function(t,n){n.key=t,n.closed=/-closed$/.test(t)}));var au=[0,2/3,1/3,0],iu=[0,1/3,2/3,0],uu=[0,1/6,2/3,1/6];function su(t,n,e){t.push("C",ou(au,n),",",ou(au,e),",",ou(iu,n),",",ou(iu,e),",",ou(uu,n),",",ou(uu,e))}function lu(t,n){return(n[1]-t[1])/(n[0]-t[0])}function cu(t){for(var n,e,r,o=-1,a=t.length;++o<a;)e=(n=t[o])[0],r=n[1]-Ot,n[0]=e*Math.cos(r),n[1]=e*Math.sin(r);return t}function fu(t){var n=io,e=io,r=0,o=uo,a=$e,i=$i,u=i.key,s=i,l="L",c=.7;function f(u){var f,h,p,d=[],m=[],g=[],v=-1,y=u.length,b=bn(n),x=bn(r),M=n===e?function(){return h}:bn(e),w=r===o?function(){return p}:bn(o);function _(){d.push("M",i(t(g),c),l,s(t(m.reverse()),c),"Z")}for(;++v<y;)a.call(this,f=u[v],v)?(m.push([h=+b.call(this,f,v),p=+x.call(this,f,v)]),g.push([+M.call(this,f,v),+w.call(this,f,v)])):m.length&&(_(),m=[],g=[]);return m.length&&_(),d.length?d.join(""):null}return f.x=function(t){return arguments.length?(n=e=t,f):e},f.x0=function(t){return arguments.length?(n=t,f):n},f.x1=function(t){return arguments.length?(e=t,f):e},f.y=function(t){return arguments.length?(r=o=t,f):o},f.y0=function(t){return arguments.length?(r=t,f):r},f.y1=function(t){return arguments.length?(o=t,f):o},f.defined=function(t){return arguments.length?(a=t,f):a},f.interpolate=function(t){return arguments.length?(u="function"==typeof t?i=t:(i=Ji.get(t)||$i).key,s=i.reverse||i,l=i.closed?"M":"L",f):u},f.tension=function(t){return arguments.length?(c=t,f):c},f}function hu(t){return t.radius}function pu(t){return[t.x,t.y]}function du(t){return function(){var n=t.apply(this,arguments),e=n[0],r=n[1]-Ot;return[e*Math.cos(r),e*Math.sin(r)]}}function mu(){return 64}function gu(){return"circle"}function vu(t){var n=Math.sqrt(t/Nt);return"M0,"+n+"A"+n+","+n+" 0 1,1 0,"+-n+"A"+n+","+n+" 0 1,1 0,"+n+"Z"}a.svg.line.radial=function(){var t=Zi(cu);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},Qi.reverse=tu,tu.reverse=Qi,a.svg.area=function(){return fu(L)},a.svg.area.radial=function(){var t=fu(cu);return t.radius=t.x,delete t.x,t.innerRadius=t.x0,delete t.x0,t.outerRadius=t.x1,delete t.x1,t.angle=t.y,delete t.y,t.startAngle=t.y0,delete t.y0,t.endAngle=t.y1,delete t.y1,t},a.svg.chord=function(){var t=Hr,n=Gr,e=hu,r=Yi,o=Vi;function a(e,r){var o=i(this,t,e,r),a=i(this,n,e,r);return"M"+o.p0+u(o.r,o.p1,o.a1-o.a0)+(function(t,n){return t.a0==n.a0&&t.a1==n.a1}(o,a)?s(o.r,o.p1,o.r,o.p0):s(o.r,o.p1,a.r,a.p0)+u(a.r,a.p1,a.a1-a.a0)+s(a.r,a.p1,o.r,o.p0))+"Z"}function i(t,n,a,i){var u=n.call(t,a,i),s=e.call(t,u,i),l=r.call(t,u,i)-Ot,c=o.call(t,u,i)-Ot;return{r:s,a0:l,a1:c,p0:[s*Math.cos(l),s*Math.sin(l)],p1:[s*Math.cos(c),s*Math.sin(c)]}}function u(t,n,e){return"A"+t+","+t+" 0 "+ +(e>Nt)+",1 "+n}function s(t,n,e,r){return"Q 0,0 "+r}return a.radius=function(t){return arguments.length?(e=bn(t),a):e},a.source=function(n){return arguments.length?(t=bn(n),a):t},a.target=function(t){return arguments.length?(n=bn(t),a):n},a.startAngle=function(t){return arguments.length?(r=bn(t),a):r},a.endAngle=function(t){return arguments.length?(o=bn(t),a):o},a},a.svg.diagonal=function(){var t=Hr,n=Gr,e=pu;function r(r,o){var a=t.call(this,r,o),i=n.call(this,r,o),u=(a.y+i.y)/2,s=[a,{x:a.x,y:u},{x:i.x,y:u},i];return"M"+(s=s.map(e))[0]+"C"+s[1]+" "+s[2]+" "+s[3]}return r.source=function(n){return arguments.length?(t=bn(n),r):t},r.target=function(t){return arguments.length?(n=bn(t),r):n},r.projection=function(t){return arguments.length?(e=t,r):e},r},a.svg.diagonal.radial=function(){var t=a.svg.diagonal(),n=pu,e=t.projection;return t.projection=function(t){return arguments.length?e(du(n=t)):n},t},a.svg.symbol=function(){var t=gu,n=mu;function e(e,r){return(yu.get(t.call(this,e,r))||vu)(n.call(this,e,r))}return e.type=function(n){return arguments.length?(t=bn(n),e):t},e.size=function(t){return arguments.length?(n=bn(t),e):n},e};var yu=a.map({circle:vu,cross:function(t){var n=Math.sqrt(t/5)/2;return"M"+-3*n+","+-n+"H"+-n+"V"+-3*n+"H"+n+"V"+-n+"H"+3*n+"V"+n+"H"+n+"V"+3*n+"H"+-n+"V"+n+"H"+-3*n+"Z"},diamond:function(t){var n=Math.sqrt(t/(2*xu)),e=n*xu;return"M0,"+-n+"L"+e+",0 0,"+n+" "+-e+",0Z"},square:function(t){var n=Math.sqrt(t)/2;return"M"+-n+","+-n+"L"+n+","+-n+" "+n+","+n+" "+-n+","+n+"Z"},"triangle-down":function(t){var n=Math.sqrt(t/bu),e=n*bu/2;return"M0,"+e+"L"+n+","+-e+" "+-n+","+-e+"Z"},"triangle-up":function(t){var n=Math.sqrt(t/bu),e=n*bu/2;return"M0,"+-e+"L"+n+","+e+" "+-n+","+e+"Z"}});a.svg.symbolTypes=yu.keys();var bu=Math.sqrt(3),xu=Math.tan(30*Lt);J.transition=function(t){for(var n,e,r=ku||++Eu,o=Nu(t),a=[],i=Su||{time:Date.now(),ease:da,delay:0,duration:250},u=-1,s=this.length;++u<s;){a.push(n=[]);for(var l=this[u],c=-1,f=l.length;++c<f;)(e=l[c])&&Pu(e,c,o,r,i),n.push(e)}return _u(a,o,r)},J.interrupt=function(t){return this.each(null==t?Mu:wu(Nu(t)))};var Mu=wu(Nu());function wu(t){return function(){var n,e,r;(n=this[t])&&(r=n[e=n.active])&&(r.timer.c=null,r.timer.t=NaN,--n.count?delete n[e]:delete this[t],n.active+=.5,r.event&&r.event.interrupt.call(this,this.__data__,r.index))}}function _u(t,n,e){return V(t,Au),t.namespace=n,t.id=e,t}var ku,Su,Au=[],Eu=0;function Tu(t,n,e,r){var o=t.id,a=t.namespace;return dt(t,"function"==typeof e?function(t,i,u){t[a][o].tween.set(n,r(e.call(t,t.__data__,i,u)))}:(e=r(e),function(t){t[a][o].tween.set(n,e)}))}function Ru(t){return null==t&&(t=""),function(){this.textContent=t}}function Nu(t){return null==t?"__transition__":"__transition_"+t+"__"}function Pu(t,n,e,r,o){var a,i,u,s,l,c=t[e]||(t[e]={active:0,count:0}),f=c[r];function h(e){var o=c.active,h=c[o];for(var d in h&&(h.timer.c=null,h.timer.t=NaN,--c.count,delete c[o],h.event&&h.event.interrupt.call(t,t.__data__,h.index)),c)if(+d<r){var m=c[d];m.timer.c=null,m.timer.t=NaN,--c.count,delete c[d]}i.c=p,En((function(){return i.c&&p(e||1)&&(i.c=null,i.t=NaN),1}),0,a),c.active=r,f.event&&f.event.start.call(t,t.__data__,n),l=[],f.tween.forEach((function(e,r){(r=r.call(t,t.__data__,n))&&l.push(r)})),s=f.ease,u=f.duration}function p(o){for(var a=o/u,i=s(a),h=l.length;h>0;)l[--h].call(t,i);if(a>=1)return f.event&&f.event.end.call(t,t.__data__,n),--c.count?delete c[r]:delete t[e],1}f||(a=o.time,i=En((function(t){var n=f.delay;if(i.t=n+a,n<=t)return h(t-n);i.c=h}),0,a),f=c[r]={tween:new S,time:a,timer:i,delay:o.delay,duration:o.duration,ease:o.ease,index:n},o=null,++c.count)}Au.call=J.call,Au.empty=J.empty,Au.node=J.node,Au.size=J.size,a.transition=function(t,n){return t&&t.transition?ku?t.transition(n):t:a.selection().transition(t)},a.transition.prototype=Au,Au.select=function(t){var n,e,r,o=this.id,a=this.namespace,i=[];t=$(t);for(var u=-1,s=this.length;++u<s;){i.push(n=[]);for(var l=this[u],c=-1,f=l.length;++c<f;)(r=l[c])&&(e=t.call(r,r.__data__,c,u))?("__data__"in r&&(e.__data__=r.__data__),Pu(e,c,a,o,r[a][o]),n.push(e)):n.push(null)}return _u(i,a,o)},Au.selectAll=function(t){var n,e,r,o,a,i=this.id,u=this.namespace,s=[];t=K(t);for(var l=-1,c=this.length;++l<c;)for(var f=this[l],h=-1,p=f.length;++h<p;)if(r=f[h]){a=r[u][i],e=t.call(r,r.__data__,h,l),s.push(n=[]);for(var d=-1,m=e.length;++d<m;)(o=e[d])&&Pu(o,d,u,i,a),n.push(o)}return _u(s,u,i)},Au.filter=function(t){var n,e,r=[];"function"!=typeof t&&(t=ht(t));for(var o=0,a=this.length;o<a;o++){r.push(n=[]);for(var i,u=0,s=(i=this[o]).length;u<s;u++)(e=i[u])&&t.call(e,e.__data__,u,o)&&n.push(e)}return _u(r,this.namespace,this.id)},Au.tween=function(t,n){var e=this.id,r=this.namespace;return arguments.length<2?this.node()[r][e].tween.get(t):dt(this,null==n?function(n){n[r][e].tween.remove(t)}:function(o){o[r][e].tween.set(t,n)})},Au.attr=function(t,n){if(arguments.length<2){for(n in t)this.attr(n,t[n]);return this}var e="transform"==t?Sa:oa,r=a.ns.qualify(t);function o(){this.removeAttribute(r)}function i(){this.removeAttributeNS(r.space,r.local)}function u(t){return null==t?o:(t+="",function(){var n,o=this.getAttribute(r);return o!==t&&(n=e(o,t),function(t){this.setAttribute(r,n(t))})})}function s(t){return null==t?i:(t+="",function(){var n,o=this.getAttributeNS(r.space,r.local);return o!==t&&(n=e(o,t),function(t){this.setAttributeNS(r.space,r.local,n(t))})})}return Tu(this,"attr."+t,n,r.local?s:u)},Au.attrTween=function(t,n){var e=a.ns.qualify(t);return this.tween("attr."+t,e.local?function(t,r){var o=n.call(this,t,r,this.getAttributeNS(e.space,e.local));return o&&function(t){this.setAttributeNS(e.space,e.local,o(t))}}:function(t,r){var o=n.call(this,t,r,this.getAttribute(e));return o&&function(t){this.setAttribute(e,o(t))}})},Au.style=function(t,n,e){var r=arguments.length;if(r<3){if("string"!=typeof t){for(e in r<2&&(n=""),t)this.style(e,t[e],n);return this}e=""}function o(){this.style.removeProperty(t)}function a(n){return null==n?o:(n+="",function(){var r,o=c(this).getComputedStyle(this,null).getPropertyValue(t);return o!==n&&(r=oa(o,n),function(n){this.style.setProperty(t,r(n),e)})})}return Tu(this,"style."+t,n,a)},Au.styleTween=function(t,n,e){function r(r,o){var a=n.call(this,r,o,c(this).getComputedStyle(this,null).getPropertyValue(t));return a&&function(n){this.style.setProperty(t,a(n),e)}}return arguments.length<3&&(e=""),this.tween("style."+t,r)},Au.text=function(t){return Tu(this,"text",t,Ru)},Au.remove=function(){var t=this.namespace;return this.each("end.transition",(function(){var n;this[t].count<2&&(n=this.parentNode)&&n.removeChild(this)}))},Au.ease=function(t){var n=this.id,e=this.namespace;return arguments.length<1?this.node()[e][n].ease:("function"!=typeof t&&(t=a.ease.apply(a,arguments)),dt(this,(function(r){r[e][n].ease=t})))},Au.delay=function(t){var n=this.id,e=this.namespace;return arguments.length<1?this.node()[e][n].delay:dt(this,"function"==typeof t?function(r,o,a){r[e][n].delay=+t.call(r,r.__data__,o,a)}:(t=+t,function(r){r[e][n].delay=t}))},Au.duration=function(t){var n=this.id,e=this.namespace;return arguments.length<1?this.node()[e][n].duration:dt(this,"function"==typeof t?function(r,o,a){r[e][n].duration=Math.max(1,t.call(r,r.__data__,o,a))}:(t=Math.max(1,t),function(r){r[e][n].duration=t}))},Au.each=function(t,n){var e=this.id,r=this.namespace;if(arguments.length<2){var o=Su,i=ku;try{ku=e,dt(this,(function(n,o,a){Su=n[r][e],t.call(n,n.__data__,o,a)}))}finally{Su=o,ku=i}}else dt(this,(function(o){var i=o[r][e];(i.event||(i.event=a.dispatch("start","end","interrupt"))).on(t,n)}));return this},Au.transition=function(){for(var t,n,e,r=this.id,o=++Eu,a=this.namespace,i=[],u=0,s=this.length;u<s;u++){i.push(t=[]);for(var l,c=0,f=(l=this[u]).length;c<f;c++)(n=l[c])&&Pu(n,c,a,o,{time:(e=n[a][r]).time,ease:e.ease,delay:e.delay+e.duration,duration:e.duration}),t.push(n)}return _u(i,a,o)},a.svg.axis=function(){var t,n=a.scale.linear(),e=Cu,r=6,o=6,i=3,s=[10],l=null;function c(u){u.each((function(){var u,c=a.select(this),f=this.__chart__||n,h=this.__chart__=n.copy(),p=null==l?h.ticks?h.ticks.apply(h,s):h.domain():l,d=null==t?h.tickFormat?h.tickFormat.apply(h,s):L:t,m=c.selectAll(".tick").data(p,h),g=m.enter().insert("g",".domain").attr("class","tick").style("opacity",Tt),v=a.transition(m.exit()).style("opacity",Tt).remove(),y=a.transition(m.order()).style("opacity",1),b=Math.max(r,0)+i,x=xi(h),M=c.selectAll(".domain").data([0]),w=(M.enter().append("path").attr("class","domain"),a.transition(M));g.append("line"),g.append("text");var _,k,S,A,E=g.select("line"),T=y.select("line"),R=m.select("text").text(d),N=g.select("text"),P=y.select("text"),C="top"===e||"left"===e?-1:1;if("bottom"===e||"top"===e?(u=Lu,_="x",S="y",k="x2",A="y2",R.attr("dy",C<0?"0em":".71em").style("text-anchor","middle"),w.attr("d","M"+x[0]+","+C*o+"V0H"+x[1]+"V"+C*o)):(u=Uu,_="y",S="x",k="y2",A="x2",R.attr("dy",".32em").style("text-anchor",C<0?"end":"start"),w.attr("d","M"+C*o+","+x[0]+"H0V"+x[1]+"H"+C*o)),E.attr(A,C*r),N.attr(S,C*b),T.attr(k,0).attr(A,C*r),P.attr(_,0).attr(S,C*b),h.rangeBand){var O=h,U=O.rangeBand()/2;f=h=function(t){return O(t)+U}}else f.rangeBand?f=h:v.call(u,h,f);g.call(u,f,h),y.call(u,h,h)}))}return c.scale=function(t){return arguments.length?(n=t,c):n},c.orient=function(t){return arguments.length?(e=t in Ou?t+"":Cu,c):e},c.ticks=function(){return arguments.length?(s=u(arguments),c):s},c.tickValues=function(t){return arguments.length?(l=t,c):l},c.tickFormat=function(n){return arguments.length?(t=n,c):t},c.tickSize=function(t){var n=arguments.length;return n?(r=+t,o=+arguments[n-1],c):r},c.innerTickSize=function(t){return arguments.length?(r=+t,c):r},c.outerTickSize=function(t){return arguments.length?(o=+t,c):o},c.tickPadding=function(t){return arguments.length?(i=+t,c):i},c.tickSubdivide=function(){return arguments.length&&c},c};var Cu="bottom",Ou={top:1,right:1,bottom:1,left:1};function Lu(t,n,e){t.attr("transform",(function(t){var r=n(t);return"translate("+(isFinite(r)?r:e(t))+",0)"}))}function Uu(t,n,e){t.attr("transform",(function(t){var r=n(t);return"translate(0,"+(isFinite(r)?r:e(t))+")"}))}a.svg.brush=function(){var t,n,e=X(h,"brushstart","brush","brushend"),r=null,o=null,i=[0,0],u=[0,0],s=!0,l=!0,f=zu[0];function h(t){t.each((function(){var t=a.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",g).on("touchstart.brush",g),n=t.selectAll(".background").data([0]);n.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),t.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var e=t.selectAll(".resize").data(f,L);e.exit().remove(),e.enter().append("g").attr("class",(function(t){return"resize "+t})).style("cursor",(function(t){return Du[t]})).append("rect").attr("x",(function(t){return/[ew]$/.test(t)?-3:null})).attr("y",(function(t){return/^[ns]/.test(t)?-3:null})).attr("width",6).attr("height",6).style("visibility","hidden"),e.style("display",h.empty()?"none":null);var i,u=a.transition(t),s=a.transition(n);r&&(i=xi(r),s.attr("x",i[0]).attr("width",i[1]-i[0]),d(u)),o&&(i=xi(o),s.attr("y",i[0]).attr("height",i[1]-i[0]),m(u)),p(u)}))}function p(t){t.selectAll(".resize").attr("transform",(function(t){return"translate("+i[+/e$/.test(t)]+","+u[+/^s/.test(t)]+")"}))}function d(t){t.select(".extent").attr("x",i[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",i[1]-i[0])}function m(t){t.select(".extent").attr("y",u[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",u[1]-u[0])}function g(){var f,g,v=this,y=a.select(a.event.target),b=e.of(v,arguments),x=a.select(v),M=y.datum(),w=!/^(n|s)$/.test(M)&&r,_=!/^(e|w)$/.test(M)&&o,k=y.classed("extent"),S=kt(v),A=a.mouse(v),E=a.select(c(v)).on("keydown.brush",N).on("keyup.brush",P);if(a.event.changedTouches?E.on("touchmove.brush",C).on("touchend.brush",L):E.on("mousemove.brush",C).on("mouseup.brush",L),x.interrupt().selectAll("*").interrupt(),k)A[0]=i[0]-A[0],A[1]=u[0]-A[1];else if(M){var T=+/w$/.test(M),R=+/^n/.test(M);g=[i[1-T]-A[0],u[1-R]-A[1]],A[0]=i[T],A[1]=u[R]}else a.event.altKey&&(f=A.slice());function N(){32==a.event.keyCode&&(k||(f=null,A[0]-=i[1],A[1]-=u[1],k=2),B())}function P(){32==a.event.keyCode&&2==k&&(A[0]+=i[1],A[1]+=u[1],k=0,B())}function C(){var t=a.mouse(v),n=!1;g&&(t[0]+=g[0],t[1]+=g[1]),k||(a.event.altKey?(f||(f=[(i[0]+i[1])/2,(u[0]+u[1])/2]),A[0]=i[+(t[0]<f[0])],A[1]=u[+(t[1]<f[1])]):f=null),w&&O(t,r,0)&&(d(x),n=!0),_&&O(t,o,1)&&(m(x),n=!0),n&&(p(x),b({type:"brush",mode:k?"move":"resize"}))}function O(e,r,o){var a,c,h=xi(r),p=h[0],d=h[1],m=A[o],g=o?u:i,v=g[1]-g[0];if(k&&(p-=m,d-=v+m),a=(o?l:s)?Math.max(p,Math.min(d,e[o])):e[o],k?c=(a+=m)+v:(f&&(m=Math.max(p,Math.min(d,2*f[o]-a))),m<a?(c=a,a=m):c=m),g[0]!=a||g[1]!=c)return o?n=null:t=null,g[0]=a,g[1]=c,!0}function L(){C(),x.style("pointer-events","all").selectAll(".resize").style("display",h.empty()?"none":null),a.select("body").style("cursor",null),E.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),S(),b({type:"brushend"})}x.style("pointer-events","none").selectAll(".resize").style("display",null),a.select("body").style("cursor",y.style("cursor")),b({type:"brushstart"}),C()}return h.event=function(r){r.each((function(){var r=e.of(this,arguments),o={x:i,y:u,i:t,j:n},s=this.__chart__||o;this.__chart__=o,ku?a.select(this).transition().each("start.brush",(function(){t=s.i,n=s.j,i=s.x,u=s.y,r({type:"brushstart"})})).tween("brush:brush",(function(){var e=aa(i,o.x),a=aa(u,o.y);return t=n=null,function(t){i=o.x=e(t),u=o.y=a(t),r({type:"brush",mode:"resize"})}})).each("end.brush",(function(){t=o.i,n=o.j,r({type:"brush",mode:"resize"}),r({type:"brushend"})})):(r({type:"brushstart"}),r({type:"brush",mode:"resize"}),r({type:"brushend"}))}))},h.x=function(t){return arguments.length?(f=zu[!(r=t)<<1|!o],h):r},h.y=function(t){return arguments.length?(f=zu[!r<<1|!(o=t)],h):o},h.clamp=function(t){return arguments.length?(r&&o?(s=!!t[0],l=!!t[1]):r?s=!!t:o&&(l=!!t),h):r&&o?[s,l]:r?s:o?l:null},h.extent=function(e){var a,s,l,c,f;return arguments.length?(r&&(a=e[0],s=e[1],o&&(a=a[0],s=s[0]),t=[a,s],r.invert&&(a=r(a),s=r(s)),s<a&&(f=a,a=s,s=f),a==i[0]&&s==i[1]||(i=[a,s])),o&&(l=e[0],c=e[1],r&&(l=l[1],c=c[1]),n=[l,c],o.invert&&(l=o(l),c=o(c)),c<l&&(f=l,l=c,c=f),l==u[0]&&c==u[1]||(u=[l,c])),h):(r&&(t?(a=t[0],s=t[1]):(a=i[0],s=i[1],r.invert&&(a=r.invert(a),s=r.invert(s)),s<a&&(f=a,a=s,s=f))),o&&(n?(l=n[0],c=n[1]):(l=u[0],c=u[1],o.invert&&(l=o.invert(l),c=o.invert(c)),c<l&&(f=l,l=c,c=f))),r&&o?[[a,l],[s,c]]:r?[a,s]:o&&[l,c])},h.clear=function(){return h.empty()||(i=[0,0],u=[0,0],t=n=null),h},h.empty=function(){return!!r&&i[0]==i[1]||!!o&&u[0]==u[1]},a.rebind(h,e,"on")};var Du={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},zu=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],qu=zn.format=he.timeFormat,ju=qu.utc,Fu=ju("%Y-%m-%dT%H:%M:%S.%LZ");function Bu(t){return t.toISOString()}function Iu(t,n,e){function r(n){return t(n)}function o(t,e){var r=(t[1]-t[0])/e,o=a.bisect(Yu,r);return o==Yu.length?[n.year,Ti(t.map((function(t){return t/31536e6})),e)[2]]:o?n[r/Yu[o-1]<Yu[o]/r?o-1:o]:[Gu,Ti(t,e)[2]]}return r.invert=function(n){return Xu(t.invert(n))},r.domain=function(n){return arguments.length?(t.domain(n),r):t.domain().map(Xu)},r.nice=function(t,n){var e=r.domain(),a=bi(e),i=null==t?o(a,10):"number"==typeof t&&o(a,t);function u(e){return!isNaN(e)&&!t.range(e,Xu(+e+1),n).length}return i&&(t=i[0],n=i[1]),r.domain(wi(e,n>1?{floor:function(n){for(;u(n=t.floor(n));)n=Xu(n-1);return n},ceil:function(n){for(;u(n=t.ceil(n));)n=Xu(+n+1);return n}}:t))},r.ticks=function(t,n){var e=bi(r.domain()),a=null==t?o(e,10):"number"==typeof t?o(e,t):!t.range&&[{range:t},n];return a&&(t=a[0],n=a[1]),t.range(e[0],Xu(+e[1]+1),n<1?1:n)},r.tickFormat=function(){return e},r.copy=function(){return Iu(t.copy(),n,e)},Ai(r,t)}function Xu(t){return new Date(t)}qu.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Bu:Fu,Bu.parse=function(t){var n=new Date(t);return isNaN(n)?null:n},Bu.toString=Fu.toString,zn.second=Bn((function(t){return new qn(1e3*Math.floor(t/1e3))}),(function(t,n){t.setTime(t.getTime()+1e3*Math.floor(n))}),(function(t){return t.getSeconds()})),zn.seconds=zn.second.range,zn.seconds.utc=zn.second.utc.range,zn.minute=Bn((function(t){return new qn(6e4*Math.floor(t/6e4))}),(function(t,n){t.setTime(t.getTime()+6e4*Math.floor(n))}),(function(t){return t.getMinutes()})),zn.minutes=zn.minute.range,zn.minutes.utc=zn.minute.utc.range,zn.hour=Bn((function(t){var n=t.getTimezoneOffset()/60;return new qn(36e5*(Math.floor(t/36e5-n)+n))}),(function(t,n){t.setTime(t.getTime()+36e5*Math.floor(n))}),(function(t){return t.getHours()})),zn.hours=zn.hour.range,zn.hours.utc=zn.hour.utc.range,zn.month=Bn((function(t){return(t=zn.day(t)).setDate(1),t}),(function(t,n){t.setMonth(t.getMonth()+n)}),(function(t){return t.getMonth()})),zn.months=zn.month.range,zn.months.utc=zn.month.utc.range;var Yu=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Vu=[[zn.second,1],[zn.second,5],[zn.second,15],[zn.second,30],[zn.minute,1],[zn.minute,5],[zn.minute,15],[zn.minute,30],[zn.hour,1],[zn.hour,3],[zn.hour,6],[zn.hour,12],[zn.day,1],[zn.day,2],[zn.week,1],[zn.month,1],[zn.month,3],[zn.year,1]],Hu=qu.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",$e]]),Gu={range:function(t,n,e){return a.range(Math.ceil(t/e)*e,+n,e).map(Xu)},floor:L,ceil:L};Vu.year=zn.year,zn.scale=function(){return Iu(a.scale.linear(),Vu,Hu)};var Wu=Vu.map((function(t){return[t[0].utc,t[1]]})),Zu=ju.multi([[".%L",function(t){return t.getUTCMilliseconds()}],[":%S",function(t){return t.getUTCSeconds()}],["%I:%M",function(t){return t.getUTCMinutes()}],["%I %p",function(t){return t.getUTCHours()}],["%a %d",function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],["%b %d",function(t){return 1!=t.getUTCDate()}],["%B",function(t){return t.getUTCMonth()}],["%Y",$e]]);function Ju(t){return JSON.parse(t.responseText)}function $u(t){var n=s.createRange();return n.selectNode(s.body),n.createContextualFragment(t.responseText)}Wu.year=zn.year.utc,zn.scale.utc=function(){return Iu(a.scale.linear(),Wu,Zu)},a.text=xn((function(t){return t.responseText})),a.json=function(t,n){return Mn(t,"application/json",Ju,n)},a.html=function(t,n){return Mn(t,"text/html",$u,n)},a.xml=xn((function(t){return t.responseXML})),this.d3=a,void 0===(o="function"==typeof(r=a)?r.call(n,e,n,t):r)||(t.exports=o)}()}])},t.exports=o()},function(t,n,e){"use strict";var r=e(26);function o(){}t.exports=function(){function t(t,n,e,o,a,i){if(i!==r){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function n(){return t}t.isRequired=t;var e={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:n,element:t,instanceOf:n,node:t,objectOf:n,oneOf:n,oneOfType:n,shape:n,exact:n};return e.checkPropTypes=o,e.PropTypes=e,e}},function(t,n,e){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,n,e){"use strict";var r=e(7),o=e(28),a=e(29),i=e(6),u=e(8),s=e(23),l=e(30);function c(t,n){return n=n.split("// __split__"),new o.Program(t,n[0],n[1])}t.exports=function(t,n,e){var f,h,p,d,m,g,v,y,b,x,M,w,_,k,S,A,E,T,R,N,P,C,O,L,U,D,z,q=this,j=null,F=null,B=null,I=null,X=null,Y=null,V=0,H=!1,G=!1;function W(t){p.viewport(0,0,e,e);var o=u.clone(t);o.zoom=1/f,o.translation.x=0,o.translation.y=0;for(var a=r.mat4.create(),i=0;i<3;i++){var s=r.vec3.random(r.vec3.create(),1);r.mat4.rotate(a,a,10*Math.random(),s)}o.rotation=r.mat4.multiply(r.mat4.create(),a,o.rotation),E.bind(),p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT);var l=u.getRect(o),c=r.mat4.create();r.mat4.ortho(c,l.left,l.right,l.bottom,l.top,0,f);var h=r.mat4.create();r.mat4.lookAt(h,[0,0,0],[0,0,-1],[0,1,0]);var d=r.mat4.create();r.mat4.translate(d,d,[0,0,-f/2]),r.mat4.multiply(d,d,o.rotation),P.setUniform("uProjection","Matrix4fv",!1,c),P.setUniform("uView","Matrix4fv",!1,h),P.setUniform("uModel","Matrix4fv",!1,d),P.setUniform("uBottomLeft","2fv",[l.left,l.bottom]),P.setUniform("uTopRight","2fv",[l.right,l.top]),P.setUniform("uAtomScale","1f",2.5*o.atomScale),P.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),P.setUniform("uRes","1f",e),P.setUniform("uDepth","1f",f),P.setUniform("uMode","1i",0),P.setUniform("uAtomShade","1f",t.atomShade),j.render(),t.bonds&&null!=F&&(C.setUniform("uProjection","Matrix4fv",!1,c),C.setUniform("uView","Matrix4fv",!1,h),C.setUniform("uModel","Matrix4fv",!1,d),C.setUniform("uRotation","Matrix4fv",!1,o.rotation),C.setUniform("uDepth","1f",f),C.setUniform("uBottomLeft","2fv",[l.left,l.bottom]),C.setUniform("uTopRight","2fv",[l.right,l.top]),C.setUniform("uRes","1f",e),C.setUniform("uBondRadius","1f",2.5*u.getBondRadius(t)),C.setUniform("uBondShade","1f",t.bondShade),C.setUniform("uAtomScale","1f",2.5*t.atomScale),C.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),C.setUniform("uMode","1i",0),F.render()),p.viewport(0,0,n,n);var y=u.getRect(t),x=u.getRect(o),M=r.mat4.invert(r.mat4.create(),a);T.bind(),p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT),O.setUniform("uSceneDepth","1i",g.index),O.setUniform("uSceneNormal","1i",m.index),O.setUniform("uRandRotDepth","1i",v.index),O.setUniform("uAccumulator","1i",b.index),O.setUniform("uSceneBottomLeft","2fv",[y.left,y.bottom]),O.setUniform("uSceneTopRight","2fv",[y.right,y.top]),O.setUniform("uRotBottomLeft","2fv",[x.left,x.bottom]),O.setUniform("uRotTopRight","2fv",[x.right,x.top]),O.setUniform("uRes","1f",n),O.setUniform("uDepth","1f",f),O.setUniform("uRot","Matrix4fv",!1,a),O.setUniform("uInvRot","Matrix4fv",!1,M),O.setUniform("uSampleCount","1i",V),B.render(),b.activate(),b.bind(),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGBA,0,0,n,n,0)}q.getAOProgress=function(){return V/1024},q.initialize=function(){t.width=t.height=n,(p=t.getContext("webgl")).enable(p.DEPTH_TEST),p.enable(p.CULL_FACE),p.clearColor(0,0,0,0),p.clearDepth(1),p.viewport(0,0,n,n),window.gl=p,o.getExtensions(p,["EXT_frag_depth","WEBGL_depth_texture"]),q.createTextures(),P=c(p,l.shaders.atom),C=c(p,l.shaders.bond),z=c(p,l.shaders["textured-quad"]),O=c(p,l.shaders.accumulator),L=c(p,l.shaders.ao),U=c(p,l.shaders.fxaa),D=c(p,l.shaders.dof);var e=[-1,-1,0,1,-1,0,1,1,0,-1,-1,0,1,1,0,-1,1,0],r=o.buildAttribs(p,{aPosition:3});r.aPosition.buffer.set(new Float32Array(e));var a=e.length/9;new o.Renderable(p,z,r,a),B=new o.Renderable(p,O,r,a),I=new o.Renderable(p,L,r,a),Y=new o.Renderable(p,U,r,a),X=new o.Renderable(p,D,r,a),0},q.createTextures=function(){y=new o.Texture(p,0,null,e,e),v=new o.Texture(p,1,null,e,e,{internalFormat:p.DEPTH_COMPONENT,format:p.DEPTH_COMPONENT,type:p.UNSIGNED_SHORT}),E=new o.Framebuffer(p,[y],v),d=new o.Texture(p,2,null,n,n),m=new o.Texture(p,3,null,n,n),g=new o.Texture(p,4,null,n,n,{internalFormat:p.DEPTH_COMPONENT,format:p.DEPTH_COMPONENT,type:p.UNSIGNED_SHORT}),S=new o.Framebuffer(p,[d],g),A=new o.Framebuffer(p,[m],g),b=new o.Texture(p,5,null,n,n),x=new o.Texture(p,6,null,n,n),T=new o.Framebuffer(p,[x]),k=new o.Texture(p,7,null,n,n),N=new o.Framebuffer(p,[k]),M=new o.Texture(p,8,null,n,n),w=new o.Texture(p,9,null,n,n),R=new o.Framebuffer(p,[w]),_=new o.Texture(p,10,null,n,n),new o.Framebuffer(p,[_])},q.setResolution=function(r,o){e=o,n=r,t.width=t.height=n,p.viewport(0,0,n,n),q.createTextures()},q.setSystem=function(t,n){function e(t){for(var n=[],e=0;e<36;e++)n.push.apply(n,t);return n}h=t;for(var r=o.buildAttribs(p,{aImposter:3,aPosition:3,aRadius:1,aColor:3}),u=[],s=[],l=[],c=[],f=0;f<h.atoms.length;f++){u.push.apply(u,a.position);var d=h.atoms[f];s.push.apply(s,e([d.x,d.y,d.z])),l.push.apply(l,e([i[d.symbol].radius]));var m=i[d.symbol].color;c.push.apply(c,e([m[0],m[1],m[2]]))}r.aImposter.buffer.set(new Float32Array(u)),r.aPosition.buffer.set(new Float32Array(s)),r.aRadius.buffer.set(new Float32Array(l)),r.aColor.buffer.set(new Float32Array(c));var g=u.length/9;if(j=new o.Renderable(p,P,r,g),n.bonds&&(F=null,h.bonds.length>0)){r=o.buildAttribs(p,{aImposter:3,aPosA:3,aPosB:3,aRadA:1,aRadB:1,aColA:3,aColB:3}),u=[];var v=[],y=[],b=[],x=[],M=[],w=[];for(f=0;f<h.bonds.length;f++){var _=h.bonds[f];if(_.cutoff>n.bondThreshold)break;u.push.apply(u,a.position),v.push.apply(v,e([_.posA.x,_.posA.y,_.posA.z])),y.push.apply(y,e([_.posB.x,_.posB.y,_.posB.z])),b.push.apply(b,e([_.radA])),x.push.apply(x,e([_.radB])),M.push.apply(M,e([_.colA.r,_.colA.g,_.colA.b])),w.push.apply(w,e([_.colB.r,_.colB.g,_.colB.b]))}r.aImposter.buffer.set(new Float32Array(u)),r.aPosA.buffer.set(new Float32Array(v)),r.aPosB.buffer.set(new Float32Array(y)),r.aRadA.buffer.set(new Float32Array(b)),r.aRadB.buffer.set(new Float32Array(x)),r.aColA.buffer.set(new Float32Array(M)),r.aColB.buffer.set(new Float32Array(w));g=u.length/9;F=new o.Renderable(p,C,r,g)}},q.reset=function(){V=0,H=!1,G=!1,b.reset(),x.reset()},q.render=function(t){if(void 0!==h&&null!=j){if(f=2*s.getRadius(h),H)if(G)for(var e=0;e<t.spf&&!(V>1024);e++)W(t),V++;else!function(t){G=!0,p.viewport(0,0,n,n),A.bind(),p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT);var e=u.getRect(t),o=r.mat4.create();r.mat4.ortho(o,e.left,e.right,e.bottom,e.top,0,f);var a=r.mat4.create();r.mat4.lookAt(a,[0,0,0],[0,0,-1],[0,1,0]);var i=r.mat4.create();r.mat4.translate(i,i,[0,0,-f/2]),r.mat4.multiply(i,i,t.rotation),P.setUniform("uProjection","Matrix4fv",!1,o),P.setUniform("uView","Matrix4fv",!1,a),P.setUniform("uModel","Matrix4fv",!1,i),P.setUniform("uBottomLeft","2fv",[e.left,e.bottom]),P.setUniform("uTopRight","2fv",[e.right,e.top]),P.setUniform("uAtomScale","1f",2.5*t.atomScale),P.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),P.setUniform("uRes","1f",n),P.setUniform("uDepth","1f",f),P.setUniform("uMode","1i",1),P.setUniform("uAtomShade","1f",t.atomShade),j.render(),t.bonds&&null!=F&&(A.bind(),C.setUniform("uProjection","Matrix4fv",!1,o),C.setUniform("uView","Matrix4fv",!1,a),C.setUniform("uModel","Matrix4fv",!1,i),C.setUniform("uRotation","Matrix4fv",!1,t.rotation),C.setUniform("uDepth","1f",f),C.setUniform("uBottomLeft","2fv",[e.left,e.bottom]),C.setUniform("uTopRight","2fv",[e.right,e.top]),C.setUniform("uRes","1f",n),C.setUniform("uBondRadius","1f",2.5*u.getBondRadius(t)),C.setUniform("uBondShade","1f",t.bondShade),C.setUniform("uAtomScale","1f",2.5*t.atomScale),C.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),C.setUniform("uMode","1i",1),F.render())}(t);else!function(t){H=!0,p.viewport(0,0,n,n),S.bind(),p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT);var e=u.getRect(t),o=r.mat4.create();r.mat4.ortho(o,e.left,e.right,e.bottom,e.top,0,f);var a=r.mat4.create();r.mat4.lookAt(a,[0,0,0],[0,0,-1],[0,1,0]);var i=r.mat4.create();r.mat4.translate(i,i,[0,0,-f/2]),r.mat4.multiply(i,i,t.rotation),P.setUniform("uProjection","Matrix4fv",!1,o),P.setUniform("uView","Matrix4fv",!1,a),P.setUniform("uModel","Matrix4fv",!1,i),P.setUniform("uBottomLeft","2fv",[e.left,e.bottom]),P.setUniform("uTopRight","2fv",[e.right,e.top]),P.setUniform("uAtomScale","1f",2.5*t.atomScale),P.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),P.setUniform("uRes","1f",n),P.setUniform("uDepth","1f",f),P.setUniform("uMode","1i",0),P.setUniform("uAtomShade","1f",t.atomShade),j.render(),t.bonds&&null!=F&&(S.bind(),C.setUniform("uProjection","Matrix4fv",!1,o),C.setUniform("uView","Matrix4fv",!1,a),C.setUniform("uModel","Matrix4fv",!1,i),C.setUniform("uRotation","Matrix4fv",!1,t.rotation),C.setUniform("uDepth","1f",f),C.setUniform("uBottomLeft","2fv",[e.left,e.bottom]),C.setUniform("uTopRight","2fv",[e.right,e.top]),C.setUniform("uRes","1f",n),C.setUniform("uBondRadius","1f",2.5*u.getBondRadius(t)),C.setUniform("uBondShade","1f",t.bondShade),C.setUniform("uAtomScale","1f",2.5*t.atomScale),C.setUniform("uRelativeAtomScale","1f",t.relativeAtomScale),C.setUniform("uMode","1i",0),F.render())}(t);!function(t){p.viewport(0,0,n,n),t.fxaa>0||t.dofStrength>0?N.bind():p.bindFramebuffer(p.FRAMEBUFFER,null);if(p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT),L.setUniform("uSceneColor","1i",d.index),L.setUniform("uSceneDepth","1i",g.index),L.setUniform("uAccumulatorOut","1i",x.index),L.setUniform("uRes","1f",n),L.setUniform("uAO","1f",2*t.ao),L.setUniform("uBrightness","1f",2*t.brightness),L.setUniform("uOutlineStrength","1f",t.outline),I.render(),t.fxaa>0){t.dofStrength>0?R.bind():p.bindFramebuffer(p.FRAMEBUFFER,null);for(var e=0;e<t.fxaa;e++)p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT),0==e?U.setUniform("uTexture","1i",k.index):U.setUniform("uTexture","1i",M.index),U.setUniform("uRes","1f",n),Y.render(),M.activate(),M.bind(),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGBA,0,0,n,n,0)}t.dofStrength>0&&(p.bindFramebuffer(p.FRAMEBUFFER,null),p.clear(p.COLOR_BUFFER_BIT|p.DEPTH_BUFFER_BIT),t.fxaa>0?D.setUniform("uColor","1i",M.index):D.setUniform("uColor","1i",k.index),D.setUniform("uDepth","1i",g.index),D.setUniform("uDOFPosition","1f",t.dofPosition),D.setUniform("uDOFStrength","1f",t.dofStrength),D.setUniform("uRes","1f",n),X.render())}(t)}},q.initialize()}},function(t,n){function e(t){var n=this;n.initialize=function(){n.buffer=t.createBuffer()},n.bind=function(){t.bindBuffer(t.ARRAY_BUFFER,n.buffer)},n.set=function(e){n.bind(),t.bufferData(t.ARRAY_BUFFER,e,t.STATIC_DRAW)},n.initialize()}t.exports.buildAttribs=function(t,n){var r={};for(var o in n)r[o]={buffer:new e(t),size:n[o]};return r},t.exports.getExtensions=function(t,n){for(var e={},r=0;r<n.length;r++){var o=t.getExtension(n[r]);if(null===o)throw"Extension "+n[r]+" not available.";e[n[r]]=o}return e},t.exports.Framebuffer=function(t,n,e,r){var o=this;o.initialize=function(){if(o.fb=t.createFramebuffer(),o.bind(),n.length>1){for(var a=[],i=0;i<n.length;i++)a.push(r["COLOR_ATTACHMENT"+i+"_WEBGL"]);r.drawBuffersWEBGL(a);for(i=0;i<n.length;i++)t.framebufferTexture2D(t.FRAMEBUFFER,r["COLOR_ATTACHMENT"+i+"_WEBGL"],t.TEXTURE_2D,n[i].texture,0)}else t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n[0].texture,0);void 0!==e&&t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,e.texture,0)},o.bind=function(){t.bindFramebuffer(t.FRAMEBUFFER,o.fb)},o.initialize()},t.exports.Texture=function(t,n,e,r,o,a){(a=a||{}).target=a.target||t.TEXTURE_2D,a.mag=a.mag||t.NEAREST,a.min=a.min||t.NEAREST,a.wraps=a.wraps||t.CLAMP_TO_EDGE,a.wrapt=a.wrapt||t.CLAMP_TO_EDGE,a.internalFormat=a.internalFormat||t.RGBA,a.format=a.format||t.RGBA,a.type=a.type||t.UNSIGNED_BYTE;var i=this;i.initialize=function(){i.index=n,i.activate(),i.texture=t.createTexture(),i.bind(),t.texParameteri(a.target,t.TEXTURE_MAG_FILTER,a.mag),t.texParameteri(a.target,t.TEXTURE_MIN_FILTER,a.min),t.texParameteri(a.target,t.TEXTURE_WRAP_S,a.wraps),t.texParameteri(a.target,t.TEXTURE_WRAP_T,a.wrapt),t.texImage2D(a.target,0,a.internalFormat,r,o,0,a.format,a.type,e)},i.bind=function(){t.bindTexture(a.target,i.texture)},i.activate=function(){t.activeTexture(t.TEXTURE0+i.index)},i.reset=function(){i.activate(),i.bind(),t.texImage2D(a.target,0,a.internalFormat,r,o,0,a.format,a.type,e)},i.initialize()},t.exports.GLBuffer=e,t.exports.Renderable=function(t,n,e,r){var o=this;o.primitiveCount=r,o.initialize=function(){},o.render=function(){for(name in n.use(),e){var a=e[name].buffer,i=e[name].size;try{var u=n.attribs[name].location}catch(t){throw console.log("Could not find location for",name),t}a.bind(),t.enableVertexAttribArray(u),t.vertexAttribPointer(u,i,t.FLOAT,!1,0,0)}for(name in t.drawArrays(t.TRIANGLES,0,3*r),o.buffers)t.disableVertexAttribArray(n.attributes[name].location)},o.initialize()},t.exports.InstancedRenderable=function(t,n,e,r,o){var a=this;a.initialize=function(){},a.render=function(){for(name in n.use(),e){var i=e[name].buffer,u=e[name].size;try{var s=n.attribs[name].location}catch(t){throw console.log("Could not find location for",name),t}i.bind(),t.enableVertexAttribArray(s),t.vertexAttribPointer(s,u,t.FLOAT,!1,0,0),o.vertexAttribDivisorANGLE(s,e[name].divisor)}for(name in o.drawArraysInstancedANGLE(t.TRIANGLES,0,36,r),a.buffers)t.disableVertexAttribArray(n.attributes[name].location)},a.initialize()},t.exports.Program=function(t,n,e){var r=this;r.initialize=function(){r.program=r.compileProgram(n,e),r.attribs=r.gatherAttribs(),r.uniforms=r.gatherUniforms()},r.use=function(){t.useProgram(r.program)},r.compileProgram=function(n,e){var o=r.compileShader(n,t.VERTEX_SHADER),a=r.compileShader(e,t.FRAGMENT_SHADER),i=t.createProgram();if(t.attachShader(i,o),t.attachShader(i,a),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS))throw console.log(t.getProgramInfoLog(i)),"Failed to compile program.";return i},r.compileShader=function(n,e){var r=t.createShader(e);if(t.shaderSource(r,n),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(r),a=parseInt(o.split(":")[2]),i=n.split("\n");for(var u in i){var s=parseInt(u);console.log(s+"  "+i[u]),u==a-1&&console.warn(o)}throw typeString=e==t.VERTEX_SHADER?"vertex":"fragment","Failed to compile "+typeString+" shader."}return r},r.setUniform=function(n,e,o){var a=Array.prototype.slice.call(arguments,2);r.use();try{var i=r.uniforms[n].location}catch(t){throw console.log(n),t}t["uniform"+e].apply(t,[i].concat(a))},r.gatherUniforms=function(){for(var n={},e=t.getProgramParameter(r.program,t.ACTIVE_UNIFORMS),o=0;o<e;o++){var a=t.getActiveUniform(r.program,o);n[a.name]={name:a.name,location:t.getUniformLocation(r.program,a.name),type:a.type,size:a.size}}return n},r.gatherAttribs=function(){for(var n={},e=t.getProgramParameter(r.program,t.ACTIVE_ATTRIBUTES),o=0;o<e;o++){var a=t.getActiveAttrib(r.program,o);n[a.name]={name:a.name,location:t.getAttribLocation(r.program,a.name),type:a.type,size:a.size}}return n},r.initialize()}},function(t,n){var e=-1;t.exports={position:[e,e,e,e,e,1,e,1,1,e,e,e,e,1,1,e,1,e,1,e,1,1,e,e,1,1,e,1,e,1,1,1,e,1,1,1,e,e,e,1,e,e,1,e,1,e,e,e,1,e,1,e,e,1,e,1,1,1,1,1,1,1,e,e,1,1,1,1,e,e,1,e,1,e,e,e,e,e,e,1,e,1,e,e,e,1,e,1,1,e,e,e,1,1,e,1,1,1,1,e,e,1,1,1,1,e,1,1],normal:[e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,e,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1]}},function(t,n,e){"use strict";var r={accumulator:"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uSceneDepth;\nuniform sampler2D uSceneNormal;\nuniform sampler2D uRandRotDepth;\nuniform sampler2D uAccumulator;\nuniform mat4 uRot;\nuniform mat4 uInvRot;\nuniform vec2 uSceneBottomLeft;\nuniform vec2 uSceneTopRight;\nuniform vec2 uRotBottomLeft;\nuniform vec2 uRotTopRight;\nuniform float uDepth;\nuniform float uRes;\nuniform int uSampleCount;\n\nvoid main() {\n\n    float dScene = texture2D(uSceneDepth, gl_FragCoord.xy/uRes).r;\n\n    vec3 r = vec3(uSceneBottomLeft + (gl_FragCoord.xy/uRes) * (uSceneTopRight - uSceneBottomLeft), 0.0);\n\n    r.z = -(dScene - 0.5) * uDepth;\n    r = vec3(uRot * vec4(r, 1));\n    float depth = -r.z/uDepth + 0.5;\n\n    vec2 p = (r.xy - uRotBottomLeft)/(uRotTopRight - uRotBottomLeft);\n\n    float dRandRot = texture2D(uRandRotDepth, p).r;\n\n    float ao = step(dRandRot, depth * 0.99);\n\n    vec3 normal = texture2D(uSceneNormal, gl_FragCoord.xy/uRes).rgb * 2.0 - 1.0;\n    vec3 dir = vec3(uInvRot * vec4(0, 0, 1, 0));\n    float mag = dot(dir, normal);\n    float sampled = step(0.0, mag);\n\n    ao *= sampled;\n\n    vec4 acc = texture2D(uAccumulator, gl_FragCoord.xy/uRes);\n\n    if (uSampleCount < 256) {\n        acc.r += ao/255.0;\n    } else if (uSampleCount < 512) {\n        acc.g += ao/255.0;\n    } else if (uSampleCount < 768) {\n        acc.b += ao/255.0;\n    } else {\n        acc.a += ao/255.0;\n    }\n        \n    gl_FragColor = acc;\n\n}\n",ao:"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uSceneColor;\nuniform sampler2D uSceneDepth;\nuniform sampler2D uAccumulatorOut;\nuniform float uRes;\nuniform float uAO;\nuniform float uBrightness;\nuniform float uOutlineStrength;\n\nvoid main() {\n    vec2 p = gl_FragCoord.xy/uRes;\n    vec4 sceneColor = texture2D(uSceneColor, p);\n    if (uOutlineStrength > 0.0) {\n        float depth = texture2D(uSceneDepth, p).r;\n        float r = 1.0/511.0;\n        float d0 = abs(texture2D(uSceneDepth, p + vec2(-r,  0)).r - depth);\n        float d1 = abs(texture2D(uSceneDepth, p + vec2( r,  0)).r - depth);\n        float d2 = abs(texture2D(uSceneDepth, p + vec2( 0, -r)).r - depth);\n        float d3 = abs(texture2D(uSceneDepth, p + vec2( 0,  r)).r - depth);\n        float d = max(d0, d1);\n        d = max(d, d2);\n        d = max(d, d3);\n        sceneColor.rgb *= pow(1.0 - d, uOutlineStrength * 32.0);\n        sceneColor.a = max(step(0.003, d), sceneColor.a);\n    }\n    vec4 dAccum = texture2D(uAccumulatorOut, p);\n    float shade = max(0.0, 1.0 - (dAccum.r + dAccum.g + dAccum.b + dAccum.a) * 0.25 * uAO);\n    shade = pow(shade, 2.0);\n    gl_FragColor = vec4(uBrightness * sceneColor.rgb * shade, sceneColor.a);\n}\n",atom:"#version 100\nprecision highp float;\n\nattribute vec3 aImposter;\nattribute vec3 aPosition;\nattribute float aRadius;\nattribute vec3 aColor;\n\nuniform mat4 uView;\nuniform mat4 uProjection;\nuniform mat4 uModel;\nuniform float uAtomScale;\nuniform float uRelativeAtomScale;\nuniform float uAtomShade;\n\nvarying vec3 vColor;\nvarying vec3 vPosition;\nvarying float vRadius;\n\nvoid main() {\n    vRadius = uAtomScale * (1.0 + (aRadius - 1.0) * uRelativeAtomScale);\n    gl_Position = uProjection * uView * uModel * vec4(vRadius * aImposter + aPosition, 1.0);\n    vColor = mix(aColor, vec3(1,1,1), uAtomShade);\n    vPosition = vec3(uModel * vec4(aPosition, 1));\n}\n\n\n// __split__\n\n\n#version 100\n#extension GL_EXT_frag_depth: enable\nprecision highp float;\n\nuniform vec2 uBottomLeft;\nuniform vec2 uTopRight;\nuniform float uRes;\nuniform float uDepth;\nuniform int uMode;\n\nvarying vec3 vPosition;\nvarying float vRadius;\nvarying vec3 vColor;\n\nvec2 res = vec2(uRes, uRes);\n\nfloat raySphereIntersect(vec3 r0, vec3 rd) {\n    float a = dot(rd, rd);\n    vec3 s0_r0 = r0 - vPosition;\n    float b = 2.0 * dot(rd, s0_r0);\n    float c = dot(s0_r0, s0_r0) - (vRadius * vRadius);\n    float disc = b*b - 4.0*a*c;\n    if (disc <= 0.0) {\n        return -1.0;\n    }\n    return (-b - sqrt(disc))/(2.0*a);\n}\n\nvoid main() {\n    vec3 r0 = vec3(uBottomLeft + (gl_FragCoord.xy/res) * (uTopRight - uBottomLeft), 0.0);\n    vec3 rd = vec3(0, 0, -1);\n    float t = raySphereIntersect(r0, rd);\n    if (t < 0.0) {\n        discard;\n    }\n    vec3 coord = r0 + rd * t;\n    vec3 normal = normalize(coord - vPosition);\n    if (uMode == 0) {\n        gl_FragColor = vec4(vColor, 1);\n    } else if (uMode == 1) {\n        gl_FragColor = vec4(normal * 0.5 + 0.5, 1.0);\n    }\n    gl_FragDepthEXT = -coord.z/uDepth;\n}\n",blur:"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uTexture;\nuniform float uRes;\nuniform int leftRight;\n\nvoid main() {\n    vec2 dir;\n    if (leftRight == 1) {\n        dir = vec2(1,0)/uRes;\n    } else {\n        dir = vec2(0,1)/uRes;\n    }\n    const int range = 16;\n    vec4 sample = vec4(0,0,0,0);\n    for (int i = -range; i <= range; i++) {\n        vec2 p = gl_FragCoord.xy/uRes + dir * float(i);\n        sample += texture2D(uTexture, p);\n    }\n    sample /= float(range) * 2.0 + 1.0;\n    gl_FragColor = sample;\n}\n",bond:"#version 100\nprecision highp float;\n\nattribute vec3 aImposter;\nattribute vec3 aPosA;\nattribute vec3 aPosB;\nattribute float aRadA;\nattribute float aRadB;\nattribute vec3 aColA;\nattribute vec3 aColB;\n\nuniform mat4 uView;\nuniform mat4 uProjection;\nuniform mat4 uModel;\nuniform mat4 uRotation;\nuniform float uBondRadius;\nuniform float uAtomScale;\nuniform float uRelativeAtomScale;\n\nvarying vec3 vNormal;\nvarying vec3 vPosA, vPosB;\nvarying float vRadA, vRadB;\nvarying vec3 vColA, vColB;\nvarying float vRadius;\n\nmat3 alignVector(vec3 a, vec3 b) {\n    vec3 v = cross(a, b);\n    float s = length(v);\n    float c = dot(a, b);\n    mat3 I = mat3(\n        1, 0, 0,\n        0, 1, 0,\n        0, 0, 1\n    );\n    mat3 vx = mat3(\n        0, v.z, -v.y,\n        -v.z, 0, v.x,\n        v.y, -v.x, 0\n    );\n    return I + vx + vx * vx * ((1.0 - c) / (s * s));\n}\n\nvoid main() {\n    vRadius = uBondRadius;\n    vec3 pos = vec3(aImposter);\n    // Scale the box in x and z to be bond-radius.\n    pos = pos * vec3(vRadius, 1, vRadius);\n    // Shift the origin-centered cube so that the bottom is at the origin.\n    pos = pos + vec3(0, 1, 0);\n    // Stretch the box in y so that it is the length of the bond.\n    pos = pos * vec3(1, length(aPosA - aPosB) * 0.5, 1);\n    // Find the rotation that aligns vec3(0, 1, 0) with vec3(uPosB - uPosA) and apply it.\n    vec3 a = normalize(vec3(-0.000001, 1.000001, 0.000001));\n    vec3 b = normalize(aPosB - aPosA);\n    mat3 R = alignVector(a, b);\n    pos = R * pos;\n    // Shift the cube so that the bottom is centered at the middle of atom A.\n    pos = pos + aPosA;\n\n    vec4 position = uModel * vec4(pos, 1);\n    gl_Position = uProjection * uView * position;\n    vPosA = aPosA;\n    vPosB = aPosB;\n    vRadA = uAtomScale * (1.0 + (aRadA - 1.0) * uRelativeAtomScale);\n    vRadB = uAtomScale * (1.0 + (aRadB - 1.0) * uRelativeAtomScale);\n    vColA = aColA;\n    vColB = aColB;\n}\n\n\n// __split__\n\n\n#version 100\n#extension GL_EXT_frag_depth: enable\nprecision highp float;\n\nuniform mat4 uRotation;\nuniform vec2 uBottomLeft;\nuniform vec2 uTopRight;\nuniform float uDepth;\nuniform float uRes;\nuniform float uBondShade;\nuniform int uMode;\n\nvarying vec3 vPosA, vPosB;\nvarying float vRadA, vRadB;\nvarying vec3 vColA, vColB;\nvarying float vRadius;\n\nmat3 alignVector(vec3 a, vec3 b) {\n    vec3 v = cross(a, b);\n    float s = length(v);\n    float c = dot(a, b);\n    mat3 I = mat3(\n        1, 0, 0,\n        0, 1, 0,\n        0, 0, 1\n    );\n    mat3 vx = mat3(\n        0, v.z, -v.y,\n        -v.z, 0, v.x,\n        v.y, -v.x, 0\n    );\n    return I + vx + vx * vx * ((1.0 - c) / (s * s));\n}\n\nvoid main() {\n\n    vec2 res = vec2(uRes, uRes);\n    vec3 r0 = vec3(uBottomLeft + (gl_FragCoord.xy/res) * (uTopRight - uBottomLeft), uDepth/2.0);\n    vec3 rd = vec3(0, 0, -1);\n\n    vec3 i = normalize(vPosB - vPosA);\n         i = vec3(uRotation * vec4(i, 0));\n    vec3 j = normalize(vec3(-0.000001, 1.000001, 0.000001));\n    mat3 R = alignVector(i, j);\n\n    vec3 r0p = r0 - vec3(uRotation * vec4(vPosA, 0));\n    r0p = R * r0p;\n    vec3 rdp = R * rd;\n\n    float a = dot(rdp.xz, rdp.xz);\n    float b = 2.0 * dot(rdp.xz, r0p.xz);\n    float c = dot(r0p.xz, r0p.xz) - vRadius*vRadius;\n    float disc = b*b - 4.0*a*c;\n    if (disc <= 0.0) {\n        discard;\n    }\n    float t = (-b - sqrt(disc))/(2.0*a);\n    if (t < 0.0) {\n        discard;\n    }\n\n    vec3 coord = r0p + rdp * t;\n    if (coord.y < 0.0 || coord.y > length(vPosA - vPosB)) {\n        discard;\n    }\n\n    vec3 color;\n    if (coord.y < vRadA + 0.5 * (length(vPosA - vPosB) - (vRadA + vRadB))) {\n        color = vColA;\n    } else {\n        color = vColB;\n    }\n\n    color = mix(color, vec3(1,1,1), uBondShade);\n\n    R = alignVector(j, i);\n    vec3 normal = normalize(R * vec3(coord.x, 0, coord.z));\n\n    coord = r0 + rd * t;\n    if (uMode == 0) {\n        gl_FragColor = vec4(color, 1);\n    } else if (uMode == 1) {\n        gl_FragColor = vec4(normal * 0.5 + 0.5, 1.0);\n    }\n    gl_FragDepthEXT = -(coord.z - uDepth/2.0)/uDepth;\n}\n",dof:"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uColor;\nuniform sampler2D uDepth;\nuniform float uRes;\nuniform float uDOFPosition;\nuniform float uDOFStrength;\nuniform int leftRight;\n\nvoid main() {\n\n    vec2 samples[64];\n    samples[0] = vec2(0.857612, 0.019885);\n    samples[1] = vec2(0.563809, -0.028071);\n    samples[2] = vec2(0.825599, -0.346856);\n    samples[3] = vec2(0.126584, -0.380959);\n    samples[4] = vec2(0.782948, 0.594322);\n    samples[5] = vec2(0.292148, -0.543265);\n    samples[6] = vec2(0.130700, 0.330220);\n    samples[7] = vec2(0.236088, 0.159604);\n    samples[8] = vec2(-0.305259, 0.810505);\n    samples[9] = vec2(0.269616, 0.923026);\n    samples[10] = vec2(0.484486, 0.371845);\n    samples[11] = vec2(-0.638057, 0.080447);\n    samples[12] = vec2(0.199629, 0.667280);\n    samples[13] = vec2(-0.861043, -0.370583);\n    samples[14] = vec2(-0.040652, -0.996174);\n    samples[15] = vec2(0.330458, -0.282111);\n    samples[16] = vec2(0.647795, -0.214354);\n    samples[17] = vec2(0.030422, -0.189908);\n    samples[18] = vec2(0.177430, -0.721124);\n    samples[19] = vec2(-0.461163, -0.327434);\n    samples[20] = vec2(-0.410012, -0.734504);\n    samples[21] = vec2(-0.616334, -0.626069);\n    samples[22] = vec2(0.590759, -0.726479);\n    samples[23] = vec2(-0.590794, 0.805365);\n    samples[24] = vec2(-0.924561, -0.163739);\n    samples[25] = vec2(-0.323028, 0.526960);\n    samples[26] = vec2(0.642128, 0.752577);\n    samples[27] = vec2(0.173625, -0.952386);\n    samples[28] = vec2(0.759014, 0.330311);\n    samples[29] = vec2(-0.360526, -0.032013);\n    samples[30] = vec2(-0.035320, 0.968156);\n    samples[31] = vec2(0.585478, -0.431068);\n    samples[32] = vec2(-0.244766, -0.906947);\n    samples[33] = vec2(-0.853096, 0.184615);\n    samples[34] = vec2(-0.089061, 0.104648);\n    samples[35] = vec2(-0.437613, 0.285308);\n    samples[36] = vec2(-0.654098, 0.379841);\n    samples[37] = vec2(-0.128663, 0.456572);\n    samples[38] = vec2(0.015980, -0.568170);\n    samples[39] = vec2(-0.043966, -0.771940);\n    samples[40] = vec2(0.346512, -0.071238);\n    samples[41] = vec2(-0.207921, -0.209121);\n    samples[42] = vec2(-0.624075, -0.189224);\n    samples[43] = vec2(-0.120618, 0.689339);\n    samples[44] = vec2(-0.664679, -0.410200);\n    samples[45] = vec2(0.371945, -0.880573);\n    samples[46] = vec2(-0.743251, 0.629998);\n    samples[47] = vec2(-0.191926, -0.413946);\n    samples[48] = vec2(0.449574, 0.833373);\n    samples[49] = vec2(0.299587, 0.449113);\n    samples[50] = vec2(-0.900432, 0.399319);\n    samples[51] = vec2(0.762613, -0.544796);\n    samples[52] = vec2(0.606462, 0.174233);\n    samples[53] = vec2(0.962185, -0.167019);\n    samples[54] = vec2(0.960990, 0.249552);\n    samples[55] = vec2(0.570397, 0.559146);\n    samples[56] = vec2(-0.537514, 0.555019);\n    samples[57] = vec2(0.108491, -0.003232);\n    samples[58] = vec2(-0.237693, -0.615428);\n    samples[59] = vec2(-0.217313, 0.261084);\n    samples[60] = vec2(-0.998966, 0.025692);\n    samples[61] = vec2(-0.418554, -0.527508);\n    samples[62] = vec2(-0.822629, -0.567797);\n    samples[63] = vec2(0.061945, 0.522105);\n\n    float invRes = 1.0/uRes;\n    vec2 coord = gl_FragCoord.xy * invRes;\n\n    float strength = uDOFStrength * uRes/768.0;\n\n    float depth = texture2D(uDepth, coord).r;\n    float range = uDOFPosition - depth;\n    float scale = abs(range);\n\n    vec4 sample = texture2D(uColor, coord);\n    float count = 1.0;\n    for(int i = 0; i < 64; i++) {\n        vec2 p = samples[i];\n        p = coord + scale * 64.0 * strength * p * invRes;\n        float d = texture2D(uDepth, p).r;\n        float r = uDOFPosition - d;\n        float s = abs(r);\n        sample += texture2D(uColor, p) * s;\n        count += s;\n    }\n\n    gl_FragColor = sample/count;\n}",fxaa:"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uTexture;\nuniform float uRes;\n\nvoid main() {\n    float FXAA_SPAN_MAX = 8.0;\n    float FXAA_REDUCE_MUL = 1.0/8.0;\n    float FXAA_REDUCE_MIN = 1.0/128.0;\n\n    vec2 texCoords = gl_FragCoord.xy/uRes;\n\n    vec4 rgbNW = texture2D(uTexture, texCoords + (vec2(-1.0, -1.0) / uRes));\n    vec4 rgbNE = texture2D(uTexture, texCoords + (vec2(1.0, -1.0) / uRes));\n    vec4 rgbSW = texture2D(uTexture, texCoords + (vec2(-1.0, 1.0) / uRes));\n    vec4 rgbSE = texture2D(uTexture, texCoords + (vec2(1.0, 1.0) / uRes));\n    vec4 rgbM  = texture2D(uTexture, texCoords);\n\n    vec4 luma = vec4(0.299, 0.587, 0.114, 1.0);\n    float lumaNW = dot(rgbNW, luma);\n    float lumaNE = dot(rgbNE, luma);\n    float lumaSW = dot(rgbSW, luma);\n    float lumaSE = dot(rgbSE, luma);\n    float lumaM  = dot(rgbM,  luma);\n\n    float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n    float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n    vec2 dir;\n    dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n    dir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n    float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n    float rcpDirMin = 1.0/(min(abs(dir.x), abs(dir.y)) + dirReduce);\n\n    dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) / uRes;\n\n    vec4 rgbA = (1.0/2.0) * \n        (texture2D(uTexture, texCoords.xy + dir * (1.0/3.0 - 0.5)) + \n         texture2D(uTexture, texCoords.xy + dir * (2.0/3.0 - 0.5)));\n    vec4 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * \n        (texture2D(uTexture, texCoords.xy + dir * (0.0/3.0 - 0.5)) +\n         texture2D(uTexture, texCoords.xy + dir * (3.0/3.0 - 0.5)));\n    float lumaB = dot(rgbB, luma);\n\n    if((lumaB < lumaMin) || (lumaB > lumaMax)){\n        gl_FragColor = rgbA;\n    } else {\n        gl_FragColor = rgbB;\n    }\n\n}","textured-quad":"#version 100\nprecision highp float;\n\nattribute vec3 aPosition;\n\nvoid main() {\n    gl_Position = vec4(aPosition, 1);\n}\n\n\n// __split__\n\n\n#version 100\nprecision highp float;\n\nuniform sampler2D uTexture;\nuniform float uRes;\n\nvoid main() {\n    gl_FragColor = texture2D(uTexture, gl_FragCoord.xy/uRes);\n}\n"};t.exports={shaders:r}},function(t,n,e){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=e(8);t.exports=function(t){if(arguments.length>1)throw"Error: The Speck Interactions module has changed!";if(0===arguments.length||"object"!==r(t))throw"Error: Arguments not provided to interactions";var n=void 0===t.scrollZoom||t.scrollZoom,e=t.container,a=t.getRotation,i=t.setRotation,u=t.getTranslation,s=t.setTranslation,l=t.getZoom,c=t.setZoom,f=t.refreshView,h={buttonDown:!1,shiftDown:!1,lastX:0,lastY:0};function p(t){0===t.button&&(h={buttonDown:!0,shiftDown:h.shiftDown,lastX:t.clientX,lastY:t.clientY})}function d(t){if(0===t.button){if(!h.buttonDown)return;h.buttonDown=!1}}function m(t){h.shiftDown=t.shiftKey}function g(t){if(h.buttonDown&&0!==t.buttons){t.preventDefault();var n=t.clientX-h.lastX,e=t.clientY-h.lastY;if(0!==n||0!==e){if(h.lastX=t.clientX,h.lastY=t.clientY,h.shiftDown){var r=u(),c=.001/l();s({x:r.x-n*c,y:r.y+e*c})}else{var p={rotation:new Float32Array(a())};o.rotate(p,n,e),i(p.rotation)}f()}}}function v(t){t.preventDefault(),c(l()*(t.deltaY<0?1/.9:.9)),f()}function y(){e.removeEventListener("mousedown",p),window.removeEventListener("mouseup",d),window.removeEventListener("keydown",m),window.removeEventListener("keyup",m),window.removeEventListener("mousemove",g),e.removeEventListener("wheel",v)}return e.addEventListener("mousedown",p),window.addEventListener("mouseup",d),window.addEventListener("keydown",m),window.addEventListener("keyup",m),window.addEventListener("mousemove",g),n&&e.addEventListener("wheel",v),y}},function(t,n){t.exports={default:{atomScale:.6,relativeAtomScale:1,bondScale:.5,ao:.75,aoRes:256,brightness:.5,outline:0,spf:32,bonds:!1,bondThreshold:1.2,bondShade:.5,atomShade:.5,dofStrength:0,dofPosition:.5,fxaa:1},stickball:{atomScale:.24,relativeAtomScale:.64,bondScale:.5,bonds:!0,bondThreshold:1.2},toon:{ao:0,spf:0,brightness:.5,outline:1},licorice:{atomScale:.1,relativeAtomScale:0,bondScale:1,bonds:!0,bondThreshold:1.2}}},function(t,n,e){"use strict";e.r(n);var r=e(10),o=e(20),a=e(1),i=e.n(a),u=e(0),s=e.n(u),l=e(24),c=e(47);function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function h(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function d(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function m(t,n){return(m=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var g=function(t){function n(t){var e;return function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n),(e=function(t,n){return!n||"object"!==f(n)&&"function"!=typeof n?d(t):n}(this,p(n).call(this,t))).renderNewSequences=e.renderNewSequences.bind(d(e)),e.containerRef=i.a.createRef(),e}var e,r,o;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&m(t,n)}(n,t),e=n,(r=[{key:"componentDidMount",value:function(){var t=this.props,n=t.height,e=t.width,r=t.nodeFillColor,o=t.colorScheme,a=t.customColors,i=t.allowPanningAndZooming;this._fornaContainer=new l.FornaContainer(this.containerRef.current,{initialSize:[e,n],allowPanningAndZooming:i}),this._fornaContainer.addCustomColors(a),this._fornaContainer.changeColorScheme(o),this.renderNewSequences(),void 0!==r&&this._fornaContainer.setOutlineColor(r)}},{key:"componentDidUpdate",value:function(){this.renderNewSequences()}},{key:"renderNewSequences",value:function(){var t=this,n=this.props.sequences;this._fornaContainer&&(this._fornaContainer.clearNodes(),n.forEach((function(n){var e=Object.assign({},n.options,{sequence:n.sequence,structure:n.structure});t._fornaContainer.addRNA(n.structure,e)})))}},{key:"shouldComponentUpdate",value:function(t){var n=this.props,e=n.sequences,r=n.colorScheme;return!c.a(e,t.sequences)||(this._fornaContainer.addCustomColors(t.customColors),this._fornaContainer.changeColorScheme(r),void 0!==t.nodeFillColor&&this._fornaContainer.setOutlineColor(t.nodeFillColor),!1)}},{key:"render",value:function(){return i.a.createElement("div",{id:this.props.id,ref:this.containerRef,style:{outline:"none"}})}}])&&h(e.prototype,r),o&&h(e,o),n}(a.Component);g.propTypes={id:s.a.string,height:s.a.number,width:s.a.number,sequences:s.a.arrayOf(s.a.exact({sequence:s.a.string.isRequired,structure:s.a.string.isRequired,options:s.a.exact({applyForce:s.a.bool,circularizeExternal:s.a.bool,labelInterval:s.a.number,name:s.a.string,avoidOthers:s.a.bool})})),nodeFillColor:s.a.string,colorScheme:s.a.oneOf(["sequence","structure","positions","custom"]),customColors:s.a.exact({domain:s.a.arrayOf(s.a.number),range:s.a.arrayOf(s.a.string),colorValues:s.a.objectOf(s.a.objectOf(s.a.oneOfType([s.a.string,s.a.number])))}),allowPanningAndZooming:s.a.bool,setProps:s.a.func},g.defaultProps={height:500,width:300,sequences:[],allowPanningAndZooming:!0,colorScheme:"sequence"};var v=e(11),y=e(12),b=e(13),x=e(14),M=e(15),w=e(16),_=e(17),k=e(18),S=e(19);e.d(n,"AlignmentChart",(function(){return r.a})),e.d(n,"Circos",(function(){return o.a})),e.d(n,"FornaContainer",(function(){return g})),e.d(n,"Ideogram",(function(){return v.a})),e.d(n,"Igv",(function(){return y.a})),e.d(n,"Molecule2dViewer",(function(){return b.a})),e.d(n,"Molecule3dViewer",(function(){return x.a})),e.d(n,"NeedlePlot",(function(){return M.a})),e.d(n,"NglMoleculeViewer",(function(){return w.a})),e.d(n,"OncoPrint",(function(){return _.a})),e.d(n,"SequenceViewer",(function(){return k.a})),e.d(n,"Speck",(function(){return S.a}))},,function(t,n){t.exports=window.ReactDOM},,,,,,,,,,,,function(t,n,e){"use strict";var r=e(9);function o(t){for(var n,e=[];!(n=t.next()).done;)e.push(n.value);return e}function a(t,n,e){for(var r=0,o=e.length;r<o;){if(t(n,e[r]))return!0;r+=1}return!1}var i=e(5);var u="function"==typeof Object.is?Object.is:function(t,n){return t===n?0!==t||1/t==1/n:t!=t&&n!=n},s=e(3),l=Object.prototype.toString,c=function(){return"[object Arguments]"===l.call(arguments)?function(t){return"[object Arguments]"===l.call(t)}:function(t){return Object(i.a)("callee",t)}}(),f=!{toString:null}.propertyIsEnumerable("toString"),h=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],p=function(){return arguments.propertyIsEnumerable("length")}(),d=function(t,n){for(var e=0;e<t.length;){if(t[e]===n)return!0;e+=1}return!1},m="function"!=typeof Object.keys||p?Object(s.a)((function(t){if(Object(t)!==t)return[];var n,e,r=[],o=p&&c(t);for(n in t)!Object(i.a)(n,t)||o&&"length"===n||(r[r.length]=n);if(f)for(e=h.length-1;e>=0;)n=h[e],Object(i.a)(n,t)&&!d(r,n)&&(r[r.length]=n),e-=1;return r})):Object(s.a)((function(t){return Object(t)!==t?[]:Object.keys(t)})),g=Object(s.a)((function(t){return null===t?"Null":void 0===t?"Undefined":Object.prototype.toString.call(t).slice(8,-1)}));function v(t,n,e,r){var i=o(t);function u(t,n){return y(t,n,e.slice(),r.slice())}return!a((function(t,n){return!a(u,n,t)}),o(n),i)}function y(t,n,e,r){if(u(t,n))return!0;var o,a,s=g(t);if(s!==g(n))return!1;if(null==t||null==n)return!1;if("function"==typeof t["fantasy-land/equals"]||"function"==typeof n["fantasy-land/equals"])return"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](n)&&"function"==typeof n["fantasy-land/equals"]&&n["fantasy-land/equals"](t);if("function"==typeof t.equals||"function"==typeof n.equals)return"function"==typeof t.equals&&t.equals(n)&&"function"==typeof n.equals&&n.equals(t);switch(s){case"Arguments":case"Array":case"Object":if("function"==typeof t.constructor&&"Promise"===(o=t.constructor,null==(a=String(o).match(/^function (\w*)/))?"":a[1]))return t===n;break;case"Boolean":case"Number":case"String":if(typeof t!=typeof n||!u(t.valueOf(),n.valueOf()))return!1;break;case"Date":if(!u(t.valueOf(),n.valueOf()))return!1;break;case"Error":return t.name===n.name&&t.message===n.message;case"RegExp":if(t.source!==n.source||t.global!==n.global||t.ignoreCase!==n.ignoreCase||t.multiline!==n.multiline||t.sticky!==n.sticky||t.unicode!==n.unicode)return!1}for(var l=e.length-1;l>=0;){if(e[l]===t)return r[l]===n;l-=1}switch(s){case"Map":return t.size===n.size&&v(t.entries(),n.entries(),e.concat([t]),r.concat([n]));case"Set":return t.size===n.size&&v(t.values(),n.values(),e.concat([t]),r.concat([n]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var c=m(t);if(c.length!==m(n).length)return!1;var f=e.concat([t]),h=r.concat([n]);for(l=c.length-1;l>=0;){var p=c[l];if(!Object(i.a)(p,n)||!y(n[p],t[p],f,h))return!1;l-=1}return!0}var b=Object(r.a)((function(t,n){return y(t,n,[],[])}));n.a=b}]);
\ No newline at end of file
diff --git a/man/dashbioNglMoleculeViewer.Rd b/man/dashbioNglMoleculeViewer.Rd
index a956ff6b4..df4080c25 100644
--- a/man/dashbioNglMoleculeViewer.Rd
+++ b/man/dashbioNglMoleculeViewer.Rd
@@ -74,7 +74,7 @@ filename: name of the used pdb/cif file
 ext: file extensions (pdb or cif)
 selectedValue: pdbString
 chain: ALL if the whole molecule shoud be displayed, e.g. A for showing only chain A
-aaRange: ALL if the whole molecule shoud be displayed, e.g. 1:50 for showing only 50 atoms
+aaRange: ALL if the whole molecule should be displayed, e.g. 1:50 for showing only 50 atoms
 color: chain color
 chosen.atoms: string of the chosen Atoms, e.g. 50,100,150
               --> chosen eatoms changed to colored 'ball'
diff --git a/package.json b/package.json
index bb51b0d95..37d811295 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "dash-bio",
-  "version": "0.6.0",
+  "version": "0.6.1",
   "description": "Dash components for bioinformatics",
   "repository": {
     "type": "git",
diff --git a/src/lib/components/NglMoleculeViewer.react.js b/src/lib/components/NglMoleculeViewer.react.js
index 56f806e3f..a2c3f45b3 100644
--- a/src/lib/components/NglMoleculeViewer.react.js
+++ b/src/lib/components/NglMoleculeViewer.react.js
@@ -21,9 +21,9 @@ export default class NglMoleculeViewer extends Component {
     }
 }
 
-const defaultHeight = '500px';
+const defaultHeight = '600px';
 
-const defaultWidth = '500px';
+const defaultWidth = '600px';
 
 const defaultStageParameters = {
     quality: 'medium',
@@ -144,7 +144,7 @@ NglMoleculeViewer.propTypes = {
      * ext: file extensions (pdb or cif)
      * selectedValue: pdbString
      * chain: ALL if the whole molecule shoud be displayed, e.g. A for showing only chain A
-     * aaRange: ALL if the whole molecule shoud be displayed, e.g. 1:50 for showing only 50 atoms
+     * aaRange: ALL if the whole molecule should be displayed, e.g. 1:50 for showing only 50 atoms
      * color: chain color
      * chosen.atoms: string of the chosen Atoms, e.g. 50,100,150
      *               --> chosen eatoms changed to colored 'ball'
diff --git a/src/lib/fragments/NglMoleculeViewer.react.js b/src/lib/fragments/NglMoleculeViewer.react.js
index e00d5b4f1..11d7cc288 100644
--- a/src/lib/fragments/NglMoleculeViewer.react.js
+++ b/src/lib/fragments/NglMoleculeViewer.react.js
@@ -20,12 +20,13 @@ export default class NglMoleculeViewer extends Component {
             orientationMatrix: null,
             structuresList: [],
         };
+        this.ref = React.createRef();
     }
 
     componentDidMount() {
-        const {id, stageParameters, width, height} = this.props;
+        const {stageParameters, width, height} = this.props;
         const params = {...stageParameters};
-        const stage = new Stage(id, params);
+        const stage = new Stage(this.ref.current, params);
         const orientationMatrix = stage.viewerControls.getOrientation();
 
         const widthStr = isNumeric(width) ? width + 'px' : width;
@@ -36,7 +37,14 @@ export default class NglMoleculeViewer extends Component {
     }
 
     shouldComponentUpdate(prevProps, nextProps) {
-        const {stageParameters, data, downloadImage, molStyles} = this.props;
+        const {
+            stageParameters,
+            data,
+            downloadImage,
+            molStyles,
+            height,
+            width,
+        } = this.props;
 
         // check if data has changed
         if (data !== null && prevProps.data !== null) {
@@ -79,16 +87,35 @@ export default class NglMoleculeViewer extends Component {
             return true;
         }
 
+        // check if Height or Width has been changed
+        if (
+            !equals(prevProps.height, height) ||
+            !equals(prevProps.width, width)
+        ) {
+            return true;
+        }
+
         // no update since neither the data nor the stage paramas have changed
         return false;
     }
 
     componentDidUpdate() {
-        const {data, stageParameters, downloadImage, sideByside} = this.props;
+        const {
+            data,
+            stageParameters,
+            downloadImage,
+            sideByside,
+            height,
+            width,
+        } = this.props;
         const {stage, structuresList} = this.state;
 
+        const widthStr = isNumeric(width) ? width + 'px' : width;
+        const heightStr = isNumeric(height) ? height + 'px' : height;
+
         // update the stage with the new stage params
         stage.setParameters(stageParameters);
+        stage.setSize(widthStr, heightStr);
 
         if (
             downloadImage === undefined ||
@@ -280,7 +307,7 @@ export default class NglMoleculeViewer extends Component {
 
     render() {
         const {id} = this.props;
-        return <div id={id} />;
+        return <div id={id} ref={this.ref} />;
     }
 }