# Smart random exploration

This experiment compares two situations, with smart start and without smart start. In the case without smart start the agent starts in the same state every iteration. In the case with smart start the agent starts in the state which has the lowest kernel density estimation compared to all visited states.

The state with the lowest kernel density is calculated according to $i = \underset{i \in D}{\arg\min}\frac{1}{|D|}\sum_{j \in D}^Ne^{-\sum_{d = 1}^{D_N}(i_d - j_d)^2 / C}$



In [1]:

import numpy as np
import tensorflow as tf
from drl.replaybuffer import ReplayBufferTF
from drl.rrtexploration import Trajectory
from drl.exploration import OrnSteinUhlenbeckNoise
import time




In [7]:

import plotly
import plotly.offline as py
from plotly.graph_objs import *
from plotly import tools
plotly.offline.init_notebook_mode()

scene=Scene(
xaxis=XAxis(
gridcolor='rgb(255, 255, 255)',
zerolinecolor='rgb(255, 255, 255)',
showbackground=True,
backgroundcolor='rgb(230, 230,230)'
),
yaxis=YAxis(
gridcolor='rgb(255, 255, 255)',
zerolinecolor='rgb(255, 255, 255)',
showbackground=True,
backgroundcolor='rgb(230, 230,230)'
),
zaxis=ZAxis(
gridcolor='rgb(255, 255, 255)',
zerolinecolor='rgb(255, 255, 255)',
showbackground=True,
backgroundcolor='rgb(230, 230,230)'
)
)




if(!window.Plotly){define('plotly', function(require, exports, module) {/**
* plotly.js v1.16.2
e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},d.getDistanceLimits=function(t){var e=this.radius.bounds;return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},d.toJSON=function(){return this.recalcMatrix(this.lastT()),{center:this.computedCenter.slice(),rotation:this.computedRotation.slice(),distance:Math.log(this.computedRadius[0]),zoomMin:this.radius.bounds[0][0],zoomMax:this.radius.bounds[1][0]}},d.fromJSON=function(t){var e=this.lastT(),r=t.center;r&&this.center.set(e,r[0],r[1],r[2]);var n=t.rotation;n&&this.rotation.set(e,n[0],n[1],n[2],n[3]);var i=t.distance;i&&i>0&&this.radius.set(e,Math.log(i)),this.setDistanceLimits(t.zoomMin,t.zoomMax)}},{"./lib/quatFromFrame":37,"filtered-vector":21,"gl-mat4/fromQuat":140,"gl-mat4/invert":143,"gl-mat4/lookAt":144}],39:[function(t,e,r){"use strict";function n(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function i(t){return Math.min(1,Math.max(-1,t))}function o(t){var e=Math.abs(t[0]),r=Math.abs(t[1]),n=Math.abs(t[2]),i=[0,0,0];e>Math.max(r,n)?i[2]=1:r>Math.max(e,n)?i[0]=1:i[1]=1;for(var o=0,a=0,s=0;3>s;++s)o+=t[s]*t[s],a+=i[s]*t[s];for(var s=0;3>s;++s)i[s]-=a/o*t[s];return f(i,i),i}function a(t,e,r,n,i,o,a,s){this.center=l(r),this.up=l(n),this.right=l(i),this.radius=l([o]),this.angle=l([a,s]),this.angle.bounds=[[-(1/0),-Math.PI/2],[1/0,Math.PI/2]],this.setDistanceLimits(t,e),this.computedCenter=this.center.curve(0),this.computedUp=this.up.curve(0),this.computedRight=this.right.curve(0),this.computedRadius=this.radius.curve(0),this.computedAngle=this.angle.curve(0),this.computedToward=[0,0,0],this.computedEye=[0,0,0],this.computedMatrix=new Array(16);for(var u=0;16>u;++u)this.computedMatrix[u]=.5;this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.up||[0,1,0],i=t.right||o(r),s=t.radius||1,l=t.theta||0,u=t.phi||0;if(e=[].slice.call(e,0,3),r=[].slice.call(r,0,3),f(r,r),i=[].slice.call(i,0,3),f(i,i),"eye"in t){var c=t.eye,p=[c[0]-e[0],c[1]-e[1],c[2]-e[2]];h(i,p,r),n(i[0],i[1],i[2])<1e-6?i=o(r):f(i,i),s=n(p[0],p[1],p[2]);var v=d(r,p)/s,m=d(i,p)/s;u=Math.acos(v),l=Math.acos(m)}return s=Math.log(s),new a(t.zoomMin,t.zoomMax,e,r,i,s,l,u)}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/invert"),c=t("gl-mat4/rotate"),h=t("gl-vec3/cross"),f=t("gl-vec3/normalize"),d=t("gl-vec3/dot"),p=a.prototype;p.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},p.getDistanceLimits=function(t){var e=this.radius.bounds[0];return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},p.recalcMatrix=function(t){this.center.curve(t),this.up.curve(t),this.right.curve(t),this.radius.curve(t),this.angle.curve(t);for(var e=this.computedUp,r=this.computedRight,i=0,o=0,a=0;3>a;++a)o+=e[a]*r[a],i+=e[a]*e[a];for(var s=Math.sqrt(i),l=0,a=0;3>a;++a)r[a]-=e[a]*o/i,l+=r[a]*r[a],e[a]/=s;for(var u=Math.sqrt(l),a=0;3>a;++a)r[a]/=u;var c=this.computedToward;h(c,e,r),f(c,c);for(var d=Math.exp(this.computedRadius[0]),p=this.computedAngle[0],v=this.computedAngle[1],m=Math.cos(p),g=Math.sin(p),y=Math.cos(v),b=Math.sin(v),x=this.computedCenter,_=m*y,w=g*y,M=b,k=-m*b,A=-g*b,T=y,E=this.computedEye,S=this.computedMatrix,a=0;3>a;++a){var L=_*r[a]+w*c[a]+M*e[a];S[4*a+1]=k*r[a]+A*c[a]+T*e[a],S[4*a+2]=L,S[4*a+3]=0}var z=S[1],I=S[5],P=S[9],C=S[2],R=S[6],D=S[10],O=I*D-P*R,F=P*C-z*D,j=z*R-I*C,N=n(O,F,j);O/=N,F/=N,j/=N,S[0]=O,S[4]=F,S[8]=j;for(var a=0;3>a;++a)E[a]=x[a]+S[2+4*a]*d;for(var a=0;3>a;++a){for(var l=0,B=0;3>B;++B)l+=S[a+4*B]*E[B];S[12+a]=-l}S[15]=1},p.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;16>n;++n)e[n]=r[n];return e}return r};var v=[0,0,0];p.rotate=function(t,e,r,n){if(this.angle.move(t,e,r),n){this.recalcMatrix(t);var i=this.computedMatrix;v[0]=i[2],v[1]=i[6],v[2]=i[10];for(var o=this.computedUp,a=this.computedRight,s=this.computedToward,l=0;3>l;++l)i[4*l]=o[l],i[4*l+1]=a[l],i[4*l+2]=s[l];c(i,i,n,v);for(var l=0;3>l;++l)o[l]=i[4*l],a[l]=i[4*l+1];this.up.set(t,o[0],o[1],o[2]),this.right.set(t,a[0],a[1],a[2])}},p.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var o=this.computedMatrix,a=(Math.exp(this.computedRadius[0]),o[1]),s=o[5],l=o[9],u=n(a,s,l);a/=u,s/=u,l/=u;var c=o[0],h=o[4],f=o[8],d=c*a+h*s+f*l;c-=a*d,h-=s*d,f-=l*d;var p=n(c,h,f);c/=p,h/=p,f/=p;var v=c*e+a*r,m=h*e+s*r,g=f*e+l*r;this.center.move(t,v,m,g);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+i),this.radius.set(t,Math.log(y))},p.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},p.setMatrix=function(t,e,r,o){var a=1;"number"==typeof r&&(a=0|r),(0>a||a>3)&&(a=1);var s=(a+2)%3;e||(this.recalcMatrix(t),e=this.computedMatrix);var l=e[a],c=e[a+4],h=e[a+8];if(o){var f=Math.abs(l),d=Math.abs(c),p=Math.abs(h),v=Math.max(f,d,p);f===v?(l=0>l?-1:1,c=h=0):p===v?(h=0>h?-1:1,l=c=0):(c=0>c?-1:1,l=h=0)}else{var m=n(l,c,h);l/=m,c/=m,h/=m}var g=e[s],y=e[s+4],b=e[s+8],x=g*l+y*c+b*h;g-=l*x,y-=c*x,b-=h*x;var _=n(g,y,b);g/=_,y/=_,b/=_;var w=c*b-h*y,M=h*g-l*b,k=l*y-c*g,A=n(w,M,k);w/=A,M/=A,k/=A,this.center.jump(t,G,H,X),this.radius.idle(t),this.up.jump(t,l,c,h),this.right.jump(t,g,y,b);var T,E;if(2===a){var S=e[1],L=e[5],z=e[9],I=S*g+L*y+z*b,P=S*w+L*M+z*k;T=0>O?-Math.PI/2:Math.PI/2,E=Math.atan2(P,I)}else{var C=e[2],R=e[6],D=e[10],O=C*l+R*c+D*h,F=C*g+R*y+D*b,j=C*w+R*M+D*k;T=Math.asin(i(O)),E=Math.atan2(j,F)}this.angle.jump(t,E,T),this.recalcMatrix(t);var N=e[2],B=e[6],U=e[10],V=this.computedMatrix;u(V,e);var q=V[15],G=V[12]/q,H=V[13]/q,X=V[14]/q,Y=Math.exp(this.computedRadius[0]);this.center.jump(t,G-N*Y,H-B*Y,X-U*Y)},p.lastT=function(){return Math.max(this.center.lastT(),this.up.lastT(),this.right.lastT(),this.radius.lastT(),this.angle.lastT())},p.idle=function(t){this.center.idle(t),this.up.idle(t),this.right.idle(t),this.radius.idle(t),this.angle.idle(t)},p.flush=function(t){this.center.flush(t),this.up.flush(t),this.right.flush(t),this.radius.flush(t),this.angle.flush(t)},p.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},p.lookAt=function(t,e,r,o){this.recalcMatrix(t),e=e||this.computedEye,r=r||this.computedCenter,o=o||this.computedUp;var a=o[0],s=o[1],l=o[2],u=n(a,s,l);if(!(1e-6>u)){a/=u,s/=u,l/=u;var c=e[0]-r[0],h=e[1]-r[1],f=e[2]-r[2],d=n(c,h,f);if(!(1e-6>d)){c/=d,h/=d,f/=d;var p=this.computedRight,v=p[0],m=p[1],g=p[2],y=a*v+s*m+l*g;v-=y*a,m-=y*s,g-=y*l;var b=n(v,m,g);if(!(.01>b&&(v=s*f-l*h,m=l*c-a*f,g=a*h-s*c,b=n(v,m,g),1e-6>b))){v/=b,m/=b,g/=b,this.up.set(t,a,s,l),this.right.set(t,v,m,g),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(d));var x=s*g-l*m,_=l*v-a*g,w=a*m-s*v,M=n(x,_,w);x/=M,_/=M,w/=M;var k=a*c+s*h+l*f,A=v*c+m*h+g*f,T=x*c+_*h+w*f,E=Math.asin(i(k)),S=Math.atan2(T,A),L=this.angle._state,z=L[L.length-1],I=L[L.length-2];z%=2*Math.PI;var P=Math.abs(z+2*Math.PI-S),C=Math.abs(z-S),R=Math.abs(z-2*Math.PI-S);C>P&&(z+=2*Math.PI),C>R&&(z-=2*Math.PI),this.angle.jump(this.angle.lastT(),z,I),this.angle.set(t,S,E)}}}}},{"filtered-vector":21,"gl-mat4/invert":143,"gl-mat4/rotate":147,"gl-vec3/cross":24,"gl-vec3/dot":25,"gl-vec3/normalize":28}],40:[function(t,e,r){"use strict";function n(t,e){this._controllerNames=Object.keys(t),this._controllerList=this._controllerNames.map(function(e){return t[e]}),this._mode=e,this._active=t[e],this._active||(this._mode="turntable",this._active=t.turntable),this.modes=this._controllerNames,this.computedMatrix=this._active.computedMatrix,this.computedEye=this._active.computedEye,this.computedUp=this._active.computedUp,this.computedCenter=this._active.computedCenter,this.computedRadius=this._active.computedRadius}function i(t){t=t||{};var e=t.eye||[0,0,1],r=t.center||[0,0,0],i=t.up||[0,1,0],l=t.distanceLimits||[0,1/0],u=t.mode||"turntable",c=o(),h=a(),f=s();return c.setDistanceLimits(l[0],l[1]),c.lookAt(0,e,r,i),h.setDistanceLimits(l[0],l[1]),h.lookAt(0,e,r,i),f.setDistanceLimits(l[0],l[1]),f.lookAt(0,e,r,i),new n({turntable:c,orbit:h,matrix:f},u)}e.exports=i;var o=t("turntable-camera-controller"),a=t("orbit-camera-controller"),s=t("matrix-camera-controller"),l=n.prototype,u=[["flush",1],["idle",1],["lookAt",4],["rotate",4],["pan",4],["translate",4],["setMatrix",2],["setDistanceLimits",2],["setDistance",2]];u.forEach(function(t){for(var e=t[0],r=[],n=0;n<t[1];++n)r.push("a"+n);var i="var cc=this._controllerList;for(var i=0;i<cc.length;++i){cc[i]."+t[0]+"("+r.join()+")}";l[e]=Function.apply(null,r.concat(i))}),l.recalcMatrix=function(t){this._active.recalcMatrix(t)},l.getDistance=function(t){return this._active.getDistance(t)},l.getDistanceLimits=function(t){return this._active.getDistanceLimits(t)},l.lastT=function(){return this._active.lastT()},l.setMode=function(t){if(t!==this._mode){var e=this._controllerNames.indexOf(t);if(!(0>e)){var r=this._active,n=this._controllerList[e],i=Math.max(r.lastT(),n.lastT());r.recalcMatrix(i),n.setMatrix(i,r.computedMatrix),this._active=n,this._mode=t,this.computedMatrix=this._active.computedMatrix,this.computedEye=this._active.computedEye,this.computedUp=this._active.computedUp,this.computedCenter=this._active.computedCenter,this.computedRadius=this._active.computedRadius}}},l.getMode=function(){return this._mode}},{"matrix-camera-controller":29,"orbit-camera-controller":38,"turntable-camera-controller":39}],41:[function(t,e,r){function n(t,e){return o(i(t,e))}e.exports=n;var i=t("alpha-complex"),o=t("simplicial-complex-boundary")},{"alpha-complex":42,"simplicial-complex-boundary":45}],42:[function(t,e,r){"use strict";function n(t,e){return i(e).filter(function(r){for(var n=new Array(r.length),i=0;i<r.length;++i)n[i]=e[r[i]];return o(n)*t<1})}e.exports=n;var i=t("delaunay-triangulate"),o=t("circumradius")},{circumradius:43,"delaunay-triangulate":120}],43:[function(t,e,r){function n(t){for(var e=i(t),r=0,n=0;n<t.length;++n)for(var o=t[n],a=0;a<e.length;++a)r+=Math.pow(o[a]-e[a],2);return Math.sqrt(r/t.length)}e.exports=n;var i=t("circumcenter")},{circumcenter:44}],44:[function(t,e,r){"use strict";function n(t,e){for(var r=0,n=t.length,i=0;n>i;++i)r+=t[i]*e[i];return r}function i(t){var e=t.length;if(0===e)return[];var r=(t[0].length,a([t.length+1,t.length+1],1)),i=a([t.length+1],1);r[e][e]=0;for(var o=0;e>o;++o){for(var l=0;o>=l;++l)r[l][o]=r[o][l]=2*n(t[o],t[l]);i[o]=n(t[o],t[o])}for(var u=s(r,i),c=0,h=u[e+1],o=0;o<h.length;++o)c+=h[o];for(var f=new Array(e),o=0;e>o;++o){for(var h=u[o],d=0,l=0;l<h.length;++l)d+=h[l];f[o]=d/c}return f}function o(t){if(0===t.length)return[];for(var e=t[0].length,r=a([e]),n=i(t),o=0;o<t.length;++o)for(var s=0;e>s;++s)r[s]+=t[o][s]*n[o];return r}var a=t("dup"),s=t("robust-linear-solve");o.barycenetric=i,e.exports=o},{dup:121,"robust-linear-solve":436}],45:[function(t,e,r){"use strict";function n(t){return o(i(t))}e.exports=n;var i=t("boundary-cells"),o=t("reduce-simplicial-complex")},{"boundary-cells":46,"reduce-simplicial-complex":49}],46:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;e>n;++n)r+=t[n].length;for(var i=new Array(r),o=0,n=0;e>n;++n)for(var a=t[n],s=a.length,l=0;s>l;++l)for(var u=i[o++]=new Array(s-1),c=1;s>c;++c)u[c-1]=a[(l+c)%s];return i}e.exports=n},{}],47:[function(t,e,r){"use strict";function n(t){for(var e=1,r=1;r<t.length;++r)for(var n=0;r>n;++n)if(t[r]<t[n])e=-e;else if(t[n]===t[r])return 0;return e}e.exports=n},{}],48:[function(t,e,r){"use strict";function n(t,e){return i(t,e)||o(t)-o(e)}var i=t("compare-cell"),o=t("cell-orientation");e.exports=n},{"cell-orientation":47,"compare-cell":107}],49:[function(t,e,r){"use strict";function n(t){t.sort(o);for(var e=t.length,r=0,n=0;e>n;++n){var s=t[n],l=a(s);if(0!==l){if(r>0){var u=t[r-1];if(0===i(s,u)&&a(u)!==l){r-=1;continue}}t[r++]=s}}return t.length=r,t}var i=t("compare-cell"),o=t("compare-oriented-cell"),a=t("cell-orientation");e.exports=n},{"cell-orientation":47,"compare-cell":107,"compare-oriented-cell":48}],50:[function(t,e,r){"use strict";var n=function(){function t(t){return!Array.isArray(t)&&null!==t&&"object"==typeof t}function e(t,e,r){for(var n=(e-t)/Math.max(r-1,1),i=[],o=0;r>o;o++)i.push(t+o*n);return i}function r(){for(var t=[].slice.call(arguments),e=t.map(function(t){return t.length}),r=Math.min.apply(null,e),n=[],i=0;r>i;i++){n[i]=[];for(var o=0;o<t.length;++o)n[i][o]=t[o][i]}return n}function n(t,e,r){for(var n=Math.min.apply(null,[t.length,e.length,r.length]),i=[],o=0;n>o;o++)i.push([t[o],e[o],r[o]]);return i}function i(t){function e(t){for(var n=0;n<t.length;n++)Array.isArray(t[n])?e(t[n],r):r+=t[n]}var r=0;return e(t,r),r}function o(t){for(var e=[],r=0;r<t.length;++r){e[r]=[];for(var n=0;n<t[r].length;++n)e[r][n]=t[r][n]}return e}function a(t){for(var e=[],r=0;r<t.length;++r)e[r]=t[r];return e}function s(t,e){if(t.length!==e.length)return!1;for(var r=t.length;r--;)if(t[r]!==e[r])return!1;return!0}function l(t,e){var r,n;if("string"!=typeof t)return t;if(r=[],"#"===t[0]?(t=t.substr(1),3===t.length&&(t+=t),n=parseInt(t,16),r[0]=n>>16&255,r[1]=n>>8&255,r[2]=255&n):h.test(t)&&(n=t.match(f),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3])),!e)for(var i=0;3>i;++i)r[i]=r[i]/255;return r}function u(t,e){var r,n;if("string"!=typeof t)return t;if(r=[],"#"===t[0]?(t=t.substr(1),3===t.length&&(t+=t),n=parseInt(t,16),r[0]=n>>16&255,r[1]=n>>8&255,r[2]=255&n):h.test(t)&&(n=t.match(f),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3]),n[4]?r[3]=parseFloat(n[4]):r[3]=1),!e)for(var i=0;3>i;++i)r[i]=r[i]/255;return r}var c={},h=/^rgba?$$\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(,.*)?$$$/,f=/^rgba?$$\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,?\s*(.*)?$$$/;return c.isPlainObject=t,c.linspace=e,c.zip3=n,c.sum=i,c.zip=r,c.isEqual=s,c.copy2D=o,c.copy1D=a,c.str2RgbArray=l,c.str2RgbaArray=u,c};e.exports=n()},{}],51:[function(t,e,r){"use strict";"use restrict";function n(t){var e=32;return t&=-t,t&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}var i=32;r.INT_BITS=i,r.INT_MAX=2147483647,r.INT_MIN=-1<<i-1,r.sign=function(t){return(t>0)-(0>t)},r.abs=function(t){var e=t>>i-1;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(e>t)},r.max=function(t,e){return t^(t^e)&-(e>t)},r.isPow2=function(t){return!(t&t-1||!t)},r.log2=function(t){var e,r;return e=(t>65535)<<4,t>>>=e,r=(t>255)<<3,t>>>=r,e|=r,r=(t>15)<<2,t>>>=r,e|=r,r=(t>3)<<1,t>>>=r,e|=r,e|t>>1},r.log10=function(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},r.popCount=function(t){return t-=t>>>1&1431655765,t=(858993459&t)+(t>>>2&858993459),16843009*(t+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,t&=15,27030>>>t&1};var o=new Array(256);!function(t){for(var e=0;256>e;++e){var r=e,n=e,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;t[e]=n<<i&255}}(o),r.reverse=function(t){return o[255&t]<<24|o[t>>>8&255]<<16|o[t>>>16&255]<<8|o[t>>>24&255]},r.interleave2=function(t,e){return t&=65535,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e&=65535,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1},r.deinterleave2=function(t,e){return t=t>>>e&1431655765,t=858993459&(t|t>>>1),t=252645135&(t|t>>>2),t=16711935&(t|t>>>4),t=65535&(t|t>>>16),t<<16>>16},r.interleave3=function(t,e,r){return t&=1023,t=4278190335&(t|t<<16),t=251719695&(t|t<<8),t=3272356035&(t|t<<4),t=1227133513&(t|t<<2),e&=1023,e=4278190335&(e|e<<16),e=251719695&(e|e<<8),e=3272356035&(e|e<<4),e=1227133513&(e|e<<2),t|=e<<1,r&=1023,r=4278190335&(r|r<<16),r=251719695&(r|r<<8),r=3272356035&(r|r<<4),r=1227133513&(r|r<<2),t|r<<2},r.deinterleave3=function(t,e){return t=t>>>e&1227133513,t=3272356035&(t|t>>>2),t=251719695&(t|t>>>4),t=4278190335&(t|t>>>8),t=1023&(t|t>>>16),t<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],52:[function(t,e,r){function n(t,e){return d.isUndefined(e)?""+e:d.isNumber(e)&&!isFinite(e)?e.toString():d.isFunction(e)||d.isRegExp(e)?e.toString():e}function i(t,e){return d.isString(t)?t.length<e?t:t.slice(0,e):t}function o(t){return i(JSON.stringify(t.actual,n),128)+" "+t.operator+" "+i(JSON.stringify(t.expected,n),128)}function a(t,e,r,n,i){throw new m.AssertionError({message:r,actual:t,expected:e,operator:n,stackStartFunction:i})}function s(t,e){t||a(t,!0,e,"==",m.ok)}function l(t,e){if(t===e)return!0;if(d.isBuffer(t)&&d.isBuffer(e)){if(t.length!=e.length)return!1;for(var r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}return d.isDate(t)&&d.isDate(e)?t.getTime()===e.getTime():d.isRegExp(t)&&d.isRegExp(e)?t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase:d.isObject(t)||d.isObject(e)?c(t,e):t==e}function u(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function c(t,e){if(d.isNullOrUndefined(t)||d.isNullOrUndefined(e))return!1;if(t.prototype!==e.prototype)return!1;if(d.isPrimitive(t)||d.isPrimitive(e))return t===e;var r=u(t),n=u(e);if(r&&!n||!r&&n)return!1;if(r)return t=p.call(t),e=p.call(e),l(t,e);var i,o,a=g(t),s=g(e);if(a.length!=s.length)return!1;for(a.sort(),s.sort(),o=a.length-1;o>=0;o--)if(a[o]!=s[o])return!1;for(o=a.length-1;o>=0;o--)if(i=a[o],!l(t[i],e[i]))return!1;return!0}function h(t,e){return t&&e?"[object RegExp]"==Object.prototype.toString.call(e)?e.test(t):t instanceof e?!0:e.call({},t)===!0:!1}function f(t,e,r,n){var i;d.isString(r)&&(n=r,r=null);try{e()}catch(o){i=o}if(n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&a(i,r,"Missing expected exception"+n),!t&&h(i,r)&&a(i,r,"Got unwanted exception"+n),t&&i&&r&&!h(i,r)||!t&&i)throw i}var d=t("util/"),p=Array.prototype.slice,v=Object.prototype.hasOwnProperty,m=e.exports=s;m.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=o(this),this.generatedMessage=!0);var e=t.stackStartFunction||a;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=e.name,s=n.indexOf("\n"+i);if(s>=0){var l=n.indexOf("\n",s+1);n=n.substring(l+1)}this.stack=n}}},d.inherits(m.AssertionError,Error),m.fail=a,m.ok=s,m.equal=function(t,e,r){t!=e&&a(t,e,r,"==",m.equal)},m.notEqual=function(t,e,r){t==e&&a(t,e,r,"!=",m.notEqual)},m.deepEqual=function(t,e,r){l(t,e)||a(t,e,r,"deepEqual",m.deepEqual)},m.notDeepEqual=function(t,e,r){l(t,e)&&a(t,e,r,"notDeepEqual",m.notDeepEqual)},m.strictEqual=function(t,e,r){t!==e&&a(t,e,r,"===",m.strictEqual)},m.notStrictEqual=function(t,e,r){t===e&&a(t,e,r,"!==",m.notStrictEqual)},m.throws=function(t,e,r){f.apply(this,[!0].concat(p.call(arguments)))},m.doesNotThrow=function(t,e){f.apply(this,[!1].concat(p.call(arguments)))},m.ifError=function(t){if(t)throw t};var g=Object.keys||function(t){var e=[];for(var r in t)v.call(t,r)&&e.push(r);return e}},{"util/":62}],53:[function(t,e,r){(function(e){"use strict";function n(){try{var t=new Uint8Array(1);return t.foo=function(){return 42},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(e){return!1}}function i(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(t){return this instanceof o?(o.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof t?a(this,t):"string"==typeof t?s(this,t,arguments.length>1?arguments[1]:"utf8"):l(this,t)):arguments.length>1?new o(t,arguments[1]):new o(t)}function a(t,e){if(t=v(t,0>e?0:0|m(e)),!o.TYPED_ARRAY_SUPPORT)for(var r=0;e>r;r++)t[r]=0;return t}function s(t,e,r){"string"==typeof r&&""!==r||(r="utf8");var n=0|y(e,r);return t=v(t,n),t.write(e,r),t}function l(t,e){if(o.isBuffer(e))return u(t,e);if(K(e))return c(t,e);if(null==e)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(e.buffer instanceof ArrayBuffer)return h(t,e);if(e instanceof ArrayBuffer)return f(t,e)}return e.length?d(t,e):p(t,e)}function u(t,e){var r=0|m(e.length);return t=v(t,r),e.copy(t,0,0,r),t}function c(t,e){var r=0|m(e.length);t=v(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function h(t,e){var r=0|m(e.length);t=v(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function f(t,e){return e.byteLength,o.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=o.prototype):t=h(t,new Uint8Array(e)),t}function d(t,e){var r=0|m(e.length);t=v(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function p(t,e){var r,n=0;"Buffer"===e.type&&K(e.data)&&(r=e.data,n=0|m(r.length)),t=v(t,n);for(var i=0;n>i;i+=1)t[i]=255&r[i];return t}function v(t,e){o.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=o.prototype):t.length=e;var r=0!==e&&e<=o.poolSize>>>1;return r&&(t.parent=J),t}function m(t){if(t>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function g(t,e){if(!(this instanceof g))return new g(t,e);var r=new o(t,e);return delete r.parent,r}function y(t,e){"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"binary":case"raw":case"raws":return r;case"utf8":case"utf-8":return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(t).length;default:if(n)return q(t).length;e=(""+e).toLowerCase(),n=!0}}function b(t,e,r){var n=!1;if(e=0|e,r=void 0===r||r===1/0?this.length:0|r,t||(t="utf8"),0>e&&(e=0),r>this.length&&(r=this.length),e>=r)return"";for(;;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return L(this,e,r);case"binary":return z(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function x(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var o=e.length;if(o%2!==0)throw new Error("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;n>a;a++){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))throw new Error("Invalid hex string");t[r+a]=s}return a}function _(t,e,r,n){return Y(q(e,t.length-r),t,r,n)}function w(t,e,r,n){return Y(G(e),t,r,n)}function M(t,e,r,n){return w(t,e,r,n)}function k(t,e,r,n){return Y(X(e),t,r,n)}function A(t,e,r,n){return Y(H(e,t.length-r),t,r,n)}function T(t,e,r){return 0===e&&r===t.length?W.fromByteArray(t):W.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;r>i;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(r>=i+s){var l,u,c,h;switch(s){case 1:128>o&&(a=o);break;case 2:l=t[i+1],128===(192&l)&&(h=(31&o)<<6|63&l,h>127&&(a=h));break;case 3:l=t[i+1],u=t[i+2],128===(192&l)&&128===(192&u)&&(h=(15&o)<<12|(63&l)<<6|63&u,h>2047&&(55296>h||h>57343)&&(a=h));break;case 4:l=t[i+1],u=t[i+2],c=t[i+3],128===(192&l)&&128===(192&u)&&128===(192&c)&&(h=(15&o)<<18|(63&l)<<12|(63&u)<<6|63&c,h>65535&&1114112>h&&(a=h))}}null===a?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=s}return S(n)}function S(t){var e=t.length;if($>=e)return String.fromCharCode.apply(String,t);for(var r="",n=0;e>n;)r+=String.fromCharCode.apply(String,t.slice(n,n+=$));return r}function L(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;r>i;i++)n+=String.fromCharCode(127&t[i]);return n}function z(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;r>i;i++)n+=String.fromCharCode(t[i]);return n}function I(t,e,r){var n=t.length;(!e||0>e)&&(e=0),(!r||0>r||r>n)&&(r=n);for(var i="",o=e;r>o;o++)i+=V(t[o]);return i}function P(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function C(t,e,r){if(t%1!==0||0>t)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,r,n,i,a){if(!o.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");if(e>i||a>e)throw new RangeError("value is out of bounds");if(r+n>t.length)throw new RangeError("index out of range")}function D(t,e,r,n){0>e&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);o>i;i++)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function O(t,e,r,n){0>e&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);o>i;i++)t[r+i]=e>>>8*(n?i:3-i)&255}function F(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("index out of range");if(0>r)throw new RangeError("index out of range")}function j(t,e,r,n,i){return i||F(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(t,e,r,n,23,4),r+4}function N(t,e,r,n,i){return i||F(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(t,e,r,n,52,8),r+8}function B(t){if(t=U(t).replace(Q,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function U(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function V(t){return 16>t?"0"+t.toString(16):t.toString(16)}function q(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],a=0;n>a;a++){if(r=t.charCodeAt(a),r>55295&&57344>r){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(56320>r){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,128>r){if((e-=1)<0)break;o.push(r)}else if(2048>r){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(65536>r){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(1114112>r))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function G(t){for(var e=[],r=0;r<t.length;r++)e.push(255&t.charCodeAt(r));return e}function H(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);a++)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function X(t){return W.toByteArray(B(t))}function Y(t,e,r,n){for(var i=0;n>i&&!(i+r>=e.length||i>=t.length);i++)e[i+r]=t[i];return i}var W=t("base64-js"),Z=t("ieee754"),K=t("isarray");r.Buffer=o,r.SlowBuffer=g,r.INSPECT_MAX_BYTES=50,o.poolSize=8192;var J={};o.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:n(),o._augment=function(t){return t.__proto__=o.prototype,t},o.TYPED_ARRAY_SUPPORT?(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})):(o.prototype.length=void 0,o.prototype.parent=void 0),o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);a>i&&t[i]===e[i];)++i;return i!==a&&(r=t[i],n=e[i]),n>r?-1:r>n?1:0},o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(t,e){if(!K(t))throw new TypeError("list argument must be an Array of Buffers.");if(0===t.length)return new o(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;r++)e+=t[r].length;var n=new o(e),i=0;for(r=0;r<t.length;r++){var a=t[r];a.copy(n,i),i+=a.length}return n},o.byteLength=y,o.prototype._isBuffer=!0,o.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?E(this,0,t):b.apply(this,arguments)},o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:0===o.compare(this,t)},o.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},o.prototype.compare=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?0:o.compare(this,t)},o.prototype.indexOf=function(t,e){function r(t,e,r){for(var n=-1,i=0;r+i<t.length;i++)if(t[r+i]===e[-1===n?0:i-n]){if(-1===n&&(n=i),i-n+1===e.length)return r+n}else n=-1;return-1}if(e>2147483647?e=2147483647:-2147483648>e&&(e=-2147483648),e>>=0,0===this.length)return-1;if(e>=this.length)return-1;if(0>e&&(e=Math.max(this.length+e,0)),"string"==typeof t)return 0===t.length?-1:String.prototype.indexOf.call(this,t,e);if(o.isBuffer(t))return r(this,t,e);if("number"==typeof t)return o.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,t,e):r(this,[t],e);throw new TypeError("val must be string, number or Buffer")},o.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else if(isFinite(e))e=0|e,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0);else{var i=n;n=e,e=0|r,r=i}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(0>r||0>e)||e>this.length)throw new RangeError("attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return x(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return w(this,t,e,r);case"binary":return M(this,t,e,r);case"base64":return k(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var$=4096;o.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),t>e&&(e=t);var n;if(o.TYPED_ARRAY_SUPPORT)n=this.subarray(t,e),n.__proto__=o.prototype;else{var i=e-t;n=new o(i,void 0);for(var a=0;i>a;a++)n[a]=this[a+t]}return n.length&&(n.parent=this.parent||this),n},o.prototype.readUIntLE=function(t,e,r){t=0|t,e=0|e,r||C(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},o.prototype.readUIntBE=function(t,e,r){t=0|t,e=0|e,r||C(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},o.prototype.readUInt8=function(t,e){return e||C(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||C(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||C(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,r){t=0|t,e=0|e,r||C(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},o.prototype.readIntBE=function(t,e,r){t=0|t,e=0|e,r||C(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){e||C(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(t,e){e||C(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(t,e){return e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||C(t,4,this.length),Z.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||C(t,4,this.length),Z.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||C(t,8,this.length),Z.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){
return e||C(t,8,this.length),Z.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,r,n){t=+t,e=0|e,r=0|r,n||R(this,t,e,r,Math.pow(2,8*r),0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},o.prototype.writeUIntBE=function(t,e,r,n){t=+t,e=0|e,r=0|r,n||R(this,t,e,r,Math.pow(2,8*r),0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},o.prototype.writeUInt8=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):D(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):D(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):O(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);R(this,t,e,r,i-1,-i)}var o=0,a=1,s=0>t?1:0;for(this[e]=255&t;++o<r&&(a*=256);)this[e+o]=(t/a>>0)-s&255;return e+r},o.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);R(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0>t?1:0;for(this[e+o]=255&t;--o>=0&&(a*=256);)this[e+o]=(t/a>>0)-s&255;return e+r},o.prototype.writeInt8=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),0>t&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):D(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):D(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):O(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,r){return t=+t,e=0|e,r||R(this,t,e,4,2147483647,-2147483648),0>t&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},o.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},o.prototype.writeDoubleLE=function(t,e,r){return N(this,t,e,!0,r)},o.prototype.writeDoubleBE=function(t,e,r){return N(this,t,e,!1,r)},o.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&r>n&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(0>e)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("sourceStart out of bounds");if(0>n)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,a=n-r;if(this===t&&e>r&&n>e)for(i=a-1;i>=0;i--)t[i+e]=this[i+r];else if(1e3>a||!o.TYPED_ARRAY_SUPPORT)for(i=0;a>i;i++)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+a),e);return a},o.prototype.fill=function(t,e,r){if(t||(t=0),e||(e=0),r||(r=this.length),e>r)throw new RangeError("end < start");if(r!==e&&0!==this.length){if(0>e||e>=this.length)throw new RangeError("start out of bounds");if(0>r||r>this.length)throw new RangeError("end out of bounds");var n;if("number"==typeof t)for(n=e;r>n;n++)this[n]=t;else{var i=q(t.toString()),o=i.length;for(n=e;r>n;n++)this[n]=i[n%o]}return this}};var Q=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":54,ieee754:55,isarray:56}],54:[function(t,e,r){"use strict";function n(){var t,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=e.length;for(t=0;r>t;t++)l[t]=e[t];for(t=0;r>t;++t)u[e.charCodeAt(t)]=t;u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63}function i(t){var e,r,n,i,o,a,s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[s-2]?2:"="===t[s-1]?1:0,a=new c(3*s/4-o),n=o>0?s-4:s;var l=0;for(e=0,r=0;n>e;e+=4,r+=3)i=u[t.charCodeAt(e)]<<18|u[t.charCodeAt(e+1)]<<12|u[t.charCodeAt(e+2)]<<6|u[t.charCodeAt(e+3)],a[l++]=(16711680&i)>>16,a[l++]=(65280&i)>>8,a[l++]=255&i;return 2===o?(i=u[t.charCodeAt(e)]<<2|u[t.charCodeAt(e+1)]>>4,a[l++]=255&i):1===o&&(i=u[t.charCodeAt(e)]<<10|u[t.charCodeAt(e+1)]<<4|u[t.charCodeAt(e+2)]>>2,a[l++]=i>>8&255,a[l++]=255&i),a}function o(t){return l[t>>18&63]+l[t>>12&63]+l[t>>6&63]+l[63&t]}function a(t,e,r){for(var n,i=[],a=e;r>a;a+=3)n=(t[a]<<16)+(t[a+1]<<8)+t[a+2],i.push(o(n));return i.join("")}function s(t){for(var e,r=t.length,n=r%3,i="",o=[],s=16383,u=0,c=r-n;c>u;u+=s)o.push(a(t,u,u+s>c?c:u+s));return 1===n?(e=t[r-1],i+=l[e>>2],i+=l[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=l[e>>10],i+=l[e>>4&63],i+=l[e<<2&63],i+="="),o.push(i),o.join("")}r.toByteArray=i,r.fromByteArray=s;var l=[],u=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array;n()},{}],55:[function(t,e,r){r.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,l=(1<<s)-1,u=l>>1,c=-7,h=r?i-1:0,f=r?-1:1,d=t[e+h];for(h+=f,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+t[e+h],h+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=f,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:(d?-1:1)*(1/0);a+=Math.pow(2,n),o-=u}return(d?-1:1)*a*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var a,s,l,u=8*o-i-1,c=(1<<u)-1,h=c>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,v=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),e+=a+h>=1?f/l:f*Math.pow(2,1-h),e*l>=2&&(a++,l/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(e*l-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;t[r+d]=255&a,d+=p,a/=256,u-=8);t[r+d-p]|=128*v}},{}],56:[function(t,e,r){var n={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},{}],57:[function(t,e,r){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function o(t){return"number"==typeof t}function a(t){return"object"==typeof t&&null!==t}function s(t){return void 0===t}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!o(t)||0>t||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,r,n,o,l,u;if(this._events||(this._events={}),"error"===t&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[t],s(r))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),r.apply(this,o)}else if(a(r))for(o=Array.prototype.slice.call(arguments,1),u=r.slice(),n=u.length,l=0;n>l;l++)u[l].apply(this,o);return!0},n.prototype.addListener=function(t,e){var r;if(!i(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e),this._events[t]?a(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,a(this._events[t])&&!this._events[t].warned&&(r=s(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,r&&r>0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(t,r),this},n.prototype.removeListener=function(t,e){var r,n,o,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],o=r.length,n=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(a(r)){for(s=o;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(0>n)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],i(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],58:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],59:[function(t,e,r){(function(t){function e(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function n(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n<t.length;n++)e(t[n],n,t)&&r.push(t[n]);return r}var i=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,o=function(t){return i.exec(t).slice(1)};r.resolve=function(){for(var r="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var a=o>=0?arguments[o]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(r=a+"/"+r,i="/"===a.charAt(0))}return r=e(n(r.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(t){var i=r.isAbsolute(t),o="/"===a(t,-1);return t=e(n(t.split("/"),function(t){return!!t}),!i).join("/"),t||i||(t="."),t&&o&&(t+="/"),(i?"/":"")+t},r.isAbsolute=function(t){return"/"===t.charAt(0)},r.join=function(){var t=Array.prototype.slice.call(arguments,0);return r.normalize(n(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},r.relative=function(t,e){function n(t){for(var e=0;e<t.length&&""===t[e];e++);for(var r=t.length-1;r>=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=r.resolve(t).substr(1),e=r.resolve(e).substr(1);for(var i=n(t.split("/")),o=n(e.split("/")),a=Math.min(i.length,o.length),s=a,l=0;a>l;l++)if(i[l]!==o[l]){s=l;break}for(var u=[],l=s;l<i.length;l++)u.push("..");return u=u.concat(o.slice(s)),u.join("/")},r.sep="/",r.delimiter=":",r.dirname=function(t){var e=o(t),r=e[0],n=e[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},r.basename=function(t,e){var r=o(t)[2];return e&&r.substr(-1*e.length)===e&&(r=r.substr(0,r.length-e.length)),r},r.extname=function(t){return o(t)[3]};var a="b"==="ab".substr(-1)?function(t,e,r){return t.substr(e,r)}:function(t,e,r){return 0>e&&(e=t.length+e),t.substr(e,r)}}).call(this,t("_process"))},{_process:60}],60:[function(t,e,r){function n(){c=!1,s.length?u=s.concat(u):h=-1,u.length&&i()}function i(){if(!c){var t=setTimeout(n);c=!0;for(var e=u.length;e;){for(s=u,u=[];++h<e;)s&&s[h].run();h=-1,e=u.length}s=null,c=!1,clearTimeout(t)}}function o(t,e){this.fun=t,this.array=e}function a(){}var s,l=e.exports={},u=[],c=!1,h=-1;l.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new o(t,e)),1!==u.length||c||setTimeout(i,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},l.title="browser",l.browser=!0,l.env={},l.argv=[],l.version="",l.versions={},l.on=a,l.addListener=a,l.once=a,l.off=a,l.removeListener=a,l.removeAllListeners=a,l.emit=a,l.binding=function(t){throw new Error("process.binding is not supported")},l.cwd=function(){return"/"},l.chdir=function(t){throw new Error("process.chdir is not supported")},l.umask=function(){return 0}},{}],61:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],62:[function(t,e,r){(function(e,n){function i(t,e){var n={seen:[],stylize:a};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),v(e)?n.showHidden=e:e&&r._extend(n,e),_(n.showHidden)&&(n.showHidden=!1),_(n.depth)&&(n.depth=2),_(n.colors)&&(n.colors=!1),_(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=o),l(n,t,n.depth)}function o(t,e){var r=i.styles[e];return r?"["+i.colors[r][0]+"m"+t+"["+i.colors[r][1]+"m":t}function a(t,e){return t}function s(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}function l(t,e,n){if(t.customInspect&&e&&T(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(n,t);return b(i)||(i=l(t,i,n)),i}var o=u(t,e);if(o)return o;var a=Object.keys(e),v=s(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(e)),A(e)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return c(e);if(0===a.length){if(T(e)){var m=e.name?": "+e.name:"";return t.stylize("[Function"+m+"]","special")}if(w(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(k(e))return t.stylize(Date.prototype.toString.call(e),"date");if(A(e))return c(e)}var g="",y=!1,x=["{","}"];if(p(e)&&(y=!0,x=["[","]"]),T(e)){var _=e.name?": "+e.name:"";g=" [Function"+_+"]"}if(w(e)&&(g=" "+RegExp.prototype.toString.call(e)),k(e)&&(g=" "+Date.prototype.toUTCString.call(e)),A(e)&&(g=" "+c(e)),0===a.length&&(!y||0==e.length))return x[0]+g+x[1];if(0>n)return w(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var M;return M=y?h(t,e,n,v,a):a.map(function(r){return f(t,e,n,v,r,y)}),t.seen.pop(),d(M,g,x)}function u(t,e){if(_(e))return t.stylize("undefined","undefined");if(b(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return y(e)?t.stylize(""+e,"number"):v(e)?t.stylize(""+e,"boolean"):m(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i){for(var o=[],a=0,s=e.length;s>a;++a)I(e,String(a))?o.push(f(t,e,r,n,String(a),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(f(t,e,r,n,i,!0))}),o}function f(t,e,r,n,i,o){var a,s,u;if(u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]},u.get?s=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(s=t.stylize("[Setter]","special")),I(n,i)||(a="["+i+"]"),s||(t.seen.indexOf(u.value)<0?(s=m(r)?l(t,u.value,null):l(t,u.value,r-1),s.indexOf("\n")>-1&&(s=o?s.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+s.split("\n").map(function(t){return" "+t}).join("\n"))):s=t.stylize("[Circular]","special")),_(a)){if(o&&i.match(/^\d+$/))return s;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function d(t,e,r){var n=0,i=t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b$\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function p(t){return Array.isArray(t)}function v(t){return"boolean"==typeof t}function m(t){return null===t}function g(t){return null==t}function y(t){return"number"==typeof t}function b(t){return"string"==typeof t}function x(t){return"symbol"==typeof t}function _(t){return void 0===t}function w(t){return M(t)&&"[object RegExp]"===S(t)}function M(t){return"object"==typeof t&&null!==t}function k(t){return M(t)&&"[object Date]"===S(t)}function A(t){return M(t)&&("[object Error]"===S(t)||t instanceof Error)}function T(t){return"function"==typeof t}function E(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function S(t){return Object.prototype.toString.call(t)}function L(t){return 10>t?"0"+t.toString(10):t.toString(10)}function z(){var t=new Date,e=[L(t.getHours()),L(t.getMinutes()),L(t.getSeconds())].join(":");return[t.getDate(),D[t.getMonth()],e].join(" ")}function I(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var P=/%[sdj%]/g;r.format=function(t){if(!b(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(i(arguments[r]));return e.join(" ")}for(var r=1,n=arguments,o=n.length,a=String(t).replace(P,function(t){if("%%"===t)return"%";if(r>=o)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return t}}),s=n[r];o>r;s=n[++r])a+=m(s)||!M(s)?" "+s:" "+i(s);return a},r.deprecate=function(t,i){function o(){if(!a){if(e.throwDeprecation)throw new Error(i);e.traceDeprecation?console.trace(i):console.error(i),a=!0}return t.apply(this,arguments)}if(_(n.process))return function(){return r.deprecate(t,i).apply(this,arguments)};if(e.noDeprecation===!0)return t;var a=!1;return o};var C,R={};r.debuglog=function(t){if(_(C)&&(C=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!R[t])if(new RegExp("\\b"+t+"\\b","i").test(C)){var n=e.pid;R[t]=function(){var e=r.format.apply(r,arguments);console.error("%s %d: %s",t,n,e)}}else R[t]=function(){};return R[t]},r.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=p,r.isBoolean=v,r.isNull=m,r.isNullOrUndefined=g,r.isNumber=y,r.isString=b,r.isSymbol=x,r.isUndefined=_,r.isRegExp=w,r.isObject=M,r.isDate=k,r.isError=A,r.isFunction=T,r.isPrimitive=E,r.isBuffer=t("./support/isBuffer");var D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];r.log=function(){console.log("%s - %s",z(),r.format.apply(r,arguments))},r.inherits=t("inherits"),r._extend=function(t,e){if(!e||!M(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":61,_process:60,inherits:58}],63:[function(t,e,r){"use strict";function n(t){return[Math.min(t[0],t[1]),Math.max(t[0],t[1])]}function i(t,e){return t[0]-e[0]||t[1]-e[1]}function o(t){return t.map(n).sort(i)}function a(t,e,r){return e in t?t[e]:r}function s(t,e,r){Array.isArray(e)?(r=r||{},e=e||[]):(r=e||{},e=[]);var n=!!a(r,"delaunay",!0),i=!!a(r,"interior",!0),s=!!a(r,"exterior",!0),f=!!a(r,"infinity",!1);if(!i&&!s||0===t.length)return[];var d=l(t,e);if(n||i!==s||f){for(var p=u(t.length,o(e)),v=0;v<d.length;++v){var m=d[v];p.addTriangle(m[0],m[1],m[2])}return n&&c(t,p),s?i?f?h(p,0,f):p.cells():h(p,1,f):h(p,-1)}return d}var l=t("./lib/monotone"),u=t("./lib/triangulation"),c=t("./lib/delaunay"),h=t("./lib/filter");e.exports=s},{"./lib/delaunay":64,"./lib/filter":65,"./lib/monotone":66,"./lib/triangulation":67}],64:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){var s=e.opposite(n,i);if(!(0>s)){if(n>i){var l=n;n=i,i=l,l=a,a=s,s=l}e.isConstraint(n,i)||o(t[n],t[i],t[a],t[s])<0&&r.push(n,i)}}function i(t,e){for(var r=[],i=t.length,a=e.stars,s=0;i>s;++s)for(var l=a[s],u=1;u<l.length;u+=2){var c=l[u];if(!(s>c||e.isConstraint(s,c))){for(var h=l[u-1],f=-1,d=1;d<l.length;d+=2)if(l[d-1]===c){f=l[d];break}0>f||o(t[s],t[c],t[h],t[f])<0&&r.push(s,c)}}for(;r.length>0;){for(var c=r.pop(),s=r.pop(),h=-1,f=-1,l=a[s],p=1;p<l.length;p+=2){var v=l[p-1],m=l[p];v===c?f=m:m===c&&(h=v)}0>h||0>f||o(t[s],t[c],t[h],t[f])>=0||(e.flip(s,c),n(t,e,r,h,s,f),n(t,e,r,s,f,h),n(t,e,r,f,c,h),n(t,e,r,c,h,f))}}var o=t("robust-in-sphere")[4];t("binary-search-bounds");e.exports=i},{"binary-search-bounds":68,"robust-in-sphere":69}],65:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a){this.cells=t,this.neighbor=e,this.flags=n,this.constraint=r,this.active=i,this.next=o,this.boundary=a}function i(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}function o(t,e){for(var r=t.cells(),o=r.length,a=0;o>a;++a){var s=r[a],l=s[0],u=s[1],c=s[2];c>u?l>u&&(s[0]=u,s[1]=c,s[2]=l):l>c&&(s[0]=c,s[1]=l,s[2]=u)}r.sort(i);for(var h=new Array(o),a=0;a<h.length;++a)h[a]=0;var f=[],d=[],p=new Array(3*o),v=new Array(3*o),m=null;e&&(m=[]);for(var g=new n(r,p,v,h,f,d,m),a=0;o>a;++a)for(var s=r[a],y=0;3>y;++y){var l=s[y],u=s[(y+1)%3],b=p[3*a+y]=g.locate(u,l,t.opposite(u,l)),x=v[3*a+y]=t.isConstraint(l,u);0>b&&(x?d.push(a):(f.push(a),h[a]=1),e&&m.push([u,l,-1]))}return g}function a(t,e,r){for(var n=0,i=0;i<t.length;++i)e[i]===r&&(t[n++]=t[i]);return t.length=n,t}function s(t,e,r){var n=o(t,r);if(0===e)return r?n.cells.concat(n.boundary):n.cells;for(var i=1,s=n.active,l=n.next,u=n.flags,c=n.cells,h=n.constraint,f=n.neighbor;s.length>0||l.length>0;){for(;s.length>0;){var d=s.pop();if(u[d]!==-i){u[d]=i;for(var p=(c[d],0);3>p;++p){var v=f[3*d+p];v>=0&&0===u[v]&&(h[3*d+p]?l.push(v):(s.push(v),u[v]=i))}}}var m=l;l=s,s=m,l.length=0,i=-i}var g=a(c,u,e);return r?g.concat(n.boundary):g}var l=t("binary-search-bounds");e.exports=s;var u=n.prototype;u.locate=function(){var t=[0,0,0];return function(e,r,n){var o=e,a=r,s=n;return n>r?e>r&&(o=r,a=n,s=e):e>n&&(o=n,a=e,s=r),0>o?-1:(t[0]=o,t[1]=a,t[2]=s,l.eq(this.cells,t,i))}}()},{"binary-search-bounds":68}],66:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.a=t,this.b=e,this.idx=r,this.lowerIds=n,this.upperIds=i}function i(t,e,r,n){this.a=t,this.b=e,this.type=r,this.idx=n}function o(t,e){var r=t.a[0]-e.a[0]||t.a[1]-e.a[1]||t.type-e.type;return r?r:t.type!==p&&(r=d(t.a,t.b,e.b))?r:t.idx-e.idx}function a(t,e){return d(t.a,t.b,e)}function s(t,e,r,n,i){for(var o=f.lt(e,n,a),s=f.gt(e,n,a),l=o;s>l;++l){for(var u=e[l],c=u.lowerIds,h=c.length;h>1&&d(r[c[h-2]],r[c[h-1]],n)>0;)t.push([c[h-1],c[h-2],i]),h-=1;c.length=h,c.push(i);for(var p=u.upperIds,h=p.length;h>1&&d(r[p[h-2]],r[p[h-1]],n)<0;)t.push([p[h-2],p[h-1],i]),h-=1;p.length=h,p.push(i)}}function l(t,e){var r;return(r=t.a[0]<e.a[0]?d(t.a,t.b,e.a):d(e.b,e.a,t.a))?r:(r=e.b[0]<t.b[0]?d(t.a,t.b,e.b):d(e.b,e.a,t.b),r||t.idx-e.idx)}function u(t,e,r){var i=f.le(t,r,l),o=t[i],a=o.upperIds,s=a[a.length-1];o.upperIds=[s],t.splice(i+1,0,new n(r.a,r.b,r.idx,[s],a))}function c(t,e,r){var n=r.a;r.a=r.b,r.b=n;var i=f.eq(t,r,l),o=t[i],a=t[i-1];a.upperIds=o.upperIds,t.splice(i,1)}function h(t,e){for(var r=t.length,a=e.length,l=[],h=0;r>h;++h)l.push(new i(t[h],null,p,h));for(var h=0;a>h;++h){var f=e[h],d=t[f[0]],g=t[f[1]];d[0]<g[0]?l.push(new i(d,g,m,h),new i(g,d,v,h)):d[0]>g[0]&&l.push(new i(g,d,m,h),new i(d,g,v,h))}l.sort(o);for(var y=l[0].a[0]-(1+Math.abs(l[0].a[0]))*Math.pow(2,-52),b=[new n([y,1],[y,0],-1,[],[],[],[])],x=[],h=0,_=l.length;_>h;++h){var w=l[h],M=w.type;M===p?s(x,b,t,w.a,w.idx):M===m?u(b,t,w):c(b,t,w)}return x}var f=t("binary-search-bounds"),d=t("robust-orientation")[3],p=0,v=1,m=2;e.exports=h},{"binary-search-bounds":68,"robust-orientation":439}],67:[function(t,e,r){"use strict";function n(t,e){this.stars=t,this.edges=e}function i(t,e,r){for(var n=1,i=t.length;i>n;n+=2)if(t[n-1]===e&&t[n]===r)return t[n-1]=t[i-2],t[n]=t[i-1],void(t.length=i-2)}function o(t,e){for(var r=new Array(t),i=0;t>i;++i)r[i]=[];return new n(r,e)}var a=t("binary-search-bounds");e.exports=o;var s=n.prototype;s.isConstraint=function(){function t(t,e){return t[0]-e[0]||t[1]-e[1]}var e=[0,0];return function(r,n){return e[0]=Math.min(r,n),e[1]=Math.max(r,n),a.eq(this.edges,e,t)>=0}}(),s.removeTriangle=function(t,e,r){var n=this.stars;i(n[t],e,r),i(n[e],r,t),i(n[r],t,e)},s.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r),n[e].push(r,t),n[r].push(t,e)},s.opposite=function(t,e){for(var r=this.stars[e],n=1,i=r.length;i>n;n+=2)if(r[n]===t)return r[n-1];return-1},s.flip=function(t,e){var r=this.opposite(t,e),n=this.opposite(e,t);this.removeTriangle(t,e,r),this.removeTriangle(e,t,n),this.addTriangle(t,n,r),this.addTriangle(e,r,n)},s.edges=function(){for(var t=this.stars,e=[],r=0,n=t.length;n>r;++r)for(var i=t[r],o=0,a=i.length;a>o;o+=2)e.push([i[o],i[o+1]]);return e},s.cells=function(){for(var t=this.stars,e=[],r=0,n=t.length;n>r;++r)for(var i=t[r],o=0,a=i.length;a>o;o+=2){var s=i[o],l=i[o+1];r<Math.min(s,l)&&e.push([r,s,l])}return e}},{"binary-search-bounds":68}],68:[function(t,e,r){"use strict";function n(t,e,r,n,i){var o=["function ",t,"(a,l,h,",n.join(","),"){",i?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a[m]"];return i?e.indexOf("c")<0?o.push(";if(x===y){return m}else if(x<=y){"):o.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):o.push(";if(",e,"){i=m;"),r?o.push("l=m+1}else{h=m-1}"):o.push("h=m-1}else{l=m+1}"),o.push("}"),i?o.push("return -1};"):o.push("return i};"),o.join("")}function i(t,e,r,i){var o=new Function([n("A","x"+t+"y",e,["y"],i),n("P","c(x,y)"+t+"0",e,["y","c"],i),"function dispatchBsearch",r,"(a,y,c,l,h){if(typeof(c)==='function'){return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)}else{return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)}}return dispatchBsearch",r].join(""));return o()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],69:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;n<t.length;++n)for(var i=r[n-1]=new Array(t.length-1),o=0,a=0;o<t.length;++o)o!==e&&(i[a++]=t[n][o]);return r}function i(t){for(var e=new Array(t),r=0;t>r;++r){e[r]=new Array(t);for(var n=0;t>n;++n)e[r][n]=["m",n,"[",t-r-2,"]"].join("")}return e}function o(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function a(t,e){if("m"===t.charAt(0)){if("w"===e.charAt(0)){var r=t.split("[");return["w",e.substr(1),"m",r[0].substr(1)].join("")}return["prod(",t,",",e,")"].join("")}return a(e,t)}function s(t){return t&!0?"-":""}function l(t){if(2===t.length)return[["diff(",a(t[0][0],t[1][1]),",",a(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r<t.length;++r)e.push(["scale(",o(l(n(t,r))),",",s(r),t[0][r],")"].join(""));return e}function u(t,e){for(var r=[],n=0;e-2>n;++n)r.push(["prod(m",t,"[",n,"],m",t,"[",n,"])"].join(""));return o(r)}function c(t){for(var e=[],r=[],a=i(t),s=0;t>s;++s)a[0][s]="1",a[t-1][s]="w"+s;for(var s=0;t>s;++s)0===(1&s)?e.push.apply(e,l(n(a,s))):r.push.apply(r,l(n(a,s)));for(var c=o(e),h=o(r),f="exactInSphere"+t,d=[],s=0;t>s;++s)d.push("m"+s);for(var p=["function ",f,"(",d.join(),"){"],s=0;t>s;++s){p.push("var w",s,"=",u(s,t),";");for(var v=0;t>v;++v)v!==s&&p.push("var w",s,"m",v,"=scale(w",s,",m",v,"[0]);")}p.push("var p=",c,",n=",h,",d=diff(p,n);return d[d.length-1];}return ",f);var x=new Function("sum","diff","prod","scale",p.join(""));return x(g,y,m,b)}function h(){return 0}function f(){return 0}function d(){return 0}function p(t){var e=_[t.length];return e||(e=_[t.length]=c(t.length)),e.apply(void 0,t)}function v(){for(;_.length<=x;)_.push(c(_.length));for(var t=[],r=["slow"],n=0;x>=n;++n)t.push("a"+n),r.push("o"+n);for(var i=["function testInSphere(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;x>=n;++n)i.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i<arguments.length;++i){s[i]=arguments[i]};return slow(s);}return testInSphere"),r.push(i.join(""));var o=Function.apply(void 0,r);e.exports=o.apply(void 0,[p].concat(_));for(var n=0;x>=n;++n)e.exports[n]=_[n]}var m=t("two-product"),g=t("robust-sum"),y=t("robust-subtract"),b=t("robust-scale"),x=6,_=[h,f,d];v()},{"robust-scale":440,"robust-subtract":441,"robust-sum":442,"two-product":456}],70:[function(t,e,r){"use strict";function n(t){var e=x(t),r=b(y(e),t);return 0>r?[e,w(e,1/0)]:r>0?[w(e,-(1/0)),e]:[e,e]}function i(t,e){for(var r=new Array(e.length),n=0;n<e.length;++n){var i=e[n],o=t[i[0]],a=t[i[1]];r[n]=[Math.min(o[0],a[0]),Math.min(o[1],a[1]),Math.max(o[0],a[0]),Math.max(o[1],a[1])]}return r}function o(t){for(var e=new Array(t.length),r=0;r<t.length;++r){var n=t[r];e[r]=[n[0],n[1],n[0],n[1]]}return e}function a(t,e,r){var n=[];return m(r,function(r,i){var o=e[r],a=e[i];if(o[0]!==a[0]&&o[0]!==a[1]&&o[1]!==a[0]&&o[1]!==a[1]){var s=t[o[0]],l=t[o[1]],u=t[a[0]],c=t[a[1]];g(s,l,u,c)&&n.push([r,i])}}),n}function s(t,e,r,n){var i=[];return m(r,n,function(r,n){var o=e[r];if(o[0]!==n&&o[1]!==n){var a=t[n],s=t[o[0]],l=t[o[1]];g(s,l,a,a)&&i.push([r,n])}}),i}function l(t,e,r,n,i){function o(e){if(e>=t.length)return a[e-t.length];var r=t[e];return[y(r[0]),y(r[1])]}for(var a=[],s=0;s<r.length;++s){var l=r[s],u=l[0],c=l[1],h=e[u],f=e[c],d=M(_(t[h[0]]),_(t[h[1]]),_(t[f[0]]),_(t[f[1]]));if(d){var p=a.length+t.length;a.push(d),n.push([u,p],[c,p])}}n.sort(function(t,e){if(t[0]!==e[0])return t[0]-e[0];var r=o(t[1]),n=o(e[1]);return b(r[0],n[0])||b(r[1],n[1])});for(var s=n.length-1;s>=0;--s){var v=n[s],u=v[0],m=e[u],g=m[0],x=m[1],w=t[g],k=t[x];if((w[0]-k[0]||w[1]-k[1])<0){var A=g;g=x,x=A}m[0]=g;var T,E=m[1]=v[1];for(i&&(T=m[2]);s>0&&n[s-1][0]===u;){var v=n[--s],S=v[1];i?e.push([E,S,T]):e.push([E,S]),E=S}i?e.push([E,x,T]):e.push([E,x])}return a}function u(t,e,r){for(var i=t.length+e.length,o=new v(i),a=r,s=0;s<e.length;++s){var l=e[s],u=n(l[0]),c=n(l[1]);a.push([u[0],c[0],u[1],c[1]]),t.push([x(l[0]),x(l[1])])}m(a,function(t,e){o.link(t,e)});for(var h=0,f=!0,d=new Array(i),s=0;i>s;++s){var p=o.find(s);p===s?(d[s]=h,t[h++]=t[s]):(f=!1,d[s]=-1)}if(t.length=h,f)return null;for(var s=0;i>s;++s)d[s]<0&&(d[s]=d[o.find(s)]);return d}function c(t,e){return t[0]-e[0]||t[1]-e[1]}function h(t,e){var r=t[0]-e[0]||t[1]-e[1];return r?r:t[2]<e[2]?-1:t[2]>e[2]?1:0}function f(t,e,r){if(0!==t.length){if(e)for(var n=0;n<t.length;++n){var i=t[n],o=e[i[0]],a=e[i[1]];i[0]=Math.min(o,a),i[1]=Math.max(o,a)}else for(var n=0;n<t.length;++n){var i=t[n],o=i[0],a=i[1];i[0]=Math.min(o,a),i[1]=Math.max(o,a)}r?t.sort(h):t.sort(c);for(var s=1,n=1;n<t.length;++n){var l=t[n-1],u=t[n];(u[0]!==l[0]||u[1]!==l[1]||r&&u[2]!==l[2])&&(t[s++]=u)}t.length=s}}function d(t,e,r){var n=i(t,e),c=a(t,e,n),h=o(t),d=s(t,e,n,h),p=l(t,e,c,d,r),v=u(t,p,h);return f(e,v,r),v?!0:c.length>0||d.length>0}function p(t,e,r){var n,i=!1;if(r){n=e;for(var o=new Array(e.length),a=0;a<e.length;++a){var s=e[a];o[a]=[s[0],s[1],r[a]]}e=o}for(;d(t,e,!!r);)i=!0;if(r&&i){n.length=0,r.length=0;for(var a=0;a<e.length;++a){var s=e[a];n.push([s[0],s[1]]),r.push(s[2])}}return i}e.exports=p;var v=t("union-find"),m=t("box-intersect"),g=(t("compare-cell"),t("robust-segment-intersect")),y=t("big-rat"),b=t("big-rat/cmp"),x=t("big-rat/to-float"),_=t("rat-vec"),w=t("nextafter"),M=t("./lib/rat-seg-intersect"); },{"./lib/rat-seg-intersect":71,"big-rat":75,"big-rat/cmp":73,"big-rat/to-float":88,"box-intersect":89,"compare-cell":107,nextafter:97,"rat-vec":99,"robust-segment-intersect":102,"union-find":103}],71:[function(t,e,r){"use strict";function n(t,e){return s(o(t[0],e[1]),o(t[1],e[0]))}function i(t,e,r,i){var o=u(e,t),s=u(i,r),f=n(o,s);if(0===l(f))return null;var d=u(t,r),p=n(s,d),v=a(p,f);return c(t,h(o,v))}e.exports=i;var o=t("big-rat/mul"),a=t("big-rat/div"),s=t("big-rat/sub"),l=t("big-rat/sign"),u=t("rat-vec/sub"),c=t("rat-vec/add"),h=t("rat-vec/muls");t("big-rat/to-float")},{"big-rat/div":74,"big-rat/mul":84,"big-rat/sign":86,"big-rat/sub":87,"big-rat/to-float":88,"rat-vec/add":98,"rat-vec/muls":100,"rat-vec/sub":101}],72:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[1]).add(e[0].mul(t[1])),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":82}],73:[function(t,e,r){"use strict";function n(t,e){return t[0].mul(e[1]).cmp(e[0].mul(t[1]))}e.exports=n},{}],74:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[1]),t[1].mul(e[0]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":82}],75:[function(t,e,r){"use strict";function n(t,e){if(i(t))return e?u(t,n(e)):[t[0].clone(),t[1].clone()];var r,c,h=0;if(o(t))r=t.clone();else if("string"==typeof t)r=s(t);else{if(0===t)return[a(0),a(1)];if(t===Math.floor(t))r=a(t);else{for(;t!==Math.floor(t);)t*=Math.pow(2,256),h-=256;r=a(t)}}if(i(e))r.mul(e[1]),c=e[0].clone();else if(o(e))c=e.clone();else if("string"==typeof e)c=s(e);else if(e)if(e===Math.floor(e))c=a(e);else{for(;e!==Math.floor(e);)e*=Math.pow(2,256),h+=256;c=a(e)}else c=a(1);return h>0?r=r.shln(h):0>h&&(c=c.shln(-h)),l(r,c)}var i=t("./is-rat"),o=t("./lib/is-bn"),a=t("./lib/num-to-bn"),s=t("./lib/str-to-bn"),l=t("./lib/rationalize"),u=t("./div");e.exports=n},{"./div":74,"./is-rat":76,"./lib/is-bn":80,"./lib/num-to-bn":81,"./lib/rationalize":82,"./lib/str-to-bn":83}],76:[function(t,e,r){"use strict";function n(t){return Array.isArray(t)&&2===t.length&&i(t[0])&&i(t[1])}var i=t("./lib/is-bn");e.exports=n},{"./lib/is-bn":80}],77:[function(t,e,r){"use strict";function n(t){return t.cmp(new i(0))}var i=t("bn.js");e.exports=n},{"bn.js":85}],78:[function(t,e,r){"use strict";function n(t){var e=t.length,r=t.words,n=0;if(1===e)n=r[0];else if(2===e)n=r[0]+67108864*r[1];else for(var n=0,i=0;e>i;i++){var o=r[i];n+=o*Math.pow(67108864,i)}return t.sign?-n:n}e.exports=n},{}],79:[function(t,e,r){"use strict";function n(t){var e=o(i.lo(t));if(32>e)return e;var r=o(i.hi(t));return r>20?52:r+32}var i=t("double-bits"),o=t("bit-twiddle").countTrailingZeros;e.exports=n},{"bit-twiddle":51,"double-bits":96}],80:[function(t,e,r){"use strict";function n(t){return t&&"object"==typeof t&&Boolean(t.words)}t("bn.js");e.exports=n},{"bn.js":85}],81:[function(t,e,r){"use strict";function n(t){var e=o.exponent(t);return 52>e?new i(t):new i(t*Math.pow(2,52-e)).shln(e-52)}var i=t("bn.js"),o=t("double-bits");e.exports=n},{"bn.js":85,"double-bits":96}],82:[function(t,e,r){"use strict";function n(t,e){var r=o(t),n=o(e);if(0===r)return[i(0),i(1)];if(0===n)return[i(0),i(0)];0>n&&(t=t.neg(),e=e.neg());var a=t.gcd(e);return a.cmpn(1)?[t.div(a),e.div(a)]:[t,e]}var i=t("./num-to-bn"),o=t("./bn-sign");e.exports=n},{"./bn-sign":77,"./num-to-bn":81}],83:[function(t,e,r){"use strict";function n(t){return new i(t)}var i=t("bn.js");e.exports=n},{"bn.js":85}],84:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[0]),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":82}],85:[function(t,e,r){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){return null!==t&&"object"==typeof t&&Array.isArray(t.words)?t:(this.sign=!1,this.words=null,this.length=0,this.red=null,"le"!==e&&"be"!==e||(r=e,e=10),void(null!==t&&this._init(t||0,e||10,r||"be")))}function o(t,e,r){for(var n=0,i=Math.min(t.length,r),o=e;i>o;o++){var a=t.charCodeAt(o)-48;n<<=4,n|=a>=49&&54>=a?a-49+10:a>=17&&22>=a?a-17+10:15&a}return n}function a(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;o>a;a++){var s=t.charCodeAt(a)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}function s(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function l(){s.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function u(){s.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function c(){s.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function h(){s.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function f(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function d(t){f.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv.sign=!0,this.minv=this.minv.mod(this.r)}"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26,i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&36>=e),t=t.toString().replace(/\s+/g,"");var i=0;"-"===t[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.sign=!0),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initNumber=function(t,e,n){0>t&&(this.sign=!0,t=-t),67108864>t?(this.words=[67108863&t],this.length=1):4503599627370496>t?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(9007199254740992>t),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o=0;if("be"===n)for(var i=t.length-1,a=0;i>=0;i-=3){var s=t[i]|t[i-1]<<8|t[i-2]<<16;this.words[a]|=s<<o&67108863,this.words[a+1]=s>>>26-o&67108863,o+=24,o>=26&&(o-=26,a++)}else if("le"===n)for(var i=0,a=0;i<t.length;i+=3){var s=t[i]|t[i+1]<<8|t[i+2]<<16;this.words[a]|=s<<o&67108863,this.words[a+1]=s>>>26-o&67108863,o+=24,o>=26&&(o-=26,a++)}return this.strip()},i.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;for(var n=0,r=t.length-6,i=0;r>=e;r-=6){var a=o(t,r,r+6);this.words[i]|=a<<n&67108863,this.words[i+1]|=a>>>26-n&4194303,n+=24,n>=26&&(n-=26,i++)}if(r+6!==e){var a=o(t,e,r+6);this.words[i]|=a<<n&67108863,this.words[i+1]|=a>>>26-n&4194303}this.strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;67108863>=i;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,l=Math.min(o,o-s)+r,u=0,c=r;l>c;c+=n)u=a(t,c,c+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){for(var h=1,u=a(t,c,t.length,e),c=0;s>c;c++)h*=e;this.imuln(h),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}},i.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.sign=this.sign,t.red=this.red},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var p=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],v=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],m=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){if(t=t||10,16===t||"hex"===t){for(var n="",i=0,e=0|e||1,o=0,a=0;a<this.length;a++){var s=this.words[a],l=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,n=0!==o||a!==this.length-1?p[6-l.length]+l+n:l+n,i+=2,i>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!==0;)n="0"+n;return this.sign&&(n="-"+n),n}if(t===(0|t)&&t>=2&&36>=t){var u=v[t],c=m[t],n="",h=this.clone();for(h.sign=!1;0!==h.cmpn(0);){var f=h.modn(c).toString(t);h=h.idivn(c),n=0!==h.cmpn(0)?p[u-f.length]+f+n:f+n}return 0===this.cmpn(0)&&(n="0"+n),this.sign&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toArray=function(t){this.strip();var e=new Array(this.byteLength());e[0]=0;var r=this.clone();if("le"!==t)for(var n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),e[e.length-n-1]=i}else for(var n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),e[n]=i}return e},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},i.prototype.bitLength=function(){var t=0,e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(0===this.cmpn(0))return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.neg=function(){if(0===this.cmpn(0))return this.clone();var t=this.clone();return t.sign=!this.sign,t},i.prototype.ior=function(t){for(this.sign=this.sign||t.sign;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.iand=function(t){this.sign=this.sign&&t.sign;var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.ixor=function(t){this.sign=this.sign||t.sign;var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);for(var n=t/26|0,i=t%26;this.length<=n;)this.words[this.length++]=0;return e?this.words[n]=this.words[n]|1<<i:this.words[n]=this.words[n]&~(1<<i),this.strip()},i.prototype.iadd=function(t){if(this.sign&&!t.sign){this.sign=!1;var e=this.isub(t);return this.sign=!this.sign,this._normSign()}if(!this.sign&&t.sign){t.sign=!1;var e=this.isub(t);return t.sign=!0,e._normSign()}var r,n;this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++){var e=r.words[o]+n.words[o]+i;this.words[o]=67108863&e,i=e>>>26}for(;0!==i&&o<r.length;o++){var e=r.words[o]+i;this.words[o]=67108863&e,i=e>>>26}if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.prototype.add=function(t){if(t.sign&&!this.sign){t.sign=!1;var e=this.sub(t);return t.sign=!0,e}if(!t.sign&&this.sign){this.sign=!1;var e=t.sub(this);return this.sign=!0,e}return this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(t.sign){t.sign=!1;var e=this.iadd(t);return t.sign=!0,e._normSign()}if(this.sign)return this.sign=!1,this.iadd(t),this.sign=!0,this._normSign();var r=this.cmp(t);if(0===r)return this.sign=!1,this.length=1,this.words[0]=0,this;var n,i;r>0?(n=this,i=t):(n=t,i=this);for(var o=0,a=0;a<i.length;a++){var e=n.words[a]-i.words[a]+o;o=e>>26,this.words[a]=67108863&e}for(;0!==o&&a<n.length;a++){var e=n.words[a]+o;o=e>>26,this.words[a]=67108863&e}if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.sign=!0),this.strip()},i.prototype.sub=function(t){return this.clone().isub(t)},i.prototype._smallMulTo=function(t,e){e.sign=t.sign!==this.sign,e.length=this.length+t.length;for(var r=0,n=0;n<e.length-1;n++){for(var i=r>>>26,o=67108863&r,a=Math.min(n,t.length-1),s=Math.max(0,n-this.length+1);a>=s;s++){var l=n-s,u=0|this.words[l],c=0|t.words[s],h=u*c,f=67108863&h;i=i+(h/67108864|0)|0,f=f+o|0,o=67108863&f,i=i+(f>>>26)|0}e.words[n]=o,r=i}return 0!==r?e.words[n]=r:e.length--,e.strip()},i.prototype._bigMulTo=function(t,e){e.sign=t.sign!==this.sign,e.length=this.length+t.length;for(var r=0,n=0,i=0;i<e.length-1;i++){var o=n;n=0;for(var a=67108863&r,s=Math.min(i,t.length-1),l=Math.max(0,i-this.length+1);s>=l;l++){var u=i-l,c=0|this.words[u],h=0|t.words[l],f=c*h,d=67108863&f;o=o+(f/67108864|0)|0,d=d+a|0,a=67108863&d,o=o+(d>>>26)|0,n+=o>>>26,o&=67108863}e.words[i]=a,r=o,o=n}return 0!==r?e.words[i]=r:e.length--,e.strip()},i.prototype.mulTo=function(t,e){var r;return r=this.length+t.length<63?this._smallMulTo(t,e):this._bigMulTo(t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.imul=function(t){if(0===this.cmpn(0)||0===t.cmpn(0))return this.words[0]=0,this.length=1,this;var e=this.length,r=t.length;this.sign=t.sign!==this.sign,this.length=this.length+t.length,this.words[this.length-1]=0;for(var n=this.length-2;n>=0;n--){for(var i=0,o=0,a=Math.min(n,r-1),s=Math.max(0,n-e+1);a>=s;s++){var l=n-s,u=this.words[l],c=t.words[s],h=u*c,f=67108863&h;i+=h/67108864|0,f+=o,o=67108863&f,i+=f>>>26}this.words[n]=o,this.words[n+1]+=i,i=0}for(var i=0,l=1;l<this.length;l++){var d=this.words[l]+i;this.words[l]=67108863&d,i=d>>>26}return this.strip()},i.prototype.imuln=function(t){r("number"==typeof t);for(var e=0,n=0;n<this.length;n++){var i=this.words[n]*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.mul(this)},i.prototype.ishln=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=67108863>>>26-e<<26-e;if(0!==e){for(var o=0,a=0;a<this.length;a++){var s=this.words[a]&i,l=this.words[a]-s<<e;this.words[a]=l|o,o=s>>>26-e}o&&(this.words[a]=o,this.length++)}if(0!==n){for(var a=this.length-1;a>=0;a--)this.words[a+n]=this.words[a];for(var a=0;n>a;a++)this.words[a]=0;this.length+=n}return this.strip()},i.prototype.ishrn=function(t,e,n){r("number"==typeof t&&t>=0);var i;i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,l=n;if(i-=a,i=Math.max(0,i),l){for(var u=0;a>u;u++)l.words[u]=this.words[u];l.length=a}if(0===a);else if(this.length>a){this.length-=a;for(var u=0;u<this.length;u++)this.words[u]=this.words[u+a]}else this.words[0]=0,this.length=1;for(var c=0,u=this.length-1;u>=0&&(0!==c||u>=i);u--){var h=this.words[u];this.words[u]=c<<26-o|h>>>o,c=h&s}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return!1;var o=this.words[n];return!!(o&i)},i.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(!this.sign,"imaskn works only with positive numbers"),0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.prototype.iaddn=function(t){return r("number"==typeof t),0>t?this.isubn(-t):this.sign?1===this.length&&this.words[0]<t?(this.words[0]=t-this.words[0],this.sign=!1,this):(this.sign=!1,this.isubn(t),this.sign=!0,this):this._iaddn(t)},i.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),0>t)return this.iaddn(-t);if(this.sign)return this.sign=!1,this.iaddn(t),this.sign=!0,this;this.words[0]-=t;for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.sign=!1,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,n){var i,o=t.length+n;if(this.words.length<o){for(var a=new Array(o),i=0;i<this.length;i++)a[i]=this.words[i];this.words=a}else i=this.length;for(this.length=Math.max(this.length,o);i<this.length;i++)this.words[i]=0;for(var s=0,i=0;i<t.length;i++){var l=this.words[i+n]+s,u=t.words[i]*e;l-=67108863&u,s=(l>>26)-(u/67108864|0),this.words[i+n]=67108863&l}for(;i<this.length-n;i++){var l=this.words[i+n]+s;s=l>>26,this.words[i+n]=67108863&l}if(0===s)return this.strip();r(-1===s),s=0;for(var i=0;i<this.length;i++){var l=-this.words[i]+s;s=l>>26,this.words[i]=67108863&l}return this.sign=!0,this.strip()},i.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),o=t,a=o.words[o.length-1],s=this._countBits(a);r=26-s,0!==r&&(o=o.shln(r),n.ishln(r),a=o.words[o.length-1]);var l,u=n.length-o.length;if("mod"!==e){l=new i(null),l.length=u+1,l.words=new Array(l.length);for(var c=0;c<l.length;c++)l.words[c]=0}var h=n.clone()._ishlnsubmul(o,1,u);h.sign||(n=h,l&&(l.words[u]=1));for(var f=u-1;f>=0;f--){var d=67108864*n.words[o.length+f]+n.words[o.length+f-1];for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(o,d,f);n.sign;)d--,n.sign=!1,n._ishlnsubmul(o,1,f),0!==n.cmpn(0)&&(n.sign=!n.sign);l&&(l.words[f]=d)}return l&&l.strip(),n.strip(),"div"!==e&&0!==r&&n.ishrn(r),{div:l?l:null,mod:n}},i.prototype.divmod=function(t,e){if(r(0!==t.cmpn(0)),this.sign&&!t.sign){var n,o,a=this.neg().divmod(t,e);return"mod"!==e&&(n=a.div.neg()),"div"!==e&&(o=0===a.mod.cmpn(0)?a.mod:t.sub(a.mod)),{div:n,mod:o}}if(!this.sign&&t.sign){var n,a=this.divmod(t.neg(),e);return"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}}return this.sign&&t.sign?this.neg().divmod(t.neg(),e):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e)},i.prototype.div=function(t){return this.divmod(t,"div").div},i.prototype.mod=function(t){return this.divmod(t,"mod").mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(0===e.mod.cmpn(0))return e.div;var r=e.div.sign?e.mod.isub(t):e.mod,n=t.shrn(1),i=t.andln(1),o=r.cmp(n);return 0>o||1===i&&0===o?e.div:e.div.sign?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){r(67108863>=t);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+this.words[i])%t;return n},i.prototype.idivn=function(t){r(67108863>=t);for(var e=0,n=this.length-1;n>=0;n--){var i=this.words[n]+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),l=new i(1),u=0;e.isEven()&&n.isEven();)e.ishrn(1),n.ishrn(1),++u;for(var c=n.clone(),h=e.clone();0!==e.cmpn(0);){for(;e.isEven();)e.ishrn(1),o.isEven()&&a.isEven()?(o.ishrn(1),a.ishrn(1)):(o.iadd(c).ishrn(1),a.isub(h).ishrn(1));for(;n.isEven();)n.ishrn(1),s.isEven()&&l.isEven()?(s.ishrn(1),l.ishrn(1)):(s.iadd(c).ishrn(1),l.isub(h).ishrn(1));e.cmp(n)>=0?(e.isub(n),o.isub(s),a.isub(l)):(n.isub(e),s.isub(o),l.isub(a))}return{a:s,b:l,gcd:n.ishln(u)}},i.prototype._invmp=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var o=new i(1),a=new i(0),s=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(;e.isEven();)e.ishrn(1),o.isEven()?o.ishrn(1):o.iadd(s).ishrn(1);for(;n.isEven();)n.ishrn(1),a.isEven()?a.ishrn(1):a.iadd(s).ishrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a)):(n.isub(e),a.isub(o))}return 0===e.cmpn(1)?o:a},i.prototype.gcd=function(t){if(0===this.cmpn(0))return t.clone();if(0===t.cmpn(0))return this.clone();var e=this.clone(),r=t.clone();e.sign=!1,r.sign=!1;for(var n=0;e.isEven()&&r.isEven();n++)e.ishrn(1),r.ishrn(1);for(;;){for(;e.isEven();)e.ishrn(1);for(;r.isEven();)r.ishrn(1);var i=e.cmp(r);if(0>i){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.ishln(n)},i.prototype.invm=function(t){return this.egcd(t).a.mod(t)},i.prototype.isEven=function(){return 0===(1&this.words[0])},i.prototype.isOdd=function(){return 1===(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n){for(var o=this.length;n+1>o;o++)this.words[o]=0;return this.words[n]|=i,this.length=n+1,this}for(var a=i,o=n;0!==a&&o<this.length;o++){var s=this.words[o];s+=a,a=s>>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},i.prototype.cmpn=function(t){var e=0>t;if(e&&(t=-t),this.sign&&!e)return-1;if(!this.sign&&e)return 1;t&=67108863,this.strip();var r;if(this.length>1)r=1;else{var n=this.words[0];r=n===t?0:t>n?-1:1}return this.sign&&(r=-r),r},i.prototype.cmp=function(t){if(this.sign&&!t.sign)return-1;if(!this.sign&&t.sign)return 1;var e=this.ucmp(t);return this.sign?-e:e},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=this.words[r],i=t.words[r];if(n!==i){i>n?e=-1:n>i&&(e=1);break}}return e},i.red=function(t){return new f(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(!this.sign,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};s.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},s.prototype.ireduce=function(t){var e,r=t;do this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),e=r.bitLength();while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):r.strip(),r},s.prototype.split=function(t,e){t.ishrn(this.n,0,e)},s.prototype.imulK=function(t){return t.imul(this.k)},n(l,s),l.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;n>i;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];e.words[e.length++]=o&r;for(var i=10;i<t.length;i++){var a=t.words[i];t.words[i-10]=(a&r)<<4|o>>>22,o=a}t.words[i-10]=o>>>22,t.length-=9},l.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e,r=0,n=0;n<t.length;n++){var i=t.words[n];e=64*i,r+=977*i,e+=r/67108864|0,r&=67108863,t.words[n]=r,r=e}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(u,s),n(c,s),n(h,s),h.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*t.words[r]+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function y(t){if(g[t])return g[t];var y;if("k256"===t)y=new l;else if("p224"===t)y=new u;else if("p192"===t)y=new c;else{if("p25519"!==t)throw new Error("Unknown prime "+t);y=new h}return g[t]=y,y},f.prototype._verify1=function(t){r(!t.sign,"red works only with positives"),r(t.red,"red works only with red numbers")},f.prototype._verify2=function(t,e){r(!t.sign&&!e.sign,"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},f.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.mod(this.m)._forceRed(this)},f.prototype.neg=function(t){var e=t.clone();return e.sign=!e.sign,e.iadd(this.m)._forceRed(this)},f.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},f.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},f.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},f.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},f.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.shln(e))},f.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},f.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},f.prototype.isqr=function(t){return this.imul(t,t)},f.prototype.sqr=function(t){return this.mul(t,t)},f.prototype.sqrt=function(t){if(0===t.cmpn(0))return t.clone();var e=this.m.andln(3);if(r(e%2===1),3===e){var n=this.m.add(new i(1)).ishrn(2),o=this.pow(t,n);return o}for(var a=this.m.subn(1),s=0;0!==a.cmpn(0)&&0===a.andln(1);)s++,a.ishrn(1);r(0!==a.cmpn(0));var l=new i(1).toRed(this),u=l.redNeg(),c=this.m.subn(1).ishrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,c).cmp(u);)h.redIAdd(u);for(var f=this.pow(h,a),o=this.pow(t,a.addn(1).ishrn(1)),d=this.pow(t,a),p=s;0!==d.cmp(l);){for(var v=d,m=0;0!==v.cmp(l);m++)v=v.redSqr();r(p>m);var g=this.pow(f,new i(1).ishln(p-m-1));o=o.redMul(g),f=g.redSqr(),d=d.redMul(f),p=m}return o},f.prototype.invm=function(t){var e=t._invmp(this.m);return e.sign?(e.sign=!1,this.imod(e).redNeg()):this.imod(e)},f.prototype.pow=function(t,e){var r=[];if(0===e.cmpn(0))return new i(1);for(var n=e.clone();0!==n.cmpn(0);)r.push(n.andln(1)),n.ishrn(1);for(var o=t,a=0;a<r.length&&0===r[a];a++,o=this.sqr(o));if(++a<r.length)for(var n=this.sqr(o);a<r.length;a++,n=this.sqr(n))0!==r[a]&&(o=this.mul(o,n));return o},f.prototype.convertTo=function(t){var e=t.mod(this.m);return e===t?e.clone():e},f.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new d(t)},n(d,f),d.prototype.convertTo=function(t){return this.imod(t.shln(this.shift))},d.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},d.prototype.imul=function(t,e){if(0===t.cmpn(0)||0===e.cmpn(0))return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).ishrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},d.prototype.mul=function(t,e){if(0===t.cmpn(0)||0===e.cmpn(0))return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).ishrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},d.prototype.invm=function(t){var e=this.imod(t._invmp(this.m).mul(this.r2));return e._forceRed(this)}}("undefined"==typeof e||e,this)},{}],86:[function(t,e,r){"use strict";function n(t){return i(t[0])*i(t[1])}var i=t("./lib/bn-sign");e.exports=n},{"./lib/bn-sign":77}],87:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[1]).sub(t[1].mul(e[0])),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":82}],88:[function(t,e,r){"use strict";function n(t){var e=t[0],r=t[1];if(0===e.cmpn(0))return 0;var n=e.divmod(r),a=n.div,s=i(a),l=n.mod;if(0===l.cmpn(0))return s;if(s){var u=o(s)+4,c=i(l.shln(u).divRound(r));return 0>s&&(c=-c),s+c*Math.pow(2,-u)}var h=r.bitLength()-l.bitLength()+53,c=i(l.shln(h).divRound(r));return 1023>h?c*Math.pow(2,-h):(c*=Math.pow(2,-1023),c*Math.pow(2,1023-h))}var i=t("./lib/bn-to-num"),o=t("./lib/ctz");e.exports=n},{"./lib/bn-to-num":78,"./lib/ctz":79}],89:[function(t,e,r){"use strict";function n(t,e){for(var r=0;t>r;++r)if(!(e[r]<=e[r+t]))return!0;return!1}function i(t,e,r,i){for(var o=0,a=0,s=0,l=t.length;l>s;++s){var u=t[s];if(!n(e,u)){for(var c=0;2*e>c;++c)r[o++]=u[c];i[a++]=s}}return a}function o(t,e,r,n){var o=t.length,a=e.length;if(!(0>=o||0>=a)){var s=t[0].length>>>1;if(!(0>=s)){var l,u=h.mallocDouble(2*s*o),c=h.mallocInt32(o);if(o=i(t,s,u,c),o>0){if(1===s&&n)f.init(o),l=f.sweepComplete(s,r,0,o,u,c,0,o,u,c);else{var p=h.mallocDouble(2*s*a),v=h.mallocInt32(a);a=i(e,s,p,v),a>0&&(f.init(o+a),l=1===s?f.sweepBipartite(s,r,0,o,u,c,0,a,p,v):d(s,r,n,o,u,c,a,p,v),h.free(p),h.free(v))}h.free(u),h.free(c)}return l}}}function a(t,e){c.push([t,e])}function s(t){return c=[],o(t,t,a,!0),c}function l(t,e){return c=[],o(t,e,a,!1),c}function u(t,e,r){switch(arguments.length){case 1:return s(t);case 2:return"function"==typeof e?o(t,t,e,!0):l(t,e);case 3:return o(t,e,r,!1);default:throw new Error("box-intersect: Invalid arguments")}}e.exports=u;var c,h=t("typedarray-pool"),f=t("./lib/sweep"),d=t("./lib/intersect"); },{"./lib/intersect":91,"./lib/sweep":95,"typedarray-pool":458}],90:[function(t,e,r){"use strict";function n(t,e,r){var n="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),i=["function ",n,"(",w.join(),"){","var ",u,"=2*",o,";"],l="for(var i="+c+","+p+"="+u+"*"+c+";i<"+h+";++i,"+p+"+="+u+"){var x0="+f+"["+a+"+"+p+"],x1="+f+"["+a+"+"+p+"+"+o+"],xi="+d+"[i];",M="for(var j="+v+","+b+"="+u+"*"+v+";j<"+m+";++j,"+b+"+="+u+"){var y0="+g+"["+a+"+"+b+"],"+(r?"y1="+g+"["+a+"+"+b+"+"+o+"],":"")+"yi="+y+"[j];";return t?i.push(l,_,":",M):i.push(M,_,":",l),r?i.push("if(y1<x0||x1<y0)continue;"):e?i.push("if(y0<=x0||x1<y0)continue;"):i.push("if(y0<x0||x1<y0)continue;"),i.push("for(var k="+a+"+1;k<"+o+";++k){var r0="+f+"[k+"+p+"],r1="+f+"[k+"+o+"+"+p+"],b0="+g+"[k+"+b+"],b1="+g+"[k+"+o+"+"+b+"];if(r1<b0||b1<r0)continue "+_+";}var "+x+"="+s+"("),e?i.push("yi,xi"):i.push("xi,yi"),i.push(");if("+x+"!==void 0)return "+x+";}}}"),{name:n,code:i.join("")}}function i(t){function e(e,r){var o=n(e,r,t);i.push(o.code),a.push("return "+o.name+"("+w.join()+");")}var r="bruteForce"+(t?"Full":"Partial"),i=[],o=w.slice();t||o.splice(3,0,l);var a=["function "+r+"("+o.join()+"){"];a.push("if("+h+"-"+c+">"+m+"-"+v+"){"),t?(e(!0,!1),a.push("}else{"),e(!1,!1)):(a.push("if("+l+"){"),e(!0,!0),a.push("}else{"),e(!0,!1),a.push("}}else{if("+l+"){"),e(!1,!0),a.push("}else{"),e(!1,!1),a.push("}")),a.push("}}return "+r);var s=i.join("")+a.join(""),u=new Function(s);return u()}var o="d",a="ax",s="vv",l="fp",u="es",c="rs",h="re",f="rb",d="ri",p="rp",v="bs",m="be",g="bb",y="bi",b="bp",x="rv",_="Q",w=[o,a,s,c,h,f,d,v,m,g,y];r.partial=i(!1),r.full=i(!0)},{}],91:[function(t,e,r){"use strict";function n(t,e){var r=8*u.log2(e+1)*(t+1)|0,n=u.nextPow2(A*r);S.length<n&&(l.free(S),S=l.mallocInt32(n));var i=u.nextPow2(T*r);i>L&&(l.free(L),L=l.mallocDouble(i))}function i(t,e,r,n,i,o,a,s,l){var u=A*t;S[u]=e,S[u+1]=r,S[u+2]=n,S[u+3]=i,S[u+4]=o,S[u+5]=a;var c=T*t;L[c]=s,L[c+1]=l}function o(t,e,r,n,i,o,a,s,l,u,c){var h=2*t,f=l*h,d=u[f+e];t:for(var p=i,v=i*h;o>p;++p,v+=h){var m=a[v+e],g=a[v+e+t];if(!(m>d||d>g||n&&d===m)){for(var y=s[p],b=e+1;t>b;++b){var m=a[v+b],g=a[v+b+t],x=u[f+b],_=u[f+b+t];if(x>g||m>_)continue t}var w;if(w=n?r(c,y):r(y,c),void 0!==w)return w}}}function a(t,e,r,n,i,o,a,s,l,u){var c=2*t,h=s*c,f=l[h+e];t:for(var d=n,p=n*c;i>d;++d,p+=c){var v=a[d];if(v!==u){var m=o[p+e],g=o[p+e+t];if(!(m>f||f>g)){for(var y=e+1;t>y;++y){var m=o[p+y],g=o[p+y+t],b=l[h+y],x=l[h+y+t];if(b>g||m>x)continue t}var _=r(v,u);if(void 0!==_)return _}}}}function s(t,e,r,s,l,u,c,v,E){n(t,s+c);var z,I=0,P=2*t;for(i(I++,0,0,s,0,c,r?16:0,-(1/0),1/0),r||i(I++,0,0,c,0,s,1,-(1/0),1/0);I>0;){I-=1;var C=I*A,R=S[C],D=S[C+1],O=S[C+2],F=S[C+3],j=S[C+4],N=S[C+5],B=I*T,U=L[B],V=L[B+1],q=1&N,G=!!(16&N),H=l,X=u,Y=v,W=E;if(q&&(H=v,X=E,Y=l,W=u),!(2&N&&(O=_(t,R,D,O,H,X,V),D>=O)||4&N&&(D=w(t,R,D,O,H,X,U),D>=O))){var Z=O-D,K=j-F;if(G){if(y>t*Z*(Z+K)){if(z=d.scanComplete(t,R,e,D,O,H,X,F,j,Y,W),void 0!==z)return z;continue}}else{if(t*Math.min(Z,K)<m){if(z=h(t,R,e,q,D,O,H,X,F,j,Y,W),void 0!==z)return z;continue}if(g>t*Z*K){if(z=d.scanBipartite(t,R,e,q,D,O,H,X,F,j,Y,W),void 0!==z)return z;continue}}var J=b(t,R,D,O,H,X,U,V);if(J>D)if(m>t*(J-D)){if(z=f(t,R+1,e,D,J,H,X,F,j,Y,W),void 0!==z)return z}else if(R===t-2){if(z=q?d.sweepBipartite(t,e,F,j,Y,W,D,J,H,X):d.sweepBipartite(t,e,D,J,H,X,F,j,Y,W),void 0!==z)return z}else i(I++,R+1,D,J,F,j,q,-(1/0),1/0),i(I++,R+1,F,j,D,J,1^q,-(1/0),1/0);if(O>J){var =p(t,R,F,j,Y,W),Q=Y[P*+R],tt=x(t,R,,j,Y,W,Q);if(j>tt&&i(I++,R,J,O,tt,j,(4|q)+(G?16:0),Q,V),>F&&i(I++,R,J,O,F,,(2|q)+(G?16:0),U,Q),+1===tt){if(z=G?a(t,R,e,J,O,H,X,,Y,W[]):o(t,R,e,q,J,O,H,X,,Y,W[]),void 0!==z)return z}else if(tt>){var et;if(G){if(et=M(t,R,J,O,H,X,Q),et>J){var rt=x(t,R,J,et,H,X,Q);if(R===t-2){if(rt>J&&(z=d.sweepComplete(t,e,J,rt,H,X,,tt,Y,W),void 0!==z))return z;if(et>rt&&(z=d.sweepBipartite(t,e,rt,et,H,X,,tt,Y,W),void 0!==z))return z}else rt>J&&i(I++,R+1,J,rt,,tt,16,-(1/0),1/0),et>rt&&(i(I++,R+1,rt,et,,tt,0,-(1/0),1/0),i(I++,R+1,,tt,rt,et,1,-(1/0),1/0))}}else et=q?k(t,R,J,O,H,X,Q):M(t,R,J,O,H,X,Q),et>J&&(R===t-2?z=q?d.sweepBipartite(t,e,,tt,Y,W,J,et,H,X):d.sweepBipartite(t,e,J,et,H,X,,tt,Y,W):(i(I++,R+1,J,et,,tt,q,-(1/0),1/0),i(I++,R+1,,tt,J,et,1^q,-(1/0),1/0)))}}}}}e.exports=s;var l=t("typedarray-pool"),u=t("bit-twiddle"),c=t("./brute"),h=c.partial,f=c.full,d=t("./sweep"),p=t("./median"),v=t("./partition"),m=128,g=1<<22,y=1<<22,b=v("!(lo>=p0)&&!(p1>=hi)",["p0","p1"]),x=v("lo===p0",["p0"]),_=v("lo<p0",["p0"]),w=v("hi<=p0",["p0"]),M=v("lo<=p0&&p0<=hi",["p0"]),k=v("lo<p0&&p0<=hi",["p0"]),A=6,T=2,E=1024,S=l.mallocInt32(E),L=l.mallocDouble(E)},{"./brute":90,"./median":92,"./partition":93,"./sweep":95,"bit-twiddle":51,"typedarray-pool":458}],92:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){for(var a=2*t,s=a*(r+1)+e,l=r+1;n>l;++l,s+=a)for(var u=i[s],c=l,h=a*(l-1);c>r&&i[h+e]>u;--c,h-=a){for(var f=h,d=h+a,p=0;a>p;++p,++f,++d){var v=i[f];i[f]=i[d],i[d]=v}var m=o[c];o[c]=o[c-1],o[c-1]=m}}function i(t,e,r,i,o,l){if(r+1>=i)return r;for(var u=r,c=i,h=i+r>>>1,f=2*t,d=h,p=o[f*h+e];c>u;){if(s>c-u){n(t,e,u,c,o,l),p=o[f*h+e];break}var v=c-u,m=Math.random()*v+u|0,g=o[f*m+e],y=Math.random()*v+u|0,b=o[f*y+e],x=Math.random()*v+u|0,_=o[f*x+e];b>=g?_>=b?(d=y,p=b):g>=_?(d=m,p=g):(d=x,p=_):b>=_?(d=y,p=b):_>=g?(d=m,p=g):(d=x,p=_);for(var w=f*(c-1),M=f*d,k=0;f>k;++k,++w,++M){var A=o[w];o[w]=o[M],o[M]=A}var T=l[c-1];l[c-1]=l[d],l[d]=T,d=a(t,e,u,c-1,o,l,p);for(var w=f*(c-1),M=f*d,k=0;f>k;++k,++w,++M){var A=o[w];o[w]=o[M],o[M]=A}var T=l[c-1];if(l[c-1]=l[d],l[d]=T,d>h){for(c=d-1;c>u&&o[f*(c-1)+e]===p;)c-=1;c+=1}else{if(!(h>d))break;for(u=d+1;c>u&&o[f*u+e]===p;)u+=1}}return a(t,e,r,h,o,l,o[f*h+e])}e.exports=i;var o=t("./partition"),a=o("lo<p0",["p0"]),s=8},{"./partition":93}],93:[function(t,e,r){"use strict";function n(t,e){var r="abcdef".split("").concat(e),n=[];return t.indexOf("lo")>=0&&n.push("lo=e[k+n]"),t.indexOf("hi")>=0&&n.push("hi=e[k+o]"),r.push(i.replace("_",n.join()).replace("",t)),Function.apply(void 0,r)}e.exports=n;var i="for(var j=2*a,k=j*c,l=k,m=c,n=b,o=a+b,p=c;d>p;++p,k+=j){var _;if()if(m===p)m+=1,l+=j;else{for(var s=0;j>s;++s){var t=e[k+s];e[k+s]=e[l],e[l++]=t}var u=f[p];f[p]=f[m],f[m++]=u}}return m"},{}],94:[function(t,e,r){"use strict";function n(t,e){4*f>=e?i(0,e-1,t):h(0,e-1,t)}function i(t,e,r){for(var n=2*(t+1),i=t+1;e>=i;++i){for(var o=r[n++],a=r[n++],s=i,l=n-2;s-- >t;){var u=r[l-2],c=r[l-1];if(o>u)break;if(u===o&&a>c)break;r[l]=u,r[l+1]=c,l-=2}r[l]=o,r[l+1]=a}}function o(t,e,r){t*=2,e*=2;var n=r[t],i=r[t+1];r[t]=r[e],r[t+1]=r[e+1],r[e]=n,r[e+1]=i}function a(t,e,r){t*=2,e*=2,r[t]=r[e],r[t+1]=r[e+1]}function s(t,e,r,n){t*=2,e*=2,r*=2;var i=n[t],o=n[t+1];n[t]=n[e],n[t+1]=n[e+1],n[e]=n[r],n[e+1]=n[r+1],n[r]=i,n[r+1]=o}function l(t,e,r,n,i){t*=2,e*=2,i[t]=i[e],i[e]=r,i[t+1]=i[e+1],i[e+1]=n}function u(t,e,r){t*=2,e*=2;var n=r[t],i=r[e];return i>n?!1:n===i?r[t+1]>r[e+1]:!0}function c(t,e,r,n){t*=2;var i=n[t];return e>i?!0:i===e?n[t+1]<r:!1}function h(t,e,r){var n=(e-t+1)/6|0,d=t+n,p=e-n,v=t+e>>1,m=v-n,g=v+n,y=d,b=m,x=v,_=g,w=p,M=t+1,k=e-1,A=0;u(y,b,r)&&(A=y,y=b,b=A),u(_,w,r)&&(A=_,_=w,w=A),u(y,x,r)&&(A=y,y=x,x=A),u(b,x,r)&&(A=b,b=x,x=A),u(y,_,r)&&(A=y,y=_,_=A),u(x,_,r)&&(A=x,x=_,_=A),u(b,w,r)&&(A=b,b=w,w=A),u(b,x,r)&&(A=b,b=x,x=A),u(_,w,r)&&(A=_,_=w,w=A);for(var T=r[2*b],E=r[2*b+1],S=r[2*_],L=r[2*_+1],z=2*y,I=2*x,P=2*w,C=2*d,R=2*v,D=2*p,O=0;2>O;++O){var F=r[z+O],j=r[I+O],N=r[P+O];r[C+O]=F,r[R+O]=j,r[D+O]=N}a(m,t,r),a(g,e,r);for(var B=M;k>=B;++B)if(c(B,T,E,r))B!==M&&o(B,M,r),++M;else if(!c(B,S,L,r))for(;;){if(c(k,S,L,r)){c(k,T,E,r)?(s(B,M,k,r),++M,--k):(o(B,k,r),--k);break}if(--k<B)break}l(t,M-1,T,E,r),l(e,k+1,S,L,r),f>=M-2-t?i(t,M-2,r):h(t,M-2,r),f>=e-(k+2)?i(k+2,e,r):h(k+2,e,r),f>=k-M?i(M,k,r):h(M,k,r)}e.exports=n;var f=32},{}],95:[function(t,e,r){"use strict";function n(t){var e=h.nextPow2(t);v.length<e&&(c.free(v),v=c.mallocInt32(e)),m.length<e&&(c.free(m),m=c.mallocInt32(e)),g.length<e&&(c.free(g),g=c.mallocInt32(e)),y.length<e&&(c.free(y),y=c.mallocInt32(e)),b.length<e&&(c.free(b),b=c.mallocInt32(e)),x.length<e&&(c.free(x),x=c.mallocInt32(e));var r=8*e;_.length<r&&(c.free(_),_=c.mallocDouble(r))}function i(t,e,r,n){var i=e[n],o=t[r-1];t[i]=o,e[o]=i}function o(t,e,r,n){t[r]=n,e[n]=r}function a(t,e,r,n,a,s,l,u,c,h){for(var p=0,b=2*t,x=t-1,w=b-1,M=r;n>M;++M){var k=s[M],A=b*M;_[p++]=a[A+x],_[p++]=-(k+1),_[p++]=a[A+w],_[p++]=k}for(var M=l;u>M;++M){var k=h[M]+d,T=b*M;_[p++]=c[T+x],_[p++]=-k,_[p++]=c[T+w],_[p++]=k}var E=p>>>1;f(_,E);for(var S=0,L=0,M=0;E>M;++M){var z=0|_[2*M+1];if(z>=d)z=z-d|0,i(g,y,L--,z);else if(z>=0)i(v,m,S--,z);else if(-d>=z){z=-z-d|0;for(var I=0;S>I;++I){var P=e(v[I],z);if(void 0!==P)return P}o(g,y,L++,z)}else{z=-z-1|0;for(var I=0;L>I;++I){var P=e(z,g[I]);if(void 0!==P)return P}o(v,m,S++,z)}}}function s(t,e,r,n,a,s,l,u,c,h){for(var d=0,p=2*t,w=t-1,M=p-1,k=r;n>k;++k){var A=s[k]+1<<1,T=p*k;_[d++]=a[T+w],_[d++]=-A,_[d++]=a[T+M],_[d++]=A}for(var k=l;u>k;++k){var A=h[k]+1<<1,E=p*k;_[d++]=c[E+w],_[d++]=1|-A,_[d++]=c[E+M],_[d++]=1|A}var S=d>>>1;f(_,S);for(var L=0,z=0,I=0,k=0;S>k;++k){var P=0|_[2*k+1],C=1&P;if(S-1>k&&P>>1===_[2*k+3]>>1&&(C=2,k+=1),0>P){for(var R=-(P>>1)-1,D=0;I>D;++D){var O=e(b[D],R);if(void 0!==O)return O}if(0!==C)for(var D=0;L>D;++D){var O=e(v[D],R);if(void 0!==O)return O}if(1!==C)for(var D=0;z>D;++D){var O=e(g[D],R);if(void 0!==O)return O}0===C?o(v,m,L++,R):1===C?o(g,y,z++,R):2===C&&o(b,x,I++,R)}else{var R=(P>>1)-1;0===C?i(v,m,L--,R):1===C?i(g,y,z--,R):2===C&&i(b,x,I--,R)}}}function l(t,e,r,n,a,s,l,u,c,h,p,g){var y=0,b=2*t,x=e,w=e+t,M=1,k=1;n?k=d:M=d;for(var A=a;s>A;++A){var T=A+M,E=b*A;_[y++]=l[E+x],_[y++]=-T,_[y++]=l[E+w],_[y++]=T}for(var A=c;h>A;++A){var T=A+k,S=b*A;_[y++]=p[S+x],_[y++]=-T}var L=y>>>1;f(_,L);for(var z=0,A=0;L>A;++A){var I=0|_[2*A+1];if(0>I){var T=-I,P=!1;if(T>=d?(P=!n,T-=d):(P=!!n,T-=1),P)o(v,m,z++,T);else{var C=g[T],R=b*T,D=p[R+e+1],O=p[R+e+1+t];t:for(var F=0;z>F;++F){var j=v[F],N=b*j;if(!(O<l[N+e+1]||l[N+e+1+t]<D)){for(var B=e+2;t>B;++B)if(p[R+B+t]<l[N+B]||l[N+B+t]<p[R+B])continue t;var U,V=u[j];if(U=n?r(C,V):r(V,C),void 0!==U)return U}}}}else i(v,m,z--,I-M)}}function u(t,e,r,n,i,o,a,s,l,u,c){for(var h=0,p=2*t,m=e,g=e+t,y=n;i>y;++y){var b=y+d,x=p*y;_[h++]=o[x+m],_[h++]=-b,_[h++]=o[x+g],_[h++]=b}for(var y=s;l>y;++y){var b=y+1,w=p*y;_[h++]=u[w+m],_[h++]=-b}var M=h>>>1;f(_,M);for(var k=0,y=0;M>y;++y){var A=0|_[2*y+1];if(0>A){var b=-A;if(b>=d)v[k++]=b-d;else{b-=1;var T=c[b],E=p*b,S=u[E+e+1],L=u[E+e+1+t];t:for(var z=0;k>z;++z){var I=v[z],P=a[I];if(P===T)break;var C=p*I;if(!(L<o[C+e+1]||o[C+e+1+t]<S)){for(var R=e+2;t>R;++R)if(u[E+R+t]<o[C+R]||o[C+R+t]<u[E+R])continue t;var D=r(P,T);if(void 0!==D)return D}}}}else{for(var b=A-d,z=k-1;z>=0;--z)if(v[z]===b){for(var R=z+1;k>R;++R)v[R-1]=v[R];break}--k}}}e.exports={init:n,sweepBipartite:a,sweepComplete:s,scanBipartite:l,scanComplete:u};var c=t("typedarray-pool"),h=t("bit-twiddle"),f=t("./sort"),d=1<<28,p=1024,v=c.mallocInt32(p),m=c.mallocInt32(p),g=c.mallocInt32(p),y=c.mallocInt32(p),b=c.mallocInt32(p),x=c.mallocInt32(p),_=c.mallocDouble(8*p)},{"./sort":94,"bit-twiddle":51,"typedarray-pool":458}],96:[function(t,e,r){(function(t){function r(t,e){return d[0]=t,d[1]=e,f[0]}function n(t){return f[0]=t,d[0]}function i(t){return f[0]=t,d[1]}function o(t,e){return d[1]=t,d[0]=e,f[0]}function a(t){return f[0]=t,d[1]}function s(t){return f[0]=t,d[0]}function l(t,e){return p.writeUInt32LE(t,0,!0),p.writeUInt32LE(e,4,!0),p.readDoubleLE(0,!0)}function u(t){return p.writeDoubleLE(t,0,!0),p.readUInt32LE(0,!0)}function c(t){return p.writeDoubleLE(t,0,!0),p.readUInt32LE(4,!0)}var h=!1;if("undefined"!=typeof Float64Array){var f=new Float64Array(1),d=new Uint32Array(f.buffer);f[0]=1,h=!0,1072693248===d[1]?(e.exports=function(t){return f[0]=t,[d[0],d[1]]},e.exports.pack=r,e.exports.lo=n,e.exports.hi=i):1072693248===d[0]?(e.exports=function(t){return f[0]=t,[d[1],d[0]]},e.exports.pack=o,e.exports.lo=a,e.exports.hi=s):h=!1}if(!h){var p=new t(8);e.exports=function(t){return p.writeDoubleLE(t,0,!0),[p.readUInt32LE(0,!0),p.readUInt32LE(4,!0)]},e.exports.pack=l,e.exports.lo=u,e.exports.hi=c}e.exports.sign=function(t){return e.exports.hi(t)>>>31},e.exports.exponent=function(t){var r=e.exports.hi(t);return(r<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){var r=e.exports.hi(t);return!(2146435072&r)}}).call(this,t("buffer").Buffer)},{buffer:53}],97:[function(t,e,r){"use strict";function n(t,e){if(isNaN(t)||isNaN(e))return NaN;if(t===e)return t;if(0===t)return 0>e?-o:o;var r=i.hi(t),n=i.lo(t);return e>t==t>0?n===a?(r+=1,n=0):n+=1:0===n?(n=a,r-=1):n-=1,i.pack(n,r)}var i=t("double-bits"),o=Math.pow(2,-1074),a=-1>>>0;e.exports=n},{"double-bits":96}],98:[function(t,e,r){"use strict";function n(t,e){for(var r=t.length,n=new Array(r),o=0;r>o;++o)n[o]=i(t[o],e[o]);return n}var i=t("big-rat/add");e.exports=n},{"big-rat/add":72}],99:[function(t,e,r){"use strict";function n(t){for(var e=new Array(t.length),r=0;r<t.length;++r)e[r]=i(t[r]);return e}e.exports=n;var i=t("big-rat")},{"big-rat":75}],100:[function(t,e,r){"use strict";function n(t,e){for(var r=i(e),n=t.length,a=new Array(n),s=0;n>s;++s)a[s]=o(t[s],r);return a}var i=t("big-rat"),o=t("big-rat/mul");e.exports=n},{"big-rat":75,"big-rat/mul":84}],101:[function(t,e,r){"use strict";function n(t,e){for(var r=t.length,n=new Array(r),o=0;r>o;++o)n[o]=i(t[o],e[o]);return n}var i=t("big-rat/sub");e.exports=n},{"big-rat/sub":87}],102:[function(t,e,r){"use strict";function n(t,e,r,n){for(var i=0;2>i;++i){var o=t[i],a=e[i],s=Math.min(o,a),l=Math.max(o,a),u=r[i],c=n[i],h=Math.min(u,c),f=Math.max(u,c);if(s>f||h>l)return!1}return!0}function i(t,e,r,i){var a=o(t,r,i),s=o(e,r,i);if(a>0&&s>0||0>a&&0>s)return!1;var l=o(r,t,e),u=o(i,t,e);return l>0&&u>0||0>l&&0>u?!1:0===a&&0===s&&0===l&&0===u?n(t,e,r,i):!0}e.exports=i;var o=t("robust-orientation")[3]},{"robust-orientation":439}],103:[function(t,e,r){"use strict";"use restrict";function n(t){this.roots=new Array(t),this.ranks=new Array(t);for(var e=0;t>e;++e)this.roots[e]=e,this.ranks[e]=0}e.exports=n;var i=n.prototype;Object.defineProperty(i,"length",{get:function(){return this.roots.length}}),i.makeSet=function(){var t=this.roots.length;return this.roots.push(t),this.ranks.push(0),t},i.find=function(t){for(var e=t,r=this.roots;r[t]!==t;)t=r[t];for(;r[e]!==t;){var n=r[e];r[e]=t,e=n}return t},i.link=function(t,e){var r=this.find(t),n=this.find(e);if(r!==n){var i=this.ranks,o=this.roots,a=i[r],s=i[n];s>a?o[r]=n:a>s?o[n]=r:(o[n]=r,++i[r])}}},{}],104:[function(t,e,r){(function(t){var r=function(){"use strict";function e(r,n,i,o){function s(r,i){if(null===r)return null;if(0==i)return r;var l,f;if("object"!=typeof r)return r;if(e.__isArray(r))l=[];else if(e.__isRegExp(r))l=new RegExp(r.source,a(r)),r.lastIndex&&(l.lastIndex=r.lastIndex);else if(e.__isDate(r))l=new Date(r.getTime());else{if(h&&t.isBuffer(r))return l=new t(r.length),r.copy(l),l;"undefined"==typeof o?(f=Object.getPrototypeOf(r),l=Object.create(f)):(l=Object.create(o),f=o)}if(n){var d=u.indexOf(r);if(-1!=d)return c[d];u.push(r),c.push(l)}for(var p in r){var v;f&&(v=Object.getOwnPropertyDescriptor(f,p)),v&&null==v.set||(l[p]=s(r[p],i-1))}return l}var l;"object"==typeof n&&(i=n.depth,o=n.prototype,l=n.filter,n=n.circular);var u=[],c=[],h="undefined"!=typeof t;return"undefined"==typeof n&&(n=!0),"undefined"==typeof i&&(i=1/0),s(r,i)}function r(t){return Object.prototype.toString.call(t)}function n(t){return"object"==typeof t&&"[object Date]"===r(t)}function i(t){return"object"==typeof t&&"[object Array]"===r(t)}function o(t){return"object"==typeof t&&"[object RegExp]"===r(t)}function a(t){var e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}return e.clonePrototype=function(t){if(null===t)return null;var e=function(){};return e.prototype=t,new e},e.__objToStr=r,e.__isDate=n,e.__isArray=i,e.__isRegExp=o,e.__getRegExpFlags=a,e}();"object"==typeof e&&e.exports&&(e.exports=r)}).call(this,t("buffer").Buffer)},{buffer:53}],105:[function(t,e,r){e.exports={jet:[{index:0,rgb:[0,0,131]},{index:.125,rgb:[0,60,170]},{index:.375,rgb:[5,255,255]},{index:.625,rgb:[255,255,0]},{index:.875,rgb:[250,0,0]},{index:1,rgb:[128,0,0]}],hsv:[{index:0,rgb:[255,0,0]},{index:.169,rgb:[253,255,2]},{index:.173,rgb:[247,255,2]},{index:.337,rgb:[0,252,4]},{index:.341,rgb:[0,252,10]},{index:.506,rgb:[1,249,255]},{index:.671,rgb:[2,0,253]},{index:.675,rgb:[8,0,253]},{index:.839,rgb:[255,0,251]},{index:.843,rgb:[255,0,245]},{index:1,rgb:[255,0,6]}],hot:[{index:0,rgb:[0,0,0]},{index:.3,rgb:[230,0,0]},{index:.6,rgb:[255,210,0]},{index:1,rgb:[255,255,255]}],cool:[{index:0,rgb:[0,255,255]},{index:1,rgb:[255,0,255]}],spring:[{index:0,rgb:[255,0,255]},{index:1,rgb:[255,255,0]}],summer:[{index:0,rgb:[0,128,102]},{index:1,rgb:[255,255,102]}],autumn:[{index:0,rgb:[255,0,0]},{index:1,rgb:[255,255,0]}],winter:[{index:0,rgb:[0,0,255]},{index:1,rgb:[0,255,128]}],bone:[{index:0,rgb:[0,0,0]},{index:.376,rgb:[84,84,116]},{index:.753,rgb:[169,200,200]},{index:1,rgb:[255,255,255]}],copper:[{index:0,rgb:[0,0,0]},{index:.804,rgb:[255,160,102]},{index:1,rgb:[255,199,127]}],greys:[{index:0,rgb:[0,0,0]},{index:1,rgb:[255,255,255]}],yignbu:[{index:0,rgb:[8,29,88]},{index:.125,rgb:[37,52,148]},{index:.25,rgb:[34,94,168]},{index:.375,rgb:[29,145,192]},{index:.5,rgb:[65,182,196]},{index:.625,rgb:[127,205,187]},{index:.75,rgb:[199,233,180]},{index:.875,rgb:[237,248,217]},{index:1,rgb:[255,255,217]}],greens:[{index:0,rgb:[0,68,27]},{index:.125,rgb:[0,109,44]},{index:.25,rgb:[35,139,69]},{index:.375,rgb:[65,171,93]},{index:.5,rgb:[116,196,118]},{index:.625,rgb:[161,217,155]},{index:.75,rgb:[199,233,192]},{index:.875,rgb:[229,245,224]},{index:1,rgb:[247,252,245]}],yiorrd:[{index:0,rgb:[128,0,38]},{index:.125,rgb:[189,0,38]},{index:.25,rgb:[227,26,28]},{index:.375,rgb:[252,78,42]},{index:.5,rgb:[253,141,60]},{index:.625,rgb:[254,178,76]},{index:.75,rgb:[254,217,118]},{index:.875,rgb:[255,237,160]},{index:1,rgb:[255,255,204]}],bluered:[{index:0,rgb:[0,0,255]},{index:1,rgb:[255,0,0]}],rdbu:[{index:0,rgb:[5,10,172]},{index:.35,rgb:[106,137,247]},{index:.5,rgb:[190,190,190]},{index:.6,rgb:[220,170,132]},{index:.7,rgb:[230,145,90]},{index:1,rgb:[178,10,28]}],picnic:[{index:0,rgb:[0,0,255]},{index:.1,rgb:[51,153,255]},{index:.2,rgb:[102,204,255]},{index:.3,rgb:[153,204,255]},{index:.4,rgb:[204,204,255]},{index:.5,rgb:[255,255,255]},{index:.6,rgb:[255,204,255]},{index:.7,rgb:[255,153,255]},{index:.8,rgb:[255,102,204]},{index:.9,rgb:[255,102,102]},{index:1,rgb:[255,0,0]}],rainbow:[{index:0,rgb:[150,0,90]},{index:.125,rgb:[0,0,200]},{index:.25,rgb:[0,25,255]},{index:.375,rgb:[0,152,255]},{index:.5,rgb:[44,255,150]},{index:.625,rgb:[151,255,0]},{index:.75,rgb:[255,234,0]},{index:.875,rgb:[255,111,0]},{index:1,rgb:[255,0,0]}],portland:[{index:0,rgb:[12,51,131]},{index:.25,rgb:[10,136,186]},{index:.5,rgb:[242,211,56]},{index:.75,rgb:[242,143,56]},{index:1,rgb:[217,30,30]}],blackbody:[{index:0,rgb:[0,0,0]},{index:.2,rgb:[230,0,0]},{index:.4,rgb:[230,210,0]},{index:.7,rgb:[255,255,255]},{index:1,rgb:[160,200,255]}],earth:[{index:0,rgb:[0,0,130]},{index:.1,rgb:[0,180,180]},{index:.2,rgb:[40,210,40]},{index:.4,rgb:[230,230,50]},{index:.6,rgb:[120,70,20]},{index:1,rgb:[255,255,255]}],electric:[{index:0,rgb:[0,0,0]},{index:.15,rgb:[30,0,100]},{index:.4,rgb:[120,0,100]},{index:.6,rgb:[160,90,0]},{index:.8,rgb:[230,200,0]},{index:1,rgb:[255,250,220]}],alpha:[{index:0,rgb:[255,255,255,0]},{index:0,rgb:[255,255,255,1]}]}},{}],106:[function(t,e,r){"use strict";function n(t){for(var e,r="#",n=0;3>n;++n)e=t[n],e=e.toString(16),r+=("00"+e).substr(e.length);return r}function i(t){return"rgba("+t.join(",")+")"}var o=t("arraytools"),a=t("clone"),s=t("./colorScales");e.exports=function(t){var e,r,l,u,c,h,f,d,p,v,m,g,y,b=[],x=[],_=[],w=[];if(o.isPlainObject(t)||(t={}),p=t.nshades||72,d=t.format||"hex",f=t.colormap,f||(f="jet"),"string"==typeof f){if(f=f.toLowerCase(),!s[f])throw Error(f+" not a supported colorscale");h=a(s[f])}else{if(!Array.isArray(f))throw Error("unsupported colormap option",f);h=a(f)}if(h.length>p)throw new Error(f+" map requires nshades to be at least size "+h.length);for(m=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:a(t.alpha):"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1],e=h.map(function(t){return Math.round(t.index*p)}),m[0]<0&&(m[0]=0),m[1]<0&&(m[0]=0),m[0]>1&&(m[0]=1),m[1]>1&&(m[0]=1),y=0;y<e.length;++y)g=h[y].index,r=h[y].rgb,4===r.length&&r[3]>=0&&r[3]<=1||(r[3]=m[0]+(m[1]-m[0])*g);for(y=0;y<e.length-1;++y)c=e[y+1]-e[y],l=h[y].rgb,u=h[y+1].rgb,b=b.concat(o.linspace(l[0],u[0],c)),x=x.concat(o.linspace(l[1],u[1],c)),_=_.concat(o.linspace(l[2],u[2],c)),w=w.concat(o.linspace(l[3],u[3],c));return b=b.map(Math.round),x=x.map(Math.round),_=_.map(Math.round),v=o.zip(b,x,_,w),"hex"===d&&(v=v.map(n)),"rgbaString"===d&&(v=v.map(i)),v}},{"./colorScales":105,arraytools:50,clone:104}],107:[function(t,e,r){function n(t,e){return t-e}function i(t,e){var r=t.length,i=t.length-e.length;if(i)return i;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:return t[0]+t[1]-e[0]-e[1]||o(t[0],t[1])-o(e[0],e[1]);case 3:var a=t[0]+t[1],s=e[0]+e[1];if(i=a+t[2]-(s+e[2]))return i;var l=o(t[0],t[1]),u=o(e[0],e[1]);return o(l,t[2])-o(u,e[2])||o(l+t[2],a)-o(u+e[2],s);case 4:var c=t[0],h=t[1],f=t[2],d=t[3],p=e[0],v=e[1],m=e[2],g=e[3];return c+h+f+d-(p+v+m+g)||o(c,h,f,d)-o(p,v,m,g,p)||o(c+h,c+f,c+d,h+f,h+d,f+d)-o(p+v,p+m,p+g,v+m,v+g,m+g)||o(c+h+f,c+h+d,c+f+d,h+f+d)-o(p+v+m,p+v+g,p+m+g,v+m+g);default:for(var y=t.slice().sort(n),b=e.slice().sort(n),x=0;r>x;++x)if(i=y[x]-b[x])return i;return 0}}e.exports=i;var o=Math.min},{}],108:[function(t,e,r){"use strict";function n(t){var e=t.length;if(0===e)return[];if(1===e)return[[0]];var r=t[0].length;return 0===r?[]:1===r?i(t):2===r?o(t):a(t,r)}var i=t("./lib/ch1d"),o=t("./lib/ch2d"),a=t("./lib/chnd");e.exports=n},{"./lib/ch1d":109,"./lib/ch2d":110,"./lib/chnd":111}],109:[function(t,e,r){"use strict";function n(t){for(var e=0,r=0,n=1;n<t.length;++n)t[n][0]<t[e][0]&&(e=n),t[n][0]>t[r][0]&&(r=n);return r>e?[[e],[r]]:e>r?[[r],[e]]:[[e]]}e.exports=n},{}],110:[function(t,e,r){"use strict";function n(t){var e=i(t),r=e.length;if(2>=r)return[];for(var n=new Array(r),o=e[r-1],a=0;r>a;++a){var s=e[a];n[a]=[o,s],o=s}return n}e.exports=n;var i=t("monotone-convex-hull-2d")},{"monotone-convex-hull-2d":113}],111:[function(t,e,r){"use strict";function n(t,e){for(var r=t.length,n=new Array(r),i=0;i<e.length;++i)n[i]=t[e[i]];for(var o=e.length,i=0;r>i;++i)e.indexOf(i)<0&&(n[o++]=t[i]);return n}function i(t,e){for(var r=t.length,n=e.length,i=0;r>i;++i)for(var o=t[i],a=0;a<o.length;++a){var s=o[a];if(n>s)o[a]=e[s];else{s-=n;for(var l=0;n>l;++l)s>=e[l]&&(s+=1);o[a]=s}}return t}function o(t,e){try{return a(t,!0)}catch(r){var o=s(t);if(o.length<=e)return[];var l=n(t,o),u=a(l,!0);return i(u,o)}}e.exports=o;var a=t("incremental-convex-hull"),s=t("affine-hull")},{"affine-hull":112,"incremental-convex-hull":241}],112:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(e+1),n=0;n<t.length;++n)r[n]=t[n];for(var n=0;n<=t.length;++n){for(var i=t.length;e>=i;++i){for(var a=new Array(e),s=0;e>s;++s)a[s]=Math.pow(i+1-n,s);r[i]=a}var l=o.apply(void 0,r);if(l)return!0}return!1}function i(t){var e=t.length;if(0===e)return[];if(1===e)return[0];for(var r=t[0].length,i=[t[0]],o=[0],a=1;e>a;++a)if(i.push(t[a]),n(i,r)){if(o.push(a),o.length===r+1)return o}else i.pop();return o}e.exports=i;var o=t("robust-orientation")},{"robust-orientation":439}],113:[function(t,e,r){"use strict";function n(t){var e=t.length;if(3>e){for(var r=new Array(e),n=0;e>n;++n)r[n]=n;return 2===e&&t[0][0]===t[1][0]&&t[0][1]===t[1][1]?[0]:r}for(var o=new Array(e),n=0;e>n;++n)o[n]=n;o.sort(function(e,r){var n=t[e][0]-t[r][0];return n?n:t[e][1]-t[r][1]});for(var a=[o[0],o[1]],s=[o[0],o[1]],n=2;e>n;++n){for(var l=o[n],u=t[l],c=a.length;c>1&&i(t[a[c-2]],t[a[c-1]],u)<=0;)c-=1,a.pop();for(a.push(l),c=s.length;c>1&&i(t[s[c-2]],t[s[c-1]],u)>=0;)c-=1,s.pop();s.push(l)}for(var r=new Array(s.length+a.length-2),h=0,n=0,f=a.length;f>n;++n)r[h++]=a[n];for(var d=s.length-2;d>0;--d)r[h++]=s[d];return r}e.exports=n;var i=t("robust-orientation")[3]},{"robust-orientation":439}],114:[function(t,e,r){e.exports={AFG:"afghan",ALA:"\\b\\wland",ALB:"albania",DZA:"algeria",ASM:"^(?=.*americ).*samoa",AND:"andorra",AGO:"angola",AIA:"anguill?a",ATA:"antarctica",ATG:"antigua",ARG:"argentin",ARM:"armenia",ABW:"^(?!.*bonaire).*\\baruba",AUS:"australia",AUT:"^(?!.*hungary).*austria|\\baustri.*\\bemp",AZE:"azerbaijan",BHS:"bahamas",BHR:"bahrain",BGD:"bangladesh|^(?=.*east).*paki?stan",BRB:"barbados",BLR:"belarus|byelo",BEL:"^(?!.*luxem).*belgium",BLZ:"belize|^(?=.*british).*honduras",BEN:"benin|dahome",BMU:"bermuda",BTN:"bhutan",BOL:"bolivia",BES:"^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands",BIH:"herzegovina|bosnia",BWA:"botswana|bechuana",BVT:"bouvet",BRA:"brazil",IOT:"british.?indian.?ocean",BRN:"brunei",BGR:"bulgaria",BFA:"burkina|\\bfaso|upper.?volta",BDI:"burundi",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CPV:"verde",CYM:"cayman",CAF:"\\bcentral.african.republic",TCD:"\\bchad",CHL:"\\bchile",CHN:"^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai).*china",CXR:"christmas",CCK:"\\bcocos|keeling",COL:"colombia",COM:"comoro",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bdr|\\bdr.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",COG:"^(?!.*\\bdem)(?!.*\\bdr)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\bcongo",COK:"\\bcook",CRI:"costa.?rica",CIV:"ivoire|ivory",HRV:"croatia",CUB:"\\bcuba",CUW:"^(?!.*bonaire).*\\bcura(c|\xe7)ao",CYP:"cyprus",CZE:"^(?=.*rep).*czech|czechia|bohemia",CSK:"czechoslovakia",DNK:"denmark",DJI:"djibouti",DMA:"dominica(?!n)",DOM:"dominican.rep",ECU:"ecuador",EGY:"egypt",SLV:"el.?salvador",GNQ:"guine.*eq|eq.*guine|^(?=.*span).*guinea",ERI:"eritrea",EST:"estonia",ETH:"ethiopia|abyssinia",FLK:"falkland|malvinas",FRO:"faroe|faeroe",FJI:"fiji",FIN:"finland",FRA:"^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul",GUF:"^(?=.*french).*guiana",PYF:"french.?polynesia|tahiti",ATF:"french.?southern",GAB:"gabon",GMB:"gambia",GEO:"^(?!.*south).*georgia",DDR:"german.?democratic.?republic|democratic.?republic.*germany|east.germany",DEU:"^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german",GHA:"ghana|gold.?coast",GIB:"gibraltar",GRC:"greece|hellenic|hellas",GRL:"greenland",GRD:"grenada",GLP:"guadeloupe",GUM:"\\bguam",GTM:"guatemala",GGY:"guernsey",GIN:"^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea",GNB:"bissau|^(?=.*portu).*guinea",GUY:"guyana|british.?guiana",HTI:"haiti",HMD:"heard.*mcdonald",VAT:"holy.?see|vatican|papal.?st",HND:"^(?!.*brit).*honduras",HKG:"hong.?kong",HUN:"^(?!.*austr).*hungary",ISL:"iceland",IND:"india(?!.*ocea)",IDN:"indonesia",IRN:"\\biran|persia",IRQ:"\\biraq|mesopotamia",IRL:"ireland",IMN:"^(?=.*isle).*\\bman",ISR:"israel",ITA:"italy",JAM:"jamaica",JPN:"japan",JEY:"jersey",JOR:"jordan",KAZ:"kazak",KEN:"kenya|british.?east.?africa|east.?africa.?prot",KIR:"kiribati",PRK:"^(?=.*democrat).*\\bkorea|^(?=.*people).*\\bkorea|^(?=.*north).*\\bkorea|dprk",KOR:"^(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea",KWT:"kuwait",KGZ:"kyrgyz|kirghiz",LAO:"\\blaos?\\b",LVA:"latvia",LBN:"lebanon",LSO:"lesotho|basuto",LBR:"liberia",LBY:"libya",LIE:"liechtenstein",LTU:"lithuania",LUX:"^(?!.*belg).*luxem",MAC:"maca(o|u)",MKD:"macedonia|fyrom",MDG:"madagascar|malagasy",MWI:"malawi|nyasa",MYS:"malaysia",MDV:"maldive",MLI:"\\bmali\\b",MLT:"\\bmalta",MHL:"marshall",MTQ:"martinique",MRT:"mauritania",MUS:"mauritius",MYT:"\\bmayotte",MEX:"\\bmexic",FSM:"micronesia",MDA:"moldov|b(a|e)ssarabia",MCO:"monaco",MNG:"mongolia",MNE:"^(?!.*serbia).*montenegro",MSR:"montserrat",MAR:"morocco|\\bmaroc",MOZ:"mozambique",MMR:"myanmar|burma",NAM:"namibia",NRU:"nauru",NPL:"nepal",NLD:"^(?!.*\\bant)(?!.*\\bcarib).*netherlands",ANT:"^(?=.*\\bant).*(nether|dutch)",NCL:"new.?caledonia",NZL:"new.?zealand",NIC:"nicaragua",NER:"\\bniger(?!ia)",NGA:"nigeria",NIU:"niue",NFK:"norfolk",MNP:"mariana",NOR:"norway",OMN:"\\boman|trucial",PAK:"^(?!.*east).*paki?stan",PLW:"palau",PSE:"palestin|\\bgaza|west.?bank",PAN:"panama",PNG:"papua|new.?guinea",PRY:"paraguay",PER:"peru",PHL:"philippines",PCN:"pitcairn",POL:"poland",PRT:"portugal",PRI:"puerto.?rico",QAT:"qatar",REU:"r(e|\xe9)union",ROU:"r(o|u|ou)mania",RUS:"\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics",RWA:"rwanda",BLM:"barth(e|\xe9)lemy",SHN:"helena",KNA:"kitts|\\bnevis",LCA:"\\blucia",MAF:"^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)",SPM:"miquelon",VCT:"vincent",WSM:"^(?!.*amer).*samoa",SMR:"san.?marino",STP:"\\bs(a|\xe3)o.?tom(e|\xe9)",SAU:"\\bsa\\w*.?arabia",SEN:"senegal",SRB:"^(?!.*monte).*serbia",SYC:"seychell",SLE:"sierra",SGP:"singapore",SXM:"^(?!.*martin)(?!.*saba).*maarten",SVK:"^(?!.*cze).*slovak",SVN:"slovenia",SLB:"solomon",SOM:"somali",ZAF:"\\bs\\w*.?africa",SGS:"south.?georgia|sandwich",SSD:"\\bs\\w*.?sudan",ESP:"spain",LKA:"sri.?lanka|ceylon",SDN:"^(?!.*\\bs(?!u)).*sudan",SUR:"surinam|dutch.?guiana",SJM:"svalbard",SWZ:"swaziland",SWE:"sweden",CHE:"switz|swiss",SYR:"syria",TWN:"taiwan|taipei|formosa",TJK:"tajik",TZA:"tanzania",THA:"thailand|\\bsiam",TLS:"^(?=.*leste).*timor|^(?=.*east).*timor",TGO:"togo",TKL:"tokelau",TON:"tonga",TTO:"trinidad|tobago",TUN:"tunisia",TUR:"turkey",TKM:"turkmen",TCA:"turks",TUV:"tuvalu",UGA:"uganda",UKR:"ukrain",ARE:"emirates|^u\\.?a\\.?e\\.?|united.?arab.?em",GBR:"united.?kingdom|britain|^u\\.?k\\.?",USA:"united.?states|\\bu\\.?s\\.?a\\.?\\b|\\bu\\.?s\\.?\\b(?!.*islands)",UMI:"minor.?outlying.?is",URY:"uruguay",UZB:"uzbek",VUT:"vanuatu|new.?hebrides",VEN:"venezuela",VNM:"^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam",VGB:"^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin",VIR:"^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin",WLF:"futuna|wallis",ESH:"western.sahara",YEM:"^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen",YMD:"^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen",YUG:"yugoslavia",ZMB:"zambia|northern.?rhodesia",EAZ:"zanzibar",ZWE:"zimbabwe|^(?!.*northern).*rhodesia"}},{}],115:[function(t,e,r){"use strict";function n(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}function i(t){var e=new n;e.pre=t.pre,e.body=t.body,e.post=t.post;var r=t.args.slice(0);e.argTypes=r;for(var i=0;i<r.length;++i){var a=r[i];if("array"===a||"object"==typeof a&&a.blockIndices){if(e.argTypes[i]="array",e.arrayArgs.push(i),e.arrayBlockIndices.push(a.blockIndices?a.blockIndices:0),e.shimArgs.push("array"+i),i<e.pre.args.length&&e.pre.args[i].count>0)throw new Error("cwise: pre() block may not reference array args");if(i<e.post.args.length&&e.post.args[i].count>0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===a)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===a){if(e.indexArgs.push(i),i<e.pre.args.length&&e.pre.args[i].count>0)throw new Error("cwise: pre() block may not reference array index");if(i<e.body.args.length&&e.body.args[i].lvalue)throw new Error("cwise: body() block may not write to array index");if(i<e.post.args.length&&e.post.args[i].count>0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===a){if(e.shapeArgs.push(i),i<e.pre.args.length&&e.pre.args[i].lvalue)throw new Error("cwise: pre() block may not write to array shape");if(i<e.body.args.length&&e.body.args[i].lvalue)throw new Error("cwise: body() block may not write to array shape");if(i<e.post.args.length&&e.post.args[i].lvalue)throw new Error("cwise: post() block may not write to array shape"); }else{if("object"!=typeof a||!a.offset)throw new Error("cwise: Unknown argument type "+r[i]);e.argTypes[i]="offset",e.offsetArgs.push({array:a.array,offset:a.offset}),e.offsetArgIndex.push(i)}}if(e.arrayArgs.length<=0)throw new Error("cwise: No array arguments specified");if(e.pre.args.length>r.length)throw new Error("cwise: Too many arguments in pre() block");if(e.body.args.length>r.length)throw new Error("cwise: Too many arguments in body() block");if(e.post.args.length>r.length)throw new Error("cwise: Too many arguments in post() block");return e.debug=!!t.printCode||!!t.debug,e.funcName=t.funcName||"cwise",e.blockSize=t.blockSize||64,o(e)}var o=t("./lib/thunk.js");e.exports=i},{"./lib/thunk.js":117}],116:[function(t,e,r){"use strict";function n(t,e,r){var n,i,o=t.length,a=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],u=[],c=0,h=0;for(n=0;o>n;++n)u.push(["i",n,"=0"].join(""));for(i=0;a>i;++i)for(n=0;o>n;++n)h=c,c=t[n],0===n?u.push(["d",i,"s",n,"=t",i,"p",c].join("")):u.push(["d",i,"s",n,"=(t",i,"p",c,"-s",h,"*t",i,"p",h,")"].join(""));for(l.push("var "+u.join(",")),n=o-1;n>=0;--n)c=t[n],l.push(["for(i",n,"=0;i",n,"<s",c,";++i",n,"){"].join(""));for(l.push(r),n=0;o>n;++n){for(h=c,c=t[n],i=0;a>i;++i)l.push(["p",i,"+=d",i,"s",n].join(""));s&&(n>0&&l.push(["index[",h,"]-=s",h].join("")),l.push(["++index[",c,"]"].join(""))),l.push("}")}return l.join("\n")}function i(t,e,r,i){for(var o=e.length,a=r.arrayArgs.length,s=r.blockSize,l=r.indexArgs.length>0,u=[],c=0;a>c;++c)u.push(["var offset",c,"=p",c].join(""));for(var c=t;o>c;++c)u.push(["for(var j"+c+"=SS[",e[c],"]|0;j",c,">0;){"].join("")),u.push(["if(j",c,"<",s,"){"].join("")),u.push(["s",e[c],"=j",c].join("")),u.push(["j",c,"=0"].join("")),u.push(["}else{s",e[c],"=",s].join("")),u.push(["j",c,"-=",s,"}"].join("")),l&&u.push(["index[",e[c],"]=j",c].join(""));for(var c=0;a>c;++c){for(var h=["offset"+c],f=t;o>f;++f)h.push(["j",f,"*t",c,"p",e[f]].join(""));u.push(["p",c,"=(",h.join("+"),")"].join(""))}u.push(n(e,r,i));for(var c=t;o>c;++c)u.push("}");return u.join("\n")}function o(t){for(var e=0,r=t[0].length;r>e;){for(var n=1;n<t.length;++n)if(t[n][e]!==t[0][e])return e;++e}return e}function a(t,e,r){for(var n=t.body,i=[],o=[],a=0;a<t.args.length;++a){var s=t.args[a];if(!(s.count<=0)){var l=new RegExp(s.name,"g"),u="",c=e.arrayArgs.indexOf(a);switch(e.argTypes[a]){case"offset":var h=e.offsetArgIndex.indexOf(a),f=e.offsetArgs[h];c=f.array,u="+q"+h;case"array":u="p"+c+u;var d="l"+a,p="a"+c;if(0===e.arrayBlockIndices[c])1===s.count?"generic"===r[c]?s.lvalue?(i.push(["var ",d,"=",p,".get(",u,")"].join("")),n=n.replace(l,d),o.push([p,".set(",u,",",d,")"].join(""))):n=n.replace(l,[p,".get(",u,")"].join("")):n=n.replace(l,[p,"[",u,"]"].join("")):"generic"===r[c]?(i.push(["var ",d,"=",p,".get(",u,")"].join("")),n=n.replace(l,d),s.lvalue&&o.push([p,".set(",u,",",d,")"].join(""))):(i.push(["var ",d,"=",p,"[",u,"]"].join("")),n=n.replace(l,d),s.lvalue&&o.push([p,"[",u,"]=",d].join("")));else{for(var v=[s.name],m=[u],g=0;g<Math.abs(e.arrayBlockIndices[c]);g++)v.push("\\s*\\[([^\$]+)\\]"),m.push("$"+(g+1)+"*t"+c+"b"+g);if(l=new RegExp(v.join(""),"g"),u=m.join("+"),"generic"===r[c])throw new Error("cwise: Generic arrays not supported in combination with blocks!");n=n.replace(l,[p,"[",u,"]"].join(""))}break;case"scalar":n=n.replace(l,"Y"+e.scalarArgs.indexOf(a));break;case"index":n=n.replace(l,"index");break;case"shape":n=n.replace(l,"shape")}}}return[i.join("\n"),n,o.join("\n")].join("\n").trim()}function s(t){for(var e=new Array(t.length),r=!0,n=0;n<t.length;++n){var i=t[n],o=i.match(/\d+/);o=o?o[0]:"",0===i.charAt(0)?e[n]="u"+i.charAt(1)+o:e[n]=i.charAt(0)+o,n>0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}function l(t,e){for(var r=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,l=new Array(t.arrayArgs.length),c=new Array(t.arrayArgs.length),h=0;h<t.arrayArgs.length;++h)c[h]=e[2*h],l[h]=e[2*h+1];for(var f=[],d=[],p=[],v=[],m=[],h=0;h<t.arrayArgs.length;++h){t.arrayBlockIndices[h]<0?(p.push(0),v.push(r),f.push(r),d.push(r+t.arrayBlockIndices[h])):(p.push(t.arrayBlockIndices[h]),v.push(t.arrayBlockIndices[h]+r),f.push(0),d.push(t.arrayBlockIndices[h]));for(var g=[],y=0;y<l[h].length;y++)p[h]<=l[h][y]&&l[h][y]<v[h]&&g.push(l[h][y]-p[h]);m.push(g)}for(var b=["SS"],x=["'use strict'"],_=[],y=0;r>y;++y)_.push(["s",y,"=SS[",y,"]"].join(""));for(var h=0;h<t.arrayArgs.length;++h){b.push("a"+h),b.push("t"+h),b.push("p"+h);for(var y=0;r>y;++y)_.push(["t",h,"p",y,"=t",h,"[",p[h]+y,"]"].join(""));for(var y=0;y<Math.abs(t.arrayBlockIndices[h]);++y)_.push(["t",h,"b",y,"=t",h,"[",f[h]+y,"]"].join(""))}for(var h=0;h<t.scalarArgs.length;++h)b.push("Y"+h);if(t.shapeArgs.length>0&&_.push("shape=SS.slice(0)"),t.indexArgs.length>0){for(var w=new Array(r),h=0;r>h;++h)w[h]="0";_.push(["index=[",w.join(","),"]"].join(""))}for(var h=0;h<t.offsetArgs.length;++h){for(var M=t.offsetArgs[h],k=[],y=0;y<M.offset.length;++y)0!==M.offset[y]&&(1===M.offset[y]?k.push(["t",M.array,"p",y].join("")):k.push([M.offset[y],"*t",M.array,"p",y].join("")));0===k.length?_.push("q"+h+"=0"):_.push(["q",h,"=",k.join("+")].join(""))}var A=u([].concat(t.pre.thisVars).concat(t.body.thisVars).concat(t.post.thisVars));_=_.concat(A),x.push("var "+_.join(","));for(var h=0;h<t.arrayArgs.length;++h)x.push("p"+h+"|=0");t.pre.body.length>3&&x.push(a(t.pre,t,c));var T=a(t.body,t,c),E=o(m);r>E?x.push(i(E,m[0],t,T)):x.push(n(m[0],t,T)),t.post.body.length>3&&x.push(a(t.post,t,c)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+x.join("\n")+"\n----------");var S=[t.funcName||"unnamed","_cwise_loop_",l[0].join("s"),"m",E,s(c)].join(""),L=new Function(["function ",S,"(",b.join(","),"){",x.join("\n"),"} return ",S].join(""));return L()}var u=t("uniq");e.exports=l},{uniq:459}],117:[function(t,e,r){"use strict";function n(t){var e=["'use strict'","var CACHED={}"],r=[],n=t.funcName+"_cwise_thunk";e.push(["return function ",n,"(",t.shimArgs.join(","),"){"].join(""));for(var o=[],a=[],s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")],l=[],u=[],c=0;c<t.arrayArgs.length;++c){var h=t.arrayArgs[c];r.push(["t",h,"=array",h,".dtype,","r",h,"=array",h,".order"].join("")),o.push("t"+h),o.push("r"+h),a.push("t"+h),a.push("r"+h+".join()"),s.push("array"+h+".data"),s.push("array"+h+".stride"),s.push("array"+h+".offset|0"),c>0&&(l.push("array"+t.arrayArgs[0]+".shape.length===array"+h+".shape.length+"+(Math.abs(t.arrayBlockIndices[0])-Math.abs(t.arrayBlockIndices[c]))),u.push("array"+t.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[0])+"]===array"+h+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[c])+"]"))}t.arrayArgs.length>1&&(e.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+t.arrayArgs[0]+".shape.length-"+Math.abs(t.arrayBlockIndices[0])+"; shapeIndex-->0;) {"),e.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}"));for(var c=0;c<t.scalarArgs.length;++c)s.push("scalar"+t.scalarArgs[c]);r.push(["type=[",a.join(","),"].join()"].join("")),r.push("proc=CACHED[type]"),e.push("var "+r.join(",")),e.push(["if(!proc){","CACHED[type]=proc=compile([",o.join(","),"])}","return proc(",s.join(","),")}"].join("")),t.debug&&console.log("-----Generated thunk:\n"+e.join("\n")+"\n----------");var f=new Function("compile",e.join("\n"));return f(i.bind(void 0,t))}var i=t("./compile.js");e.exports=n},{"./compile.js":116}],118:[function(t,e,r){e.exports=t("cwise-compiler")},{"cwise-compiler":115}],119:[function(e,r,n){!function(){function e(t){return t&&(t.ownerDocument||t.document||t).documentElement}function n(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function i(t,e){return e>t?-1:t>e?1:t>=e?0:NaN}function o(t){return null===t?NaN:+t}function a(t){return!isNaN(t)}function s(t){return{left:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);i>n;){var o=n+i>>>1;t(e[o],r)<0?n=o+1:i=o}return n},right:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);i>n;){var o=n+i>>>1;t(e[o],r)>0?i=o:n=o+1}return n}}}function l(t){return t.length}function u(t){for(var e=1;t*e%1;)e*=10;return e}function c(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function h(){this._=Object.create(null)}function f(t){return(t+="")===Ma||t[0]===ka?ka+t:t}function d(t){return(t+="")[0]===ka?t.slice(1):t}function p(t){return f(t)in this._}function v(t){return(t=f(t))in this._&&delete this._[t]}function m(){var t=[];for(var e in this._)t.push(d(e));return t}function g(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function b(){this._=Object.create(null)}function x(t){return t}function _(t,e,r){return function(){var n=r.apply(e,arguments);return n===e?t:n}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var r=0,n=Aa.length;n>r;++r){var i=Aa[r]+e;if(i in t)return i}}function M(){}function k(){}function A(t){function e(){for(var e,n=r,i=-1,o=n.length;++i<o;)(e=n[i].on)&&e.apply(this,arguments);return t}var r=[],n=new h;return e.on=function(e,i){var o,a=n.get(e);return arguments.length<2?a&&a.on:(a&&(a.on=null,r=r.slice(0,o=r.indexOf(a)).concat(r.slice(o+1)),n.remove(e)),i&&r.push(n.set(e,{on:i})),t)},e}function T(){ca.event.preventDefault()}function E(){for(var t,e=ca.event;t=e.sourceEvent;)e=t;return e}function S(t){for(var e=new k,r=0,n=arguments.length;++r<n;)e[arguments[r]]=A(e);return e.of=function(r,n){return function(i){try{var o=i.sourceEvent=ca.event;i.target=t,ca.event=i,e[i.type].apply(r,n)}finally{ca.event=o}}},e}function L(t){return Ea(t,Ia),t}function z(t){return"function"==typeof t?t:function(){return Sa(t,this)}}function I(t){return"function"==typeof t?t:function(){return La(t,this)}}function P(t,e){function r(){this.removeAttribute(t)}function n(){this.removeAttributeNS(t.space,t.local)}function i(){this.setAttribute(t,e)}function o(){this.setAttributeNS(t.space,t.local,e)}function a(){var r=e.apply(this,arguments);null==r?this.removeAttribute(t):this.setAttribute(t,r)}function s(){var r=e.apply(this,arguments);null==r?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,r)}return t=ca.ns.qualify(t),null==e?t.local?n:r:"function"==typeof e?t.local?s:a:t.local?o:i}function C(t){return t.trim().replace(/\s+/g," ")}function R(t){return new RegExp("(?:^|\\s+)"+ca.requote(t)+"(?:\\s+|$)","g")}function D(t){return(t+"").trim().split(/^|\s+/)}function O(t,e){function r(){for(var r=-1;++r<i;)t[r](this,e)}function n(){for(var r=-1,n=e.apply(this,arguments);++r<i;)t[r](this,n)}t=D(t).map(F);var i=t.length;return"function"==typeof e?n:r}function F(t){var e=R(t);return function(r,n){if(i=r.classList)return n?i.add(t):i.remove(t);var i=r.getAttribute("class")||"";n?(e.lastIndex=0,e.test(i)||r.setAttribute("class",C(i+" "+t))):r.setAttribute("class",C(i.replace(e," ")))}}function j(t,e,r){function n(){this.style.removeProperty(t)}function i(){this.style.setProperty(t,e,r)}function o(){var n=e.apply(this,arguments);null==n?this.style.removeProperty(t):this.style.setProperty(t,n,r)}return null==e?n:"function"==typeof e?o:i}function N(t,e){function r(){delete this[t]}function n(){this[t]=e}function i(){var r=e.apply(this,arguments);null==r?delete this[t]:this[t]=r}return null==e?r:"function"==typeof e?i:n}function B(t){function e(){var e=this.ownerDocument,r=this.namespaceURI;return r===Pa&&e.documentElement.namespaceURI===Pa?e.createElement(t):e.createElementNS(r,t)}function r(){return this.ownerDocument.createElementNS(t.space,t.local)}return"function"==typeof t?t:(t=ca.ns.qualify(t)).local?r:e}function U(){var t=this.parentNode;t&&t.removeChild(this)}function V(t){return{__data__:t}}function q(t){return function(){return za(this,t)}}function G(t){return arguments.length||(t=i),function(e,r){return e&&r?t(e.__data__,r.__data__):!e-!r}}function H(t,e){for(var r=0,n=t.length;n>r;r++)for(var i,o=t[r],a=0,s=o.length;s>a;a++)(i=o[a])&&e(i,a,r);return t}function X(t){return Ea(t,Ra),t}function Y(t){var e,r;return function(n,i,o){var a,s=t[o].update,l=s.length;for(o!=r&&(r=o,e=0),i>=e&&(e=i+1);!(a=s[e])&&++e<l;);return a}}function W(t,e,r){function n(){var e=this[a];e&&(this.removeEventListener(t,e,e.$),delete this[a])}function i(){var i=l(e,fa(arguments));n.call(this),this.addEventListener(t,this[a]=i,i.$=r),i._=e}function o(){var e,r=new RegExp("^__on([^.]+)"+ca.requote(t)+"$");for(var n in this)if(e=n.match(r)){var i=this[n];this.removeEventListener(e[1],i,i.$),delete this[n]}}var a="__on"+t,s=t.indexOf("."),l=Z;s>0&&(t=t.slice(0,s));var u=Da.get(t);return u&&(t=u,l=K),s?e?i:n:e?M:o}function Z(t,e){return function(r){var n=ca.event;ca.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{ca.event=n}}}function K(t,e){var r=Z(t,e);return function(t){var e=this,n=t.relatedTarget;n&&(n===e||8&n.compareDocumentPosition(e))||r.call(e,t)}}function J(t){var r=".dragsuppress-"+ ++Fa,i="click"+r,o=ca.select(n(t)).on("touchmove"+r,T).on("dragstart"+r,T).on("selectstart"+r,T);if(null==Oa&&(Oa="onselectstart"in t?!1:w(t.style,"userSelect")),Oa){var a=e(t).style,s=a[Oa];a[Oa]="none"}return function(t){if(o.on(r,null),Oa&&(a[Oa]=s),t){var e=function(){o.on(i,null)};o.on(i,function(){T(),e()},!0),setTimeout(e,0)}}}function $(t,e){e.changedTouches&&(e=e.changedTouches[0]);var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();if(0>ja){var o=n(t);if(o.scrollX||o.scrollY){r=ca.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var a=r[0][0].getScreenCTM();ja=!(a.f||a.e),r.remove()}}return ja?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function Q(){return ca.event.changedTouches[0].identifier}function tt(t){return t>0?1:0>t?-1:0}function et(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function rt(t){return t>1?0:-1>t?Ua:Math.acos(t)}function nt(t){return t>1?Ga:-1>t?-Ga:Math.asin(t)}function it(t){return((t=Math.exp(t))-1/t)/2}function ot(t){return((t=Math.exp(t))+1/t)/2}function at(t){return((t=Math.exp(2*t))-1)/(t+1)}function st(t){return(t=Math.sin(t/2))*t}function lt(){}function ut(t,e,r){return this instanceof ut?(this.h=+t,this.s=+e,void(this.l=+r)):arguments.length<2?t instanceof ut?new ut(t.h,t.s,t.l):Mt(""+t,kt,ut):new ut(t,e,r)}function ct(t,e,r){function n(t){return t>360?t-=360:0>t&&(t+=360),60>t?o+(a-o)*t/60:180>t?a:240>t?o+(a-o)*(240-t)/60:o}function i(t){return Math.round(255*n(t))}var o,a;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:0>e?0:e>1?1:e,r=0>r?0:r>1?1:r,a=.5>=r?r*(1+e):r+e-r*e,o=2*r-a,new bt(i(t+120),i(t),i(t-120))}function ht(t,e,r){return this instanceof ht?(this.h=+t,this.c=+e,void(this.l=+r)):arguments.length<2?t instanceof ht?new ht(t.h,t.c,t.l):t instanceof dt?vt(t.l,t.a,t.b):vt((t=At((t=ca.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ht(t,e,r)}function ft(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new dt(r,Math.cos(t*=Ha)*e,Math.sin(t)*e)}function dt(t,e,r){return this instanceof dt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof dt?new dt(t.l,t.a,t.b):t instanceof ht?ft(t.h,t.c,t.l):At((t=bt(t)).r,t.g,t.b):new dt(t,e,r)}function pt(t,e,r){var n=(t+16)/116,i=n+e/500,o=n-r/200;return i=mt(i)*rs,n=mt(n)*ns,o=mt(o)*is,new bt(yt(3.2404542*i-1.5371385*n-.4985314*o),yt(-.969266*i+1.8760108*n+.041556*o),yt(.0556434*i-.2040259*n+1.0572252*o))}function vt(t,e,r){return t>0?new ht(Math.atan2(r,e)*Xa,Math.sqrt(e*e+r*r),t):new ht(NaN,NaN,t)}function mt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function gt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(.00304>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function bt(t,e,r){return this instanceof bt?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof bt?new bt(t.r,t.g,t.b):Mt(""+t,bt,ct):new bt(t,e,r)}function xt(t){return new bt(t>>16,t>>8&255,255&t)}function _t(t){return xt(t)+""}function wt(t){return 16>t?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function Mt(t,e,r){var n,i,o,a=0,s=0,l=0;if(n=/([a-z]+)$$(.*)$$/.exec(t=t.toLowerCase()))switch(i=n[2].split(","),n[1]){case"hsl":return r(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(Et(i[0]),Et(i[1]),Et(i[2]))}return(o=ss.get(t))?e(o.r,o.g,o.b):(null==t||"#"!==t.charAt(0)||isNaN(o=parseInt(t.slice(1),16))||(4===t.length?(a=(3840&o)>>4,a=a>>4|a,s=240&o,s=s>>4|s,l=15&o,l=l<<4|l):7===t.length&&(a=(16711680&o)>>16,s=(65280&o)>>8,l=255&o)),e(a,s,l))}function kt(t,e,r){var n,i,o=Math.min(t/=255,e/=255,r/=255),a=Math.max(t,e,r),s=a-o,l=(a+o)/2;return s?(i=.5>l?s/(a+o):s/(2-a-o),n=t==a?(e-r)/s+(r>e?6:0):e==a?(r-t)/s+2:(t-e)/s+4,n*=60):(n=NaN,i=l>0&&1>l?0:n),new ut(n,i,l)}function At(t,e,r){t=Tt(t),e=Tt(e),r=Tt(r);var n=gt((.4124564*t+.3575761*e+.1804375*r)/rs),i=gt((.2126729*t+.7151522*e+.072175*r)/ns),o=gt((.0193339*t+.119192*e+.9503041*r)/is);return dt(116*i-16,500*(n-i),200*(i-o))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Et(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function St(t){return"function"==typeof t?t:function(){return t}}function Lt(t){return function(e,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),zt(e,r,t,n)}}function zt(t,e,r,n){function i(){var t,e=l.status;if(!e&&Pt(l)||e>=200&&300>e||304===e){try{t=r.call(o,l)}catch(n){return void a.error.call(o,n)}a.load.call(o,t)}else a.error.call(o,l)}var o={},a=ca.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,u=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()},l.onprogress=function(t){var e=ca.event;ca.event=t;try{a.progress.call(o,l)}finally{ca.event=e}},o.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",o)},o.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",o):e},o.responseType=function(t){return arguments.length?(u=t,o):u},o.response=function(t){return r=t,o},["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(fa(arguments)))}}),o.send=function(r,n,i){if(2===arguments.length&&"function"==typeof n&&(i=n,n=null),l.open(r,t,!0),null==e||"accept"in s||(s.accept=e+",*/*"),l.setRequestHeader)for(var c in s)l.setRequestHeader(c,s[c]);return null!=e&&l.overrideMimeType&&l.overrideMimeType(e),null!=u&&(l.responseType=u),null!=i&&o.on("error",i).on("load",function(t){i(null,t)}),a.beforesend.call(o,l),l.send(null==n?null:n),o},o.abort=function(){return l.abort(),o},ca.rebind(o,a,"on"),null==n?o:o.get(It(n))}function It(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}function Pt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Ct(t,e,r){var n=arguments.length;2>n&&(e=0),3>n&&(r=Date.now());var i=r+e,o={c:t,t:i,n:null};return us?us.n=o:ls=o,us=o,cs||(hs=clearTimeout(hs),cs=1,fs(Rt)),o}function Rt(){var t=Dt(),e=Ot()-t;e>24?(isFinite(e)&&(clearTimeout(hs),hs=setTimeout(Rt,e)),cs=0):(cs=1,fs(Rt))}function Dt(){for(var t=Date.now(),e=ls;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Ot(){for(var t,e=ls,r=1/0;e;)e.c?(e.t<r&&(r=e.t),e=(t=e).n):e=t?t.n=e.n:ls=e.n;return us=t,r}function Ft(t,e){return e-(t?Math.ceil(Math.log(t)/Math.LN10):1)}function jt(t,e){var r=Math.pow(10,3*wa(8-e));return{scale:e>8?function(t){return t/r}:function(t){return t*r},symbol:t}}function Nt(t){var e=t.decimal,r=t.thousands,n=t.grouping,i=t.currency,o=n&&r?function(t,e){for(var i=t.length,o=[],a=0,s=n[0],l=0;i>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),o.push(t.substring(i-=s,i+s)),!((l+=s+1)>e));)s=n[a=(a+1)%n.length];return o.reverse().join(r)}:x;return function(t){var r=ps.exec(t),n=r[1]||" ",a=r[2]||">",s=r[3]||"-",l=r[4]||"",u=r[5],c=+r[6],h=r[7],f=r[8],d=r[9],p=1,v="",m="",g=!1,y=!0;switch(f&&(f=+f.substring(1)),(u||"0"===n&&"="===a)&&(u=n="0",a="="),d){case"n":h=!0,d="g";break;case"%":p=100,m="%",d="f";break;case"p":p=100,m="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(v="0"+d.toLowerCase());case"c":y=!1;case"d":g=!0,f=0;break;case"s":p=-1,d="r"}"$"===l&&(v=i[0],m=i[1]),"r"!=d||f||(d="g"),null!=f&&("g"==d?f=Math.max(1,Math.min(21,f)):"e"!=d&&"f"!=d||(f=Math.max(0,Math.min(20,f)))),d=vs.get(d)||Bt;var b=u&&h;return function(t){var r=m;if(g&&t%1)return"";var i=0>t||0===t&&0>1/t?(t=-t,"-"):"-"===s?"":s;if(0>p){var l=ca.formatPrefix(t,f);t=l.scale(t),r=l.symbol+m}else t*=p;t=d(t,f);var x,_,w=t.lastIndexOf(".");if(0>w){var M=y?t.lastIndexOf("e"):-1;0>M?(x=t,_=""):(x=t.substring(0,M),_=t.substring(M))}else x=t.substring(0,w),_=e+t.substring(w+1);!u&&h&&(x=o(x,1/0));var k=v.length+x.length+_.length+(b?0:i.length),A=c>k?new Array(k=c-k+1).join(n):"";return b&&(x=o(A+x,A.length?c-_.length:1/0)),i+=v,t=x+_,("<"===a?i+t+A:">"===a?A+i+t:"^"===a?A.substring(0,k>>=1)+i+t+A.substring(k):i+(b?t:A+t))+r}}}function Bt(t){return t+""}function Ut(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Vt(t,e,r){function n(e){var r=t(e),n=o(r,1);return n-e>e-r?r:n}function i(r){return e(r=t(new gs(r-1)),1),r}function o(t,r){return e(t=new gs(+t),r),t}function a(t,n,o){var a=i(t),s=[];if(o>1)for(;n>a;)r(a)%o||s.push(new Date(+a)),e(a,1);else for(;n>a;)s.push(new Date(+a)),e(a,1);return s}function s(t,e,r){try{gs=Ut;var n=new Ut;return n._=t,a(n,e,r)}finally{gs=Date}}t.floor=t,t.round=n,t.ceil=i,t.offset=o,t.range=a;var l=t.utc=qt(t);return l.floor=l,l.round=qt(n),l.ceil=qt(i),l.offset=qt(o),l.range=s,t}function qt(t){return function(e,r){try{gs=Ut;var n=new Ut;return n._=e,t(n,r)._}finally{gs=Date}}}function Gt(t){function e(t){function e(e){for(var r,i,o,a=[],s=-1,l=0;++s<n;)37===t.charCodeAt(s)&&(a.push(t.slice(l,s)),null!=(i=bs[r=t.charAt(++s)])&&(r=t.charAt(++s)),(o=S[r])&&(r=o(e,null==i?"e"===r?" ":"0":i)),a.push(r),l=s+1);return a.push(t.slice(l,s)),a.join("")}var n=t.length;return e.parse=function(e){var n={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null},i=r(n,t,e,0);if(i!=e.length)return null;"p"in n&&(n.H=n.H%12+12*n.p);var o=null!=n.Z&&gs!==Ut,a=new(o?Ut:gs);return"j"in n?a.setFullYear(n.y,0,n.j):"W"in n||"U"in n?("w"in n||(n.w="W"in n?1:0),a.setFullYear(n.y,0,1),a.setFullYear(n.y,0,"W"in n?(n.w+6)%7+7*n.W-(a.getDay()+5)%7:n.w+7*n.U-(a.getDay()+6)%7)):a.setFullYear(n.y,n.m,n.d),a.setHours(n.H+(n.Z/100|0),n.M+n.Z%100,n.S,n.L),o?a._:a},e.toString=function(){return t},e}function r(t,e,r,n){for(var i,o,a,s=0,l=e.length,u=r.length;l>s;){if(n>=u)return-1;if(i=e.charCodeAt(s++),37===i){if(a=e.charAt(s++),o=L[a in bs?e.charAt(s++):a],!o||(n=o(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}function n(t,e,r){w.lastIndex=0;var n=w.exec(e.slice(r));return n?(t.w=M.get(n[0].toLowerCase()),r+n[0].length):-1}function i(t,e,r){x.lastIndex=0;var n=x.exec(e.slice(r));return n?(t.w=_.get(n[0].toLowerCase()),r+n[0].length):-1}function o(t,e,r){T.lastIndex=0;var n=T.exec(e.slice(r));return n?(t.m=E.get(n[0].toLowerCase()),r+n[0].length):-1}function a(t,e,r){k.lastIndex=0;var n=k.exec(e.slice(r));return n?(t.m=A.get(n[0].toLowerCase()),r+n[0].length):-1}function s(t,e,n){return r(t,S.c.toString(),e,n)}function l(t,e,n){return r(t,S.x.toString(),e,n)}function u(t,e,n){return r(t,S.X.toString(),e,n)}function c(t,e,r){var n=b.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)}var h=t.dateTime,f=t.date,d=t.time,p=t.periods,v=t.days,m=t.shortDays,g=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{gs=Ut;var e=new gs;return e._=t,n(e)}finally{gs=Date}}var n=e(t);return r.parse=function(t){try{gs=Ut;var e=n.parse(t);return e&&e._}finally{gs=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var b=ca.map(),x=Xt(v),_=Yt(v),w=Xt(m),M=Yt(m),k=Xt(g),A=Yt(g),T=Xt(y),E=Yt(y);p.forEach(function(t,e){b.set(t.toLowerCase(),e)});var S={a:function(t){return m[t.getDay()]},A:function(t){return v[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return g[t.getMonth()]},c:e(h),d:function(t,e){return Ht(t.getDate(),e,2)},e:function(t,e){return Ht(t.getDate(),e,2)},H:function(t,e){return Ht(t.getHours(),e,2)},I:function(t,e){return Ht(t.getHours()%12||12,e,2)},j:function(t,e){return Ht(1+ms.dayOfYear(t),e,3)},L:function(t,e){return Ht(t.getMilliseconds(),e,3)},m:function(t,e){return Ht(t.getMonth()+1,e,2)},M:function(t,e){return Ht(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Ht(t.getSeconds(),e,2)},U:function(t,e){return Ht(ms.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ht(ms.mondayOfYear(t),e,2)},x:e(f),X:e(d),y:function(t,e){return Ht(t.getFullYear()%100,e,2)},Y:function(t,e){return Ht(t.getFullYear()%1e4,e,4)},Z:le,"%":function(){return"%"}},L={a:n,A:i,b:o,B:a,c:s,d:re,e:re,H:ie,I:ie,j:ne,L:se,m:ee,M:oe,p:c,S:ae,U:Zt,w:Wt,W:Kt,x:l,X:u,y:$t,Y:Jt,Z:Qt,"%":ue};return e}function Ht(t,e,r){var n=0>t?"-":"",i=(n?-t:t)+"",o=i.length;return n+(r>o?new Array(r-o+1).join(e)+i:i)}function Xt(t){return new RegExp("^(?:"+t.map(ca.requote).join("|")+")","i")}function Yt(t){for(var e=new h,r=-1,n=t.length;++r<n;)e.set(t[r].toLowerCase(),r);return e}function Wt(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function Zt(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r));return n?(t.U=+n[0],r+n[0].length):-1}function Kt(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r));return n?(t.W=+n[0],r+n[0].length):-1}function Jt(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function$t(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.y=te(+n[0]),r+n[0].length):-1}function Qt(t,e,r){return/^[+-]\d{4}$/.test(e=e.slice(r,r+5))?(t.Z=-e,r+5):-1}function te(t){return t+(t>68?1900:2e3)}function ee(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ie(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function oe(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function ae(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function le(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=wa(e)/60|0,i=wa(e)%60;return r+Ht(n,"0",2)+Ht(i,"0",2)}function ue(t,e,r){_s.lastIndex=0;var n=_s.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function ce(t){for(var e=t.length,r=-1;++r<e;)t[r][0]=this(t[r][0]);return function(e){for(var r=0,n=t[r];!n[1](e);)n=t[++r];return n[0](e)}}function he(){}function fe(t,e,r){var n=r.s=t+e,i=n-t,o=n-i;r.t=t-o+(e-i)}function de(t,e){t&&As.hasOwnProperty(t.type)&&As[t.type](t,e)}function pe(t,e,r){var n,i=-1,o=t.length-r;for(e.lineStart();++i<o;)n=t[i],e.point(n[0],n[1],n[2]);e.lineEnd()}function ve(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)pe(t[r],e,1);e.polygonEnd()}function me(){function t(t,e){t*=Ha,e=e*Ha/2+Ua/4;var r=t-n,a=r>=0?1:-1,s=a*r,l=Math.cos(e),u=Math.sin(e),c=o*u,h=i*l+c*Math.cos(s),f=c*a*Math.sin(s);Es.add(Math.atan2(f,h)),n=t,i=l,o=u}var e,r,n,i,o;Ss.point=function(a,s){Ss.point=t,n=(e=a)*Ha,i=Math.cos(s=(r=s)*Ha/2+Ua/4),o=Math.sin(s)},Ss.lineEnd=function(){t(e,r)}}function ge(t){var e=t[0],r=t[1],n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function be(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function xe(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function _e(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Me(t){return[Math.atan2(t[1],t[0]),nt(t[2])]}function ke(t,e){return wa(t[0]-e[0])<Na&&wa(t[1]-e[1])<Na}function Ae(t,e){t*=Ha;var r=Math.cos(e*=Ha);Te(r*Math.cos(t),r*Math.sin(t),Math.sin(e))}function Te(t,e,r){++Ls,Is+=(t-Is)/Ls,Ps+=(e-Ps)/Ls,Cs+=(r-Cs)/Ls}function Ee(){function t(t,i){t*=Ha;var o=Math.cos(i*=Ha),a=o*Math.cos(t),s=o*Math.sin(t),l=Math.sin(i),u=Math.atan2(Math.sqrt((u=r*l-n*s)*u+(u=n*a-e*l)*u+(u=e*s-r*a)*u),e*a+r*s+n*l);zs+=u,Rs+=u*(e+(e=a)),Ds+=u*(r+(r=s)),Os+=u*(n+(n=l)),Te(e,r,n)}var e,r,n;Bs.point=function(i,o){i*=Ha;var a=Math.cos(o*=Ha);e=a*Math.cos(i),r=a*Math.sin(i),n=Math.sin(o),Bs.point=t,Te(e,r,n)}}function Se(){Bs.point=Ae}function Le(){function t(t,e){t*=Ha;var r=Math.cos(e*=Ha),a=r*Math.cos(t),s=r*Math.sin(t),l=Math.sin(e),u=i*l-o*s,c=o*a-n*l,h=n*s-i*a,f=Math.sqrt(u*u+c*c+h*h),d=n*a+i*s+o*l,p=f&&-rt(d)/f,v=Math.atan2(f,d);Fs+=p*u,js+=p*c,Ns+=p*h,zs+=v,Rs+=v*(n+(n=a)),Ds+=v*(i+(i=s)),Os+=v*(o+(o=l)),Te(n,i,o)}var e,r,n,i,o;Bs.point=function(a,s){e=a,r=s,Bs.point=t,a*=Ha;var l=Math.cos(s*=Ha);n=l*Math.cos(a),i=l*Math.sin(a),o=Math.sin(s),Te(n,i,o)},Bs.lineEnd=function(){t(e,r),Bs.lineEnd=Se,Bs.point=Ae}}function ze(t,e){function r(r,n){return r=t(r,n),e(r[0],r[1])}return t.invert&&e.invert&&(r.invert=function(r,n){return r=e.invert(r,n),r&&t.invert(r[0],r[1])}),r}function Ie(){return!0}function Pe(t,e,r,n,i){var o=[],a=[];if(t.forEach(function(t){if(!((e=t.length-1)<=0)){var e,r=t[0],n=t[e];if(ke(r,n)){i.lineStart();for(var s=0;e>s;++s)i.point((r=t[s])[0],r[1]);return void i.lineEnd()}var l=new Re(r,t,null,!0),u=new Re(r,null,l,!1);l.o=u,o.push(l),a.push(u),l=new Re(n,t,null,!1),u=new Re(n,null,l,!0),l.o=u,o.push(l),a.push(u)}}),a.sort(e),Ce(o),Ce(a),o.length){for(var s=0,l=r,u=a.length;u>s;++s)a[s].e=l=!l;for(var c,h,f=o[0];;){for(var d=f,p=!0;d.v;)if((d=d.n)===f)return;c=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(p)for(var s=0,u=c.length;u>s;++s)i.point((h=c[s])[0],h[1]);else n(d.x,d.n.x,1,i);d=d.n}else{if(p){c=d.p.z;for(var s=c.length-1;s>=0;--s)i.point((h=c[s])[0],h[1])}else n(d.x,d.p.x,-1,i);d=d.p}d=d.o,c=d.z,p=!p}while(!d.v);i.lineEnd()}}}function Ce(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n<e;)i.n=r=t[n],r.p=i,i=r;i.n=r=t[0],r.p=i}}function Re(t,e,r,n){this.x=t,this.z=e,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function De(t,e,r,n){return function(i,o){function a(e,r){var n=i(e,r);t(e=n[0],r=n[1])&&o.point(e,r)}function s(t,e){var r=i(t,e);m.point(r[0],r[1])}function l(){y.point=s,m.lineStart()}function u(){y.point=a,m.lineEnd()}function c(t,e){v.push([t,e]);var r=i(t,e);x.point(r[0],r[1])}function h(){x.lineStart(),v=[]}function f(){c(v[0][0],v[0][1]),x.lineEnd();var t,e=x.clean(),r=b.buffer(),n=r.length;if(v.pop(),p.push(v),v=null,n)if(1&e){t=r[0];var i,n=t.length-1,a=-1;if(n>0){for(_||(o.polygonStart(),_=!0),o.lineStart();++a<n;)o.point((i=t[a])[0],i[1]);o.lineEnd()}}else n>1&&2&e&&r.push(r.pop().concat(r.shift())),d.push(r.filter(Oe))}var d,p,v,m=e(o),g=i.invert(n[0],n[1]),y={point:a,lineStart:l,lineEnd:u,polygonStart:function(){y.point=c,y.lineStart=h,y.lineEnd=f,d=[],p=[]},polygonEnd:function(){y.point=a,y.lineStart=l,y.lineEnd=u,d=ca.merge(d);var t=Ve(g,p);d.length?(_||(o.polygonStart(),_=!0),Pe(d,je,t,r,o)):t&&(_||(o.polygonStart(),_=!0),o.lineStart(),r(null,null,1,o),o.lineEnd()),_&&(o.polygonEnd(),_=!1),d=p=null},sphere:function(){o.polygonStart(),o.lineStart(),r(null,null,1,o),o.lineEnd(),o.polygonEnd()}},b=Fe(),x=e(b),_=!1;return y}}function Oe(t){return t.length>1}function Fe(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:M,buffer:function(){var r=e;return e=[], t=null,r},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function je(t,e){return((t=t.x)[0]<0?t[1]-Ga-Na:Ga-t[1])-((e=e.x)[0]<0?e[1]-Ga-Na:Ga-e[1])}function Ne(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var s=o>0?Ua:-Ua,l=wa(o-r);wa(l-Ua)<Na?(t.point(r,n=(n+a)/2>0?Ga:-Ga),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(o,n),e=0):i!==s&&l>=Ua&&(wa(r-i)<Na&&(r-=i*Na),wa(o-s)<Na&&(o-=s*Na),n=Be(r,n,o,a),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),e=0),t.point(r=o,n=a),i=s},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}function Be(t,e,r,n){var i,o,a=Math.sin(t-r);return wa(a)>Na?Math.atan((Math.sin(e)*(o=Math.cos(n))*Math.sin(r)-Math.sin(n)*(i=Math.cos(e))*Math.sin(t))/(i*o*a)):(e+n)/2}function Ue(t,e,r,n){var i;if(null==t)i=r*Ga,n.point(-Ua,i),n.point(0,i),n.point(Ua,i),n.point(Ua,0),n.point(Ua,-i),n.point(0,-i),n.point(-Ua,-i),n.point(-Ua,0),n.point(-Ua,i);else if(wa(t[0]-e[0])>Na){var o=t[0]<e[0]?Ua:-Ua;i=r*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(e[0],e[1])}function Ve(t,e){var r=t[0],n=t[1],i=[Math.sin(r),-Math.cos(r),0],o=0,a=0;Es.reset();for(var s=0,l=e.length;l>s;++s){var u=e[s],c=u.length;if(c)for(var h=u[0],f=h[0],d=h[1]/2+Ua/4,p=Math.sin(d),v=Math.cos(d),m=1;;){m===c&&(m=0),t=u[m];var g=t[0],y=t[1]/2+Ua/4,b=Math.sin(y),x=Math.cos(y),_=g-f,w=_>=0?1:-1,M=w*_,k=M>Ua,A=p*b;if(Es.add(Math.atan2(A*w*Math.sin(M),v*x+A*Math.cos(M))),o+=k?_+w*Va:_,k^f>=r^g>=r){var T=be(ge(h),ge(t));we(T);var E=be(i,T);we(E);var S=(k^_>=0?-1:1)*nt(E[2]);(n>S||n===S&&(T[0]||T[1]))&&(a+=k^_>=0?1:-1)}if(!m++)break;f=g,p=b,v=x,h=t}}return(-Na>o||Na>o&&0>Es)^1&a}function qe(t){function e(t,e){return Math.cos(t)*Math.cos(e)>o}function r(t){var r,o,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(h,f){var d,p=[h,f],v=e(h,f),m=a?v?0:i(h,f):v?i(h+(0>h?Ua:-Ua),f):0;if(!r&&(u=l=v)&&t.lineStart(),v!==l&&(d=n(r,p),(ke(r,d)||ke(p,d))&&(p[0]+=Na,p[1]+=Na,v=e(p[0],p[1]))),v!==l)c=0,v?(t.lineStart(),d=n(p,r),t.point(d[0],d[1])):(d=n(r,p),t.point(d[0],d[1]),t.lineEnd()),r=d;else if(s&&r&&a^v){var g;m&o||!(g=n(p,r,!0))||(c=0,a?(t.lineStart(),t.point(g[0][0],g[0][1]),t.point(g[1][0],g[1][1]),t.lineEnd()):(t.point(g[1][0],g[1][1]),t.lineEnd(),t.lineStart(),t.point(g[0][0],g[0][1])))}!v||r&&ke(r,p)||t.point(p[0],p[1]),r=p,l=v,o=m},lineEnd:function(){l&&t.lineEnd(),r=null},clean:function(){return c|(u&&l)<<1}}}function n(t,e,r){var n=ge(t),i=ge(e),a=[1,0,0],s=be(n,i),l=ye(s,s),u=s[0],c=l-u*u;if(!c)return!r&&t;var h=o*l/c,f=-o*u/c,d=be(a,s),p=_e(a,h),v=_e(s,f);xe(p,v);var m=d,g=ye(p,m),y=ye(m,m),b=g*g-y*(ye(p,p)-1);if(!(0>b)){var x=Math.sqrt(b),_=_e(m,(-g-x)/y);if(xe(_,p),_=Me(_),!r)return _;var w,M=t[0],k=e[0],A=t[1],T=e[1];M>k&&(w=M,M=k,k=w);var E=k-M,S=wa(E-Ua)<Na,L=S||Na>E;if(!S&&A>T&&(w=A,A=T,T=w),L?S?A+T>0^_[1]<(wa(_[0]-M)<Na?A:T):A<=_[1]&&_[1]<=T:E>Ua^(M<=_[0]&&_[0]<=k)){var z=_e(m,(-g+x)/y);return xe(z,p),[_,Me(z)]}}}function i(e,r){var n=a?t:Ua-t,i=0;return-n>e?i|=1:e>n&&(i|=2),-n>r?i|=4:r>n&&(i|=8),i}var o=Math.cos(t),a=o>0,s=wa(o)>Na,l=mr(t,6*Ha);return De(e,r,l,a?[0,-t]:[-Ua,t-Ua])}function Ge(t,e,r,n){return function(i){var o,a=i.a,s=i.b,l=a.x,u=a.y,c=s.x,h=s.y,f=0,d=1,p=c-l,v=h-u;if(o=t-l,p||!(o>0)){if(o/=p,0>p){if(f>o)return;d>o&&(d=o)}else if(p>0){if(o>d)return;o>f&&(f=o)}if(o=r-l,p||!(0>o)){if(o/=p,0>p){if(o>d)return;o>f&&(f=o)}else if(p>0){if(f>o)return;d>o&&(d=o)}if(o=e-u,v||!(o>0)){if(o/=v,0>v){if(f>o)return;d>o&&(d=o)}else if(v>0){if(o>d)return;o>f&&(f=o)}if(o=n-u,v||!(0>o)){if(o/=v,0>v){if(o>d)return;o>f&&(f=o)}else if(v>0){if(f>o)return;d>o&&(d=o)}return f>0&&(i.a={x:l+f*p,y:u+f*v}),1>d&&(i.b={x:l+d*p,y:u+d*v}),i}}}}}}function He(t,e,r,n){function i(n,i){return wa(n[0]-t)<Na?i>0?0:3:wa(n[0]-r)<Na?i>0?2:1:wa(n[1]-e)<Na?i>0?1:0:i>0?3:2}function o(t,e){return a(t.x,e.x)}function a(t,e){var r=i(t,1),n=i(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){function l(t){for(var e=0,r=m.length,n=t[1],i=0;r>i;++i)for(var o,a=1,s=m[i],l=s.length,u=s[0];l>a;++a)o=s[a],u[1]<=n?o[1]>n&&et(u,o,t)>0&&++e:o[1]<=n&&et(u,o,t)<0&&--e,u=o;return 0!==e}function u(o,s,l,u){var c=0,h=0;if(null==o||(c=i(o,l))!==(h=i(s,l))||a(o,s)<0^l>0){do u.point(0===c||3===c?t:r,c>1?n:e);while((c=(c+l+4)%4)!==h)}else u.point(s[0],s[1])}function c(i,o){return i>=t&&r>=i&&o>=e&&n>=o}function h(t,e){c(t,e)&&s.point(t,e)}function f(){L.point=p,m&&m.push(g=[]),k=!0,M=!1,_=w=NaN}function d(){v&&(p(y,b),x&&M&&E.rejoin(),v.push(E.buffer())),L.point=h,M&&s.lineEnd()}function p(t,e){t=Math.max(-Vs,Math.min(Vs,t)),e=Math.max(-Vs,Math.min(Vs,e));var r=c(t,e);if(m&&g.push([t,e]),k)y=t,b=e,x=r,k=!1,r&&(s.lineStart(),s.point(t,e));else if(r&&M)s.point(t,e);else{var n={a:{x:_,y:w},b:{x:t,y:e}};S(n)?(M||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),A=!1):r&&(s.lineStart(),s.point(t,e),A=!1)}_=t,w=e,M=r}var v,m,g,y,b,x,_,w,M,k,A,T=s,E=Fe(),S=Ge(t,e,r,n),L={point:h,lineStart:f,lineEnd:d,polygonStart:function(){s=E,v=[],m=[],A=!0},polygonEnd:function(){s=T,v=ca.merge(v);var e=l([t,n]),r=A&&e,i=v.length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),i&&Pe(v,o,e,u,s),s.polygonEnd()),v=m=g=null}};return L}}function Xe(t){var e=0,r=Ua/3,n=lr(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*Ua/180,r=t[1]*Ua/180):[e/Ua*180,r/Ua*180]},i}function Ye(t,e){function r(t,e){var r=Math.sqrt(o-2*i*Math.sin(e))/i;return[r*Math.sin(t*=i),a-r*Math.cos(t)]}var n=Math.sin(t),i=(n+Math.sin(e))/2,o=1+n*(2*i-n),a=Math.sqrt(o)/i;return r.invert=function(t,e){var r=a-e;return[Math.atan2(t,r)/i,nt((o-(t*t+r*r)*i*i)/(2*i))]},r}function We(){function t(t,e){Gs+=i*t-n*e,n=t,i=e}var e,r,n,i;Zs.point=function(o,a){Zs.point=t,e=n=o,r=i=a},Zs.lineEnd=function(){t(e,r)}}function Ze(t,e){Hs>t&&(Hs=t),t>Ys&&(Ys=t),Xs>e&&(Xs=e),e>Ws&&(Ws=e)}function Ke(){function t(t,e){a.push("M",t,",",e,o)}function e(t,e){a.push("M",t,",",e),s.point=r}function r(t,e){a.push("L",t,",",e)}function n(){s.point=t}function i(){a.push("Z")}var o=Je(4.5),a=[],s={point:t,lineStart:function(){s.point=e},lineEnd:n,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=n,s.point=t},pointRadius:function(t){return o=Je(t),s},result:function(){if(a.length){var t=a.join("");return a=[],t}}};return s}function Je(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function$e(t,e){Is+=t,Ps+=e,++Cs}function Qe(){function t(t,n){var i=t-e,o=n-r,a=Math.sqrt(i*i+o*o);Rs+=a*(e+t)/2,Ds+=a*(r+n)/2,Os+=a,$e(e=t,r=n)}var e,r;Js.point=function(n,i){Js.point=t,$e(e=n,r=i)}}function tr(){Js.point=$e}function er(){function t(t,e){var r=t-n,o=e-i,a=Math.sqrt(r*r+o*o);Rs+=a*(n+t)/2,Ds+=a*(i+e)/2,Os+=a,a=i*t-n*e,Fs+=a*(n+t),js+=a*(i+e),Ns+=3*a,$e(n=t,i=e)}var e,r,n,i;Js.point=function(o,a){Js.point=t,$e(e=n=o,r=i=a)},Js.lineEnd=function(){t(e,r)}}function rr(t){function e(e,r){t.moveTo(e+a,r),t.arc(e,r,a,0,Va)}function r(e,r){t.moveTo(e,r),s.point=n}function n(e,r){t.lineTo(e,r)}function i(){s.point=e}function o(){t.closePath()}var a=4.5,s={point:e,lineStart:function(){s.point=r},lineEnd:i,polygonStart:function(){s.lineEnd=o},polygonEnd:function(){s.lineEnd=i,s.point=e},pointRadius:function(t){return a=t,s},result:M};return s}function nr(t){function e(t){return(s?n:r)(t)}function r(e){return ar(e,function(r,n){r=t(r,n),e.point(r[0],r[1])})}function n(e){function r(r,n){r=t(r,n),e.point(r[0],r[1])}function n(){b=NaN,k.point=o,e.lineStart()}function o(r,n){var o=ge([r,n]),a=t(r,n);i(b,x,y,_,w,M,b=a[0],x=a[1],y=r,_=o[0],w=o[1],M=o[2],s,e),e.point(b,x)}function a(){k.point=r,e.lineEnd()}function l(){n(),k.point=u,k.lineEnd=c}function u(t,e){o(h=t,f=e),d=b,p=x,v=_,m=w,g=M,k.point=o}function c(){i(b,x,y,_,w,M,d,p,h,v,m,g,s,e),k.lineEnd=a,a()}var h,f,d,p,v,m,g,y,b,x,_,w,M,k={point:r,lineStart:n,lineEnd:a,polygonStart:function(){e.polygonStart(),k.lineStart=l},polygonEnd:function(){e.polygonEnd(),k.lineStart=n}};return k}function i(e,r,n,s,l,u,c,h,f,d,p,v,m,g){var y=c-e,b=h-r,x=y*y+b*b;if(x>4*o&&m--){var _=s+d,w=l+p,M=u+v,k=Math.sqrt(_*_+w*w+M*M),A=Math.asin(M/=k),T=wa(wa(M)-1)<Na||wa(n-f)<Na?(n+f)/2:Math.atan2(w,_),E=t(T,A),S=E[0],L=E[1],z=S-e,I=L-r,P=b*z-y*I;(P*P/x>o||wa((y*z+b*I)/x-.5)>.3||a>s*d+l*p+u*v)&&(i(e,r,n,s,l,u,S,L,T,_/=k,w/=k,M,m,g),g.point(S,L),i(S,L,T,_,w,M,c,h,f,d,p,v,m,g))}}var o=.5,a=Math.cos(30*Ha),s=16;return e.precision=function(t){return arguments.length?(s=(o=t*t)>0&&16,e):Math.sqrt(o)},e}function ir(t){var e=nr(function(e,r){return t([e*Xa,r*Xa])});return function(t){return ur(e(t))}}function or(t){this.stream=t}function ar(t,e){return{point:e,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function sr(t){return lr(function(){return t})()}function lr(t){function e(t){return t=s(t[0]*Ha,t[1]*Ha),[t[0]*f+l,u-t[1]*f]}function r(t){return t=s.invert((t[0]-l)/f,(u-t[1])/f),t&&[t[0]*Xa,t[1]*Xa]}function n(){s=ze(a=fr(g,y,b),o);var t=o(v,m);return l=d-t[0]*f,u=p+t[1]*f,i()}function i(){return c&&(c.valid=!1,c=null),e}var o,a,s,l,u,c,h=nr(function(t,e){return t=o(t,e),[t[0]*f+l,u-t[1]*f]}),f=150,d=480,p=250,v=0,m=0,g=0,y=0,b=0,_=Us,w=x,M=null,k=null;return e.stream=function(t){return c&&(c.valid=!1),c=ur(_(a,h(w(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(_=null==t?(M=t,Us):qe((M=+t)*Ha),i()):M},e.clipExtent=function(t){return arguments.length?(k=t,w=t?He(t[0][0],t[0][1],t[1][0],t[1][1]):x,i()):k},e.scale=function(t){return arguments.length?(f=+t,n()):f},e.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],n()):[d,p]},e.center=function(t){return arguments.length?(v=t[0]%360*Ha,m=t[1]%360*Ha,n()):[v*Xa,m*Xa]},e.rotate=function(t){return arguments.length?(g=t[0]%360*Ha,y=t[1]%360*Ha,b=t.length>2?t[2]%360*Ha:0,n()):[g*Xa,y*Xa,b*Xa]},ca.rebind(e,h,"precision"),function(){return o=t.apply(this,arguments),e.invert=o.invert&&r,n()}}function ur(t){return ar(t,function(e,r){t.point(e*Ha,r*Ha)})}function cr(t,e){return[t,e]}function hr(t,e){return[t>Ua?t-Va:-Ua>t?t+Va:t,e]}function fr(t,e,r){return t?e||r?ze(pr(t),vr(e,r)):pr(t):e||r?vr(e,r):hr}function dr(t){return function(e,r){return e+=t,[e>Ua?e-Va:-Ua>e?e+Va:e,r]}}function pr(t){var e=dr(t);return e.invert=dr(-t),e}function vr(t,e){function r(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,u=Math.sin(e),c=u*n+s*i;return[Math.atan2(l*o-c*a,s*n-u*i),nt(c*o+l*a)]}var n=Math.cos(t),i=Math.sin(t),o=Math.cos(e),a=Math.sin(e);return r.invert=function(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,u=Math.sin(e),c=u*o-l*a;return[Math.atan2(l*o+u*a,s*n+c*i),nt(c*n-s*i)]},r}function mr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,o,a,s){var l=a*e;null!=i?(i=gr(r,i),o=gr(r,o),(a>0?o>i:i>o)&&(i+=a*Va)):(i=t+a*Va,o=t-.5*l);for(var u,c=i;a>0?c>o:o>c;c-=l)s.point((u=Me([r,-n*Math.cos(c),-n*Math.sin(c)]))[0],u[1])}}function gr(t,e){var r=ge(e);r[0]-=t,we(r);var n=rt(-r[1]);return((-r[2]<0?-n:n)+2*Math.PI-Na)%(2*Math.PI)}function yr(t,e,r){var n=ca.range(t,e-Na,r).concat(e);return function(t){return n.map(function(e){return[t,e]})}}function br(t,e,r){var n=ca.range(t,e-Na,r).concat(e);return function(t){return n.map(function(e){return[e,t]})}}function xr(t){return t.source}function _r(t){return t.target}function wr(t,e,r,n){var i=Math.cos(e),o=Math.sin(e),a=Math.cos(n),s=Math.sin(n),l=i*Math.cos(t),u=i*Math.sin(t),c=a*Math.cos(r),h=a*Math.sin(r),f=2*Math.asin(Math.sqrt(st(n-e)+i*a*st(r-t))),d=1/Math.sin(f),p=f?function(t){var e=Math.sin(t*=f)*d,r=Math.sin(f-t)*d,n=r*l+e*c,i=r*u+e*h,a=r*o+e*s;return[Math.atan2(i,n)*Xa,Math.atan2(a,Math.sqrt(n*n+i*i))*Xa]}:function(){return[t*Xa,e*Xa]};return p.distance=f,p}function Mr(){function t(t,i){var o=Math.sin(i*=Ha),a=Math.cos(i),s=wa((t*=Ha)-e),l=Math.cos(s);$s+=Math.atan2(Math.sqrt((s=a*Math.sin(s))*s+(s=n*o-r*a*l)*s),r*o+n*a*l),e=t,r=o,n=a}var e,r,n;Qs.point=function(i,o){e=i*Ha,r=Math.sin(o*=Ha),n=Math.cos(o),Qs.point=t},Qs.lineEnd=function(){Qs.point=Qs.lineEnd=M}}function kr(t,e){function r(e,r){var n=Math.cos(e),i=Math.cos(r),o=t(n*i);return[o*i*Math.sin(e),o*Math.sin(r)]}return r.invert=function(t,r){var n=Math.sqrt(t*t+r*r),i=e(n),o=Math.sin(i),a=Math.cos(i);return[Math.atan2(t*o,n*a),Math.asin(n&&r*o/n)]},r}function Ar(t,e){function r(t,e){a>0?-Ga+Na>e&&(e=-Ga+Na):e>Ga-Na&&(e=Ga-Na);var r=a/Math.pow(i(e),o);return[r*Math.sin(o*t),a-r*Math.cos(o*t)]}var n=Math.cos(t),i=function(t){return Math.tan(Ua/4+t/2)},o=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(i(e)/i(t)),a=n*Math.pow(i(t),o)/o;return o?(r.invert=function(t,e){var r=a-e,n=tt(o)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/o,2*Math.atan(Math.pow(a/n,1/o))-Ga]},r):Er}function Tr(t,e){function r(t,e){var r=o-e;return[r*Math.sin(i*t),o-r*Math.cos(i*t)]}var n=Math.cos(t),i=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),o=n/i+t;return wa(i)<Na?cr:(r.invert=function(t,e){var r=o-e;return[Math.atan2(t,r)/i,o-tt(i)*Math.sqrt(t*t+r*r)]},r)}function Er(t,e){return[t,Math.log(Math.tan(Ua/4+e/2))]}function Sr(t){var e,r=sr(t),n=r.scale,i=r.translate,o=r.clipExtent;return r.scale=function(){var t=n.apply(r,arguments);return t===r?e?r.clipExtent(null):r:t},r.translate=function(){var t=i.apply(r,arguments);return t===r?e?r.clipExtent(null):r:t},r.clipExtent=function(t){var a=o.apply(r,arguments);if(a===r){if(e=null==t){var s=Ua*n(),l=i();o([[l[0]-s,l[1]-s],[l[0]+s,l[1]+s]])}}else e&&(a=null);return a},r.clipExtent(null)}function Lr(t,e){return[Math.log(Math.tan(Ua/4+e/2)),-t]}function zr(t){return t[0]}function Ir(t){return t[1]}function Pr(t){for(var e=t.length,r=[0,1],n=2,i=2;e>i;i++){for(;n>1&&et(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function Cr(t,e){return t[0]-e[0]||t[1]-e[1]}function Rr(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function Dr(t,e,r,n){var i=t[0],o=r[0],a=e[0]-i,s=n[0]-o,l=t[1],u=r[1],c=e[1]-l,h=n[1]-u,f=(s*(l-u)-h*(i-o))/(h*a-s*c);return[i+f*a,l+f*c]}function Or(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function Fr(){on(this),this.edge=this.site=this.circle=null}function jr(t){var e=hl.pop()||new Fr;return e.site=t,e}function Nr(t){Zr(t),ll.remove(t),hl.push(t),on(t)}function Br(t){var e=t.circle,r=e.x,n=e.cy,i={x:r,y:n},o=t.P,a=t.N,s=[t];Nr(t);for(var l=o;l.circle&&wa(r-l.circle.x)<Na&&wa(n-l.circle.cy)<Na;)o=l.P,s.unshift(l),Nr(l),l=o;s.unshift(l),Zr(l);for(var u=a;u.circle&&wa(r-u.circle.x)<Na&&wa(n-u.circle.cy)<Na;)a=u.N,s.push(u),Nr(u),u=a;s.push(u),Zr(u);var c,h=s.length;for(c=1;h>c;++c)u=s[c],l=s[c-1],en(u.edge,l.site,u.site,i);l=s[0],u=s[h-1],u.edge=Qr(l.site,u.site,null,i),Wr(l),Wr(u)}function Ur(t){for(var e,r,n,i,o=t.x,a=t.y,s=ll._;s;)if(n=Vr(s,a)-o,n>Na)s=s.L;else{if(i=o-qr(s,a),!(i>Na)){n>-Na?(e=s.P,r=s):i>-Na?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=jr(t);if(ll.insert(e,l),e||r){if(e===r)return Zr(e),r=jr(e.site),ll.insert(l,r),l.edge=r.edge=Qr(e.site,l.site),Wr(e),void Wr(r);if(!r)return void(l.edge=Qr(e.site,l.site));Zr(e),Zr(r);var u=e.site,c=u.x,h=u.y,f=t.x-c,d=t.y-h,p=r.site,v=p.x-c,m=p.y-h,g=2*(f*m-d*v),y=f*f+d*d,b=v*v+m*m,x={x:(m*y-d*b)/g+c,y:(f*b-v*y)/g+h};en(r.edge,u,p,x),l.edge=Qr(u,t,null,x),r.edge=Qr(t,p,null,x),Wr(e),Wr(r)}}function Vr(t,e){var r=t.site,n=r.x,i=r.y,o=i-e;if(!o)return n;var a=t.P;if(!a)return-(1/0);r=a.site;var s=r.x,l=r.y,u=l-e;if(!u)return s;var c=s-n,h=1/o-1/u,f=c/u;return h?(-f+Math.sqrt(f*f-2*h*(c*c/(-2*u)-l+u/2+i-o/2)))/h+n:(n+s)/2}function qr(t,e){var r=t.N;if(r)return Vr(r,e);var n=t.site;return n.y===e?n.x:1/0}function Gr(t){this.site=t,this.edges=[]}function Hr(t){for(var e,r,n,i,o,a,s,l,u,c,h=t[0][0],f=t[1][0],d=t[0][1],p=t[1][1],v=sl,m=v.length;m--;)if(o=v[m],o&&o.prepare())for(s=o.edges,l=s.length,a=0;l>a;)c=s[a].end(),n=c.x,i=c.y,u=s[++a%l].start(),e=u.x,r=u.y,(wa(n-e)>Na||wa(i-r)>Na)&&(s.splice(a,0,new rn(tn(o.site,c,wa(n-h)<Na&&p-i>Na?{x:h,y:wa(e-h)<Na?r:p}:wa(i-p)<Na&&f-n>Na?{x:wa(r-p)<Na?e:f,y:p}:wa(n-f)<Na&&i-d>Na?{x:f,y:wa(e-f)<Na?r:d}:wa(i-d)<Na&&n-h>Na?{x:wa(r-d)<Na?e:h,y:d}:null),o.site,null)),++l)}function Xr(t,e){return e.angle-t.angle}function Yr(){on(this),this.x=this.y=this.arc=this.site=this.cy=null}function Wr(t){var e=t.P,r=t.N;if(e&&r){var n=e.site,i=t.site,o=r.site;if(n!==o){var a=i.x,s=i.y,l=n.x-a,u=n.y-s,c=o.x-a,h=o.y-s,f=2*(l*h-u*c);if(!(f>=-Ba)){var d=l*l+u*u,p=c*c+h*h,v=(h*d-u*p)/f,m=(l*p-c*d)/f,h=m+s,g=fl.pop()||new Yr;g.arc=t,g.site=i,g.x=v+a,g.y=h+Math.sqrt(v*v+m*m),g.cy=h,t.circle=g;for(var y=null,b=cl._;b;)if(g.y<b.y||g.y===b.y&&g.x<=b.x){if(!b.L){y=b.P;break}b=b.L}else{if(!b.R){y=b;break}b=b.R}cl.insert(y,g),y||(ul=g)}}}}function Zr(t){var e=t.circle;e&&(e.P||(ul=e.N),cl.remove(e),fl.push(e),on(e),t.circle=null)}function Kr(t){for(var e,r=al,n=Ge(t[0][0],t[0][1],t[1][0],t[1][1]),i=r.length;i--;)e=r[i],(!Jr(e,t)||!n(e)||wa(e.a.x-e.b.x)<Na&&wa(e.a.y-e.b.y)<Na)&&(e.a=e.b=null,r.splice(i,1))}function Jr(t,e){var r=t.b;if(r)return!0;var n,i,o=t.a,a=e[0][0],s=e[1][0],l=e[0][1],u=e[1][1],c=t.l,h=t.r,f=c.x,d=c.y,p=h.x,v=h.y,m=(f+p)/2,g=(d+v)/2;if(v===d){if(a>m||m>=s)return;if(f>p){if(o){if(o.y>=u)return}else o={x:m,y:l};r={x:m,y:u}}else{if(o){if(o.y<l)return}else o={x:m,y:u};r={x:m,y:l}}}else if(n=(f-p)/(v-d),i=g-n*m,-1>n||n>1)if(f>p){if(o){if(o.y>=u)return}else o={x:(l-i)/n,y:l};r={x:(u-i)/n,y:u}}else{if(o){if(o.y<l)return}else o={x:(u-i)/n,y:u};r={x:(l-i)/n,y:l}}else if(v>d){if(o){if(o.x>=s)return}else o={x:a,y:n*a+i};r={x:s,y:n*s+i}}else{if(o){if(o.x<a)return}else o={x:s,y:n*s+i};r={x:a,y:n*a+i}}return t.a=o,t.b=r,!0}function $r(t,e){this.l=t,this.r=e,this.a=this.b=null}function Qr(t,e,r,n){var i=new$r(t,e);return al.push(i),r&&en(i,t,e,r),n&&en(i,e,t,n),sl[t.i].edges.push(new rn(i,t,e)),sl[e.i].edges.push(new rn(i,e,t)),i}function tn(t,e,r){var n=new $r(t,null);return n.a=e,n.b=r,al.push(n),n}function en(t,e,r,n){t.a||t.b?t.l===r?t.b=n:t.a=n:(t.a=n,t.l=e,t.r=r)}function rn(t,e,r){var n=t.a,i=t.b;this.edge=t,this.site=e,this.angle=r?Math.atan2(r.y-e.y,r.x-e.x):t.l===e?Math.atan2(i.x-n.x,n.y-i.y):Math.atan2(n.x-i.x,i.y-n.y)}function nn(){this._=null}function on(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function an(t,e){var r=e,n=e.R,i=r.U;i?i.L===r?i.L=n:i.R=n:t._=n,n.U=i,r.U=n,r.R=n.L,r.R&&(r.R.U=r),n.L=r}function sn(t,e){var r=e,n=e.L,i=r.U;i?i.L===r?i.L=n:i.R=n:t._=n,n.U=i,r.U=n,r.L=n.R,r.L&&(r.L.U=r),n.R=r}function ln(t){for(;t.L;)t=t.L;return t}function un(t,e){var r,n,i,o=t.sort(cn).pop();for(al=[],sl=new Array(t.length),ll=new nn,cl=new nn;;)if(i=ul,o&&(!i||o.y<i.y||o.y===i.y&&o.x<i.x))o.x===r&&o.y===n||(sl[o.i]=new Gr(o),Ur(o),r=o.x,n=o.y),o=t.pop();else{if(!i)break;Br(i.arc)}e&&(Kr(e),Hr(e));var a={cells:sl,edges:al};return ll=cl=al=sl=null,a}function cn(t,e){return e.y-t.y||e.x-t.x}function hn(t,e,r){return(t.x-r.x)*(e.y-t.y)-(t.x-e.x)*(r.y-t.y)}function fn(t){return t.x}function dn(t){return t.y}function pn(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function vn(t,e,r,n,i,o){if(!t(e,r,n,i,o)){var a=.5*(r+i),s=.5*(n+o),l=e.nodes;l[0]&&vn(t,l[0],r,n,a,s),l[1]&&vn(t,l[1],a,n,i,s),l[2]&&vn(t,l[2],r,s,a,o),l[3]&&vn(t,l[3],a,s,i,o)}}function mn(t,e,r,n,i,o,a){var s,l=1/0;return function u(t,c,h,f,d){if(!(c>o||h>a||n>f||i>d)){if(p=t.point){var p,v=e-t.x,m=r-t.y,g=v*v+m*m;if(l>g){var y=Math.sqrt(l=g);n=e-y,i=r-y,o=e+y,a=r+y,s=p}}for(var b=t.nodes,x=.5*(c+f),_=.5*(h+d),w=e>=x,M=r>=_,k=M<<1|w,A=k+4;A>k;++k)if(t=b[3&k])switch(3&k){case 0:u(t,c,h,x,_);break;case 1:u(t,x,h,f,_);break;case 2:u(t,c,_,x,d);break;case 3:u(t,x,_,f,d)}}}(t,n,i,o,a),s}function gn(t,e){t=ca.rgb(t),e=ca.rgb(e);var r=t.r,n=t.g,i=t.b,o=e.r-r,a=e.g-n,s=e.b-i;return function(t){return"#"+wt(Math.round(r+o*t))+wt(Math.round(n+a*t))+wt(Math.round(i+s*t))}}function yn(t,e){var r,n={},i={};for(r in t)r in e?n[r]=_n(t[r],e[r]):i[r]=t[r];for(r in e)r in t||(i[r]=e[r]);return function(t){for(r in n)i[r]=n[r](t);return i}}function bn(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function xn(t,e){var r,n,i,o=pl.lastIndex=vl.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(r=pl.exec(t))&&(n=vl.exec(e));)(i=n.index)>o&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(r=r[0])===(n=n[0])?s[a]?s[a]+=n:s[++a]=n:(s[++a]=null,l.push({i:a,x:bn(r,n)})),o=vl.lastIndex;return o<e.length&&(i=e.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?(e=l[0].x,function(t){return e(t)+""}):function(){return e}:(e=l.length,function(t){for(var r,n=0;e>n;++n)s[(r=l[n]).i]=r.x(t);return s.join("")})}function _n(t,e){for(var r,n=ca.interpolators.length;--n>=0&&!(r=ca.interpolators[n](t,e)););return r}function wn(t,e){var r,n=[],i=[],o=t.length,a=e.length,s=Math.min(t.length,e.length);for(r=0;s>r;++r)n.push(_n(t[r],e[r]));for(;o>r;++r)i[r]=t[r];for(;a>r;++r)i[r]=e[r];return function(t){for(r=0;s>r;++r)i[r]=n[r](t);return i}}function Mn(t){return function(e){return 0>=e?0:e>=1?1:t(e)}}function kn(t){return function(e){return 1-t(1-e)}}function An(t){return function(e){return.5*(.5>e?t(2*e):2-t(2-2*e))}}function Tn(t){return t*t}function En(t){return t*t*t}function Sn(t){if(0>=t)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(.5>t?r:3*(t-e)+r-.75)}function Ln(t){return function(e){return Math.pow(e,t)}}function zn(t){return 1-Math.cos(t*Ga)}function In(t){return Math.pow(2,10*(t-1))}function Pn(t){return 1-Math.sqrt(1-t*t)}function Cn(t,e){var r;return arguments.length<2&&(e=.45),arguments.length?r=e/Va*Math.asin(1/t):(t=1,r=e/4),function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*Va/e)}}function Rn(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Dn(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function On(t,e){t=ca.hcl(t),e=ca.hcl(e);var r=t.h,n=t.c,i=t.l,o=e.h-r,a=e.c-n,s=e.l-i;return isNaN(a)&&(a=0,n=isNaN(n)?e.c:n),isNaN(o)?(o=0,r=isNaN(r)?e.h:r):o>180?o-=360:-180>o&&(o+=360),function(t){return ft(r+o*t,n+a*t,i+s*t)+""}}function Fn(t,e){t=ca.hsl(t),e=ca.hsl(e);var r=t.h,n=t.s,i=t.l,o=e.h-r,a=e.s-n,s=e.l-i;return isNaN(a)&&(a=0,n=isNaN(n)?e.s:n),isNaN(o)?(o=0,r=isNaN(r)?e.h:r):o>180?o-=360:-180>o&&(o+=360),function(t){return ct(r+o*t,n+a*t,i+s*t)+""}}function jn(t,e){t=ca.lab(t),e=ca.lab(e);var r=t.l,n=t.a,i=t.b,o=e.l-r,a=e.a-n,s=e.b-i;return function(t){return pt(r+o*t,n+a*t,i+s*t)+""}}function Nn(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function Bn(t){var e=[t.a,t.b],r=[t.c,t.d],n=Vn(e),i=Un(e,r),o=Vn(qn(r,e,-i))||0;e[0]*r[1]<r[0]*e[1]&&(e[0]*=-1,e[1]*=-1,n*=-1,i*=-1),this.rotate=(n?Math.atan2(e[1],e[0]):Math.atan2(-r[0],r[1]))*Xa,this.translate=[t.e,t.f],this.scale=[n,o],this.skew=o?Math.atan2(i,o)*Xa:0}function Un(t,e){return t[0]*e[0]+t[1]*e[1]}function Vn(t){var e=Math.sqrt(Un(t,t));return e&&(t[0]/=e,t[1]/=e),e}function qn(t,e,r){return t[0]+=r*e[0],t[1]+=r*e[1],t}function Gn(t){return t.length?t.pop()+",":""}function Hn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push("translate(",null,",",null,")");n.push({i:i-4,x:bn(t[0],e[0])},{i:i-2,x:bn(t[1],e[1])})}else(e[0]||e[1])&&r.push("translate("+e+")")}function Xn(t,e,r,n){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(Gn(r)+"rotate(",null,")")-2,x:bn(t,e)})):e&&r.push(Gn(r)+"rotate("+e+")")}function Yn(t,e,r,n){t!==e?n.push({i:r.push(Gn(r)+"skewX(",null,")")-2,x:bn(t,e)}):e&&r.push(Gn(r)+"skewX("+e+")")}function Wn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(Gn(r)+"scale(",null,",",null,")");n.push({i:i-4,x:bn(t[0],e[0])},{i:i-2,x:bn(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(Gn(r)+"scale("+e+")")}function Zn(t,e){var r=[],n=[];return t=ca.transform(t),e=ca.transform(e),Hn(t.translate,e.translate,r,n),Xn(t.rotate,e.rotate,r,n),Yn(t.skew,e.skew,r,n),Wn(t.scale,e.scale,r,n),t=e=null,function(t){for(var e,i=-1,o=n.length;++i<o;)r[(e=n[i]).i]=e.x(t);return r.join("")}}function Kn(t,e){return e=(e-=t=+t)||1/e,function(r){return(r-t)/e}}function Jn(t,e){return e=(e-=t=+t)||1/e,function(r){return Math.max(0,Math.min(1,(r-t)/e))}}function$n(t){for(var e=t.source,r=t.target,n=ti(e,r),i=[e];e!==n;)e=e.parent,i.push(e);for(var o=i.length;r!==n;)i.splice(o,0,r),r=r.parent;return i}function Qn(t){for(var e=[],r=t.parent;null!=r;)e.push(t),t=r,r=r.parent;return e.push(t),e}function ti(t,e){if(t===e)return t;for(var r=Qn(t),n=Qn(e),i=r.pop(),o=n.pop(),a=null;i===o;)a=i,i=r.pop(),o=n.pop();return a}function ei(t){t.fixed|=2}function ri(t){t.fixed&=-7}function ni(t){t.fixed|=4,t.px=t.x,t.py=t.y}function ii(t){t.fixed&=-5}function oi(t,e,r){var n=0,i=0;if(t.charge=0,!t.leaf)for(var o,a=t.nodes,s=a.length,l=-1;++l<s;)o=a[l],null!=o&&(oi(o,e,r),t.charge+=o.charge,n+=o.charge*o.cx,i+=o.charge*o.cy);if(t.point){t.leaf||(t.point.x+=Math.random()-.5,t.point.y+=Math.random()-.5);var u=e*r[t.point.index];t.charge+=t.pointCharge=u,n+=u*t.point.x,i+=u*t.point.y}t.cx=n/t.charge,t.cy=i/t.charge}function ai(t,e){return ca.rebind(t,e,"sort","children","value"),t.nodes=t,t.links=fi,t}function si(t,e){for(var r=[t];null!=(t=r.pop());)if(e(t),(i=t.children)&&(n=i.length))for(var n,i;--n>=0;)r.push(i[n])}function li(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(o=t.children)&&(i=o.length))for(var i,o,a=-1;++a<i;)r.push(o[a]);for(;null!=(t=n.pop());)e(t)}function ui(t){return t.children}function ci(t){return t.value}function hi(t,e){return e.value-t.value}function fi(t){return ca.merge(t.map(function(t){return(t.children||[]).map(function(e){return{source:t,target:e}})}))}function di(t){return t.x}function pi(t){return t.y}function vi(t,e,r){t.y0=e,t.y=r}function mi(t){return ca.range(t.length)}function gi(t){for(var e=-1,r=t[0].length,n=[];++e<r;)n[e]=0;return n}function yi(t){for(var e,r=1,n=0,i=t[0][1],o=t.length;o>r;++r)(e=t[r][1])>i&&(n=r,i=e);return n}function bi(t){return t.reduce(xi,0)}function xi(t,e){return t+e[1]}function _i(t,e){return wi(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wi(t,e){for(var r=-1,n=+t[0],i=(t[1]-n)/e,o=[];++r<=e;)o[r]=i*r+n;return o}function Mi(t){return[ca.min(t),ca.max(t)]}function ki(t,e){return t.value-e.value}function Ai(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Ti(t,e){t._pack_next=e,e._pack_prev=t}function Ei(t,e){var r=e.x-t.x,n=e.y-t.y,i=t.r+e.r;return.999*i*i>r*r+n*n}function Si(t){function e(t){c=Math.min(t.x-t.r,c),h=Math.max(t.x+t.r,h),f=Math.min(t.y-t.r,f),d=Math.max(t.y+t.r,d)}if((r=t.children)&&(u=r.length)){var r,n,i,o,a,s,l,u,c=1/0,h=-(1/0),f=1/0,d=-(1/0);if(r.forEach(Li),n=r[0],n.x=-n.r,n.y=0,e(n),u>1&&(i=r[1],i.x=i.r,i.y=0,e(i),u>2))for(o=r[2],Pi(n,i,o),e(o),Ai(n,o),n._pack_prev=o,Ai(o,i),i=n._pack_next,a=3;u>a;a++){Pi(n,i,o=r[a]);var p=0,v=1,m=1;for(s=i._pack_next;s!==i;s=s._pack_next,v++)if(Ei(s,o)){p=1;break}if(1==p)for(l=n._pack_prev;l!==s._pack_prev&&!Ei(l,o);l=l._pack_prev,m++);p?(m>v||v==m&&i.r<n.r?Ti(n,i=s):Ti(n=l,i),a--):(Ai(n,o),i=o,e(o))}var g=(c+h)/2,y=(f+d)/2,b=0;for(a=0;u>a;a++)o=r[a],o.x-=g,o.y-=y,b=Math.max(b,o.r+Math.sqrt(o.x*o.x+o.y*o.y));t.r=b,r.forEach(zi)}}function Li(t){t._pack_next=t._pack_prev=t}function zi(t){delete t._pack_next,delete t._pack_prev}function Ii(t,e,r,n){var i=t.children;if(t.x=e+=n*t.x,t.y=r+=n*t.y,t.r*=n,i)for(var o=-1,a=i.length;++o<a;)Ii(i[o],e,r,n)}function Pi(t,e,r){var n=t.r+r.r,i=e.x-t.x,o=e.y-t.y;if(n&&(i||o)){var a=e.r+r.r,s=i*i+o*o;a*=a,n*=n;var l=.5+(n-a)/(2*s),u=Math.sqrt(Math.max(0,2*a*(n+s)-(n-=s)*n-a*a))/(2*s);r.x=t.x+l*i+u*o,r.y=t.y+l*o-u*i}else r.x=t.x+n,r.y=t.y}function Ci(t,e){return t.parent==e.parent?1:2}function Ri(t){var e=t.children;return e.length?e[0]:t.t}function Di(t){var e,r=t.children;return(e=r.length)?r[e-1]:t.t}function Oi(t,e,r){var n=r/(e.i-t.i);e.c-=n,e.s+=r,t.c+=n,e.z+=r,e.m+=r}function Fi(t){for(var e,r=0,n=0,i=t.children,o=i.length;--o>=0;)e=i[o],e.z+=r,e.m+=r,r+=e.s+(n+=e.c)}function ji(t,e,r){return t.a.parent===e.parent?t.a:r}function Ni(t){return 1+ca.max(t,function(t){return t.y})}function Bi(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function Ui(t){var e=t.children;return e&&e.length?Ui(e[0]):t}function Vi(t){var e,r=t.children;return r&&(e=r.length)?Vi(r[e-1]):t}function qi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Gi(t,e){var r=t.x+e[3],n=t.y+e[0],i=t.dx-e[1]-e[3],o=t.dy-e[0]-e[2];return 0>i&&(r+=i/2,i=0),0>o&&(n+=o/2,o=0),{x:r,y:n,dx:i,dy:o}}function Hi(t){var e=t[0],r=t[t.length-1];return r>e?[e,r]:[r,e]}function Xi(t){return t.rangeExtent?t.rangeExtent():Hi(t.range())}function Yi(t,e,r,n){var i=r(t[0],t[1]),o=n(e[0],e[1]);return function(t){return o(i(t))}}function Wi(t,e){var r,n=0,i=t.length-1,o=t[n],a=t[i];return o>a&&(r=n,n=i,i=r,r=o,o=a,a=r),t[n]=e.floor(o),t[i]=e.ceil(a),t}function Zi(t){return t?{floor:function(e){return Math.floor(e/t)*t},ceil:function(e){return Math.ceil(e/t)*t}}:Tl}function Ki(t,e,r,n){var i=[],o=[],a=0,s=Math.min(t.length,e.length)-1;for(t[s]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<=s;)i.push(r(t[a-1],t[a])),o.push(n(e[a-1],e[a]));return function(e){var r=ca.bisect(t,e,1,s)-1;return o[r](i[r](e))}}function Ji(t,e,r,n){function i(){var i=Math.min(t.length,e.length)>2?Ki:Yi,l=n?Jn:Kn;return a=i(t,e,l,r),s=i(e,t,l,_n),o}function o(t){return a(t)}var a,s;return o.invert=function(t){return s(t)},o.domain=function(e){return arguments.length?(t=e.map(Number),i()):t},o.range=function(t){return arguments.length?(e=t,i()):e},o.rangeRound=function(t){return o.range(t).interpolate(Nn)},o.clamp=function(t){return arguments.length?(n=t,i()):n},o.interpolate=function(t){return arguments.length?(r=t,i()):r},o.ticks=function(e){return eo(t,e)},o.tickFormat=function(e,r){return ro(t,e,r)},o.nice=function(e){return Qi(t,e),i()},o.copy=function(){return Ji(t,e,r,n)},i()}function $i(t,e){return ca.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Qi(t,e){return Wi(t,Zi(to(t,e)[2])),Wi(t,Zi(to(t,e)[2])),t}function to(t,e){null==e&&(e=10);var r=Hi(t),n=r[1]-r[0],i=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),o=e/n*i;return.15>=o?i*=10:.35>=o?i*=5:.75>=o&&(i*=2),r[0]=Math.ceil(r[0]/i)*i,r[1]=Math.floor(r[1]/i)*i+.5*i,r[2]=i,r}function eo(t,e){return ca.range.apply(ca,to(t,e))}function ro(t,e,r){var n=to(t,e);if(r){var i=ps.exec(r);if(i.shift(),"s"===i[8]){var o=ca.formatPrefix(Math.max(wa(n[0]),wa(n[1])));return i[7]||(i[7]="."+no(o.scale(n[2]))),i[8]="f",r=ca.format(i.join("")),function(t){return r(o.scale(t))+o.symbol}}i[7]||(i[7]="."+io(i[8],n)),r=i.join("")}else r=",."+no(n[2])+"f";return ca.format(r)}function no(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function io(t,e){var r=no(e[2]);return t in El?Math.abs(r-no(Math.max(wa(e[0]),wa(e[1]))))+ +("e"!==t):r-2*("%"===t)}function oo(t,e,r,n){function i(t){return(r?Math.log(0>t?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function o(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function a(e){return t(i(e))}return a.invert=function(e){return o(t.invert(e))},a.domain=function(e){return arguments.length?(r=e[0]>=0,t.domain((n=e.map(Number)).map(i)),a):n},a.base=function(r){return arguments.length?(e=+r,t.domain(n.map(i)),a):e},a.nice=function(){var e=Wi(n.map(i),r?Math:Ll);return t.domain(e),n=e.map(o),a},a.ticks=function(){var t=Hi(n),a=[],s=t[0],l=t[1],u=Math.floor(i(s)),c=Math.ceil(i(l)),h=e%1?2:e;if(isFinite(c-u)){if(r){for(;c>u;u++)for(var f=1;h>f;f++)a.push(o(u)*f);a.push(o(u))}else for(a.push(o(u));u++<c;)for(var f=h-1;f>0;f--)a.push(o(u)*f);for(u=0;a[u]<s;u++);for(c=a.length;a[c-1]>l;c--);a=a.slice(u,c)}return a},a.tickFormat=function(t,r){if(!arguments.length)return Sl;arguments.length<2?r=Sl:"function"!=typeof r&&(r=ca.format(r));var n=Math.max(1,e*t/a.ticks().length);return function(t){var a=t/o(Math.round(i(t)));return e-.5>a*e&&(a*=e),n>=a?r(t):""}},a.copy=function(){return oo(t.copy(),e,r,n)},$i(a,t)}function ao(t,e,r){function n(e){return t(i(e))}var i=so(e),o=so(1/e);return n.invert=function(e){return o(t.invert(e))},n.domain=function(e){return arguments.length?(t.domain((r=e.map(Number)).map(i)),n):r},n.ticks=function(t){return eo(r,t)},n.tickFormat=function(t,e){return ro(r,t,e)},n.nice=function(t){return n.domain(Qi(r,t));
},n.exponent=function(a){return arguments.length?(i=so(e=a),o=so(1/e),t.domain(r.map(i)),n):e},n.copy=function(){return ao(t.copy(),e,r)},$i(n,t)}function so(t){return function(e){return 0>e?-Math.pow(-e,t):Math.pow(e,t)}}function lo(t,e){function r(r){return o[((i.get(r)||("range"===e.t?i.set(r,t.push(r)):NaN))-1)%o.length]}function n(e,r){return ca.range(t.length).map(function(t){return e+r*t})}var i,o,a;return r.domain=function(n){if(!arguments.length)return t;t=[],i=new h;for(var o,a=-1,s=n.length;++a<s;)i.has(o=n[a])||i.set(o,t.push(o));return r[e.t].apply(r,e.a)},r.range=function(t){return arguments.length?(o=t,a=0,e={t:"range",a:arguments},r):o},r.rangePoints=function(i,s){arguments.length<2&&(s=0);var l=i[0],u=i[1],c=t.length<2?(l=(l+u)/2,0):(u-l)/(t.length-1+s);return o=n(l+c*s/2,c),a=0,e={t:"rangePoints",a:arguments},r},r.rangeRoundPoints=function(i,s){arguments.length<2&&(s=0);var l=i[0],u=i[1],c=t.length<2?(l=u=Math.round((l+u)/2),0):(u-l)/(t.length-1+s)|0;return o=n(l+Math.round(c*s/2+(u-l-(t.length-1+s)*c)/2),c),a=0,e={t:"rangeRoundPoints",a:arguments},r},r.rangeBands=function(i,s,l){arguments.length<2&&(s=0),arguments.length<3&&(l=s);var u=i[1]<i[0],c=i[u-0],h=i[1-u],f=(h-c)/(t.length-s+2*l);return o=n(c+f*l,f),u&&o.reverse(),a=f*(1-s),e={t:"rangeBands",a:arguments},r},r.rangeRoundBands=function(i,s,l){arguments.length<2&&(s=0),arguments.length<3&&(l=s);var u=i[1]<i[0],c=i[u-0],h=i[1-u],f=Math.floor((h-c)/(t.length-s+2*l));return o=n(c+Math.round((h-c-(t.length-s)*f)/2),f),u&&o.reverse(),a=Math.round(f*(1-s)),e={t:"rangeRoundBands",a:arguments},r},r.rangeBand=function(){return a},r.rangeExtent=function(){return Hi(e.a[0])},r.copy=function(){return lo(t,e)},r.domain(t)}function uo(t,e){function r(){var r=0,i=e.length;for(s=[];++r<i;)s[r-1]=ca.quantile(t,r/i);return n}function n(t){return isNaN(t=+t)?void 0:e[ca.bisect(s,t)]}var s;return n.domain=function(e){return arguments.length?(t=e.map(o).filter(a).sort(i),r()):t},n.range=function(t){return arguments.length?(e=t,r()):e},n.quantiles=function(){return s},n.invertExtent=function(r){return r=e.indexOf(r),0>r?[NaN,NaN]:[r>0?s[r-1]:t[0],r<s.length?s[r]:t[t.length-1]]},n.copy=function(){return uo(t,e)},r()}function co(t,e,r){function n(e){return r[Math.max(0,Math.min(a,Math.floor(o*(e-t))))]}function i(){return o=r.length/(e-t),a=r.length-1,n}var o,a;return n.domain=function(r){return arguments.length?(t=+r[0],e=+r[r.length-1],i()):[t,e]},n.range=function(t){return arguments.length?(r=t,i()):r},n.invertExtent=function(e){return e=r.indexOf(e),e=0>e?NaN:e/o+t,[e,e+1/o]},n.copy=function(){return co(t,e,r)},i()}function ho(t,e){function r(r){return r>=r?e[ca.bisect(t,r)]:void 0}return r.domain=function(e){return arguments.length?(t=e,r):t},r.range=function(t){return arguments.length?(e=t,r):e},r.invertExtent=function(r){return r=e.indexOf(r),[t[r-1],t[r]]},r.copy=function(){return ho(t,e)},r}function fo(t){function e(t){return+t}return e.invert=e,e.domain=e.range=function(r){return arguments.length?(t=r.map(e),e):t},e.ticks=function(e){return eo(t,e)},e.tickFormat=function(e,r){return ro(t,e,r)},e.copy=function(){return fo(t)},e}function po(){return 0}function vo(t){return t.innerRadius}function mo(t){return t.outerRadius}function go(t){return t.startAngle}function yo(t){return t.endAngle}function bo(t){return t&&t.padAngle}function xo(t,e,r,n){return(t-r)*e-(e-n)*t>0?0:1}function _o(t,e,r,n,i){var o=t[0]-e[0],a=t[1]-e[1],s=(i?n:-n)/Math.sqrt(o*o+a*a),l=s*a,u=-s*o,c=t[0]+l,h=t[1]+u,f=e[0]+l,d=e[1]+u,p=(c+f)/2,v=(h+d)/2,m=f-c,g=d-h,y=m*m+g*g,b=r-n,x=c*d-f*h,_=(0>g?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*g-m*_)/y,M=(-x*m-g*_)/y,k=(x*g+m*_)/y,A=(-x*m+g*_)/y,T=w-p,E=M-v,S=k-p,L=A-v;return T*T+E*E>S*S+L*L&&(w=k,M=A),[[w-l,M-u],[w*r/b,M*r/b]]}function wo(t){function e(e){function a(){u.push("M",o(t(c),s))}for(var l,u=[],c=[],h=-1,f=e.length,d=St(r),p=St(n);++h<f;)i.call(this,l=e[h],h)?c.push([+d.call(this,l,h),+p.call(this,l,h)]):c.length&&(a(),c=[]);return c.length&&a(),u.length?u.join(""):null}var r=zr,n=Ir,i=Ie,o=Mo,a=o.key,s=.7;return e.x=function(t){return arguments.length?(r=t,e):r},e.y=function(t){return arguments.length?(n=t,e):n},e.defined=function(t){return arguments.length?(i=t,e):i},e.interpolate=function(t){return arguments.length?(a="function"==typeof t?o=t:(o=Dl.get(t)||Mo).key,e):a},e.tension=function(t){return arguments.length?(s=t,e):s},e}function Mo(t){return t.length>1?t.join("L"):t+"Z"}function ko(t){return t.join("L")+"Z"}function Ao(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e<r;)i.push("H",(n[0]+(n=t[e])[0])/2,"V",n[1]);return r>1&&i.push("H",n[0]),i.join("")}function To(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e<r;)i.push("V",(n=t[e])[1],"H",n[0]);return i.join("")}function Eo(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e<r;)i.push("H",(n=t[e])[0],"V",n[1]);return i.join("")}function So(t,e){return t.length<4?Mo(t):t[1]+Io(t.slice(1,-1),Po(t,e))}function Lo(t,e){return t.length<3?ko(t):t[0]+Io((t.push(t[0]),t),Po([t[t.length-2]].concat(t,[t[1]]),e))}function zo(t,e){return t.length<3?Mo(t):t[0]+Io(t,Po(t,e))}function Io(t,e){if(e.length<1||t.length!=e.length&&t.length!=e.length+2)return Mo(t);var r=t.length!=e.length,n="",i=t[0],o=t[1],a=e[0],s=a,l=1;if(r&&(n+="Q"+(o[0]-2*a[0]/3)+","+(o[1]-2*a[1]/3)+","+o[0]+","+o[1],i=t[1],l=2),e.length>1){s=e[1],o=t[l],l++,n+="C"+(i[0]+a[0])+","+(i[1]+a[1])+","+(o[0]-s[0])+","+(o[1]-s[1])+","+o[0]+","+o[1];for(var u=2;u<e.length;u++,l++)o=t[l],s=e[u],n+="S"+(o[0]-s[0])+","+(o[1]-s[1])+","+o[0]+","+o[1]}if(r){var c=t[l];n+="Q"+(o[0]+2*s[0]/3)+","+(o[1]+2*s[1]/3)+","+c[0]+","+c[1]}return n}function Po(t,e){for(var r,n=[],i=(1-e)/2,o=t[0],a=t[1],s=1,l=t.length;++s<l;)r=o,o=a,a=t[s],n.push([i*(a[0]-r[0]),i*(a[1]-r[1])]);return n}function Co(t){if(t.length<3)return Mo(t);var e=1,r=t.length,n=t[0],i=n[0],o=n[1],a=[i,i,i,(n=t[1])[0]],s=[o,o,o,n[1]],l=[i,",",o,"L",Fo(jl,a),",",Fo(jl,s)];for(t.push(t[r-1]);++e<=r;)n=t[e],a.shift(),a.push(n[0]),s.shift(),s.push(n[1]),jo(l,a,s);return t.pop(),l.push("L",n),l.join("")}function Ro(t){if(t.length<4)return Mo(t);for(var e,r=[],n=-1,i=t.length,o=[0],a=[0];++n<3;)e=t[n],o.push(e[0]),a.push(e[1]);for(r.push(Fo(jl,o)+","+Fo(jl,a)),--n;++n<i;)e=t[n],o.shift(),o.push(e[0]),a.shift(),a.push(e[1]),jo(r,o,a);return r.join("")}function Do(t){for(var e,r,n=-1,i=t.length,o=i+4,a=[],s=[];++n<4;)r=t[n%i],a.push(r[0]),s.push(r[1]);for(e=[Fo(jl,a),",",Fo(jl,s)],--n;++n<o;)r=t[n%i],a.shift(),a.push(r[0]),s.shift(),s.push(r[1]),jo(e,a,s);return e.join("")}function Oo(t,e){var r=t.length-1;if(r)for(var n,i,o=t[0][0],a=t[0][1],s=t[r][0]-o,l=t[r][1]-a,u=-1;++u<=r;)n=t[u],i=u/r,n[0]=e*n[0]+(1-e)*(o+i*s),n[1]=e*n[1]+(1-e)*(a+i*l);return Co(t)}function Fo(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function jo(t,e,r){t.push("C",Fo(Ol,e),",",Fo(Ol,r),",",Fo(Fl,e),",",Fo(Fl,r),",",Fo(jl,e),",",Fo(jl,r))}function No(t,e){return(e[1]-t[1])/(e[0]-t[0])}function Bo(t){for(var e=0,r=t.length-1,n=[],i=t[0],o=t[1],a=n[0]=No(i,o);++e<r;)n[e]=(a+(a=No(i=o,o=t[e+1])))/2;return n[e]=a,n}function Uo(t){for(var e,r,n,i,o=[],a=Bo(t),s=-1,l=t.length-1;++s<l;)e=No(t[s],t[s+1]),wa(e)<Na?a[s]=a[s+1]=0:(r=a[s]/e,n=a[s+1]/e,i=r*r+n*n,i>9&&(i=3*e/Math.sqrt(i),a[s]=i*r,a[s+1]=i*n));for(s=-1;++s<=l;)i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+a[s]*a[s])),o.push([i||0,a[s]*i||0]);return o}function Vo(t){return t.length<3?Mo(t):t[0]+Io(t,Uo(t))}function qo(t){for(var e,r,n,i=-1,o=t.length;++i<o;)e=t[i],r=e[0],n=e[1]-Ga,e[0]=r*Math.cos(n),e[1]=r*Math.sin(n);return t}function Go(t){function e(e){function l(){v.push("M",s(t(g),h),c,u(t(m.reverse()),h),"Z")}for(var f,d,p,v=[],m=[],g=[],y=-1,b=e.length,x=St(r),_=St(i),w=r===n?function(){return d}:St(n),M=i===o?function(){return p}:St(o);++y<b;)a.call(this,f=e[y],y)?(m.push([d=+x.call(this,f,y),p=+_.call(this,f,y)]),g.push([+w.call(this,f,y),+M.call(this,f,y)])):m.length&&(l(),m=[],g=[]);return m.length&&l(),v.length?v.join(""):null}var r=zr,n=zr,i=0,o=Ir,a=Ie,s=Mo,l=s.key,u=s,c="L",h=.7;return e.x=function(t){return arguments.length?(r=n=t,e):n},e.x0=function(t){return arguments.length?(r=t,e):r},e.x1=function(t){return arguments.length?(n=t,e):n},e.y=function(t){return arguments.length?(i=o=t,e):o},e.y0=function(t){return arguments.length?(i=t,e):i},e.y1=function(t){return arguments.length?(o=t,e):o},e.defined=function(t){return arguments.length?(a=t,e):a},e.interpolate=function(t){return arguments.length?(l="function"==typeof t?s=t:(s=Dl.get(t)||Mo).key,u=s.reverse||s,c=s.closed?"M":"L",e):l},e.tension=function(t){return arguments.length?(h=t,e):h},e}function Ho(t){return t.radius}function Xo(t){return[t.x,t.y]}function Yo(t){return function(){var e=t.apply(this,arguments),r=e[0],n=e[1]-Ga;return[r*Math.cos(n),r*Math.sin(n)]}}function Wo(){return 64}function Zo(){return"circle"}function Ko(t){var e=Math.sqrt(t/Ua);return"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+-e+"A"+e+","+e+" 0 1,1 0,"+e+"Z"}function Jo(t){return function(){var e,r,n;(e=this[t])&&(n=e[r=e.active])&&(n.timer.c=null,n.timer.t=NaN,--e.count?delete e[r]:delete this[t],e.active+=.5,n.event&&n.event.interrupt.call(this,this.__data__,n.index))}}function$o(t,e,r){return Ea(t,Hl),t.namespace=e,t.id=r,t}function Qo(t,e,r,n){var i=t.id,o=t.namespace;return H(t,"function"==typeof r?function(t,a,s){t[o][i].tween.set(e,n(r.call(t,t.__data__,a,s)))}:(r=n(r),function(t){t[o][i].tween.set(e,r)}))}function ta(t){return null==t&&(t=""),function(){this.textContent=t}}function ea(t){return null==t?"__transition__":"__transition_"+t+"__"}function ra(t,e,r,n,i){function o(t){var e=v.delay;return u.t=e+l,t>=e?a(t-e):void(u.c=a)}function a(r){var i=p.active,o=p[i];o&&(o.timer.c=null,o.timer.t=NaN,--p.count,delete p[i],o.event&&o.event.interrupt.call(t,t.__data__,o.index));for(var a in p)if(n>+a){var h=p[a];h.timer.c=null,h.timer.t=NaN,--p.count,delete p[a]}u.c=s,Ct(function(){return u.c&&s(r||1)&&(u.c=null,u.t=NaN),1},0,l),p.active=n,v.event&&v.event.start.call(t,t.__data__,e),d=[],v.tween.forEach(function(r,n){(n=n.call(t,t.__data__,e))&&d.push(n)}),f=v.ease,c=v.duration}function s(i){for(var o=i/c,a=f(o),s=d.length;s>0;)d[--s].call(t,a);return o>=1?(v.event&&v.event.end.call(t,t.__data__,e),--p.count?delete p[n]:delete t[r],1):void 0}var l,u,c,f,d,p=t[r]||(t[r]={active:0,count:0}),v=p[n];v||(l=i.time,u=Ct(o,0,l),v=p[n]={tween:new h,time:l,timer:u,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++p.count)}function na(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function ia(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function oa(t){return t.toISOString()}function aa(t,e,r){function n(e){return t(e)}function i(t,r){var n=t[1]-t[0],i=n/r,o=ca.bisect(tu,i);return o==tu.length?[e.year,to(t.map(function(t){return t/31536e6}),r)[2]]:o?e[i/tu[o-1]<tu[o]/i?o-1:o]:[nu,to(t,r)[2]]}return n.invert=function(e){return sa(t.invert(e))},n.domain=function(e){return arguments.length?(t.domain(e),n):t.domain().map(sa)},n.nice=function(t,e){function r(r){return!isNaN(r)&&!t.range(r,sa(+r+1),e).length}var o=n.domain(),a=Hi(o),s=null==t?i(a,10):"number"==typeof t&&i(a,t);return s&&(t=s[0],e=s[1]),n.domain(Wi(o,e>1?{floor:function(e){for(;r(e=t.floor(e));)e=sa(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=sa(+e+1);return e}}:t))},n.ticks=function(t,e){var r=Hi(n.domain()),o=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return o&&(t=o[0],e=o[1]),t.range(r[0],sa(+r[1]+1),1>e?1:e)},n.tickFormat=function(){return r},n.copy=function(){return aa(t.copy(),e,r)},$i(n,t)}function sa(t){return new Date(t)}function la(t){return JSON.parse(t.responseText)}function ua(t){var e=da.createRange();return e.selectNode(da.body),e.createContextualFragment(t.responseText)}var ca={version:"3.5.16"},ha=[].slice,fa=function(t){return ha.call(t)},da=this.document;if(da)try{fa(da.documentElement.childNodes)[0].nodeType}catch(pa){fa=function(t){for(var e=t.length,r=new Array(e);e--;)r[e]=t[e];return r}}if(Date.now||(Date.now=function(){return+new Date}),da)try{da.createElement("DIV").style.setProperty("opacity",0,"")}catch(va){var ma=this.Element.prototype,ga=ma.setAttribute,ya=ma.setAttributeNS,ba=this.CSSStyleDeclaration.prototype,xa=ba.setProperty;ma.setAttribute=function(t,e){ga.call(this,t,e+"")},ma.setAttributeNS=function(t,e,r){ya.call(this,t,e,r+"")},ba.setProperty=function(t,e,r){xa.call(this,t,e+"",r)}}ca.ascending=i,ca.descending=function(t,e){return t>e?-1:e>t?1:e>=t?0:NaN},ca.min=function(t,e){var r,n,i=-1,o=t.length;if(1===arguments.length){for(;++i<o;)if(null!=(n=t[i])&&n>=n){r=n;break}for(;++i<o;)null!=(n=t[i])&&r>n&&(r=n)}else{for(;++i<o;)if(null!=(n=e.call(t,t[i],i))&&n>=n){r=n;break}for(;++i<o;)null!=(n=e.call(t,t[i],i))&&r>n&&(r=n)}return r},ca.max=function(t,e){var r,n,i=-1,o=t.length;if(1===arguments.length){for(;++i<o;)if(null!=(n=t[i])&&n>=n){r=n;break}for(;++i<o;)null!=(n=t[i])&&n>r&&(r=n)}else{for(;++i<o;)if(null!=(n=e.call(t,t[i],i))&&n>=n){r=n;break}for(;++i<o;)null!=(n=e.call(t,t[i],i))&&n>r&&(r=n)}return r},ca.extent=function(t,e){var r,n,i,o=-1,a=t.length;if(1===arguments.length){for(;++o<a;)if(null!=(n=t[o])&&n>=n){r=i=n;break}for(;++o<a;)null!=(n=t[o])&&(r>n&&(r=n),n>i&&(i=n))}else{for(;++o<a;)if(null!=(n=e.call(t,t[o],o))&&n>=n){r=i=n;break}for(;++o<a;)null!=(n=e.call(t,t[o],o))&&(r>n&&(r=n),n>i&&(i=n))}return[r,i]},ca.sum=function(t,e){var r,n=0,i=t.length,o=-1;if(1===arguments.length)for(;++o<i;)a(r=+t[o])&&(n+=r);else for(;++o<i;)a(r=+e.call(t,t[o],o))&&(n+=r);return n},ca.mean=function(t,e){var r,n=0,i=t.length,s=-1,l=i;if(1===arguments.length)for(;++s<i;)a(r=o(t[s]))?n+=r:--l;else for(;++s<i;)a(r=o(e.call(t,t[s],s)))?n+=r:--l;return l?n/l:void 0},ca.quantile=function(t,e){var r=(t.length-1)*e+1,n=Math.floor(r),i=+t[n-1],o=r-n;return o?i+o*(t[n]-i):i},ca.median=function(t,e){var r,n=[],s=t.length,l=-1;if(1===arguments.length)for(;++l<s;)a(r=o(t[l]))&&n.push(r);else for(;++l<s;)a(r=o(e.call(t,t[l],l)))&&n.push(r);return n.length?ca.quantile(n.sort(i),.5):void 0},ca.variance=function(t,e){var r,n,i=t.length,s=0,l=0,u=-1,c=0;if(1===arguments.length)for(;++u<i;)a(r=o(t[u]))&&(n=r-s,s+=n/++c,l+=n*(r-s));else for(;++u<i;)a(r=o(e.call(t,t[u],u)))&&(n=r-s,s+=n/++c,l+=n*(r-s));return c>1?l/(c-1):void 0},ca.deviation=function(){var t=ca.variance.apply(this,arguments);return t?Math.sqrt(t):t};var _a=s(i);ca.bisectLeft=_a.left,ca.bisect=ca.bisectRight=_a.right,ca.bisector=function(t){return s(1===t.length?function(e,r){return i(t(e),r)}:t)},ca.shuffle=function(t,e,r){(o=arguments.length)<3&&(r=t.length,2>o&&(e=0));for(var n,i,o=r-e;o;)i=Math.random()*o--|0,n=t[o+e],t[o+e]=t[i+e],t[i+e]=n;return t},ca.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},ca.pairs=function(t){for(var e,r=0,n=t.length-1,i=t[0],o=new Array(0>n?0:n);n>r;)o[r]=[e=i,i=t[++r]];return o},ca.transpose=function(t){if(!(i=t.length))return[];for(var e=-1,r=ca.min(t,l),n=new Array(r);++e<r;)for(var i,o=-1,a=n[e]=new Array(i);++o<i;)a[o]=t[o][e];return n},ca.zip=function(){return ca.transpose(arguments)},ca.keys=function(t){var e=[];for(var r in t)e.push(r);return e},ca.values=function(t){var e=[];for(var r in t)e.push(t[r]);return e},ca.entries=function(t){var e=[];for(var r in t)e.push({key:r,value:t[r]});return e},ca.merge=function(t){for(var e,r,n,i=t.length,o=-1,a=0;++o<i;)a+=t[o].length;for(r=new Array(a);--i>=0;)for(n=t[i],e=n.length;--e>=0;)r[--a]=n[e];return r};var wa=Math.abs;ca.range=function(t,e,r){if(arguments.length<3&&(r=1,arguments.length<2&&(e=t,t=0)),(e-t)/r===1/0)throw new Error("infinite range");var n,i=[],o=u(wa(r)),a=-1;if(t*=o,e*=o,r*=o,0>r)for(;(n=t+r*++a)>e;)i.push(n/o);else for(;(n=t+r*++a)<e;)i.push(n/o);return i},ca.map=function(t,e){var r=new h;if(t instanceof h)t.forEach(function(t,e){r.set(t,e)});else if(Array.isArray(t)){var n,i=-1,o=t.length;if(1===arguments.length)for(;++i<o;)r.set(i,t[i]);else for(;++i<o;)r.set(e.call(t,n=t[i],i),n)}else for(var a in t)r.set(a,t[a]);return r};var Ma="__proto__",ka="\x00";c(h,{has:p,get:function(t){return this._[f(t)]},set:function(t,e){return this._[f(t)]=e},remove:v,keys:m,values:function(){var t=[];for(var e in this._)t.push(this._[e]);return t},entries:function(){var t=[];for(var e in this._)t.push({key:d(e),value:this._[e]});return t},size:g,empty:y,forEach:function(t){for(var e in this._)t.call(this,d(e),this._[e])}}),ca.nest=function(){function t(e,a,s){if(s>=o.length)return n?n.call(i,a):r?a.sort(r):a;for(var l,u,c,f,d=-1,p=a.length,v=o[s++],m=new h;++d<p;)(f=m.get(l=v(u=a[d])))?f.push(u):m.set(l,[u]);return e?(u=e(),c=function(r,n){u.set(r,t(e,n,s))}):(u={},c=function(r,n){u[r]=t(e,n,s)}),m.forEach(c),u}function e(t,r){if(r>=o.length)return t;var n=[],i=a[r++];return t.forEach(function(t,i){n.push({key:t,values:e(i,r)})}),i?n.sort(function(t,e){return i(t.key,e.key)}):n}var r,n,i={},o=[],a=[];return i.map=function(e,r){return t(r,e,0)},i.entries=function(r){return e(t(ca.map,r,0),0)},i.key=function(t){return o.push(t),i},i.sortKeys=function(t){return a[o.length-1]=t,i},i.sortValues=function(t){return r=t,i},i.rollup=function(t){return n=t,i},i},ca.set=function(t){var e=new b;if(t)for(var r=0,n=t.length;n>r;++r)e.add(t[r]);return e},c(b,{has:p,add:function(t){return this._[f(t+="")]=!0,t},remove:v,values:m,size:g,empty:y,forEach:function(t){for(var e in this._)t.call(this,d(e))}}),ca.behavior={},ca.rebind=function(t,e){for(var r,n=1,i=arguments.length;++n<i;)t[r=arguments[n]]=_(t,e,e[r]);return t};var Aa=["webkit","ms","moz","Moz","o","O"];ca.dispatch=function(){for(var t=new k,e=-1,r=arguments.length;++e<r;)t[arguments[e]]=A(t);return t},k.prototype.on=function(t,e){var r=t.indexOf("."),n="";if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t)return arguments.length<2?this[t].on(n):this[t].on(n,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(n,null);return this}},ca.event=null,ca.requote=function(t){return t.replace(Ta,"\\$&")};var Ta=/[\\\^\$\*\+\?\|\.\{\}]/g,Ea={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},Sa=function(t,e){return e.querySelector(t)},La=function(t,e){return e.querySelectorAll(t)},za=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(za=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(Sa=function(t,e){return Sizzle(t,e)[0]||null},La=Sizzle,za=Sizzle.matchesSelector),ca.selection=function(){return ca.select(da.documentElement)};var Ia=ca.selection.prototype=[];Ia.select=function(t){var e,r,n,i,o=[];t=z(t);for(var a=-1,s=this.length;++a<s;){o.push(e=[]),e.parentNode=(n=this[a]).parentNode;for(var l=-1,u=n.length;++l<u;)(i=n[l])?(e.push(r=t.call(i,i.__data__,l,a)),r&&"__data__"in i&&(r.__data__=i.__data__)):e.push(null)}return L(o)},Ia.selectAll=function(t){var e,r,n=[];t=I(t);for(var i=-1,o=this.length;++i<o;)for(var a=this[i],s=-1,l=a.length;++s<l;)(r=a[s])&&(n.push(e=fa(t.call(r,r.__data__,s,i))),e.parentNode=r);return L(n)};var Pa="http://www.w3.org/1999/xhtml",Ca={svg:"http://www.w3.org/2000/svg",xhtml:Pa,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};ca.ns={prefix:Ca,qualify:function(t){var e=t.indexOf(":"),r=t;return e>=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),Ca.hasOwnProperty(r)?{space:Ca[r],local:t}:t}},Ia.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return t=ca.ns.qualify(t),t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(e in t)this.each(P(e,t[e]));return this}return this.each(P(t,e))},Ia.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=D(t)).length,i=-1;if(e=r.classList){for(;++i<n;)if(!e.contains(t[i]))return!1}else for(e=r.getAttribute("class");++i<n;)if(!R(t[i]).test(e))return!1;return!0}for(e in t)this.each(O(e,t[e]));return this}return this.each(O(t,e))},Ia.style=function(t,e,r){var i=arguments.length;if(3>i){if("string"!=typeof t){2>i&&(e="");for(r in t)this.each(j(r,t[r],e));return this}if(2>i){var o=this.node();return n(o).getComputedStyle(o,null).getPropertyValue(t)}r=""}return this.each(j(t,e,r))},Ia.property=function(t,e){if(arguments.length<2){if("string"==typeof t)return this.node()[t];for(e in t)this.each(N(e,t[e]));return this}return this.each(N(t,e))},Ia.text=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}:null==t?function(){this.textContent=""}:function(){this.textContent=t}):this.node().textContent},Ia.html=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}:null==t?function(){this.innerHTML=""}:function(){this.innerHTML=t}):this.node().innerHTML},Ia.append=function(t){return t=B(t),this.select(function(){return this.appendChild(t.apply(this,arguments))})},Ia.insert=function(t,e){return t=B(t),e=z(e),this.select(function(){return this.insertBefore(t.apply(this,arguments),e.apply(this,arguments)||null)})},Ia.remove=function(){return this.each(U)},Ia.data=function(t,e){function r(t,r){var n,i,o,a=t.length,c=r.length,f=Math.min(a,c),d=new Array(c),p=new Array(c),v=new Array(a);if(e){var m,g=new h,y=new Array(a);for(n=-1;++n<a;)(i=t[n])&&(g.has(m=e.call(i,i.__data__,n))?v[n]=i:g.set(m,i),y[n]=m);for(n=-1;++n<c;)(i=g.get(m=e.call(r,o=r[n],n)))?i!==!0&&(d[n]=i,i.__data__=o):p[n]=V(o),g.set(m,!0);for(n=-1;++n<a;)n in y&&g.get(y[n])!==!0&&(v[n]=t[n])}else{for(n=-1;++n<f;)i=t[n],o=r[n],i?(i.__data__=o,d[n]=i):p[n]=V(o);for(;c>n;++n)p[n]=V(r[n]);for(;a>n;++n)v[n]=t[n]}p.update=d,p.parentNode=d.parentNode=v.parentNode=t.parentNode,s.push(p),l.push(d),u.push(v)}var n,i,o=-1,a=this.length;if(!arguments.length){for(t=new Array(a=(n=this[0]).length);++o<a;)(i=n[o])&&(t[o]=i.__data__);return t}var s=X([]),l=L([]),u=L([]);if("function"==typeof t)for(;++o<a;)r(n=this[o],t.call(n,n.parentNode.__data__,o));else for(;++o<a;)r(n=this[o],t);return l.enter=function(){return s},l.exit=function(){return u},l},Ia.datum=function(t){return arguments.length?this.property("__data__",t):this.property("__data__")},Ia.filter=function(t){var e,r,n,i=[];"function"!=typeof t&&(t=q(t));for(var o=0,a=this.length;a>o;o++){i.push(e=[]),e.parentNode=(r=this[o]).parentNode;for(var s=0,l=r.length;l>s;s++)(n=r[s])&&t.call(n,n.__data__,s,o)&&e.push(n)}return L(i)},Ia.order=function(){for(var t=-1,e=this.length;++t<e;)for(var r,n=this[t],i=n.length-1,o=n[i];--i>=0;)(r=n[i])&&(o&&o!==r.nextSibling&&o.parentNode.insertBefore(r,o),o=r);return this},Ia.sort=function(t){t=G.apply(this,arguments);for(var e=-1,r=this.length;++e<r;)this[e].sort(t);return this.order()},Ia.each=function(t){return H(this,function(e,r,n){t.call(e,e.__data__,r,n)})},Ia.call=function(t){var e=fa(arguments);return t.apply(e[0]=this,e),this},Ia.empty=function(){return!this.node()},Ia.node=function(){for(var t=0,e=this.length;e>t;t++)for(var r=this[t],n=0,i=r.length;i>n;n++){var o=r[n];if(o)return o}return null},Ia.size=function(){var t=0;return H(this,function(){++t}),t};var Ra=[];ca.selection.enter=X,ca.selection.enter.prototype=Ra,Ra.append=Ia.append,Ra.empty=Ia.empty,Ra.node=Ia.node,Ra.call=Ia.call,Ra.size=Ia.size,Ra.select=function(t){for(var e,r,n,i,o,a=[],s=-1,l=this.length;++s<l;){n=(i=this[s]).update,a.push(e=[]),e.parentNode=i.parentNode;for(var u=-1,c=i.length;++u<c;)(o=i[u])?(e.push(n[u]=r=t.call(i.parentNode,o.__data__,u,s)),r.__data__=o.__data__):e.push(null)}return L(a)},Ra.insert=function(t,e){return arguments.length<2&&(e=Y(this)),Ia.insert.call(this,t,e)},ca.select=function(t){var r;return"string"==typeof t?(r=[Sa(t,da)],r.parentNode=da.documentElement):(r=[t],r.parentNode=e(t)),L([r])},ca.selectAll=function(t){var e;return"string"==typeof t?(e=fa(La(t,da)),e.parentNode=da.documentElement):(e=fa(t),e.parentNode=null),L([e])},Ia.on=function(t,e,r){var n=arguments.length;if(3>n){if("string"!=typeof t){2>n&&(e=!1);for(r in t)this.each(W(r,t[r],e));return this}if(2>n)return(n=this.node()["__on"+t])&&n._;r=!1}return this.each(W(t,e,r))};var Da=ca.map({mouseenter:"mouseover",mouseleave:"mouseout"});da&&Da.forEach(function(t){"on"+t in da&&Da.remove(t)});var Oa,Fa=0;ca.mouse=function(t){return$(t,E())};var ja=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;ca.touch=function(t,e,r){if(arguments.length<3&&(r=e,e=E().changedTouches),e)for(var n,i=0,o=e.length;o>i;++i)if((n=e[i]).identifier===r)return $(t,n)},ca.behavior.drag=function(){function t(){this.on("mousedown.drag",o).on("touchstart.drag",a)}function e(t,e,n,o,a){return function(){function s(){var t,r,n=e(f,v);n&&(t=n[0]-b[0],r=n[1]-b[1],p|=t|r,b=n,d({type:"drag",x:n[0]+u[0],y:n[1]+u[1],dx:t,dy:r}))}function l(){e(f,v)&&(g.on(o+m,null).on(a+m,null),y(p),d({type:"dragend"}))}var u,c=this,h=ca.event.target.correspondingElement||ca.event.target,f=c.parentNode,d=r.of(c,arguments),p=0,v=t(),m=".drag"+(null==v?"":"-"+v),g=ca.select(n(h)).on(o+m,s).on(a+m,l),y=J(h),b=e(f,v);i?(u=i.apply(c,arguments),u=[u.x-b[0],u.y-b[1]]):u=[0,0],d({type:"dragstart"})}}var r=S(t,"drag","dragstart","dragend"),i=null,o=e(M,ca.mouse,n,"mousemove","mouseup"),a=e(Q,ca.touch,x,"touchmove","touchend");return t.origin=function(e){return arguments.length?(i=e,t):i},ca.rebind(t,r,"on")},ca.touches=function(t,e){return arguments.length<2&&(e=E().touches),e?fa(e).map(function(e){var r=$(t,e);return r.identifier=e.identifier,r}):[]};var Na=1e-6,Ba=Na*Na,Ua=Math.PI,Va=2*Ua,qa=Va-Na,Ga=Ua/2,Ha=Ua/180,Xa=180/Ua,Ya=Math.SQRT2,Wa=2,Za=4;ca.interpolateZoom=function(t,e){var r,n,i=t[0],o=t[1],a=t[2],s=e[0],l=e[1],u=e[2],c=s-i,h=l-o,f=c*c+h*h;if(Ba>f)n=Math.log(u/a)/Ya,r=function(t){return[i+t*c,o+t*h,a*Math.exp(Ya*t*n)]};else{var d=Math.sqrt(f),p=(u*u-a*a+Za*f)/(2*a*Wa*d),v=(u*u-a*a-Za*f)/(2*u*Wa*d),m=Math.log(Math.sqrt(p*p+1)-p),g=Math.log(Math.sqrt(v*v+1)-v);n=(g-m)/Ya,r=function(t){var e=t*n,r=ot(m),s=a/(Wa*d)*(r*at(Ya*e+m)-it(m));return[i+s*c,o+s*h,a*r/ot(Ya*e+m)]}}return r.duration=1e3*n,r},ca.behavior.zoom=function(){function t(t){t.on(I,h).on(Ja+".zoom",d).on("dblclick.zoom",p).on(R,f)}function e(t){return[(t[0]-k.x)/k.k,(t[1]-k.y)/k.k]}function r(t){return[t[0]*k.k+k.x,t[1]*k.k+k.y]}function i(t){k.k=Math.max(E[0],Math.min(E[1],t))}function o(t,e){e=r(e),k.x+=t[0]-e[0],k.y+=t[1]-e[1]}function a(e,r,n,a){e.__chart__={x:k.x,y:k.y,k:k.k},i(Math.pow(2,a)),o(m=r,n),e=ca.select(e),L>0&&(e=e.transition().duration(L)),e.call(t.event)}function s(){_&&_.domain(x.range().map(function(t){return(t-k.x)/k.k}).map(x.invert)),M&&M.domain(w.range().map(function(t){return(t-k.y)/k.k}).map(w.invert))}function l(t){z++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function c(t){--z||(t({type:"zoomend"}),m=null)}function h(){function t(){s=1,o(ca.mouse(i),f),u(a)}function r(){h.on(P,null).on(C,null),d(s),c(a)}var i=this,a=D.of(i,arguments),s=0,h=ca.select(n(i)).on(P,t).on(C,r),f=e(ca.mouse(i)),d=J(i);Gl.call(i),l(a)}function f(){function t(){var t=ca.touches(p);return d=k.k,t.forEach(function(t){t.identifier in m&&(m[t.identifier]=e(t))}),t}function r(){var e=ca.event.target;ca.select(e).on(x,n).on(_,s),w.push(e);for(var r=ca.event.changedTouches,i=0,o=r.length;o>i;++i)m[r[i].identifier]=null;var l=t(),u=Date.now();if(1===l.length){if(500>u-b){var c=l[0];a(p,c,m[c.identifier],Math.floor(Math.log(k.k)/Math.LN2)+1),T()}b=u}else if(l.length>1){var c=l[0],h=l[1],f=c[0]-h[0],d=c[1]-h[1];g=f*f+d*d}}function n(){var t,e,r,n,a=ca.touches(p);Gl.call(p);for(var s=0,l=a.length;l>s;++s,n=null)if(r=a[s],n=m[r.identifier]){if(e)break;t=r,e=n}if(n){var c=(c=r[0]-t[0])*c+(c=r[1]-t[1])*c,h=g&&Math.sqrt(c/g);t=[(t[0]+r[0])/2,(t[1]+r[1])/2],e=[(e[0]+n[0])/2,(e[1]+n[1])/2],i(h*d)}b=null,o(t,e),u(v)}function s(){if(ca.event.touches.length){for(var e=ca.event.changedTouches,r=0,n=e.length;n>r;++r)delete m[e[r].identifier];for(var i in m)return void t()}ca.selectAll(w).on(y,null),M.on(I,h).on(R,f),A(),c(v)}var d,p=this,v=D.of(p,arguments),m={},g=0,y=".zoom-"+ca.event.changedTouches[0].identifier,x="touchmove"+y,_="touchend"+y,w=[],M=ca.select(p),A=J(p);r(),l(v),M.on(I,null).on(R,r)}function d(){var t=D.of(this,arguments);y?clearTimeout(y):(Gl.call(this),v=e(m=g||ca.mouse(this)),l(t)),y=setTimeout(function(){y=null,c(t)},50),T(),i(Math.pow(2,.002*Ka())*k.k),o(m,v),u(t)}function p(){var t=ca.mouse(this),r=Math.log(k.k)/Math.LN2;a(this,t,e(t),ca.event.shiftKey?Math.ceil(r)-1:Math.floor(r)+1)}var v,m,g,y,b,x,_,w,M,k={x:0,y:0,k:1},A=[960,500],E=$a,L=250,z=0,I="mousedown.zoom",P="mousemove.zoom",C="mouseup.zoom",R="touchstart.zoom",D=S(t,"zoomstart","zoom","zoomend");return Ja||(Ja="onwheel"in da?(Ka=function(){return-ca.event.deltaY*(ca.event.deltaMode?120:1)},"wheel"):"onmousewheel"in da?(Ka=function(){return ca.event.wheelDelta},"mousewheel"):(Ka=function(){return-ca.event.detail},"MozMousePixelScroll")),t.event=function(t){t.each(function(){var t=D.of(this,arguments),e=k;Vl?ca.select(this).transition().each("start.zoom",function(){k=this.__chart__||{x:0,y:0,k:1},l(t)}).tween("zoom:zoom",function(){var r=A[0],n=A[1],i=m?m[0]:r/2,o=m?m[1]:n/2,a=ca.interpolateZoom([(i-k.x)/k.k,(o-k.y)/k.k,r/k.k],[(i-e.x)/e.k,(o-e.y)/e.k,r/e.k]);return function(e){var n=a(e),s=r/n[2];this.__chart__=k={x:i-n[0]*s,y:o-n[1]*s,k:s},u(t)}}).each("interrupt.zoom",function(){c(t)}).each("end.zoom",function(){c(t)}):(this.__chart__=k,l(t),u(t),c(t))})},t.translate=function(e){return arguments.length?(k={x:+e[0],y:+e[1],k:k.k},s(),t):[k.x,k.y]},t.scale=function(e){return arguments.length?(k={x:k.x,y:k.y,k:null},i(+e),s(),t):k.k},t.scaleExtent=function(e){return arguments.length?(E=null==e?$a:[+e[0],+e[1]],t):E},t.center=function(e){return arguments.length?(g=e&&[+e[0],+e[1]],t):g},t.size=function(e){return arguments.length?(A=e&&[+e[0],+e[1]],t):A},t.duration=function(e){return arguments.length?(L=+e,t):L},t.x=function(e){return arguments.length?(_=e,x=e.copy(),k={x:0,y:0,k:1},t):_},t.y=function(e){return arguments.length?(M=e,w=e.copy(),k={x:0,y:0,k:1},t):M},ca.rebind(t,D,"on")};var Ka,Ja,$a=[0,1/0];ca.color=lt,lt.prototype.toString=function(){return this.rgb()+""},ca.hsl=ut;var Qa=ut.prototype=new lt;Qa.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new ut(this.h,this.s,this.l/t)},Qa.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new ut(this.h,this.s,t*this.l)},Qa.rgb=function(){return ct(this.h,this.s,this.l)},ca.hcl=ht;var ts=ht.prototype=new lt;ts.brighter=function(t){return new ht(this.h,this.c,Math.min(100,this.l+es*(arguments.length?t:1)))},ts.darker=function(t){return new ht(this.h,this.c,Math.max(0,this.l-es*(arguments.length?t:1)))},ts.rgb=function(){return ft(this.h,this.c,this.l).rgb()},ca.lab=dt;var es=18,rs=.95047,ns=1,is=1.08883,os=dt.prototype=new lt;os.brighter=function(t){return new dt(Math.min(100,this.l+es*(arguments.length?t:1)),this.a,this.b)},os.darker=function(t){return new dt(Math.max(0,this.l-es*(arguments.length?t:1)),this.a,this.b)},os.rgb=function(){return pt(this.l,this.a,this.b)},ca.rgb=bt;var as=bt.prototype=new lt;as.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,r=this.g,n=this.b,i=30;return e||r||n?(e&&i>e&&(e=i),r&&i>r&&(r=i),n&&i>n&&(n=i),new bt(Math.min(255,e/t),Math.min(255,r/t),Math.min(255,n/t))):new bt(i,i,i)},as.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new bt(t*this.r,t*this.g,t*this.b)},as.hsl=function(){return kt(this.r,this.g,this.b)},as.toString=function(){return"#"+wt(this.r)+wt(this.g)+wt(this.b)};var ss=ca.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});ss.forEach(function(t,e){ss.set(t,xt(e))}),ca.functor=St,ca.xhr=Lt(x),ca.dsv=function(t,e){function r(t,r,o){arguments.length<3&&(o=r,r=null);var a=zt(t,e,null==r?n:i(r),o);return a.row=function(t){return arguments.length?a.response(null==(r=t)?n:i(t)):r},a}function n(t){return r.parse(t.responseText)}function i(t){return function(e){return r.parse(e.responseText,t)}}function o(e){return e.map(a).join(t)}function a(t){return s.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}var s=new RegExp('["'+t+"\n]"),l=t.charCodeAt(0);return r.parse=function(t,e){var n;return r.parseRows(t,function(t,r){if(n)return n(t,r-1);var i=new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}");n=e?function(t,r){return e(i(t),r)}:i})},r.parseRows=function(t,e){function r(){if(c>=u)return a;if(i)return i=!1,o;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++<u;)if(34===t.charCodeAt(r)){if(34!==t.charCodeAt(r+1))break;++r}c=r+2;var n=t.charCodeAt(r+1);return 13===n?(i=!0,10===t.charCodeAt(r+2)&&++c):10===n&&(i=!0),t.slice(e+1,r).replace(/""/g,'"')}for(;u>c;){var n=t.charCodeAt(c++),s=1;if(10===n)i=!0;else if(13===n)i=!0,10===t.charCodeAt(c)&&(++c,++s);else if(n!==l)continue;return t.slice(e,c-s)}return t.slice(e)}for(var n,i,o={},a={},s=[],u=t.length,c=0,h=0;(n=r())!==a;){for(var f=[];n!==o&&n!==a;)f.push(n),n=r();e&&null==(f=e(f,h++))||s.push(f)}return s},r.format=function(e){if(Array.isArray(e[0]))return r.formatRows(e);var n=new b,i=[];return e.forEach(function(t){for(var e in t)n.has(e)||i.push(n.add(e))}),[i.map(a).join(t)].concat(e.map(function(e){return i.map(function(t){return a(e[t])}).join(t)})).join("\n")},r.formatRows=function(t){return t.map(o).join("\n")},r},ca.csv=ca.dsv(",","text/csv"),ca.tsv=ca.dsv(" ","text/tab-separated-values");var ls,us,cs,hs,fs=this[w(this,"requestAnimationFrame")]||function(t){setTimeout(t,17)};ca.timer=function(){Ct.apply(this,arguments)},ca.timer.flush=function(){Dt(),Ot()},ca.round=function(t,e){return e?Math.round(t*(e=Math.pow(10,e)))/e:Math.round(t)};var ds=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(jt);ca.formatPrefix=function(t,e){var r=0;return(t=+t)&&(0>t&&(t*=-1),e&&(t=ca.round(t,Ft(t,e))),r=1+Math.floor(1e-12+Math.log(t)/Math.LN10),r=Math.max(-24,Math.min(24,3*Math.floor((r-1)/3)))),ds[8+r/3]};var ps=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,vs=ca.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,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=ca.round(t,Ft(t,e))).toFixed(Math.max(0,Math.min(20,Ft(t*(1+1e-15),e))))}}),ms=ca.time={},gs=Date;Ut.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(){ys.setUTCDate.apply(this._,arguments)},setDay:function(){ys.setUTCDay.apply(this._,arguments)},setFullYear:function(){ys.setUTCFullYear.apply(this._,arguments)},setHours:function(){ys.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ys.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ys.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ys.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ys.setUTCSeconds.apply(this._,arguments)},setTime:function(){ys.setTime.apply(this._,arguments)}};var ys=Date.prototype;ms.year=Vt(function(t){return t=ms.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),ms.years=ms.year.range,ms.years.utc=ms.year.utc.range,ms.day=Vt(function(t){var e=new gs(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),ms.days=ms.day.range,ms.days.utc=ms.day.utc.range,ms.dayOfYear=function(t){var e=ms.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var r=ms[t]=Vt(function(t){return(t=ms.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var r=ms.year(t).getDay();return Math.floor((ms.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});ms[t+"s"]=r.range,ms[t+"s"].utc=r.utc.range,ms[t+"OfYear"]=function(t){var r=ms.year(t).getDay();return Math.floor((ms.dayOfYear(t)+(r+e)%7)/7)}}),ms.week=ms.sunday,ms.weeks=ms.sunday.range,ms.weeks.utc=ms.sunday.utc.range,ms.weekOfYear=ms.sundayOfYear;var bs={"-":"",_:" ",0:"0"},xs=/^\s*\d+/,_s=/^%/;ca.locale=function(t){return{numberFormat:Nt(t),timeFormat:Gt(t)}};var ws=ca.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"]});ca.format=ws.numberFormat,ca.geo={},he.prototype={s:0,t:0,add:function(t){fe(t,this.t,Ms),fe(Ms.s,this.s,this),this.s?this.t+=Ms.t:this.s=Ms.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var Ms=new he;ca.geo.stream=function(t,e){t&&ks.hasOwnProperty(t.type)?ks[t.type](t,e):de(t,e)};var ks={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)de(r[n].geometry,e)}},As={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)t=r[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){pe(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)pe(r[n],e,0)},Polygon:function(t,e){ve(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)ve(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)de(r[n],e)}};ca.geo.area=function(t){return Ts=0,ca.geo.stream(t,Ss),Ts};var Ts,Es=new he,Ss={sphere:function(){Ts+=4*Ua},point:M,lineStart:M,lineEnd:M,polygonStart:function(){Es.reset(),Ss.lineStart=me},polygonEnd:function(){var t=2*Es;Ts+=0>t?4*Ua+t:t,Ss.lineStart=Ss.lineEnd=Ss.point=M}};ca.geo.bounds=function(){function t(t,e){b.push(x=[c=t,f=t]),h>e&&(h=e),e>d&&(d=e)}function e(e,r){var n=ge([e*Ha,r*Ha]);if(g){var i=be(g,n),o=[i[1],-i[0],0],a=be(o,i);we(a),a=Me(a);var l=e-p,u=l>0?1:-1,v=a[0]*Xa*u,m=wa(l)>180;if(m^(v>u*p&&u*e>v)){var y=a[1]*Xa;y>d&&(d=y)}else if(v=(v+360)%360-180,m^(v>u*p&&u*e>v)){var y=-a[1]*Xa;h>y&&(h=y)}else h>r&&(h=r),r>d&&(d=r);m?p>e?s(c,e)>s(c,f)&&(f=e):s(e,f)>s(c,f)&&(c=e):f>=c?(c>e&&(c=e),e>f&&(f=e)):e>p?s(c,e)>s(c,f)&&(f=e):s(e,f)>s(c,f)&&(c=e)}else t(e,r);g=n,p=e}function r(){_.point=e}function n(){x[0]=c,x[1]=f,_.point=t,g=null}function i(t,r){if(g){var n=t-p;y+=wa(n)>180?n+(n>0?360:-360):n}else v=t,m=r;Ss.point(t,r),e(t,r)}function o(){Ss.lineStart()}function a(){i(v,m),Ss.lineEnd(),wa(y)>Na&&(c=-(f=180)),x[0]=c,x[1]=f,g=null}function s(t,e){return(e-=t)<0?e+360:e}function l(t,e){return t[0]-e[0]}function u(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}var c,h,f,d,p,v,m,g,y,b,x,_={point:t,lineStart:r,lineEnd:n,polygonStart:function(){_.point=i,_.lineStart=o,_.lineEnd=a,y=0,Ss.polygonStart()},polygonEnd:function(){Ss.polygonEnd(),_.point=t,_.lineStart=r,_.lineEnd=n,0>Es?(c=-(f=180),h=-(d=90)):y>Na?d=90:-Na>y&&(h=-90),x[0]=c,x[1]=f}};return function(t){d=f=-(c=h=1/0),b=[],ca.geo.stream(t,_);var e=b.length;if(e){b.sort(l);for(var r,n=1,i=b[0],o=[i];e>n;++n)r=b[n],u(r[0],i)||u(r[1],i)?(s(i[0],r[1])>s(i[0],i[1])&&(i[1]=r[1]),s(r[0],i[1])>s(i[0],i[1])&&(i[0]=r[0])):o.push(i=r);for(var a,r,p=-(1/0),e=o.length-1,n=0,i=o[e];e>=n;i=r,++n)r=o[n],(a=s(i[1],r[0]))>p&&(p=a,c=r[0],f=i[1])}return b=x=null,c===1/0||h===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,h],[f,d]]}}(),ca.geo.centroid=function(t){Ls=zs=Is=Ps=Cs=Rs=Ds=Os=Fs=js=Ns=0,ca.geo.stream(t,Bs);var e=Fs,r=js,n=Ns,i=e*e+r*r+n*n;return Ba>i&&(e=Rs,r=Ds,n=Os,Na>zs&&(e=Is,r=Ps,n=Cs),i=e*e+r*r+n*n,Ba>i)?[NaN,NaN]:[Math.atan2(r,e)*Xa,nt(n/Math.sqrt(i))*Xa]};var Ls,zs,Is,Ps,Cs,Rs,Ds,Os,Fs,js,Ns,Bs={sphere:M,point:Ae,lineStart:Ee,lineEnd:Se,polygonStart:function(){Bs.lineStart=Le},polygonEnd:function(){Bs.lineStart=Ee}},Us=De(Ie,Ne,Ue,[-Ua,-Ua/2]),Vs=1e9;ca.geo.clipExtent=function(){var t,e,r,n,i,o,a={stream:function(t){return i&&(i.valid=!1),i=o(t),i.valid=!0,i},extent:function(s){return arguments.length?(o=He(t=+s[0][0],e=+s[0][1],r=+s[1][0],n=+s[1][1]),i&&(i.valid=!1,i=null),a):[[t,e],[r,n]]}};return a.extent([[0,0],[960,500]])},(ca.geo.conicEqualArea=function(){return Xe(Ye)}).raw=Ye,ca.geo.albers=function(){return ca.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},ca.geo.albersUsa=function(){function t(t){var o=t[0],a=t[1];return e=null,r(o,a),e||(n(o,a),e)||i(o,a),e}var e,r,n,i,o=ca.geo.albers(),a=ca.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=ca.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,r){e=[t,r]}};return t.invert=function(t){var e=o.scale(),r=o.translate(),n=(t[0]-r[0])/e,i=(t[1]-r[1])/e;return(i>=.12&&.234>i&&n>=-.425&&-.214>n?a:i>=.166&&.234>i&&n>=-.214&&-.115>n?s:o).invert(t)},t.stream=function(t){var e=o.stream(t),r=a.stream(t),n=s.stream(t);return{point:function(t,i){e.point(t,i),r.point(t,i),n.point(t,i)},sphere:function(){e.sphere(),r.sphere(),n.sphere()},lineStart:function(){e.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){e.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){e.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){e.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},t.precision=function(e){return arguments.length?(o.precision(e),a.precision(e),s.precision(e),t):o.precision()},t.scale=function(e){return arguments.length?(o.scale(e),a.scale(.35*e),s.scale(e),t.translate(o.translate())):o.scale()},t.translate=function(e){if(!arguments.length)return o.translate();var u=o.scale(),c=+e[0],h=+e[1];return r=o.translate(e).clipExtent([[c-.455*u,h-.238*u],[c+.455*u,h+.238*u]]).stream(l).point,n=a.translate([c-.307*u,h+.201*u]).clipExtent([[c-.425*u+Na,h+.12*u+Na],[c-.214*u-Na,h+.234*u-Na]]).stream(l).point,i=s.translate([c-.205*u,h+.212*u]).clipExtent([[c-.214*u+Na,h+.166*u+Na],[c-.115*u-Na,h+.234*u-Na]]).stream(l).point,t},t.scale(1070)};var qs,Gs,Hs,Xs,Ys,Ws,Zs={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Gs=0,Zs.lineStart=We},polygonEnd:function(){Zs.lineStart=Zs.lineEnd=Zs.point=M,qs+=wa(Gs/2)}},Ks={point:Ze,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Js={point:$e,lineStart:Qe,lineEnd:tr,polygonStart:function(){Js.lineStart=er},polygonEnd:function(){Js.point=$e,Js.lineStart=Qe,Js.lineEnd=tr}};ca.geo.path=function(){function t(t){return t&&("function"==typeof s&&o.pointRadius(+s.apply(this,arguments)),a&&a.valid||(a=i(o)),ca.geo.stream(t,a)),o.result()}function e(){return a=null,t}var r,n,i,o,a,s=4.5;return t.area=function(t){return qs=0,ca.geo.stream(t,i(Zs)),qs},t.centroid=function(t){return Is=Ps=Cs=Rs=Ds=Os=Fs=js=Ns=0,ca.geo.stream(t,i(Js)),Ns?[Fs/Ns,js/Ns]:Os?[Rs/Os,Ds/Os]:Cs?[Is/Cs,Ps/Cs]:[NaN,NaN]},t.bounds=function(t){return Ys=Ws=-(Hs=Xs=1/0),ca.geo.stream(t,i(Ks)),[[Hs,Xs],[Ys,Ws]]},t.projection=function(t){return arguments.length?(i=(r=t)?t.stream||ir(t):x,e()):r},t.context=function(t){return arguments.length?(o=null==(n=t)?new Ke:new rr(t),"function"!=typeof s&&o.pointRadius(s),e()):n},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(o.pointRadius(+e),+e),t):s},t.projection(ca.geo.albersUsa()).context(null)},ca.geo.transform=function(t){return{stream:function(e){var r=new or(e);for(var n in t)r[n]=t[n];return r}}},or.prototype={point:function(t,e){this.stream.point(t,e)},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()}},ca.geo.projection=sr,ca.geo.projectionMutator=lr,(ca.geo.equirectangular=function(){return sr(cr)}).raw=cr.invert=cr,ca.geo.rotation=function(t){function e(e){return e=t(e[0]*Ha,e[1]*Ha),e[0]*=Xa,e[1]*=Xa,e}return t=fr(t[0]%360*Ha,t[1]*Ha,t.length>2?t[2]*Ha:0),e.invert=function(e){return e=t.invert(e[0]*Ha,e[1]*Ha),e[0]*=Xa,e[1]*=Xa,e},e},hr.invert=cr,ca.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=fr(-t[0]*Ha,-t[1]*Ha,0).invert,i=[];return r(null,null,1,{point:function(t,r){i.push(t=e(t,r)),t[0]*=Xa,t[1]*=Xa}}),{type:"Polygon",coordinates:[i]}}var e,r,n=[0,0],i=6;return t.origin=function(e){return arguments.length?(n=e,t):n},t.angle=function(n){return arguments.length?(r=mr((e=+n)*Ha,i*Ha),t):e},t.precision=function(n){return arguments.length?(r=mr(e*Ha,(i=+n)*Ha),t):i},t.angle(90)},ca.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Ha,i=t[1]*Ha,o=e[1]*Ha,a=Math.sin(n),s=Math.cos(n),l=Math.sin(i),u=Math.cos(i),c=Math.sin(o),h=Math.cos(o);return Math.atan2(Math.sqrt((r=h*a)*r+(r=u*c-l*h*s)*r),l*c+u*h*s)},ca.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return ca.range(Math.ceil(o/m)*m,i,m).map(f).concat(ca.range(Math.ceil(u/g)*g,l,g).map(d)).concat(ca.range(Math.ceil(n/p)*p,r,p).filter(function(t){return wa(t%m)>Na}).map(c)).concat(ca.range(Math.ceil(s/v)*v,a,v).filter(function(t){return wa(t%g)>Na}).map(h))}var r,n,i,o,a,s,l,u,c,h,f,d,p=10,v=p,m=90,g=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[f(o).concat(d(l).slice(1),f(i).reverse().slice(1),d(u).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(o=+e[0][0],i=+e[1][0],u=+e[0][1],l=+e[1][1],o>i&&(e=o,o=i,i=e),u>l&&(e=u,u=l,l=e),t.precision(y)):[[o,u],[i,l]]},t.minorExtent=function(e){return arguments.length?(n=+e[0][0],r=+e[1][0],s=+e[0][1],a=+e[1][1],n>r&&(e=n,n=r,r=e),s>a&&(e=s,s=a,a=e),t.precision(y)):[[n,s],[r,a]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(m=+e[0],g=+e[1],t):[m,g]},t.minorStep=function(e){return arguments.length?(p=+e[0],v=+e[1],t):[p,v]},t.precision=function(e){return arguments.length?(y=+e,c=yr(s,a,90),h=br(n,r,y),f=yr(u,l,90),d=br(o,i,y),t):y},t.majorExtent([[-180,-90+Na],[180,90-Na]]).minorExtent([[-180,-80-Na],[180,80+Na]])},ca.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||i.apply(this,arguments)]}}var e,r,n=xr,i=_r;return t.distance=function(){return ca.geo.distance(e||n.apply(this,arguments),r||i.apply(this,arguments))},t.source=function(r){return arguments.length?(n=r,e="function"==typeof r?null:r,t):n},t.target=function(e){return arguments.length?(i=e,r="function"==typeof e?null:e,t):i},t.precision=function(){return arguments.length?t:0},t},ca.geo.interpolate=function(t,e){return wr(t[0]*Ha,t[1]*Ha,e[0]*Ha,e[1]*Ha)},ca.geo.length=function(t){return$s=0,ca.geo.stream(t,Qs),$s};var$s,Qs={sphere:M,point:M,lineStart:Mr,lineEnd:M,polygonStart:M,polygonEnd:M},tl=kr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ca.geo.azimuthalEqualArea=function(){return sr(tl)}).raw=tl;var el=kr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(ca.geo.azimuthalEquidistant=function(){return sr(el)}).raw=el,(ca.geo.conicConformal=function(){return Xe(Ar)}).raw=Ar,(ca.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var rl=kr(function(t){return 1/t},Math.atan);(ca.geo.gnomonic=function(){return sr(rl)}).raw=rl,Er.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Ga]},(ca.geo.mercator=function(){return Sr(Er)}).raw=Er;var nl=kr(function(){return 1},Math.asin);(ca.geo.orthographic=function(){return sr(nl)}).raw=nl;var il=kr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ca.geo.stereographic=function(){return sr(il)}).raw=il,Lr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Ga]},(ca.geo.transverseMercator=function(){var t=Sr(Lr),e=t.center,r=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?r([t[0],t[1],t.length>2?t[2]+90:90]):(t=r(),[t[0],t[1],t[2]-90])},r([0,0,90])}).raw=Lr,ca.geom={},ca.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=St(r),o=St(n),a=t.length,s=[],l=[];for(e=0;a>e;e++)s.push([+i.call(this,t[e],e),+o.call(this,t[e],e),e]);for(s.sort(Cr),e=0;a>e;e++)l.push([s[e][0],-s[e][1]]);var u=Pr(s),c=Pr(l),h=c[0]===u[0],f=c[c.length-1]===u[u.length-1],d=[];for(e=u.length-1;e>=0;--e)d.push(t[s[u[e]][2]]);for(e=+h;e<c.length-f;++e)d.push(t[s[c[e]][2]]);return d}var r=zr,n=Ir;return arguments.length?e(t):(e.x=function(t){return arguments.length?(r=t,e):r},e.y=function(t){return arguments.length?(n=t,e):n},e)},ca.geom.polygon=function(t){return Ea(t,ol),t};var ol=ca.geom.polygon.prototype=[];ol.area=function(){for(var t,e=-1,r=this.length,n=this[r-1],i=0;++e<r;)t=n,n=this[e],i+=t[1]*n[0]-t[0]*n[1];return.5*i},ol.centroid=function(t){var e,r,n=-1,i=this.length,o=0,a=0,s=this[i-1];for(arguments.length||(t=-1/(6*this.area()));++n<i;)e=s,s=this[n],r=e[0]*s[1]-s[0]*e[1],o+=(e[0]+s[0])*r,a+=(e[1]+s[1])*r;return[o*t,a*t]},ol.clip=function(t){for(var e,r,n,i,o,a,s=Or(t),l=-1,u=this.length-Or(this),c=this[u-1];++l<u;){for(e=t.slice(),t.length=0,i=this[l],o=e[(n=e.length-s)-1],r=-1;++r<n;)a=e[r],Rr(a,c,i)?(Rr(o,c,i)||t.push(Dr(o,a,c,i)),t.push(a)):Rr(o,c,i)&&t.push(Dr(o,a,c,i)),o=a;s&&t.push(t[0]),c=i}return t};var al,sl,ll,ul,cl,hl=[],fl=[];Gr.prototype.prepare=function(){for(var t,e=this.edges,r=e.length;r--;)t=e[r].edge,t.b&&t.a||e.splice(r,1);return e.sort(Xr),e.length},rn.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}},nn.prototype={insert:function(t,e){var r,n,i;if(t){if(e.P=t,e.N=t.N,t.N&&(t.N.P=e),t.N=e,t.R){for(t=t.R;t.L;)t=t.L;t.L=e}else t.R=e;r=t}else this._?(t=ln(this._),e.P=null,e.N=t,t.P=t.L=e,r=t):(e.P=e.N=null,this._=e,r=null);for(e.L=e.R=null,e.U=r,e.C=!0,t=e;r&&r.C;)n=r.U,r===n.L?(i=n.R,i&&i.C?(r.C=i.C=!1,n.C=!0,t=n):(t===r.R&&(an(this,r),t=r,r=t.U),r.C=!1,n.C=!0,sn(this,n))):(i=n.L,i&&i.C?(r.C=i.C=!1,n.C=!0,t=n):(t===r.L&&(sn(this,r),t=r,r=t.U),r.C=!1,n.C=!0,an(this,n))),r=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 e,r,n,i=t.U,o=t.L,a=t.R;if(r=o?a?ln(a):o:a,i?i.L===t?i.L=r:i.R=r:this._=r,o&&a?(n=r.C,r.C=t.C,r.L=o,o.U=r,r!==a?(i=r.U,r.U=t.U,t=r.R,i.L=t,r.R=a,a.U=r):(r.U=i,i=r,t=r.R)):(n=t.C,t=r),t&&(t.U=i),!n){if(t&&t.C)return void(t.C=!1);do{if(t===this._)break;if(t===i.L){if(e=i.R,e.C&&(e.C=!1,i.C=!0,an(this,i),e=i.R),e.L&&e.L.C||e.R&&e.R.C){e.R&&e.R.C||(e.L.C=!1,e.C=!0,sn(this,e),e=i.R),e.C=i.C,i.C=e.R.C=!1,an(this,i),t=this._;break}}else if(e=i.L,e.C&&(e.C=!1,i.C=!0,sn(this,i),e=i.L),e.L&&e.L.C||e.R&&e.R.C){e.L&&e.L.C||(e.R.C=!1,e.C=!0,an(this,e),e=i.L),e.C=i.C,i.C=e.L.C=!1,sn(this,i),t=this._;break}e.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}},ca.geom.voronoi=function(t){function e(t){var e=new Array(t.length),n=s[0][0],i=s[0][1],o=s[1][0],a=s[1][1];return un(r(t),s).cells.forEach(function(r,s){var l=r.edges,u=r.site,c=e[s]=l.length?l.map(function(t){var e=t.start();return[e.x,e.y]}):u.x>=n&&u.x<=o&&u.y>=i&&u.y<=a?[[n,a],[o,a],[o,i],[n,i]]:[];c.point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(o(t,e)/Na)*Na,y:Math.round(a(t,e)/Na)*Na,i:e}})}var n=zr,i=Ir,o=n,a=i,s=dl;return t?e(t):(e.links=function(t){return un(r(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return un(r(t)).cells.forEach(function(r,n){for(var i,o,a=r.site,s=r.edges.sort(Xr),l=-1,u=s.length,c=s[u-1].edge,h=c.l===a?c.r:c.l;++l<u;)i=c,o=h,c=s[l].edge,h=c.l===a?c.r:c.l,n<o.i&&n<h.i&&hn(a,o,h)<0&&e.push([t[n],t[o.i],t[h.i]])}),e},e.x=function(t){return arguments.length?(o=St(n=t),e):n},e.y=function(t){return arguments.length?(a=St(i=t),e):i},e.clipExtent=function(t){return arguments.length?(s=null==t?dl:t,e):s===dl?null:s},e.size=function(t){return arguments.length?e.clipExtent(t&&[[0,0],t]):s===dl?null:s&&s[1]},e)};var dl=[[-1e6,-1e6],[1e6,1e6]];ca.geom.delaunay=function(t){return ca.geom.voronoi().triangles(t)},ca.geom.quadtree=function(t,e,r,n,i){function o(t){function o(t,e,r,n,i,o,a,s){if(!isNaN(r)&&!isNaN(n))if(t.leaf){var l=t.x,c=t.y;if(null!=l)if(wa(l-r)+wa(c-n)<.01)u(t,e,r,n,i,o,a,s);else{var h=t.point;t.x=t.y=t.point=null,u(t,h,l,c,i,o,a,s),u(t,e,r,n,i,o,a,s)}else t.x=r,t.y=n,t.point=e}else u(t,e,r,n,i,o,a,s)}function u(t,e,r,n,i,a,s,l){var u=.5*(i+s),c=.5*(a+l),h=r>=u,f=n>=c,d=f<<1|h;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]=pn()),h?i=u:s=u,f?a=c:l=c,o(t,e,r,n,i,a,s,l)}var c,h,f,d,p,v,m,g,y,b=St(s),x=St(l);if(null!=e)v=e,m=r,g=n,y=i;else if(g=y=-(v=m=1/0),h=[],f=[],p=t.length,a)for(d=0;p>d;++d)c=t[d],c.x<v&&(v=c.x),c.y<m&&(m=c.y),c.x>g&&(g=c.x),c.y>y&&(y=c.y),h.push(c.x),f.push(c.y);else for(d=0;p>d;++d){var _=+b(c=t[d],d),w=+x(c,d);v>_&&(v=_),m>w&&(m=w),_>g&&(g=_),w>y&&(y=w),h.push(_),f.push(w)}var M=g-v,k=y-m;M>k?y=m+M:g=v+k;var A=pn();if(A.add=function(t){o(A,t,+b(t,++d),+x(t,d),v,m,g,y)},A.visit=function(t){vn(t,A,v,m,g,y)},A.find=function(t){return mn(A,t[0],t[1],v,m,g,y)},d=-1,null==e){for(;++d<p;)o(A,t[d],h[d],f[d],v,m,g,y);--d}else t.forEach(A.add);return h=f=t=c=null,A}var a,s=zr,l=Ir;return(a=arguments.length)?(s=fn,l=dn,3===a&&(i=r,n=e,r=e=0),o(t)):(o.x=function(t){return arguments.length?(s=t,o):s},o.y=function(t){return arguments.length?(l=t,o):l},o.extent=function(t){return arguments.length?(null==t?e=r=n=i=null:(e=+t[0][0],r=+t[0][1],n=+t[1][0],i=+t[1][1]),o):null==e?null:[[e,r],[n,i]]},o.size=function(t){return arguments.length?(null==t?e=r=n=i=null:(e=r=0,n=+t[0],i=+t[1]),o):null==e?null:[n-e,i-r]},o)},ca.interpolateRgb=gn,ca.interpolateObject=yn,ca.interpolateNumber=bn,ca.interpolateString=xn;var pl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vl=new RegExp(pl.source,"g");ca.interpolate=_n,ca.interpolators=[function(t,e){var r=typeof e;return("string"===r?ss.has(e.toLowerCase())||/^(#|rgb|hsl\()/i.test(e)?gn:xn:e instanceof lt?gn:Array.isArray(e)?wn:"object"===r&&isNaN(e)?yn:bn)(t,e)}],ca.interpolateArray=wn;var ml=function(){return x},gl=ca.map({linear:ml,poly:Ln,quad:function(){return Tn},cubic:function(){return En},sin:function(){return zn},exp:function(){return In},circle:function(){return Pn},elastic:Cn,back:Rn,bounce:function(){return Dn}}),yl=ca.map({"in":x,out:kn,"in-out":An,"out-in":function(t){return An(kn(t))}});ca.ease=function(t){var e=t.indexOf("-"),r=e>=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=gl.get(r)||ml,n=yl.get(n)||x,Mn(n(r.apply(null,ha.call(arguments,1))))},ca.interpolateHcl=On,ca.interpolateHsl=Fn,ca.interpolateLab=jn,ca.interpolateRound=Nn,ca.transform=function(t){var e=da.createElementNS(ca.ns.prefix.svg,"g");return(ca.transform=function(t){if(null!=t){e.setAttribute("transform",t);var r=e.transform.baseVal.consolidate()}return new Bn(r?r.matrix:bl)})(t)},Bn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var bl={a:1,b:0,c:0,d:1,e:0,f:0};ca.interpolateTransform=Zn,ca.layout={},ca.layout.bundle=function(){return function(t){for(var e=[],r=-1,n=t.length;++r<n;)e.push(n(t[r]));return e}},ca.layout.chord=function(){function t(){var t,u,h,f,d,p={},v=[],m=ca.range(o),g=[];for(r=[],n=[],t=0,f=-1;++f<o;){for(u=0,d=-1;++d<o;)u+=i[f][d];v.push(u),g.push(ca.range(o)),t+=u}for(a&&m.sort(function(t,e){return a(v[t],v[e])}),s&&g.forEach(function(t,e){t.sort(function(t,r){return s(i[e][t],i[e][r])})}),t=(Va-c*o)/t,u=0,f=-1;++f<o;){for(h=u,d=-1;++d<o;){var y=m[f],b=g[y][d],x=i[y][b],_=u,w=u+=x*t;p[y+"-"+b]={index:y,subindex:b,startAngle:_,endAngle:w,value:x}}n[y]={index:y,startAngle:h,endAngle:u,value:v[y]},u+=c}for(f=-1;++f<o;)for(d=f-1;++d<o;){var M=p[f+"-"+d],k=p[d+"-"+f];(M.value||k.value)&&r.push(M.value<k.value?{source:k,target:M}:{source:M,target:k})}l&&e()}function e(){r.sort(function(t,e){return l((t.source.value+t.target.value)/2,(e.source.value+e.target.value)/2)})}var r,n,i,o,a,s,l,u={},c=0;return u.matrix=function(t){return arguments.length?(o=(i=t)&&i.length,r=n=null,u):i},u.padding=function(t){return arguments.length?(c=t,r=n=null,u):c},u.sortGroups=function(t){return arguments.length?(a=t,r=n=null,u):a},u.sortSubgroups=function(t){return arguments.length?(s=t,r=null,u):s},u.sortChords=function(t){return arguments.length?(l=t,r&&e(),u):l},u.chords=function(){return r||t(),r},u.groups=function(){return n||t(),n},u},ca.layout.force=function(){function t(t){return function(e,r,n,i){if(e.point!==t){var o=e.cx-t.x,a=e.cy-t.y,s=i-r,l=o*o+a*a;if(l>s*s/g){if(v>l){var u=e.charge/l;t.px-=o*u,t.py-=a*u}return!0}if(e.point&&l&&v>l){var u=e.pointCharge/l;t.px-=o*u,t.py-=a*u}}return!e.charge}}function e(t){t.px=ca.event.x,t.py=ca.event.y,l.resume()}var r,n,i,o,a,s,l={},u=ca.dispatch("start","tick","end"),c=[1,1],h=.9,f=xl,d=_l,p=-30,v=wl,m=.1,g=.64,y=[],b=[];return l.tick=function(){if((i*=.99)<.005)return r=null,u.end({type:"end",alpha:i=0}),!0;var e,n,l,f,d,v,g,x,_,w=y.length,M=b.length;for(n=0;M>n;++n)l=b[n],f=l.source,d=l.target,x=d.x-f.x,_=d.y-f.y,(v=x*x+_*_)&&(v=i*a[n]*((v=Math.sqrt(v))-o[n])/v,x*=v,_*=v,d.x-=x*(g=f.weight+d.weight?f.weight/(f.weight+d.weight):.5),d.y-=_*g,f.x+=x*(g=1-g),f.y+=_*g);if((g=i*m)&&(x=c[0]/2,_=c[1]/2,n=-1,g))for(;++n<w;)l=y[n],l.x+=(x-l.x)*g,l.y+=(_-l.y)*g;if(p)for(oi(e=ca.geom.quadtree(y),i,s),n=-1;++n<w;)(l=y[n]).fixed||e.visit(t(l));for(n=-1;++n<w;)l=y[n],l.fixed?(l.x=l.px,l.y=l.py):(l.x-=(l.px-(l.px=l.x))*h,l.y-=(l.py-(l.py=l.y))*h);u.tick({type:"tick",alpha:i})},l.nodes=function(t){return arguments.length?(y=t,l):y},l.links=function(t){return arguments.length?(b=t,l):b},l.size=function(t){return arguments.length?(c=t,l):c},l.linkDistance=function(t){return arguments.length?(f="function"==typeof t?t:+t,l):f},l.distance=l.linkDistance,l.linkStrength=function(t){return arguments.length?(d="function"==typeof t?t:+t,l):d},l.friction=function(t){return arguments.length?(h=+t,l):h},l.charge=function(t){return arguments.length?(p="function"==typeof t?t:+t,l):p},l.chargeDistance=function(t){return arguments.length?(v=t*t,l):Math.sqrt(v)},l.gravity=function(t){return arguments.length?(m=+t,l):m},l.theta=function(t){return arguments.length?(g=t*t,l):Math.sqrt(g)},l.alpha=function(t){return arguments.length?(t=+t,i?t>0?i=t:(r.c=null,r.t=NaN,r=null,u.end({type:"end",alpha:i=0})):t>0&&(u.start({type:"start",alpha:i=t}),r=Ct(l.tick)),l):i},l.start=function(){function t(t,n){if(!r){for(r=new Array(i),l=0;i>l;++l)r[l]=[];for(l=0;u>l;++l){var o=b[l];r[o.source.index].push(o.target),r[o.target.index].push(o.source)}}for(var a,s=r[e],l=-1,c=s.length;++l<c;)if(!isNaN(a=s[l][t]))return a;return Math.random()*n}var e,r,n,i=y.length,u=b.length,h=c[0],v=c[1];for(e=0;i>e;++e)(n=y[e]).index=e,n.weight=0;for(e=0;u>e;++e)n=b[e],"number"==typeof n.source&&(n.source=y[n.source]),"number"==typeof n.target&&(n.target=y[n.target]),++n.source.weight,++n.target.weight;for(e=0;i>e;++e)n=y[e],isNaN(n.x)&&(n.x=t("x",h)),isNaN(n.y)&&(n.y=t("y",v)),isNaN(n.px)&&(n.px=n.x),isNaN(n.py)&&(n.py=n.y);if(o=[],"function"==typeof f)for(e=0;u>e;++e)o[e]=+f.call(this,b[e],e);else for(e=0;u>e;++e)o[e]=f;if(a=[],"function"==typeof d)for(e=0;u>e;++e)a[e]=+d.call(this,b[e],e);else for(e=0;u>e;++e)a[e]=d;if(s=[],"function"==typeof p)for(e=0;i>e;++e)s[e]=+p.call(this,y[e],e);else for(e=0;i>e;++e)s[e]=p;return l.resume()},l.resume=function(){return l.alpha(.1)},l.stop=function(){return l.alpha(0)},l.drag=function(){return n||(n=ca.behavior.drag().origin(x).on("dragstart.force",ei).on("drag.force",e).on("dragend.force",ri)),arguments.length?void this.on("mouseover.force",ni).on("mouseout.force",ii).call(n):n},ca.rebind(l,u,"on")};var xl=20,_l=1,wl=1/0;ca.layout.hierarchy=function(){function t(i){var o,a=[i],s=[];for(i.depth=0;null!=(o=a.pop());)if(s.push(o),(u=r.call(t,o,o.depth))&&(l=u.length)){for(var l,u,c;--l>=0;)a.push(c=u[l]),c.parent=o,c.depth=o.depth+1;n&&(o.value=0),o.children=u}else n&&(o.value=+n.call(t,o,o.depth)||0),delete o.children;return li(i,function(t){var r,i;e&&(r=t.children)&&r.sort(e),n&&(i=t.parent)&&(i.value+=t.value)}),s}var e=hi,r=ui,n=ci;return t.sort=function(r){return arguments.length?(e=r,t):e},t.children=function(e){return arguments.length?(r=e,t):r},t.value=function(e){return arguments.length?(n=e,t):n},t.revalue=function(e){return n&&(si(e,function(t){t.children&&(t.value=0)}),li(e,function(e){var r;e.children||(e.value=+n.call(t,e,e.depth)||0), (r=e.parent)&&(r.value+=e.value)})),e},t},ca.layout.partition=function(){function t(e,r,n,i){var o=e.children;if(e.x=r,e.y=e.depth*i,e.dx=n,e.dy=i,o&&(a=o.length)){var a,s,l,u=-1;for(n=e.value?n/e.value:0;++u<a;)t(s=o[u],r,l=s.value*n,i),r+=l}}function e(t){var r=t.children,n=0;if(r&&(i=r.length))for(var i,o=-1;++o<i;)n=Math.max(n,e(r[o]));return 1+n}function r(r,o){var a=n.call(this,r,o);return t(a[0],0,i[0],i[1]/e(a[0])),a}var n=ca.layout.hierarchy(),i=[1,1];return r.size=function(t){return arguments.length?(i=t,r):i},ai(r,n)},ca.layout.pie=function(){function t(a){var s,l=a.length,u=a.map(function(r,n){return+e.call(t,r,n)}),c=+("function"==typeof n?n.apply(this,arguments):n),h=("function"==typeof i?i.apply(this,arguments):i)-c,f=Math.min(Math.abs(h)/l,+("function"==typeof o?o.apply(this,arguments):o)),d=f*(0>h?-1:1),p=ca.sum(u),v=p?(h-l*d)/p:0,m=ca.range(l),g=[];return null!=r&&m.sort(r===Ml?function(t,e){return u[e]-u[t]}:function(t,e){return r(a[t],a[e])}),m.forEach(function(t){g[t]={data:a[t],value:s=u[t],startAngle:c,endAngle:c+=s*v+d,padAngle:f}}),g}var e=Number,r=Ml,n=0,i=Va,o=0;return t.value=function(r){return arguments.length?(e=r,t):e},t.sort=function(e){return arguments.length?(r=e,t):r},t.startAngle=function(e){return arguments.length?(n=e,t):n},t.endAngle=function(e){return arguments.length?(i=e,t):i},t.padAngle=function(e){return arguments.length?(o=e,t):o},t};var Ml={};ca.layout.stack=function(){function t(s,l){if(!(f=s.length))return s;var u=s.map(function(r,n){return e.call(t,r,n)}),c=u.map(function(e){return e.map(function(e,r){return[o.call(t,e,r),a.call(t,e,r)]})}),h=r.call(t,c,l);u=ca.permute(u,h),c=ca.permute(c,h);var f,d,p,v,m=n.call(t,c,l),g=u[0].length;for(p=0;g>p;++p)for(i.call(t,u[0][p],v=m[p],c[0][p][1]),d=1;f>d;++d)i.call(t,u[d][p],v+=c[d-1][p][1],c[d][p][1]);return s}var e=x,r=mi,n=gi,i=vi,o=di,a=pi;return t.values=function(r){return arguments.length?(e=r,t):e},t.order=function(e){return arguments.length?(r="function"==typeof e?e:kl.get(e)||mi,t):r},t.offset=function(e){return arguments.length?(n="function"==typeof e?e:Al.get(e)||gi,t):n},t.x=function(e){return arguments.length?(o=e,t):o},t.y=function(e){return arguments.length?(a=e,t):a},t.out=function(e){return arguments.length?(i=e,t):i},t};var kl=ca.map({"inside-out":function(t){var e,r,n=t.length,i=t.map(yi),o=t.map(bi),a=ca.range(n).sort(function(t,e){return i[t]-i[e]}),s=0,l=0,u=[],c=[];for(e=0;n>e;++e)r=a[e],l>s?(s+=o[r],u.push(r)):(l+=o[r],c.push(r));return c.reverse().concat(u)},reverse:function(t){return ca.range(t.length).reverse()},"default":mi}),Al=ca.map({silhouette:function(t){var e,r,n,i=t.length,o=t[0].length,a=[],s=0,l=[];for(r=0;o>r;++r){for(e=0,n=0;i>e;e++)n+=t[e][r][1];n>s&&(s=n),a.push(n)}for(r=0;o>r;++r)l[r]=(s-a[r])/2;return l},wiggle:function(t){var e,r,n,i,o,a,s,l,u,c=t.length,h=t[0],f=h.length,d=[];for(d[0]=l=u=0,r=1;f>r;++r){for(e=0,i=0;c>e;++e)i+=t[e][r][1];for(e=0,o=0,s=h[r][0]-h[r-1][0];c>e;++e){for(n=0,a=(t[e][r][1]-t[e][r-1][1])/(2*s);e>n;++n)a+=(t[n][r][1]-t[n][r-1][1])/s;o+=a*t[e][r][1]}d[r]=l-=i?o/i*s:0,u>l&&(u=l)}for(r=0;f>r;++r)d[r]-=u;return d},expand:function(t){var e,r,n,i=t.length,o=t[0].length,a=1/i,s=[];for(r=0;o>r;++r){for(e=0,n=0;i>e;e++)n+=t[e][r][1];if(n)for(e=0;i>e;e++)t[e][r][1]/=n;else for(e=0;i>e;e++)t[e][r][1]=a}for(r=0;o>r;++r)s[r]=0;return s},zero:gi});ca.layout.histogram=function(){function t(t,o){for(var a,s,l=[],u=t.map(r,this),c=n.call(this,u,o),h=i.call(this,c,u,o),o=-1,f=u.length,d=h.length-1,p=e?1:1/f;++o<d;)a=l[o]=[],a.dx=h[o+1]-(a.x=h[o]),a.y=0;if(d>0)for(o=-1;++o<f;)s=u[o],s>=c[0]&&s<=c[1]&&(a=l[ca.bisect(h,s,1,d)-1],a.y+=p,a.push(t[o]));return l}var e=!0,r=Number,n=Mi,i=_i;return t.value=function(e){return arguments.length?(r=e,t):r},t.range=function(e){return arguments.length?(n=St(e),t):n},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:St(e),t):i},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},ca.layout.pack=function(){function t(t,o){var a=r.call(this,t,o),s=a[0],l=i[0],u=i[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,li(s,function(t){t.r=+c(t.value)}),li(s,Si),n){var h=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;li(s,function(t){t.r+=h}),li(s,Si),li(s,function(t){t.r-=h})}return Ii(s,l/2,u/2,e?1:1/Math.max(2*s.r/l,2*s.r/u)),a}var e,r=ca.layout.hierarchy().sort(ki),n=0,i=[1,1];return t.size=function(e){return arguments.length?(i=e,t):i},t.radius=function(r){return arguments.length?(e=null==r||"function"==typeof r?r:+r,t):e},t.padding=function(e){return arguments.length?(n=+e,t):n},ai(t,r)},ca.layout.tree=function(){function t(t,i){var c=a.call(this,t,i),h=c[0],f=e(h);if(li(f,r),f.parent.m=-f.z,si(f,n),u)si(h,o);else{var d=h,p=h,v=h;si(h,function(t){t.x<d.x&&(d=t),t.x>p.x&&(p=t),t.depth>v.depth&&(v=t)});var m=s(d,p)/2-d.x,g=l[0]/(p.x+s(p,d)/2+m),y=l[1]/(v.depth||1);si(h,function(t){t.x=(t.x+m)*g,t.y=t.depth*y})}return c}function e(t){for(var e,r={A:null,children:[t]},n=[r];null!=(e=n.pop());)for(var i,o=e.children,a=0,s=o.length;s>a;++a)n.push((o[a]=i={_:o[a],parent:e,children:(i=o[a].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:a}).a=i);return r.children[0]}function r(t){var e=t.children,r=t.parent.children,n=t.i?r[t.i-1]:null;if(e.length){Fi(t);var o=(e[0].z+e[e.length-1].z)/2;n?(t.z=n.z+s(t._,n._),t.m=t.z-o):t.z=o}else n&&(t.z=n.z+s(t._,n._));t.parent.A=i(t,n,t.parent.A||r[0])}function n(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function i(t,e,r){if(e){for(var n,i=t,o=t,a=e,l=i.parent.children[0],u=i.m,c=o.m,h=a.m,f=l.m;a=Di(a),i=Ri(i),a&&i;)l=Ri(l),o=Di(o),o.a=t,n=a.z+h-i.z-u+s(a._,i._),n>0&&(Oi(ji(a,t,r),t,n),u+=n,c+=n),h+=a.m,u+=i.m,f+=l.m,c+=o.m;a&&!Di(o)&&(o.t=a,o.m+=h-c),i&&!Ri(l)&&(l.t=i,l.m+=u-f,r=t)}return r}function o(t){t.x*=l[0],t.y=t.depth*l[1]}var a=ca.layout.hierarchy().sort(null).value(null),s=Ci,l=[1,1],u=null;return t.separation=function(e){return arguments.length?(s=e,t):s},t.size=function(e){return arguments.length?(u=null==(l=e)?o:null,t):u?null:l},t.nodeSize=function(e){return arguments.length?(u=null==(l=e)?null:o,t):u?l:null},ai(t,a)},ca.layout.cluster=function(){function t(t,o){var a,s=e.call(this,t,o),l=s[0],u=0;li(l,function(t){var e=t.children;e&&e.length?(t.x=Bi(e),t.y=Ni(e)):(t.x=a?u+=r(t,a):0,t.y=0,a=t)});var c=Ui(l),h=Vi(l),f=c.x-r(c,h)/2,d=h.x+r(h,c)/2;return li(l,i?function(t){t.x=(t.x-l.x)*n[0],t.y=(l.y-t.y)*n[1]}:function(t){t.x=(t.x-f)/(d-f)*n[0],t.y=(1-(l.y?t.y/l.y:1))*n[1]}),s}var e=ca.layout.hierarchy().sort(null).value(null),r=Ci,n=[1,1],i=!1;return t.separation=function(e){return arguments.length?(r=e,t):r},t.size=function(e){return arguments.length?(i=null==(n=e),t):i?null:n},t.nodeSize=function(e){return arguments.length?(i=null!=(n=e),t):i?n:null},ai(t,e)},ca.layout.treemap=function(){function t(t,e){for(var r,n,i=-1,o=t.length;++i<o;)n=(r=t[i]).value*(0>e?0:e),r.area=isNaN(n)||0>=n?0:n}function e(r){var o=r.children;if(o&&o.length){var a,s,l,u=h(r),c=[],f=o.slice(),p=1/0,v="slice"===d?u.dx:"dice"===d?u.dy:"slice-dice"===d?1&r.depth?u.dy:u.dx:Math.min(u.dx,u.dy);for(t(f,u.dx*u.dy/r.value),c.area=0;(l=f.length)>0;)c.push(a=f[l-1]),c.area+=a.area,"squarify"!==d||(s=n(c,v))<=p?(f.pop(),p=s):(c.area-=c.pop().area,i(c,v,u,!1),v=Math.min(u.dx,u.dy),c.length=c.area=0,p=1/0);c.length&&(i(c,v,u,!0),c.length=c.area=0),o.forEach(e)}}function r(e){var n=e.children;if(n&&n.length){var o,a=h(e),s=n.slice(),l=[];for(t(s,a.dx*a.dy/e.value),l.area=0;o=s.pop();)l.push(o),l.area+=o.area,null!=o.z&&(i(l,o.z?a.dx:a.dy,a,!s.length),l.length=l.area=0);n.forEach(r)}}function n(t,e){for(var r,n=t.area,i=0,o=1/0,a=-1,s=t.length;++a<s;)(r=t[a].area)&&(o>r&&(o=r),r>i&&(i=r));return n*=n,e*=e,n?Math.max(e*i*p/n,n/(e*o*p)):1/0}function i(t,e,r,n){var i,o=-1,a=t.length,s=r.x,u=r.y,c=e?l(t.area/e):0;if(e==r.dx){for((n||c>r.dy)&&(c=r.dy);++o<a;)i=t[o],i.x=s,i.y=u,i.dy=c,s+=i.dx=Math.min(r.x+r.dx-s,c?l(i.area/c):0);i.z=!0,i.dx+=r.x+r.dx-s,r.y+=c,r.dy-=c}else{for((n||c>r.dx)&&(c=r.dx);++o<a;)i=t[o],i.x=s,i.y=u,i.dx=c,u+=i.dy=Math.min(r.y+r.dy-u,c?l(i.area/c):0);i.z=!1,i.dy+=r.y+r.dy-u,r.x+=c,r.dx-=c}}function o(n){var i=a||s(n),o=i[0];return o.x=o.y=0,o.value?(o.dx=u[0],o.dy=u[1]):o.dx=o.dy=0,a&&s.revalue(o),t([o],o.dx*o.dy/o.value),(a?r:e)(o),f&&(a=i),i}var a,s=ca.layout.hierarchy(),l=Math.round,u=[1,1],c=null,h=qi,f=!1,d="squarify",p=.5*(1+Math.sqrt(5));return o.size=function(t){return arguments.length?(u=t,o):u},o.padding=function(t){function e(e){var r=t.call(o,e,e.depth);return null==r?qi(e):Gi(e,"number"==typeof r?[r,r,r,r]:r)}function r(e){return Gi(e,t)}if(!arguments.length)return c;var n;return h=null==(c=t)?qi:"function"==(n=typeof t)?e:"number"===n?(t=[t,t,t,t],r):r,o},o.round=function(t){return arguments.length?(l=t?Math.round:Number,o):l!=Number},o.sticky=function(t){return arguments.length?(f=t,a=null,o):f},o.ratio=function(t){return arguments.length?(p=t,o):p},o.mode=function(t){return arguments.length?(d=t+"",o):d},ai(o,s)},ca.random={normal:function(t,e){var r=arguments.length;return 2>r&&(e=1),1>r&&(t=0),function(){var r,n,i;do r=2*Math.random()-1,n=2*Math.random()-1,i=r*r+n*n;while(!i||i>1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=ca.random.normal.apply(ca,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=ca.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,r=0;t>r;r++)e+=Math.random();return e}}},ca.scale={};var Tl={floor:x,ceil:x};ca.scale.linear=function(){return Ji([0,1],[0,1],_n,!1)};var El={s:1,g:1,p:1,r:1,e:1};ca.scale.log=function(){return oo(ca.scale.linear().domain([0,1]),10,!0,[1,10])};var Sl=ca.format(".0e"),Ll={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};ca.scale.pow=function(){return ao(ca.scale.linear(),1,[0,1])},ca.scale.sqrt=function(){return ca.scale.pow().exponent(.5)},ca.scale.ordinal=function(){return lo([],{t:"range",a:[[]]})},ca.scale.category10=function(){return ca.scale.ordinal().range(zl)},ca.scale.category20=function(){return ca.scale.ordinal().range(Il)},ca.scale.category20b=function(){return ca.scale.ordinal().range(Pl)},ca.scale.category20c=function(){return ca.scale.ordinal().range(Cl)};var zl=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(_t),Il=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(_t),Pl=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(_t),Cl=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(_t);ca.scale.quantile=function(){return uo([],[])},ca.scale.quantize=function(){return co(0,1,[0,1])},ca.scale.threshold=function(){return ho([.5],[0,1])},ca.scale.identity=function(){return fo([0,1])},ca.svg={},ca.svg.arc=function(){function t(){var t=Math.max(0,+r.apply(this,arguments)),u=Math.max(0,+n.apply(this,arguments)),c=a.apply(this,arguments)-Ga,h=s.apply(this,arguments)-Ga,f=Math.abs(h-c),d=c>h?0:1;if(t>u&&(p=u,u=t,t=p),f>=qa)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,v,m,g,y,b,x,_,w,M,k,A,T=0,E=0,S=[];if((g=(+l.apply(this,arguments)||0)/2)&&(m=o===Rl?Math.sqrt(t*t+u*u):+o.apply(this,arguments),d||(E*=-1),u&&(E=nt(m/u*Math.sin(g))),t&&(T=nt(m/t*Math.sin(g)))),u){y=u*Math.cos(c+E),b=u*Math.sin(c+E),x=u*Math.cos(h-E),_=u*Math.sin(h-E);var L=Math.abs(h-c-2*E)<=Ua?0:1;if(E&&xo(y,b,x,_)===d^L){var z=(c+h)/2;y=u*Math.cos(z),b=u*Math.sin(z),x=_=null}}else y=b=0;if(t){w=t*Math.cos(h-T),M=t*Math.sin(h-T),k=t*Math.cos(c+T),A=t*Math.sin(c+T);var I=Math.abs(c-h+2*T)<=Ua?0:1;if(T&&xo(w,M,k,A)===1-d^I){var P=(c+h)/2;w=t*Math.cos(P),M=t*Math.sin(P),k=A=null}}else w=M=0;if(f>Na&&(p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){v=u>t^d?0:1;var C=p,R=p;if(Ua>f){var D=null==k?[w,M]:null==x?[y,b]:Dr([y,b],[k,A],[x,_],[w,M]),O=y-D[0],F=b-D[1],j=x-D[0],N=_-D[1],B=1/Math.sin(Math.acos((O*j+F*N)/(Math.sqrt(O*O+F*F)*Math.sqrt(j*j+N*N)))/2),U=Math.sqrt(D[0]*D[0]+D[1]*D[1]);R=Math.min(p,(t-U)/(B-1)),C=Math.min(p,(u-U)/(B+1))}if(null!=x){var V=_o(null==k?[w,M]:[k,A],[y,b],u,C,d),q=_o([x,_],[w,M],u,C,d);p===C?S.push("M",V[0],"A",C,",",C," 0 0,",v," ",V[1],"A",u,",",u," 0 ",1-d^xo(V[1][0],V[1][1],q[1][0],q[1][1]),",",d," ",q[1],"A",C,",",C," 0 0,",v," ",q[0]):S.push("M",V[0],"A",C,",",C," 0 1,",v," ",q[0])}else S.push("M",y,",",b);if(null!=k){var G=_o([y,b],[k,A],t,-R,d),H=_o([w,M],null==x?[y,b]:[x,_],t,-R,d);p===R?S.push("L",H[0],"A",R,",",R," 0 0,",v," ",H[1],"A",t,",",t," 0 ",d^xo(H[1][0],H[1][1],G[1][0],G[1][1]),",",1-d," ",G[1],"A",R,",",R," 0 0,",v," ",G[0]):S.push("L",H[0],"A",R,",",R," 0 0,",v," ",G[0])}else S.push("L",w,",",M)}else S.push("M",y,",",b),null!=x&&S.push("A",u,",",u," 0 ",L,",",d," ",x,",",_),S.push("L",w,",",M),null!=k&&S.push("A",t,",",t," 0 ",I,",",1-d," ",k,",",A);return S.push("Z"),S.join("")}function e(t,e){return"M0,"+t+"A"+t+","+t+" 0 1,"+e+" 0,"+-t+"A"+t+","+t+" 0 1,"+e+" 0,"+t}var r=vo,n=mo,i=po,o=Rl,a=go,s=yo,l=bo;return t.innerRadius=function(e){return arguments.length?(r=St(e),t):r},t.outerRadius=function(e){return arguments.length?(n=St(e),t):n},t.cornerRadius=function(e){return arguments.length?(i=St(e),t):i},t.padRadius=function(e){return arguments.length?(o=e==Rl?Rl:St(e),t):o},t.startAngle=function(e){return arguments.length?(a=St(e),t):a},t.endAngle=function(e){return arguments.length?(s=St(e),t):s},t.padAngle=function(e){return arguments.length?(l=St(e),t):l},t.centroid=function(){var t=(+r.apply(this,arguments)+ +n.apply(this,arguments))/2,e=(+a.apply(this,arguments)+ +s.apply(this,arguments))/2-Ga;return[Math.cos(e)*t,Math.sin(e)*t]},t};var Rl="auto";ca.svg.line=function(){return wo(x)};var Dl=ca.map({linear:Mo,"linear-closed":ko,step:Ao,"step-before":To,"step-after":Eo,basis:Co,"basis-open":Ro,"basis-closed":Do,bundle:Oo,cardinal:zo,"cardinal-open":So,"cardinal-closed":Lo,monotone:Vo});Dl.forEach(function(t,e){e.key=t,e.closed=/-closed/.test(t)});var Ol=[0,2/3,1/3,0],Fl=[0,1/3,2/3,0],jl=[0,1/6,2/3,1/6];ca.svg.line.radial=function(){var t=wo(qo);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},To.reverse=Eo,Eo.reverse=To,ca.svg.area=function(){return Go(x)},ca.svg.area.radial=function(){var t=Go(qo);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},ca.svg.chord=function(){function t(t,s){var l=e(this,o,t,s),u=e(this,a,t,s);return"M"+l.p0+n(l.r,l.p1,l.a1-l.a0)+(r(l,u)?i(l.r,l.p1,l.r,l.p0):i(l.r,l.p1,u.r,u.p0)+n(u.r,u.p1,u.a1-u.a0)+i(u.r,u.p1,l.r,l.p0))+"Z"}function e(t,e,r,n){var i=e.call(t,r,n),o=s.call(t,i,n),a=l.call(t,i,n)-Ga,c=u.call(t,i,n)-Ga;return{r:o,a0:a,a1:c,p0:[o*Math.cos(a),o*Math.sin(a)],p1:[o*Math.cos(c),o*Math.sin(c)]}}function r(t,e){return t.a0==e.a0&&t.a1==e.a1}function n(t,e,r){return"A"+t+","+t+" 0 "+ +(r>Ua)+",1 "+e}function i(t,e,r,n){return"Q 0,0 "+n}var o=xr,a=_r,s=Ho,l=go,u=yo;return t.radius=function(e){return arguments.length?(s=St(e),t):s},t.source=function(e){return arguments.length?(o=St(e),t):o},t.target=function(e){return arguments.length?(a=St(e),t):a},t.startAngle=function(e){return arguments.length?(l=St(e),t):l},t.endAngle=function(e){return arguments.length?(u=St(e),t):u},t},ca.svg.diagonal=function(){function t(t,i){var o=e.call(this,t,i),a=r.call(this,t,i),s=(o.y+a.y)/2,l=[o,{x:o.x,y:s},{x:a.x,y:s},a];return l=l.map(n),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=xr,r=_r,n=Xo;return t.source=function(r){return arguments.length?(e=St(r),t):e},t.target=function(e){return arguments.length?(r=St(e),t):r},t.projection=function(e){return arguments.length?(n=e,t):n},t},ca.svg.diagonal.radial=function(){var t=ca.svg.diagonal(),e=Xo,r=t.projection;return t.projection=function(t){return arguments.length?r(Yo(e=t)):e},t},ca.svg.symbol=function(){function t(t,n){return(Nl.get(e.call(this,t,n))||Ko)(r.call(this,t,n))}var e=Zo,r=Wo;return t.type=function(r){return arguments.length?(e=St(r),t):e},t.size=function(e){return arguments.length?(r=St(e),t):r},t};var Nl=ca.map({circle:Ko,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*Ul)),r=e*Ul;return"M0,"+-e+"L"+r+",0 0,"+e+" "+-r+",0Z"},square:function(t){var e=Math.sqrt(t)/2;return"M"+-e+","+-e+"L"+e+","+-e+" "+e+","+e+" "+-e+","+e+"Z"},"triangle-down":function(t){var e=Math.sqrt(t/Bl),r=e*Bl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Bl),r=e*Bl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});ca.svg.symbolTypes=Nl.keys();var Bl=Math.sqrt(3),Ul=Math.tan(30*Ha);Ia.transition=function(t){for(var e,r,n=Vl||++Xl,i=ea(t),o=[],a=ql||{time:Date.now(),ease:Sn,delay:0,duration:250},s=-1,l=this.length;++s<l;){o.push(e=[]);for(var u=this[s],c=-1,h=u.length;++c<h;)(r=u[c])&&ra(r,c,i,n,a),e.push(r)}return o(o,i,n)},Ia.interrupt=function(t){return this.each(null==t?Gl:Jo(ea(t)))};var Vl,ql,Gl=Jo(ea()),Hl=[],Xl=0;Hl.call=Ia.call,Hl.empty=Ia.empty,Hl.node=Ia.node,Hl.size=Ia.size,ca.transition=function(t,e){return t&&t.transition?Vl?t.transition(e):t:ca.selection().transition(t)},ca.transition.prototype=Hl,Hl.select=function(t){var e,r,n,i=this.id,o=this.namespace,a=[];t=z(t);for(var s=-1,l=this.length;++s<l;){a.push(e=[]);for(var u=this[s],c=-1,h=u.length;++c<h;)(n=u[c])&&(r=t.call(n,n.__data__,c,s))?("__data__"in n&&(r.__data__=n.__data__),ra(r,c,o,i,n[o][i]),e.push(r)):e.push(null)}return o(a,o,i)},Hl.selectAll=function(t){var e,r,n,i,o,a=this.id,s=this.namespace,l=[];t=I(t);for(var u=-1,c=this.length;++u<c;)for(var h=this[u],f=-1,d=h.length;++f<d;)if(n=h[f]){o=n[s][a],r=t.call(n,n.__data__,f,u),l.push(e=[]);for(var p=-1,v=r.length;++p<v;)(i=r[p])&&ra(i,p,s,a,o),e.push(i)}return o(l,s,a)},Hl.filter=function(t){var e,r,n,i=[];"function"!=typeof t&&(t=q(t));for(var o=0,a=this.length;a>o;o++){i.push(e=[]);for(var r=this[o],s=0,l=r.length;l>s;s++)(n=r[s])&&t.call(n,n.__data__,s,o)&&e.push(n)}return o(i,this.namespace,this.id)},Hl.tween=function(t,e){var r=this.id,n=this.namespace;return arguments.length<2?this.node()[n][r].tween.get(t):H(this,null==e?function(e){e[n][r].tween.remove(t)}:function(i){i[n][r].tween.set(t,e)})},Hl.attr=function(t,e){function r(){this.removeAttribute(s)}function n(){this.removeAttributeNS(s.space,s.local)}function i(t){return null==t?r:(t+="",function(){var e,r=this.getAttribute(s);return r!==t&&(e=a(r,t),function(t){this.setAttribute(s,e(t))})})}function o(t){return null==t?n:(t+="",function(){var e,r=this.getAttributeNS(s.space,s.local);return r!==t&&(e=a(r,t),function(t){this.setAttributeNS(s.space,s.local,e(t))})})}if(arguments.length<2){for(e in t)this.attr(e,t[e]);return this}var a="transform"==t?Zn:_n,s=ca.ns.qualify(t);return Qo(this,"attr."+t,e,s.local?o:i)},Hl.attrTween=function(t,e){function r(t,r){var n=e.call(this,t,r,this.getAttribute(i));return n&&function(t){this.setAttribute(i,n(t))}}function n(t,r){var n=e.call(this,t,r,this.getAttributeNS(i.space,i.local));return n&&function(t){this.setAttributeNS(i.space,i.local,n(t))}}var i=ca.ns.qualify(t);return this.tween("attr."+t,i.local?n:r)},Hl.style=function(t,e,r){function i(){this.style.removeProperty(t)}function o(e){return null==e?i:(e+="",function(){var i,o=n(this).getComputedStyle(this,null).getPropertyValue(t);return o!==e&&(i=_n(o,e),function(e){this.style.setProperty(t,i(e),r)})})}var a=arguments.length;if(3>a){if("string"!=typeof t){2>a&&(e="");for(r in t)this.style(r,t[r],e);return this}r=""}return Qo(this,"style."+t,e,o)},Hl.styleTween=function(t,e,r){function i(i,o){var a=e.call(this,i,o,n(this).getComputedStyle(this,null).getPropertyValue(t));return a&&function(e){this.style.setProperty(t,a(e),r)}}return arguments.length<3&&(r=""),this.tween("style."+t,i)},Hl.text=function(t){return Qo(this,"text",t,ta)},Hl.remove=function(){var t=this.namespace;return this.each("end.transition",function(){var e;this[t].count<2&&(e=this.parentNode)&&e.removeChild(this)})},Hl.ease=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].ease:("function"!=typeof t&&(t=ca.ease.apply(ca,arguments)),H(this,function(n){n[r][e].ease=t}))},Hl.delay=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].delay:H(this,"function"==typeof t?function(n,i,o){n[r][e].delay=+t.call(n,n.__data__,i,o)}:(t=+t,function(n){n[r][e].delay=t}))},Hl.duration=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].duration:H(this,"function"==typeof t?function(n,i,o){n[r][e].duration=Math.max(1,t.call(n,n.__data__,i,o))}:(t=Math.max(1,t),function(n){n[r][e].duration=t}))},Hl.each=function(t,e){var r=this.id,n=this.namespace;if(arguments.length<2){var i=ql,o=Vl;try{Vl=r,H(this,function(e,i,o){ql=e[n][r],t.call(e,e.__data__,i,o)})}finally{ql=i,Vl=o}}else H(this,function(i){var o=i[n][r];(o.event||(o.event=ca.dispatch("start","end","interrupt"))).on(t,e)});return this},Hl.transition=function(){for(var t,e,r,n,i=this.id,o=++Xl,a=this.namespace,s=[],l=0,u=this.length;u>l;l++){s.push(t=[]);for(var e=this[l],c=0,h=e.length;h>c;c++)(r=e[c])&&(n=r[a][i],ra(r,c,a,o,{time:n.time,ease:n.ease,delay:n.delay+n.duration,duration:n.duration})),t.push(r)}return o(s,a,o)},ca.svg.axis=function(){function t(t){t.each(function(){var t,u=ca.select(this),c=this.__chart__||r,h=this.__chart__=r.copy(),f=null==l?h.ticks?h.ticks.apply(h,s):h.domain():l,d=null==e?h.tickFormat?h.tickFormat.apply(h,s):x:e,p=u.selectAll(".tick").data(f,h),v=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Na),m=ca.transition(p.exit()).style("opacity",Na).remove(),g=ca.transition(p.order()).style("opacity",1),y=Math.max(i,0)+a,b=Xi(h),_=u.selectAll(".domain").data([0]),w=(_.enter().append("path").attr("class","domain"),ca.transition(_));v.append("line"),v.append("text");var M,k,A,T,E=v.select("line"),S=g.select("line"),L=p.select("text").text(d),z=v.select("text"),I=g.select("text"),P="top"===n||"left"===n?-1:1;if("bottom"===n||"top"===n?(t=na,M="x",A="y",k="x2",T="y2",L.attr("dy",0>P?"0em":".71em").style("text-anchor","middle"),w.attr("d","M"+b[0]+","+P*o+"V0H"+b[1]+"V"+P*o)):(t=ia,M="y",A="x",k="y2",T="x2",L.attr("dy",".32em").style("text-anchor",0>P?"end":"start"),w.attr("d","M"+P*o+","+b[0]+"H0V"+b[1]+"H"+P*o)),E.attr(T,P*i),z.attr(A,P*y),S.attr(k,0).attr(T,P*i),I.attr(M,0).attr(A,P*y),h.rangeBand){var C=h,R=C.rangeBand()/2;c=h=function(t){return C(t)+R}}else c.rangeBand?c=h:m.call(t,h,c);v.call(t,c,h),g.call(t,h,h)})}var e,r=ca.scale.linear(),n=Yl,i=6,o=6,a=3,s=[10],l=null;return t.scale=function(e){return arguments.length?(r=e,t):r},t.orient=function(e){return arguments.length?(n=e in Wl?e+"":Yl,t):n},t.ticks=function(){return arguments.length?(s=fa(arguments),t):s},t.tickValues=function(e){return arguments.length?(l=e,t):l},t.tickFormat=function(r){return arguments.length?(e=r,t):e},t.tickSize=function(e){var r=arguments.length;return r?(i=+e,o=+arguments[r-1],t):i},t.innerTickSize=function(e){return arguments.length?(i=+e,t):i},t.outerTickSize=function(e){return arguments.length?(o=+e,t):o},t.tickPadding=function(e){return arguments.length?(a=+e,t):a},t.tickSubdivide=function(){return arguments.length&&t},t};var Yl="bottom",Wl={top:1,right:1,bottom:1,left:1};ca.svg.brush=function(){function t(n){n.each(function(){var n=ca.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",o).on("touchstart.brush",o),a=n.selectAll(".background").data([0]);a.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),n.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var s=n.selectAll(".resize").data(v,x);s.exit().remove(),s.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return Zl[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"),s.style("display",t.empty()?"none":null);var l,h=ca.transition(n),f=ca.transition(a);u&&(l=Xi(u),f.attr("x",l[0]).attr("width",l[1]-l[0]),r(h)),c&&(l=Xi(c),f.attr("y",l[0]).attr("height",l[1]-l[0]),i(h)),e(h)})}function e(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+h[+/e/.test(t)]+","+f[+/^s/.test(t)]+")"})}function r(t){t.select(".extent").attr("x",h[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",h[1]-h[0])}function i(t){t.select(".extent").attr("y",f[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function o(){function o(){32==ca.event.keyCode&&(L||(b=null,I[0]-=h[1],I[1]-=f[1],L=2),T())}function v(){32==ca.event.keyCode&&2==L&&(I[0]+=h[1],I[1]+=f[1],L=0,T())}function m(){var t=ca.mouse(_),n=!1;x&&(t[0]+=x[0],t[1]+=x[1]),L||(ca.event.altKey?(b||(b=[(h[0]+h[1])/2,(f[0]+f[1])/2]),I[0]=h[+(t[0]<b[0])],I[1]=f[+(t[1]<b[1])]):b=null),E&&g(t,u,0)&&(r(k),n=!0),S&&g(t,c,1)&&(i(k),n=!0),n&&(e(k),M({type:"brush",mode:L?"move":"resize"}))}function g(t,e,r){var n,i,o=Xi(e),l=o[0],u=o[1],c=I[r],v=r?f:h,m=v[1]-v[0];return L&&(l-=c,u-=m+c),n=(r?p:d)?Math.max(l,Math.min(u,t[r])):t[r],L?i=(n+=c)+m:(b&&(c=Math.max(l,Math.min(u,2*b[r]-n))),n>c?(i=n,n=c):i=c),v[0]!=n||v[1]!=i?(r?s=null:a=null,v[0]=n,v[1]=i,!0):void 0}function y(){m(),k.style("pointer-events","all").selectAll(".resize").style("display",t.empty()?"none":null),ca.select("body").style("cursor",null),P.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),z(),M({type:"brushend"})}var b,x,_=this,w=ca.select(ca.event.target),M=l.of(_,arguments),k=ca.select(_),A=w.datum(),E=!/^(n|s)/.test(A)&&u,S=!/^(e|w)/.test(A)&&c,L=w.classed("extent"),z=J(_),I=ca.mouse(_),P=ca.select(n(_)).on("keydown.brush",o).on("keyup.brush",v);if(ca.event.changedTouches?P.on("touchmove.brush",m).on("touchend.brush",y):P.on("mousemove.brush",m).on("mouseup.brush",y),k.interrupt().selectAll("*").interrupt(),L)I[0]=h[0]-I[0],I[1]=f[0]-I[1];else if(A){var C=+/w/.test(A),R=+/^n/.test(A);x=[h[1-C]-I[0],f[1-R]-I[1]],I[0]=h[C],I[1]=f[R]}else ca.event.altKey&&(b=I.slice());k.style("pointer-events","none").selectAll(".resize").style("display",null),ca.select("body").style("cursor",w.style("cursor")),M({type:"brushstart"}),m()}var a,s,l=S(t,"brushstart","brush","brushend"),u=null,c=null,h=[0,0],f=[0,0],d=!0,p=!0,v=Kl[0];return t.event=function(t){t.each(function(){var t=l.of(this,arguments),e={x:h,y:f,i:a,j:s},r=this.__chart__||e;this.__chart__=e,Vl?ca.select(this).transition().each("start.brush",function(){a=r.i,s=r.j,h=r.x,f=r.y,t({type:"brushstart"})}).tween("brush:brush",function(){var r=wn(h,e.x),n=wn(f,e.y);return a=s=null,function(i){h=e.x=r(i),f=e.y=n(i),t({type:"brush",mode:"resize"})}}).each("end.brush",function(){a=e.i,s=e.j,t({type:"brush",mode:"resize"}),t({type:"brushend"})}):(t({type:"brushstart"}),t({type:"brush",mode:"resize"}),t({type:"brushend"}))})},t.x=function(e){return arguments.length?(u=e,v=Kl[!u<<1|!c],t):u},t.y=function(e){return arguments.length?(c=e,v=Kl[!u<<1|!c],t):c},t.clamp=function(e){return arguments.length?(u&&c?(d=!!e[0],p=!!e[1]):u?d=!!e:c&&(p=!!e),t):u&&c?[d,p]:u?d:c?p:null},t.extent=function(e){var r,n,i,o,l;return arguments.length?(u&&(r=e[0],n=e[1],c&&(r=r[0],n=n[0]),a=[r,n],u.invert&&(r=u(r),n=u(n)),r>n&&(l=r,r=n,n=l),r==h[0]&&n==h[1]||(h=[r,n])),c&&(i=e[0],o=e[1],u&&(i=i[1],o=o[1]),s=[i,o],c.invert&&(i=c(i),o=c(o)),i>o&&(l=i,i=o,o=l),i==f[0]&&o==f[1]||(f=[i,o])),t):(u&&(a?(r=a[0],n=a[1]):(r=h[0],n=h[1],u.invert&&(r=u.invert(r),n=u.invert(n)),r>n&&(l=r,r=n,n=l))),c&&(s?(i=s[0],o=s[1]):(i=f[0],o=f[1],c.invert&&(i=c.invert(i),o=c.invert(o)),i>o&&(l=i,i=o,o=l))),u&&c?[[r,i],[n,o]]:u?[r,n]:c&&[i,o])},t.clear=function(){return t.empty()||(h=[0,0],f=[0,0],a=s=null),t},t.empty=function(){return!!u&&h[0]==h[1]||!!c&&f[0]==f[1]},ca.rebind(t,l,"on")};var Zl={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Kl=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Jl=ms.format=ws.timeFormat,l=Jl.utc,Ql=l("%Y-%m-%dT%H:%M:%S.%LZ");Jl.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?oa:Ql,oa.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},oa.toString=Ql.toString,ms.second=Vt(function(t){return new gs(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()}),ms.seconds=ms.second.range,ms.seconds.utc=ms.second.utc.range,ms.minute=Vt(function(t){return new gs(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()}),ms.minutes=ms.minute.range,ms.minutes.utc=ms.minute.utc.range,ms.hour=Vt(function(t){var e=t.getTimezoneOffset()/60;return new gs(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()}),ms.hours=ms.hour.range,ms.hours.utc=ms.hour.utc.range,ms.month=Vt(function(t){return t=ms.day(t),t.setDate(1),t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()}),ms.months=ms.month.range,ms.months.utc=ms.month.utc.range;var tu=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],eu=[[ms.second,1],[ms.second,5],[ms.second,15],[ms.second,30],[ms.minute,1],[ms.minute,5],[ms.minute,15],[ms.minute,30],[ms.hour,1],[ms.hour,3],[ms.hour,6],[ms.hour,12],[ms.day,1],[ms.day,2],[ms.week,1],[ms.month,1],[ms.month,3],[ms.year,1]],ru=Jl.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",Ie]]),nu={range:function(t,e,r){return ca.range(Math.ceil(t/r)*r,+e,r).map(sa)},floor:x,ceil:x};eu.year=ms.year,ms.scale=function(){return aa(ca.scale.linear(),eu,ru)};var iu=eu.map(function(t){return[t[0].utc,t[1]]}),ou=l.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",Ie]]);iu.year=ms.year.utc,ms.scale.utc=function(){return aa(ca.scale.linear(),iu,ou)},ca.text=Lt(function(t){return t.responseText}),ca.json=function(t,e){return zt(t,"application/json",la,e)},ca.html=function(t,e){return zt(t,"text/html",ua,e)},ca.xml=Lt(function(t){return t.responseXML}),"function"==typeof t&&t.amd?(this.d3=ca,t(ca)):"object"==typeof r&&r.exports?r.exports=ca:this.d3=ca}()},{}],120:[function(t,e,r){"use strict";function n(t,e){this.point=t,this.index=e}function i(t,e){for(var r=t.point,n=e.point,i=r.length,o=0;i>o;++o){var a=n[o]-r[o];if(a)return a}return 0}function o(t,e,r){if(1===t)return r?[[-1,0]]:[];var n=e.map(function(t,e){return[t[0],e]});n.sort(function(t,e){return t[0]-e[0]});for(var i=new Array(t-1),o=1;t>o;++o){var a=n[o-1],s=n[o];i[o-1]=[a[1],s[1]]}return r&&i.push([-1,i[0][1]],[i[t-1][1],-1]),i}function a(t,e){var r=t.length;if(0===r)return[];var a=t[0].length;if(1>a)return[];if(1===a)return o(r,t,e);for(var u=new Array(r),c=1,h=0;r>h;++h){for(var f=t[h],d=new Array(a+1),p=0,v=0;a>v;++v){var m=f[v];d[v]=m,p+=m*m; }d[a]=p,u[h]=new n(d,h),c=Math.max(p,c)}l(u,i),r=u.length;for(var g=new Array(r+a+1),y=new Array(r+a+1),b=(a+1)*(a+1)*c,x=new Array(a+1),h=0;a>=h;++h)x[h]=0;x[a]=b,g[0]=x.slice(),y[0]=-1;for(var h=0;a>=h;++h){var d=x.slice();d[h]=1,g[h+1]=d,y[h+1]=-1}for(var h=0;r>h;++h){var _=u[h];g[h+a+1]=_.point,y[h+a+1]=_.index}var w=s(g,!1);if(w=e?w.filter(function(t){for(var e=0,r=0;a>=r;++r){var n=y[t[r]];if(0>n&&++e>=2)return!1;t[r]=n}return!0}):w.filter(function(t){for(var e=0;a>=e;++e){var r=y[t[e]];if(0>r)return!1;t[e]=r}return!0}),1&a)for(var h=0;h<w.length;++h){var _=w[h],d=_[0];_[0]=_[1],_[1]=d}return w}var s=t("incremental-convex-hull"),l=t("uniq");e.exports=a},{"incremental-convex-hull":241,uniq:459}],121:[function(t,e,r){"use strict";function n(t,e,r){var i=0|t[r];if(0>=i)return[];var o,a=new Array(i);if(r===t.length-1)for(o=0;i>o;++o)a[o]=e;else for(o=0;i>o;++o)a[o]=n(t,e,r+1);return a}function i(t,e){var r,n;for(r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function o(t,e){switch("undefined"==typeof e&&(e=0),typeof t){case"number":if(t>0)return i(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=o},{}],122:[function(e,r,n){(function(n,i){(function(){"use strict";function o(t){return"function"==typeof t||"object"==typeof t&&null!==t}function a(t){return"function"==typeof t}function s(t){X=t}function l(t){K=t}function u(){return function(){n.nextTick(p)}}function c(){return function(){H(p)}}function h(){var t=0,e=new Q(p),r=document.createTextNode("");return e.observe(r,{characterData:!0}),function(){r.data=t=++t%2}}function f(){var t=new MessageChannel;return t.port1.onmessage=p,function(){t.port2.postMessage(0)}}function d(){return function(){setTimeout(p,1)}}function p(){for(var t=0;Z>t;t+=2){var e=rt[t],r=rt[t+1];e(r),rt[t]=void 0,rt[t+1]=void 0}Z=0}function v(){try{var t=e,r=t("vertx");return H=r.runOnLoop||r.runOnContext,c()}catch(n){return d()}}function m(t,e){var r=this,n=r._state;if(n===at&&!t||n===st&&!e)return this;var i=new this.constructor(y),o=r._result;if(n){var a=arguments[n-1];K(function(){R(n,i,a,o)})}else z(r,i,t,e);return i}function g(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var r=new e(y);return T(r,t),r}function y(){}function b(){return new TypeError("You cannot resolve a promise with itself")}function x(){return new TypeError("A promises callback cannot return that same promise.")}function _(t){try{return t.then}catch(e){return lt.error=e,lt}}function w(t,e,r,n){try{t.call(e,r,n)}catch(i){return i}}function M(t,e,r){K(function(t){var n=!1,i=w(r,e,function(r){n||(n=!0,e!==r?T(t,r):S(t,r))},function(e){n||(n=!0,L(t,e))},"Settle: "+(t._label||" unknown promise"));!n&&i&&(n=!0,L(t,i))},t)}function k(t,e){e._state===at?S(t,e._result):e._state===st?L(t,e._result):z(e,void 0,function(e){T(t,e)},function(e){L(t,e)})}function A(t,e,r){e.constructor===t.constructor&&r===nt&&constructor.resolve===it?k(t,e):r===lt?L(t,lt.error):void 0===r?S(t,e):a(r)?M(t,e,r):S(t,e)}function T(t,e){t===e?L(t,b()):o(e)?A(t,e,_(e)):S(t,e)}function E(t){t._onerror&&t._onerror(t._result),I(t)}function S(t,e){t._state===ot&&(t._result=e,t._state=at,0!==t._subscribers.length&&K(I,t))}function L(t,e){t._state===ot&&(t._state=st,t._result=e,K(E,t))}function z(t,e,r,n){var i=t._subscribers,o=i.length;t._onerror=null,i[o]=e,i[o+at]=r,i[o+st]=n,0===o&&t._state&&K(I,t)}function I(t){var e=t._subscribers,r=t._state;if(0!==e.length){for(var n,i,o=t._result,a=0;a<e.length;a+=3)n=e[a],i=e[a+r],n?R(r,n,i,o):i(o);t._subscribers.length=0}}function P(){this.error=null}function C(t,e){try{return t(e)}catch(r){return ut.error=r,ut}}function R(t,e,r,n){var i,o,s,l,u=a(r);if(u){if(i=C(r,n),i===ut?(l=!0,o=i.error,i=null):s=!0,e===i)return void L(e,x())}else i=n,s=!0;e._state!==ot||(u&&s?T(e,i):l?L(e,o):t===at?S(e,i):t===st&&L(e,i))}function D(t,e){try{e(function(e){T(t,e)},function(e){L(t,e)})}catch(r){L(t,r)}}function O(t){return new vt(this,t).promise}function F(t){function e(t){T(i,t)}function r(t){L(i,t)}var n=this,i=new n(y);if(!W(t))return L(i,new TypeError("You must pass an array to race.")),i;for(var o=t.length,a=0;i._state===ot&&o>a;a++)z(n.resolve(t[a]),void 0,e,r);return i}function j(t){var e=this,r=new e(y);return L(r,t),r}function N(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function B(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function U(t){this._id=dt++,this._state=void 0,this._result=void 0,this._subscribers=[],y!==t&&("function"!=typeof t&&N(),this instanceof U?D(this,t):B())}function V(t,e){this._instanceConstructor=t,this.promise=new t(y),Array.isArray(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&S(this.promise,this._result))):L(this.promise,this._validationError())}function q(){var t;if("undefined"!=typeof i)t=i;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=t.Promise;r&&"[object Promise]"===Object.prototype.toString.call(r.resolve())&&!r.cast||(t.Promise=pt)}var G;G=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var H,X,Y,W=G,Z=0,K=function(t,e){rt[Z]=t,rt[Z+1]=e,Z+=2,2===Z&&(X?X(p):Y())},J="undefined"!=typeof window?window:void 0,=J||{},Q=.MutationObserver||.WebKitMutationObserver,tt="undefined"!=typeof n&&"[object process]"==={}.toString.call(n),et="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,rt=new Array(1e3);Y=tt?u():Q?h():et?f():void 0===J&&"function"==typeof e?v():d();var nt=m,it=g,ot=void 0,at=1,st=2,lt=new P,ut=new P,ct=O,ht=F,ft=j,dt=0,pt=U;U.all=ct,U.race=ht,U.resolve=it,U.reject=ft,U._setScheduler=s,U._setAsap=l,U._asap=K,U.prototype={constructor:U,then:nt,"catch":function(t){return this.then(null,t)}};var vt=V;V.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},V.prototype._enumerate=function(){for(var t=this.length,e=this._input,r=0;this._state===ot&&t>r;r++)this._eachEntry(e[r],r)},V.prototype._eachEntry=function(t,e){var r=this._instanceConstructor,n=r.resolve;if(n===it){var i=_(t);if(i===nt&&t._state!==ot)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(r===pt){var o=new r(y);A(o,t,i),this._willSettleAt(o,e)}else this._willSettleAt(new r(function(e){e(t)}),e)}else this._willSettleAt(n(t),e)},V.prototype._settledAt=function(t,e,r){var n=this.promise;n._state===ot&&(this._remaining--,t===st?L(n,r):this._result[e]=r),0===this._remaining&&S(n,this._result)},V.prototype._willSettleAt=function(t,e){var r=this;z(t,void 0,function(t){r._settledAt(at,e,t)},function(t){r._settledAt(st,e,t)})};var mt=q,gt={Promise:pt,polyfill:mt};"function"==typeof t&&t.amd?t(function(){return gt}):"undefined"!=typeof r&&r.exports?r.exports=gt:"undefined"!=typeof this&&(this.ES6Promise=gt),mt()}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:60}],123:[function(t,e,r){"use strict";function n(t){for(var e,r=t.length,n=0;r>n;n++)if(e=t.charCodeAt(n),(9>e||e>13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(8192>e||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(t=+t,0===t&&n(r))return!1}else if("number"!==e)return!1;return 1>t-t}},{}],124:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.gl=t,this.type=e,this.handle=r,this.length=n,this.usage=i}function i(t,e,r,n,i,o){var a=i.length*i.BYTES_PER_ELEMENT;if(0>o)return t.bufferData(e,i,n),a;if(a+o>r)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return t.bufferSubData(e,o,i),r}function o(t,e){for(var r=l.malloc(t.length,e),n=t.length,i=0;n>i;++i)r[i]=t[i];return r}function a(t,e){for(var r=1,n=e.length-1;n>=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}function s(t,e,r,i){if(r=r||t.ARRAY_BUFFER,i=i||t.DYNAMIC_DRAW,r!==t.ARRAY_BUFFER&&r!==t.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(i!==t.DYNAMIC_DRAW&&i!==t.STATIC_DRAW&&i!==t.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var o=t.createBuffer(),a=new n(t,r,o,0,i);return a.update(e),a}var l=t("typedarray-pool"),u=t("ndarray-ops"),c=t("ndarray"),h=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"],f=n.prototype;f.bind=function(){this.gl.bindBuffer(this.type,this.handle)},f.unbind=function(){this.gl.bindBuffer(this.type,null)},f.dispose=function(){this.gl.deleteBuffer(this.handle)},f.update=function(t,e){if("number"!=typeof e&&(e=-1),this.bind(),"object"==typeof t&&"undefined"!=typeof t.shape){var r=t.dtype;if(h.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){var n=gl.getExtension("OES_element_index_uint");r=n&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&a(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=i(this.gl,this.type,this.length,this.usage,t.data,e):this.length=i(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var s=l.malloc(t.size,r),f=c(s,t.shape);u.assign(f,t),0>e?this.length=i(this.gl,this.type,this.length,this.usage,s,e):this.length=i(this.gl,this.type,this.length,this.usage,s.subarray(0,t.size),e),l.free(s)}}else if(Array.isArray(t)){var d;d=this.type===this.gl.ELEMENT_ARRAY_BUFFER?o(t,"uint16"):o(t,"float32"),0>e?this.length=i(this.gl,this.type,this.length,this.usage,d,e):this.length=i(this.gl,this.type,this.length,this.usage,d.subarray(0,t.length),e),l.free(d)}else if("object"==typeof t&&"number"==typeof t.length)this.length=i(this.gl,this.type,this.length,this.usage,t,e);else{if("number"!=typeof t&&void 0!==t)throw new Error("gl-buffer: Invalid data type");if(e>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");t=0|t,0>=t&&(t=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=s},{ndarray:433,"ndarray-ops":432,"typedarray-pool":458}],125:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.shader=e,this.buffer=r,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.numPoints=0,this.color=[0,0,0,1]}function i(t,e){var r=o(t.gl,l.vertex,l.fragment),i=a(t.gl),s=new n(t,r,i);return s.update(e),t.addObject(s),s}var o=t("gl-shader"),a=t("gl-buffer"),s=t("typedarray-pool"),l=t("./lib/shaders");e.exports=i;var u=[[1,0,0,1,0,0],[1,0,0,-1,0,0],[-1,0,0,-1,0,0],[-1,0,0,-1,0,0],[-1,0,0,1,0,0],[1,0,0,1,0,0],[1,0,-1,0,0,1],[1,0,-1,0,0,-1],[1,0,1,0,0,-1],[1,0,1,0,0,-1],[1,0,1,0,0,1],[1,0,-1,0,0,1],[-1,0,-1,0,0,1],[-1,0,-1,0,0,-1],[-1,0,1,0,0,-1],[-1,0,1,0,0,-1],[-1,0,1,0,0,1],[-1,0,-1,0,0,1],[0,1,1,0,0,0],[0,1,-1,0,0,0],[0,-1,-1,0,0,0],[0,-1,-1,0,0,0],[0,1,1,0,0,0],[0,-1,1,0,0,0],[0,1,0,-1,1,0],[0,1,0,-1,-1,0],[0,1,0,1,-1,0],[0,1,0,1,1,0],[0,1,0,-1,1,0],[0,1,0,1,-1,0],[0,-1,0,-1,1,0],[0,-1,0,-1,-1,0],[0,-1,0,1,-1,0],[0,-1,0,1,1,0],[0,-1,0,-1,1,0],[0,-1,0,1,-1,0]],c=n.prototype;c.draw=function(){var t=[1,0,0,0,1,0,0,0,1],e=[1,1];return function(){var r=this.plot,n=this.shader,i=this.buffer,o=this.bounds,a=this.numPoints;if(a){var s=r.gl,l=r.dataBox,c=r.viewBox,h=r.pixelRatio,f=o[2]-o[0],d=o[3]-o[1],p=l[2]-l[0],v=l[3]-l[1];t[0]=2*f/p,t[4]=2*d/v,t[6]=2*(o[0]-l[0])/p-1,t[7]=2*(o[1]-l[1])/v-1;var m=c[2]-c[0],g=c[3]-c[1];e[0]=2*h/m,e[1]=2*h/g,i.bind(),n.bind(),n.uniforms.viewTransform=t,n.uniforms.pixelScale=e,n.uniforms.color=this.color,n.attributes.position.pointer(s.FLOAT,!1,16,0),n.attributes.pixelOffset.pointer(s.FLOAT,!1,16,8),s.drawArrays(s.TRIANGLES,0,a*u.length)}}}(),c.drawPick=function(t){return t},c.pick=function(t,e){return null},c.update=function(t){t=t||{};var e,r,n,i=t.positions||[],o=t.errors||[],a=1;"lineWidth"in t&&(a=+t.lineWidth);var l=5;"capSize"in t&&(l=+t.capSize),this.color=(t.color||[0,0,0,1]).slice();var c=this.bounds=[1/0,1/0,-(1/0),-(1/0)],h=this.numPoints=i.length>>1;for(e=0;h>e;++e)r=i[2*e],n=i[2*e+1],c[0]=Math.min(r,c[0]),c[1]=Math.min(n,c[1]),c[2]=Math.max(r,c[2]),c[3]=Math.max(n,c[3]);c[2]===c[0]&&(c[2]+=1),c[3]===c[1]&&(c[3]+=1);var f=1/(c[2]-c[0]),d=1/(c[3]-c[1]),p=c[0],v=c[1],m=s.mallocFloat32(h*u.length*4),g=0;for(e=0;h>e;++e){r=i[2*e],n=i[2*e+1];for(var y=o[4*e],b=o[4*e+1],x=o[4*e+2],_=o[4*e+3],w=0;w<u.length;++w){var M=u[w],k=M[0],A=M[1];0>k?k*=y:k>0&&(k*=b),0>A?A*=x:A>0&&(A*=_),m[g++]=f*(r-p+k),m[g++]=d*(n-v+A),m[g++]=a*M[2]+(l+a)*M[4],m[g++]=a*M[3]+(l+a)*M[5]}}this.buffer.update(m),s.free(m)},c.dispose=function(){this.plot.removeObject(this),this.shader.dispose(),this.buffer.dispose()}},{"./lib/shaders":126,"gl-buffer":124,"gl-shader":203,"typedarray-pool":458}],126:[function(t,e,r){e.exports={vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec2 pixelOffset;\n\nuniform mat3 viewTransform;\nuniform vec2 pixelScale;\n\nvoid main() {\n vec3 scrPosition = viewTransform * vec3(position, 1);\n gl_Position = vec4(\n scrPosition.xy + scrPosition.z * pixelScale * pixelOffset,\n 0,\n scrPosition.z);\n}\n",fragment:"precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n"}},{}],127:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.shader=n,this.buffer=e,this.vao=r,this.pixelRatio=1,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.lineWidth=[1,1,1],this.capSize=[10,10,10],this.lineCount=[0,0,0],this.lineOffset=[0,0,0],this.opacity=1}function i(t,e){for(var r=0;3>r;++r)t[0][r]=Math.min(t[0][r],e[r]),t[1][r]=Math.max(t[1][r],e[r])}function o(t,e,r,n){for(var i=f[n],o=0;o<i.length;++o){var a=i[o];t.push(e[0],e[1],e[2],r[0],r[1],r[2],r[3],a[0],a[1],a[2])}return i.length}function a(t){var e=t.gl,r=s(e),i=l(e,[{buffer:r,type:e.FLOAT,size:3,offset:0,stride:40},{buffer:r,type:e.FLOAT,size:4,offset:12,stride:40},{buffer:r,type:e.FLOAT,size:3,offset:28,stride:40}]),o=u(e);o.attributes.position.location=0,o.attributes.color.location=1,o.attributes.offset.location=2;var a=new n(e,r,i,o);return a.update(t),a}e.exports=a;var s=t("gl-buffer"),l=t("gl-vao"),u=t("./shaders/index"),c=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],h=n.prototype;h.isOpaque=function(){return this.opacity>=1},h.isTransparent=function(){return this.opacity<1},h.drawTransparent=h.draw=function(t){var e=this.gl,r=this.shader.uniforms;this.shader.bind();var n=r.view=t.view||c,i=r.projection=t.projection||c;r.model=t.model||c,r.clipBounds=this.clipBounds,r.opacity=this.opacity;var o=n[12],a=n[13],s=n[14],l=n[15],u=this.pixelRatio*(i[3]*o+i[7]*a+i[11]*s+i[15]*l)/e.drawingBufferHeight;this.vao.bind();for(var h=0;3>h;++h)e.lineWidth(this.lineWidth[h]),r.capSize=this.capSize[h]*u,e.drawArrays(e.LINES,this.lineOffset[h],this.lineCount[h]);this.vao.unbind()};var f=function(){for(var t=new Array(3),e=0;3>e;++e){for(var r=[],n=1;2>=n;++n)for(var i=-1;1>=i;i+=2){var o=(n+e)%3,a=[0,0,0];a[o]=i,r.push(a)}t[e]=r}return t}();h.update=function(t){t=t||{},"lineWidth"in t&&(this.lineWidth=t.lineWidth,Array.isArray(this.lineWidth)||(this.lineWidth=[this.lineWidth,this.lineWidth,this.lineWidth])),"capSize"in t&&(this.capSize=t.capSize,Array.isArray(this.capSize)||(this.capSize=[this.capSize,this.capSize,this.capSize])),"opacity"in t&&(this.opacity=t.opacity);var e=t.color||[[0,0,0],[0,0,0],[0,0,0]],r=t.position,n=t.error;if(Array.isArray(e[0])||(e=[e,e,e]),r&&n){var a=[],s=r.length,l=0;this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.lineCount=[0,0,0];for(var u=0;3>u;++u){this.lineOffset[u]=l;t:for(var c=0;s>c;++c){for(var h=r[c],f=0;3>f;++f)if(isNaN(h[f])||!isFinite(h[f]))continue t;var d=n[c],p=e[u];if(Array.isArray(p[0])&&(p=e[c]),3===p.length&&(p=[p[0],p[1],p[2],1]),!isNaN(d[0][u])&&!isNaN(d[1][u])){if(d[0][u]<0){var v=h.slice();v[u]+=d[0][u],a.push(h[0],h[1],h[2],p[0],p[1],p[2],p[3],0,0,0,v[0],v[1],v[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,v),l+=2+o(a,v,p,u)}if(d[1][u]>0){var v=h.slice();v[u]+=d[1][u],a.push(h[0],h[1],h[2],p[0],p[1],p[2],p[3],0,0,0,v[0],v[1],v[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,v),l+=2+o(a,v,p,u)}}}this.lineCount[u]=l-this.lineOffset[u]}this.buffer.update(a)}},h.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()}},{"./shaders/index":128,"gl-buffer":124,"gl-vao":232}],128:[function(t,e,r){"use strict";var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, offset;\nattribute vec4 color;\nuniform mat4 model, view, projection;\nuniform float capSize;\nvarying vec4 fragColor;\nvarying vec3 fragPosition;\n\nvoid main() {\n vec4 worldPosition = model * vec4(position, 1.0);\n worldPosition = (worldPosition / worldPosition.w) + vec4(capSize * offset, 0.0);\n gl_Position = projection * view * worldPosition;\n fragColor = color;\n fragPosition = position;\n}",o="precision mediump float;\n#define GLSLIFY 1\nuniform vec3 clipBounds[2];\nuniform float opacity;\nvarying vec3 fragPosition;\nvarying vec4 fragColor;\n\nvoid main() {\n if(any(lessThan(fragPosition, clipBounds[0])) || any(greaterThan(fragPosition, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = opacity * fragColor;\n}";e.exports=function(t){return n(t,i,o,null,[{name:"position",type:"vec3"},{name:"offset",type:"vec3"},{name:"color",type:"vec4"}])}},{"gl-shader":203}],129:[function(t,e,r){"use strict";function n(t){var e=t.getParameter(t.FRAMEBUFFER_BINDING),r=t.getParameter(t.RENDERBUFFER_BINDING),n=t.getParameter(t.TEXTURE_BINDING_2D);return[e,r,n]}function i(t,e){t.bindFramebuffer(t.FRAMEBUFFER,e[0]),t.bindRenderbuffer(t.RENDERBUFFER,e[1]),t.bindTexture(t.TEXTURE_2D,e[2])}function o(t,e){var r=t.getParameter(e.MAX_COLOR_ATTACHMENTS_WEBGL);y=new Array(r+1);for(var n=0;r>=n;++n){for(var i=new Array(r),o=0;n>o;++o)i[o]=t.COLOR_ATTACHMENT0+o;for(var o=n;r>o;++o)i[o]=t.NONE;y[n]=i}}function a(t){switch(t){case p:throw new Error("gl-fbo: Framebuffer unsupported");case v:throw new Error("gl-fbo: Framebuffer incomplete attachment");case m:throw new Error("gl-fbo: Framebuffer incomplete dimensions");case g:throw new Error("gl-fbo: Framebuffer incomplete missing attachment");default:throw new Error("gl-fbo: Framebuffer failed for unspecified reason")}}function s(t,e,r,n,i,o){if(!n)return null;var a=d(t,e,r,i,n);return a.magFilter=t.NEAREST,a.minFilter=t.NEAREST,a.mipSamples=1,a.bind(),t.framebufferTexture2D(t.FRAMEBUFFER,o,t.TEXTURE_2D,a.handle,0),a}function l(t,e,r,n,i){var o=t.createRenderbuffer();return t.bindRenderbuffer(t.RENDERBUFFER,o),t.renderbufferStorage(t.RENDERBUFFER,n,e,r),t.framebufferRenderbuffer(t.FRAMEBUFFER,i,t.RENDERBUFFER,o),o}function u(t){var e=n(t.gl),r=t.gl,o=t.handle=r.createFramebuffer(),u=t._shape[0],c=t._shape[1],h=t.color.length,f=t._ext,d=t._useStencil,p=t._useDepth,v=t._colorType;r.bindFramebuffer(r.FRAMEBUFFER,o);for(var m=0;h>m;++m)t.color[m]=s(r,u,c,v,r.RGBA,r.COLOR_ATTACHMENT0+m);0===h?(t._color_rb=l(r,u,c,r.RGBA4,r.COLOR_ATTACHMENT0),f&&f.drawBuffersWEBGL(y[0])):h>1&&f.drawBuffersWEBGL(y[h]);var g=r.getExtension("WEBGL_depth_texture");g?d?t.depth=s(r,u,c,g.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p&&(t.depth=s(r,u,c,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):p&&d?t._depth_rb=l(r,u,c,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p?t._depth_rb=l(r,u,c,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):d&&(t._depth_rb=l(r,u,c,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var b=r.checkFramebufferStatus(r.FRAMEBUFFER);if(b!==r.FRAMEBUFFER_COMPLETE){t._destroyed=!0,r.bindFramebuffer(r.FRAMEBUFFER,null),r.deleteFramebuffer(t.handle),t.handle=null,t.depth&&(t.depth.dispose(),t.depth=null),t._depth_rb&&(r.deleteRenderbuffer(t._depth_rb),t._depth_rb=null);for(var m=0;m<t.color.length;++m)t.color[m].dispose(),t.color[m]=null;t._color_rb&&(r.deleteRenderbuffer(t._color_rb),t._color_rb=null),i(r,e),a(b)}i(r,e)}function c(t,e,r,n,i,o,a,s){this.gl=t,this._shape=[0|e,0|r],this._destroyed=!1,this._ext=s,this.color=new Array(i);for(var l=0;i>l;++l)this.color[l]=null;this._color_rb=null,this.depth=null,this._depth_rb=null,this._colorType=n,this._useDepth=o,this._useStencil=a;var c=this,h=[0|e,0|r];Object.defineProperties(h,{0:{get:function(){return c._shape[0]},set:function(t){return c.width=t}},1:{get:function(){return c._shape[1]},set:function(t){return c.height=t}}}),this._shapeVector=h,u(this)}function h(t,e,r){if(t._destroyed)throw new Error("gl-fbo: Can't resize destroyed FBO");if(t._shape[0]!==e||t._shape[1]!==r){var o=t.gl,s=o.getParameter(o.MAX_RENDERBUFFER_SIZE);if(0>e||e>s||0>r||r>s)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var l=n(o),u=0;u<t.color.length;++u)t.color[u].shape=t._shape;t._color_rb&&(o.bindRenderbuffer(o.RENDERBUFFER,t._color_rb),o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,t._shape[0],t._shape[1])),t.depth&&(t.depth.shape=t._shape),t._depth_rb&&(o.bindRenderbuffer(o.RENDERBUFFER,t._depth_rb),t._useDepth&&t._useStencil?o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,t._shape[0],t._shape[1]):t._useDepth?o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,t._shape[0],t._shape[1]):t._useStencil&&o.renderbufferStorage(o.RENDERBUFFER,o.STENCIL_INDEX,t._shape[0],t._shape[1])),o.bindFramebuffer(o.FRAMEBUFFER,t.handle);var c=o.checkFramebufferStatus(o.FRAMEBUFFER);c!==o.FRAMEBUFFER_COMPLETE&&(t.dispose(),i(o,l),a(c)),i(o,l)}}function f(t,e,r,n){p||(p=t.FRAMEBUFFER_UNSUPPORTED,v=t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT,m=t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS,g=t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);var i=t.getExtension("WEBGL_draw_buffers");if(!y&&i&&o(t,i),Array.isArray(e)&&(n=r,r=0|e[1],e=0|e[0]),"number"!=typeof e)throw new Error("gl-fbo: Missing shape parameter");var a=t.getParameter(t.MAX_RENDERBUFFER_SIZE);if(0>e||e>a||0>r||r>a)throw new Error("gl-fbo: Parameters are too large for FBO");n=n||{};var s=1;if("color"in n){if(s=Math.max(0|n.color,0),0>s)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(s>1){if(!i)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(s>t.getParameter(i.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+s+" draw buffers")}}var l=t.UNSIGNED_BYTE,u=t.getExtension("OES_texture_float");if(n.float&&s>0){if(!u)throw new Error("gl-fbo: Context does not support floating point textures");l=t.FLOAT}else n.preferFloat&&s>0&&u&&(l=t.FLOAT);var h=!0;"depth"in n&&(h=!!n.depth);var f=!1;return"stencil"in n&&(f=!!n.stencil),new c(t,e,r,l,s,h,f,i)}var d=t("gl-texture2d");e.exports=f;var p,v,m,g,y=null,b=c.prototype;Object.defineProperties(b,{shape:{get:function(){return this._destroyed?[0,0]:this._shapeVector},set:function(t){if(Array.isArray(t)||(t=[0|t,0|t]),2!==t.length)throw new Error("gl-fbo: Shape vector must be length 2");var e=0|t[0],r=0|t[1];return h(this,e,r),[e,r]},enumerable:!1},width:{get:function(){return this._destroyed?0:this._shape[0]},set:function(t){return t=0|t,h(this,t,this._shape[1]),t},enumerable:!1},height:{get:function(){return this._destroyed?0:this._shape[1]},set:function(t){return t=0|t,h(this,this._shape[0],t),t},enumerable:!1}}),b.bind=function(){if(!this._destroyed){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.handle),t.viewport(0,0,this._shape[0],this._shape[1])}},b.dispose=function(){if(!this._destroyed){this._destroyed=!0;var t=this.gl;t.deleteFramebuffer(this.handle),this.handle=null,this.depth&&(this.depth.dispose(),this.depth=null),this._depth_rb&&(t.deleteRenderbuffer(this._depth_rb),this._depth_rb=null);for(var e=0;e<this.color.length;++e)this.color[e].dispose(),this.color[e]=null;this._color_rb&&(t.deleteRenderbuffer(this._color_rb),this._color_rb=null)}}},{"gl-texture2d":228}],130:[function(t,e,r){r.lineVertex="precision mediump float;\n#define GLSLIFY 1\n\nfloat inverse_1_0(float m) {\n return 1.0 / m;\n}\n\nmat2 inverse_1_0(mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n}\n\nmat3 inverse_1_0(mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nmat4 inverse_1_0(mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n}\n\n\n\nattribute vec2 a, d;\n\nuniform mat3 matrix;\nuniform vec2 screenShape;\nuniform float width;\n\nvarying vec2 direction;\n\nvoid main() {\n vec2 dir = (matrix * vec3(d, 0)).xy;\n vec3 base = matrix * vec3(a, 1);\n vec2 n = 0.5 * width *\n normalize(screenShape.yx * vec2(dir.y, -dir.x)) / screenShape.xy;\n vec2 tangent = normalize(screenShape.xy * dir);\n if(dir.x < 0.0 || (dir.x == 0.0 && dir.y < 0.0)) {\n direction = -tangent;\n } else {\n direction = tangent;\n }\n gl_Position = vec4(base.xy/base.z + n, 0, 1);\n}\n",r.lineFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\nuniform vec2 screenShape;\nuniform sampler2D dashPattern;\nuniform float dashLength;\n\nvarying vec2 direction;\n\nvoid main() {\n float t = fract(dot(direction, gl_FragCoord.xy) / dashLength);\n vec4 pcolor = color * texture2D(dashPattern, vec2(t, 0.0)).r;\n gl_FragColor = vec4(pcolor.rgb * pcolor.a, pcolor.a);\n}\n",r.mitreVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 p;\n\nuniform mat3 matrix;\nuniform vec2 screenShape;\nuniform float radius;\n\nvoid main() {\n vec3 pp = matrix * vec3(p, 1);\n gl_Position = vec4(pp.xy, 0, pp.z);\n gl_PointSize = radius;\n}\n",r.mitreFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n if(length(gl_PointCoord.xy - 0.5) > 0.25) {\n discard;\n }\n gl_FragColor = vec4(color.rgb, color.a);\n}\n",r.pickVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 a, d;\nattribute vec4 pick0, pick1;\n\nuniform mat3 matrix;\nuniform vec2 screenShape;\nuniform float width;\n\nvarying vec4 pickA, pickB;\n\nfloat inverse_1_0(float m) {\n return 1.0 / m;\n}\n\nmat2 inverse_1_0(mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n}\n\nmat3 inverse_1_0(mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nmat4 inverse_1_0(mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n}\n\n\n\nvoid main() {\n vec3 base = matrix * vec3(a, 1);\n vec2 n = width *\n normalize(screenShape.yx * vec2(d.y, -d.x)) / screenShape.xy;\n gl_Position = vec4(base.xy/base.z + n, 0, 1);\n pickA = pick0;\n pickB = pick1;\n}\n",r.pickFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 pickOffset;\n\nvarying vec4 pickA, pickB;\n\nvoid main() {\n vec4 fragId = vec4(pickA.xyz, 0.0);\n if(pickB.w > pickA.w) {\n fragId.xyz = pickB.xyz;\n }\n\n fragId += pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n gl_FragColor = fragId / 255.0;\n}\n",r.fillVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 a, d;\n\nuniform mat3 matrix;\nuniform vec2 projectAxis;\nuniform float projectValue;\nuniform float depth;\n\nvoid main() {\n vec3 base = matrix * vec3(a, 1);\n vec2 p = base.xy / base.z;\n if(d.y < 0.0 || (d.y == 0.0 && d.x < 0.0)) {\n if(dot(p, projectAxis) < projectValue) {\n p = p * (1.0 - abs(projectAxis)) + projectAxis * projectValue;\n }\n }\n gl_Position = vec4(p, depth, 1);\n}\n",r.fillFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n"; },{}],131:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s){this.plot=t,this.dashPattern=e,this.lineBuffer=r,this.pickBuffer=n,this.lineShader=i,this.mitreShader=o,this.fillShader=a,this.pickShader=s,this.usingDashes=!1,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.width=1,this.color=[0,0,1,1],this.fill=[!1,!1,!1,!1],this.fillColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.data=null,this.numPoints=0,this.vertCount=0,this.pickOffset=0,this.lodBuffer=[]}function i(t){return t.map(function(t){return t.slice()})}function o(t,e){var r=t.gl,i=s(r),o=s(r),u=l(r,[1,1]),c=a(r,h.lineVertex,h.lineFragment),f=a(r,h.mitreVertex,h.mitreFragment),d=a(r,h.fillVertex,h.fillFragment),p=a(r,h.pickVertex,h.pickFragment),v=new n(t,u,i,o,c,f,d,p);return t.addObject(v),v.update(e),v}e.exports=o;var a=t("gl-shader"),s=t("gl-buffer"),l=t("gl-texture2d"),u=t("ndarray"),c=t("typedarray-pool"),h=t("./lib/shaders"),f=n.prototype;f.draw=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0],r=[1,0],n=[-1,0],i=[0,1],o=[0,-1];return function(){var a=this.plot,s=this.color,l=this.width,u=(this.numPoints,this.bounds),c=this.vertCount;if(c){var h=a.gl,f=a.viewBox,d=a.dataBox,p=a.pixelRatio,v=u[2]-u[0],m=u[3]-u[1],g=d[2]-d[0],y=d[3]-d[1],b=f[2]-f[0],x=f[3]-f[1];t[0]=2*v/g,t[4]=2*m/y,t[6]=2*(u[0]-d[0])/g-1,t[7]=2*(u[1]-d[1])/y-1,e[0]=b,e[1]=x;var _=this.lineBuffer;_.bind();var w=this.fill;if(w[0]||w[1]||w[2]||w[3]){var M=this.fillShader;M.bind();var k=M.uniforms;k.matrix=t,k.depth=a.nextDepthValue();var A=M.attributes;A.a.pointer(h.FLOAT,!1,16,0),A.d.pointer(h.FLOAT,!1,16,8),h.depthMask(!0),h.enable(h.DEPTH_TEST);var T=this.fillColor;w[0]&&(k.color=T[0],k.projectAxis=n,k.projectValue=1,h.drawArrays(h.TRIANGLES,0,c)),w[1]&&(k.color=T[1],k.projectAxis=o,k.projectValue=1,h.drawArrays(h.TRIANGLES,0,c)),w[2]&&(k.color=T[2],k.projectAxis=r,k.projectValue=1,h.drawArrays(h.TRIANGLES,0,c)),w[3]&&(k.color=T[3],k.projectAxis=i,k.projectValue=1,h.drawArrays(h.TRIANGLES,0,c)),h.depthMask(!1),h.disable(h.DEPTH_TEST)}var E=this.lineShader;E.bind();var S=E.uniforms;S.matrix=t,S.color=s,S.width=l*p,S.screenShape=e,S.dashPattern=this.dashPattern.bind(),S.dashLength=this.dashLength*p;var L=E.attributes;if(L.a.pointer(h.FLOAT,!1,16,0),L.d.pointer(h.FLOAT,!1,16,8),h.drawArrays(h.TRIANGLES,0,c),l>2&&!this.usingDashes){var z=this.mitreShader;z.bind();var I=z.uniforms;I.matrix=t,I.color=s,I.screenShape=e,I.radius=l*p,z.attributes.p.pointer(h.FLOAT,!1,48,0),h.drawArrays(h.POINTS,0,c/3|0)}}}}(),f.drawPick=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0],r=[0,0,0,0];return function(n){var i=this.plot,o=this.pickShader,a=this.lineBuffer,s=this.pickBuffer,l=this.width,u=this.numPoints,c=this.bounds,h=this.vertCount,f=i.gl,d=i.viewBox,p=i.dataBox,v=i.pickPixelRatio,m=c[2]-c[0],g=c[3]-c[1],y=p[2]-p[0],b=p[3]-p[1],x=d[2]-d[0],_=d[3]-d[1];if(this.pickOffset=n,!h)return n+u;t[0]=2*m/y,t[4]=2*g/b,t[6]=2*(c[0]-p[0])/y-1,t[7]=2*(c[1]-p[1])/b-1,e[0]=x,e[1]=_,r[0]=255&n,r[1]=n>>>8&255,r[2]=n>>>16&255,r[3]=n>>>24,o.bind();var w=o.uniforms;w.matrix=t,w.width=l*v,w.pickOffset=r,w.screenShape=e;var M=o.attributes;return a.bind(),M.a.pointer(f.FLOAT,!1,16,0),M.d.pointer(f.FLOAT,!1,16,8),s.bind(),M.pick0.pointer(f.UNSIGNED_BYTE,!1,8,0),M.pick1.pointer(f.UNSIGNED_BYTE,!1,8,4),f.drawArrays(f.TRIANGLES,0,h),n+u}}(),f.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(n>r||r>=n+i)return null;var o=r-n,a=this.data;return{object:this,pointId:o,dataCoord:[a[2*o],a[2*o+1]]}},f.update=function(t){t=t||{};var e=this.plot.gl;!!t.connectGaps;this.color=(t.color||[0,0,1,1]).slice(),this.width=+(t.width||1),this.fill=(t.fill||[!1,!1,!1,!1]).slice(),this.fillColor=i(t.fillColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);for(var r=t.dashes||[1],n=0,o=0;o<r.length;++o)n+=r[o];for(var a=c.mallocUint8(n),s=0,h=255,o=0;o<r.length;++o){for(var f=0;f<r[o];++f)a[s++]=h;h^=255}this.dashPattern.dispose(),this.usingDashes=r.length>1,this.dashPattern=l(e,u(a,[n,1,4],[1,0,0])),this.dashPattern.minFilter=e.NEAREST,this.dashPattern.magFilter=e.NEAREST,this.dashLength=n,c.free(a);var d=t.positions;this.data=d;var p=this.bounds;p[0]=p[1]=1/0,p[2]=p[3]=-(1/0);var v=this.numPoints=d.length>>>1;if(0!==v){for(var o=0;v>o;++o){var m=d[2*o],g=d[2*o+1];isNaN(m)||isNaN(g)||(p[0]=Math.min(p[0],m),p[1]=Math.min(p[1],g),p[2]=Math.max(p[2],m),p[3]=Math.max(p[3],g))}p[0]===p[2]&&(p[2]+=1),p[3]===p[1]&&(p[3]+=1);for(var y=c.mallocFloat32(24*(v-1)),b=c.mallocUint32(12*(v-1)),x=y.length,_=b.length,s=v,w=0;s>1;){var M=--s,m=d[2*s],g=d[2*s+1],k=M-1,A=d[2*k],T=d[2*k+1];if(!(isNaN(m)||isNaN(g)||isNaN(A)||isNaN(T))){w+=1,m=(m-p[0])/(p[2]-p[0]),g=(g-p[1])/(p[3]-p[1]),A=(A-p[0])/(p[2]-p[0]),T=(T-p[1])/(p[3]-p[1]);var E=A-m,S=T-g,L=M|1<<24,z=M-1,I=M,P=M-1|1<<24;y[--x]=-S,y[--x]=-E,y[--x]=g,y[--x]=m,b[--_]=L,b[--_]=z,y[--x]=S,y[--x]=E,y[--x]=T,y[--x]=A,b[--_]=I,b[--_]=P,y[--x]=-S,y[--x]=-E,y[--x]=T,y[--x]=A,b[--_]=I,b[--_]=P,y[--x]=S,y[--x]=E,y[--x]=T,y[--x]=A,b[--_]=I,b[--_]=P,y[--x]=-S,y[--x]=-E,y[--x]=g,y[--x]=m,b[--_]=L,b[--_]=z,y[--x]=S,y[--x]=E,y[--x]=g,y[--x]=m,b[--_]=L,b[--_]=z}}this.vertCount=6*w,this.lineBuffer.update(y.subarray(x)),this.pickBuffer.update(b.subarray(_)),c.free(y),c.free(b)}},f.dispose=function(){this.plot.removeObject(this),this.lineBuffer.dispose(),this.pickBuffer.dispose(),this.lineShader.dispose(),this.mitreShader.dispose(),this.fillShader.dispose(),this.pickShader.dispose(),this.dashPattern.dispose()}},{"./lib/shaders":130,"gl-buffer":124,"gl-shader":203,"gl-texture2d":228,ndarray:433,"typedarray-pool":458}],132:[function(t,e,r){var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, nextPosition;\nattribute float arcLength, lineWidth;\nattribute vec4 color;\n\nuniform vec2 screenShape;\nuniform float pixelRatio;\nuniform mat4 model, view, projection;\n\nvarying vec4 fragColor;\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\n\nvoid main() {\n vec4 projected = projection * view * model * vec4(position, 1.0);\n vec4 tangentClip = projection * view * model * vec4(nextPosition - position, 0.0);\n vec2 tangent = normalize(screenShape * tangentClip.xy);\n vec2 offset = 0.5 * pixelRatio * lineWidth * vec2(tangent.y, -tangent.x) / screenShape;\n\n gl_Position = vec4(projected.xy + projected.w * offset, projected.zw);\n\n worldPosition = position;\n pixelArcLength = arcLength;\n fragColor = color;\n}\n",o="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform sampler2D dashTexture;\nuniform float dashScale;\nuniform float opacity;\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if(any(lessThan(worldPosition, clipBounds[0])) || any(greaterThan(worldPosition, clipBounds[1]))) {\n discard;\n }\n float dashWeight = texture2D(dashTexture, vec2(dashScale * pixelArcLength, 0)).r;\n if(dashWeight < 0.5) {\n discard;\n }\n gl_FragColor = fragColor * opacity;\n}\n",a="precision mediump float;\n#define GLSLIFY 1\n\n#define FLOAT_MAX 1.70141184e38\n#define FLOAT_MIN 1.17549435e-38\n\nlowp vec4 encode_float_1_0(highp float v) {\n highp float av = abs(v);\n\n //Handle special cases\n if(av < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n //Compute exponent and mantissa\n highp float e = floor(log2(av));\n highp float m = av * pow(2.0, -e) - 1.0;\n \n //Unpack mantissa\n c[1] = floor(128.0 * m);\n m -= c[1] / 128.0;\n c[2] = floor(32768.0 * m);\n m -= c[2] / 32768.0;\n c[3] = floor(8388608.0 * m);\n \n //Unpack exponent\n highp float ebias = e + 127.0;\n c[0] = floor(ebias / 2.0);\n ebias -= c[0] * 2.0;\n c[1] += floor(ebias) * 128.0; \n\n //Unpack sign bit\n c[0] += 128.0 * step(0.0, -v);\n\n //Scale back to range\n return c / 255.0;\n}\n\n\n\nuniform float pickId;\nuniform vec3 clipBounds[2];\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if(any(lessThan(worldPosition, clipBounds[0])) || any(greaterThan(worldPosition, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId/255.0, encode_float_1_0(pixelArcLength).xyz);\n}",s=[{name:"position",type:"vec3"},{name:"nextPosition",type:"vec3"},{name:"arcLength",type:"float"},{name:"lineWidth",type:"float"},{name:"color",type:"vec4"}];r.createShader=function(t){return n(t,i,o,null,s)},r.createPickShader=function(t){return n(t,i,a,null,s)}},{"gl-shader":203}],133:[function(t,e,r){"use strict";function n(t,e){for(var r=0,n=0;3>n;++n){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}function i(t){for(var e=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],r=0;3>r;++r)e[0][r]=Math.max(t[0][r],e[0][r]),e[1][r]=Math.min(t[1][r],e[1][r]);return e}function o(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function a(t,e,r,n,i,o){this.gl=t,this.shader=e,this.pickShader=r,this.buffer=n,this.vao=i,this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=o,this.dashScale=1,this.opacity=1,this.dirty=!0,this.pixelRatio=1}function s(t){var e=t.gl||t.scene&&t.scene.gl,r=v(e);r.attributes.position.location=0,r.attributes.nextPosition.location=1,r.attributes.arcLength.location=2,r.attributes.lineWidth.location=3,r.attributes.color.location=4;var n=m(e);n.attributes.position.location=0,n.attributes.nextPosition.location=1,n.attributes.arcLength.location=2,n.attributes.lineWidth.location=3,n.attributes.color.location=4;for(var i=l(e),o=u(e,[{buffer:i,size:3,offset:0,stride:48},{buffer:i,size:3,offset:12,stride:48},{buffer:i,size:1,offset:24,stride:48},{buffer:i,size:1,offset:28,stride:48},{buffer:i,size:4,offset:32,stride:48}]),s=d(new Array(1024),[256,1,4]),h=0;1024>h;++h)s.data[h]=255;var f=c(e,s);f.wrap=e.REPEAT;var p=new a(e,r,n,i,o,f);return p.update(t),p}e.exports=s;var l=t("gl-buffer"),u=t("gl-vao"),c=t("gl-texture2d"),h=t("glsl-read-float"),f=t("binary-search-bounds"),d=t("ndarray"),p=t("./lib/shaders"),v=p.createShader,m=p.createPickShader,g=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],y=a.prototype;y.isTransparent=function(){return this.opacity<1},y.isOpaque=function(){return this.opacity>=1},y.pickSlots=1,y.setPickBase=function(t){this.pickId=t},y.drawTransparent=y.draw=function(t){var e=this.gl,r=this.shader,n=this.vao;r.bind(),r.uniforms={model:t.model||g,view:t.view||g,projection:t.projection||g,clipBounds:i(this.clipBounds),dashTexture:this.texture.bind(),dashScale:this.dashScale/this.arcLength[this.arcLength.length-1],opacity:this.opacity,screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.drawPick=function(t){var e=this.gl,r=this.pickShader,n=this.vao;r.bind(),r.uniforms={model:t.model||g,view:t.view||g,projection:t.projection||g,pickId:this.pickId,clipBounds:i(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.update=function(t){var e,r;this.dirty=!0;var i=!!t.connectGaps;"dashScale"in t&&(this.dashScale=t.dashScale),"opacity"in t&&(this.opacity=+t.opacity);var o=t.position||t.positions;if(o){var a=t.color||t.colors||[0,0,0,1],s=t.lineWidth||1,l=[],u=[],c=[],h=0,p=0,v=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],m=!1;t:for(e=1;e<o.length;++e){var g=o[e-1],y=o[e];for(u.push(h),c.push(g.slice()),r=0;3>r;++r){if(isNaN(g[r])||isNaN(y[r])||!isFinite(g[r])||!isFinite(y[r])){if(!i&&l.length>0){for(var b=0;24>b;++b)l.push(l[l.length-12]);p+=2,m=!0}continue t}v[0][r]=Math.min(v[0][r],g[r],y[r]),v[1][r]=Math.max(v[1][r],g[r],y[r])}var x,_;Array.isArray(a[0])?(x=a[e-1],_=a[e]):x=_=a,3===x.length&&(x=[x[0],x[1],x[2],1]),3===_.length&&(_=[_[0],_[1],_[2],1]);var w;w=Array.isArray(s)?s[e-1]:s;var M=h;if(h+=n(g,y),m){for(r=0;2>r;++r)l.push(g[0],g[1],g[2],y[0],y[1],y[2],M,w,x[0],x[1],x[2],x[3]);p+=2,m=!1}l.push(g[0],g[1],g[2],y[0],y[1],y[2],M,w,x[0],x[1],x[2],x[3],g[0],g[1],g[2],y[0],y[1],y[2],M,-w,x[0],x[1],x[2],x[3],y[0],y[1],y[2],g[0],g[1],g[2],h,-w,_[0],_[1],_[2],_[3],y[0],y[1],y[2],g[0],g[1],g[2],h,w,_[0],_[1],_[2],_[3]),p+=4}if(this.buffer.update(l),u.push(h),c.push(o[o.length-1].slice()),this.bounds=v,this.vertexCount=p,this.points=c,this.arcLength=u,"dashes"in t){var k=t.dashes,A=k.slice();for(A.unshift(0),e=1;e<A.length;++e)A[e]=A[e-1]+A[e];var T=d(new Array(1024),[256,1,4]);for(e=0;256>e;++e){for(r=0;4>r;++r)T.set(e,0,r,0);1&f.le(A,A[A.length-1]*e/255)?T.set(e,0,0,0):T.set(e,0,0,255)}this.texture.setPixels(T)}}},y.dispose=function(){this.shader.dispose(),this.vao.dispose(),this.buffer.dispose()},y.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=h(t.value[0],t.value[1],t.value[2],0),r=f.le(this.arcLength,e);if(0>r)return null;if(r===this.arcLength.length-1)return new o(this.arcLength[this.arcLength.length-1],this.points[this.points.length-1].slice(),r);for(var n=this.points[r],i=this.points[Math.min(r+1,this.points.length-1)],a=(e-this.arcLength[r])/(this.arcLength[r+1]-this.arcLength[r]),s=1-a,l=[0,0,0],u=0;3>u;++u)l[u]=s*n[u]+a*i[u];var c=Math.min(.5>a?r:r+1,this.points.length-1);return new o(e,l,c,this.points[c])}},{"./lib/shaders":132,"binary-search-bounds":134,"gl-buffer":124,"gl-texture2d":228,"gl-vao":232,"glsl-read-float":135,ndarray:433}],134:[function(t,e,r){arguments[4][22][0].apply(r,arguments)},{dup:22}],135:[function(t,e,r){function n(t,e,r,n){return i[0]=n,i[1]=r,i[2]=e,i[3]=t,o[0]}e.exports=n;var i=new Uint8Array(4),o=new Float32Array(i.buffer)},{}],136:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=c*a-s*u,f=-c*o+s*l,d=u*o-a*l,p=r*h+n*f+i*d;return p?(p=1/p,t[0]=h*p,t[1]=(-c*n+i*u)*p,t[2]=(s*n-i*a)*p,t[3]=f*p,t[4]=(c*r-i*l)*p,t[5]=(-s*r+i*o)*p,t[6]=d*p,t[7]=(-u*r+n*l)*p,t[8]=(a*r-n*o)*p,t):null}e.exports=n},{}],137:[function(t,e,r){function n(t){var e=new Float32Array(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}e.exports=n},{}],138:[function(t,e,r){function n(){var t=new Float32Array(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}e.exports=n},{}],139:[function(t,e,r){function n(t){var e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],c=t[9],h=t[10],f=t[11],d=t[12],p=t[13],v=t[14],m=t[15],g=e*a-r*o,y=e*s-n*o,b=e*l-i*o,x=r*s-n*a,_=r*l-i*a,w=n*l-i*s,M=u*p-c*d,k=u*v-h*d,A=u*m-f*d,T=c*v-h*p,E=c*m-f*p,S=h*m-f*v;return g*S-y*E+b*T+x*A-_*k+w*M}e.exports=n},{}],140:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,s=n+n,l=i+i,u=r*a,c=n*a,h=n*s,f=i*a,d=i*s,p=i*l,v=o*a,m=o*s,g=o*l;return t[0]=1-h-p,t[1]=c+g,t[2]=f-m,t[3]=0,t[4]=c-g,t[5]=1-u-p,t[6]=d+v,t[7]=0,t[8]=f+m,t[9]=d-v,t[10]=1-u-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=n},{}],141:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=n+n,l=i+i,u=o+o,c=n*s,h=n*l,f=n*u,d=i*l,p=i*u,v=o*u,m=a*s,g=a*l,y=a*u;return t[0]=1-(d+v),t[1]=h+y,t[2]=f-g,t[3]=0,t[4]=h-y,t[5]=1-(c+v),t[6]=p+m,t[7]=0,t[8]=f+g,t[9]=p-m,t[10]=1-(c+d),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}e.exports=n},{}],142:[function(t,e,r){function n(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}e.exports=n},{}],143:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=e[9],f=e[10],d=e[11],p=e[12],v=e[13],m=e[14],g=e[15],y=r*s-n*a,b=r*l-i*a,x=r*u-o*a,_=n*l-i*s,w=n*u-o*s,M=i*u-o*l,k=c*v-h*p,A=c*m-f*p,T=c*g-d*p,E=h*m-f*v,S=h*g-d*v,L=f*g-d*m,z=y*L-b*S+x*E+_*T-w*A+M*k;return z?(z=1/z,t[0]=(s*L-l*S+u*E)*z,t[1]=(i*S-n*L-o*E)*z,t[2]=(v*M-m*w+g*_)*z,t[3]=(f*w-h*M-d*_)*z,t[4]=(l*T-a*L-u*A)*z,t[5]=(r*L-i*T+o*A)*z,t[6]=(m*x-p*M-g*b)*z,t[7]=(c*M-f*x+d*b)*z,t[8]=(a*S-s*T+u*k)*z,t[9]=(n*T-r*S-o*k)*z,t[10]=(p*w-v*x+g*y)*z,t[11]=(h*x-c*w-d*y)*z,t[12]=(s*A-a*E-l*k)*z,t[13]=(r*E-n*A+i*k)*z,t[14]=(v*b-p*_-m*y)*z,t[15]=(c*_-h*b+f*y)*z,t):null}e.exports=n},{}],144:[function(t,e,r){function n(t,e,r,n){var o,a,s,l,u,c,h,f,d,p,v=e[0],m=e[1],g=e[2],y=n[0],b=n[1],x=n[2],_=r[0],w=r[1],M=r[2];return Math.abs(v-_)<1e-6&&Math.abs(m-w)<1e-6&&Math.abs(g-M)<1e-6?i(t):(h=v-_,f=m-w,d=g-M,p=1/Math.sqrt(h*h+f*f+d*d),h*=p,f*=p,d*=p,o=b*d-x*f,a=x*h-y*d,s=y*f-b*h,p=Math.sqrt(o*o+a*a+s*s),p?(p=1/p,o*=p,a*=p,s*=p):(o=0,a=0,s=0),l=f*s-d*a,u=d*o-h*s,c=h*a-f*o,p=Math.sqrt(l*l+u*u+c*c),p?(p=1/p,l*=p,u*=p,c*=p):(l=0,u=0,c=0),t[0]=o,t[1]=l,t[2]=h,t[3]=0,t[4]=a,t[5]=u,t[6]=f,t[7]=0,t[8]=s,t[9]=c,t[10]=d,t[11]=0,t[12]=-(o*v+a*m+s*g),t[13]=-(l*v+u*m+c*g),t[14]=-(h*v+f*m+d*g),t[15]=1,t)}var i=t("./identity");e.exports=n},{"./identity":142}],145:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],f=e[9],d=e[10],p=e[11],v=e[12],m=e[13],g=e[14],y=e[15],b=r[0],x=r[1],_=r[2],w=r[3];return t[0]=b*n+x*s+_*h+w*v,t[1]=b*i+x*l+_*f+w*m,t[2]=b*o+x*u+_*d+w*g,t[3]=b*a+x*c+_*p+w*y,b=r[4],x=r[5],_=r[6],w=r[7],t[4]=b*n+x*s+_*h+w*v,t[5]=b*i+x*l+_*f+w*m,t[6]=b*o+x*u+_*d+w*g,t[7]=b*a+x*c+_*p+w*y,b=r[8],x=r[9],_=r[10],w=r[11],t[8]=b*n+x*s+_*h+w*v,t[9]=b*i+x*l+_*f+w*m,t[10]=b*o+x*u+_*d+w*g,t[11]=b*a+x*c+_*p+w*y,b=r[12],x=r[13],_=r[14],w=r[15],t[12]=b*n+x*s+_*h+w*v,t[13]=b*i+x*l+_*f+w*m,t[14]=b*o+x*u+_*d+w*g,t[15]=b*a+x*c+_*p+w*y,t}e.exports=n},{}],146:[function(t,e,r){function n(t,e,r,n,i){var o=1/Math.tan(e/2),a=1/(n-i);return t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*a,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*a,t[15]=0,t}e.exports=n},{}],147:[function(t,e,r){function n(t,e,r,n){var i,o,a,s,l,u,c,h,f,d,p,v,m,g,y,b,x,_,w,M,k,A,T,E,S=n[0],L=n[1],z=n[2],I=Math.sqrt(S*S+L*L+z*z);return Math.abs(I)<1e-6?null:(I=1/I,S*=I,L*=I,z*=I,i=Math.sin(r),o=Math.cos(r),a=1-o,s=e[0],l=e[1],u=e[2],c=e[3],h=e[4],f=e[5],d=e[6],p=e[7],v=e[8],m=e[9],g=e[10],y=e[11],b=S*S*a+o,x=L*S*a+z*i,_=z*S*a-L*i,w=S*L*a-z*i,M=L*L*a+o,k=z*L*a+S*i,A=S*z*a+L*i,T=L*z*a-S*i,E=z*z*a+o,t[0]=s*b+h*x+v*_,t[1]=l*b+f*x+m*_,t[2]=u*b+d*x+g*_,t[3]=c*b+p*x+y*_,t[4]=s*w+h*M+v*k,t[5]=l*w+f*M+m*k,t[6]=u*w+d*M+g*k,t[7]=c*w+p*M+y*k,t[8]=s*A+h*T+v*E,t[9]=l*A+f*T+m*E,t[10]=u*A+d*T+g*E,t[11]=c*A+p*T+y*E,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}e.exports=n},{}],148:[function(t,e,r){function n(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],h=e[10],f=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+u*n,t[5]=a*i+c*n,t[6]=s*i+h*n,t[7]=l*i+f*n,t[8]=u*i-o*n,t[9]=c*i-a*n,t[10]=h*i-s*n,t[11]=f*i-l*n,t}e.exports=n},{}],149:[function(t,e,r){function n(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],u=e[8],c=e[9],h=e[10],f=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-u*n,t[1]=a*i-c*n,t[2]=s*i-h*n,t[3]=l*i-f*n,t[8]=o*n+u*i,t[9]=a*n+c*i,t[10]=s*n+h*i,t[11]=l*n+f*i,t}e.exports=n},{}],150:[function(t,e,r){function n(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],u=e[4],c=e[5],h=e[6],f=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+u*n,t[1]=a*i+c*n,t[2]=s*i+h*n,t[3]=l*i+f*n,t[4]=u*i-o*n,t[5]=c*i-a*n,t[6]=h*i-s*n,t[7]=f*i-l*n,t}e.exports=n},{}],151:[function(t,e,r){function n(t,e,r){var n=r[0],i=r[1],o=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}e.exports=n},{}],152:[function(t,e,r){function n(t,e,r){var n,i,o,a,s,l,u,c,h,f,d,p,v=r[0],m=r[1],g=r[2];return e===t?(t[12]=e[0]*v+e[4]*m+e[8]*g+e[12],t[13]=e[1]*v+e[5]*m+e[9]*g+e[13],t[14]=e[2]*v+e[6]*m+e[10]*g+e[14],t[15]=e[3]*v+e[7]*m+e[11]*g+e[15]):(n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],f=e[9],d=e[10],p=e[11],t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=u,t[7]=c,t[8]=h,t[9]=f,t[10]=d,t[11]=p,t[12]=n*v+s*m+h*g+e[12],t[13]=i*v+l*m+f*g+e[13],t[14]=o*v+u*m+d*g+e[14],t[15]=a*v+c*m+p*g+e[15]),t}e.exports=n},{}],153:[function(t,e,r){function n(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=i,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}e.exports=n},{}],154:[function(t,e,r){"use strict";function n(t,e){for(var r=[0,0,0,0],n=0;4>n;++n)for(var i=0;4>i;++i)r[i]+=t[4*n+i]*e[n];return r}function i(t,e,r,i,o){for(var a=n(i,n(r,n(e,[t[0],t[1],t[2],1]))),s=0;3>s;++s)a[s]/=a[3];return[.5*o[0]*(1+a[0]),.5*o[1]*(1-a[1])]}function o(t,e){if(2===t.length){for(var r=0,n=0,i=0;2>i;++i)r+=Math.pow(e[i]-t[0][i],2),n+=Math.pow(e[i]-t[1][i],2);return r=Math.sqrt(r),n=Math.sqrt(n),1e-6>r+n?[1,0]:[n/(r+n),r/(n+r)]}if(3===t.length){var o=[0,0];return u(t[0],t[1],t[2],e,o),l(t,o)}return[]}function a(t,e){for(var r=[0,0,0],n=0;n<t.length;++n)for(var i=t[n],o=e[n],a=0;3>a;++a)r[a]+=o*i[a];return r}function s(t,e,r,n,s,l){if(1===t.length)return[0,t[0].slice()];for(var u=new Array(t.length),c=0;c<t.length;++c)u[c]=i(t[c],r,n,s,l);for(var h=0,f=1/0,c=0;c<u.length;++c){for(var d=0,p=0;2>p;++p)d+=Math.pow(u[c][p]-e[p],2);f>d&&(f=d,h=c)}for(var v=o(u,e),m=0,c=0;3>c;++c){if(v[c]<-.001||v[c]>1.0001)return null;m+=v[c]}return Math.abs(m-1)>.001?null:[h,a(t,v),v]}var l=t("barycentric"),u=t("polytope-closest-point/lib/closest_point_2d.js");e.exports=s},{barycentric:157,"polytope-closest-point/lib/closest_point_2d.js":159}],155:[function(t,e,r){var n="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec4 m_position = model * vec4(position, 1.0);\n vec4 t_position = view * m_position;\n gl_Position = projection * t_position;\n f_color = color;\n f_normal = normal;\n f_data = position;\n f_eyeDirection = eyePosition - position;\n f_lightDirection = lightPosition - position;\n f_uv = uv;\n}",i="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat cookTorranceSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness,\n float fresnel) {\n\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n //Half angle vector\n vec3 H = normalize(lightDirection + viewDirection);\n\n //Geometric term\n float NdotH = max(dot(surfaceNormal, H), 0.0);\n float VdotH = max(dot(viewDirection, H), 0.000001);\n float LdotH = max(dot(lightDirection, H), 0.000001);\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\n float G = min(1.0, min(G1, G2));\n \n //Distribution term\n float D = beckmannDistribution_2_0(NdotH, roughness);\n\n //Fresnel term\n float F = pow(1.0 - VdotN, fresnel);\n\n //Multiply terms and done\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\n\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n \n if(!gl_FrontFacing) {\n N = -N;\n }\n\n float specular = cookTorranceSpecular_1_1(L, V, N, roughness, fresnel);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = f_color * texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}",o="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model, view, projection;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_color = color;\n f_data = position;\n f_uv = uv;\n}",a="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",s="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\nattribute float pointSize;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n }\n gl_PointSize = pointSize;\n f_color = color;\n f_uv = uv;\n}",l="precision mediump float;\n#define GLSLIFY 1\n\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec2 pointR = gl_PointCoord.xy - vec2(0.5,0.5);\n if(dot(pointR, pointR) > 0.25) {\n discard;\n }\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",u="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_id = id;\n f_position = position;\n}",c="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}",h="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute float pointSize;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n gl_PointSize = pointSize;\n }\n f_id = id;\n f_position = position;\n}",f="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n}",d="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n";r.meshShader={vertex:n,fragment:i,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:o,fragment:a,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:s,fragment:l,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:u,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:h,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:f,fragment:d,attributes:[{name:"position",type:"vec3"}]}},{}],156:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s,l,u,c,h,f,d,p,v,m,g,y,b,x,_,w,M,k,A,T){this.gl=t,this.cells=[],this.positions=[],this.intensity=[],this.texture=e,this.dirty=!0,this.triShader=r,this.lineShader=n,this.pointShader=i,this.pickShader=o,this.pointPickShader=a,this.contourShader=s,this.trianglePositions=l,this.triangleColors=c,this.triangleNormals=f,this.triangleUVs=h,this.triangleIds=u,this.triangleVAO=d,this.triangleCount=0,this.lineWidth=1,this.edgePositions=p,this.edgeColors=m,this.edgeUVs=g,this.edgeIds=v,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=b,this.pointColors=_,this.pointUVs=w,this.pointSizes=M,this.pointIds=x,this.pointVAO=k,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=A,this.contourVAO=T,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickId=1,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.lightPosition=[1e5,1e5,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.opacity=1,this._model=D,this._view=D,this._projection=D,this._resolution=[1,1]}function i(t){for(var e=k({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;256>n;++n){for(var i=e[n],o=0;3>o;++o)r[4*n+o]=i[o];r[4*n+3]=255*i[3]}return M(r,[256,256,4],[4,0,1])}function o(t,e,r){for(var n=new Array(e),i=0;e>i;++i)n[i]=0;for(var o=t.length,i=0;o>i;++i)for(var a=t[i],s=0;s<a.length;++s)n[a[s]]=r[i];return n}function a(t){for(var e=t.length,r=new Array(e),n=0;e>n;++n)r[n]=t[n][2];return r}function s(t){var e=m(t,L);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.normal.location=4,e}function l(t){var e=m(t,z);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e}function u(t){var e=m(t,I);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.pointSize.location=4,e}function c(t){var e=m(t,P);return e.attributes.position.location=0,e.attributes.id.location=1,e}function h(t){var e=m(t,C);return e.attributes.position.location=0,e.attributes.id.location=1,e.attributes.pointSize.location=4,e}function f(t){var e=m(t,R);return e.attributes.position.location=0,e}function d(t){var e=t.gl,r=s(e),i=l(e),o=u(e),a=c(e),d=h(e),p=f(e),v=b(e,M(new Uint8Array([255,255,255,255]),[1,1,4]));v.generateMipmap(),v.minFilter=e.LINEAR_MIPMAP_LINEAR,v.magFilter=e.LINEAR;var m=g(e),x=g(e),_=g(e),w=g(e),k=g(e),A=y(e,[{buffer:m,type:e.FLOAT,size:3},{buffer:k,type:e.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:x,type:e.FLOAT,size:4},{buffer:_,type:e.FLOAT,size:2},{buffer:w,type:e.FLOAT,size:3}]),T=g(e),E=g(e),S=g(e),L=g(e),z=y(e,[{buffer:T,type:e.FLOAT,size:3},{buffer:L,type:e.UNSIGNED_BYTE, size:4,normalized:!0},{buffer:E,type:e.FLOAT,size:4},{buffer:S,type:e.FLOAT,size:2}]),I=g(e),P=g(e),C=g(e),R=g(e),D=g(e),O=y(e,[{buffer:I,type:e.FLOAT,size:3},{buffer:D,type:e.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:P,type:e.FLOAT,size:4},{buffer:C,type:e.FLOAT,size:2},{buffer:R,type:e.FLOAT,size:1}]),F=g(e),j=y(e,[{buffer:F,type:e.FLOAT,size:3}]),N=new n(e,v,r,i,o,a,d,p,m,k,x,_,w,A,T,L,E,S,z,I,D,P,C,R,O,F,j);return N.update(t),N}var p=1e-6,v=1e-6,m=t("gl-shader"),g=t("gl-buffer"),y=t("gl-vao"),b=t("gl-texture2d"),x=t("normals"),_=t("gl-mat4/multiply"),w=t("gl-mat4/invert"),M=t("ndarray"),k=t("colormap"),A=t("simplicial-complex-contour"),T=t("typedarray-pool"),E=t("./lib/shaders"),S=t("./lib/closest-point"),L=E.meshShader,z=E.wireShader,I=E.pointShader,P=E.pickShader,C=E.pointPickShader,R=E.contourShader,D=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],O=n.prototype;O.isOpaque=function(){return this.opacity>=1},O.isTransparent=function(){return this.opacity<1},O.pickSlots=1,O.setPickBase=function(t){this.pickId=t},O.highlight=function(t){if(!t||!this.contourEnable)return void(this.contourCount=0);for(var e=A(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,o=r.length,a=T.mallocFloat32(6*o),s=0,l=0;o>l;++l)for(var u=r[l],c=0;2>c;++c){var h=u[0];2===u.length&&(h=u[c]);for(var f=n[h][0],d=n[h][1],p=i[h],v=1-p,m=this.positions[f],g=this.positions[d],y=0;3>y;++y)a[s++]=p*m[y]+v*g[y]}this.contourCount=s/3|0,this.contourPositions.update(a.subarray(0,s)),T.free(a)},O.update=function(t){t=t||{};var e=this.gl;this.dirty=!0,"contourEnable"in t&&(this.contourEnable=t.contourEnable),"contourColor"in t&&(this.contourColor=t.contourColor),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"lightPosition"in t&&(this.lightPosition=t.lightPosition),"opacity"in t&&(this.opacity=t.opacity),"ambient"in t&&(this.ambientLight=t.ambient),"diffuse"in t&&(this.diffuseLight=t.diffuse),"specular"in t&&(this.specularLight=t.specular),"roughness"in t&&(this.roughness=t.roughness),"fresnel"in t&&(this.fresnel=t.fresnel),t.texture?(this.texture.dispose(),this.texture=b(e,t.texture)):t.colormap&&(this.texture.shape=[256,256],this.texture.minFilter=e.LINEAR_MIPMAP_LINEAR,this.texture.magFilter=e.LINEAR,this.texture.setPixels(i(t.colormap)),this.texture.generateMipmap());var r=t.cells,n=t.positions;if(n&&r){var s=[],l=[],u=[],c=[],h=[],f=[],d=[],m=[],g=[],y=[],_=[],w=[],M=[],k=[];this.cells=r,this.positions=n;var A=t.vertexNormals,T=t.cellNormals,E=void 0===t.vertexNormalsEpsilon?p:t.vertexNormalsEpsilon,S=void 0===t.faceNormalsEpsilon?v:t.faceNormalsEpsilon;t.useFacetNormals&&!T&&(T=x.faceNormals(r,n,S)),T||A||(A=x.vertexNormals(r,n,E));var L=t.vertexColors,z=t.cellColors,I=t.meshColor||[1,1,1,1],P=t.vertexUVs,C=t.vertexIntensity,R=t.cellUVs,D=t.cellIntensity,O=1/0,F=-(1/0);if(!P&&!R)if(C)for(var j=0;j<C.length;++j){var N=C[j];O=Math.min(O,N),F=Math.max(F,N)}else if(D)for(var j=0;j<D.length;++j){var N=D[j];O=Math.min(O,N),F=Math.max(F,N)}else for(var j=0;j<n.length;++j){var N=n[j][2];O=Math.min(O,N),F=Math.max(F,N)}C?this.intensity=C:D?this.intensity=o(r,n.length,D):this.intensity=a(n);var B=t.pointSizes,U=t.pointSize||1;this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]];for(var j=0;j<n.length;++j)for(var V=n[j],q=0;3>q;++q)!isNaN(V[q])&&isFinite(V[q])&&(this.bounds[0][q]=Math.min(this.bounds[0][q],V[q]),this.bounds[1][q]=Math.max(this.bounds[1][q],V[q]));var G=0,H=0,X=0;t:for(var j=0;j<r.length;++j){var Y=r[j];switch(Y.length){case 1:for(var W=Y[0],V=n[W],q=0;3>q;++q)if(isNaN(V[q])||!isFinite(V[q]))continue t;y.push(V[0],V[1],V[2]);var Z;Z=L?L[W]:z?z[j]:I,3===Z.length?_.push(Z[0],Z[1],Z[2],1):_.push(Z[0],Z[1],Z[2],Z[3]);var K;K=P?P[W]:C?[(C[W]-O)/(F-O),0]:R?R[j]:D?[(D[j]-O)/(F-O),0]:[(V[2]-O)/(F-O),0],w.push(K[0],K[1]),B?M.push(B[W]):M.push(U),k.push(j),X+=1;break;case 2:for(var q=0;2>q;++q)for(var W=Y[q],V=n[W],J=0;3>J;++J)if(isNaN(V[J])||!isFinite(V[J]))continue t;for(var q=0;2>q;++q){var W=Y[q],V=n[W];f.push(V[0],V[1],V[2]);var Z;Z=L?L[W]:z?z[j]:I,3===Z.length?d.push(Z[0],Z[1],Z[2],1):d.push(Z[0],Z[1],Z[2],Z[3]);var K;K=P?P[W]:C?[(C[W]-O)/(F-O),0]:R?R[j]:D?[(D[j]-O)/(F-O),0]:[(V[2]-O)/(F-O),0],m.push(K[0],K[1]),g.push(j)}H+=1;break;case 3:for(var q=0;3>q;++q)for(var W=Y[q],V=n[W],J=0;3>J;++J)if(isNaN(V[J])||!isFinite(V[J]))continue t;for(var q=0;3>q;++q){var W=Y[q],V=n[W];s.push(V[0],V[1],V[2]);var Z;Z=L?L[W]:z?z[j]:I,3===Z.length?l.push(Z[0],Z[1],Z[2],1):l.push(Z[0],Z[1],Z[2],Z[3]);var K;K=P?P[W]:C?[(C[W]-O)/(F-O),0]:R?R[j]:D?[(D[j]-O)/(F-O),0]:[(V[2]-O)/(F-O),0],c.push(K[0],K[1]);var ;=A?A[W]:T[j],u.push([0],[1],[2]),h.push(j)}G+=1}}this.pointCount=X,this.edgeCount=H,this.triangleCount=G,this.pointPositions.update(y),this.pointColors.update(_),this.pointUVs.update(w),this.pointSizes.update(M),this.pointIds.update(new Uint32Array(k)),this.edgePositions.update(f),this.edgeColors.update(d),this.edgeUVs.update(m),this.edgeIds.update(new Uint32Array(g)),this.trianglePositions.update(s),this.triangleColors.update(l),this.triangleUVs.update(c),this.triangleNormals.update(u),this.triangleIds.update(new Uint32Array(h))}},O.drawTransparent=O.draw=function(t){t=t||{};for(var e=this.gl,r=t.model||D,n=t.view||D,i=t.projection||D,o=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],a=0;3>a;++a)o[0][a]=Math.max(o[0][a],this.clipBounds[0][a]),o[1][a]=Math.min(o[1][a],this.clipBounds[1][a]);var s={model:r,view:n,projection:i,clipBounds:o,kambient:this.ambientLight,kdiffuse:this.diffuseLight,kspecular:this.specularLight,roughness:this.roughness,fresnel:this.fresnel,eyePosition:[0,0,0],lightPosition:[0,0,0],opacity:this.opacity,contourColor:this.contourColor,texture:0};this.texture.bind(0);var l=new Array(16);_(l,s.view,s.model),_(l,s.projection,l),w(l,l);for(var a=0;3>a;++a)s.eyePosition[a]=l[12+a]/l[15];for(var u=l[15],a=0;3>a;++a)u+=this.lightPosition[a]*l[4*a+3];for(var a=0;3>a;++a){for(var c=l[12+a],h=0;3>h;++h)c+=l[4*h+a]*this.lightPosition[h];s.lightPosition[a]=c/u}if(this.triangleCount>0){var f=this.triShader;f.bind(),f.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}if(this.edgeCount>0&&this.lineWidth>0){var f=this.lineShader;f.bind(),f.uniforms=s,this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()}if(this.pointCount>0){var f=this.pointShader;f.bind(),f.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}if(this.contourEnable&&this.contourCount>0&&this.contourLineWidth>0){var f=this.contourShader;f.bind(),f.uniforms=s,this.contourVAO.bind(),e.drawArrays(e.LINES,0,this.contourCount),this.contourVAO.unbind()}},O.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||D,n=t.view||D,i=t.projection||D,o=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],a=0;3>a;++a)o[0][a]=Math.max(o[0][a],this.clipBounds[0][a]),o[1][a]=Math.min(o[1][a],this.clipBounds[1][a]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(i),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s={model:r,view:n,projection:i,clipBounds:o,pickId:this.pickId/255},l=this.pickShader;if(l.bind(),l.uniforms=s,this.triangleCount>0&&(this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()),this.pointCount>0){var l=this.pointPickShader;l.bind(),l.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}},O.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;for(var e=t.value[0]+256*t.value[1]+65536*t.value[2],r=this.cells[e],n=this.positions,i=new Array(r.length),o=0;o<r.length;++o)i[o]=n[r[o]];var a=S(i,[t.coord[0],this._resolution[1]-t.coord[1]],this._model,this._view,this._projection,this._resolution);if(!a)return null;for(var s=a[2],l=0,o=0;o<r.length;++o)l+=s[o]*this.intensity[r[o]];return{position:a[1],index:r[a[0]],cell:r,cellId:e,intensity:l,dataCoordinate:this.positions[r[a[0]]]}},O.dispose=function(){this.texture.dispose(),this.triShader.dispose(),this.lineShader.dispose(),this.pointShader.dispose(),this.pickShader.dispose(),this.pointPickShader.dispose(),this.triangleVAO.dispose(),this.trianglePositions.dispose(),this.triangleColors.dispose(),this.triangleUVs.dispose(),this.triangleNormals.dispose(),this.triangleIds.dispose(),this.edgeVAO.dispose(),this.edgePositions.dispose(),this.edgeColors.dispose(),this.edgeUVs.dispose(),this.edgeIds.dispose(),this.pointVAO.dispose(),this.pointPositions.dispose(),this.pointColors.dispose(),this.pointUVs.dispose(),this.pointSizes.dispose(),this.pointIds.dispose(),this.contourVAO.dispose(),this.contourPositions.dispose(),this.contourShader.dispose()},e.exports=d},{"./lib/closest-point":154,"./lib/shaders":155,colormap:106,"gl-buffer":124,"gl-mat4/invert":143,"gl-mat4/multiply":145,"gl-shader":203,"gl-texture2d":228,"gl-vao":232,ndarray:433,normals:158,"simplicial-complex-contour":160,"typedarray-pool":458}],157:[function(t,e,r){"use strict";function n(t){for(var e=0,r=0;r<t.length;++r)e+=t[r];return e}function i(t,e){for(var r=e.length,i=new Array(r+1),a=0;r>a;++a){for(var s=new Array(r+1),l=0;r>=l;++l)s[l]=t[l][a];i[a]=s}i[r]=new Array(r+1);for(var a=0;r>=a;++a)i[r][a]=1;for(var u=new Array(r+1),a=0;r>a;++a)u[a]=e[a];u[r]=1;var c=o(i,u),h=n(c[r+1]);0===h&&(h=1);for(var f=new Array(r+1),a=0;r>=a;++a)f[a]=n(c[a])/h;return f}e.exports=i;var o=t("robust-linear-solve")},{"robust-linear-solve":436}],158:[function(t,e,r){var n=1e-6,i=1e-6;r.vertexNormals=function(t,e,r){for(var i=e.length,o=new Array(i),a=void 0===r?n:r,s=0;i>s;++s)o[s]=[0,0,0];for(var s=0;s<t.length;++s)for(var l=t[s],u=0,c=l[l.length-1],h=l[0],f=0;f<l.length;++f){u=c,c=h,h=l[(f+1)%l.length];for(var d=e[u],p=e[c],v=e[h],m=new Array(3),g=0,y=new Array(3),b=0,x=0;3>x;++x)m[x]=d[x]-p[x],g+=m[x]*m[x],y[x]=v[x]-p[x],b+=y[x]*y[x];if(g*b>a)for(var _=o[c],w=1/Math.sqrt(g*b),x=0;3>x;++x){var M=(x+1)%3,k=(x+2)%3;_[x]+=w*(y[M]*m[k]-y[k]*m[M])}}for(var s=0;i>s;++s){for(var _=o[s],A=0,x=0;3>x;++x)A+=_[x]*_[x];if(A>a)for(var w=1/Math.sqrt(A),x=0;3>x;++x)_[x]*=w;else for(var x=0;3>x;++x)_[x]=0}return o},r.faceNormals=function(t,e,r){for(var n=t.length,o=new Array(n),a=void 0===r?i:r,s=0;n>s;++s){for(var l=t[s],u=new Array(3),c=0;3>c;++c)u[c]=e[l[c]];for(var h=new Array(3),f=new Array(3),c=0;3>c;++c)h[c]=u[1][c]-u[0][c],f[c]=u[2][c]-u[0][c];for(var d=new Array(3),p=0,c=0;3>c;++c){var v=(c+1)%3,m=(c+2)%3;d[c]=h[v]*f[m]-h[m]*f[v],p+=d[c]*d[c]}p=p>a?1/Math.sqrt(p):0;for(var c=0;3>c;++c)d[c]*=p;o[s]=d}return o}},{}],159:[function(t,e,r){"use strict";function n(t,e,r,n,s){i.length<n.length&&(i=new Float64Array(n.length),o=new Float64Array(n.length),a=new Float64Array(n.length));for(var l=0;l<n.length;++l)i[l]=t[l]-n[l],o[l]=e[l]-t[l],a[l]=r[l]-t[l];for(var u=0,c=0,h=0,f=0,d=0,p=0,l=0;l<n.length;++l){var v=o[l],m=a[l],g=i[l];u+=v*v,c+=v*m,h+=m*m,f+=g*v,d+=g*m,p+=g*g}var y,b=Math.abs(u*h-c*c),x=c*d-h*f,_=c*f-u*d;if(b>=x+_)if(0>x)0>_&&0>f?(_=0,-f>=u?(x=1,y=u+2*f+p):(x=-f/u,y=f*x+p)):(x=0,d>=0?(_=0,y=p):-d>=h?(_=1,y=h+2*d+p):(_=-d/h,y=d*_+p));else if(0>_)_=0,f>=0?(x=0,y=p):-f>=u?(x=1,y=u+2*f+p):(x=-f/u,y=f*x+p);else{var w=1/b;x*=w,_*=w,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*d)+p}else{var M,k,A,T;0>x?(M=c+f,k=h+d,k>M?(A=k-M,T=u-2*c+h,A>=T?(x=1,_=0,y=u+2*f+p):(x=A/T,_=1-x,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*d)+p)):(x=0,0>=k?(_=1,y=h+2*d+p):d>=0?(_=0,y=p):(_=-d/h,y=d*_+p))):0>_?(M=c+d,k=u+f,k>M?(A=k-M,T=u-2*c+h,A>=T?(_=1,x=0,y=h+2*d+p):(_=A/T,x=1-_,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*d)+p)):(_=0,0>=k?(x=1,y=u+2*f+p):f>=0?(x=0,y=p):(x=-f/u,y=f*x+p))):(A=h+d-c-f,0>=A?(x=0,_=1,y=h+2*d+p):(T=u-2*c+h,A>=T?(x=1,_=0,y=u+2*f+p):(x=A/T,_=1-x,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*d)+p)))}for(var E=1-x-_,l=0;l<n.length;++l)s[l]=E*t[l]+x*e[l]+_*r[l];return 0>y?0:y}var i=new Float64Array(4),o=new Float64Array(4),a=new Float64Array(4);e.exports=n},{}],160:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;e>n;++n)r=0|Math.max(r,t[n].length);return r-1}function i(t,e){for(var r=t.length,n=h.mallocUint8(r),i=0;r>i;++i)n[i]=t[i]<e|0;return n}function o(t,e){for(var r=t.length,n=e*(e+1)/2*r|0,i=h.mallocUint32(2*n),o=0,a=0;r>a;++a)for(var s=t[a],e=s.length,l=0;e>l;++l)for(var u=0;l>u;++u){var d=s[u],p=s[l];i[o++]=0|Math.min(d,p),i[o++]=0|Math.max(d,p)}var v=o/2|0;f(c(i,[v,2]));for(var m=2,a=2;o>a;a+=2)i[a-2]===i[a]&&i[a-1]===i[a+1]||(i[m++]=i[a],i[m++]=i[a+1]);return c(i,[m/2|0,2])}function a(t,e,r,n){for(var i=t.data,o=t.shape[0],a=h.mallocDouble(o),s=0,l=0;o>l;++l){var u=i[2*l],f=i[2*l+1];if(r[u]!==r[f]){var d=e[u],p=e[f];i[2*s]=u,i[2*s+1]=f,a[s++]=(p-n)/(p-d)}}return t.shape[0]=s,c(a,[s])}function s(t,e){var r=h.mallocInt32(2*e),n=t.shape[0],i=t.data;r[0]=0;for(var o=0,a=0;n>a;++a){var s=i[2*a];if(s!==o){for(r[2*o+1]=a;++o<s;)r[2*o]=a,r[2*o+1]=a;r[2*o]=a}}for(r[2*o+1]=n;++o<e;)r[2*o]=r[2*o+1]=n;return r}function l(t){for(var e=0|t.shape[0],r=t.data,n=new Array(e),i=0;e>i;++i)n[i]=[r[2*i],r[2*i+1]];return n}function u(t,e,r,u){r=r||0,"undefined"==typeof u&&(u=n(t));var c=t.length;if(0===c||1>u)return{cells:[],vertexIds:[],vertexWeights:[]};var f=i(e,+r),p=o(t,u),v=a(p,e,f,+r),m=s(p,0|e.length),g=d(u)(t,p.data,m,f),y=l(p),b=[].slice.call(v.data,0,v.shape[0]);return h.free(f),h.free(p.data),h.free(v.data),h.free(m),{cells:g,vertexIds:y,vertexWeights:b}}e.exports=u;var c=t("ndarray"),h=t("typedarray-pool"),f=t("ndarray-sort"),d=t("./lib/codegen")},{"./lib/codegen":161,ndarray:433,"ndarray-sort":164,"typedarray-pool":458}],161:[function(t,e,r){"use strict";function n(t){function e(t){if(!(t.length<=0)){u.push("R.push(");for(var e=0;e<t.length;++e){var r=t[e];e>0&&u.push(","),u.push("[");for(var n=0;n<r.length;++n){var i=r[n];n>0&&u.push(","),u.push("B(C,E,c[",i[0],"],c[",i[1],"])")}u.push("]")}u.push(");")}}var r=0,n=new Array(t+1);n[0]=[[]];for(var i=1;t>=i;++i)for(var s=n[i]=a(i),l=0;l<s.length;++l)r=Math.max(r,s[i].length);for(var u=["function B(C,E,i,j){","var a=Math.min(i,j)|0,b=Math.max(i,j)|0,l=C[2*a],h=C[2*a+1];","while(l<h){","var m=(l+h)>>1,v=E[2*m+1];","if(v===b){return m}","if(b<v){h=m}else{l=m+1}","}","return l;","};","function getContour",t,"d(F,E,C,S){","var n=F.length,R=[];","for(var i=0;i<n;++i){var c=F[i],l=c.length;"],i=t+1;i>1;--i){t+1>i&&u.push("else "),u.push("if(l===",i,"){");for(var c=[],l=0;i>l;++l)c.push("(S[c["+l+"]]<<"+l+")");u.push("var M=",c.join("+"),";if(M===0||M===",(1<<i)-1,"){continue}switch(M){");for(var s=n[i-1],l=0;l<s.length;++l)u.push("case ",l,":"),e(s[l]),u.push("break;");u.push("}}")}u.push("}return R;};return getContour",t,"d");var h=new Function("pool",u.join(""));return h(o)}function i(t){var e=s[t];return e||(e=s[t]=n(t)),e}e.exports=i;var o=t("typedarray-pool"),a=t("marching-simplex-table"),s={}},{"marching-simplex-table":162,"typedarray-pool":458}],162:[function(t,e,r){"use strict";function n(t,e,r){for(var n=new Array(t),i=0;t>i;++i)n[i]=0,i===e&&(n[i]+=.5),i===r&&(n[i]+=.5);return n}function i(t,e){if(0===e||e===(1<<t+1)-1)return[];for(var r=[],i=[],o=0;t>=o;++o)if(e&1<<o){r.push(n(t,o-1,o-1)),i.push(null);for(var s=0;t>=s;++s)~e&1<<s&&(r.push(n(t,o-1,s-1)),i.push([o,s]))}var l=a(r),u=[];t:for(var o=0;o<l.length;++o){for(var c=l[o],h=[],s=0;s<c.length;++s){if(!i[c[s]])continue t;h.push(i[c[s]].slice())}u.push(h)}return u}function o(t){for(var e=1<<t+1,r=new Array(e),n=0;e>n;++n)r[n]=i(t,n);return r}e.exports=o;var a=t("convex-hull")},{"convex-hull":108}],163:[function(t,e,r){"use strict";function n(t){switch(t){case"uint8":return[l.mallocUint8,l.freeUint8];case"uint16":return[l.mallocUint16,l.freeUint16];case"uint32":return[l.mallocUint32,l.freeUint32];case"int8":return[l.mallocInt8,l.freeInt8];case"int16":return[l.mallocInt16,l.freeInt16];case"int32":return[l.mallocInt32,l.freeInt32];case"float32":return[l.mallocFloat,l.freeFloat];case"float64":return[l.mallocDouble,l.freeDouble];default:return null}}function i(t){for(var e=[],r=0;t>r;++r)e.push("s"+r);for(var r=0;t>r;++r)e.push("n"+r);for(var r=1;t>r;++r)e.push("d"+r);for(var r=1;t>r;++r)e.push("e"+r);for(var r=1;t>r;++r)e.push("f"+r);return e}function o(t,e){function r(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function o(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}var a=["'use strict'"],s=["ndarrayInsertionSort",t.join("d"),e].join(""),l=["left","right","data","offset"].concat(i(t.length)),u=n(e),c=["i,j,cptr,ptr=left*s0+offset"];if(t.length>1){for(var h=[],f=1;f<t.length;++f)c.push("i"+f),h.push("n"+f);u?c.push("scratch=malloc("+h.join("*")+")"):c.push("scratch=new Array("+h.join("*")+")"),c.push("dptr","sptr","a","b")}else c.push("scratch");if(a.push(["function ",s,"(",l.join(","),"){var ",c.join(",")].join(""),"for(i=left+1;i<=right;++i){","j=i;ptr+=s0","cptr=ptr"),t.length>1){a.push("dptr=0;sptr=ptr");for(var f=t.length-1;f>=0;--f){var d=t[f];0!==d&&a.push(["for(i",d,"=0;i",d,"<n",d,";++i",d,"){"].join(""))}a.push("scratch[dptr++]=",r("sptr"));for(var f=0;f<t.length;++f){var d=t[f];0!==d&&a.push("sptr+=d"+d,"}")}a.push("__g:while(j-->left){","dptr=0","sptr=cptr-s0");for(var f=1;f<t.length;++f)1===f&&a.push("__l:"),a.push(["for(i",f,"=0;i",f,"<n",f,";++i",f,"){"].join(""));a.push(["a=",r("sptr"),"\nb=scratch[dptr]\nif(a<b){break __g}\nif(a>b){break __l}"].join(""));for(var f=t.length-1;f>=1;--f)a.push("sptr+=e"+f,"dptr+=f"+f,"}");a.push("dptr=cptr;sptr=cptr-s0");for(var f=t.length-1;f>=0;--f){var d=t[f];0!==d&&a.push(["for(i",d,"=0;i",d,"<n",d,";++i",d,"){"].join(""))}a.push(o("dptr",r("sptr")));for(var f=0;f<t.length;++f){var d=t[f];0!==d&&a.push(["dptr+=d",d,";sptr+=d",d].join(""),"}")}a.push("cptr-=s0\n}"),a.push("dptr=cptr;sptr=0");for(var f=t.length-1;f>=0;--f){var d=t[f];0!==d&&a.push(["for(i",d,"=0;i",d,"<n",d,";++i",d,"){"].join(""))}a.push(o("dptr","scratch[sptr++]"));for(var f=0;f<t.length;++f){var d=t[f];0!==d&&a.push("dptr+=d"+d,"}")}}else a.push("scratch="+r("ptr"),"while((j-->left)&&("+r("cptr-s0")+">scratch)){",o("cptr",r("cptr-s0")),"cptr-=s0","}",o("cptr","scratch"));if(a.push("}"),t.length>1&&u&&a.push("free(scratch)"),a.push("} return "+s),u){var p=new Function("malloc","free",a.join("\n"));return p(u[0],u[1])}var p=new Function(a.join("\n"));return p()}function a(t,e,r){function o(t){return["(offset+",t,"*s0)"].join("")}function a(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function s(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}function l(e,r,n){if(1===e.length)_.push("ptr0="+o(e[0]));else for(var i=0;i<e.length;++i)_.push(["b_ptr",i,"=s0*",e[i]].join(""));r&&_.push("pivot_ptr=0"),_.push("ptr_shift=offset");for(var i=t.length-1;i>=0;--i){var a=t[i];0!==a&&_.push(["for(i",a,"=0;i",a,"<n",a,";++i",a,"){"].join(""))}if(e.length>1)for(var i=0;i<e.length;++i)_.push(["ptr",i,"=b_ptr",i,"+ptr_shift"].join(""));_.push(n),r&&_.push("++pivot_ptr");for(var i=0;i<t.length;++i){var a=t[i];0!==a&&(e.length>1?_.push("ptr_shift+=d"+a):_.push("ptr0+=d"+a),_.push("}"))}}function c(e,r,n,i){if(1===r.length)_.push("ptr0="+o(r[0]));else{for(var a=0;a<r.length;++a)_.push(["b_ptr",a,"=s0*",r[a]].join(""));_.push("ptr_shift=offset")}n&&_.push("pivot_ptr=0"),e&&_.push(e+":");for(var a=1;a<t.length;++a)_.push(["for(i",a,"=0;i",a,"<n",a,";++i",a,"){"].join(""));if(r.length>1)for(var a=0;a<r.length;++a)_.push(["ptr",a,"=b_ptr",a,"+ptr_shift"].join(""));_.push(i);for(var a=t.length-1;a>=1;--a)n&&_.push("pivot_ptr+=f"+a),r.length>1?_.push("ptr_shift+=e"+a):_.push("ptr0+=e"+a),_.push("}")}function h(){t.length>1&&k&&_.push("free(pivot1)","free(pivot2)")}function f(e,r){var n="el"+e,i="el"+r;if(t.length>1){var s="__l"+ ++A;c(s,[n,i],!1,["comp=",a("ptr0"),"-",a("ptr1"),"\n","if(comp>0){tmp0=",n,";",n,"=",i,";",i,"=tmp0;break ",s,"}\n","if(comp<0){break ",s,"}"].join(""))}else _.push(["if(",a(o(n)),">",a(o(i)),"){tmp0=",n,";",n,"=",i,";",i,"=tmp0}"].join(""))}function d(e,r){t.length>1?l([e,r],!1,s("ptr0",a("ptr1"))):_.push(s(o(e),a(o(r))))}function p(e,r,n){if(t.length>1){var i="__l"+ ++A;c(i,[r],!0,[e,"=",a("ptr0"),"-pivot",n,"[pivot_ptr]\n","if(",e,"!==0){break ",i,"}"].join(""))}else _.push([e,"=",a(o(r)),"-pivot",n].join(""))}function v(e,r){t.length>1?l([e,r],!1,["tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1","tmp")].join("")):_.push(["ptr0=",o(e),"\n","ptr1=",o(r),"\n","tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1","tmp")].join(""))}function m(e,r,n){t.length>1?(l([e,r,n],!1,["tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1",a("ptr2")),"\n",s("ptr2","tmp")].join("")),_.push("++"+r,"--"+n)):_.push(["ptr0=",o(e),"\n","ptr1=",o(r),"\n","ptr2=",o(n),"\n","++",r,"\n","--",n,"\n","tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1",a("ptr2")),"\n",s("ptr2","tmp")].join(""))}function g(t,e){v(t,e),_.push("--"+e)}function y(e,r,n){t.length>1?l([e,r],!0,[s("ptr0",a("ptr1")),"\n",s("ptr1",["pivot",n,"[pivot_ptr]"].join(""))].join("")):_.push(s(o(e),a(o(r))),s(o(r),"pivot"+n))}function b(e,r){_.push(["if((",r,"-",e,")<=",u,"){\n","insertionSort(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}else{\n",w,"(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}"].join(""))}function x(e,r,n){t.length>1?(_.push(["__l",++A,":while(true){"].join("")),l([e],!0,["if(",a("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",A,"}"].join("")),_.push(n,"}")):_.push(["while(",a(o(e)),"===pivot",r,"){",n,"}"].join(""))}var _=["'use strict'"],w=["ndarrayQuickSort",t.join("d"),e].join(""),M=["left","right","data","offset"].concat(i(t.length)),k=n(e),A=0;_.push(["function ",w,"(",M.join(","),"){"].join(""));var T=["sixth=((right-left+1)/6)|0","index1=left+sixth","index5=right-sixth","index3=(left+right)>>1","index2=index3-sixth","index4=index3+sixth","el1=index1","el2=index2","el3=index3","el4=index4","el5=index5","less=left+1","great=right-1","pivots_are_equal=true","tmp","tmp0","x","y","z","k","ptr0","ptr1","ptr2","comp_pivot1=0","comp_pivot2=0","comp=0"];if(t.length>1){for(var E=[],S=1;S<t.length;++S)E.push("n"+S),T.push("i"+S);for(var S=0;8>S;++S)T.push("b_ptr"+S);T.push("ptr3","ptr4","ptr5","ptr6","ptr7","pivot_ptr","ptr_shift","elementSize="+E.join("*")),k?T.push("pivot1=malloc(elementSize)","pivot2=malloc(elementSize)"):T.push("pivot1=new Array(elementSize),pivot2=new Array(elementSize)")}else T.push("pivot1","pivot2");if(_.push("var "+T.join(",")),f(1,2),f(4,5),f(1,3),f(2,3),f(1,4),f(3,4),f(2,5),f(2,3),f(4,5),t.length>1?l(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",a("ptr1"),"\n","pivot2[pivot_ptr]=",a("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",a("ptr0"),"\n","y=",a("ptr2"),"\n","z=",a("ptr4"),"\n",s("ptr5","x"),"\n",s("ptr6","y"),"\n",s("ptr7","z")].join("")):_.push(["pivot1=",a(o("el2")),"\n","pivot2=",a(o("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",a(o("el1")),"\n","y=",a(o("el3")),"\n","z=",a(o("el5")),"\n",s(o("index1"),"x"),"\n",s(o("index3"),"y"),"\n",s(o("index5"),"z")].join("")),d("index2","left"),d("index4","right"),_.push("if(pivots_are_equal){"),_.push("for(k=less;k<=great;++k){"),p("comp","k",1),_.push("if(comp===0){continue}"),_.push("if(comp<0){"),_.push("if(k!==less){"),v("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),_.push("while(true){"),p("comp","great",1),_.push("if(comp>0){"),_.push("great--"),_.push("}else if(comp<0){"),m("k","less","great"),_.push("break"),_.push("}else{"),g("k","great"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}else{"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1<0){"),_.push("if(k!==less){"),v("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2>0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp>0){"),_.push("if(--great<k){break}"),_.push("continue"),_.push("}else{"),p("comp","great",1),_.push("if(comp<0){"),m("k","less","great"),_.push("}else{"),g("k","great"),_.push("}"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),y("left","(less-1)",1),y("right","(great+1)",2),b("left","(less-2)"),b("(great+2)","right"),_.push("if(pivots_are_equal){"),h(),_.push("return"),_.push("}"),_.push("if(less<index1&&great>index5){"),x("less",1,"++less"),x("great",2,"--great"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1===0){"),_.push("if(k!==less){"),v("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2===0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp===0){"),_.push("if(--great<k){break}"),_.push("continue"),_.push("}else{"),p("comp","great",1),_.push("if(comp<0){"),m("k","less","great"),_.push("}else{"),g("k","great"),_.push("}"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),h(),b("less","great"),_.push("}return "+w),t.length>1&&k){var L=new Function("insertionSort","malloc","free",_.join("\n"));return L(r,k[0],k[1])}var L=new Function("insertionSort",_.join("\n"));return L(r)}function s(t,e){var r=["'use strict'"],n=["ndarraySortWrapper",t.join("d"),e].join(""),s=["array"];r.push(["function ",n,"(",s.join(","),"){"].join(""));for(var l=["data=array.data,offset=array.offset|0,shape=array.shape,stride=array.stride"],c=0;c<t.length;++c)l.push(["s",c,"=stride[",c,"]|0,n",c,"=shape[",c,"]|0"].join(""));for(var h=new Array(t.length),f=[],c=0;c<t.length;++c){var d=t[c];0!==d&&(0===f.length?h[d]="1":h[d]=f.join("*"),f.push("n"+d))}for(var p=-1,v=-1,c=0;c<t.length;++c){var m=t[c];0!==m&&(p>0?l.push(["d",m,"=s",m,"-d",p,"*n",p].join("")):l.push(["d",m,"=s",m].join("")),p=m);var d=t.length-1-c;0!==d&&(v>0?l.push(["e",d,"=s",d,"-e",v,"*n",v,",f",d,"=",h[d],"-f",v,"*n",v].join("")):l.push(["e",d,"=s",d,",f",d,"=",h[d]].join("")),v=d)}r.push("var "+l.join(","));var g=["0","n0-1","data","offset"].concat(i(t.length));r.push(["if(n0<=",u,"){","insertionSort(",g.join(","),")}else{","quickSort(",g.join(","),")}"].join("")),r.push("}return "+n);var y=new Function("insertionSort","quickSort",r.join("\n")),b=o(t,e),x=a(t,e,b);return y(b,x)}var l=t("typedarray-pool"),u=32;e.exports=s},{"typedarray-pool":458}],164:[function(t,e,r){"use strict";function n(t){var e=t.order,r=t.dtype,n=[e,r],a=n.join(":"),s=o[a];return s||(o[a]=s=i(e,r)),s(t),t}var i=t("./lib/compile_sort.js"),o={};e.exports=n},{"./lib/compile_sort.js":163}],165:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r}function i(t){var e=t.gl,r=o(e,[0,0,0,1,1,0,1,1]),i=a(e,s.boxVert,s.lineFrag);return new n(t,r,i)}e.exports=i;var o=t("gl-buffer"),a=t("gl-shader"),s=t("./shaders"),l=n.prototype;l.bind=function(){var t=this.shader;this.vbo.bind(),this.shader.bind(),t.attributes.coord.pointer(),t.uniforms.screenBox=this.plot.screenBox},l.drawBox=function(){var t=[0,0],e=[0,0];return function(r,n,i,o,a){var s=this.plot,l=this.shader,u=s.gl;t[0]=r,t[1]=n,e[0]=i,e[1]=o,l.uniforms.lo=t,l.uniforms.hi=e,l.uniforms.color=a,u.drawArrays(u.TRIANGLE_STRIP,0,4)}}(),l.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":168,"gl-buffer":124,"gl-shader":203}],166:[function(t,e,r){"use strict";function n(t,e,r,n){this.plot=t,this.vbo=e,this.shader=r,this.tickShader=n,this.ticks=[[],[]]}function i(t,e){return t-e}function o(t){var e=t.gl,r=a(e),i=s(e,u.gridVert,u.gridFrag),o=s(e,u.tickVert,u.gridFrag),l=new n(t,r,i,o);return l}e.exports=o;var a=t("gl-buffer"),s=t("gl-shader"),l=t("binary-search-bounds"),u=t("./shaders"),c=n.prototype;c.draw=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){for(var n=this.plot,i=this.vbo,o=this.shader,a=this.ticks,s=n.gl,l=n._tickBounds,u=n.dataBox,c=n.viewBox,h=n.gridLineWidth,f=n.gridLineColor,d=n.gridLineEnable,p=n.pixelRatio,v=0;2>v;++v){var m=l[v],g=l[v+2],y=g-m,b=.5*(u[v+2]+u[v]),x=u[v+2]-u[v];e[v]=2*y/x,t[v]=2*(m-b)/x}o.bind(),i.bind(),o.attributes.dataCoord.pointer(),o.uniforms.dataShift=t,o.uniforms.dataScale=e;for(var _=0,v=0;2>v;++v){r[0]=r[1]=0,r[v]=1,o.uniforms.dataAxis=r,o.uniforms.lineWidth=h[v]/(c[v+2]-c[v])*p,o.uniforms.color=f[v];var w=6*a[v].length;d[v]&&w&&s.drawArrays(s.TRIANGLES,_,w),_+=w}}}(),c.drawTickMarks=function(){var t=[0,0],e=[0,0],r=[1,0],n=[0,1],o=[0,0],a=[0,0];return function(){for(var s=this.plot,u=this.vbo,c=this.tickShader,h=this.ticks,f=s.gl,d=s._tickBounds,p=s.dataBox,v=s.viewBox,m=s.pixelRatio,g=s.screenBox,y=g[2]-g[0],b=g[3]-g[1],x=v[2]-v[0],_=v[3]-v[1],w=0;2>w;++w){var M=d[w],k=d[w+2],A=k-M,T=.5*(p[w+2]+p[w]),E=p[w+2]-p[w];e[w]=2*A/E,t[w]=2*(M-T)/E}e[0]*=x/y,t[0]*=x/y,e[1]*=_/b,t[1]*=_/b,c.bind(),u.bind(),c.attributes.dataCoord.pointer();var S=c.uniforms;S.dataShift=t,S.dataScale=e;var L=s.tickMarkLength,z=s.tickMarkWidth,I=s.tickMarkColor,P=0,C=6*h[0].length,R=Math.min(l.ge(h[0],(p[0]-d[0])/(d[2]-d[0]),i),h[0].length),D=Math.min(l.gt(h[0],(p[2]-d[0])/(d[2]-d[0]),i),h[0].length),O=P+6*R,F=6*Math.max(0,D-R),j=Math.min(l.ge(h[1],(p[1]-d[1])/(d[3]-d[1]),i),h[1].length),N=Math.min(l.gt(h[1],(p[3]-d[1])/(d[3]-d[1]),i),h[1].length),B=C+6*j,U=6*Math.max(0,N-j);o[0]=2*(v[0]-L[1])/y-1,o[1]=(v[3]+v[1])/b-1,a[0]=L[1]*m/y,a[1]=z[1]*m/b,U&&(S.color=I[1],S.tickScale=a,S.dataAxis=n,S.screenOffset=o,f.drawArrays(f.TRIANGLES,B,U)),o[0]=(v[2]+v[0])/y-1,o[1]=2*(v[1]-L[0])/b-1,a[0]=z[0]*m/y,a[1]=L[0]*m/b,F&&(S.color=I[0],S.tickScale=a,S.dataAxis=r,S.screenOffset=o,f.drawArrays(f.TRIANGLES,O,F)),o[0]=2*(v[2]+L[3])/y-1,o[1]=(v[3]+v[1])/b-1,a[0]=L[3]*m/y,a[1]=z[3]*m/b,U&&(S.color=I[3],S.tickScale=a,S.dataAxis=n,S.screenOffset=o,f.drawArrays(f.TRIANGLES,B,U)),o[0]=(v[2]+v[0])/y-1,o[1]=2*(v[3]+L[2])/b-1,a[0]=z[2]*m/y,a[1]=L[2]*m/b,F&&(S.color=I[2],S.tickScale=a,S.dataAxis=r,S.screenOffset=o,f.drawArrays(f.TRIANGLES,O,F))}}(),c.update=function(){var t=[1,1,-1,-1,1,-1],e=[1,-1,1,1,-1,-1];return function(r){for(var n=r.ticks,i=r.bounds,o=new Float32Array(18*(n[0].length+n[1].length)),a=(this.plot.zeroLineEnable,0),s=[[],[]],l=0;2>l;++l)for(var u=s[l],c=n[l],h=i[l],f=i[l+2],d=0;d<c.length;++d){var p=(c[d].x-h)/(f-h);u.push(p);for(var v=0;6>v;++v)o[a++]=p,o[a++]=t[v],o[a++]=e[v]}this.ticks=s,this.vbo.update(o)}}(),c.dispose=function(){this.vbo.dispose(),this.shader.dispose(),this.tickShader.dispose()}},{"./shaders":168,"binary-search-bounds":170,"gl-buffer":124,"gl-shader":203}],167:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r}function i(t){var e=t.gl,r=o(e,[-1,-1,-1,1,1,-1,1,1]),i=a(e,s.lineVert,s.lineFrag),l=new n(t,r,i);return l}e.exports=i;var o=t("gl-buffer"),a=t("gl-shader"),s=t("./shaders"),l=n.prototype;l.bind=function(){var t=this.shader;this.vbo.bind(),this.shader.bind(),t.attributes.coord.pointer(),t.uniforms.screenBox=this.plot.screenBox},l.drawLine=function(){var t=[0,0],e=[0,0];return function(r,n,i,o,a,s){var l=this.plot,u=this.shader,c=l.gl;t[0]=r,t[1]=n,e[0]=i,e[1]=o,u.uniforms.start=t,u.uniforms.end=e,u.uniforms.width=a*l.pixelRatio,u.uniforms.color=s,c.drawArrays(c.TRIANGLE_STRIP,0,4)}}(),l.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":168,"gl-buffer":124,"gl-shader":203}],168:[function(t,e,r){"use strict";var n="precision lowp float;\n#define GLSLIFY 1\nuniform vec4 color;\nvoid main() {\n gl_FragColor = vec4(color.xyz * color.w, color.w);\n}\n";e.exports={lineVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 coord;\n\nuniform vec4 screenBox;\nuniform vec2 start, end;\nuniform float width;\n\nvec2 perp(vec2 v) {\n return vec2(v.y, -v.x);\n}\n\nvec2 screen(vec2 v) {\n return 2.0 * (v - screenBox.xy) / (screenBox.zw - screenBox.xy) - 1.0;\n}\n\nvoid main() {\n vec2 delta = normalize(perp(start - end));\n vec2 offset = mix(start, end, 0.5 * (coord.y+1.0));\n gl_Position = vec4(screen(offset + 0.5 * width * delta * coord.x), 0, 1);\n}\n",lineFrag:n,textVert:"#define GLSLIFY 1\nattribute vec3 textCoordinate;\n\nuniform vec2 dataScale, dataShift, dataAxis, screenOffset, textScale;\nuniform float angle;\n\nvoid main() {\n float dataOffset = textCoordinate.z;\n vec2 glyphOffset = textCoordinate.xy;\n mat2 glyphMatrix = mat2(cos(angle), sin(angle), -sin(angle), cos(angle));\n vec2 screenCoordinate = dataAxis * (dataScale * dataOffset + dataShift) +\n glyphMatrix * glyphOffset * textScale + screenOffset;\n gl_Position = vec4(screenCoordinate, 0, 1);\n}\n", textFrag:n,gridVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 dataCoord;\n\nuniform vec2 dataAxis, dataShift, dataScale;\nuniform float lineWidth;\n\nvoid main() {\n vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);\n pos += 10.0 * dataCoord.y * vec2(dataAxis.y, -dataAxis.x) + dataCoord.z * lineWidth;\n gl_Position = vec4(pos, 0, 1);\n}\n",gridFrag:n,boxVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 coord;\n\nuniform vec4 screenBox;\nuniform vec2 lo, hi;\n\nvec2 screen(vec2 v) {\n return 2.0 * (v - screenBox.xy) / (screenBox.zw - screenBox.xy) - 1.0;\n}\n\nvoid main() {\n gl_Position = vec4(screen(mix(lo, hi, coord)), 0, 1);\n}\n",tickVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 dataCoord;\n\nuniform vec2 dataAxis, dataShift, dataScale, screenOffset, tickScale;\n\nvoid main() {\n vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);\n gl_Position = vec4(pos + tickScale*dataCoord.yz + screenOffset, 0, 1);\n}\n"}},{}],169:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r,this.tickOffset=[[],[]],this.tickX=[[],[]],this.labelOffset=[0,0],this.labelCount=[0,0]}function i(t){var e=t.gl,r=o(e),i=a(e,u.textVert,u.textFrag),s=new n(t,r,i);return s}e.exports=i;var o=t("gl-buffer"),a=t("gl-shader"),s=t("text-cache"),l=t("binary-search-bounds"),u=t("./shaders"),c=n.prototype;c.drawTicks=function(){var t=[0,0],e=[0,0],r=[0,0];return function(n){var i=this.plot,o=this.shader,a=this.tickX[n],s=this.tickOffset[n],u=i.gl,c=i.viewBox,h=i.dataBox,f=i.screenBox,d=i.pixelRatio,p=i.tickEnable,v=i.tickPad,m=i.tickColor,g=i.tickAngle,y=(i.tickMarkLength,i.labelEnable),b=i.labelPad,x=i.labelColor,_=i.labelAngle,w=this.labelOffset[n],M=this.labelCount[n],k=l.lt(a,h[n]),A=l.le(a,h[n+2]);t[0]=t[1]=0,t[n]=1,e[n]=(c[2+n]+c[n])/(f[2+n]-f[n])-1;var T=2/f[2+(1^n)]-f[1^n];e[1^n]=T*c[1^n]-1,p[n]&&(e[1^n]-=T*d*v[n],A>k&&s[A]>s[k]&&(o.uniforms.dataAxis=t,o.uniforms.screenOffset=e,o.uniforms.color=m[n],o.uniforms.angle=g[n],u.drawArrays(u.TRIANGLES,s[k],s[A]-s[k]))),y[n]&&M&&(e[1^n]-=T*d*b[n],o.uniforms.dataAxis=r,o.uniforms.screenOffset=e,o.uniforms.color=x[n],o.uniforms.angle=_[n],u.drawArrays(u.TRIANGLES,w,M)),e[1^n]=T*c[2+(1^n)]-1,p[n+2]&&(e[1^n]+=T*d*v[n+2],A>k&&s[A]>s[k]&&(o.uniforms.dataAxis=t,o.uniforms.screenOffset=e,o.uniforms.color=m[n+2],o.uniforms.angle=g[n+2],u.drawArrays(u.TRIANGLES,s[k],s[A]-s[k]))),y[n+2]&&M&&(e[1^n]+=T*d*b[n+2],o.uniforms.dataAxis=r,o.uniforms.screenOffset=e,o.uniforms.color=x[n+2],o.uniforms.angle=_[n+2],u.drawArrays(u.TRIANGLES,w,M))}}(),c.drawTitle=function(){var t=[0,0],e=[0,0];return function(){var r=this.plot,n=this.shader,i=r.gl,o=r.screenBox,a=r.titleCenter,s=r.titleAngle,l=r.titleColor,a=r.titleCenter,u=r.pixelRatio;if(this.titleCount){for(var c=0;2>c;++c)e[c]=2*(a[c]*u-o[c])/(o[2+c]-o[c])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,i.drawArrays(i.TRIANGLES,this.titleOffset,this.titleCount)}}}(),c.bind=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){var n=this.plot,i=this.shader,o=n._tickBounds,a=n.dataBox,s=n.screenBox,l=n.viewBox;i.bind();for(var u=0;2>u;++u){var c=o[u],h=o[u+2],f=h-c,d=.5*(a[u+2]+a[u]),p=a[u+2]-a[u],v=l[u],m=l[u+2],g=m-v,y=s[u],b=s[u+2],x=b-y;e[u]=2*f/p*g/x,t[u]=2*(c-d)/p*g/x}r[1]=2*n.pixelRatio/(s[3]-s[1]),r[0]=r[1]*(s[3]-s[1])/(s[2]-s[0]),i.uniforms.dataScale=e,i.uniforms.dataShift=t,i.uniforms.textScale=r,this.vbo.bind(),i.attributes.textCoordinate.pointer()}}(),c.update=function(t){for(var e=[],r=t.ticks,n=t.bounds,i=0;2>i;++i){for(var o=[Math.floor(e.length/3)],a=[-(1/0)],l=r[i],u=0;u<l.length;++u){for(var c=l[u],h=c.x,f=c.text,d=c.font||"sans-serif",p=c.fontSize||12,v=s(d,f).data,m=1/(n[i+2]-n[i]),g=n[i],y=0;y<v.length;y+=2)e.push(v[y]*p,-v[y+1]*p,(h-g)*m);o.push(Math.floor(e.length/3)),a.push(h)}this.tickOffset[i]=o,this.tickX[i]=a}for(var i=0;2>i;++i){this.labelOffset[i]=Math.floor(e.length/3);for(var v=s(t.labelFont[i],t.labels[i]).data,p=t.labelSize[i],u=0;u<v.length;u+=2)e.push(v[u]*p,-v[u+1]*p,0);this.labelCount[i]=Math.floor(e.length/3)-this.labelOffset[i]}this.titleOffset=Math.floor(e.length/3);for(var v=s(t.titleFont,t.title).data,p=t.titleSize,u=0;u<v.length;u+=2)e.push(v[u]*p,-v[u+1]*p,0);this.titleCount=Math.floor(e.length/3)-this.titleOffset,this.vbo.update(e)},c.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":168,"binary-search-bounds":170,"gl-buffer":124,"gl-shader":203,"text-cache":453}],170:[function(t,e,r){arguments[4][68][0].apply(r,arguments)},{dup:68}],171:[function(t,e,r){"use strict";function n(t,e){this.gl=t,this.pickBuffer=e,this.screenBox=[0,0,t.drawingBufferWidth,t.drawingBufferHeight],this.viewBox=[0,0,0,0],this.dataBox=[-10,-10,10,10],this.gridLineEnable=[!0,!0],this.gridLineWidth=[1,1],this.gridLineColor=[[0,0,0,1],[0,0,0,1]],this.pixelRatio=1,this.tickMarkLength=[0,0,0,0],this.tickMarkWidth=[0,0,0,0],this.tickMarkColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.tickPad=[15,15,15,15],this.tickAngle=[0,0,0,0],this.tickEnable=[!0,!0,!0,!0],this.tickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.labelPad=[15,15,15,15],this.labelAngle=[0,Math.PI/2,0,3*Math.PI/2],this.labelEnable=[!0,!0,!0,!0],this.labelColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.titleCenter=[0,0],this.titleEnable=!0,this.titleAngle=0,this.titleColor=[0,0,0,1],this.borderColor=[0,0,0,0],this.backgroundColor=[0,0,0,0],this.zeroLineEnable=[!0,!0],this.zeroLineWidth=[4,4],this.zeroLineColor=[[0,0,0,1],[0,0,0,1]],this.borderLineEnable=[!0,!0,!0,!0],this.borderLineWidth=[2,2,2,2],this.borderLineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.grid=null,this.text=null,this.line=null,this.box=null,this.objects=[],this.overlays=[],this._tickBounds=[1/0,1/0,-(1/0),-(1/0)],this.dirty=!1,this.pickDirty=!1,this.pickDelay=120,this.pickRadius=10,this._pickTimeout=null,this._drawPick=this.drawPick.bind(this),this._depthCounter=0}function i(t){for(var e=t.slice(),r=0;r<e.length;++r)e[r]=e[r].slice();return e}function o(t,e){return t.x-e.x}function a(t){var e=t.gl,r=s(e,[e.drawingBufferWidth,e.drawingBufferHeight]),i=new n(e,r);return i.grid=l(i),i.text=u(i),i.line=c(i),i.box=h(i),i.update(t),i}e.exports=a;var s=t("gl-select-static"),l=t("./lib/grid"),u=t("./lib/text"),c=t("./lib/line"),h=t("./lib/box"),f=n.prototype;f.setDirty=function(){this.dirty=this.pickDirty=!0},f.setOverlayDirty=function(){this.dirty=!0},f.nextDepthValue=function(){return this._depthCounter++/65536},f.draw=function(){return function(){var t=this.gl,e=this.screenBox,r=this.viewBox,n=this.dataBox,i=this.pixelRatio,o=this.grid,a=this.line,s=this.text,l=this.objects;if(this._depthCounter=0,this.pickDirty&&(this._pickTimeout&&clearTimeout(this._pickTimeout),this.pickDirty=!1,this._pickTimeout=setTimeout(this._drawPick,this.pickDelay)),this.dirty){this.dirty=!1,t.bindFramebuffer(t.FRAMEBUFFER,null),t.enable(t.SCISSOR_TEST),t.disable(t.DEPTH_TEST),t.depthFunc(t.LESS),t.depthMask(!1),t.enable(t.BLEND),t.blendEquation(t.FUNC_ADD,t.FUNC_ADD),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),t.scissor(e[0],e[1],e[2]-e[0],e[3]-e[1]);var u=this.borderColor;t.clearColor(u[0]*u[3],u[1]*u[3],u[2]*u[3],u[3]),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),t.scissor(r[0],r[1],r[2]-r[0],r[3]-r[1]),t.viewport(r[0],r[1],r[2]-r[0],r[3]-r[1]);var c=this.backgroundColor;t.clearColor(c[0]*c[3],c[1]*c[3],c[2]*c[3],c[3]),t.clear(t.COLOR_BUFFER_BIT),o.draw();var h=this.zeroLineEnable,f=this.zeroLineColor,d=this.zeroLineWidth;if(h[0]||h[1]){a.bind();for(var p=0;2>p;++p)if(h[p]&&n[p]<=0&&n[p+2]>=0){var v=e[p]-n[p]*(e[p+2]-e[p])/(n[p+2]-n[p]);0===p?a.drawLine(v,e[1],v,e[3],d[p],f[p]):a.drawLine(e[0],v,e[2],v,d[p],f[p])}}for(var p=0;p<l.length;++p)l[p].draw();t.viewport(e[0],e[1],e[2]-e[0],e[3]-e[1]),t.scissor(e[0],e[1],e[2]-e[0],e[3]-e[1]),this.grid.drawTickMarks(),a.bind();var m=this.borderLineEnable,g=this.borderLineWidth,y=this.borderLineColor;m[1]&&a.drawLine(r[0],r[1]-.5*g[1]*i,r[0],r[3]+.5*g[3]*i,g[1],y[1]),m[0]&&a.drawLine(r[0]-.5*g[0]*i,r[1],r[2]+.5*g[2]*i,r[1],g[0],y[0]),m[3]&&a.drawLine(r[2],r[1]-.5*g[1]*i,r[2],r[3]+.5*g[3]*i,g[3],y[3]),m[2]&&a.drawLine(r[0]-.5*g[0]*i,r[3],r[2]+.5*g[2]*i,r[3],g[2],y[2]),s.bind();for(var p=0;2>p;++p)s.drawTicks(p);this.titleEnable&&s.drawTitle();for(var b=this.overlays,p=0;p<b.length;++p)b[p].draw();t.disable(t.SCISSOR_TEST),t.disable(t.BLEND),t.depthMask(!0)}}}(),f.drawPick=function(){return function(){var t=this.pickBuffer;this.gl;this._pickTimeout=null,t.begin();for(var e=1,r=this.objects,n=0;n<r.length;++n)e=r[n].drawPick(e);t.end()}}(),f.pick=function(){return function(t,e){var r=this.pixelRatio,n=this.pickPixelRatio,i=this.viewBox,o=0|Math.round((t-i[0]/r)*n),a=0|Math.round((e-i[1]/r)*n),s=this.pickBuffer.query(o,a,this.pickRadius);if(!s)return null;for(var l=s.id+(s.value[0]<<8)+(s.value[1]<<16)+(s.value[2]<<24),u=this.objects,c=0;c<u.length;++c){var h=u[c].pick(o,a,l);if(h)return h}return null}}(),f.setScreenBox=function(t){var e=this.screenBox,r=this.pixelRatio;e[0]=0|Math.round(t[0]*r),e[1]=0|Math.round(t[1]*r),e[2]=0|Math.round(t[2]*r),e[3]=0|Math.round(t[3]*r),this.setDirty()},f.setDataBox=function(t){var e=this.dataBox,r=e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3];r&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],this.setDirty())},f.setViewBox=function(t){var e=this.pixelRatio,r=this.viewBox;r[0]=0|Math.round(t[0]*e),r[1]=0|Math.round(t[1]*e),r[2]=0|Math.round(t[2]*e),r[3]=0|Math.round(t[3]*e);var n=this.pickPixelRatio;this.pickBuffer.shape=[0|Math.round((t[2]-t[0])*n),0|Math.round((t[3]-t[1])*n)],this.setDirty()},f.update=function(t){t=t||{};var e=this.gl;this.pixelRatio=t.pixelRatio||1;var r=this.pixelRatio;this.pickPixelRatio=Math.max(r,1),this.setScreenBox(t.screenBox||[0,0,e.drawingBufferWidth/r,e.drawingBufferHeight/r]);this.screenBox;this.setViewBox(t.viewBox||[.125*(this.screenBox[2]-this.screenBox[0])/r,.125*(this.screenBox[3]-this.screenBox[1])/r,.875*(this.screenBox[2]-this.screenBox[0])/r,.875*(this.screenBox[3]-this.screenBox[1])/r]);var n=this.viewBox,a=(n[2]-n[0])/(n[3]-n[1]);this.setDataBox(t.dataBox||[-10,-10/a,10,10/a]),this.borderColor=(t.borderColor||[0,0,0,0]).slice(),this.backgroundColor=(t.backgroundColor||[0,0,0,0]).slice(),this.gridLineEnable=(t.gridLineEnable||[!0,!0]).slice(),this.gridLineWidth=(t.gridLineWidth||[1,1]).slice(),this.gridLineColor=i(t.gridLineColor||[[.5,.5,.5,1],[.5,.5,.5,1]]),this.zeroLineEnable=(t.zeroLineEnable||[!0,!0]).slice(),this.zeroLineWidth=(t.zeroLineWidth||[4,4]).slice(),this.zeroLineColor=i(t.zeroLineColor||[[0,0,0,1],[0,0,0,1]]),this.tickMarkLength=(t.tickMarkLength||[0,0,0,0]).slice(),this.tickMarkWidth=(t.tickMarkWidth||[0,0,0,0]).slice(),this.tickMarkColor=i(t.tickMarkColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]),this.titleCenter=(t.titleCenter||[.5*(n[0]+n[2])/r,(n[3]+120)/r]).slice(),this.titleEnable=!("titleEnable"in t&&!t.titleEnable),this.titleAngle=t.titleAngle||0,this.titleColor=(t.titleColor||[0,0,0,1]).slice(),this.labelPad=(t.labelPad||[15,15,15,15]).slice(),this.labelAngle=(t.labelAngle||[0,Math.PI/2,0,3*Math.PI/2]).slice(),this.labelEnable=(t.labelEnable||[!0,!0,!0,!0]).slice(),this.labelColor=i(t.labelColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]),this.tickPad=(t.tickPad||[15,15,15,15]).slice(),this.tickAngle=(t.tickAngle||[0,0,0,0]).slice(),this.tickEnable=(t.tickEnable||[!0,!0,!0,!0]).slice(),this.tickColor=i(t.tickColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]),this.borderLineEnable=(t.borderLineEnable||[!0,!0,!0,!0]).slice(),this.borderLineWidth=(t.borderLineWidth||[2,2,2,2]).slice(),this.borderLineColor=i(t.borderLineColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);var s=t.ticks||[[],[]],l=this._tickBounds;l[0]=l[1]=1/0,l[2]=l[3]=-(1/0);for(var u=0;2>u;++u){var c=s[u].slice(0);0!==c.length&&(c.sort(o),l[u]=Math.min(l[u],c[0].x),l[u+2]=Math.max(l[u+2],c[c.length-1].x))}this.grid.update({bounds:l,ticks:s}),this.text.update({bounds:l,ticks:s,labels:t.labels||["x","y"],labelSize:t.labelSize||[12,12],labelFont:t.labelFont||["sans-serif","sans-serif"],title:t.title||"",titleSize:t.titleSize||18,titleFont:t.titleFont||"sans-serif"}),this.setDirty()},f.dispose=function(){this.box.dispose(),this.grid.dispose(),this.text.dispose(),this.line.dispose();for(var t=this.objects.length-1;t>=0;--t)this.objects[t].dispose();this.objects.length=0;for(var t=this.overlays.length-1;t>=0;--t)this.overlays[t].dispose();this.overlays.length=0,this.gl=null},f.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},f.removeObject=function(t){for(var e=this.objects,r=0;r<e.length;++r)if(e[r]===t){e.splice(r,1),this.setDirty();break}},f.addOverlay=function(t){this.overlays.indexOf(t)<0&&(this.overlays.push(t),this.setOverlayDirty())},f.removeOverlay=function(t){for(var e=this.overlays,r=0;r<e.length;++r)if(e[r]===t){e.splice(r,1),this.setOverlayDirty();break}}},{"./lib/box":165,"./lib/grid":166,"./lib/line":167,"./lib/text":169,"gl-select-static":202}],172:[function(t,e,r){var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\nattribute vec2 position;\nvarying vec2 uv;\nvoid main() {\n uv = position;\n gl_Position = vec4(position, 0, 1);\n}",o="precision mediump float;\n#define GLSLIFY 1\n\nuniform sampler2D accumBuffer;\nvarying vec2 uv;\n\nvoid main() {\n vec4 accum = texture2D(accumBuffer, 0.5 * (uv + 1.0));\n gl_FragColor = min(vec4(1,1,1,1), accum);\n}";e.exports=function(t){return n(t,i,o,null,[{name:"position",type:"vec2"}])}},{"gl-shader":203}],173:[function(t,e,r){"use strict";function n(t,e){t=t||document.body,e=e||{};var r=[.01,1/0];"distanceLimits"in e&&(r[0]=e.distanceLimits[0],r[1]=e.distanceLimits[1]),"zoomMin"in e&&(r[0]=e.zoomMin),"zoomMax"in e&&(r[1]=e.zoomMax);var n=o({center:e.center||[0,0,0],up:e.up||[0,1,0],eye:e.eye||[0,0,10],mode:e.mode||"orbit",distanceLimits:r}),l=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],u=0,c=t.clientWidth,h=t.clientHeight,f={view:n,element:t,delay:e.delay||16,rotateSpeed:e.rotateSpeed||1,zoomSpeed:e.zoomSpeed||1,translateSpeed:e.translateSpeed||1,flipX:!!e.flipX,flipY:!!e.flipY,modes:n.modes,tick:function(){var e=i(),r=this.delay;n.idle(e-r),n.flush(e-(100+2*r));var o=e-2*r;n.recalcMatrix(o);for(var a=!0,s=n.computedMatrix,f=0;16>f;++f)a=a&&l[f]===s[f],l[f]=s[f];var d=t.clientWidth===c&&t.clientHeight===h;return c=t.clientWidth,h=t.clientHeight,a?!d:(u=Math.exp(n.computedRadius[0]),!0)},lookAt:function(t,e,r){n.lookAt(n.lastT(),t,e,r)},rotate:function(t,e,r){n.rotate(n.lastT(),t,e,r)},pan:function(t,e,r){n.pan(n.lastT(),t,e,r)},translate:function(t,e,r){n.translate(n.lastT(),t,e,r)}};Object.defineProperties(f,{matrix:{get:function(){return n.computedMatrix},set:function(t){return n.setMatrix(n.lastT(),t),n.computedMatrix},enumerable:!0},mode:{get:function(){return n.getMode()},set:function(t){return n.setMode(t),n.getMode()},enumerable:!0},center:{get:function(){return n.computedCenter},set:function(t){return n.lookAt(n.lastT(),t),n.computedCenter},enumerable:!0},eye:{get:function(){return n.computedEye},set:function(t){return n.lookAt(n.lastT(),null,t),n.computedEye},enumerable:!0},up:{get:function(){return n.computedUp},set:function(t){return n.lookAt(n.lastT(),null,null,t),n.computedUp},enumerable:!0},distance:{get:function(){return u},set:function(t){return n.setDistance(n.lastT(),t),t},enumerable:!0},distanceLimits:{get:function(){return n.getDistanceLimits(r)},set:function(t){return n.setDistanceLimits(t),t},enumerable:!0}}),t.addEventListener("contextmenu",function(t){return t.preventDefault(),!1});var d=0,p=0;return a(t,function(e,r,o,a){var s=1/t.clientHeight,l=s*(r-d),c=s*(o-p),h=f.flipX?1:-1,v=f.flipY?1:-1,m=Math.PI*f.rotateSpeed,g=i();if(1&e)a.shift?n.rotate(g,0,0,-l*m):n.rotate(g,h*m*l,-v*m*c,0);else if(2&e)n.pan(g,-f.translateSpeed*l*u,f.translateSpeed*c*u,0);else if(4&e){var y=f.zoomSpeed*c/window.innerHeight*(g-n.lastT())*50;n.pan(g,0,0,u*(Math.exp(y)-1))}d=r,p=o}),s(t,function(t,e,r){var o=f.flipX?1:-1,a=f.flipY?1:-1,s=i();if(Math.abs(t)>Math.abs(e))n.rotate(s,0,0,-t*o*Math.PI*f.rotateSpeed/window.innerWidth);else{var l=f.zoomSpeed*a*e/window.innerHeight*(s-n.lastT())/100;n.pan(s,0,0,u*(Math.exp(l)-1))}},!0),f}e.exports=n;var i=t("right-now"),o=t("3d-view"),a=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":40,"mouse-change":421,"mouse-wheel":425,"right-now":435}],174:[function(t,e,r){!function(){"use strict";function t(e){e.permitHostObjects___&&e.permitHostObjects___(t)}function r(t){return!(t.substr(0,d.length)==d&&"___"===t.substr(t.length-3))}function n(t){if(t!==Object(t))throw new TypeError("Not an object: "+t);var e=t[p];if(e&&e.key===t)return e;if(f(t)){e={key:t};try{return h(t,p,{value:e,writable:!1,enumerable:!1,configurable:!1}),e}catch(r){return}}}function i(t){return t.prototype=null,Object.freeze(t)}function o(){y||"undefined"==typeof console||(y=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}if("undefined"==typeof ses||!ses.ok||ses.ok()){"undefined"!=typeof ses&&(ses.weakMapPermitHostObjects=t);var a=!1;if("function"==typeof WeakMap){var s=WeakMap;if("undefined"!=typeof navigator&&/Firefox/.test(navigator.userAgent));else{var l=new s,u=Object.freeze({});if(l.set(u,1),1===l.get(u))return void(e.exports=WeakMap);a=!0}}var c=(Object.prototype.hasOwnProperty,Object.getOwnPropertyNames),h=Object.defineProperty,f=Object.isExtensible,d="weakmap:",p=d+"ident:"+Math.random()+"___";if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues&&"function"==typeof ArrayBuffer&&"function"==typeof Uint8Array){var v=new ArrayBuffer(25),m=new Uint8Array(v);crypto.getRandomValues(m),p=d+"rand:"+Array.prototype.map.call(m,function(t){return(t%36).toString(36)}).join("")+"___"}if(h(Object,"getOwnPropertyNames",{value:function(t){return c(t).filter(r)}}),"getPropertyNames"in Object){var g=Object.getPropertyNames;h(Object,"getPropertyNames",{value:function(t){return g(t).filter(r)}})}!function(){var t=Object.freeze;h(Object,"freeze",{value:function(e){return n(e),t(e)}});var e=Object.seal;h(Object,"seal",{value:function(t){return n(t),e(t)}});var r=Object.preventExtensions;h(Object,"preventExtensions",{value:function(t){return n(t),r(t)}})}();var y=!1,b=0,x=function(){function t(t,e){var r,i=n(t);return i?u in i?i[u]:e:(r=s.indexOf(t),r>=0?l[r]:e)}function e(t){var e=n(t);return e?u in e:s.indexOf(t)>=0}function r(t,e){var r,i=n(t);return i?i[u]=e:(r=s.indexOf(t),r>=0?l[r]=e:(r=s.length,l[r]=e,s[r]=t)),this}function a(t){var e,r,i=n(t);return i?u in i&&delete i[u]:(e=s.indexOf(t),0>e?!1:(r=s.length-1,s[e]=void 0,l[e]=l[r],s[e]=s[r],s.length=r,l.length=r,!0))}this instanceof x||o();var s=[],l=[],u=b++;return Object.create(x.prototype,{get___:{value:i(t)},has___:{value:i(e)},set___:{value:i(r)},delete___:{value:i(a)}})};x.prototype=Object.create(Object.prototype,{get:{value:function(t,e){return this.get___(t,e)},writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writable:!0,configurable:!0},set:{value:function(t,e){return this.set___(t,e)},writable:!0,configurable:!0},"delete":{value:function(t){return this.delete___(t)},writable:!0,configurable:!0}}),"function"==typeof s?!function(){function r(){function e(t,e){return c?u.has(t)?u.get(t):c.get___(t,e):u.get(t,e)}function r(t){return u.has(t)||(c?c.has___(t):!1)}function n(t){var e=!!u.delete(t);return c?c.delete___(t)||e:e}this instanceof x||o();var l,u=new s,c=void 0,h=!1;return l=a?function(t,e){return u.set(t,e),u.has(t)||(c||(c=new x),c.set(t,e)),this}:function(t,e){if(h)try{u.set(t,e)}catch(r){c||(c=new x),c.set___(t,e)}else u.set(t,e);return this},Object.create(x.prototype,{get___:{value:i(e)},has___:{value:i(r)},set___:{value:i(l)},delete___:{value:i(n)},permitHostObjects___:{value:i(function(e){if(e!==t)throw new Error("bogus call to permitHostObjects___");h=!0})}})}a&&"undefined"!=typeof Proxy&&(Proxy=void 0),r.prototype=x.prototype,e.exports=r,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=x)}}()},{}],175:[function(t,e,r){"use strict";function n(t){var e=s.get(t);if(!e||!t.isBuffer(e._triangleBuffer.buffer)){var r=o(t,new Float32Array([-1,-1,-1,4,4,-1]));e=a(t,[{buffer:r,type:t.FLOAT,size:2}]),e._triangleBuffer=r,s.set(t,e)}e.bind(),t.drawArrays(t.TRIANGLES,0,3),e.unbind()}var i="undefined"==typeof WeakMap?t("weak-map"):WeakMap,o=t("gl-buffer"),a=t("gl-vao"),s=new i;e.exports=n},{"gl-buffer":124,"gl-vao":232,"weak-map":174}],176:[function(t,e,r){"use strict";function n(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function i(t){this.gl=t,this.pixelRatio=1,this.bounds=[[-10,-10,-10],[10,10,10]],this.ticks=[[],[],[]],this.autoTicks=!0,this.tickSpacing=[1,1,1],this.tickEnable=[!0,!0,!0],this.tickFont=["sans-serif","sans-serif","sans-serif"],this.tickSize=[12,12,12],this.tickAngle=[0,0,0],this.tickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.tickPad=[10,10,10],this.lastCubeProps={cubeEdges:[0,0,0],axis:[0,0,0]},this.labels=["x","y","z"],this.labelEnable=[!0,!0,!0],this.labelFont="sans-serif",this.labelSize=[20,20,20],this.labelAngle=[0,0,0],this.labelColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.labelPad=[10,10,10],this.lineEnable=[!0,!0,!0],this.lineMirror=[!1,!1,!1],this.lineWidth=[1,1,1],this.lineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.lineTickEnable=[!0,!0,!0],this.lineTickMirror=[!1,!1,!1],this.lineTickLength=[0,0,0],this.lineTickWidth=[1,1,1],this.lineTickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.gridEnable=[!0,!0,!0],this.gridWidth=[1,1,1],this.gridColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroEnable=[!0,!0,!0],this.zeroLineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroLineWidth=[2,2,2],this.backgroundEnable=[!1,!1,!1],this.backgroundColor=[[.8,.8,.8,.5],[.8,.8,.8,.5],[.8,.8,.8,.5]],this._firstInit=!0,this._text=null,this._lines=null,this._background=c(t)}function o(){this.primalOffset=[0,0,0],this.primalMinor=[0,0,0],this.mirrorOffset=[0,0,0],this.mirrorMinor=[0,0,0]}function a(t,e,r,n,i){for(var o=t.primalOffset,a=t.primalMinor,s=t.mirrorOffset,l=t.mirrorMinor,u=n[e],c=0;3>c;++c)if(e!==c){var h=o,f=s,d=a,p=l;u&1<<c&&(h=s,f=o,d=l,p=a),h[c]=r[0][c],f[c]=r[1][c],i[c]>0?(d[c]=-1,p[c]=0):(d[c]=0,p[c]=1)}}function s(t,e){var r=new i(t);return r.update(e),r}e.exports=s;var l=t("./lib/text.js"),u=t("./lib/lines.js"),c=t("./lib/background.js"),h=t("./lib/cube.js"),f=t("./lib/ticks.js"),d=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),p=i.prototype;p.update=function(t){function e(e,r,n){if(n in t){var i,o=t[n],a=this[n];(e?Array.isArray(o)&&Array.isArray(o[0]):Array.isArray(o))?this[n]=i=[r(o[0]),r(o[1]),r(o[2])]:this[n]=i=[r(o),r(o),r(o)];for(var s=0;3>s;++s)if(i[s]!==a[s])return!0}return!1}t=t||{};var r,n=e.bind(this,!1,Number),i=e.bind(this,!1,Boolean),o=e.bind(this,!1,String),a=e.bind(this,!0,function(t){if(Array.isArray(t)){if(3===t.length)return[+t[0],+t[1],+t[2],1];if(4===t.length)return[+t[0],+t[1],+t[2],+t[3]]}return[0,0,0,1]}),s=!1,c=!1;if("bounds"in t)for(var h=t.bounds,d=0;2>d;++d)for(var p=0;3>p;++p)h[d][p]!==this.bounds[d][p]&&(c=!0),this.bounds[d][p]=h[d][p];if("ticks"in t){r=t.ticks,s=!0,this.autoTicks=!1;for(var d=0;3>d;++d)this.tickSpacing[d]=0}else n("tickSpacing")&&(this.autoTicks=!0,c=!0);if(this._firstInit&&("ticks"in t||"tickSpacing"in t||(this.autoTicks=!0),c=!0,s=!0,this._firstInit=!1),c&&this.autoTicks&&(r=f.create(this.bounds,this.tickSpacing),s=!0),s){for(var d=0;3>d;++d)r[d].sort(function(t,e){return t.x-e.x});f.equal(r,this.ticks)?s=!1:this.ticks=r}i("tickEnable"),o("tickFont")&&(s=!0),n("tickSize"),n("tickAngle"),n("tickPad"),a("tickColor");var v=o("labels");o("labelFont")&&(v=!0),i("labelEnable"),n("labelSize"),n("labelPad"),a("labelColor"),i("lineEnable"),i("lineMirror"),n("lineWidth"),a("lineColor"),i("lineTickEnable"),i("lineTickMirror"),n("lineTickLength"),n("lineTickWidth"),a("lineTickColor"),i("gridEnable"),n("gridWidth"),a("gridColor"),i("zeroEnable"),a("zeroLineColor"),n("zeroLineWidth"),i("backgroundEnable"),a("backgroundColor"),this._text?this._text&&(v||s)&&this._text.update(this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont):this._text=l(this.gl,this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont),this._lines&&s&&(this._lines.dispose(),this._lines=null),this._lines||(this._lines=u(this.gl,this.bounds,this.ticks))};var v=[new o,new o,new o],m=[0,0,0],g={model:d,view:d,projection:d};p.isOpaque=function(){return!0},p.isTransparent=function(){return!1},p.drawTransparent=function(t){};var y=[0,0,0],b=[0,0,0],x=[0,0,0];p.draw=function(t){t=t||g;for(var e=this.gl,r=t.model||d,i=t.view||d,o=t.projection||d,s=this.bounds,l=h(r,i,o,s),u=l.cubeEdges,c=l.axis,f=i[12],p=i[13],_=i[14],w=i[15],M=this.pixelRatio*(o[3]*f+o[7]*p+o[11]*_+o[15]*w)/e.drawingBufferHeight,k=0;3>k;++k)this.lastCubeProps.cubeEdges[k]=u[k],this.lastCubeProps.axis[k]=c[k];for(var A=v,k=0;3>k;++k)a(v[k],k,this.bounds,u,c);for(var e=this.gl,T=m,k=0;3>k;++k)this.backgroundEnable[k]?T[k]=c[k]:T[k]=0;this._background.draw(r,i,o,s,T,this.backgroundColor),this._lines.bind(r,i,o,this);for(var k=0;3>k;++k){var E=[0,0,0];c[k]>0?E[k]=s[1][k]:E[k]=s[0][k];for(var S=0;2>S;++S){var L=(k+1+S)%3,z=(k+1+(1^S))%3;this.gridEnable[L]&&this._lines.drawGrid(L,z,this.bounds,E,this.gridColor[L],this.gridWidth[L]*this.pixelRatio)}for(var S=0;2>S;++S){var L=(k+1+S)%3,z=(k+1+(1^S))%3;this.zeroEnable[z]&&s[0][z]<=0&&s[1][z]>=0&&this._lines.drawZero(L,z,this.bounds,E,this.zeroLineColor[z],this.zeroLineWidth[z]*this.pixelRatio)}}for(var k=0;3>k;++k){this.lineEnable[k]&&this._lines.drawAxisLine(k,this.bounds,A[k].primalOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio),this.lineMirror[k]&&this._lines.drawAxisLine(k,this.bounds,A[k].mirrorOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio);for(var I=n(y,A[k].primalMinor),P=n(b,A[k].mirrorMinor),C=this.lineTickLength,S=0;3>S;++S){var R=M/r[5*S];I[S]*=C[S]*R,P[S]*=C[S]*R}this.lineTickEnable[k]&&this._lines.drawAxisTicks(k,A[k].primalOffset,I,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio),this.lineTickMirror[k]&&this._lines.drawAxisTicks(k,A[k].mirrorOffset,P,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio)}this._text.bind(r,i,o,this.pixelRatio);for(var k=0;3>k;++k){for(var D=A[k].primalMinor,O=n(x,A[k].primalOffset),S=0;3>S;++S)this.lineTickEnable[k]&&(O[S]+=M*D[S]*Math.max(this.lineTickLength[S],0)/r[5*S]);if(this.tickEnable[k]){for(var S=0;3>S;++S)O[S]+=M*D[S]*this.tickPad[S]/r[5*S];this._text.drawTicks(k,this.tickSize[k],this.tickAngle[k],O,this.tickColor[k])}if(this.labelEnable[k]){for(var S=0;3>S;++S)O[S]+=M*D[S]*this.labelPad[S]/r[5*S];O[k]+=.5*(s[0][k]+s[1][k]),this._text.drawLabel(k,this.labelSize[k],this.labelAngle[k],O,this.labelColor[k])}}},p.dispose=function(){this._text.dispose(),this._lines.dispose(),this._background.dispose(),this._lines=null,this._text=null,this._background=null,this.gl=null}},{"./lib/background.js":177,"./lib/cube.js":178,"./lib/lines.js":179,"./lib/text.js":181,"./lib/ticks.js":182}],177:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n}function i(t){for(var e=[],r=[],i=0,l=0;3>l;++l)for(var u=(l+1)%3,c=(l+2)%3,h=[0,0,0],f=[0,0,0],d=-1;1>=d;d+=2){r.push(i,i+2,i+1,i+1,i+2,i+3),h[l]=d,f[l]=d;for(var p=-1;1>=p;p+=2){h[u]=p;for(var v=-1;1>=v;v+=2)h[c]=v,e.push(h[0],h[1],h[2],f[0],f[1],f[2]),i+=1}var m=u;u=c,c=m}var g=o(t,new Float32Array(e)),y=o(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),b=a(t,[{buffer:g,type:t.FLOAT,size:3,offset:0,stride:24},{buffer:g,type:t.FLOAT,size:3,offset:12,stride:24}],y),x=s(t);return x.attributes.position.location=0,x.attributes.normal.location=1,new n(t,g,b,x)}e.exports=i;var o=t("gl-buffer"),a=t("gl-vao"),s=t("./shaders").bg,l=n.prototype;l.draw=function(t,e,r,n,i,o){for(var a=!1,s=0;3>s;++s)a=a||i[s];if(a){var l=this.gl;l.enable(l.POLYGON_OFFSET_FILL),l.polygonOffset(1,2),this.shader.bind(),this.shader.uniforms={model:t,view:e,projection:r,bounds:n,enable:i,colors:o},this.vao.bind(),this.vao.draw(this.gl.TRIANGLES,36),l.disable(l.POLYGON_OFFSET_FILL)}},l.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders":180,"gl-buffer":124,"gl-vao":232}],178:[function(t,e,r){"use strict";function n(t,e,r){for(var n=0;4>n;++n){t[n]=r[12+n];for(var i=0;3>i;++i)t[n]+=e[i]*r[4*i+n]}}function i(t){for(var e=0;e<v.length;++e)if(t=l.positive(t,v[e]),t.length<3)return 0;for(var r=t[0],n=r[0]/r[3],i=r[1]/r[3],o=0,e=1;e+1<t.length;++e){var a=t[e],s=t[e+1],u=a[0]/a[3],c=a[1]/a[3],h=s[0]/s[3],f=s[1]/s[3],d=u-n,p=c-i,m=h-n,g=f-i;o+=Math.abs(d*g-p*m)}return o}function o(t,e,r,o){s(c,e,t),s(c,r,c);for(var l=0,v=0;2>v;++v){d[2]=o[v][2];for(var b=0;2>b;++b){d[1]=o[b][1];for(var x=0;2>x;++x)d[0]=o[x][0],n(h[l],d,c),l+=1}}for(var _=-1,v=0;8>v;++v){for(var w=h[v][3],M=0;3>M;++M)f[v][M]=h[v][M]/w;0>w&&(0>_?_=v:f[v][2]<f[_][2]&&(_=v))}if(0>_){_=0;for(var k=0;3>k;++k){for(var A=(k+2)%3,T=(k+1)%3,E=-1,S=-1,L=0;2>L;++L){var z=L<<k,I=z+(L<<A)+(1-L<<T),P=z+(1-L<<A)+(L<<T);u(f[z],f[I],f[P],p)<0||(L?E=1:S=1)}if(0>E||0>S)S>E&&(_|=1<<k);else{for(var L=0;2>L;++L){var z=L<<k,I=z+(L<<A)+(1-L<<T),P=z+(1-L<<A)+(L<<T),C=i([h[z],h[I],h[P],h[z+(1<<A)+(1<<T)]]);L?E=C:S=C}S>E&&(_|=1<<k)}}}for(var R=7^_,D=-1,v=0;8>v;++v)v!==_&&v!==R&&(0>D?D=v:f[D][1]>f[v][1]&&(D=v));for(var O=-1,v=0;3>v;++v){var F=D^1<<v;if(F!==_&&F!==R){0>O&&(O=F);var T=f[F];T[0]<f[O][0]&&(O=F)}}for(var j=-1,v=0;3>v;++v){var F=D^1<<v;if(F!==_&&F!==R&&F!==O){0>j&&(j=F);var T=f[F];T[0]>f[j][0]&&(j=F)}}var N=m;N[0]=N[1]=N[2]=0,N[a.log2(O^D)]=D&O,N[a.log2(D^j)]=D&j;var B=7^j;B===_||B===R?(B=7^O,N[a.log2(j^B)]=B&j):N[a.log2(O^B)]=B&O;for(var U=g,V=_,k=0;3>k;++k)V&1<<k?U[k]=-1:U[k]=1;return y}e.exports=o;var a=t("bit-twiddle"),s=t("gl-mat4/multiply"),l=(t("gl-mat4/invert"),t("split-polygon")),u=t("robust-orientation"),c=new Array(16),h=(new Array(16),new Array(8)),f=new Array(8),d=new Array(3),p=[0,0,0];!function(){for(var t=0;8>t;++t)h[t]=[1,1,1,1],f[t]=[1,1,1]}();var v=[[0,0,1,0,0],[0,0,-1,1,0],[0,-1,0,1,0],[0,1,0,1,0],[-1,0,0,1,0],[1,0,0,1,0]],m=[1,1,1],g=[0,0,0],y={cubeEdges:m,axis:g}},{"bit-twiddle":51,"gl-mat4/invert":143,"gl-mat4/multiply":145,"robust-orientation":439,"split-polygon":184}],179:[function(t,e,r){"use strict";function n(t){return t[0]=t[1]=t[2]=0,t}function i(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function o(t,e,r,n,i,o,a,s){this.gl=t,this.vertBuffer=e,this.vao=r,this.shader=n,this.tickCount=i,this.tickOffset=o,this.gridCount=a,this.gridOffset=s}function a(t,e,r){var n=[],i=[0,0,0],a=[0,0,0],c=[0,0,0],h=[0,0,0];n.push(0,0,1,0,1,1,0,0,-1,0,0,-1,0,1,1,0,1,-1);for(var f=0;3>f;++f){for(var d=n.length/3|0,p=0;p<r[f].length;++p){var v=+r[f][p].x;n.push(v,0,1,v,1,1,v,0,-1,v,0,-1,v,1,1,v,1,-1)}var m=n.length/3|0;i[f]=d,a[f]=m-d;for(var d=n.length/3|0,g=0;g<r[f].length;++g){var v=+r[f][g].x;n.push(v,0,1,v,1,1,v,0,-1,v,0,-1,v,1,1,v,1,-1)}var m=n.length/3|0;c[f]=d,h[f]=m-d}var y=s(t,new Float32Array(n)),b=l(t,[{buffer:y,type:t.FLOAT,size:3,stride:0,offset:0}]),x=u(t);return x.attributes.position.location=0,new o(t,y,b,x,a,i,h,c)}e.exports=a;var s=t("gl-buffer"),l=t("gl-vao"),u=t("./shaders").line,c=[0,0,0],h=[0,0,0],f=[0,0,0],d=[0,0,0],p=[1,1],v=o.prototype;v.bind=function(t,e,r){this.shader.bind(),this.shader.uniforms.model=t,this.shader.uniforms.view=e,this.shader.uniforms.projection=r,p[0]=this.gl.drawingBufferWidth,p[1]=this.gl.drawingBufferHeight,this.shader.uniforms.screenShape=p,this.vao.bind()},v.drawAxisLine=function(t,e,r,o,a){var s=n(h);this.shader.uniforms.majorAxis=h,s[t]=e[1][t]-e[0][t],this.shader.uniforms.minorAxis=s;var l=i(d,r);l[t]+=e[0][t],this.shader.uniforms.offset=l,this.shader.uniforms.lineWidth=a,this.shader.uniforms.color=o;var u=n(f);u[(t+2)%3]=1,this.shader.uniforms.screenAxis=u,this.vao.draw(this.gl.TRIANGLES,6);var u=n(f);u[(t+1)%3]=1,this.shader.uniforms.screenAxis=u,this.vao.draw(this.gl.TRIANGLES,6)},v.drawAxisTicks=function(t,e,r,i,o){ if(this.tickCount[t]){var a=n(c);a[t]=1,this.shader.uniforms.majorAxis=a,this.shader.uniforms.offset=e,this.shader.uniforms.minorAxis=r,this.shader.uniforms.color=i,this.shader.uniforms.lineWidth=o;var s=n(f);s[t]=1,this.shader.uniforms.screenAxis=s,this.vao.draw(this.gl.TRIANGLES,this.tickCount[t],this.tickOffset[t])}},v.drawGrid=function(t,e,r,o,a,s){if(this.gridCount[t]){var l=n(h);l[e]=r[1][e]-r[0][e],this.shader.uniforms.minorAxis=l;var u=i(d,o);u[e]+=r[0][e],this.shader.uniforms.offset=u;var p=n(c);p[t]=1,this.shader.uniforms.majorAxis=p;var v=n(f);v[t]=1,this.shader.uniforms.screenAxis=v,this.shader.uniforms.lineWidth=s,this.shader.uniforms.color=a,this.vao.draw(this.gl.TRIANGLES,this.gridCount[t],this.gridOffset[t])}},v.drawZero=function(t,e,r,o,a,s){var l=n(h);this.shader.uniforms.majorAxis=l,l[t]=r[1][t]-r[0][t],this.shader.uniforms.minorAxis=l;var u=i(d,o);u[t]+=r[0][t],this.shader.uniforms.offset=u;var c=n(f);c[e]=1,this.shader.uniforms.screenAxis=c,this.shader.uniforms.lineWidth=s,this.shader.uniforms.color=a,this.vao.draw(this.gl.TRIANGLES,6)},v.dispose=function(){this.vao.dispose(),this.vertBuffer.dispose(),this.shader.dispose()}},{"./shaders":180,"gl-buffer":124,"gl-vao":232}],180:[function(t,e,r){"use strict";var n=t("gl-shader"),i="#define GLSLIFY 1\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\nuniform vec3 offset, majorAxis, minorAxis, screenAxis;\nuniform float lineWidth;\nuniform vec2 screenShape;\n\nvec3 project(vec3 p) {\n vec4 pp = projection * view * model * vec4(p, 1.0);\n return pp.xyz / max(pp.w, 0.0001);\n}\n\nvoid main() {\n vec3 major = position.x * majorAxis;\n vec3 minor = position.y * minorAxis;\n\n vec3 vPosition = major + minor + offset;\n vec3 pPosition = project(vPosition);\n vec3 offset = project(vPosition + screenAxis * position.z);\n\n vec2 screen = normalize((offset - pPosition).xy * screenShape) / screenShape;\n\n gl_Position = vec4(pPosition + vec3(0.5 * screen * lineWidth, 0), 1.0);\n}\n",o="precision mediump float;\n#define GLSLIFY 1\nuniform vec4 color;\nvoid main() {\n gl_FragColor = color;\n}";r.line=function(t){return n(t,i,o,null,[{name:"position",type:"vec3"}])};var a="#define GLSLIFY 1\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\nuniform vec3 offset, axis;\nuniform float scale, angle, pixelScale;\nuniform vec2 resolution;\n\nvoid main() { \n //Compute plane offset\n vec2 planeCoord = position.xy * pixelScale;\n mat2 planeXform = scale * mat2(cos(angle), sin(angle),\n -sin(angle), cos(angle));\n vec2 viewOffset = 2.0 * planeXform * planeCoord / resolution;\n\n //Compute world offset\n float axisDistance = position.z;\n vec3 dataPosition = axisDistance * axis + offset;\n vec4 worldPosition = model * vec4(dataPosition, 1);\n \n //Compute clip position\n vec4 viewPosition = view * worldPosition;\n vec4 clipPosition = projection * viewPosition;\n clipPosition /= clipPosition.w;\n\n //Apply text offset in clip coordinates\n clipPosition += vec4(viewOffset, 0, 0);\n\n //Done\n gl_Position = clipPosition;\n}",s="precision mediump float;\n#define GLSLIFY 1\nuniform vec4 color;\nvoid main() {\n gl_FragColor = color;\n}";r.text=function(t){return n(t,a,s,null,[{name:"position",type:"vec3"}])};var l="#define GLSLIFY 1\nattribute vec3 position;\nattribute vec3 normal;\n\nuniform mat4 model, view, projection;\nuniform vec3 enable;\nuniform vec3 bounds[2];\n\nvarying vec3 colorChannel;\n\nvoid main() {\n if(dot(normal, enable) > 0.0) {\n vec3 nPosition = mix(bounds[0], bounds[1], 0.5 * (position + 1.0));\n gl_Position = projection * view * model * vec4(nPosition, 1.0);\n } else {\n gl_Position = vec4(0,0,0,0);\n }\n colorChannel = abs(normal);\n}",u="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 colors[3];\n\nvarying vec3 colorChannel;\n\nvoid main() {\n gl_FragColor = colorChannel.x * colors[0] + \n colorChannel.y * colors[1] +\n colorChannel.z * colors[2];\n}";r.bg=function(t){return n(t,l,u,null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},{"gl-shader":203}],181:[function(t,e,r){(function(r){"use strict";function n(t,e,r,n){this.gl=t,this.shader=e,this.buffer=r,this.vao=n,this.tickOffset=this.tickCount=this.labelOffset=this.labelCount=null}function i(t,e){try{return l(t,e)}catch(r){return console.warn("error vectorizing text:",r),{cells:[],positions:[]}}}function o(t,e,r,i,o,l){var c=a(t),h=s(t,[{buffer:c,size:3}]),f=u(t);f.attributes.position.location=0;var d=new n(t,f,c,h);return d.update(e,r,i,o,l),d}e.exports=o;var a=t("gl-buffer"),s=t("gl-vao"),l=t("vectorize-text"),u=t("./shaders").text,c=window||r.global||{},h=c.__TEXT_CACHE||{};c.__TEXT_CACHE={};var f=3,d=n.prototype,p=[0,0];d.bind=function(t,e,r,n){this.vao.bind(),this.shader.bind();var i=this.shader.uniforms;i.model=t,i.view=e,i.projection=r,i.pixelScale=n,p[0]=this.gl.drawingBufferWidth,p[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=p},d.update=function(t,e,r,n,o){function a(t,e,r,n){var o=h[r];o||(o=h[r]={});var a=o[e];a||(a=o[e]=i(e,{triangles:!0,font:r,textAlign:"center",textBaseline:"middle"}));for(var l=(n||12)/12,u=a.positions,c=a.cells,f=0,d=c.length;d>f;++f)for(var p=c[f],v=2;v>=0;--v){var m=u[p[v]];s.push(l*m[0],-l*m[1],t)}}for(var s=(this.gl,[]),l=[0,0,0],u=[0,0,0],c=[0,0,0],d=[0,0,0],p=0;3>p;++p){c[p]=s.length/f|0,a(.5*(t[0][p]+t[1][p]),e[p],r),d[p]=(s.length/f|0)-c[p],l[p]=s.length/f|0;for(var v=0;v<n[p].length;++v)n[p][v].text&&a(n[p][v].x,n[p][v].text,n[p][v].font||o,n[p][v].fontSize||12);u[p]=(s.length/f|0)-l[p]}this.buffer.update(s),this.tickOffset=l,this.tickCount=u,this.labelOffset=c,this.labelCount=d};var v=[0,0,0];d.drawTicks=function(t,e,r,n,i){if(this.tickCount[t]){var o=v;o[0]=o[1]=o[2]=0,o[t]=1,this.shader.uniforms.axis=o,this.shader.uniforms.color=i,this.shader.uniforms.angle=r,this.shader.uniforms.scale=e,this.shader.uniforms.offset=n,this.vao.draw(this.gl.TRIANGLES,this.tickCount[t],this.tickOffset[t])}};var m=[0,0,0];d.drawLabel=function(t,e,r,n,i){this.labelCount[t]&&(this.shader.uniforms.axis=m,this.shader.uniforms.color=i,this.shader.uniforms.angle=r,this.shader.uniforms.scale=e,this.shader.uniforms.offset=n,this.vao.draw(this.gl.TRIANGLES,this.labelCount[t],this.labelOffset[t]))},d.dispose=function(){this.shader.dispose(),this.vao.dispose(),this.buffer.dispose()}}).call(this,t("_process"))},{"./shaders":180,_process:60,"gl-buffer":124,"gl-vao":232,"vectorize-text":460}],182:[function(t,e,r){"use strict";function n(t,e){var r=t+"",n=r.indexOf("."),i=0;n>=0&&(i=r.length-n-1);var o=Math.pow(10,i),a=Math.round(t*e*o),s=a+"";if(s.indexOf("e")>=0)return s;var l=a/o,u=a%o;0>a?(l=0|-Math.ceil(l),u=0|-u):(l=0|Math.floor(l),u=0|u);var c=""+l;if(0>a&&(c="-"+c),i){for(var h=""+u;h.length<i;)h="0"+h;return c+"."+h}return c}function i(t,e){for(var r=[],i=0;3>i;++i){for(var o=[],a=(.5*(t[0][i]+t[1][i]),0);a*e[i]<=t[1][i];++a)o.push({x:a*e[i],text:n(e[i],a)});for(var a=-1;a*e[i]>=t[0][i];--a)o.push({x:a*e[i],text:n(e[i],a)});r.push(o)}return r}function o(t,e){for(var r=0;3>r;++r){if(t[r].length!==e[r].length)return!1;for(var n=0;n<t[r].length;++n){var i=t[r][n],o=e[r][n];if(i.x!==o.x||i.text!==o.text)return!1}}return!0}r.create=i,r.equal=o},{}],183:[function(t,e,r){"use strict";function n(t,e,r){var n=e||0,i=r||1;return[[t[12]+t[0],t[13]+t[1],t[14]+t[2],t[15]+t[3]],[t[12]-t[0],t[13]-t[1],t[14]-t[2],t[15]-t[3]],[t[12]+t[4],t[13]+t[5],t[14]+t[6],t[15]+t[7]],[t[12]-t[4],t[13]-t[5],t[14]-t[6],t[15]-t[7]],[n*t[12]+t[8],n*t[13]+t[9],n*t[14]+t[10],n*t[15]+t[11]],[i*t[12]-t[8],i*t[13]-t[9],i*t[14]-t[10],i*t[15]-t[11]]]}e.exports=n},{}],184:[function(t,e,r){"use strict";function n(t,e){var r=u(l(t,e),[e[e.length-1]]);return r[r.length-1]}function i(t,e,r,n){var i=n-e,o=-e/i;0>o?o=0:o>1&&(o=1);for(var a=1-o,s=t.length,l=new Array(s),u=0;s>u;++u)l[u]=o*t[u]+a*r[u];return l}function o(t,e){for(var r=[],o=[],a=n(t[t.length-1],e),s=t[t.length-1],l=t[0],u=0;u<t.length;++u,s=l){l=t[u];var c=n(l,e);if(0>a&&c>0||a>0&&0>c){var h=i(s,c,l,a);r.push(h),o.push(h.slice())}0>c?o.push(l.slice()):c>0?r.push(l.slice()):(r.push(l.slice()),o.push(l.slice())),a=c}return{positive:r,negative:o}}function a(t,e){for(var r=[],o=n(t[t.length-1],e),a=t[t.length-1],s=t[0],l=0;l<t.length;++l,a=s){s=t[l];var u=n(s,e);(0>o&&u>0||o>0&&0>u)&&r.push(i(a,u,s,o)),u>=0&&r.push(s.slice()),o=u}return r}function s(t,e){for(var r=[],o=n(t[t.length-1],e),a=t[t.length-1],s=t[0],l=0;l<t.length;++l,a=s){s=t[l];var u=n(s,e);(0>o&&u>0||o>0&&0>u)&&r.push(i(a,u,s,o)),0>=u&&r.push(s.slice()),o=u}return r}var l=t("robust-dot-product"),u=t("robust-sum");e.exports=o,e.exports.positive=a,e.exports.negative=s},{"robust-dot-product":185,"robust-sum":442}],185:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t[0],e[0]),n=1;n<t.length;++n)r=o(r,i(t[n],e[n]));return r}var i=t("two-product"),o=t("robust-sum");e.exports=n},{"robust-sum":442,"two-product":456}],186:[function(t,e,r){"use strict";function n(t,e,r){this.lo=t,this.hi=e,this.pixelsPerDataUnit=r}function i(t,e,r,n,i){for(var o=0;3>o;++o){for(var a=p,s=v,l=0;3>l;++l)s[l]=a[l]=r[l];s[3]=a[3]=1,s[o]+=1,h(s,s,e),s[3]<0&&(t[o]=1/0),a[o]-=1,h(a,a,e),a[3]<0&&(t[o]=1/0);var u=(a[0]/a[3]-s[0]/s[3])*n,c=(a[1]/a[3]-s[1]/s[3])*i;t[o]=.25*Math.sqrt(u*u+c*c)}return t}function o(t,e,r,n,o){var h=e.model||f,p=e.view||f,v=e.projection||f,y=t.bounds,o=o||l(h,p,v,y),b=o.axis;o.edges;u(d,p,h),u(d,v,d);for(var x=m,_=0;3>_;++_)x[_].lo=1/0,x[_].hi=-(1/0),x[_].pixelsPerDataUnit=1/0;var w=a(c(d,d));c(d,d);for(var M=0;3>M;++M){var k=(M+1)%3,A=(M+2)%3,T=g;t:for(var _=0;2>_;++_){var E=[];if(b[M]<0!=!!_){T[M]=y[_][M];for(var S=0;2>S;++S){T[k]=y[S^_][k];for(var L=0;2>L;++L)T[A]=y[L^S^_][A],E.push(T.slice())}for(var S=0;S<w.length;++S){if(0===E.length)continue t;E=s.positive(E,w[S])}for(var S=0;S<E.length;++S)for(var A=E[S],z=i(g,d,A,r,n),L=0;3>L;++L)x[L].lo=Math.min(x[L].lo,A[L]),x[L].hi=Math.max(x[L].hi,A[L]),L!==M&&(x[L].pixelsPerDataUnit=Math.min(x[L].pixelsPerDataUnit,Math.abs(z[L])))}}}return x}e.exports=o;var a=t("extract-frustum-planes"),s=t("split-polygon"),l=t("./lib/cube.js"),u=t("gl-mat4/multiply"),c=t("gl-mat4/transpose"),h=t("gl-vec4/transformMat4"),f=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),d=new Float32Array(16),p=[0,0,0,1],v=[0,0,0,1],m=[new n(1/0,-(1/0),1/0),new n(1/0,-(1/0),1/0),new n(1/0,-(1/0),1/0)],g=[0,0,0]},{"./lib/cube.js":178,"extract-frustum-planes":183,"gl-mat4/multiply":145,"gl-mat4/transpose":153,"gl-vec4/transformMat4":233,"split-polygon":184}],187:[function(t,e,r){"use strict";var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, color;\nattribute float weight;\n\nuniform mat4 model, view, projection;\nuniform vec3 coordinates[3];\nuniform vec4 colors[3];\nuniform vec2 screenShape;\nuniform float lineWidth;\n\nvarying vec4 fragColor;\n\nvoid main() {\n vec3 vertexPosition = mix(coordinates[0],\n mix(coordinates[2], coordinates[1], 0.5 * (position + 1.0)), abs(position));\n\n vec4 clipPos = projection * view * model * vec4(vertexPosition, 1.0);\n vec2 clipOffset = (projection * view * model * vec4(color, 0.0)).xy;\n vec2 delta = weight * clipOffset * screenShape;\n vec2 lineOffset = normalize(vec2(delta.y, -delta.x)) / screenShape;\n\n gl_Position = vec4(clipPos.xy + clipPos.w * 0.5 * lineWidth * lineOffset, clipPos.z, clipPos.w);\n fragColor = color.x * colors[0] + color.y * colors[1] + color.z * colors[2];\n}\n",o="precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}";e.exports=function(t){return n(t,i,o,null,[{name:"position",type:"vec3"},{name:"color",type:"vec3"},{name:"weight",type:"float"}])}},{"gl-shader":203}],188:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n,this.pixelRatio=1,this.bounds=[[-1e3,-1e3,-1e3],[1e3,1e3,1e3]],this.position=[0,0,0],this.lineWidth=[2,2,2],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.enabled=[!0,!0,!0],this.drawSides=[!0,!0,!0],this.axes=null}function i(t,e){function r(t,e,r,n,o,a){var s=[t,e,r,0,0,0,1];s[n+3]=1,s[n]=o,i.push.apply(i,s),s[6]=-1,i.push.apply(i,s),s[n]=a,i.push.apply(i,s),i.push.apply(i,s),s[6]=1,i.push.apply(i,s),s[n]=o,i.push.apply(i,s)}var i=[];r(0,0,0,0,0,1),r(0,0,0,1,0,1),r(0,0,0,2,0,1),r(1,0,0,1,-1,1),r(1,0,0,2,-1,1),r(0,1,0,0,-1,1),r(0,1,0,2,-1,1),r(0,0,1,0,-1,1),r(0,0,1,1,-1,1);var l=o(t,i),u=a(t,[{type:t.FLOAT,buffer:l,size:3,offset:0,stride:28},{type:t.FLOAT,buffer:l,size:3,offset:12,stride:28},{type:t.FLOAT,buffer:l,size:1,offset:24,stride:28}]),c=s(t);c.attributes.position.location=0,c.attributes.color.location=1,c.attributes.weight.location=2;var h=new n(t,l,u,c);return h.update(e),h}var o=t("gl-buffer"),a=t("gl-vao"),s=t("./shaders/index");e.exports=i;var l=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],u=n.prototype,c=[0,0,0],h=[0,0,0],f=[0,0];u.isTransparent=function(){return!1},u.drawTransparent=function(t){},u.draw=function(t){var e=this.gl,r=this.vao,n=this.shader;r.bind(),n.bind();var i,o=t.model||l,a=t.view||l,s=t.projection||l;this.axes&&(i=this.axes.lastCubeProps.axis);for(var u=c,d=h,p=0;3>p;++p)i&&i[p]<0?(u[p]=this.bounds[0][p],d[p]=this.bounds[1][p]):(u[p]=this.bounds[1][p],d[p]=this.bounds[0][p]);f[0]=e.drawingBufferWidth,f[1]=e.drawingBufferHeight,n.uniforms.model=o,n.uniforms.view=a,n.uniforms.projection=s,n.uniforms.coordinates=[this.position,u,d],n.uniforms.colors=this.colors,n.uniforms.screenShape=f;for(var p=0;3>p;++p)n.uniforms.lineWidth=this.lineWidth[p]*this.pixelRatio,this.enabled[p]&&(r.draw(e.TRIANGLES,6,6*p),this.drawSides[p]&&r.draw(e.TRIANGLES,12,18+12*p));r.unbind()},u.update=function(t){t&&("bounds"in t&&(this.bounds=t.bounds),"position"in t&&(this.position=t.position),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"colors"in t&&(this.colors=t.colors),"enabled"in t&&(this.enabled=t.enabled),"drawSides"in t&&(this.drawSides=t.drawSides))},u.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders/index":187,"gl-buffer":124,"gl-vao":232}],189:[function(t,e,r){"use strict";function n(){this.mouse=[-1,-1],this.screen=null,this.distance=1/0,this.index=null,this.dataCoordinate=null,this.dataPosition=null,this.object=null,this.data=null}function i(t,e){var r=null;try{r=t.getContext("webgl",e),r||(r=t.getContext("experimental-webgl",e))}catch(n){return null}return r}function o(t){var e=Math.round(Math.log(Math.abs(t))/Math.log(10));if(0>e){var r=Math.round(Math.pow(10,-e));return Math.ceil(t*r)/r}if(e>0){var r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function a(t){return"boolean"==typeof t?t:!0}function s(t){function e(){if(!_&&G.autoResize){var t=w.parentNode,e=1,r=1;t&&t!==document.body?(e=t.clientWidth,r=t.clientHeight):(e=window.innerWidth,r=window.innerHeight);var n=0|Math.ceil(e*G.pixelRatio),i=0|Math.ceil(r*G.pixelRatio);if(n!==w.width||i!==w.height){w.width=n,w.height=i;var o=w.style;o.position=o.position||"absolute",o.left="0px",o.top="0px",o.width=e+"px",o.height=r+"px",j=!0}}}function r(){for(var t=R.length,e=F.length,r=0;e>r;++r)O[r]=0;t:for(var r=0;t>r;++r){var n=R[r],i=n.pickSlots;if(i){for(var o=0;e>o;++o)if(O[o]+i<255){D[r]=o,n.setPickBase(O[o]+1),O[o]+=i;continue t}var a=f(k,q);D[r]=e,F.push(a),O.push(i),n.setPickBase(1),e+=1}else D[r]=-1}for(;e>0&&0===O[e-1];)O.pop(),F.pop().dispose()}function s(){return G.contextLost?!0:void(k.isContextLost()&&(G.contextLost=!0,G.mouseListener.enabled=!1,G.selection.object=null,G.oncontextloss&&G.oncontextloss()))}function y(){if(!s()){k.colorMask(!0,!0,!0,!0),k.depthMask(!0),k.disable(k.BLEND),k.enable(k.DEPTH_TEST);for(var t=R.length,e=F.length,r=0;e>r;++r){var n=F[r];n.shape=H,n.begin();for(var i=0;t>i;++i)if(D[i]===r){var o=R[i];o.drawPick&&(o.pixelRatio=1,o.drawPick(V))}n.end()}}}function b(){if(!s()){e();var t=G.camera.tick();V.view=G.camera.matrix,j=j||t,N=N||t,I.pixelRatio=G.pixelRatio,C.pixelRatio=G.pixelRatio;var r=R.length,n=W[0],i=W[1];n[0]=n[1]=n[2]=1/0,i[0]=i[1]=i[2]=-(1/0);for(var a=0;r>a;++a){var l=R[a];l.pixelRatio=G.pixelRatio,l.axes=G.axes,j=j||!!l.dirty,N=N||!!l.dirty;var u=l.bounds;if(u)for(var h=u[0],f=u[1],d=0;3>d;++d)n[d]=Math.min(n[d],h[d]),i[d]=Math.max(i[d],f[d])}var v=G.bounds;if(G.autoBounds)for(var d=0;3>d;++d){if(i[d]<n[d])n[d]=-1,i[d]=1;else{n[d]===i[d]&&(n[d]-=1,i[d]+=1);var g=.05*(i[d]-n[d]);n[d]=n[d]-g,i[d]=i[d]+g}v[0][d]=n[d],v[1][d]=i[d]}for(var b=!1,d=0;3>d;++d)b=b||Z[0][d]!==v[0][d]||Z[1][d]!==v[1][d],Z[0][d]=v[0][d],Z[1][d]=v[1][d];if(b){for(var x=[0,0,0],a=0;3>a;++a)x[a]=o((v[1][a]-v[0][a])/10);I.autoTicks?I.update({bounds:v,tickSpacing:x}):I.update({bounds:v})}N=N||b,j=j||b;var _=k.drawingBufferWidth,w=k.drawingBufferHeight;q[0]=_,q[1]=w,H[0]=0|Math.max(_/G.pixelRatio,1),H[1]=0|Math.max(w/G.pixelRatio,1),m(B,G.fovy,_/w,G.zNear,G.zFar);for(var a=0;16>a;++a)U[a]=0;U[15]=1;for(var M=0,a=0;3>a;++a)M=Math.max(M,v[1][a]-v[0][a]);for(var a=0;3>a;++a)G.autoScale?U[5*a]=G.aspect[a]/(v[1][a]-v[0][a]):U[5*a]=1/M,G.autoCenter&&(U[12+a]=.5*-U[5*a]*(v[0][a]+v[1][a]));for(var a=0;r>a;++a){var l=R[a];l.axesBounds=v,G.clipToBounds&&(l.clipBounds=v)}if(T.object&&(G.snapToData?C.position=T.dataCoordinate:C.position=T.dataPosition,C.bounds=v),N&&(N=!1,y()),j){G.axesPixels=c(G.axes,V,_,w),G.onrender&&G.onrender(),k.bindFramebuffer(k.FRAMEBUFFER,null),k.viewport(0,0,_,w);var A=G.clearColor;k.clearColor(A[0],A[1],A[2],A[3]),k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT),k.depthMask(!0),k.colorMask(!0,!0,!0,!0),k.enable(k.DEPTH_TEST),k.depthFunc(k.LEQUAL),k.disable(k.BLEND),k.disable(k.CULL_FACE);var L=!1;I.enable&&(L=L||I.isTransparent(),I.draw(V)),C.axes=I,T.object&&C.draw(V),k.disable(k.CULL_FACE);for(var a=0;r>a;++a){var l=R[a];l.axes=I,l.pixelRatio=G.pixelRatio,l.isOpaque&&l.isOpaque()&&l.draw(V),l.isTransparent&&l.isTransparent()&&(L=!0)}if(L){E.shape=q,E.bind(),k.clear(k.DEPTH_BUFFER_BIT),k.colorMask(!1,!1,!1,!1),k.depthMask(!0),k.depthFunc(k.LESS),I.enable&&I.isTransparent()&&I.drawTransparent(V);for(var a=0;r>a;++a){var l=R[a];l.isOpaque&&l.isOpaque()&&l.draw(V)}k.enable(k.BLEND),k.blendEquation(k.FUNC_ADD),k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA),k.colorMask(!0,!0,!0,!0),k.depthMask(!1),k.clearColor(0,0,0,0),k.clear(k.COLOR_BUFFER_BIT),I.isTransparent()&&I.drawTransparent(V);for(var a=0;r>a;++a){var l=R[a];l.isTransparent&&l.isTransparent()&&l.drawTransparent(V)}k.bindFramebuffer(k.FRAMEBUFFER,null),k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA),k.disable(k.DEPTH_TEST),S.bind(),E.color[0].bind(0),S.uniforms.accumBuffer=0,p(k),k.disable(k.BLEND)}j=!1;for(var a=0;r>a;++a)R[a].dirty=!1}}}function x(){_||G.contextLost||(requestAnimationFrame(x),b())}t=t||{};var _=!1,w=(t.pixelRatio||parseFloat(window.devicePixelRatio),t.canvas);if(!w)if(w=document.createElement("canvas"),t.container){var M=t.container;M.appendChild(w)}else document.body.appendChild(w);var k=t.gl;if(k||(k=i(w,t.glOptions||{premultipliedAlpha:!0,antialias:!0})),!k)throw new Error("webgl not supported");var A=t.bounds||[[-10,-10,-10],[10,10,10]],T=new n,E=d(k,[k.drawingBufferWidth,k.drawingBufferHeight],{preferFloat:!0}),S=g(k),L=t.camera||{eye:[2,0,0],center:[0,0,0],up:[0,1,0],zoomMin:.1,zoomMax:100,mode:"turntable"},z=t.axes||{},I=u(k,z);I.enable=!z.disable;var P=t.spikes||{},C=h(k,P),R=[],D=[],O=[],F=[],j=!0,N=!0,B=new Array(16),U=new Array(16),V={view:null,projection:B,model:U},N=!0,q=[k.drawingBufferWidth,k.drawingBufferHeight],G={gl:k,contextLost:!1,pixelRatio:t.pixelRatio||parseFloat(window.devicePixelRatio),canvas:w,selection:T,camera:l(w,L),axes:I,axesPixels:null,spikes:C,bounds:A,objects:R,shape:q,aspect:t.aspectRatio||[1,1,1],pickRadius:t.pickRadius||10,zNear:t.zNear||.01,zFar:t.zFar||1e3,fovy:t.fovy||Math.PI/4,clearColor:t.clearColor||[0,0,0,0],autoResize:a(t.autoResize),autoBounds:a(t.autoBounds),autoScale:!!t.autoScale,autoCenter:a(t.autoCenter),clipToBounds:a(t.clipToBounds),snapToData:!!t.snapToData,onselect:t.onselect||null,onrender:t.onrender||null,onclick:t.onclick||null,cameraParams:V,oncontextloss:null,mouseListener:null},H=[k.drawingBufferWidth/G.pixelRatio|0,k.drawingBufferHeight/G.pixelRatio|0];G.autoResize&&e(),window.addEventListener("resize",e),G.update=function(t){_||(t=t||{},j=!0,N=!0)},G.add=function(t){_||(t.axes=I,R.push(t),D.push(-1),j=!0,N=!0,r())},G.remove=function(t){if(!_){var e=R.indexOf(t);0>e||(R.splice(e,1),D.pop(),j=!0,N=!0,r())}},G.dispose=function(){if(!_&&(_=!0,window.removeEventListener("resize",e),w.removeEventListener("webglcontextlost",s),G.mouseListener.enabled=!1,!G.contextLost)){I.dispose(),C.dispose();for(var t=0;t<R.length;++t)R[t].dispose();E.dispose();for(var t=0;t<F.length;++t)F[t].dispose();S.dispose(),k=null,I=null,C=null,R=[]}};var X=!1,Y=0;G.mouseListener=v(w,function(t,e,r){if(!_){var n=F.length,i=R.length,o=T.object;T.distance=1/0,T.mouse[0]=e,T.mouse[1]=r,T.object=null,T.screen=null,T.dataCoordinate=T.dataPosition=null;var a=!1;if(t&&Y)X=!0;else{X&&(N=!0),X=!1;for(var s=0;n>s;++s){var l=F[s].query(e,H[1]-r-1,G.pickRadius);if(l){if(l.distance>T.distance)continue;for(var u=0;i>u;++u){var c=R[u];if(D[u]===s){var h=c.pick(l);h&&(T.buttons=t,T.screen=l.coord,T.distance=l.distance,T.object=c,T.index=h.distance,T.dataPosition=h.position,T.dataCoordinate=h.dataCoordinate,T.data=h,a=!0)}}}}}o&&o!==T.object&&(o.highlight&&o.highlight(null),j=!0),T.object&&(T.object.highlight&&T.object.highlight(T.data),j=!0),a=a||T.object!==o,a&&G.onselect&&G.onselect(T),1&t&&!(1&Y)&&G.onclick&&G.onclick(T),Y=t}}),w.addEventListener("webglcontextlost",s);var W=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],Z=[W[0].slice(),W[1].slice()];return x(),G.redraw=function(){_||(j=!0,b())},G}e.exports=s;var l=t("3d-view-controls"),u=t("gl-axes3d"),c=t("gl-axes3d/properties"),h=t("gl-spikes3d"),f=t("gl-select-static"),d=t("gl-fbo"),p=t("a-big-triangle"),v=t("mouse-change"),m=t("gl-mat4/perspective"),g=t("./lib/shader")},{"./lib/shader":172,"3d-view-controls":173,"a-big-triangle":175,"gl-axes3d":176,"gl-axes3d/properties":186,"gl-fbo":129,"gl-mat4/perspective":146,"gl-select-static":202,"gl-spikes3d":188,"mouse-change":421}],190:[function(t,e,r){"use strict";e.exports={vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec2 offset;\nattribute vec4 color;\n\nuniform mat3 viewTransform;\nuniform vec2 pixelScale;\n\nvarying vec4 fragColor;\n\nvec4 computePosition_1_0(vec2 position, vec2 offset, mat3 view, vec2 scale) {\n vec3 xposition = view * vec3(position, 1.0);\n return vec4(\n xposition.xy + scale * offset * xposition.z,\n 0,\n xposition.z);\n}\n\n\n\n\nvoid main() {\n fragColor = color;\n\n gl_Position = computePosition_1_0(\n position,\n offset,\n viewTransform,\n pixelScale);\n}\n",fragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n",pickVertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec2 offset;\nattribute vec4 id;\n\nuniform mat3 viewTransform;\nuniform vec2 pixelScale;\nuniform vec4 pickOffset;\n\nvarying vec4 fragColor;\n\nvec4 computePosition_1_0(vec2 position, vec2 offset, mat3 view, vec2 scale) {\n vec3 xposition = view * vec3(position, 1.0);\n return vec4(\n xposition.xy + scale * offset * xposition.z,\n 0,\n xposition.z);\n}\n\n\n\n\nvoid main() {\n vec4 fragId = id + pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n fragColor = fragId / 255.0;\n\n gl_Position = computePosition_1_0(\n position,\n offset,\n viewTransform,\n pixelScale);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],191:[function(t,e,r){"use strict";function n(t){if(t in f)return f[t];var e=c(t,{polygons:!0,font:"sans-serif",textAlign:"left",textBaseline:"alphabetic"}),r=[],n=[];e.forEach(function(t){t.forEach(function(t){for(var e=0;e<t.length;++e){var i=t[(e+t.length-1)%t.length],o=t[e],a=t[(e+1)%t.length],s=t[(e+2)%t.length],l=o[0]-i[0],u=o[1]-i[1],c=Math.sqrt(l*l+u*u);l/=c,u/=c,r.push(i[0],i[1]+1.4),n.push(u,-l),r.push(i[0],i[1]+1.4),n.push(-u,l),r.push(o[0],o[1]+1.4),n.push(-u,l),r.push(o[0],o[1]+1.4),n.push(-u,l),r.push(i[0],i[1]+1.4),n.push(u,-l),r.push(o[0],o[1]+1.4),n.push(u,-l);var h=s[0]-a[0],f=s[1]-a[1],d=Math.sqrt(h*h+f*f);h/=d,f/=d,r.push(o[0],o[1]+1.4),n.push(u,-l),r.push(o[0],o[1]+1.4),n.push(-u,l),r.push(a[0],a[1]+1.4),n.push(-f,h),r.push(a[0],a[1]+1.4),n.push(-f,h),r.push(o[0],o[1]+1.4),n.push(f,-h),r.push(a[0],a[1]+1.4),n.push(f,-h)}})});for(var i=[1/0,1/0,-(1/0),-(1/0)],o=0;o<r.length;o+=2)for(var a=0;2>a;++a)i[a]=Math.min(i[a],r[o+a]),i[2+a]=Math.max(i[2+a],r[o+a]);return f[t]={coords:r,normals:n,bounds:i}}function i(t,e,r,n,i,o,a){this.plot=t,this.shader=e,this.pickShader=r,this.positionBuffer=n,this.offsetBuffer=i,this.colorBuffer=o,this.idBuffer=a,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.numPoints=0,this.numVertices=0,this.pickOffset=0,this.points=null}function o(t,e){var r=t.gl,n=a(r,h.vertex,h.fragment),o=a(r,h.pickVertex,h.pickFragment),l=s(r),u=s(r),c=s(r),f=s(r),d=new i(t,n,o,l,u,c,f);return d.update(e),t.addObject(d),d}e.exports=o;var a=t("gl-shader"),s=t("gl-buffer"),l=t("text-cache"),u=t("typedarray-pool"),c=t("vectorize-text"),h=t("./lib/shaders"),f={},d=i.prototype;!function(){function t(){var t=this.plot,n=this.bounds,i=t.viewBox,o=t.dataBox,a=t.pixelRatio,s=n[2]-n[0],l=n[3]-n[1],u=o[2]-o[0],c=o[3]-o[1];e[0]=2*s/u,e[4]=2*l/c,e[6]=2*(n[0]-o[0])/u-1,e[7]=2*(n[1]-o[1])/c-1;var h=i[2]-i[0],f=i[3]-i[1];r[0]=2*a/h,r[1]=2*a/f}var e=[1,0,0,0,1,0,0,0,1],r=[1,1];d.draw=function(){var n=this.plot,i=this.shader,o=this.numVertices;if(o){var a=n.gl;t.call(this),i.bind(),i.uniforms.pixelScale=r,i.uniforms.viewTransform=e,this.positionBuffer.bind(),i.attributes.position.pointer(),this.offsetBuffer.bind(),i.attributes.offset.pointer(),this.colorBuffer.bind(),i.attributes.color.pointer(a.UNSIGNED_BYTE,!0),a.drawArrays(a.TRIANGLES,0,o)}};var n=[0,0,0,0];d.drawPick=function(i){var o=this.plot,a=this.pickShader,s=this.numVertices,l=o.gl;if(this.pickOffset=i,!s)return i;for(var u=0;4>u;++u)n[u]=i>>8*u&255;return t.call(this),a.bind(),a.uniforms.pixelScale=r,a.uniforms.viewTransform=e,a.uniforms.pickOffset=n,this.positionBuffer.bind(),a.attributes.position.pointer(),this.offsetBuffer.bind(),a.attributes.offset.pointer(),this.idBuffer.bind(),a.attributes.id.pointer(l.UNSIGNED_BYTE,!1),l.drawArrays(l.TRIANGLES,0,s),i+this.numPoints}}(),d.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(n>r||r>=n+i)return null;var o=r-n,a=this.points;return{object:this,pointId:o,dataCoord:[a[2*o],a[2*o+1]]}},d.update=function(t){t=t||{};var e=t.positions||[],r=t.colors||[],i=t.glyphs||[],o=t.sizes||[],a=t.borderWidths||[],s=t.borderColors||[];this.points=e;for(var c=this.bounds=[1/0,1/0,-(1/0),-(1/0)],h=0,f=0;f<i.length;++f){h+=l("sans-serif",i[f]).data.length+n(i[f]).coords.length>>1;for(var d=0;2>d;++d)c[d]=Math.min(c[d],e[2*f+d]),c[2+d]=Math.max(c[2+d],e[2*f+d])}c[0]===c[2]&&(c[2]+=1),c[3]===c[1]&&(c[3]+=1);for(var p=1/(c[2]-c[0]),v=1/(c[3]-c[1]),m=c[0],g=c[1],y=u.mallocFloat32(2*h),b=u.mallocFloat32(2*h),x=u.mallocUint8(4*h),_=u.mallocUint32(h),w=0,f=0;f<i.length;++f){for(var M=l("sans-serif",i[f]),k=n(i[f]),A=p*(e[2*f]-m),T=v*(e[2*f+1]-g),E=o[f],S=255*r[4*f],L=255*r[4*f+1],z=255*r[4*f+2],I=255*r[4*f+3],P=.5*(k.bounds[0]+k.bounds[2]),C=.5*(k.bounds[1]+k.bounds[3]),d=0;d<M.data.length;d+=2)y[2*w]=A,y[2*w+1]=T,b[2*w]=-E*(M.data[d]-P),b[2*w+1]=-E*(M.data[d+1]-C),x[4*w]=S,x[4*w+1]=L,x[4*w+2]=z,x[4*w+3]=I,_[w]=f,w+=1;var R=a[f];S=255*s[4*f],L=255*s[4*f+1],z=255*s[4*f+2],I=255*s[4*f+3];for(var d=0;d<k.coords.length;d+=2)y[2*w]=A,y[2*w+1]=T,b[2*w]=-(E*(k.coords[d]-P)+R*k.normals[d]),b[2*w+1]=-(E*(k.coords[d+1]-C)+R*k.normals[d+1]),x[4*w]=S,x[4*w+1]=L,x[4*w+2]=z,x[4*w+3]=I,_[w]=f,w+=1}this.numPoints=i.length,this.numVertices=h,this.positionBuffer.update(y),this.offsetBuffer.update(b),this.colorBuffer.update(x),this.idBuffer.update(_),u.free(y),u.free(b),u.free(x),u.free(_)},d.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.positionBuffer.dispose(),this.offsetBuffer.dispose(),this.colorBuffer.dispose(),this.idBuffer.dispose(),this.plot.removeObject(this)}},{"./lib/shaders":190,"gl-buffer":124,"gl-shader":203,"text-cache":453,"typedarray-pool":458,"vectorize-text":460}],192:[function(t,e,r){r.pointVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute float weight;\n\nuniform mat3 matrix;\nuniform float pointSize, useWeight;\n\nvarying float fragWeight;\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n gl_PointSize = pointSize;\n fragWeight = mix(1.0, weight, useWeight);\n}\n",r.pointFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color, borderColor;\nuniform float centerFraction;\n\nvarying float fragWeight;\n\nfloat smoothStep(float x, float y) {\n return 1.0 / (1.0 + exp(50.0*(x - y)));\n}\n\nvoid main() {\n float radius = length(2.0*gl_PointCoord.xy-1.0);\n if(radius > 1.0) {\n discard;\n }\n vec4 baseColor = mix(borderColor, color, smoothStep(radius, centerFraction));\n float alpha = 1.0 - pow(1.0 - baseColor.a, fragWeight);\n gl_FragColor = vec4(baseColor.rgb * alpha, alpha);\n}\n",r.pickVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n gl_PointSize = pointSize;\n\n vec4 id = pickId + pickOffset;\n id.y += floor(id.x / 256.0);\n id.x -= floor(id.x / 256.0) * 256.0;\n\n id.z += floor(id.y / 256.0);\n id.y -= floor(id.y / 256.0) * 256.0;\n\n id.w += floor(id.z / 256.0);\n id.z -= floor(id.z / 256.0) * 256.0;\n\n fragId = id;\n}\n",r.pickFragment="precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragId;\n\nvoid main() {\n float radius = length(2.0*gl_PointCoord.xy-1.0);\n if(radius > 1.0) {\n discard;\n }\n gl_FragColor = fragId / 255.0;\n}\n"},{}],193:[function(t,e,r){arguments[4][68][0].apply(r,arguments)},{dup:68}],194:[function(t,e,r){"use strict";function n(t,e,r,n,o){4*f>=o?i(0,o-1,t,e,r,n):h(0,o-1,t,e,r,n)}function i(t,e,r,n,i,o){for(var a=t+1;e>=a;++a){for(var s=r[a],l=n[2*a],u=n[2*a+1],c=i[a],h=o[a],f=a;f>t;){var d=r[f-1],p=n[2*(f-1)];if((d-s||l-p)>=0)break;r[f]=d,n[2*f]=p,n[2*f+1]=n[2*f-1],i[f]=i[f-1],o[f]=o[f-1],f-=1}r[f]=s,n[2*f]=l,n[2*f+1]=u,i[f]=c,o[f]=h}}function o(t,e,r,n,i,o){var a=r[t],s=n[2*t],l=n[2*t+1],u=i[t],c=o[t];r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],o[t]=o[e],r[e]=a,n[2*e]=s,n[2*e+1]=l,i[e]=u,o[e]=c}function a(t,e,r,n,i,o){r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],o[t]=o[e]}function s(t,e,r,n,i,o,a){var s=n[t],l=i[2*t],u=i[2*t+1],c=o[t],h=a[t];n[t]=n[e],i[2*t]=i[2*e],i[2*t+1]=i[2*e+1],o[t]=o[e],a[t]=a[e],n[e]=n[r],i[2*e]=i[2*r],i[2*e+1]=i[2*r+1],o[e]=o[r],a[e]=a[r],n[r]=s,i[2*r]=l,i[2*r+1]=u,o[r]=c,a[r]=h}function l(t,e,r,n,i,o,a,s,l,u,c){s[t]=s[e],l[2*t]=l[2*e],l[2*t+1]=l[2*e+1],u[t]=u[e],c[t]=c[e],s[e]=r,l[2*e]=n,l[2*e+1]=i,u[e]=o,c[e]=a}function u(t,e,r,n,i){return(r[t]-r[e]||n[2*e]-n[2*t]||i[t]-i[e])<0}function c(t,e,r,n,i,o,a,s){return(e-o[t]||a[2*t]-r||i-s[t])<0}function h(t,e,r,n,d,p){var v=(e-t+1)/6|0,m=t+v,g=e-v,y=t+e>>1,b=y-v,x=y+v,_=m,w=b,M=y,k=x,A=g,T=t+1,E=e-1,S=0;u(_,w,r,n,d,p)&&(S=_,_=w,w=S),u(k,A,r,n,d,p)&&(S=k,k=A,A=S),u(_,M,r,n,d,p)&&(S=_,_=M,M=S),u(w,M,r,n,d,p)&&(S=w,w=M,M=S),u(_,k,r,n,d,p)&&(S=_,_=k,k=S),u(M,k,r,n,d,p)&&(S=M, M=k,k=S),u(w,A,r,n,d,p)&&(S=w,w=A,A=S),u(w,M,r,n,d,p)&&(S=w,w=M,M=S),u(k,A,r,n,d,p)&&(S=k,k=A,A=S);var L=r[w],z=n[2*w],I=n[2*w+1],P=d[w],C=p[w],R=r[k],D=n[2*k],O=n[2*k+1],F=d[k],j=p[k],N=_,B=M,U=A,V=m,q=y,G=g,H=r[N],X=r[B],Y=r[U];r[V]=H,r[q]=X,r[G]=Y;for(var W=0;2>W;++W){var Z=n[2*N+W],K=n[2*B+W],J=n[2*U+W];n[2*V+W]=Z,n[2*q+W]=K,n[2*G+W]=J}var =d[N],Q=d[B],tt=d[U];d[V]=,d[q]=Q,d[G]=tt;var et=p[N],rt=p[B],nt=p[U];p[V]=et,p[q]=rt,p[G]=nt,a(b,t,r,n,d,p),a(x,e,r,n,d,p);for(var it=T;E>=it;++it)if(c(it,L,z,I,P,r,n,d))it!==T&&o(it,T,r,n,d,p),++T;else if(!c(it,R,D,O,F,r,n,d))for(;;){if(c(E,R,D,O,F,r,n,d)){c(E,L,z,I,P,r,n,d)?(s(it,T,E,r,n,d,p),++T,--E):(o(it,E,r,n,d,p),--E);break}if(--E<it)break}l(t,T-1,L,z,I,P,C,r,n,d,p),l(e,E+1,R,D,O,F,j,r,n,d,p),f>=T-2-t?i(t,T-2,r,n,d,p):h(t,T-2,r,n,d,p),f>=e-(E+2)?i(E+2,e,r,n,d,p):h(E+2,e,r,n,d,p),f>=E-T?i(T,E,r,n,d,p):h(T,E,r,n,d,p)}e.exports=n;var f=32},{}],195:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s){for(var l=r,u=r;n>u;++u){var c=t[2*u],h=t[2*u+1],f=e[u];c>=i&&a>=c&&h>=o&&s>=h&&(u===l?l+=1:(t[2*u]=t[2*l],t[2*u+1]=t[2*l+1],e[u]=e[l],t[2*l]=c,t[2*l+1]=h,e[l]=f,l+=1))}return l}function i(t,e,r){this.pixelSize=t,this.offset=e,this.count=r}function o(t,e,r,o){function l(i,o,a,s,u,c){var h=.5*a,f=s+1,d=u-s;r[_]=d,x[_++]=c;for(var p=0;2>p;++p)for(var v=0;2>v;++v){var m=i+p*h,g=o+v*h,y=n(t,e,f,u,m,g,m+h,g+h);if(y!==f){if(y-f>=Math.max(.9*d,32)){var b=u+s>>>1;l(m,g,h,f,b,c+1),f=b}l(m,g,h,f,y,c+1),f=y}}}var u=t.length>>>1;if(1>u)return[];for(var c=1/0,h=1/0,f=-(1/0),d=-(1/0),p=0;u>p;++p){var v=t[2*p],m=t[2*p+1];c=Math.min(c,v),f=Math.max(f,v),h=Math.min(h,m),d=Math.max(d,m),e[p]=p}c===f&&(f+=1+Math.abs(f)),h===d&&(d+=1+Math.abs(f));var g=1/(f-c),y=1/(d-h),b=Math.max(f-c,d-h);o=o||[0,0,0,0],o[0]=c,o[1]=h,o[2]=f,o[3]=d;var x=a.mallocInt32(u),_=0;l(c,h,b,0,u,0),s(x,t,e,r,u);for(var w=[],M=0,k=u,_=u-1;_>=0;--_){t[2*_]=(t[2*_]-c)*g,t[2*_+1]=(t[2*_+1]-h)*y;var A=x[_];A!==M&&(w.push(new i(b*Math.pow(.5,A),_+1,k-(_+1))),k=_+1,M=A)}return w.push(new i(b*Math.pow(.5,A+1),0,k)),a.free(x),w}var a=t("typedarray-pool"),s=t("./lib/sort");e.exports=o},{"./lib/sort":194,"typedarray-pool":458}],196:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this.plot=t,this.offsetBuffer=e,this.pickBuffer=r,this.weightBuffer=n,this.shader=i,this.pickShader=o,this.scales=[],this.size=12,this.borderSize=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.pickOffset=0,this.points=null,this.xCoords=null}function i(t,e){var r=t.gl,i=a(r),s=a(r),l=a(r),u=o(r,c.pointVertex,c.pointFragment),h=o(r,c.pickVertex,c.pickFragment),f=new n(t,i,s,l,u,h);return f.update(e),t.addObject(f),f}var o=t("gl-shader"),a=t("gl-buffer"),s=t("binary-search-bounds"),l=t("snap-points-2d"),u=t("typedarray-pool"),c=t("./lib/shader");e.exports=i;var h=n.prototype;h.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.xCoords&&u.free(this.xCoords),this.plot.removeObject(this)},h.update=function(t){function e(e,r){return e in t?t[e]:r}t=t||{},this.size=e("size",12),this.color=e("color",[1,0,0,1]).slice(),this.borderSize=e("borderSize",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.xCoords&&u.free(this.xCoords);var r=t.positions,n=u.mallocFloat32(r.length),i=u.mallocInt32(r.length>>>1);n.set(r);var o=u.mallocFloat32(r.length);this.points=r,this.scales=l(n,i,o,this.bounds),this.offsetBuffer.update(n),this.pickBuffer.update(i),this.weightBuffer.update(o);for(var a=u.mallocFloat32(r.length>>>1),s=0,c=0;s<r.length;s+=2,++c)a[c]=n[s];u.free(i),u.free(n),u.free(o),this.xCoords=a,this.pointCount=r.length>>>1,this.pickOffset=0},h.drawPick=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0,0,0];return function(r){var n=this.plot,i=this.pickShader,o=this.scales,a=this.offsetBuffer,l=this.pickBuffer,u=this.bounds,c=this.size,h=this.borderSize,f=n.gl,d=n.pickPixelRatio,p=n.viewBox,v=n.dataBox;if(0===this.pointCount)return r;var m=u[2]-u[0],g=u[3]-u[1],y=v[2]-v[0],b=v[3]-v[1],x=(p[2]-p[0])*d/n.pixelRatio,_=(p[3]-p[1])*d/n.pixelRatio,w=Math.min(y/x,b/_);t[0]=2*m/y,t[4]=2*g/b,t[6]=2*(u[0]-v[0])/y-1,t[7]=2*(u[1]-v[1])/b-1,this.pickOffset=r,e[0]=255&r,e[1]=r>>8&255,e[2]=r>>16&255,e[3]=r>>24&255,i.bind(),i.uniforms.matrix=t,i.uniforms.color=this.color,i.uniforms.borderColor=this.borderColor,i.uniforms.pointSize=d*(c+h),i.uniforms.pickOffset=e,0===this.borderSize?i.uniforms.centerFraction=2:i.uniforms.centerFraction=c/(c+h+1.25),a.bind(),i.attributes.position.pointer(),l.bind(),i.attributes.pickId.pointer(f.UNSIGNED_BYTE);for(var M=this.xCoords,k=(v[0]-u[0]-w*c*d)/m,A=(v[2]-u[0]+w*c*d)/m,T=o.length-1;T>=0;--T){var E=o[T];if(!(E.pixelSize<w&&T>1)){var S=E.offset,L=E.count+S,z=s.ge(M,k,S,L-1),I=s.lt(M,A,z,L-1)+1;I>z&&f.drawArrays(f.POINTS,z,I-z)}}return r+this.pointCount}}(),h.draw=function(){var t=[1,0,0,0,1,0,0,0,1];return function(){var e=this.plot,r=this.shader,n=this.scales,i=this.offsetBuffer,o=this.bounds,a=this.size,l=this.borderSize,u=e.gl,c=e.pixelRatio,h=e.viewBox,f=e.dataBox;if(0!==this.pointCount){var d=o[2]-o[0],p=o[3]-o[1],v=f[2]-f[0],m=f[3]-f[1],g=h[2]-h[0],y=h[3]-h[1],b=Math.min(v/g,m/y);t[0]=2*d/v,t[4]=2*p/m,t[6]=2*(o[0]-f[0])/v-1,t[7]=2*(o[1]-f[1])/m-1,r.bind(),r.uniforms.matrix=t,r.uniforms.color=this.color,r.uniforms.borderColor=this.borderColor,r.uniforms.pointSize=c*(a+l),r.uniforms.useWeight=1,0===this.borderSize?r.uniforms.centerFraction=2:r.uniforms.centerFraction=a/(a+l+1.25),i.bind(),r.attributes.position.pointer(),this.weightBuffer.bind(),r.attributes.weight.pointer();for(var x=this.xCoords,_=(f[0]-o[0]-b*a*c)/d,w=(f[2]-o[0]+b*a*c)/d,M=!0,k=n.length-1;k>=0;--k){var A=n[k];if(!(A.pixelSize<b&&k>1)){var T=A.offset,E=A.count+T,S=s.ge(x,_,T,E-1),L=s.lt(x,w,S,E-1)+1;L>S&&u.drawArrays(u.POINTS,S,L-S),M&&(M=!1,r.uniforms.useWeight=0)}}}}}(),h.pick=function(t,e,r){var n=this.pickOffset,i=this.pointCount;if(n>r||r>=n+i)return null;var o=r-n,a=this.points;return{object:this,pointId:o,dataCoord:[a[2*o],a[2*o+1]]}}},{"./lib/shader":192,"binary-search-bounds":193,"gl-buffer":124,"gl-shader":203,"snap-points-2d":195,"typedarray-pool":458}],197:[function(t,e,r){"use strict";function n(t,e){var r=o[e];if(r||(r=o[e]={}),t in r)return r[t];for(var n=i(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),a=i(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-(1/0),-(1/0)]],l=0;l<n.positions.length;++l)for(var u=n.positions[l],c=0;2>c;++c)s[0][c]=Math.min(s[0][c],u[c]),s[1][c]=Math.max(s[1][c],u[c]);return r[t]=[a,n,s]}var i=t("vectorize-text");e.exports=n;var o={}},{"vectorize-text":460}],198:[function(t,e,r){function n(t,e){var r=i(t,e),n=r.attributes;return n.position.location=0,n.color.location=1,n.glyph.location=2,n.id.location=3,r}var i=t("gl-shader"),o="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\n\nuniform vec4 highlightId;\nuniform float highlightScale;\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1])) ) {\n gl_Position = vec4(0,0,0,0);\n } else {\n float scale = 1.0;\n if(distance(highlightId, id) < 0.0001) {\n scale = highlightScale;\n }\n\n vec4 worldPosition = model * vec4(position, 1);\n vec4 viewPosition = view * worldPosition;\n viewPosition = viewPosition / viewPosition.w;\n vec4 clipPosition = projection * (viewPosition + scale * vec4(glyph.x, -glyph.y, 0, 0));\n \n gl_Position = clipPosition;\n interpColor = color;\n pickId = id;\n dataCoordinate = position;\n }\n}",a="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec2 screenSize;\nuniform vec3 clipBounds[2];\nuniform float highlightScale, pixelRatio;\nuniform vec4 highlightId;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n float scale = pixelRatio;\n if(distance(highlightId.bgr, id.bgr) < 0.001) {\n scale *= highlightScale;\n }\n\n vec4 worldPosition = model * vec4(position, 1.0);\n vec4 viewPosition = view * worldPosition;\n vec4 clipPosition = projection * viewPosition;\n clipPosition /= clipPosition.w;\n \n gl_Position = clipPosition + vec4(screenSize * scale * vec2(glyph.x, -glyph.y), 0.0, 0.0);\n interpColor = color;\n pickId = id;\n dataCoordinate = position;\n }\n}",s="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform float highlightScale;\nuniform vec4 highlightId;\nuniform vec3 axes[2];\nuniform mat4 model, view, projection;\nuniform vec2 screenSize;\nuniform vec3 clipBounds[2];\nuniform float scale, pixelRatio;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) ||\n any(greaterThan(position, clipBounds[1])) ) {\n gl_Position = vec4(0,0,0,0);\n } else {\n float lscale = pixelRatio * scale;\n if(distance(highlightId, id) < 0.0001) {\n lscale *= highlightScale;\n }\n\n vec4 clipCenter = projection * view * model * vec4(position, 1);\n vec3 dataPosition = position + 0.5*lscale*(axes[0] * glyph.x + axes[1] * glyph.y) * clipCenter.w * screenSize.y;\n vec4 clipPosition = projection * view * model * vec4(dataPosition, 1);\n\n gl_Position = clipPosition;\n interpColor = color;\n pickId = id;\n dataCoordinate = dataPosition;\n }\n}\n",l="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 fragClipBounds[2];\nuniform float opacity;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(dataCoordinate, fragClipBounds[0])) ||\n any(greaterThan(dataCoordinate, fragClipBounds[1])) ) {\n discard;\n } else {\n gl_FragColor = interpColor * opacity;\n }\n}\n",u="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 fragClipBounds[2];\nuniform float pickGroup;\n\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(dataCoordinate, fragClipBounds[0])) || \n any(greaterThan(dataCoordinate, fragClipBounds[1])) ) {\n discard;\n } else {\n gl_FragColor = vec4(pickGroup, pickId.bgr);\n }\n}",c=[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"glyph",type:"vec2"},{name:"id",type:"vec4"}],h={vertex:o,fragment:l,attributes:c},f={vertex:a,fragment:l,attributes:c},d={vertex:s,fragment:l,attributes:c},p={vertex:o,fragment:u,attributes:c},v={vertex:a,fragment:u,attributes:c},m={vertex:s,fragment:u,attributes:c};r.createPerspective=function(t){return n(t,h)},r.createOrtho=function(t){return n(t,f)},r.createProject=function(t){return n(t,d)},r.createPickPerspective=function(t){return n(t,p)},r.createPickOrtho=function(t){return n(t,v)},r.createPickProject=function(t){return n(t,m)}},{"gl-shader":203}],199:[function(t,e,r){"use strict";function n(t,e){var r=t[0],n=t[1],i=t[2],o=t[3];return t[0]=e[0]*r+e[4]*n+e[8]*i+e[12]*o,t[1]=e[1]*r+e[5]*n+e[9]*i+e[13]*o,t[2]=e[2]*r+e[6]*n+e[10]*i+e[14]*o,t[3]=e[3]*r+e[7]*n+e[11]*i+e[15]*o,t}function i(t,e,r,i){return n(i,i,r),n(i,i,e),n(i,i,t)}function o(t,e){this.index=t,this.dataCoordinate=this.position=e}function a(t,e,r,n,i,a,s,l,u,c,h,f){this.gl=t,this.pixelRatio=1,this.shader=e,this.orthoShader=r,this.projectShader=n,this.pointBuffer=i,this.colorBuffer=a,this.glyphBuffer=s,this.idBuffer=l,this.vao=u,this.vertexCount=0,this.lineVertexCount=0,this.opacity=1,this.lineWidth=0,this.projectScale=[2/3,2/3,2/3],this.projectOpacity=[1,1,1],this.pickId=0,this.pickPerspectiveShader=c,this.pickOrthoShader=h,this.pickProjectShader=f,this.points=[],this._selectResult=new o(0,[0,0,0]),this.useOrtho=!0,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.axesProject=[!0,!0,!0],this.axesBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.highlightId=[1,1,1,1],this.highlightScale=2,this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.dirty=!0}function s(t){return t[0]=t[1]=t[2]=0,t}function l(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t}function u(t,e,r,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[r]=n,t}function c(t){for(var e=L,r=0;2>r;++r)for(var n=0;3>n;++n)e[r][n]=Math.max(Math.min(t[r][n],1e8),-1e8);return e}function h(t,e,r,n,o){var a,h=e.axesProject,f=e.gl,d=t.uniforms,p=r.model||x,v=r.view||x,m=r.projection||x,y=e.axesBounds,b=c(e.clipBounds);a=e.axes?e.axes.lastCubeProps.axis:[1,1,1],w[0]=2/f.drawingBufferWidth,w[1]=2/f.drawingBufferHeight,t.bind(),d.view=v,d.projection=m,d.screenSize=w,d.highlightId=e.highlightId,d.highlightScale=e.highlightScale,d.clipBounds=b,d.pickGroup=e.pickId/255,d.pixelRatio=e.pixelRatio;for(var _=0;3>_;++_)if(h[_]&&e.projectOpacity[_]<1===n){d.scale=e.projectScale[_],d.opacity=e.projectOpacity[_];for(var L=E,z=0;16>z;++z)L[z]=0;for(var z=0;4>z;++z)L[5*z]=1;L[5*_]=0,a[_]<0?L[12+_]=y[0][_]:L[12+_]=y[1][_],g(L,p,L),d.model=L;var I=(_+1)%3,P=(_+2)%3,C=s(M),R=s(k);C[I]=1,R[P]=1;var D=i(m,v,p,l(A,C)),O=i(m,v,p,l(T,R));if(Math.abs(D[1])>Math.abs(O[1])){var F=D;D=O,O=F,F=C,C=R,R=F;var j=I;I=P,P=j}D[0]<0&&(C[I]=-1),O[1]>0&&(R[P]=-1);for(var N=0,B=0,z=0;4>z;++z)N+=Math.pow(p[4*I+z],2),B+=Math.pow(p[4*P+z],2);C[I]/=Math.sqrt(N),R[P]/=Math.sqrt(B),d.axes[0]=C,d.axes[1]=R,d.fragClipBounds[0]=u(S,b[0],_,-1e8),d.fragClipBounds[1]=u(S,b[1],_,1e8),e.vao.draw(f.TRIANGLES,e.vertexCount),e.lineWidth>0&&(f.lineWidth(e.lineWidth),e.vao.draw(f.LINES,e.lineVertexCount,e.vertexCount))}}function f(t,e,r,n,i,o){var a=r.gl;if(r.vao.bind(),i===r.opacity<1||o){t.bind();var s=t.uniforms;s.model=n.model||x,s.view=n.view||x,s.projection=n.projection||x,w[0]=2/a.drawingBufferWidth,w[1]=2/a.drawingBufferHeight,s.screenSize=w,s.highlightId=r.highlightId,s.highlightScale=r.highlightScale,s.fragClipBounds=P,s.clipBounds=r.axes.bounds,s.opacity=r.opacity,s.pickGroup=r.pickId/255,s.pixelRatio=r.pixelRatio,r.vao.draw(a.TRIANGLES,r.vertexCount),r.lineWidth>0&&(a.lineWidth(r.lineWidth),r.vao.draw(a.LINES,r.lineVertexCount,r.vertexCount))}h(e,r,n,i,o),r.vao.unbind()}function d(t){var e=t.gl,r=y.createPerspective(e),n=y.createOrtho(e),i=y.createProject(e),o=y.createPickPerspective(e),s=y.createPickOrtho(e),l=y.createPickProject(e),u=p(e),c=p(e),h=p(e),f=p(e),d=v(e,[{buffer:u,size:3,type:e.FLOAT},{buffer:c,size:4,type:e.FLOAT},{buffer:h,size:2,type:e.FLOAT},{buffer:f,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),m=new a(e,r,n,i,u,c,h,f,d,o,s,l);return m.update(t),m}var p=t("gl-buffer"),v=t("gl-vao"),m=t("typedarray-pool"),g=t("gl-mat4/multiply"),y=t("./lib/shaders"),b=t("./lib/glyphs"),x=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];e.exports=d;var _=a.prototype;_.pickSlots=1,_.setPickBase=function(t){this.pickId=t},_.isTransparent=function(){if(this.opacity<1)return!0;for(var t=0;3>t;++t)if(this.axesProject[t]&&this.projectOpacity[t]<1)return!0;return!1},_.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;3>t;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var w=[0,0],M=[0,0,0],k=[0,0,0],A=[0,0,0,1],T=[0,0,0,1],E=x.slice(),S=[0,0,0],L=[[0,0,0],[0,0,0]],z=[-1e8,-1e8,-1e8],I=[1e8,1e8,1e8],P=[z,I];_.draw=function(t){var e=this.useOrtho?this.orthoShader:this.shader;f(e,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){var e=this.useOrtho?this.orthoShader:this.shader;f(e,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){var e=this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader;f(e,this.pickProjectShader,this,t,!1,!0)},_.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[2]+(t.value[1]<<8)+(t.value[0]<<16);if(e>=this.pointCount||0>e)return null;var r=this.points[e],n=this._selectResult;n.index=e;for(var i=0;3>i;++i)n.position[i]=n.dataCoordinate[i]=r[i];return n},_.highlight=function(t){if(t){var e=t.index,r=255&e,n=e>>8&255,i=e>>16&255;this.highlightId=[r/255,n/255,i/255,0]}else this.highlightId=[1,1,1,1]},_.update=function(t){if(t=t||{},"perspective"in t&&(this.useOrtho=!t.perspective),"orthographic"in t&&(this.useOrtho=!!t.orthographic),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"project"in t)if(Array.isArray(t.project))this.axesProject=t.project;else{var e=!!t.project;this.axesProject=[e,e,e]}if("projectScale"in t)if(Array.isArray(t.projectScale))this.projectScale=t.projectScale.slice();else{var r=+t.projectScale;this.projectScale=[r,r,r]}if("projectOpacity"in t)if(Array.isArray(t.projectOpacity))this.projectOpacity=t.projectOpacity.slice();else{var r=+t.projectOpacity;this.projectOpacity=[r,r,r]}"opacity"in t&&(this.opacity=t.opacity),this.dirty=!0;var n=t.position;if(n){var i=t.font||"normal",o=t.alignment||[0,0],a=[1/0,1/0,1/0],s=[-(1/0),-(1/0),-(1/0)],l=t.glyph,u=t.color,c=t.size,h=t.angle,f=t.lineColor,d=0,p=0,v=0,g=n.length;t:for(var y=0;g>y;++y){for(var x=n[y],_=0;3>_;++_)if(isNaN(x[_])||!isFinite(x[_]))continue t;var w;w=Array.isArray(l)?b(l[y],i):l?b(l,i):b("\u25cf",i);var M=w[0],k=w[1],A=w[2];p+=3*M.cells.length,v+=2*k.edges.length}var T=p+v,E=m.mallocFloat(3*T),S=m.mallocFloat(4*T),L=m.mallocFloat(2*T),z=m.mallocUint32(T),I=[0,o[1]],P=0,C=p,R=[0,0,0,1],D=[0,0,0,1],O=Array.isArray(u)&&Array.isArray(u[0]),F=Array.isArray(f)&&Array.isArray(f[0]);t:for(var y=0;g>y;++y){for(var x=n[y],_=0;3>_;++_){if(isNaN(x[_])||!isFinite(x[_])){d+=1;continue t}s[_]=Math.max(s[_],x[_]),a[_]=Math.min(a[_],x[_])}var w;w=Array.isArray(l)?b(l[y],i):l?b(l,i):b("\u25cf",i);var M=w[0],k=w[1],A=w[2];if(Array.isArray(u)){var j;if(j=O?u[y]:u,3===j.length){for(var _=0;3>_;++_)R[_]=j[_];R[3]=1}else if(4===j.length)for(var _=0;4>_;++_)R[_]=j[_]}else R[0]=R[1]=R[2]=0,R[3]=1;if(Array.isArray(f)){var j;if(j=F?f[y]:f,3===j.length){for(var _=0;3>_;++_)D[_]=j[_];D[_]=1}else if(4===j.length)for(var _=0;4>_;++_)D[_]=j[_]}else D[0]=D[1]=D[2]=0,D[3]=1;var N=.5;Array.isArray(c)?N=+c[y]:c?N=+c:this.useOrtho&&(N=12);var B=0;Array.isArray(h)?B=+h[y]:h&&(B=+h);for(var U=Math.cos(B),V=Math.sin(B),x=n[y],_=0;3>_;++_)s[_]=Math.max(s[_],x[_]),a[_]=Math.min(a[_],x[_]);o[0]<0?I[0]=o[0]*(1+A[1][0]):o[0]>0&&(I[0]=-o[0]*(1+A[0][0]));for(var q=M.cells,G=M.positions,_=0;_<q.length;++_)for(var H=q[_],X=0;3>X;++X){for(var Y=0;3>Y;++Y)E[3*P+Y]=x[Y];for(var Y=0;4>Y;++Y)S[4*P+Y]=R[Y];z[P]=d;var W=G[H[X]];L[2*P]=N*(U*W[0]-V*W[1]+I[0]),L[2*P+1]=N*(V*W[0]+U*W[1]+I[1]),P+=1}for(var q=k.edges,G=k.positions,_=0;_<q.length;++_)for(var H=q[_],X=0;2>X;++X){for(var Y=0;3>Y;++Y)E[3*C+Y]=x[Y];for(var Y=0;4>Y;++Y)S[4*C+Y]=D[Y];z[C]=d;var W=G[H[X]];L[2*C]=N*(U*W[0]-V*W[1]+I[0]),L[2*C+1]=N*(V*W[0]+U*W[1]+I[1]),C+=1}d+=1}this.vertexCount=p,this.lineVertexCount=v,this.pointBuffer.update(E),this.colorBuffer.update(S),this.glyphBuffer.update(L),this.idBuffer.update(new Uint32Array(z)),m.free(E),m.free(S),m.free(L),m.free(z),this.bounds=[a,s],this.points=n,this.pointCount=n.length}},_.dispose=function(){this.shader.dispose(),this.orthoShader.dispose(),this.pickPerspectiveShader.dispose(),this.pickOrthoShader.dispose(),this.vao.dispose(),this.pointBuffer.dispose(),this.colorBuffer.dispose(),this.glyphBuffer.dispose(),this.idBuffer.dispose()}},{"./lib/glyphs":197,"./lib/shaders":198,"gl-buffer":124,"gl-mat4/multiply":145,"gl-vao":232,"typedarray-pool":458}],200:[function(t,e,r){"use strict";r.boxVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 vertex;\n\nuniform vec2 cornerA, cornerB;\n\nvoid main() {\n gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);\n}\n",r.boxFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n"},{}],201:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.boxBuffer=e,this.boxShader=r,this.enabled=!0,this.selectBox=[1/0,1/0,-(1/0),-(1/0)],this.borderColor=[0,0,0,1],this.innerFill=!1,this.innerColor=[0,0,0,.25],this.outerFill=!0,this.outerColor=[0,0,0,.5],this.borderWidth=10}function i(t,e){var r=t.gl,i=a(r,[0,0,0,1,1,0,1,1]),l=o(r,s.boxVertex,s.boxFragment),u=new n(t,i,l);return u.update(e),t.addOverlay(u),u}var o=t("gl-shader"),a=t("gl-buffer"),s=t("./lib/shaders");e.exports=i;var l=n.prototype;l.draw=function(){if(this.enabled){var t=this.plot,e=this.selectBox,r=this.borderWidth,n=(this.innerFill,this.innerColor),i=(this.outerFill,this.outerColor),o=this.borderColor,a=t.box,s=t.screenBox,l=t.dataBox,u=t.viewBox,c=t.pixelRatio,h=(e[0]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],f=(e[1]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1],d=(e[2]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],p=(e[3]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1];if(h=Math.max(h,u[0]),f=Math.max(f,u[1]),d=Math.min(d,u[2]),p=Math.min(p,u[3]),!(h>d||f>p)){a.bind();var v=s[2]-s[0],m=s[3]-s[1];if(this.outerFill&&(a.drawBox(0,0,v,f,i),a.drawBox(0,f,h,p,i),a.drawBox(0,p,v,m,i),a.drawBox(d,f,v,p,i)),this.innerFill&&a.drawBox(h,f,d,p,n),r>0){var g=r*c;a.drawBox(h-g,f-g,d+g,f+g,o),a.drawBox(h-g,p-g,d+g,p+g,o),a.drawBox(h-g,f-g,h+g,p+g,o),a.drawBox(d-g,f-g,d+g,p+g,o)}}}},l.update=function(t){t=t||{},this.innerFill=!!t.innerFill,this.outerFill=!!t.outerFill,this.innerColor=(t.innerColor||[0,0,0,.5]).slice(),this.outerColor=(t.outerColor||[0,0,0,.5]).slice(),this.borderColor=(t.borderColor||[0,0,0,1]).slice(),this.borderWidth=t.borderWidth||0,this.selectBox=(t.selectBox||this.selectBox).slice()},l.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":200,"gl-buffer":124,"gl-shader":203}],202:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}function i(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}function o(t,e){var r=a(t,e),n=s.mallocUint8(e[0]*e[1]*4);return new i(t,r,n)}e.exports=o;var a=t("gl-fbo"),s=t("typedarray-pool"),l=t("ndarray"),u=t("bit-twiddle").nextPow2,c=t("cwise/lib/wrapper")({args:["array",{offset:[0,0,1],array:0},{offset:[0,0,2],array:0},{offset:[0,0,3],array:0},"scalar","scalar","index"],pre:{body:"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},body:{body:"{if(255>_inline_46_arg0_||255>_inline_46_arg1_||255>_inline_46_arg2_||255>_inline_46_arg3_){var _inline_46_l=_inline_46_arg4_-_inline_46_arg6_[0],_inline_46_a=_inline_46_arg5_-_inline_46_arg6_[1],_inline_46_f=_inline_46_l*_inline_46_l+_inline_46_a*_inline_46_a;_inline_46_f<this_closestD2&&(this_closestD2=_inline_46_f,this_closestX=_inline_46_arg6_[0],this_closestY=_inline_46_arg6_[1])}}",args:[{name:"_inline_46_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg4_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg5_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg6_",lvalue:!1,rvalue:!0,count:4}],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:["_inline_46_a","_inline_46_f","_inline_46_l"]},post:{body:"{return[this_closestX,this_closestY,this_closestD2]}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},debug:!1,funcName:"cwise",blockSize:64}),h=i.prototype;Object.defineProperty(h,"shape",{get:function(){return this.gl?this.fbo.shape.slice():[0,0]},set:function(t){if(this.gl){this.fbo.shape=t;var e=this.fbo.shape[0],r=this.fbo.shape[1];if(r*e*4>this.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;r*e*4>i;++i)n[i]=255}return t}}}),h.begin=function(){var t=this.gl;this.shape;t&&(this.fbo.bind(),t.clearColor(1,1,1,1),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT))},h.end=function(){var t=this.gl;t&&(t.bindFramebuffer(t.FRAMEBUFFER,null),this._readTimeout||clearTimeout(this._readTimeout),this._readTimeout=setTimeout(this._readCallback,1))},h.query=function(t,e,r){if(!this.gl)return null;var i=this.fbo.shape.slice();t=0|t,e=0|e,"number"!=typeof r&&(r=1);var o=0|Math.min(Math.max(t-r,0),i[0]),a=0|Math.min(Math.max(t+r,0),i[0]),s=0|Math.min(Math.max(e-r,0),i[1]),u=0|Math.min(Math.max(e+r,0),i[1]);if(o>=a||s>=u)return null;var h=[a-o,u-s],f=l(this.buffer,[h[0],h[1],4],[4,4*i[0],1],4*(o+i[0]*s)),d=c(f.hi(h[0],h[1],1),r,r),p=d[0],v=d[1];if(0>p||Math.pow(this.radius,2)<d[2])return null;var m=f.get(p,v,0),g=f.get(p,v,1),y=f.get(p,v,2),b=f.get(p,v,3);return new n(p+o|0,v+s|0,m,[g,y,b],Math.sqrt(d[2]))},h.dispose=function(){this.gl&&(this.fbo.dispose(),s.free(this.buffer),this.gl=null,this._readTimeout&&clearTimeout(this._readTimeout))}},{"bit-twiddle":51,"cwise/lib/wrapper":118,"gl-fbo":129,ndarray:433,"typedarray-pool":458}],203:[function(t,e,r){"use strict";function n(t){this.gl=t,this._vref=this._fref=this._relink=this.vertShader=this.fragShader=this.program=this.attributes=this.uniforms=this.types=null}function i(t,e){return t.name<e.name?-1:1}function o(t,e,r,i,o){var a=new n(t);return a.update(e,r,i,o),a}var a=t("./lib/create-uniforms"),s=t("./lib/create-attributes"),l=t("./lib/reflect"),u=t("./lib/shader-cache"),c=t("./lib/runtime-reflect"),h=t("./lib/GLError"),f=n.prototype;f.bind=function(){this.program||this._relink(),this.gl.useProgram(this.program)},f.dispose=function(){this._fref&&this._fref.dispose(),this._vref&&this._vref.dispose(),this.attributes=this.types=this.vertShader=this.fragShader=this.program=this._relink=this._fref=this._vref=null},f.update=function(t,e,r,n){function o(){d.program=u.program(p,d._vref,d._fref,x,_);for(var t=0;t<r.length;++t)S[t]=p.getUniformLocation(d.program,r[t].name)}if(!e||1===arguments.length){var f=t;t=f.vertex,e=f.fragment,r=f.uniforms,n=f.attributes}var d=this,p=d.gl,v=d._vref;d._vref=u.shader(p,p.VERTEX_SHADER,t),v&&v.dispose(),d.vertShader=d._vref.shader;var m=this._fref;if(d._fref=u.shader(p,p.FRAGMENT_SHADER,e),m&&m.dispose(),d.fragShader=d._fref.shader,!r||!n){var g=p.createProgram();if(p.attachShader(g,d.fragShader),p.attachShader(g,d.vertShader),p.linkProgram(g),!p.getProgramParameter(g,p.LINK_STATUS)){var y=p.getProgramInfoLog(g);throw new h(y,"Error linking program:"+y)}r=r||c.uniforms(p,g),n=n||c.attributes(p,g),p.deleteProgram(g)}n=n.slice(),n.sort(i);for(var b=[],x=[],_=[],w=0;w<n.length;++w){var M=n[w];if(M.type.indexOf("mat")>=0){for(var k=0|M.type.charAt(M.type.length-1),A=new Array(k),T=0;k>T;++T)A[T]=_.length,x.push(M.name+"["+T+"]"),"number"==typeof M.location?_.push(M.location+T):Array.isArray(M.location)&&M.location.length===k&&"number"==typeof M.location[T]?_.push(0|M.location[T]):_.push(-1);b.push({name:M.name,type:M.type,locations:A})}else b.push({name:M.name,type:M.type,locations:[_.length]}),x.push(M.name),"number"==typeof M.location?_.push(0|M.location):_.push(-1)}for(var E=0,w=0;w<_.length;++w)if(_[w]<0){for(;_.indexOf(E)>=0;)E+=1;_[w]=E}var S=new Array(r.length);o(),d._relink=o,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,b,_),Object.defineProperty(d,"uniforms",a(p,d,r,S))},e.exports=o},{"./lib/GLError":204,"./lib/create-attributes":205,"./lib/create-uniforms":206,"./lib/reflect":207,"./lib/runtime-reflect":208,"./lib/shader-cache":209}],204:[function(t,e,r){function n(t,e,r){this.shortMessage=e||"",this.longMessage=r||"",this.rawError=t||"",this.message="gl-shader: "+(e||t||"")+(r?"\n"+r:""),this.stack=(new Error).stack}n.prototype=new Error,n.prototype.name="GLError",n.prototype.constructor=n,e.exports=n},{}],205:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=o}function i(t,e,r,i,o,a,s){for(var l=["gl","v"],u=[],c=0;o>c;++c)l.push("x"+c),u.push("x"+c);l.push("if(x0.length===void 0){return gl.vertexAttrib"+o+"f(v,"+u.join()+")}else{return gl.vertexAttrib"+o+"fv(v,x0)}");var h=Function.apply(null,l),f=new n(t,e,r,i,o,h);Object.defineProperty(a,s,{set:function(e){return t.disableVertexAttribArray(i[r]),h(t,i[r],e),e},get:function(){return f},enumerable:!0})}function o(t,e,r,n,o,a,s){for(var l=new Array(o),u=new Array(o),c=0;o>c;++c)i(t,e,r[c],n,o,l,c),u[c]=l[c];Object.defineProperty(l,"location",{set:function(t){if(Array.isArray(t))for(var e=0;o>e;++e)u[e].location=t[e];else for(var e=0;o>e;++e)u[e].location=t+e;return t},get:function(){for(var t=new Array(o),e=0;o>e;++e)t[e]=n[r[e]];return t},enumerable:!0}),l.pointer=function(e,i,a,s){e=e||t.FLOAT,i=!!i,a=a||o*o,s=s||0;for(var l=0;o>l;++l){var u=n[r[l]];t.vertexAttribPointer(u,o,e,i,a,s+l*o),t.enableVertexAttribArray(u)}};var h=new Array(o),f=t["vertexAttrib"+o+"fv"];Object.defineProperty(a,s,{set:function(e){for(var i=0;o>i;++i){var a=n[r[i]];if(t.disableVertexAttribArray(a),Array.isArray(e[0]))f.call(t,a,e[i]);else{for(var s=0;o>s;++s)h[s]=e[o*i+s];f.call(t,a,h)}}return e},get:function(){return l},enumerable:!0})}function a(t,e,r,n){for(var a={},l=0,u=r.length;u>l;++l){var c=r[l],h=c.name,f=c.type,d=c.locations;switch(f){case"bool":case"int":case"float":i(t,e,d[0],n,1,a,h);break;default:if(f.indexOf("vec")>=0){var p=f.charCodeAt(f.length-1)-48;if(2>p||p>4)throw new s("","Invalid data type for attribute "+h+": "+f);i(t,e,d[0],n,p,a,h)}else{if(!(f.indexOf("mat")>=0))throw new s("","Unknown data type for attribute "+h+": "+f);var p=f.charCodeAt(f.length-1)-48;if(2>p||p>4)throw new s("","Invalid data type for attribute "+h+": "+f);o(t,e,d,n,p,a,h)}}}return a}e.exports=a;var s=t("./GLError"),l=n.prototype;l.pointer=function(t,e,r,n){var i=this,o=i._gl,a=i._locations[i._index];o.vertexAttribPointer(a,i._dimension,t||o.FLOAT,!!e,r||0,n||0),o.enableVertexAttribArray(a)},l.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(l,"location",{get:function(){return this._locations[this._index]},set:function(t){return t!==this._locations[this._index]&&(this._locations[this._index]=0|t,this._wrapper.program=null),0|t}})},{"./GLError":204}],206:[function(t,e,r){"use strict";function n(t){var e=new Function("y","return function(){return y}");return e(t)}function i(t,e){for(var r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function o(t,e,r,o){function l(r){var n=new Function("gl","wrapper","locations","return function(){return gl.getUniform(wrapper.program,locations["+r+"])}");return n(t,e,o)}function u(t,e,r){switch(r){case"bool":case"int":case"sampler2D":case"samplerCube":return"gl.uniform1i(locations["+e+"],obj"+t+")";case"float":return"gl.uniform1f(locations["+e+"],obj"+t+")";default:var n=r.indexOf("vec");if(!(n>=0&&1>=n&&r.length===4+n)){if(0===r.indexOf("mat")&&4===r.length){var i=r.charCodeAt(r.length-1)-48;if(2>i||i>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var i=r.charCodeAt(r.length-1)-48;if(2>i||i>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new s("","Unrecognized data type for vector "+name+": "+r)}}}function c(t,e){if("object"!=typeof e)return[[t,e]];var r=[];for(var n in e){var i=e[n],o=t;o+=parseInt(n)+""===n?"["+n+"]":"."+n,"object"==typeof i?r.push.apply(r,c(o,i)):r.push([o,i])}return r}function h(e){for(var n=["return function updateProperty(obj){"],i=c("",e),a=0;a<i.length;++a){var s=i[a],l=s[0],h=s[1];o[h]&&n.push(u(l,h,r[h].type))}n.push("return obj}");var f=new Function("gl","locations",n.join("\n")); return f(t,o)}function f(t){switch(t){case"bool":return!1;case"int":case"sampler2D":case"samplerCube":return 0;case"float":return 0;default:var e=t.indexOf("vec");if(e>=0&&1>=e&&t.length===4+e){var r=t.charCodeAt(t.length-1)-48;if(2>r||r>4)throw new s("","Invalid data type");return"b"===t.charAt(0)?i(r,!1):i(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(2>r||r>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+t);return i(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function d(t,e,i){if("object"==typeof i){var a=p(i);Object.defineProperty(t,e,{get:n(a),set:h(i),enumerable:!0,configurable:!1})}else o[i]?Object.defineProperty(t,e,{get:l(i),set:h(i),enumerable:!0,configurable:!1}):t[e]=f(r[i].type)}function p(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r<t.length;++r)d(e,r,t[r])}else{e={};for(var n in t)d(e,n,t[n])}return e}var v=a(r,!0);return{get:n(p(v)),set:h(v),enumerable:!0,configurable:!0}}var a=t("./reflect"),s=t("./GLError");e.exports=o},{"./GLError":204,"./reflect":207}],207:[function(t,e,r){"use strict";function n(t,e){for(var r={},n=0;n<t.length;++n)for(var i=t[n].name,o=i.split("."),a=r,s=0;s<o.length;++s){var l=o[s].split("[");if(l.length>1){l[0]in a||(a[l[0]]=[]),a=a[l[0]];for(var u=1;u<l.length;++u){var c=parseInt(l[u]);u<l.length-1||s<o.length-1?(c in a||(u<l.length-1?a[c]=[]:a[c]={}),a=a[c]):e?a[c]=n:a[c]=t[n].type}}else s<o.length-1?(l[0]in a||(a[l[0]]={}),a=a[l[0]]):e?a[l[0]]=n:a[l[0]]=t[n].type}return r}e.exports=n},{}],208:[function(t,e,r){"use strict";function n(t,e){if(!s){var r=Object.keys(a);s={};for(var n=0;n<r.length;++n){var i=r[n];s[t[i]]=a[i]}}return s[e]}function i(t,e){for(var r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),i=[],o=0;r>o;++o){var a=t.getActiveUniform(e,o);if(a){var s=n(t,a.type);if(a.size>1)for(var l=0;l<a.size;++l)i.push({name:a.name.replace("[0]","["+l+"]"),type:s});else i.push({name:a.name,type:s})}}return i}function o(t,e){for(var r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),i=[],o=0;r>o;++o){var a=t.getActiveAttrib(e,o);a&&i.push({name:a.name,type:n(t,a.type)})}return i}r.uniforms=i,r.attributes=o;var a={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},s=null},{}],209:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a){this.id=t,this.src=e,this.type=r,this.shader=n,this.count=o,this.programs=[],this.cache=a}function i(t){this.gl=t,this.shaders=[{},{}],this.programs={}}function o(t,e,r){var n=t.createShader(e);if(t.shaderSource(n,r),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){var i=t.getShaderInfoLog(n);try{var o=h(i,r,e)}catch(a){throw console.warn("Failed to format compiler error: "+a),new c(i,"Error compiling shader:\n"+i)}throw new c(i,o.short,o.long)}return n}function a(t,e,r,n,i){var o=t.createProgram();t.attachShader(o,e),t.attachShader(o,r);for(var a=0;a<n.length;++a)t.bindAttribLocation(o,i[a],n[a]);if(t.linkProgram(o),!t.getProgramParameter(o,t.LINK_STATUS)){var s=t.getProgramInfoLog(o);throw new c(s,"Error linking program: "+s)}return o}function s(t){var e=d.get(t);return e||(e=new i(t),d.set(t,e)),e}function l(t,e,r){return s(t).getShaderReference(e,r)}function u(t,e,r,n,i){return s(t).getProgram(e,r,n,i)}r.shader=l,r.program=u;var c=t("./GLError"),h=t("gl-format-compiler-error"),f="undefined"==typeof WeakMap?t("weakmap-shim"):WeakMap,d=new f,p=0;n.prototype.dispose=function(){if(0===--this.count){for(var t=this.cache,e=t.gl,r=this.programs,n=0,i=r.length;i>n;++n){var o=t.programs[r[n]];o&&(delete t.programs[n],e.deleteProgram(o))}e.deleteShader(this.shader),delete t.shaders[this.type===e.FRAGMENT_SHADER|0][this.src]}};var v=i.prototype;v.getShaderReference=function(t,e){var r=this.gl,i=this.shaders[t===r.FRAGMENT_SHADER|0],a=i[e];if(a&&r.isShader(a.shader))a.count+=1;else{var s=o(r,t,e);a=i[e]=new n(p++,e,t,s,[],1,this)}return a},v.getProgram=function(t,e,r,n){var i=[t.id,e.id,r.join(":"),n.join(":")].join("@"),o=this.programs[i];return o&&this.gl.isProgram(o)||(this.programs[i]=o=a(this.gl,t.shader,e.shader,r,n),t.programs.push(i),e.programs.push(i)),o}},{"./GLError":204,"gl-format-compiler-error":210,"weakmap-shim":220}],210:[function(t,e,r){function n(t,e,r){"use strict";var n=a(e)||"of unknown name (see npm glsl-shader-name)",l="unknown type";void 0!==r&&(l=r===o.FRAGMENT_SHADER?"fragment":"vertex");for(var u=i("Error compiling %s shader %s:\n",l,n),c=i("%s%s",u,t),h=t.split("\n"),f={},d=0;d<h.length;d++){var p=h[d];if(""!==p){var v=parseInt(p.split(":")[2]);if(isNaN(v))throw new Error(i("Could not parse error: %s",p));f[v]=p}}for(var m=s(e).split("\n"),d=0;d<m.length;d++)if(f[d+3]||f[d+2]||f[d+1]){var g=m[d];if(u+=g+"\n",f[d+1]){var y=f[d+1];y=y.substr(y.split(":",3).join(":").length+1).trim(),u+=i("^^^ %s\n\n",y)}}return{"long":u.trim(),"short":c.trim()}}var i=t("sprintf-js").sprintf,o=t("gl-constants/lookup"),a=t("glsl-shader-name"),s=t("add-line-numbers");e.exports=n},{"add-line-numbers":211,"gl-constants/lookup":214,"glsl-shader-name":215,"sprintf-js":217}],211:[function(t,e,r){function n(t,e,r){e="number"==typeof e?e:1,r=r||": ";var n=t.split(/\r?\n/),o=String(n.length+e-1).length;return n.map(function(t,n){var a=n+e,s=String(a).length,l=i(a,o-s);return l+r+t}).join("\n")}var i=t("pad-left");e.exports=n},{"pad-left":212}],212:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r="undefined"!=typeof r?r+"":" ",n(r,e)+t}},{"repeat-string":434}],213:[function(t,e,r){e.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"}},{}],214:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":213}],215:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:i(t),r=0;r<e.length;r++){var n=e[r];if("preprocessor"===n.type){var a=n.data.match(/\#define\s+SHADER_NAME(_B64)?\s+(.+)/);if(a&&a[2]){var s=a[1],l=a[2];return(s?o(l):l).trim()}}}}var i=t("glsl-tokenizer"),o=t("atob-lite");e.exports=n},{"atob-lite":216,"glsl-tokenizer":240}],216:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],217:[function(e,r,n){!function(e){function r(){var t=arguments[0],e=r.cache;return e[t]&&e.hasOwnProperty(t)||(e[t]=r.parse(t)),r.format.call(null,e[t],arguments)}function i(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function o(t,e){return Array(e+1).join(t)}var a={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\|\(([^]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^$(\d+)$/,sign:/^[\+\-]/};r.format=function(t,e){var n,s,l,u,c,h,f,d=1,p=t.length,v="",m=[],g=!0,y="";for(s=0;p>s;s++)if(v=i(t[s]),"string"===v)m[m.length]=t[s];else if("array"===v){if(u=t[s],u[2])for(n=e[d],l=0;l<u[2].length;l++){if(!n.hasOwnProperty(u[2][l]))throw new Error(r("[sprintf] property '%s' does not exist",u[2][l]));n=n[u[2][l]]}else n=u[1]?e[u[1]]:e[d++];if("function"==i(n)&&(n=n()),a.not_string.test(u[8])&&a.not_json.test(u[8])&&"number"!=i(n)&&isNaN(n))throw new TypeError(r("[sprintf] expecting number but found %s",i(n)));switch(a.number.test(u[8])&&(g=n>=0),u[8]){case"b":n=n.toString(2);break;case"c":n=String.fromCharCode(n);break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,u[6]?parseInt(u[6]):0);break;case"e":n=u[7]?n.toExponential(u[7]):n.toExponential();break;case"f":n=u[7]?parseFloat(n).toFixed(u[7]):parseFloat(n);break;case"g":n=u[7]?parseFloat(n).toPrecision(u[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&u[7]?n.substring(0,u[7]):n;break;case"u":n>>>=0;break;case"x":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}a.json.test(u[8])?m[m.length]=n:(!a.number.test(u[8])||g&&!u[3]?y="":(y=g?"+":"-",n=n.toString().replace(a.sign,"")),h=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",f=u[6]-(y+n).length,c=u[6]&&f>0?o(h,f):"",m[m.length]=u[5]?y+n+c:"0"===h?y+c+n:c+y+n)}return m.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],i=0;e;){if(null!==(r=a.text.exec(e)))n[n.length]=r[0];else if(null!==(r=a.modulo.exec(e)))n[n.length]="%";else{if(null===(r=a.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var o=[],s=r[2],l=[];if(null===(l=a.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o[o.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=a.key_access.exec(s)))o[o.length]=l[1];else{if(null===(l=a.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");o[o.length]=l[1]}r[2]=o}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var s=function(t,e,n){return n=(e||[]).slice(0),n.splice(0,0,t),r.apply(null,n)};"undefined"!=typeof n?(n.sprintf=r,n.vsprintf=s):(e.sprintf=r,e.vsprintf=s,"function"==typeof t&&t.amd&&t(function(){return{sprintf:r,vsprintf:s}}))}("undefined"==typeof window?this:window)},{}],218:[function(t,e,r){function n(){var t={};return function(e){if(("object"!=typeof e||null===e)&&"function"!=typeof e)throw new Error("Weakmap-shim: Key must be object");var r=e.valueOf(t);return r&&r.identity===t?r:i(e,t)}}var i=t("./hidden-store.js");e.exports=n},{"./hidden-store.js":219}],219:[function(t,e,r){function n(t,e){var r={identity:e},n=t.valueOf;return Object.defineProperty(t,"valueOf",{value:function(t){return t!==e?n.apply(this,arguments):r},writable:!0}),r}e.exports=n},{}],220:[function(t,e,r){function n(){var t=i();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){t(e).value=r},has:function(e){return"value"in t(e)},"delete":function(e){return delete t(e).value}}}var i=t("./create-store.js");e.exports=n},{"./create-store.js":218}],221:[function(t,e,r){"use strict";function n(t){this.plot=t,this.enable=[!0,!0,!1,!1],this.width=[1,1,1,1],this.color=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.center=[1/0,1/0]}function i(t,e){var r=new n(t);return r.update(e),t.addOverlay(r),r}e.exports=i;var o=n.prototype;o.update=function(t){t=t||{},this.enable=(t.enable||[!0,!0,!1,!1]).slice(),this.width=(t.width||[1,1,1,1]).slice(),this.color=(t.color||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]).map(function(t){return t.slice()}),this.center=(t.center||[1/0,1/0]).slice(),this.plot.setOverlayDirty()},o.draw=function(){var t=this.enable,e=this.width,r=this.color,n=this.center,i=this.plot,o=i.line,a=i.dataBox,s=i.viewBox;if(o.bind(),a[0]<=n[0]&&n[0]<=a[2]&&a[1]<=n[1]&&n[1]<=a[3]){var l=s[0]+(n[0]-a[0])/(a[2]-a[0])*(s[2]-s[0]),u=s[1]+(n[1]-a[1])/(a[3]-a[1])*(s[3]-s[1]);t[0]&&o.drawLine(l,u,s[0],u,e[0],r[0]),t[1]&&o.drawLine(l,u,l,s[1],e[1],r[1]),t[2]&&o.drawLine(l,u,s[2],u,e[2],r[2]),t[3]&&o.drawLine(l,u,l,s[3],e[3],r[3])}},o.dispose=function(){this.plot.removeOverlay(this)}},{}],222:[function(t,e,r){var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute vec3 f;\nattribute vec3 normal;\n\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 lightPosition, eyePosition;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\n\nvoid main() {\n worldCoordinate = vec3(uv.zw, f.x);\n vec4 worldPosition = model * vec4(worldCoordinate, 1.0);\n vec4 clipPosition = projection * view * worldPosition;\n gl_Position = clipPosition;\n kill = f.y;\n value = f.z;\n planeCoordinate = uv.xy;\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * worldPosition;\n cameraCoordinate.xyz /= cameraCoordinate.w;\n lightDirection = lightPosition - cameraCoordinate.xyz;\n eyeDirection = eyePosition - cameraCoordinate.xyz;\n surfaceNormal = normalize((vec4(normal,0) * inverseModel).xyz);\n}\n",o="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat beckmannSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness) {\n return beckmannDistribution_2_0(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness);\n}\n\n\n\nuniform vec3 lowerBound, upperBound;\nuniform float contourTint;\nuniform vec4 contourColor;\nuniform sampler2D colormap;\nuniform vec3 clipBounds[2];\nuniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\n\nvoid main() {\n if(kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(surfaceNormal);\n vec3 V = normalize(eyeDirection);\n vec3 L = normalize(lightDirection);\n\n if(gl_FrontFacing) {\n N = -N;\n }\n\n float specular = beckmannSpecular_1_1(L, V, N, roughness);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = texture2D(colormap, vec2(value, value));\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = mix(litColor, contourColor, contourTint) * opacity;\n}\n",a="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute float f;\n\nuniform mat3 permutation;\nuniform mat4 model, view, projection;\nuniform float height, zOffset;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\n\nvoid main() {\n vec3 dataCoordinate = permutation * vec3(uv.xy, height);\n vec4 worldPosition = model * vec4(dataCoordinate, 1.0);\n\n vec4 clipPosition = projection * view * worldPosition;\n clipPosition.z = clipPosition.z + zOffset;\n\n gl_Position = clipPosition;\n value = f;\n kill = -1.0;\n worldCoordinate = dataCoordinate;\n planeCoordinate = uv.zw;\n\n //Don't do lighting for contours\n surfaceNormal = vec3(1,0,0);\n eyeDirection = vec3(0,1,0);\n lightDirection = vec3(0,0,1);\n}\n",s="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec2 shape;\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 surfaceNormal;\n\nvec2 splitFloat(float v) {\n float vh = 255.0 * v;\n float upper = floor(vh);\n float lower = fract(vh);\n return vec2(upper / 255.0, floor(lower * 16.0) / 16.0);\n}\n\nvoid main() {\n if(kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n vec2 ux = splitFloat(planeCoordinate.x / shape.x);\n vec2 uy = splitFloat(planeCoordinate.y / shape.y);\n gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0));\n}\n";r.createShader=function(t){var e=n(t,i,o,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createPickShader=function(t){var e=n(t,i,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createContourShader=function(t){var e=n(t,a,o,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e},r.createPickContourShader=function(t){var e=n(t,a,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e}},{"gl-shader":203}],223:[function(t,e,r){arguments[4][22][0].apply(r,arguments)},{dup:22}],224:[function(t,e,r){"use strict";function n(t){if(t in l)return l[t];for(var e=[],r=0;t>r;++r)e.push("out",r,"s=0.5*(inp",r,"l-inp",r,"r);");for(var n=["array"],i=["junk"],r=0;t>r;++r){n.push("array"),i.push("out"+r+"s");var o=a(t);o[r]=-1,n.push({array:0,offset:o.slice()}),o[r]=1,n.push({array:0,offset:o.slice()}),i.push("inp"+r+"l","inp"+r+"r")}return l[t]=s({args:n,pre:c,post:c,body:{body:e.join(""),args:i.map(function(t){return{name:t,lvalue:0===t.indexOf("out"),rvalue:0===t.indexOf("inp"),count:"junk"!==t|0}}),thisVars:[],localVars:[]},funcName:"fdTemplate"+t})}function i(t){function e(e){for(var r=o-e.length,n=[],i=[],s=[],l=0;o>l;++l)e.indexOf(l+1)>=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),n.push("1"),i.push("s["+l+"]-2"));var u=".lo("+n.join()+").hi("+i.join()+")";if(0===n.length&&(u=""),r>0){a.push("if(1");for(var l=0;o>l;++l)e.indexOf(l+1)>=0||e.indexOf(-(l+1))>=0||a.push("&&s[",l,"]>2");a.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;o>l;++l)e.indexOf(l+1)>=0||e.indexOf(-(l+1))>=0||a.push(",dst.pick(",s.join(),",",l,")",u);a.push(");")}for(var l=0;l<e.length;++l){var c=Math.abs(e[l])-1,h="dst.pick("+s.join()+","+c+")"+u;switch(t[c]){case"clamp":var f=s.slice(),d=s.slice();e[l]<0?f[c]="s["+c+"]-2":d[c]="1",0===r?a.push("if(s[",c,"]>1){dst.set(",s.join(),",",c,",0.5*(src.get(",f.join(),")-src.get(",d.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):a.push("if(s[",c,"]>1){diff(",h,",src.pick(",f.join(),")",u,",src.pick(",d.join(),")",u,");}else{zero(",h,");};");break;case"mirror":0===r?a.push("dst.set(",s.join(),",",c,",0);"):a.push("zero(",h,");");break;case"wrap":var p=s.slice(),v=s.slice();e[l]<0?(p[c]="s["+c+"]-2",v[c]="0"):(p[c]="s["+c+"]-1",v[c]="1"),0===r?a.push("if(s[",c,"]>2){dst.set(",s.join(),",",c,",0.5*(src.get(",p.join(),")-src.get(",v.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):a.push("if(s[",c,"]>2){diff(",h,",src.pick(",p.join(),")",u,",src.pick(",v.join(),")",u,");}else{zero(",h,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}r>0&&a.push("};")}var r=t.join(),i=u[r];if(i)return i;for(var o=t.length,a=["function gradient(dst,src){var s=src.shape.slice();"],s=0;1<<o>s;++s){for(var c=[],d=0;o>d;++d)s&1<<d&&c.push(d+1);for(var p=0;p<1<<c.length;++p){for(var v=c.slice(),d=0;d<c.length;++d)p&1<<d&&(v[d]=-v[d]);e(v)}}a.push("return dst;};return gradient");for(var m=["diff","zero"],g=[h,f],s=1;o>=s;++s)m.push("grad"+s),g.push(n(s));m.push(a.join(""));var y=Function.apply(void 0,m),i=y.apply(void 0,g);return l[r]=i,i}function o(t,e,r){if(Array.isArray(r)){if(r.length!==e.dimension)throw new Error("ndarray-gradient: invalid boundary conditions")}else r="string"==typeof r?a(e.dimension,r):a(e.dimension,"clamp");if(t.dimension!==e.dimension+1)throw new Error("ndarray-gradient: output dimension must be +1 input dimension");if(t.shape[e.dimension]!==e.dimension)throw new Error("ndarray-gradient: output shape must match input shape");for(var n=0;n<e.dimension;++n)if(t.shape[n]!==e.shape[n])throw new Error("ndarray-gradient: shape mismatch");if(0===e.size)return t;if(e.dimension<=0)return t.set(0),t;var o=i(r);return o(t,e)}e.exports=o;var a=t("dup"),s=t("cwise-compiler"),l={},u={},c={body:"",args:[],thisVars:[],localVars:[]},h=s({args:["array","array","array"],pre:c,post:c,body:{args:[{name:"out",lvalue:!0,rvalue:!1,count:1},{name:"left",lvalue:!1,rvalue:!0,count:1},{name:"right",lvalue:!1,rvalue:!0,count:1}],body:"out=0.5*(left-right)",thisVars:[],localVars:[]},funcName:"cdiff"}),f=s({args:["array"],pre:c,post:c,body:{args:[{name:"out",lvalue:!0,rvalue:!1,count:1}],body:"out=0",thisVars:[],localVars:[]},funcName:"zero"})},{"cwise-compiler":115,dup:121}],225:[function(t,e,r){"use strict";var n=t("ndarray"),i=t("./doConvert.js");e.exports=function(t,e){for(var r=[],o=t,a=1;o instanceof Array;)r.push(o.length),a*=o.length,o=o[0];return 0===r.length?n():(e||(e=n(new Float64Array(a),r)),i(e,t),e)}},{"./doConvert.js":226,ndarray:433}],226:[function(t,e,r){e.exports=t("cwise-compiler")({args:["array","scalar","index"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}",args:[{name:"_inline_1_arg0_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:4}],thisVars:[],localVars:["_inline_1_i","_inline_1_v"]},post:{body:"{}",args:[],thisVars:[],localVars:[]},funcName:"convert",blockSize:64})},{"cwise-compiler":115}],227:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.position=t,this.index=e,this.uv=r,this.level=n,this.dataCoordinate=i}function i(t){var e=x([y({colormap:t,nshades:O,format:"rgba"}).map(function(t){return[t[0],t[1],t[2],255*t[3]]})]);return b.divseq(e,255),e}function o(t,e,r,i,o,a,s,l,u,c,h,f,d,p){this.gl=t,this.shape=e,this.bounds=r,this.intensityBounds=[],this._shader=i,this._pickShader=o,this._coordinateBuffer=a,this._vao=s,this._colorMap=l,this._contourShader=u,this._contourPickShader=c,this._contourBuffer=h,this._contourVAO=f,this._contourOffsets=[[],[],[]],this._contourCounts=[[],[],[]],this._vertexCount=0,this._pickResult=new n([0,0,0],[0,0],[0,0],[0,0,0],[0,0,0]),this._dynamicBuffer=d,this._dynamicVAO=p,this._dynamicOffsets=[0,0,0],this._dynamicCounts=[0,0,0],this.contourWidth=[1,1,1],this.contourLevels=[[1],[1],[1]],this.contourTint=[0,0,0],this.contourColor=[[.5,.5,.5,1],[.5,.5,.5,1],[.5,.5,.5,1]],this.showContour=!0,this.showSurface=!0,this.enableHighlight=[!0,!0,!0],this.highlightColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.highlightTint=[1,1,1],this.highlightLevel=[-1,-1,-1],this.enableDynamic=[!0,!0,!0],this.dynamicLevel=[NaN,NaN,NaN],this.dynamicColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.dynamicTint=[1,1,1],this.dynamicWidth=[1,1,1],this.axesBounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.surfaceProject=[!1,!1,!1],this.contourProject=[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],this.colorBounds=[!1,!1],this._field=[_(g.mallocFloat(1024),[0,0]),_(g.mallocFloat(1024),[0,0]),_(g.mallocFloat(1024),[0,0])],this.pickId=1,this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.snapToData=!1,this.opacity=1,this.lightPosition=[10,1e4,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.dirty=!0}function a(t,e){var r,n,i,o=e.axes&&e.axes.lastCubeProps.axis||j,a=e.showSurface,s=e.showContour;for(r=0;3>r;++r)for(a=a||e.surfaceProject[r],n=0;3>n;++n)s=s||e.contourProject[r][n];for(r=0;3>r;++r){var l=N.projections[r];for(n=0;16>n;++n)l[n]=0;for(n=0;4>n;++n)l[5*n]=1;l[5*r]=0,l[12+r]=e.axesBounds[+(o[r]>0)][r],M(l,t.model,l);var u=N.clipBounds[r];for(i=0;2>i;++i)for(n=0;3>n;++n)u[i][n]=t.clipBounds[i][n];u[0][r]=-1e8,u[1][r]=1e8}return N.showSurface=a,N.showContour=s,N}function s(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=B;n.model=t.model||C,n.view=t.view||C,n.projection=t.projection||C,n.lowerBound=[this.bounds[0][0],this.bounds[0][1],this.colorBounds[0]||this.bounds[0][2]],n.upperBound=[this.bounds[1][0],this.bounds[1][1],this.colorBounds[1]||this.bounds[1][2]],n.contourColor=this.contourColor[0],n.inverseModel=k(n.inverseModel,n.model);for(var i=0;2>i;++i)for(var o=n.clipBounds[i],s=0;3>s;++s)o[s]=Math.min(Math.max(this.clipBounds[i][s],-1e8),1e8);n.kambient=this.ambientLight,n.kdiffuse=this.diffuseLight,n.kspecular=this.specularLight,n.roughness=this.roughness,n.fresnel=this.fresnel,n.opacity=this.opacity,n.height=0,n.permutation=V;var l=U;for(M(l,n.view,n.model),M(l,n.projection,l),k(l,l),i=0;3>i;++i)n.eyePosition[i]=l[12+i]/l[15];var u=l[15];for(i=0;3>i;++i)u+=this.lightPosition[i]*l[4*i+3];for(i=0;3>i;++i){var c=l[12+i];for(s=0;3>s;++s)c+=l[4*s+i]*this.lightPosition[s];n.lightPosition[i]=c/u}var h=a(n,this);if(h.showSurface&&e===this.opacity<1){for(this._shader.bind(),this._shader.uniforms=n,this._vao.bind(),this.showSurface&&this._vertexCount&&this._vao.draw(r.TRIANGLES,this._vertexCount),i=0;3>i;++i)this.surfaceProject[i]&&this.vertexCount&&(this._shader.uniforms.model=h.projections[i],this._shader.uniforms.clipBounds=h.clipBounds[i],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(h.showContour&&!e){var f=this._contourShader;n.kambient=1,n.kdiffuse=0,n.kspecular=0,n.opacity=1,f.bind(),f.uniforms=n;var d=this._contourVAO;for(d.bind(),i=0;3>i;++i)for(f.uniforms.permutation=D[i],r.lineWidth(this.contourWidth[i]),s=0;s<this.contourLevels[i].length;++s)this._contourCounts[i][s]&&(s===this.highlightLevel[i]?(f.uniforms.contourColor=this.highlightColor[i], f.uniforms.contourTint=this.highlightTint[i]):0!==s&&s-1!==this.highlightLevel[i]||(f.uniforms.contourColor=this.contourColor[i],f.uniforms.contourTint=this.contourTint[i]),f.uniforms.height=this.contourLevels[i][s],d.draw(r.LINES,this._contourCounts[i][s],this._contourOffsets[i][s]));for(i=0;3>i;++i)for(f.uniforms.model=h.projections[i],f.uniforms.clipBounds=h.clipBounds[i],s=0;3>s;++s)if(this.contourProject[i][s]){f.uniforms.permutation=D[s],r.lineWidth(this.contourWidth[s]);for(var p=0;p<this.contourLevels[s].length;++p)p===this.highlightLevel[s]?(f.uniforms.contourColor=this.highlightColor[s],f.uniforms.contourTint=this.highlightTint[s]):0!==p&&p-1!==this.highlightLevel[s]||(f.uniforms.contourColor=this.contourColor[s],f.uniforms.contourTint=this.contourTint[s]),f.uniforms.height=this.contourLevels[s][p],d.draw(r.LINES,this._contourCounts[s][p],this._contourOffsets[s][p])}for(d=this._dynamicVAO,d.bind(),i=0;3>i;++i)if(0!==this._dynamicCounts[i])for(f.uniforms.model=n.model,f.uniforms.clipBounds=n.clipBounds,f.uniforms.permutation=D[i],r.lineWidth(this.dynamicWidth[i]),f.uniforms.contourColor=this.dynamicColor[i],f.uniforms.contourTint=this.dynamicTint[i],f.uniforms.height=this.dynamicLevel[i],d.draw(r.LINES,this._dynamicCounts[i],this._dynamicOffsets[i]),s=0;3>s;++s)this.contourProject[s][i]&&(f.uniforms.model=h.projections[s],f.uniforms.clipBounds=h.clipBounds[s],d.draw(r.LINES,this._dynamicCounts[i],this._dynamicOffsets[i]));d.unbind()}}function l(t,e){var r=e.shape.slice(),n=t.shape.slice();b.assign(t.lo(1,1).hi(r[0],r[1]),e),b.assign(t.lo(1).hi(r[0],1),e.hi(r[0],1)),b.assign(t.lo(1,n[1]-1).hi(r[0],1),e.lo(0,r[1]-1).hi(r[0],1)),b.assign(t.lo(0,1).hi(1,r[1]),e.hi(1)),b.assign(t.lo(n[0]-1,1).hi(1,r[1]),e.lo(r[0]-1)),t.set(0,0,e.get(0,0)),t.set(0,n[1]-1,e.get(0,r[1]-1)),t.set(n[0]-1,0,e.get(r[0]-1,0)),t.set(n[0]-1,n[1]-1,e.get(r[0]-1,r[1]-1))}function u(t,e){return Array.isArray(t)?[e(t[0]),e(t[1]),e(t[2])]:[e(t),e(t),e(t)]}function c(t){return Array.isArray(t)?3===t.length?[t[0],t[1],t[2],1]:[t[0],t[1],t[2],t[3]]:[0,0,0,1]}function h(t){if(Array.isArray(t)){if(Array.isArray(t))return[c(t[0]),c(t[1]),c(t[2])];var e=c(t);return[e.slice(),e.slice(),e.slice()]}}function f(t){var e=t.gl,r=S(e),n=z(e),i=L(e),a=I(e),s=p(e),l=v(e,[{buffer:s,size:4,stride:P,offset:0},{buffer:s,size:3,stride:P,offset:16},{buffer:s,size:3,stride:P,offset:28}]),u=p(e),c=v(e,[{buffer:u,size:4,stride:20,offset:0},{buffer:u,size:1,stride:20,offset:16}]),h=p(e),f=v(e,[{buffer:h,size:2,type:e.FLOAT}]),d=m(e,1,O,e.RGBA,e.UNSIGNED_BYTE);d.minFilter=e.LINEAR,d.magFilter=e.LINEAR;var g=new o(e,[0,0],[[0,0,0],[0,0,0]],r,n,s,l,d,i,a,u,c,h,f),y={levels:[[],[],[]]};for(var b in t)y[b]=t[b];return y.colormap=y.colormap||"jet",g.update(y),g}e.exports=f;var d=t("bit-twiddle"),p=t("gl-buffer"),v=t("gl-vao"),m=t("gl-texture2d"),g=t("typedarray-pool"),y=t("colormap"),b=t("ndarray-ops"),x=t("ndarray-pack"),_=t("ndarray"),w=t("surface-nets"),M=t("gl-mat4/multiply"),k=t("gl-mat4/invert"),A=t("binary-search-bounds"),T=t("ndarray-gradient"),E=t("./lib/shaders"),S=E.createShader,L=E.createContourShader,z=E.createPickShader,I=E.createPickContourShader,P=40,C=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],R=[[0,0],[0,1],[1,0],[1,1],[1,0],[0,1]],D=[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]];!function(){for(var t=0;3>t;++t){var e=D[t],r=(t+1)%3,n=(t+2)%3;e[r+0]=1,e[n+3]=1,e[t+6]=1}}();var O=265,F=o.prototype;F.isTransparent=function(){return this.opacity<1},F.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;3>t;++t)if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0)return!0;return!1},F.pickSlots=1,F.setPickBase=function(t){this.pickId=t};var j=[0,0,0],N={showSurface:!1,showContour:!1,projections:[C.slice(),C.slice(),C.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]},B={model:C,view:C,projection:C,inverseModel:C.slice(),lowerBound:[0,0,0],upperBound:[0,0,0],colorMap:0,clipBounds:[[0,0,0],[0,0,0]],height:0,contourTint:0,contourColor:[0,0,0,1],permutation:[1,0,0,0,1,0,0,0,1],zOffset:-1e-4,kambient:1,kdiffuse:1,kspecular:1,lightPosition:[1e3,1e3,1e3],eyePosition:[0,0,0],roughness:1,fresnel:1,opacity:1},U=C.slice(),V=[1,0,0,0,1,0,0,0,1];F.draw=function(t){return s.call(this,t,!1)},F.drawTransparent=function(t){return s.call(this,t,!0)};var q={model:C,view:C,projection:C,inverseModel:C,clipBounds:[[0,0,0],[0,0,0]],height:0,shape:[0,0],pickId:0,lowerBound:[0,0,0],upperBound:[0,0,0],zOffset:0,permutation:[1,0,0,0,1,0,0,0,1],lightPosition:[0,0,0],eyePosition:[0,0,0]};F.drawPick=function(t){t=t||{};var e=this.gl;e.disable(e.CULL_FACE);var r=q;r.model=t.model||C,r.view=t.view||C,r.projection=t.projection||C,r.shape=this._field[2].shape,r.pickId=this.pickId/255,r.lowerBound=this.bounds[0],r.upperBound=this.bounds[1],r.permutation=V;for(var n=0;2>n;++n)for(var i=r.clipBounds[n],o=0;3>o;++o)i[o]=Math.min(Math.max(this.clipBounds[n][o],-1e8),1e8);var s=a(r,this);if(s.showSurface){for(this._pickShader.bind(),this._pickShader.uniforms=r,this._vao.bind(),this._vao.draw(e.TRIANGLES,this._vertexCount),n=0;3>n;++n)this.surfaceProject[n]&&(this._pickShader.uniforms.model=s.projections[n],this._pickShader.uniforms.clipBounds=s.clipBounds[n],this._vao.draw(e.TRIANGLES,this._vertexCount));this._vao.unbind()}if(s.showContour){var l=this._contourPickShader;l.bind(),l.uniforms=r;var u=this._contourVAO;for(u.bind(),o=0;3>o;++o)for(e.lineWidth(this.contourWidth[o]),l.uniforms.permutation=D[o],n=0;n<this.contourLevels[o].length;++n)this._contourCounts[o][n]&&(l.uniforms.height=this.contourLevels[o][n],u.draw(e.LINES,this._contourCounts[o][n],this._contourOffsets[o][n]));for(n=0;3>n;++n)for(l.uniforms.model=s.projections[n],l.uniforms.clipBounds=s.clipBounds[n],o=0;3>o;++o)if(this.contourProject[n][o]){l.uniforms.permutation=D[o],e.lineWidth(this.contourWidth[o]);for(var c=0;c<this.contourLevels[o].length;++c)this._contourCounts[o][c]&&(l.uniforms.height=this.contourLevels[o][c],u.draw(e.LINES,this._contourCounts[o][c],this._contourOffsets[o][c]))}u.unbind()}},F.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=this._field[2].shape,r=this._pickResult,n=e[0]*(t.value[0]+(t.value[2]>>4)/16)/255,i=Math.floor(n),o=n-i,a=e[1]*(t.value[1]+(15&t.value[2])/16)/255,s=Math.floor(a),l=a-s;i+=1,s+=1;var u=r.position;u[0]=u[1]=u[2]=0;for(var c=0;2>c;++c)for(var h=c?o:1-o,f=0;2>f;++f)for(var d=f?l:1-l,p=i+c,v=s+f,m=h*d,g=0;3>g;++g)u[g]+=this._field[g].get(p,v)*m;for(var y=this._pickResult.level,b=0;3>b;++b)if(y[b]=A.le(this.contourLevels[b],u[b]),y[b]<0)this.contourLevels[b].length>0&&(y[b]=0);else if(y[b]<this.contourLevels[b].length-1){var x=this.contourLevels[b][y[b]],_=this.contourLevels[b][y[b]+1];Math.abs(x-u[b])>Math.abs(_-u[b])&&(y[b]+=1)}for(r.index[0]=.5>o?i:i+1,r.index[1]=.5>l?s:s+1,r.uv[0]=n/e[0],r.uv[1]=a/e[1],g=0;3>g;++g)r.dataCoordinate[g]=this._field[g].get(r.index[0],r.index[1]);return r},F.update=function(t){t=t||{},this.dirty=!0,"contourWidth"in t&&(this.contourWidth=u(t.contourWidth,Number)),"showContour"in t&&(this.showContour=u(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=u(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=h(t.contourColor)),"contourProject"in t&&(this.contourProject=u(t.contourProject,function(t){return u(t,Boolean)})),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=h(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=u(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=u(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"colorBounds"in t&&(this.colorBounds=t.colorBounds);var e=t.field||t.coords&&t.coords[2]||null,r=!1;if(e||(e=this._field[2].shape[0]||this._field[2].shape[2]?this._field[2].lo(1,1).hi(this._field[2].shape[0]-2,this._field[2].shape[1]-2):this._field[2].hi(0,0)),"field"in t||"coords"in t){var n=(e.shape[0]+2)*(e.shape[1]+2);n>this._field[2].data.length&&(g.freeFloat(this._field[2].data),this._field[2].data=g.mallocFloat(d.nextPow2(n))),this._field[2]=_(this._field[2].data,[e.shape[0]+2,e.shape[1]+2]),l(this._field[2],e),this.shape=e.shape.slice();for(var o=this.shape,a=0;2>a;++a)this._field[2].size>this._field[a].data.length&&(g.freeFloat(this._field[a].data),this._field[a].data=g.mallocFloat(this._field[2].size)),this._field[a]=_(this._field[a].data,[o[0]+2,o[1]+2]);if(t.coords){var s=t.coords;if(!Array.isArray(s)||3!==s.length)throw new Error("gl-surface: invalid coordinates for x/y");for(a=0;2>a;++a){var c=s[a];for(y=0;2>y;++y)if(c.shape[y]!==o[y])throw new Error("gl-surface: coords have incorrect shape");l(this._field[a],c)}}else if(t.ticks){var f=t.ticks;if(!Array.isArray(f)||2!==f.length)throw new Error("gl-surface: invalid ticks");for(a=0;2>a;++a){var p=f[a];if((Array.isArray(p)||p.length)&&(p=_(p)),p.shape[0]!==o[a])throw new Error("gl-surface: invalid tick length");var v=_(p.data,o);v.stride[a]=p.stride[0],v.stride[1^a]=0,l(this._field[a],v)}}else{for(a=0;2>a;++a){var m=[0,0];m[a]=1,this._field[a]=_(this._field[a].data,[o[0]+2,o[1]+2],m,0)}this._field[0].set(0,0,0);for(var y=0;y<o[0];++y)this._field[0].set(y+1,0,y);for(this._field[0].set(o[0]+1,0,o[0]-1),this._field[1].set(0,0,0),y=0;y<o[1];++y)this._field[1].set(0,y+1,y);this._field[1].set(0,o[1]+1,o[1]-1)}var b=this._field,x=_(g.mallocFloat(3*b[2].size*2),[3,o[0]+2,o[1]+2,2]);for(a=0;3>a;++a)T(x.pick(a),b[a],"mirror");var M=_(g.mallocFloat(3*b[2].size),[o[0]+2,o[1]+2,3]);for(a=0;a<o[0]+2;++a)for(y=0;y<o[1]+2;++y){var k=x.get(0,a,y,0),A=x.get(0,a,y,1),E=x.get(1,a,y,0),S=x.get(1,a,y,1),L=x.get(2,a,y,0),z=x.get(2,a,y,1),I=E*z-S*L,P=L*A-z*k,C=k*S-A*E,D=Math.sqrt(I*I+P*P+C*C);1e-8>D?(D=Math.max(Math.abs(I),Math.abs(P),Math.abs(C)),1e-8>D?(C=1,P=I=0,D=1):D=1/D):D=1/Math.sqrt(D),M.set(a,y,0,I*D),M.set(a,y,1,P*D),M.set(a,y,2,C*D)}g.free(x.data);var O=[1/0,1/0,1/0],F=[-(1/0),-(1/0),-(1/0)],j=1/0,N=-(1/0),B=(o[0]-1)*(o[1]-1)*6,U=g.mallocFloat(d.nextPow2(10*B)),V=0,q=0;for(a=0;a<o[0]-1;++a)t:for(y=0;y<o[1]-1;++y){for(var G=0;2>G;++G)for(var H=0;2>H;++H)for(var X=0;3>X;++X){var Y=this._field[X].get(1+a+G,1+y+H);if(isNaN(Y)||!isFinite(Y))continue t}for(X=0;6>X;++X){var W=a+R[X][0],Z=y+R[X][1],K=this._field[0].get(W+1,Z+1),J=this._field[1].get(W+1,Z+1);Y=this._field[2].get(W+1,Z+1);var$=Y;I=M.get(W+1,Z+1,0),P=M.get(W+1,Z+1,1),C=M.get(W+1,Z+1,2),t.intensity&&($=t.intensity.get(W,Z)),U[V++]=W,U[V++]=Z,U[V++]=K,U[V++]=J,U[V++]=Y,U[V++]=0,U[V++]=$,U[V++]=I,U[V++]=P,U[V++]=C,O[0]=Math.min(O[0],K),O[1]=Math.min(O[1],J),O[2]=Math.min(O[2],Y),j=Math.min(j,$),F[0]=Math.max(F[0],K),F[1]=Math.max(F[1],J),F[2]=Math.max(F[2],Y),N=Math.max(N,$),q+=1}}for(t.intensityBounds&&(j=+t.intensityBounds[0],N=+t.intensityBounds[1]),a=6;V>a;a+=10)U[a]=(U[a]-j)/(N-j);this._vertexCount=q,this._coordinateBuffer.update(U.subarray(0,V)),g.freeFloat(U),g.free(M.data),this.bounds=[O,F],this.intensity=t.intensity||this._field[2],this.intensityBounds[0]===j&&this.intensityBounds[1]===N||(r=!0),this.intensityBounds=[j,N]}if("levels"in t){var Q=t.levels;for(Q=Array.isArray(Q[0])?Q.slice():[[],[],Q],a=0;3>a;++a)Q[a]=Q[a].slice(),Q.sort(function(t,e){return t-e});t:for(a=0;3>a;++a){if(Q[a].length!==this.contourLevels[a].length){r=!0;break}for(y=0;y<Q[a].length;++y)if(Q[a][y]!==this.contourLevels[a][y]){r=!0;break t}}this.contourLevels=Q}if(r){b=this._field,o=this.shape;for(var tt=[],et=0;3>et;++et){Q=this.contourLevels[et];var rt=[],nt=[],it=[0,0,0];for(a=0;a<Q.length;++a){var ot=w(this._field[et],Q[a]);rt.push(tt.length/5|0),q=0;t:for(y=0;y<ot.cells.length;++y){var at=ot.cells[y];for(X=0;2>X;++X){var st=ot.positions[at[X]],lt=st[0],ut=0|Math.floor(lt),ct=lt-ut,ht=st[1],ft=0|Math.floor(ht),dt=ht-ft,pt=!1;e:for(var vt=0;3>vt;++vt){it[vt]=0;var mt=(et+vt+1)%3;for(G=0;2>G;++G){var gt=G?ct:1-ct;for(W=0|Math.min(Math.max(ut+G,0),o[0]),H=0;2>H;++H){var yt=H?dt:1-dt;if(Z=0|Math.min(Math.max(ft+H,0),o[1]),Y=2>vt?this._field[mt].get(W,Z):(this.intensity.get(W,Z)-this.intensityBounds[0])/(this.intensityBounds[1]-this.intensityBounds[0]),!isFinite(Y)||isNaN(Y)){pt=!0;break e}var bt=gt*yt;it[vt]+=bt*Y}}}if(pt){if(X>0){for(var xt=0;5>xt;++xt)tt.pop();q-=1}continue t}tt.push(it[0],it[1],st[0],st[1],it[2]),q+=1}}nt.push(q)}this._contourOffsets[et]=rt,this._contourCounts[et]=nt}var _t=g.mallocFloat(tt.length);for(a=0;a<tt.length;++a)_t[a]=tt[a];this._contourBuffer.update(_t),g.freeFloat(_t)}t.colormap&&this._colorMap.setPixels(i(t.colormap))},F.dispose=function(){this._shader.dispose(),this._vao.dispose(),this._coordinateBuffer.dispose(),this._colorMap.dispose(),this._contourBuffer.dispose(),this._contourVAO.dispose(),this._contourShader.dispose(),this._contourPickShader.dispose(),this._dynamicBuffer.dispose(),this._dynamicVAO.dispose();for(var t=0;3>t;++t)g.freeFloat(this._field[t].data)},F.highlight=function(t){if(!t)return this._dynamicCounts=[0,0,0],this.dyanamicLevel=[NaN,NaN,NaN],void(this.highlightLevel=[-1,-1,-1]);for(var e=0;3>e;++e)this.enableHighlight[e]?this.highlightLevel[e]=t.level[e]:this.highlightLevel[e]=-1;var r;if(r=this.snapToData?t.dataCoordinate:t.position,this.enableDynamic[0]&&r[0]!==this.dynamicLevel[0]||this.enableDynamic[1]&&r[1]!==this.dynamicLevel[1]||this.enableDynamic[2]&&r[2]!==this.dynamicLevel[2]){for(var n=0,i=this.shape,o=g.mallocFloat(12*i[0]*i[1]),a=0;3>a;++a)if(this.enableDynamic[a]){this.dynamicLevel[a]=r[a];var s=(a+1)%3,l=(a+2)%3,u=this._field[a],c=this._field[s],h=this._field[l],f=(this.intensity,w(u,r[a])),d=f.cells,p=f.positions;for(this._dynamicOffsets[a]=n,e=0;e<d.length;++e)for(var v=d[e],m=0;2>m;++m){var y=p[v[m]],b=+y[0],x=0|b,_=0|Math.min(x+1,i[0]),M=b-x,k=1-M,A=+y[1],T=0|A,E=0|Math.min(T+1,i[1]),S=A-T,L=1-S,z=k*L,I=k*S,P=M*L,C=M*S,R=z*c.get(x,T)+I*c.get(x,E)+P*c.get(_,T)+C*c.get(_,E),D=z*h.get(x,T)+I*h.get(x,E)+P*h.get(_,T)+C*h.get(_,E);if(isNaN(R)||isNaN(D)){m&&(n-=1);break}o[2*n+0]=R,o[2*n+1]=D,n+=1}this._dynamicCounts[a]=n-this._dynamicOffsets[a]}else this.dynamicLevel[a]=NaN,this._dynamicCounts[a]=0;this._dynamicBuffer.update(o.subarray(0,2*n)),g.freeFloat(o)}}},{"./lib/shaders":222,"binary-search-bounds":223,"bit-twiddle":51,colormap:106,"gl-buffer":124,"gl-mat4/invert":143,"gl-mat4/multiply":145,"gl-texture2d":228,"gl-vao":232,ndarray:433,"ndarray-gradient":224,"ndarray-ops":432,"ndarray-pack":225,"surface-nets":452,"typedarray-pool":458}],228:[function(t,e,r){"use strict";function n(t){m=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],g=[t.NEAREST,t.LINEAR,t.NEAREST_MIPMAP_NEAREST,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_LINEAR],y=[t.REPEAT,t.CLAMP_TO_EDGE,t.MIRRORED_REPEAT]}function i(t,e,r){var n=t.gl,i=n.getParameter(n.MAX_TEXTURE_SIZE);if(0>e||e>i||0>r||r>i)throw new Error("gl-texture2d: Invalid texture size");return t._shape=[e,r],t.bind(),n.texImage2D(n.TEXTURE_2D,0,t.format,e,r,0,t.format,t.type,null),t._mipLevels=[0],t}function o(t,e,r,n,i,o){this.gl=t,this.handle=e,this.format=i,this.type=o,this._shape=[r,n],this._mipLevels=[0],this._magFilter=t.NEAREST,this._minFilter=t.NEAREST,this._wrapS=t.CLAMP_TO_EDGE,this._wrapT=t.CLAMP_TO_EDGE,this._anisoSamples=1;var a=this,s=[this._wrapS,this._wrapT];Object.defineProperties(s,[{get:function(){return a._wrapS},set:function(t){return a.wrapS=t}},{get:function(){return a._wrapT},set:function(t){return a.wrapT=t}}]),this._wrapVector=s;var l=[this._shape[0],this._shape[1]];Object.defineProperties(l,[{get:function(){return a._shape[0]},set:function(t){return a.width=t}},{get:function(){return a._shape[1]},set:function(t){return a.height=t}}]),this._shapeVector=l}function a(t,e){return 3===t.length?1===e[2]&&e[1]===t[0]*t[2]&&e[0]===t[2]:1===e[0]&&e[1]===t[0]}function s(t,e,r,n,i,o,s,l){var u=l.dtype,c=l.shape.slice();if(c.length<2||c.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var h=0,f=0,m=a(c,l.stride.slice());"float32"===u?h=t.FLOAT:"float64"===u?(h=t.FLOAT,m=!1,u="float32"):"uint8"===u?h=t.UNSIGNED_BYTE:(h=t.UNSIGNED_BYTE,m=!1,u="uint8");var g=1;if(2===c.length)f=t.LUMINANCE,c=[c[0],c[1],1],l=d(l.data,c,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==c.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===c[2])f=t.ALPHA;else if(2===c[2])f=t.LUMINANCE_ALPHA;else if(3===c[2])f=t.RGB;else{if(4!==c[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");f=t.RGBA}g=c[2]}if(f!==t.LUMINANCE&&f!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(f=i),f!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,x=s.indexOf(n)<0;if(x&&s.push(n),h===o&&m)0===l.offset&&l.data.length===y?x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,o,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,o,l.data):x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,o,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,o,l.data.subarray(l.offset,l.offset+y));else{var _;_=o===t.FLOAT?v.mallocFloat32(y):v.mallocUint8(y);var w=d(_,c,[c[2],c[2]*c[0],1]);h===t.FLOAT&&o===t.UNSIGNED_BYTE?b(w,l):p.assign(w,l),x?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,o,_.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,o,_.subarray(0,y)),o===t.FLOAT?v.freeFloat32(_):v.freeUint8(_)}}function l(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function u(t,e,r,n,i){var a=t.getParameter(t.MAX_TEXTURE_SIZE);if(0>e||e>a||0>r||r>a)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=l(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new o(t,s,e,r,n,i)}function c(t,e,r,n){var i=l(t);return t.texImage2D(t.TEXTURE_2D,0,r,r,n,e),new o(t,i,0|e.width,0|e.height,r,n)}function h(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var s=a(n,e.stride.slice()),u=0;"float32"===r?u=t.FLOAT:"float64"===r?(u=t.FLOAT,s=!1,r="float32"):"uint8"===r?u=t.UNSIGNED_BYTE:(u=t.UNSIGNED_BYTE,s=!1,r="uint8");var c=0;if(2===n.length)c=t.LUMINANCE,n=[n[0],n[1],1],e=d(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])c=t.ALPHA;else if(2===n[2])c=t.LUMINANCE_ALPHA;else if(3===n[2])c=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");c=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,s=!1);var h,f,m=e.size;if(s)h=0===e.offset&&e.data.length===m?e.data:e.data.subarray(e.offset,e.offset+m);else{var g=[n[2],n[2]*n[0],1];f=v.malloc(m,r);var y=d(f,n,g,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?p.assign(y,e):b(y,e),h=f.subarray(0,m)}var x=l(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,u,h),s||v.free(f),new o(t,x,n[0],n[1],c,u)}function f(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(m||n(t),"number"==typeof arguments[1])return u(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return u(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1];if(e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof ImageData)return c(t,e,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return h(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var d=t("ndarray"),p=t("ndarray-ops"),v=t("typedarray-pool");e.exports=f;var m=null,g=null,y=null,b=function(t,e){p.muls(t,e,255)},x=o.prototype;Object.defineProperties(x,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&m.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),g.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),this._minFilter=t}},magFilter:{get:function(){return this._magFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&m.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),g.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=gl.getExtension("EXT_texture_filter_anisotropic");r&&this.gl.texParameterf(this.gl.TEXTURE_2D,r.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,t),this._wrapS=t}},wrapT:{get:function(){return this._wrapT},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;2>e;++e)if(y.indexOf(t[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);this._wrapS=t[0],this._wrapT=t[1];var r=this.gl;return this.bind(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this._wrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this._wrapT),t}},shape:{get:function(){return this._shapeVector},set:function(t){if(Array.isArray(t)){if(2!==t.length)throw new Error("gl-texture2d: Invalid texture shape")}else t=[0|t,0|t];return i(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t=0|t,i(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t=0|t,i(this,this._shape[0],t),t}}}),x.bind=function(t){var e=this.gl;return void 0!==t&&e.activeTexture(e.TEXTURE0+(0|t)),e.bindTexture(e.TEXTURE_2D,this.handle),void 0!==t?0|t:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},x.dispose=function(){this.gl.deleteTexture(this.handle)},x.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var t=Math.min(this._shape[0],this._shape[1]),e=0;t>0;++e,t>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},x.setPixels=function(t,e,r,n){var i=this.gl;if(this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0,t instanceof HTMLCanvasElement||t instanceof ImageData||t instanceof HTMLImageElement||t instanceof HTMLVideoElement){var o=this._mipLevels.indexOf(n)<0;o?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,t),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,t)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||0>e||0>r)throw new Error("gl-texture2d: Texture dimensions are out of bounds");s(i,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:433,"ndarray-ops":432,"typedarray-pool":458}],229:[function(t,e,r){"use strict";function n(t,e,r){e?e.bind():t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null);var n=0|t.getParameter(t.MAX_VERTEX_ATTRIBS);if(r){if(r.length>n)throw new Error("gl-vao: Too many vertex attributes");for(var i=0;i<r.length;++i){var o=r[i];if(o.buffer){var a=o.buffer,s=o.size||4,l=o.type||t.FLOAT,u=!!o.normalized,c=o.stride||0,h=o.offset||0;a.bind(),t.enableVertexAttribArray(i),t.vertexAttribPointer(i,s,l,u,c,h)}else{if("number"==typeof o)t.vertexAttrib1f(i,o);else if(1===o.length)t.vertexAttrib1f(i,o[0]);else if(2===o.length)t.vertexAttrib2f(i,o[0],o[1]);else if(3===o.length)t.vertexAttrib3f(i,o[0],o[1],o[2]);else{if(4!==o.length)throw new Error("gl-vao: Invalid vertex attribute");t.vertexAttrib4f(i,o[0],o[1],o[2],o[3])}t.disableVertexAttribArray(i)}}for(;n>i;++i)t.disableVertexAttribArray(i)}else{t.bindBuffer(t.ARRAY_BUFFER,null);for(var i=0;n>i;++i)t.disableVertexAttribArray(i)}}e.exports=n},{}],230:[function(t,e,r){"use strict";function n(t){this.gl=t,this._elements=null,this._attributes=null,this._elementsType=t.UNSIGNED_SHORT}function i(t){return new n(t)}var o=t("./do-bind.js");n.prototype.bind=function(){o(this.gl,this._elements,this._attributes)},n.prototype.update=function(t,e,r){this._elements=e,this._attributes=t,this._elementsType=r||this.gl.UNSIGNED_SHORT},n.prototype.dispose=function(){},n.prototype.unbind=function(){},n.prototype.draw=function(t,e,r){r=r||0;var n=this.gl;this._elements?n.drawElements(t,e,this._elementsType,r):n.drawArrays(t,r,e)},e.exports=i},{"./do-bind.js":229}],231:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this.location=t,this.dimension=e,this.a=r,this.b=n,this.c=i,this.d=o}function i(t,e,r){this.gl=t,this._ext=e,this.handle=r,this._attribs=[],this._useElements=!1,this._elementsType=t.UNSIGNED_SHORT}function o(t,e){return new i(t,e,e.createVertexArrayOES())}var a=t("./do-bind.js");n.prototype.bind=function(t){switch(this.dimension){case 1:t.vertexAttrib1f(this.location,this.a);break;case 2:t.vertexAttrib2f(this.location,this.a,this.b);break;case 3:t.vertexAttrib3f(this.location,this.a,this.b,this.c);break;case 4:t.vertexAttrib4f(this.location,this.a,this.b,this.c,this.d)}},i.prototype.bind=function(){this._ext.bindVertexArrayOES(this.handle);for(var t=0;t<this._attribs.length;++t)this._attribs[t].bind(this.gl)},i.prototype.unbind=function(){this._ext.bindVertexArrayOES(null)},i.prototype.dispose=function(){this._ext.deleteVertexArrayOES(this.handle)},i.prototype.update=function(t,e,r){if(this.bind(),a(this.gl,e,t),this.unbind(),this._attribs.length=0,t)for(var i=0;i<t.length;++i){var o=t[i];"number"==typeof o?this._attribs.push(new n(i,1,o)):Array.isArray(o)&&this._attribs.push(new n(i,o.length,o[0],o[1],o[2],o[3]))}this._useElements=!!e,this._elementsType=r||this.gl.UNSIGNED_SHORT},i.prototype.draw=function(t,e,r){r=r||0;var n=this.gl;this._useElements?n.drawElements(t,e,this._elementsType,r):n.drawArrays(t,r,e)},e.exports=o},{"./do-bind.js":229}],232:[function(t,e,r){"use strict";function n(t,e,r,n){var a,s=t.getExtension("OES_vertex_array_object");return a=s?i(t,s):o(t),a.update(e,r,n),a}var i=t("./lib/vao-native.js"),o=t("./lib/vao-emulated.js");e.exports=n},{"./lib/vao-emulated.js":230,"./lib/vao-native.js":231}],233:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}e.exports=n},{}],234:[function(t,e,r){function n(t){function e(t){t.length&&V.push({type:M[B],data:t,position:H,line:q,column:G})}function r(t){j=0,W+=t,F=W.length;for(var e;D=W[j],F>j;){switch(e=j,B){case h:j=S();break;case f:j=E();break;case d:j=T();break;case p:j=L();break;case v:j=P();break;case w:j=I();break;case m:j=C();break;case c:j=R();break;case x:j=A();break;case u:j=k()}if(e!==j)switch(W[e]){case"\n":G=0,++q;break;default:++G}}return N+=j,W=W.slice(j),V}function n(t){return U.length&&e(U.join("")),B=_,e("(eof)"),V}function k(){return U=U.length?[]:U,"/"===O&&"*"===D?(H=N+j-1,B=h,O=D,j+1):"/"===O&&"/"===D?(H=N+j-1,B=f,O=D,j+1):"#"===D?(B=d,H=N+j,j):/\s/.test(D)?(B=x,H=N+j,j):(X=/\d/.test(D),Y=/[^\w_]/.test(D),H=N+j,B=X?v:Y?p:c,j)}function A(){return/[^\s]/g.test(D)?(e(U.join("")),B=u,j):(U.push(D),O=D,j+1)}function T(){return"\n"===D&&"\\"!==O?(e(U.join("")),B=u,j):(U.push(D),O=D,j+1)}function E(){return T()}function S(){return"/"===D&&"*"===O?(U.push(D),e(U.join("")),B=u,j+1):(U.push(D),O=D,j+1)}function L(){if("."===O&&/\d/.test(D))return B=m,j;if("/"===O&&"*"===D)return B=h,j;if("/"===O&&"/"===D)return B=f,j;if("."===D&&U.length){for(;z(U););return B=m,j}if(";"===D||")"===D||"("===D){if(U.length)for(;z(U););return e(D),B=u,j+1}var t=2===U.length&&"="!==D;if(/[\w_\d\s]/.test(D)||t){for(;z(U););return B=u,j}return U.push(D),O=D,j+1}function z(t){for(var r,n,i=0;;){if(r=o.indexOf(t.slice(0,t.length+i).join("")),n=o[r],-1===r){if(i--+t.length>0)continue;n=t.slice(0,1).join("")}return e(n),H+=n.length,U=U.slice(n.length),U.length}}function I(){return/[^a-fA-F0-9]/.test(D)?(e(U.join("")),B=u,j):(U.push(D),O=D,j+1)}function P(){return"."===D?(U.push(D),B=m,O=D,j+1):/[eE]/.test(D)?(U.push(D),B=m,O=D,j+1):"x"===D&&1===U.length&&"0"===U[0]?(B=w,U.push(D),O=D,j+1):/[^\d]/.test(D)?(e(U.join("")),B=u,j):(U.push(D),O=D,j+1)}function C(){return"f"===D&&(U.push(D),O=D,j+=1),/[eE]/.test(D)?(U.push(D),O=D,j+1):"-"===D&&/[eE]/.test(O)?(U.push(D),O=D,j+1):/[^\d]/.test(D)?(e(U.join("")),B=u,j):(U.push(D),O=D,j+1)}function R(){if(/[^\d\w_]/.test(D)){var t=U.join("");return B=K.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:g,e(U.join("")),B=u,j}return U.push(D),O=D,j+1}var D,O,F,j=0,N=0,B=u,U=[],V=[],q=1,G=0,H=0,X=!1,Y=!1,W="";t=t||{};var Z=a,K=i;return"300 es"===t.version&&(Z=l,K=s),function(t){return V=[],null!==t?r(t):n()}}e.exports=n;var i=t("./lib/literals"),o=t("./lib/operators"),a=t("./lib/builtins"),s=t("./lib/literals-300es"),l=t("./lib/builtins-300es"),u=999,c=9999,h=0,f=1,d=2,p=3,v=4,m=5,g=6,y=7,b=8,x=9,_=10,w=11,M=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":236,"./lib/builtins-300es":235,"./lib/literals":238,"./lib/literals-300es":237,"./lib/operators":239}],235:[function(t,e,r){var n=t("./builtins");n=n.slice().filter(function(t){return!/^(gl\_|texture)/.test(t)}),e.exports=n.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"])},{"./builtins":236}],236:[function(t,e,r){e.exports=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"];
"../../symbol/mergelines":312,"../../symbol/quads":313,"../../symbol/resolve_text":314,"../../symbol/shaping":315,"../../util/token":348,"../../util/util":349,"../bucket":247,"../load_geometry":254,"point-geometry":404}],252:[function(t,e,r){"use strict";function n(t,e,r){this.arrayBuffer=t.arrayBuffer,this.length=t.length,this.attributes=e.members,this.itemSize=e.bytesPerElement,this.type=r,this.arrayType=e}var i=t("assert");e.exports=n,n.prototype.bind=function(t){var e=t[this.type];this.buffer?t.bindBuffer(e,this.buffer):(this.buffer=t.createBuffer(),t.bindBuffer(e,this.buffer),t.bufferData(e,this.arrayBuffer,t.STATIC_DRAW),this.arrayBuffer=null)};var o={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT"};n.prototype.setVertexAttribPointers=function(t,e){for(var r=0;r<this.attributes.length;r++){var n=this.attributes[r],a=e[n.name];i(void 0!==a,'array member "'+n.name+'" name does not match shader attribute name'),t.vertexAttribPointer(a,n.components,t[o[n.type]],!1,this.arrayType.bytesPerElement,n.offset)}},n.prototype.destroy=function(t){this.buffer&&t.deleteBuffer(this.buffer)},n.BufferType={VERTEX:"ARRAY_BUFFER",ELEMENT:"ELEMENT_ARRAY_BUFFER"},n.ELEMENT_ATTRIBUTE_TYPE="Uint16",n.VERTEX_ATTRIBUTE_ALIGNMENT=4},{assert:52}],253:[function(t,e,r){"use strict";function n(t,e,r){if(t.grid){var n=t,i=e;t=n.coord,e=n.overscaling,this.grid=new p(n.grid),this.featureIndexArray=new k(n.featureIndexArray),this.rawTileData=i,this.bucketLayerIDs=n.bucketLayerIDs}else this.grid=new p(h,16,0),this.featureIndexArray=new k;this.coord=t,this.overscaling=e,this.x=t.x,this.y=t.y,this.z=t.z-Math.log(e)/Math.LN2,this.setCollisionTile(r)}function i(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function o(t,e){return e-t}function a(t){return t["line-gap-width"]>0?t["line-gap-width"]+2*t["line-width"]:t["line-width"]}function s(t,e,r,n,i){if(!e[0]&&!e[1])return t;e=u.convert(e),"viewport"===r&&e._rotate(-n);for(var o=[],a=0;a<t.length;a++){for(var s=t[a],l=[],c=0;c<s.length;c++)l.push(s[c].sub(e._mult(i)));o.push(l)}return o}function l(t,e){for(var r=[],n=new u(0,0),i=0;i<t.length;i++){for(var o=t[i],a=[],s=0;s<o.length;s++){var l=o[s-1],c=o[s],h=o[s+1],f=0===s?n:c.sub(l)._unit()._perp(),d=s===o.length-1?n:h.sub(c)._unit()._perp(),p=f._add(d)._unit(),v=p.x*d.x+p.y*d.y;p._mult(1/v),a.push(p._mult(e)._add(c))}r.push(a)}return r}var u=t("point-geometry"),c=t("./load_geometry"),h=t("./bucket").EXTENT,f=t("feature-filter"),d=t("../util/struct_array"),p=t("grid-index"),v=t("../util/dictionary_coder"),m=t("vector-tile"),g=t("pbf"),y=t("../util/vectortile_to_geojson"),b=t("../util/util").arraysIntersect,x=t("../util/intersection_tests"),_=x.multiPolygonIntersectsBufferedMultiPoint,w=x.multiPolygonIntersectsMultiPolygon,M=x.multiPolygonIntersectsBufferedMultiLine,k=new d({members:[{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]});e.exports=n,n.prototype.insert=function(t,e,r,n){var i=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(e,r,n);for(var o=c(t),a=0;a<o.length;a++){for(var s=o[a],l=[1/0,1/0,-(1/0),-(1/0)],u=0;u<s.length;u++){var h=s[u];l[0]=Math.min(l[0],h.x),l[1]=Math.min(l[1],h.y),l[2]=Math.max(l[2],h.x),l[3]=Math.max(l[3],h.y)}this.grid.insert(i,l[0],l[1],l[2],l[3])}},n.prototype.setCollisionTile=function(t){this.collisionTile=t},n.prototype.serialize=function(){var t={coord:this.coord,overscaling:this.overscaling,grid:this.grid.toArrayBuffer(),featureIndexArray:this.featureIndexArray.serialize(),bucketLayerIDs:this.bucketLayerIDs};return{data:t,transferables:[t.grid,t.featureIndexArray.arrayBuffer]}},n.prototype.query=function(t,e){this.vtLayers||(this.vtLayers=new m.VectorTile(new g(new Uint8Array(this.rawTileData))).layers,this.sourceLayerCoder=new v(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]));var r={},n=t.params||{},s=h/t.tileSize/t.scale,l=f(n.filter),c=0;for(var d in e){var p=e[d],y=p.paint,b=0;"line"===p.type?b=a(y)/2+Math.abs(y["line-offset"])+i(y["line-translate"]):"fill"===p.type?b=i(y["fill-translate"]):"circle"===p.type&&(b=y["circle-radius"]+i(y["circle-translate"])),c=Math.max(c,b*s)}for(var x=t.queryGeometry.map(function(t){return t.map(function(t){return new u(t.x,t.y)})}),_=1/0,w=1/0,M=-(1/0),k=-(1/0),A=0;A<x.length;A++)for(var T=x[A],E=0;E<T.length;E++){var S=T[E];_=Math.min(_,S.x),w=Math.min(w,S.y),M=Math.max(M,S.x),k=Math.max(k,S.y)}var L=this.grid.query(_-c,w-c,M+c,k+c);L.sort(o),this.filterMatching(r,L,this.featureIndexArray,x,l,n.layers,e,t.bearing,s);var z=this.collisionTile.queryRenderedSymbols(_,w,M,k,t.scale);return z.sort(),this.filterMatching(r,z,this.collisionTile.collisionBoxArray,x,l,n.layers,e,t.bearing,s),r},n.prototype.filterMatching=function(t,e,r,n,i,o,u,h,f){for(var d,p=0;p<e.length;p++){var v=e[p];if(v!==d){d=v;var m=r.get(v),g=this.bucketLayerIDs[m.bucketIndex];if(!o||b(o,g)){var x=this.sourceLayerCoder.decode(m.sourceLayerIndex),k=this.vtLayers[x],A=k.feature(m.featureIndex);if(i(A))for(var T=null,E=0;E<g.length;E++){var S=g[E];if(!(o&&o.indexOf(S)<0)){var L=u[S];if(L){var z;if("symbol"!==L.type){T||(T=c(A));var I=L.paint;if("line"===L.type){z=s(n,I["line-translate"],I["line-translate-anchor"],h,f);var P=a(I)/2*f;if(I["line-offset"]&&(T=l(T,I["line-offset"]*f)),!M(z,T,P))continue}else if("fill"===L.type){if(z=s(n,I["fill-translate"],I["fill-translate-anchor"],h,f),!w(z,T))continue}else if("circle"===L.type){z=s(n,I["circle-translate"],I["circle-translate-anchor"],h,f);var C=I["circle-radius"]*f;if(!_(z,T,C))continue}}var R=new y(A,this.z,this.x,this.y);R.layer=L.serialize({includeRefProperties:!0});var D=t[S];void 0===D&&(D=t[S]=[]),D.push(R)}}}}}}}},{"../util/dictionary_coder":340,"../util/intersection_tests":344,"../util/struct_array":347,"../util/util":349,"../util/vectortile_to_geojson":350,"./bucket":247,"./load_geometry":254,"feature-filter":352,"grid-index":373,pbf:402,"point-geometry":404,"vector-tile":413}],254:[function(t,e,r){"use strict";var n=t("./bucket").EXTENT,i=-2*n,o=2*n-1,a=!1;e.exports=function(t){for(var e=n/t.extent,r=t.loadGeometry(),s=0;s<r.length;s++)for(var l=r[s],u=0;u<l.length;u++){var c=l[u];c.x=Math.round(c.x*e),c.y=Math.round(c.y*e),a===!1&&(c.x<i||c.x>o||c.y<i||c.y>o)&&(console.warn("Geometry exceeds allowed extent, reduce your vector tile buffer size"),a=!0)}return r}},{"./bucket":247}],255:[function(t,e,r){"use strict";function n(t,e,r){this.column=t,this.row=e,this.zoom=r}e.exports=n,n.prototype={clone:function(){return new n(this.column,this.row,this.zoom)},zoomTo:function(t){return this.clone()._zoomTo(t)},sub:function(t){return this.clone()._sub(t)},_zoomTo:function(t){var e=Math.pow(2,t-this.zoom);return this.column*=e,this.row*=e,this.zoom=t,this},_sub:function(t){return t=t.zoomTo(this.zoom),this.column-=t.column,this.row-=t.row,this}}},{}],256:[function(t,e,r){"use strict";function n(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}e.exports=n;var i=t("../util/util").wrap;n.prototype.wrap=function(){return new n(i(this.lng,-180,180),this.lat)},n.prototype.toArray=function(){return[this.lng,this.lat]},n.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t}},{"../util/util":349}],257:[function(t,e,r){"use strict";function n(t,e){t&&(e?this.extend(t).extend(e):4===t.length?this.extend([t[0],t[1]]).extend([t[2],t[3]]):this.extend(t[0]).extend(t[1]))}e.exports=n;var i=t("./lng_lat");n.prototype={extend:function(t){var e,r,o=this._sw,a=this._ne;if(t instanceof i)e=t,r=t;else{if(!(t instanceof n))return t?this.extend(i.convert(t)||n.convert(t)):this;if(e=t._sw,r=t._ne,!e||!r)return this}return o||a?(o.lng=Math.min(e.lng,o.lng),o.lat=Math.min(e.lat,o.lat),a.lng=Math.max(r.lng,a.lng),a.lat=Math.max(r.lat,a.lat)):(this._sw=new i(e.lng,e.lat),this._ne=new i(r.lng,r.lat)),this},getCenter:function(){return new i((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},getSouthWest:function(){return this._sw},getNorthEast:function(){return this._ne},getNorthWest:function(){return new i(this.getWest(),this.getNorth())},getSouthEast:function(){return new i(this.getEast(),this.getSouth())},getWest:function(){return this._sw.lng},getSouth:function(){return this._sw.lat},getEast:function(){return this._ne.lng},getNorth:function(){return this._ne.lat},toArray:function(){return[this._sw.toArray(),this._ne.toArray()]},toString:function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"}},n.convert=function(t){return!t||t instanceof n?t:new n(t)}},{"./lng_lat":256}],258:[function(t,e,r){"use strict";function n(t,e){this.tileSize=512,this._minZoom=t||0,this._maxZoom=e||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new i(0,0),this.zoom=0,this.angle=0,this._altitude=1.5,this._pitch=0,this._unmodified=!0}var i=t("./lng_lat"),o=t("point-geometry"),a=t("./coordinate"),s=t("../util/util").wrap,l=t("../util/interpolate"),u=t("../source/tile_coord"),c=t("../data/bucket").EXTENT,h=t("gl-matrix"),f=h.vec4,d=h.mat4,p=h.mat2;e.exports=n,n.prototype={get minZoom(){return this._minZoom},set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},get maxZoom(){return this._maxZoom},set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},get worldSize(){return this.tileSize*this.scale},get centerPoint(){return this.size._div(2)},get size(){return new o(this.width,this.height)},get bearing(){return-this.angle/Math.PI*180},set bearing(t){var e=-s(t,-180,180)*Math.PI/180;this.angle!==e&&(this._unmodified=!1,this.angle=e,this._calcProjMatrix(),this.rotationMatrix=p.create(),p.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},get pitch(){return this._pitch/Math.PI*180},set pitch(t){var e=Math.min(60,t)/180*Math.PI;this._pitch!==e&&(this._unmodified=!1,this._pitch=e,this._calcProjMatrix())},get altitude(){return this._altitude},set altitude(t){var e=Math.max(.75,t);this._altitude!==e&&(this._unmodified=!1,this._altitude=e,this._calcProjMatrix())},get zoom(){return this._zoom},set zoom(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._calcProjMatrix(),this._constrain())},get center(){return this._center},set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._calcProjMatrix(),this._constrain())},resize:function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._calcProjMatrix(),this._constrain()},get unmodified(){return this._unmodified},zoomScale:function(t){return Math.pow(2,t)},scaleZoom:function(t){return Math.log(t)/Math.LN2},project:function(t,e){return new o(this.lngX(t.lng,e),this.latY(t.lat,e))},unproject:function(t,e){return new i(this.xLng(t.x,e),this.yLat(t.y,e))},get x(){return this.lngX(this.center.lng)},get y(){return this.latY(this.center.lat)},get point(){return new o(this.x,this.y)},lngX:function(t,e){return(180+t)*(e||this.worldSize)/360},latY:function(t,e){var r=180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360));return(180-r)*(e||this.worldSize)/360},xLng:function(t,e){return 360*t/(e||this.worldSize)-180},yLat:function(t,e){var r=180-360*t/(e||this.worldSize);return 360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90},panBy:function(t){var e=this.centerPoint._add(t);this.center=this.pointLocation(e)},setLocationAtPoint:function(t,e){var r=this.locationCoordinate(t),n=this.pointCoordinate(e),i=this.pointCoordinate(this.centerPoint),o=n._sub(r);this._unmodified=!1,this.center=this.coordinateLocation(i._sub(o))},locationPoint:function(t){return this.coordinatePoint(this.locationCoordinate(t))},pointLocation:function(t){return this.coordinateLocation(this.pointCoordinate(t))},locationCoordinate:function(t){var e=this.zoomScale(this.tileZoom)/this.worldSize,r=i.convert(t);return new a(this.lngX(r.lng)*e,this.latY(r.lat)*e,this.tileZoom)},coordinateLocation:function(t){var e=this.zoomScale(t.zoom);return new i(this.xLng(t.column,e),this.yLat(t.row,e))},pointCoordinate:function(t){var e=0,r=this.coordinatePointMatrix(this.tileZoom);if(d.invert(r,r),!r)throw new Error("failed to invert matrix");var n=[t.x,t.y,0,1],i=[t.x,t.y,1,1];f.transformMat4(n,n,r),f.transformMat4(i,i,r);var o=n[3],s=i[3],u=n[0]/o,c=i[0]/s,h=n[1]/o,p=i[1]/s,v=n[2]/o,m=i[2]/s,g=v===m?0:(e-v)/(m-v);return new a(l(u,c,g),l(h,p,g),this.tileZoom)},coordinatePoint:function(t){var e=this.coordinatePointMatrix(t.zoom),r=[t.column,t.row,0,1];return f.transformMat4(r,r,e),new o(r[0]/r[3],r[1]/r[3])},coordinatePointMatrix:function(t){var e=d.copy(new Float64Array(16),this.projMatrix),r=this.worldSize/this.zoomScale(t);return d.scale(e,e,[r,r,1]),d.multiply(e,this.getPixelMatrix(),e),e},getPixelMatrix:function(){var t=d.create();return d.scale(t,t,[this.width/2,-this.height/2,1]),d.translate(t,t,[1,-1,0]),t},calculatePosMatrix:function(t,e){void 0===e&&(e=1/0),t instanceof u&&(t=t.toCoordinate(e));var r=Math.min(t.zoom,e),n=this.worldSize/Math.pow(2,r),i=new Float64Array(16);return d.identity(i),d.translate(i,i,[t.column*n,t.row*n,0]),d.scale(i,i,[n/c,n/c,1]),d.multiply(i,this.projMatrix,i),new Float32Array(i)},_constrain:function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var t,e,r,n,i,a,s,l,u=this.size,c=this._unmodified;this.latRange&&(t=this.latY(this.latRange[1]),e=this.latY(this.latRange[0]),i=e-t<u.y?u.y/(e-t):0),this.lngRange&&(r=this.lngX(this.lngRange[0]),n=this.lngX(this.lngRange[1]),a=n-r<u.x?u.x/(n-r):0);var h=Math.max(a||0,i||0);if(h)return this.center=this.unproject(new o(a?(n+r)/2:this.x,i?(e+t)/2:this.y)),this.zoom+=this.scaleZoom(h),this._unmodified=c,void(this._constraining=!1);if(this.latRange){var f=this.y,d=u.y/2;t>f-d&&(l=t+d),f+d>e&&(l=e-d)}if(this.lngRange){var p=this.x,v=u.x/2;r>p-v&&(s=r+v),p+v>n&&(s=n-v)}void 0===s&&void 0===l||(this.center=this.unproject(new o(void 0!==s?s:this.x,void 0!==l?l:this.y))),this._unmodified=c,this._constraining=!1}},_calcProjMatrix:function(){var t=new Float64Array(16),e=Math.atan(.5/this.altitude),r=Math.sin(e)*this.altitude/Math.sin(Math.PI/2-this._pitch-e),n=Math.cos(Math.PI/2-this._pitch)*r+this.altitude;d.perspective(t,2*Math.atan(this.height/2/this.altitude),this.width/this.height,.1,n),d.translate(t,t,[0,0,-this.altitude]),d.scale(t,t,[1,-1,1/this.height]),d.rotateX(t,t,this._pitch),d.rotateZ(t,t,this.angle),d.translate(t,t,[-this.x,-this.y,0]),this.projMatrix=t}}},{"../data/bucket":247,"../source/tile_coord":281,"../util/interpolate":343,"../util/util":349,"./coordinate":255,"./lng_lat":256,"gl-matrix":363,"point-geometry":404}],259:[function(t,e,r){"use strict";var n={" ":[16,[]],"!":[10,[5,21,5,7,-1,-1,5,2,4,1,5,0,6,1,5,2]],'"':[16,[4,21,4,14,-1,-1,12,21,12,14]],"#":[21,[11,25,4,-7,-1,-1,17,25,10,-7,-1,-1,4,12,18,12,-1,-1,3,6,17,6]],:[20,[8,25,8,-4,-1,-1,12,25,12,-4,-1,-1,17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],"%":[24,[21,21,3,0,-1,-1,8,21,10,19,10,17,9,15,7,14,5,14,3,16,3,18,4,20,6,21,8,21,10,20,13,19,16,19,19,20,21,21,-1,-1,17,7,15,6,14,4,14,2,16,0,18,0,20,1,21,3,21,5,19,7,17,7]],"&":[26,[23,12,23,13,22,14,21,14,20,13,19,11,17,6,15,3,13,1,11,0,7,0,5,1,4,2,3,4,3,6,4,8,5,9,12,13,13,14,14,16,14,18,13,20,11,21,9,20,8,18,8,16,9,13,11,10,16,3,18,1,20,0,22,0,23,1,23,2]],"'":[10,[5,19,4,20,5,21,6,20,6,18,5,16,4,15]],"(":[14,[11,25,9,23,7,20,5,16,4,11,4,7,5,2,7,-2,9,-5,11,-7]],")":[14,[3,25,5,23,7,20,9,16,10,11,10,7,9,2,7,-2,5,-5,3,-7]],"*":[16,[8,21,8,9,-1,-1,3,18,13,12,-1,-1,13,18,3,12]],"+":[26,[13,18,13,0,-1,-1,4,9,22,9]],",":[10,[6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"-":[26,[4,9,22,9]],".":[10,[5,2,4,1,5,0,6,1,5,2]],"/":[22,[20,25,2,-7]],0:[20,[9,21,6,20,4,17,3,12,3,9,4,4,6,1,9,0,11,0,14,1,16,4,17,9,17,12,16,17,14,20,11,21,9,21]],1:[20,[6,17,8,18,11,21,11,0]],2:[20,[4,16,4,17,5,19,6,20,8,21,12,21,14,20,15,19,16,17,16,15,15,13,13,10,3,0,17,0]],3:[20,[5,21,16,21,10,13,13,13,15,12,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],4:[20,[13,21,3,7,18,7,-1,-1,13,21,13,0]],5:[20,[15,21,5,21,4,12,5,13,8,14,11,14,14,13,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],6:[20,[16,18,15,20,12,21,10,21,7,20,5,17,4,12,4,7,5,3,7,1,10,0,11,0,14,1,16,3,17,6,17,7,16,10,14,12,11,13,10,13,7,12,5,10,4,7]],7:[20,[17,21,7,0,-1,-1,3,21,17,21]],8:[20,[8,21,5,20,4,18,4,16,5,14,7,13,11,12,14,11,16,9,17,7,17,4,16,2,15,1,12,0,8,0,5,1,4,2,3,4,3,7,4,9,6,11,9,12,13,13,15,14,16,16,16,18,15,20,12,21,8,21]],9:[20,[16,14,15,11,13,9,10,8,9,8,6,9,4,11,3,14,3,15,4,18,6,20,9,21,10,21,13,20,15,18,16,14,16,9,15,4,13,1,10,0,8,0,5,1,4,3]],":":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,5,2,4,1,5,0,6,1,5,2]],";":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"<":[24,[20,18,4,9,20,0]],"=":[26,[4,12,22,12,-1,-1,4,6,22,6]],">":[24,[4,18,20,9,4,0]],"?":[18,[3,16,3,17,4,19,5,20,7,21,11,21,13,20,14,19,15,17,15,15,14,13,13,12,9,10,9,7,-1,-1,9,2,8,1,9,0,10,1,9,2]],"@":[27,[18,13,17,15,15,16,12,16,10,15,9,14,8,11,8,8,9,6,11,5,14,5,16,6,17,8,-1,-1,12,16,10,14,9,11,9,8,10,6,11,5,-1,-1,18,16,17,8,17,6,19,5,21,5,23,7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12,21,9,20,7,19,5,17,4,15,3,12,3,9,4,6,5,4,7,2,9,1,12,0,15,0,18,1,20,2,21,3,-1,-1,19,16,18,8,18,6,19,5]],A:[18,[9,21,1,0,-1,-1,9,21,17,0,-1,-1,4,7,14,7]],B:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,-1,-1,4,11,13,11,16,10,17,9,18,7,18,4,17,2,16,1,13,0,4,0]],C:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5]],D:[21,[4,21,4,0,-1,-1,4,21,11,21,14,20,16,18,17,16,18,13,18,8,17,5,16,3,14,1,11,0,4,0]],E:[19,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11,-1,-1,4,0,17,0]],F:[18,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11]],G:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,18,8,-1,-1,13,8,18,8]],H:[22,[4,21,4,0,-1,-1,18,21,18,0,-1,-1,4,11,18,11]],I:[8,[4,21,4,0]],J:[16,[12,21,12,5,11,2,10,1,8,0,6,0,4,1,3,2,2,5,2,7]],K:[21,[4,21,4,0,-1,-1,18,21,4,7,-1,-1,9,12,18,0]],L:[17,[4,21,4,0,-1,-1,4,0,16,0]],M:[24,[4,21,4,0,-1,-1,4,21,12,0,-1,-1,20,21,12,0,-1,-1,20,21,20,0]],N:[22,[4,21,4,0,-1,-1,4,21,18,0,-1,-1,18,21,18,0]],O:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21]],P:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13,10,4,10]],Q:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21,-1,-1,12,4,18,-2]],R:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,4,11,-1,-1,11,11,18,0]],S:[20,[17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],T:[16,[8,21,8,0,-1,-1,1,21,15,21]],U:[22,[4,21,4,6,5,3,7,1,10,0,12,0,15,1,17,3,18,6,18,21]],V:[18,[1,21,9,0,-1,-1,17,21,9,0]],W:[24,[2,21,7,0,-1,-1,12,21,7,0,-1,-1,12,21,17,0,-1,-1,22,21,17,0]],X:[20,[3,21,17,0,-1,-1,17,21,3,0]],Y:[18,[1,21,9,11,9,0,-1,-1,17,21,9,11]],Z:[20,[17,21,3,0,-1,-1,3,21,17,21,-1,-1,3,0,17,0]],"[":[14,[4,25,4,-7,-1,-1,5,25,5,-7,-1,-1,4,25,11,25,-1,-1,4,-7,11,-7]],"\\":[14,[0,21,14,-3]],"]":[14,[9,25,9,-7,-1,-1,10,25,10,-7,-1,-1,3,25,10,25,-1,-1,3,-7,10,-7]],"^":[16,[6,15,8,18,10,15,-1,-1,3,12,8,17,13,12,-1,-1,8,17,8,0]],_:[16,[0,-2,16,-2]],"":[10,[6,21,5,20,4,18,4,16,5,15,6,16,5,17]],a:[19,[15,14,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],b:[19,[4,21,4,0,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],c:[18,[15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],d:[19,[15,21,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],e:[18,[3,8,15,8,15,10,14,12,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],f:[12,[10,21,8,21,6,20,5,17,5,0,-1,-1,2,14,9,14]],g:[19,[15,14,15,-2,14,-5,13,-6,11,-7,8,-7,6,-6,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],h:[19,[4,21,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],i:[8,[3,21,4,20,5,21,4,22,3,21,-1,-1,4,14,4,0]],j:[10,[5,21,6,20,7,21,6,22,5,21,-1,-1,6,14,6,-3,5,-6,3,-7,1,-7]],k:[17,[4,21,4,0,-1,-1,14,14,4,4,-1,-1,8,8,15,0]],l:[8,[4,21,4,0]],m:[30,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0,-1,-1,15,10,18,13,20,14,23,14,25,13,26,10,26,0]],n:[19,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],o:[19,[8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3,16,6,16,8,15,11,13,13,11,14,8,14]],p:[19,[4,14,4,-7,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],q:[19,[15,14,15,-7,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],r:[13,[4,14,4,0,-1,-1,4,8,5,11,7,13,9,14,12,14]],s:[17,[14,11,13,13,10,14,7,14,4,13,3,11,4,9,6,8,11,7,13,6,14,4,14,3,13,1,10,0,7,0,4,1,3,3]],t:[12,[5,21,5,4,6,1,8,0,10,0,-1,-1,2,14,9,14]],u:[19,[4,14,4,4,5,1,7,0,10,0,12,1,15,4,-1,-1,15,14,15,0]],v:[16,[2,14,8,0,-1,-1,14,14,8,0]],w:[22,[3,14,7,0,-1,-1,11,14,7,0,-1,-1,11,14,15,0,-1,-1,19,14,15,0]],x:[17,[3,14,14,0,-1,-1,14,14,3,0]],y:[16,[2,14,8,0,-1,-1,14,14,8,0,6,-4,4,-6,2,-7,1,-7]],z:[17,[14,14,3,0,-1,-1,3,14,14,14,-1,-1,3,0,14,0]],"{":[14,[9,25,7,24,6,23,5,21,5,19,6,17,7,16,8,14,8,12,6,10,-1,-1,7,24,6,22,6,20,7,18,8,17,9,15,9,13,8,11,4,9,8,7,9,5,9,3,8,1,7,0,6,-2,6,-4,7,-6,-1,-1,6,8,8,6,8,4,7,2,6,1,5,-1,5,-3,6,-5,7,-6,9,-7]],"|":[8,[4,25,4,-7]],"}":[14,[5,25,7,24,8,23,9,21,9,19,8,17,7,16,6,14,6,12,8,10,-1,-1,7,24,8,22,8,20,7,18,6,17,5,15,5,13,6,11,10,9,6,7,5,5,5,3,6,1,7,0,8,-2,8,-4,7,-6,-1,-1,8,8,6,6,6,4,7,2,8,1,9,-1,9,-3,8,-5,7,-6,5,-7]],"~":[24,[3,6,3,8,4,11,6,12,8,12,10,11,14,8,16,7,18,7,20,8,21,10,-1,-1,3,8,4,10,6,11,8,11,10,10,14,7,16,6,18,6,20,7,21,10,21,12]]};e.exports=function(t,e,r,i){i=i||1;var o,a,s,l,u,c,h,f,d=[];for(o=0,a=t.length;a>o;o++)if(u=n[t[o]]){for(f=null,s=0,l=u[1].length;l>s;s+=2)-1===u[1][s]&&-1===u[1][s+1]?f=null:(c=e+u[1][s]*i,h=r-u[1][s+1]*i,f&&d.push(f.x,f.y,c,h),f={x:c,y:h});e+=u[0]*i}return d}},{}],260:[function(t,e,r){"use strict";var n=e.exports={};n.Map=t("./ui/map"),n.Control=t("./ui/control/control"),n.Navigation=t("./ui/control/navigation"),n.Geolocate=t("./ui/control/geolocate"),n.Attribution=t("./ui/control/attribution"),n.Popup=t("./ui/popup"),n.GeoJSONSource=t("./source/geojson_source"),n.VideoSource=t("./source/video_source"),n.ImageSource=t("./source/image_source"),n.Style=t("./style/style"),n.LngLat=t("./geo/lng_lat"),n.LngLatBounds=t("./geo/lng_lat_bounds"),n.Point=t("point-geometry"),n.Evented=t("./util/evented"),n.util=t("./util/util"),n.supported=t("./util/browser").supported;var i=t("./util/ajax");n.util.getJSON=i.getJSON,n.util.getArrayBuffer=i.getArrayBuffer;var o=t("./util/config");n.config=o,Object.defineProperty(n,"accessToken",{get:function(){return o.ACCESS_TOKEN},set:function(t){o.ACCESS_TOKEN=t}})},{"./geo/lng_lat":256,"./geo/lng_lat_bounds":257,"./source/geojson_source":274,"./source/image_source":276,"./source/video_source":284,"./style/style":290,"./ui/control/attribution":318,"./ui/control/control":319,"./ui/control/geolocate":320,"./ui/control/navigation":321,"./ui/map":331,"./ui/popup":332,"./util/ajax":334,"./util/browser":335,"./util/config":339,"./util/evented":341,"./util/util":349,"point-geometry":404}],261:[function(t,e,r){"use strict";function n(t,e,r){var n,i=t.gl,l=t.transform,u=a.premultiply(r.paint["background-color"]),c=r.paint["background-pattern"],h=r.paint["background-opacity"],f=c?t.spriteAtlas.getPosition(c.from,!0):null,d=c?t.spriteAtlas.getPosition(c.to,!0):null;if(t.setDepthSublayer(0),f&&d){if(t.isOpaquePass)return;n=t.useProgram("pattern"),i.uniform1i(n.u_image,0),i.uniform2fv(n.u_pattern_tl_a,f.tl),i.uniform2fv(n.u_pattern_br_a,f.br),i.uniform2fv(n.u_pattern_tl_b,d.tl),i.uniform2fv(n.u_pattern_br_b,d.br),i.uniform1f(n.u_opacity,h),i.uniform1f(n.u_mix,c.t),t.spriteAtlas.bind(i,!0),t.tileExtentPatternVAO.bind(i,n,t.tileExtentBuffer)}else{if(t.isOpaquePass!==(1===u[3]))return;n=t.useProgram("fill"),i.uniform4fv(n.u_color,u),i.uniform1f(n.u_opacity,h),t.tileExtentVAO.bind(i,n,t.tileExtentBuffer)}i.disable(i.STENCIL_TEST);for(var p=o.coveringTiles(l),v=0;v<p.length;v++){var m=p[v],g=512;if(f&&d){var y=[f.size[0]*c.fromScale,f.size[1]*c.fromScale],b=[d.size[0]*c.toScale,d.size[1]*c.toScale],x={coord:m,tileSize:g};i.uniform2fv(n.u_patternscale_a,[1/s(x,y[0],t.transform.tileZoom),1/s(x,y[1],t.transform.tileZoom)]),i.uniform2fv(n.u_patternscale_b,[1/s(x,b[0],t.transform.tileZoom),1/s(x,b[1],t.transform.tileZoom)]);var _=g*Math.pow(2,t.transform.tileZoom-m.z),w=_/y[0]%1*(m.x+m.w*Math.pow(2,m.z)),M=_/y[1]%1*m.y,k=_/b[0]%1*(m.x+m.w*Math.pow(2,m.z)),A=_/b[1]%1*m.y;i.uniform2fv(n.u_offset_a,[w,M]),i.uniform2fv(n.u_offset_b,[k,A])}i.uniformMatrix4fv(n.u_matrix,!1,t.transform.calculatePosMatrix(m)),i.drawArrays(i.TRIANGLE_STRIP,0,t.tileExtentBuffer.length)}i.stencilMask(0),i.stencilFunc(i.EQUAL,128,128)}var i=t("../source/tile_pyramid"),o=new i({tileSize:512}),a=t("../util/util"),s=t("../source/pixels_to_tile_units");e.exports=n},{"../source/pixels_to_tile_units":277,"../source/tile_pyramid":282,"../util/util":349}],262:[function(t,e,r){"use strict";function n(t,e,r,n){if(!t.isOpaquePass){var o=t.gl;t.setDepthSublayer(0),t.depthMask(!1),o.disable(o.STENCIL_TEST);for(var a=0;a<n.length;a++){var s=n[a],l=e.getTile(s),u=l.getBucket(r);if(u){var c=u.bufferGroups.circle;if(c){var h=t.useProgram("circle",u.getProgramMacros("circle",r));o.uniform2fv(h.u_extrude_scale,t.transform.pixelsToGLUnits),o.uniform1f(h.u_blur,r.paint["circle-blur"]),o.uniform1f(h.u_devicepixelratio,i.devicePixelRatio),o.uniform1f(h.u_opacity,r.paint["circle-opacity"]),o.uniformMatrix4fv(h.u_matrix,!1,t.translatePosMatrix(s.posMatrix,l,r.paint["circle-translate"],r.paint["circle-translate-anchor"])),u.setUniforms(o,"circle",h,r,{zoom:t.transform.zoom});for(var f=0;f<c.length;f++){var d=c[f];d.vaos[r.id].bind(o,h,d.layout.vertex,d.layout.element,d.paint[r.id]),o.drawElements(o.TRIANGLES,3*d.layout.element.length,o.UNSIGNED_SHORT,0)}}}}}}var i=t("../util/browser");e.exports=n},{"../util/browser":335}],263:[function(t,e,r){"use strict";function n(t,e,r,n){var i=t.gl;i.enable(i.STENCIL_TEST);for(var o=t.useProgram("collisionbox"),a=0;a<n.length;a++){var s=n[a],l=e.getTile(s),u=l.getBucket(r);if(u){var c=u.bufferGroups.collisionBox;if(c&&c.length){var h=c[0];0!==h.layout.vertex.length&&(i.uniformMatrix4fv(o.u_matrix,!1,s.posMatrix),t.enableTileClippingMask(s),t.lineWidth(1),i.uniform1f(o.u_scale,Math.pow(2,t.transform.zoom-l.coord.z)),i.uniform1f(o.u_zoom,10*t.transform.zoom),i.uniform1f(o.u_maxzoom,10*(l.coord.z+1)),h.vaos[r.id].bind(i,o,h.layout.vertex),i.drawArrays(i.LINES,0,h.layout.vertex.length))}}}}e.exports=n},{}],264:[function(t,e,r){"use strict";function n(t,e,r){if(!t.isOpaquePass&&t.options.debug)for(var n=0;n<r.length;n++)i(t,e,r[n])}function i(t,e,r){var n=t.gl;n.disable(n.STENCIL_TEST),t.lineWidth(1*a.devicePixelRatio);var i=r.posMatrix,h=t.useProgram("debug");n.uniformMatrix4fv(h.u_matrix,!1,i),n.uniform4f(h.u_color,1,0,0,1),t.debugVAO.bind(n,h,t.debugBuffer),n.drawArrays(n.LINE_STRIP,0,t.debugBuffer.length);for(var f=o(r.toString(),50,200,5),d=new t.PosArray,p=0;p<f.length;p+=2)d.emplaceBack(f[p],f[p+1]);var v=new u(d.serialize(),t.PosArray.serialize(),u.BufferType.VERTEX),m=new c;m.bind(n,h,v),n.uniform4f(h.u_color,1,1,1,1);for(var g=e.getTile(r).tileSize,y=l/(Math.pow(2,t.transform.zoom-r.z)*g),b=[[-1,-1],[-1,1],[1,-1],[1,1]],x=0;x<b.length;x++){var _=b[x];n.uniformMatrix4fv(h.u_matrix,!1,s.translate([],i,[y*_[0],y*_[1],0])),n.drawArrays(n.LINES,0,v.length)}n.uniform4f(h.u_color,0,0,0,1),n.uniformMatrix4fv(h.u_matrix,!1,i),n.drawArrays(n.LINES,0,v.length)}var o=t("../lib/debugtext"),a=t("../util/browser"),s=t("gl-matrix").mat4,l=t("../data/bucket").EXTENT,u=t("../data/buffer"),c=t("./vertex_array_object");e.exports=n},{"../data/bucket":247,"../data/buffer":252,"../lib/debugtext":259,"../util/browser":335,"./vertex_array_object":273,"gl-matrix":363}],265:[function(t,e,r){"use strict";function n(t,e,r,n){var a=t.gl;a.enable(a.STENCIL_TEST);var l=s.premultiply(r.paint["fill-color"]),u=r.paint["fill-pattern"],c=s.premultiply(r.paint["fill-outline-color"]),h=r.paint["fill-opacity"];if(u?!t.isOpaquePass:t.isOpaquePass===(1===l[3]&&1===h))for(var f=0;f<n.length;f++)i(t,e,r,n[f]);if(!t.isOpaquePass&&r.paint["fill-antialias"])if(c||!r.paint["fill-pattern"]){var d=t.useProgram("outline");t.lineWidth(2),t.depthMask(!1),c?t.setDepthSublayer(2):t.setDepthSublayer(0),a.uniform2f(d.u_world,a.drawingBufferWidth,a.drawingBufferHeight),a.uniform4fv(d.u_color,c?c:l),a.uniform1f(d.u_opacity,h);for(var p=0;p<n.length;p++)o(t,e,r,n[p])}else{var v=t.useProgram("outlinepattern");t.lineWidth(2),t.depthMask(!1),t.setDepthSublayer(0),a.uniform2f(v.u_world,a.drawingBufferWidth,a.drawingBufferHeight);for(var m=0;m<n.length;m++)o(t,e,r,n[m])}}function i(t,e,r,n){var i=e.getTile(n),o=i.getBucket(r);if(o){var l=o.bufferGroups.fill;if(l){var u=t.gl,c=s.premultiply(r.paint["fill-color"]),h=r.paint["fill-pattern"],f=r.paint["fill-opacity"],d=n.posMatrix,p=t.translatePosMatrix(d,i,r.paint["fill-translate"],r.paint["fill-translate-anchor"]);t.setDepthSublayer(1),u.stencilMask(7),u.clear(u.STENCIL_BUFFER_BIT),t.enableTileClippingMask(n),u.stencilOpSeparate(u.FRONT,u.KEEP,u.KEEP,u.INCR_WRAP),u.stencilOpSeparate(u.BACK,u.KEEP,u.KEEP,u.DECR_WRAP),u.colorMask(!1,!1,!1,!1),t.depthMask(!1);var v=t.useProgram("fill");u.uniformMatrix4fv(v.u_matrix,!1,p);for(var m=0;m<l.length;m++){var g=l[m];g.vaos[r.id].bind(u,v,g.layout.vertex,g.layout.element),u.drawElements(u.TRIANGLES,3*g.layout.element.length,u.UNSIGNED_SHORT,0)}u.colorMask(!0,!0,!0,!0),t.depthMask(!0),u.stencilOp(u.KEEP,u.KEEP,u.KEEP),u.stencilMask(0);var y;h?(y=t.useProgram("pattern"),a(h,f,i,n,t,y),u.activeTexture(u.TEXTURE0),t.spriteAtlas.bind(u,!0),t.tileExtentPatternVAO.bind(u,y,t.tileExtentBuffer)):(y=t.useProgram("fill"),u.uniform4fv(v.u_color,c),u.uniform1f(v.u_opacity,f),t.tileExtentVAO.bind(u,y,t.tileExtentBuffer)),u.uniformMatrix4fv(y.u_matrix,!1,d),u.stencilFunc(u.NOTEQUAL,0,7),u.drawArrays(u.TRIANGLE_STRIP,0,t.tileExtentBuffer.length),u.stencilMask(0)}}}function o(t,e,r,n){var i=e.getTile(n),o=i.getBucket(r);if(o){var s=t.gl,l=o.bufferGroups.fill,u=r.paint["fill-pattern"],c=r.paint["fill-opacity"],h=u?t.useProgram("outlinepattern"):t.useProgram("outline");s.uniformMatrix4fv(h.u_matrix,!1,t.translatePosMatrix(n.posMatrix,i,r.paint["fill-translate"],r.paint["fill-translate-anchor"])),u&&a(u,c,i,n,t,h),t.enableTileClippingMask(n);for(var f=0;f<l.length;f++){var d=l[f];d.secondVaos[r.id].bind(s,h,d.layout.vertex,d.layout.element2),s.drawElements(s.LINES,2*d.layout.element2.length,s.UNSIGNED_SHORT,0)}}}function a(t,e,r,n,i,o){var a=i.gl,s=i.spriteAtlas.getPosition(t.from,!0),u=i.spriteAtlas.getPosition(t.to,!0);if(s&&u){a.uniform1i(o.u_image,0),a.uniform2fv(o.u_pattern_tl_a,s.tl),a.uniform2fv(o.u_pattern_br_a,s.br),a.uniform2fv(o.u_pattern_tl_b,u.tl),a.uniform2fv(o.u_pattern_br_b,u.br),a.uniform1f(o.u_opacity,e),a.uniform1f(o.u_mix,t.t);var c=[s.size[0]*t.fromScale,s.size[1]*t.fromScale],h=[u.size[0]*t.toScale,u.size[1]*t.toScale];a.uniform2fv(o.u_patternscale_a,[1/l(r,c[0],i.transform.tileZoom),1/l(r,c[1],i.transform.tileZoom)]),a.uniform2fv(o.u_patternscale_b,[1/l(r,h[0],i.transform.tileZoom),1/l(r,h[1],i.transform.tileZoom)]);var f=r.tileSize*Math.pow(2,i.transform.tileZoom-r.coord.z),d=f/c[0]%1*(r.coord.x+n.w*Math.pow(2,r.coord.z)),p=f/c[1]%1*r.coord.y,v=f/h[0]%1*(r.coord.x+n.w*Math.pow(2,r.coord.z)),m=f/h[1]%1*r.coord.y;a.uniform2fv(o.u_offset_a,[d,p]),a.uniform2fv(o.u_offset_b,[v,m]),a.activeTexture(a.TEXTURE0),i.spriteAtlas.bind(a,!0)}}var s=t("../util/util"),l=t("../source/pixels_to_tile_units");e.exports=n},{ "../source/pixels_to_tile_units":277,"../util/util":349}],266:[function(t,e,r){"use strict";var n=t("../util/browser"),i=t("gl-matrix").mat2,o=t("../util/util"),a=t("../source/pixels_to_tile_units");e.exports=function(t,e,r,s){if(!t.isOpaquePass){t.setDepthSublayer(0),t.depthMask(!1);var l=t.gl;if(l.enable(l.STENCIL_TEST),!(r.paint["line-width"]<=0)){var u=1/n.devicePixelRatio,c=r.paint["line-blur"]+u,h=r.paint["line-width"]/2,f=-1,d=0,p=0;r.paint["line-gap-width"]>0&&(f=r.paint["line-gap-width"]/2+.5*u,h=r.paint["line-width"],d=f-u/2);var v=d+h+u/2+p,m=o.premultiply(r.paint["line-color"]),g=t.transform,y=i.create();i.scale(y,y,[1,Math.cos(g._pitch)]),i.rotate(y,y,t.transform.angle);var b,x,_,w,M,k=Math.sqrt(g.height*g.height/4*(1+g.altitude*g.altitude)),A=g.height/2*Math.tan(g._pitch),T=(k+A)/k-1,E=r.paint["line-dasharray"],S=r.paint["line-pattern"];if(E)b=t.useProgram("linesdfpattern"),l.uniform2fv(b.u_linewidth,[v,f]),l.uniform1f(b.u_blur,c),l.uniform4fv(b.u_color,m),l.uniform1f(b.u_opacity,r.paint["line-opacity"]),x=t.lineAtlas.getDash(E.from,"round"===r.layout["line-cap"]),_=t.lineAtlas.getDash(E.to,"round"===r.layout["line-cap"]),l.uniform1i(b.u_image,0),l.activeTexture(l.TEXTURE0),t.lineAtlas.bind(l),l.uniform1f(b.u_tex_y_a,x.y),l.uniform1f(b.u_tex_y_b,_.y),l.uniform1f(b.u_mix,E.t),l.uniform1f(b.u_extra,T),l.uniform1f(b.u_offset,-r.paint["line-offset"]),l.uniformMatrix2fv(b.u_antialiasingmatrix,!1,y);else if(S){if(w=t.spriteAtlas.getPosition(S.from,!0),M=t.spriteAtlas.getPosition(S.to,!0),!w||!M)return;b=t.useProgram("linepattern"),l.uniform1i(b.u_image,0),l.activeTexture(l.TEXTURE0),t.spriteAtlas.bind(l,!0),l.uniform2fv(b.u_linewidth,[v,f]),l.uniform1f(b.u_blur,c),l.uniform2fv(b.u_pattern_tl_a,w.tl),l.uniform2fv(b.u_pattern_br_a,w.br),l.uniform2fv(b.u_pattern_tl_b,M.tl),l.uniform2fv(b.u_pattern_br_b,M.br),l.uniform1f(b.u_fade,S.t),l.uniform1f(b.u_opacity,r.paint["line-opacity"]),l.uniform1f(b.u_extra,T),l.uniform1f(b.u_offset,-r.paint["line-offset"]),l.uniformMatrix2fv(b.u_antialiasingmatrix,!1,y)}else b=t.useProgram("line"),l.uniform2fv(b.u_linewidth,[v,f]),l.uniform1f(b.u_blur,c),l.uniform1f(b.u_extra,T),l.uniform1f(b.u_offset,-r.paint["line-offset"]),l.uniformMatrix2fv(b.u_antialiasingmatrix,!1,y),l.uniform4fv(b.u_color,m),l.uniform1f(b.u_opacity,r.paint["line-opacity"]);for(var L=0;L<s.length;L++){var z=s[L],I=e.getTile(z),P=I.getBucket(r);if(P){var C=P.bufferGroups.line;if(C){t.enableTileClippingMask(z);var R=t.translatePosMatrix(z.posMatrix,I,r.paint["line-translate"],r.paint["line-translate-anchor"]);l.uniformMatrix4fv(b.u_matrix,!1,R);var D=1/a(I,1,t.transform.zoom);if(E){var O=x.width*E.fromScale,F=_.width*E.toScale,j=[1/a(I,O,t.transform.tileZoom),-x.height/2],N=[1/a(I,F,t.transform.tileZoom),-_.height/2],B=t.lineAtlas.width/(256*Math.min(O,F)*n.devicePixelRatio)/2;l.uniform1f(b.u_ratio,D),l.uniform2fv(b.u_patternscale_a,j),l.uniform2fv(b.u_patternscale_b,N),l.uniform1f(b.u_sdfgamma,B)}else S?(l.uniform1f(b.u_ratio,D),l.uniform2fv(b.u_pattern_size_a,[a(I,w.size[0]*S.fromScale,t.transform.tileZoom),M.size[1]]),l.uniform2fv(b.u_pattern_size_b,[a(I,M.size[0]*S.toScale,t.transform.tileZoom),M.size[1]])):l.uniform1f(b.u_ratio,D);for(var U=0;U<C.length;U++){var V=C[U];V.vaos[r.id].bind(l,b,V.layout.vertex,V.layout.element),l.drawElements(l.TRIANGLES,3*V.layout.element.length,l.UNSIGNED_SHORT,0)}}}}}}}},{"../source/pixels_to_tile_units":277,"../util/browser":335,"../util/util":349,"gl-matrix":363}],267:[function(t,e,r){"use strict";function n(t,e,r,n){if(!t.isOpaquePass){var o=t.gl;o.enable(o.DEPTH_TEST),t.depthMask(!0),o.depthFunc(o.LESS);for(var a=n.length&&n[0].z,s=0;s<n.length;s++){var l=n[s];t.setDepthSublayer(l.z-a),i(t,e,r,l)}o.depthFunc(o.LEQUAL)}}function i(t,e,r,n){var i=t.gl;i.disable(i.STENCIL_TEST);var u=e.getTile(n),c=t.transform.calculatePosMatrix(n,e.maxzoom),h=t.useProgram("raster");i.uniformMatrix4fv(h.u_matrix,!1,c),i.uniform1f(h.u_brightness_low,r.paint["raster-brightness-min"]),i.uniform1f(h.u_brightness_high,r.paint["raster-brightness-max"]),i.uniform1f(h.u_saturation_factor,s(r.paint["raster-saturation"])),i.uniform1f(h.u_contrast_factor,a(r.paint["raster-contrast"])),i.uniform3fv(h.u_spin_weights,o(r.paint["raster-hue-rotate"]));var f,d,p=u.source&&u.source._pyramid.findLoadedParent(n,0,{}),v=l(u,p,r,t.transform);i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,u.texture),p?(i.activeTexture(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,p.texture),f=Math.pow(2,p.coord.z-u.coord.z),d=[u.coord.x*f%1,u.coord.y*f%1]):v[1]=0,i.uniform2fv(h.u_tl_parent,d||[0,0]),i.uniform1f(h.u_scale_parent,f||1),i.uniform1f(h.u_buffer_scale,1),i.uniform1f(h.u_opacity0,v[0]),i.uniform1f(h.u_opacity1,v[1]),i.uniform1i(h.u_image0,0),i.uniform1i(h.u_image1,1);var m=u.boundsBuffer||t.rasterBoundsBuffer,g=u.boundsVAO||t.rasterBoundsVAO;g.bind(i,h,m),i.drawArrays(i.TRIANGLE_STRIP,0,m.length)}function o(t){t*=Math.PI/180;var e=Math.sin(t),r=Math.cos(t);return[(2*r+1)/3,(-Math.sqrt(3)*e-r+1)/3,(Math.sqrt(3)*e-r+1)/3]}function a(t){return t>0?1/(1-t):1+t}function s(t){return t>0?1-1/(1.001-t):-t}function l(t,e,r,n){var i=[1,0],o=r.paint["raster-fade-duration"];if(t.source&&o>0){var a=(new Date).getTime(),s=(a-t.timeAdded)/o,l=e?(a-e.timeAdded)/o:-1,c=t.source._pyramid.coveringZoomLevel(n),h=e?Math.abs(e.coord.z-c)>Math.abs(t.coord.z-c):!1;!e||h?(i[0]=u.clamp(s,0,1),i[1]=1-i[0]):(i[0]=u.clamp(1-l,0,1),i[1]=1-i[0])}var f=r.paint["raster-opacity"];return i[0]*=f,i[1]*=f,i}var u=t("../util/util"),c=t("../util/struct_array");e.exports=n,n.RasterBoundsArray=new c({members:[{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]})},{"../util/struct_array":347,"../util/util":349}],268:[function(t,e,r){"use strict";function n(t,e,r,n){if(!t.isOpaquePass){var o=!(r.layout["text-allow-overlap"]||r.layout["icon-allow-overlap"]||r.layout["text-ignore-placement"]||r.layout["icon-ignore-placement"]),a=t.gl;o?a.disable(a.STENCIL_TEST):a.enable(a.STENCIL_TEST),t.setDepthSublayer(0),t.depthMask(!1),a.disable(a.DEPTH_TEST),i(t,e,r,n,!1,r.paint["icon-translate"],r.paint["icon-translate-anchor"],r.layout["icon-rotation-alignment"],r.layout["icon-size"],r.paint["icon-halo-width"],r.paint["icon-halo-color"],r.paint["icon-halo-blur"],r.paint["icon-opacity"],r.paint["icon-color"]),i(t,e,r,n,!0,r.paint["text-translate"],r.paint["text-translate-anchor"],r.layout["text-rotation-alignment"],r.layout["text-size"],r.paint["text-halo-width"],r.paint["text-halo-color"],r.paint["text-halo-blur"],r.paint["text-opacity"],r.paint["text-color"]),a.enable(a.DEPTH_TEST),s(t,e,r,n)}}function i(t,e,r,n,i,a,s,u,c,h,f,d,p,v){f=l.premultiply(f),v=l.premultiply(v);for(var m=0;m<n.length;m++){var g=e.getTile(n[m]),y=g.getBucket(r);if(y){var b=y.bufferGroups,x=i?b.glyph:b.icon;x.length&&(t.enableTileClippingMask(n[m]),o(t,r,n[m].posMatrix,g,y,x,i,i||y.sdfIcons,!i&&y.iconsNeedLinear,i?y.adjustedTextSize:y.adjustedIconSize,y.fontstack,a,s,u,c,h,f,d,p,v))}}}function o(t,e,r,n,i,o,s,l,c,h,f,d,p,v,m,g,y,b,x,_){var w,M,k,A=t.gl,T=t.transform,E="map"===v,S=s?24:1,L=m/S;E?(M=u(n,1,t.transform.zoom)*L,k=1/Math.cos(T._pitch),w=[M,M]):(M=t.transform.altitude*L,k=1,w=[T.pixelsToGLUnits[0]*M,T.pixelsToGLUnits[1]*M]);var z=Math.sqrt(T.height*T.height/4*(1+T.altitude*T.altitude)),I=T.height/2*Math.tan(T._pitch),P=(z+I)/z-1;if(s||t.style.sprite.loaded()){var C=t.useProgram(l?"sdf":"icon");if(A.uniformMatrix4fv(C.u_matrix,!1,t.translatePosMatrix(r,n,d,p)),A.uniform1i(C.u_skewed,E),A.uniform1f(C.u_extra,P),A.uniform2fv(C.u_extrude_scale,w),A.activeTexture(A.TEXTURE0),A.uniform1i(C.u_texture,0),s){var R=f&&t.glyphSource.getGlyphAtlas(f);if(!R)return;R.updateTexture(A),A.uniform2f(C.u_texsize,R.width/4,R.height/4)}else{var D=t.options.rotating||t.options.zooming,O=1!==L||a.devicePixelRatio!==t.spriteAtlas.pixelRatio||c,F=E||t.transform.pitch;t.spriteAtlas.bind(A,l||D||O||F),A.uniform2f(C.u_texsize,t.spriteAtlas.width/4,t.spriteAtlas.height/4)}var j=Math.log(m/h)/Math.LN2||0;A.uniform1f(C.u_zoom,10*(t.transform.zoom-j)),A.activeTexture(A.TEXTURE1),t.frameHistory.bind(A),A.uniform1i(C.u_fadetexture,1);var N;if(l){var B=8,U=1.19,V=6,q=.105*S/m/a.devicePixelRatio;if(g){A.uniform1f(C.u_gamma,(b*U/L/B+q)*k),A.uniform4fv(C.u_color,y),A.uniform1f(C.u_opacity,x),A.uniform1f(C.u_buffer,(V-g/L)/B);for(var G=0;G<o.length;G++)N=o[G],N.vaos[e.id].bind(A,C,N.layout.vertex,N.layout.element),A.drawElements(A.TRIANGLES,3*N.layout.element.length,A.UNSIGNED_SHORT,0)}A.uniform1f(C.u_gamma,q*k),A.uniform4fv(C.u_color,_),A.uniform1f(C.u_opacity,x),A.uniform1f(C.u_buffer,.75);for(var H=0;H<o.length;H++)N=o[H],N.vaos[e.id].bind(A,C,N.layout.vertex,N.layout.element),A.drawElements(A.TRIANGLES,3*N.layout.element.length,A.UNSIGNED_SHORT,0)}else{A.uniform1f(C.u_opacity,x);for(var X=0;X<o.length;X++)N=o[X],N.vaos[e.id].bind(A,C,N.layout.vertex,N.layout.element),A.drawElements(A.TRIANGLES,3*N.layout.element.length,A.UNSIGNED_SHORT,0)}}}var a=t("../util/browser"),s=t("./draw_collision_debug"),l=t("../util/util"),u=t("../source/pixels_to_tile_units");e.exports=n},{"../source/pixels_to_tile_units":277,"../util/browser":335,"../util/util":349,"./draw_collision_debug":263}],269:[function(t,e,r){"use strict";function n(){this.changeTimes=new Float64Array(256),this.changeOpacities=new Uint8Array(256),this.opacities=new Uint8ClampedArray(256),this.array=new Uint8Array(this.opacities.buffer),this.fadeDuration=300,this.previousZoom=0,this.firstFrame=!0}e.exports=n,n.prototype.record=function(t){var e=Date.now();this.firstFrame&&(e=0,this.firstFrame=!1),t=Math.floor(10*t);var r;if(t<this.previousZoom)for(r=t+1;r<=this.previousZoom;r++)this.changeTimes[r]=e,this.changeOpacities[r]=this.opacities[r];else for(r=t;r>this.previousZoom;r--)this.changeTimes[r]=e,this.changeOpacities[r]=this.opacities[r];for(r=0;256>r;r++){var n=e-this.changeTimes[r],i=n/this.fadeDuration*255;t>=r?this.opacities[r]=this.changeOpacities[r]+i:this.opacities[r]=this.changeOpacities[r]-i}this.changed=!0,this.previousZoom=t},n.prototype.bind=function(t){this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.changed&&(t.texSubImage2D(t.TEXTURE_2D,0,0,0,256,1,t.ALPHA,t.UNSIGNED_BYTE,this.array),this.changed=!1)):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,256,1,0,t.ALPHA,t.UNSIGNED_BYTE,this.array))}},{}],270:[function(t,e,r){"use strict";function n(t,e){this.width=t,this.height=e,this.nextRow=0,this.bytes=4,this.data=new Uint8Array(this.width*this.height*this.bytes),this.positions={}}e.exports=n,n.prototype.setSprite=function(t){this.sprite=t},n.prototype.getDash=function(t,e){var r=t.join(",")+e;return this.positions[r]||(this.positions[r]=this.addDash(t,e)),this.positions[r]},n.prototype.addDash=function(t,e){var r=e?7:0,n=2*r+1,i=128;if(this.nextRow+n>this.height)return console.warn("LineAtlas out of space"),null;for(var o=0,a=0;a<t.length;a++)o+=t[a];for(var s=this.width/o,l=s/2,u=t.length%2===1,c=-r;r>=c;c++)for(var h=this.nextRow+r+c,f=this.width*h,d=u?-t[t.length-1]:0,p=t[0],v=1,m=0;m<this.width;m++){for(;m/s>p;)d=p,p+=t[v],u&&v===t.length-1&&(p+=t[0]),v++;var g,y=Math.abs(m-d*s),b=Math.abs(m-p*s),x=Math.min(y,b),_=v%2===1;if(e){var w=r?c/r*(l+1):0;if(_){var M=l-Math.abs(w);g=Math.sqrt(x*x+M*M)}else g=l-Math.sqrt(x*x+w*w)}else g=(_?1:-1)*x;this.data[3+4*(f+m)]=Math.max(0,Math.min(255,g+i))}var k={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:o};return this.nextRow+=n,this.dirty=!0,k},n.prototype.bind=function(t){this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.RGBA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,this.data))}},{}],271:[function(t,e,r){"use strict";function n(t,e){this.gl=t,this.transform=e,this.reusableTextures={},this.preFbos={},this.frameHistory=new a,this.setup(),this.numSublayers=s.maxUnderzooming+s.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.lineWidthRange=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE)}var i=t("../util/browser"),o=t("gl-matrix").mat4,a=t("./frame_history"),s=t("../source/tile_pyramid"),l=t("../data/bucket").EXTENT,u=t("../source/pixels_to_tile_units"),c=t("../util/util"),h=t("../util/struct_array"),f=t("../data/buffer"),d=t("./vertex_array_object"),p=t("./draw_raster").RasterBoundsArray;e.exports=n,c.extend(n.prototype,t("./painter/use_program")),n.prototype.resize=function(t,e){var r=this.gl;this.width=t*i.devicePixelRatio,this.height=e*i.devicePixelRatio,r.viewport(0,0,this.width,this.height)},n.prototype.setup=function(){var t=this.gl;t.verbose=!0,t.enable(t.BLEND),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),t.enable(t.STENCIL_TEST),t.enable(t.DEPTH_TEST),t.depthFunc(t.LEQUAL),this._depthMask=!1,t.depthMask(!1);var e=this.PosArray=new h({members:[{name:"a_pos",type:"Int16",components:2}]}),r=new e;r.emplaceBack(0,0),r.emplaceBack(l,0),r.emplaceBack(0,l),r.emplaceBack(l,l),this.tileExtentBuffer=new f(r.serialize(),e.serialize(),f.BufferType.VERTEX),this.tileExtentVAO=new d,this.tileExtentPatternVAO=new d;var n=new e;n.emplaceBack(0,0),n.emplaceBack(l,0),n.emplaceBack(l,l),n.emplaceBack(0,l),n.emplaceBack(0,0),this.debugBuffer=new f(n.serialize(),e.serialize(),f.BufferType.VERTEX),this.debugVAO=new d;var i=new p;i.emplaceBack(0,0,0,0),i.emplaceBack(l,0,32767,0),i.emplaceBack(0,l,0,32767),i.emplaceBack(l,l,32767,32767),this.rasterBoundsBuffer=new f(i.serialize(),p.serialize(),f.BufferType.VERTEX),this.rasterBoundsVAO=new d},n.prototype.clearColor=function(){var t=this.gl;t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)},n.prototype.clearStencil=function(){var t=this.gl;t.clearStencil(0),t.stencilMask(255),t.clear(t.STENCIL_BUFFER_BIT)},n.prototype.clearDepth=function(){var t=this.gl;t.clearDepth(1),this.depthMask(!0),t.clear(t.DEPTH_BUFFER_BIT)},n.prototype._renderTileClippingMasks=function(t){var e=this.gl;e.colorMask(!1,!1,!1,!1),this.depthMask(!1),e.disable(e.DEPTH_TEST),e.enable(e.STENCIL_TEST),e.stencilMask(248),e.stencilOp(e.KEEP,e.KEEP,e.REPLACE);var r=1;this._tileClippingMaskIDs={};for(var n=0;n<t.length;n++){var i=t[n],o=this._tileClippingMaskIDs[i.id]=r++<<3;e.stencilFunc(e.ALWAYS,o,248);var a=this.useProgram("fill");e.uniformMatrix4fv(a.u_matrix,!1,i.posMatrix),this.tileExtentVAO.bind(e,a,this.tileExtentBuffer),e.drawArrays(e.TRIANGLE_STRIP,0,this.tileExtentBuffer.length)}e.stencilMask(0),e.colorMask(!0,!0,!0,!0),this.depthMask(!0),e.enable(e.DEPTH_TEST)},n.prototype.enableTileClippingMask=function(t){var e=this.gl;e.stencilFunc(e.EQUAL,this._tileClippingMaskIDs[t.id],248)},n.prototype.prepareBuffers=function(){},n.prototype.bindDefaultFramebuffer=function(){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,null)};var v={symbol:t("./draw_symbol"),circle:t("./draw_circle"),line:t("./draw_line"),fill:t("./draw_fill"),raster:t("./draw_raster"),background:t("./draw_background"),debug:t("./draw_debug")};n.prototype.render=function(t,e){this.style=t,this.options=e,this.lineAtlas=t.lineAtlas,this.spriteAtlas=t.spriteAtlas,this.spriteAtlas.setSprite(t.sprite),this.glyphSource=t.glyphSource,this.frameHistory.record(this.transform.zoom),this.prepareBuffers(),this.clearColor(),this.clearDepth(),this.showOverdrawInspector(e.showOverdrawInspector),this.depthRange=(t._order.length+2)*this.numSublayers*this.depthEpsilon,this.renderPass({isOpaquePass:!0}),this.renderPass({isOpaquePass:!1})},n.prototype.renderPass=function(t){var e=this.style._groups,r=t.isOpaquePass;this.currentLayer=r?this.style._order.length:-1;for(var n=0;n<e.length;n++){var i,o=e[r?e.length-1-n:n],a=this.style.sources[o.source],s=[];if(a){for(s=a.getVisibleCoordinates(),i=0;i<s.length;i++)s[i].posMatrix=this.transform.calculatePosMatrix(s[i],a.maxzoom);this.clearStencil(),a.prepare&&a.prepare(),a.isTileClipped&&this._renderTileClippingMasks(s)}for(r?(this._showOverdrawInspector||this.gl.disable(this.gl.BLEND),this.isOpaquePass=!0):(this.gl.enable(this.gl.BLEND),this.isOpaquePass=!1,s.reverse()),i=0;i<o.length;i++){var l=o[r?o.length-1-i:i];this.currentLayer+=r?-1:1,this.renderLayer(this,a,l,s)}a&&v.debug(this,a,s)}},n.prototype.depthMask=function(t){t!==this._depthMask&&(this._depthMask=t,this.gl.depthMask(t))},n.prototype.renderLayer=function(t,e,r,n){r.isHidden(this.transform.zoom)||("background"===r.type||n.length)&&(this.id=r.id,v[r.type](t,e,r,n))},n.prototype.setDepthSublayer=function(t){var e=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon,r=e-1+this.depthRange;this.gl.depthRange(r,e)},n.prototype.translatePosMatrix=function(t,e,r,n){if(!r[0]&&!r[1])return t;if("viewport"===n){var i=Math.sin(-this.transform.angle),a=Math.cos(-this.transform.angle);r=[r[0]*a-r[1]*i,r[0]*i+r[1]*a]}var s=[u(e,r[0],this.transform.zoom),u(e,r[1],this.transform.zoom),0],l=new Float32Array(16);return o.translate(l,t,s),l},n.prototype.saveTexture=function(t){var e=this.reusableTextures[t.size];e?e.push(t):this.reusableTextures[t.size]=[t]},n.prototype.getTexture=function(t){var e=this.reusableTextures[t];return e&&e.length>0?e.pop():null},n.prototype.lineWidth=function(t){this.gl.lineWidth(c.clamp(t,this.lineWidthRange[0],this.lineWidthRange[1]))},n.prototype.showOverdrawInspector=function(t){if(t||this._showOverdrawInspector){this._showOverdrawInspector=t;var e=this.gl;if(t){e.blendFunc(e.CONSTANT_COLOR,e.ONE);var r=8,n=1/r;e.blendColor(n,n,n,0),e.clearColor(0,0,0,1),e.clear(e.COLOR_BUFFER_BIT)}else e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}}},{"../data/bucket":247,"../data/buffer":252,"../source/pixels_to_tile_units":277,"../source/tile_pyramid":282,"../util/browser":335,"../util/struct_array":347,"../util/util":349,"./draw_background":261,"./draw_circle":262,"./draw_debug":264,"./draw_fill":265,"./draw_line":266,"./draw_raster":267,"./draw_symbol":268,"./frame_history":269,"./painter/use_program":272,"./vertex_array_object":273,"gl-matrix":363}],272:[function(t,e,r){"use strict";var n=(t("path"),t("assert")),i=t("../../util/util"),o={debug:{fragmentSource:"precision mediump float;\n\nuniform lowp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, step(32767.0, a_pos.x), 1);\n}\n"},fill:{fragmentSource:"precision mediump float;\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nvoid main() {\n gl_FragColor = u_color * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},circle:{fragmentSource:"precision mediump float;\n\nuniform lowp float u_blur;\nuniform lowp float u_opacity;\n\nvarying lowp vec4 v_color;\nvarying vec2 v_extrude;\nvarying lowp float v_antialiasblur;\n\nvoid main() {\n float t = smoothstep(1.0 - max(u_blur, v_antialiasblur), 1.0, length(v_extrude));\n gl_FragColor = v_color * (1.0 - t) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nuniform mat4 u_matrix;\nuniform vec2 u_extrude_scale;\nuniform float u_devicepixelratio;\n\nattribute vec2 a_pos;\n\n#ifdef ATTRIBUTE_A_COLOR\nattribute lowp vec4 a_color;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_COLOR0\nuniform lowp float u_color_t;\nattribute lowp vec4 a_color0;\nattribute lowp vec4 a_color1;\nattribute lowp vec4 a_color2;\nattribute lowp vec4 a_color3;\n#else\nuniform lowp vec4 a_color;\n#endif\n\n#ifdef ATTRIBUTE_A_RADIUS\nattribute mediump float a_radius;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_RADIUS\nuniform lowp float u_radius_t;\nattribute mediump vec4 a_radius;\n#else\nuniform mediump float a_radius;\n#endif\n\nvarying vec2 v_extrude;\nvarying lowp vec4 v_color;\nvarying lowp float v_antialiasblur;\n\nfloat evaluate_zoom_function_1(const vec4 values, const float t) {\n if (t < 1.0) {\n return mix(values[0], values[1], t);\n } else if (t < 2.0) {\n return mix(values[1], values[2], t - 1.0);\n } else {\n return mix(values[2], values[3], t - 2.0);\n }\n}\n\nvec4 evaluate_zoom_function_4(const vec4 value0, const vec4 value1, const vec4 value2, const vec4 value3, const float t) {\n if (t < 1.0) {\n return mix(value0, value1, t);\n } else if (t < 2.0) {\n return mix(value1, value2, t - 1.0);\n } else {\n return mix(value2, value3, t - 2.0);\n }\n}\n\nvoid main(void) {\n\n#ifdef ATTRIBUTE_A_RADIUS\n mediump float radius = a_radius / 10.0;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_RADIUS\n mediump float radius = evaluate_zoom_function_1(a_radius, u_radius_t) / 10.0;\n#else\n mediump float radius = a_radius;\n#endif\n\n // unencode the extrusion vector that we snuck into the a_pos vector\n v_extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0);\n\n vec2 extrude = v_extrude * radius * u_extrude_scale;\n // multiply a_pos by 0.5, since we had it * 2 in order to sneak\n // in extrusion data\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0, 1);\n\n // gl_Position is divided by gl_Position.w after this shader runs.\n // Multiply the extrude by it so that it isn't affected by it.\n gl_Position.xy += extrude * gl_Position.w;\n\n#ifdef ATTRIBUTE_A_COLOR\n v_color = a_color / 255.0;\n#elif defined ATTRIBUTE_ZOOM_FUNCTION_A_COLOR0\n v_color = evaluate_zoom_function_4(a_color0, a_color1, a_color2, a_color3, u_color_t) / 255.0;\n#else\n v_color = a_color;\n#endif\n\n // This is a minimum blur distance that serves as a faux-antialiasing for\n // the circle. since blur is a ratio of the circle's size and the intent is\n // to keep the blur at roughly 1px, the two are inversely related.\n v_antialiasblur = 1.0 / u_devicepixelratio / radius;\n}\n"},line:{fragmentSource:"precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform float u_blur;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_ratio;\nuniform mediump vec2 u_linewidth;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec4 dist = vec4(u_linewidth.s * a_extrude * scale, 0.0, 0.0);\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linepattern:{fragmentSource:"precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform float u_point;\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * u_linewidth.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * u_linewidth.s / u_pattern_size_b.y);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos), texture2D(u_image, pos2), u_fade);\n\n alpha *= u_opacity;\n\n gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump vec2 u_linewidth;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 extrude = a_extrude * scale;\n mediump vec2 dist = u_linewidth.s * extrude;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n v_linesofar = a_linesofar;\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linesdfpattern:{fragmentSource:"precision mediump float;\n\nuniform vec2 u_linewidth;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * u_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump vec2 u_linewidth;\nuniform mediump float u_ratio;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec4 dist = vec4(u_linewidth.s * a_extrude * scale, 0.0, 0.0);\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist.xy) / u_ratio, 0.0, 1.0);\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_gamma_scale = perspective_scale * squish_scale;\n}\n" },outline:{fragmentSource:"precision mediump float;\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nvarying vec2 v_pos;\n\nvoid main() {\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy/gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},outlinepattern:{fragmentSource:"precision mediump float;\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n \n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nuniform vec2 u_patternscale_a;\nuniform vec2 u_patternscale_b;\nuniform vec2 u_offset_a;\nuniform vec2 u_offset_b;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos_a = u_patternscale_a * a_pos + u_offset_a;\n v_pos_b = u_patternscale_b * a_pos + u_offset_b;\n v_pos = (gl_Position.xy/gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},pattern:{fragmentSource:"precision mediump float;\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nuniform mat4 u_matrix;\nuniform vec2 u_patternscale_a;\nuniform vec2 u_patternscale_b;\nuniform vec2 u_offset_a;\nuniform vec2 u_offset_b;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos_a = u_patternscale_a * a_pos + u_offset_a;\n v_pos_b = u_patternscale_b * a_pos + u_offset_b;\n}\n"},raster:{fragmentSource:"precision mediump float;\n\nuniform float u_opacity0;\nuniform float u_opacity1;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n // read and cross-fade colors from the main and parent tiles\n vec4 color0 = texture2D(u_image0, v_pos0);\n vec4 color1 = texture2D(u_image1, v_pos1);\n vec4 color = color0 * u_opacity0 + color1 * u_opacity1;\n vec3 rgb = color.rgb;\n\n // spin\n rgb = vec3(\n dot(rgb, u_spin_weights.xyz),\n dot(rgb, u_spin_weights.zxy),\n dot(rgb, u_spin_weights.yzx));\n\n // saturation\n float average = (color.r + color.g + color.b) / 3.0;\n rgb += (average - rgb) * u_saturation_factor;\n\n // contrast\n rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n // brightness\n vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb), color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nuniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},icon:{fragmentSource:"precision mediump float;\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp float u_opacity;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_opacity;\n gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\n\n\n// matrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_skewed;\nuniform float u_extra;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n vec2 a_tex = a_data1.xy;\n mediump float a_labelminzoom = a_data1[2];\n mediump vec2 a_zoom = a_data2.st;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_skewed) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},sdf:{fragmentSource:"precision mediump float;\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform lowp float u_buffer;\nuniform lowp float u_gamma;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n lowp float dist = texture2D(u_texture, v_tex).a;\n lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n lowp float gamma = u_gamma * v_gamma_scale;\n lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec4 a_data1;\nattribute vec4 a_data2;\n\n\n// matrix is for the vertex position, exmatrix is for rotating and projecting\n// the extrusion vector.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_skewed;\nuniform float u_extra;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_tex = a_data1.xy;\n mediump float a_labelminzoom = a_data1[2];\n mediump vec2 a_zoom = a_data2.st;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_skewed) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - y * u_extra);\n v_gamma_scale = perspective_scale;\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},collisionbox:{fragmentSource:"precision mediump float;\n\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n\n float alpha = 0.5;\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0) * alpha;\n\n if (v_placement_zoom > u_zoom) {\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n }\n\n if (u_zoom >= v_max_zoom) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n }\n\n if (v_placement_zoom >= u_maxzoom) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;\n }\n}\n",vertexSource:"precision highp float;\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);\n\n v_max_zoom = a_data.x;\n v_placement_zoom = a_data.y;\n}\n"}};e.exports._createProgram=function(t,e){var r=this.gl,a=r.createProgram(),s=o[t],l="";if(e)for(var u=0;u<e.length;u++)l+="#define "+e[u]+"\n";var c=r.createShader(r.FRAGMENT_SHADER);r.shaderSource(c,l+s.fragmentSource),r.compileShader(c),n(r.getShaderParameter(c,r.COMPILE_STATUS),r.getShaderInfoLog(c)),r.attachShader(a,c);var h=r.createShader(r.VERTEX_SHADER);r.shaderSource(h,l+s.vertexSource),r.compileShader(h),n(r.getShaderParameter(h,r.COMPILE_STATUS),r.getShaderInfoLog(h)),r.attachShader(a,h),r.linkProgram(a),n(r.getProgramParameter(a,r.LINK_STATUS),r.getProgramInfoLog(a));for(var f={},d=r.getProgramParameter(a,r.ACTIVE_ATTRIBUTES),p=0;d>p;p++){var v=r.getActiveAttrib(a,p);f[v.name]=p}for(var m={},g=r.getProgramParameter(a,r.ACTIVE_UNIFORMS),y=0;g>y;y++){var b=r.getActiveUniform(a,y);m[b.name]=r.getUniformLocation(a,b.name)}return i.extend({program:a,definition:s,attributes:f,numAttributes:d},f,m)},e.exports._createProgramCached=function(t,e){this.cache=this.cache||{},this._showOverdrawInspector&&(e=e||[],e.push("OVERDRAW_INSPECTOR"));var r=JSON.stringify({name:t,macros:e});return this.cache[r]||(this.cache[r]=this._createProgram(t,e)),this.cache[r]},e.exports.useProgram=function(t,e){var r=this.gl,n=this._createProgramCached(t,e),i=this.currentProgram;return i!==n&&(r.useProgram(n.program),this.currentProgram=n),n}},{"../../util/util":349,assert:52,path:59}],273:[function(t,e,r){"use strict";function n(){this.boundProgram=null,this.boundVertexBuffer=null,this.boundVertexBuffer2=null,this.boundElementBuffer=null,this.vao=null}var i=t("assert");e.exports=n;var o=!1;n.prototype.bind=function(t,e,r,n,a){var s=t.extVertexArrayObject;if(void 0===s&&(s=t.extVertexArrayObject=t.getExtension("OES_vertex_array_object")),s?(this.vao||(this.vao=s.createVertexArrayOES()),s.bindVertexArrayOES(this.vao)):o||(console.warn("Not using VertexArrayObject extension."),o=!0),this.boundProgram)i(this.boundProgram===e,"trying to bind a VAO to a different shader"),i(this.boundVertexBuffer===r,"trying to bind a VAO to a different vertex buffer"),i(this.boundVertexBuffer2===a,"trying to bind a VAO to a different vertex buffer"),i(this.boundElementBuffer===n,"trying to bind a VAO to a different element buffer");else{var l,u=s?0:t.currentNumAttributes||0,c=e.numAttributes;for(l=u;c>l;l++)t.enableVertexAttribArray(l);if(!s){for(i(l>0),l=c;u>l;l++)t.disableVertexAttribArray(l);t.currentNumAttributes=c}r.bind(t),r.setVertexAttribPointers(t,e),a&&(a.bind(t),a.setVertexAttribPointers(t,e)),n&&n.bind(t),s&&(this.boundProgram=e,this.boundVertexBuffer=r,this.boundVertexBuffer2=a,this.boundElementBuffer=n)}},n.prototype.unbind=function(t){var e=t.extVertexArrayObject;e&&e.bindVertexArrayOES(null)},n.prototype.destroy=function(t){var e=t.extVertexArrayObject;e&&this.vao&&(e.deleteVertexArrayOES(this.vao),this.vao=null)}},{assert:52}],274:[function(t,e,r){"use strict";function n(t){t=t||{},this._data=t.data,void 0!==t.maxzoom&&(this.maxzoom=t.maxzoom);var e=u/this.tileSize;this.geojsonVtOptions={buffer:(void 0!==t.buffer?t.buffer:128)*e,tolerance:(void 0!==t.tolerance?t.tolerance:.375)*e,extent:u,maxZoom:this.maxzoom},this.cluster=t.cluster||!1,this.superclusterOptions={maxZoom:Math.min(t.clusterMaxZoom,this.maxzoom-1)||this.maxzoom-1,extent:u,radius:(t.clusterRadius||50)*e,log:!1},this._pyramid=new a({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!0,load:this._loadTile.bind(this),abort:this._abortTile.bind(this),unload:this._unloadTile.bind(this),add:this._addTile.bind(this),remove:this._removeTile.bind(this),redoPlacement:this._redoTilePlacement.bind(this)})}var i=t("../util/util"),o=t("../util/evented"),a=t("./tile_pyramid"),s=t("./source"),l=t("resolve-url"),u=t("../data/bucket").EXTENT;e.exports=n,n.prototype=i.inherit(o,{minzoom:0,maxzoom:18,tileSize:512,_dirty:!0,isTileClipped:!0,setData:function(t){return this._data=t,this._dirty=!0,this.fire("change"),this.map&&this.update(this.map.transform),this},onAdd:function(t){this.map=t},loaded:function(){return this._loaded&&this._pyramid.loaded()},update:function(t){this._dirty&&this._updateData(),this._loaded&&this._pyramid.update(this.used,t)},reload:function(){this._loaded&&this._pyramid.reload()},serialize:function(){return{type:"geojson",data:this._data}},getVisibleCoordinates:s._getVisibleCoordinates,getTile:s._getTile,queryRenderedFeatures:s._queryRenderedVectorFeatures,querySourceFeatures:s._querySourceFeatures,_updateData:function(){this._dirty=!1;var t={tileSize:this.tileSize,source:this.id,geojsonVtOptions:this.geojsonVtOptions,cluster:this.cluster,superclusterOptions:this.superclusterOptions},e=this._data;"string"==typeof e?t.url="undefined"!=typeof window?l(window.location.href,e):e:t.data=JSON.stringify(e),this.workerID=this.dispatcher.send("parse geojson",t,function(t){this._loaded=!0,t?this.fire("error",{error:t}):(this._pyramid.reload(),this.fire("change"))}.bind(this))},_loadTile:function(t){var e=t.coord.z>this.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,r={uid:t.uid,coord:t.coord,zoom:t.coord.z,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,overscaling:e,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID=this.dispatcher.send("load geojson tile",r,function(e,r){if(t.unloadVectorData(this.map.painter),!t.aborted){if(e)return void this.fire("tile.error",{tile:t});t.loadVectorData(r,this.map.style),t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(this)),this.fire("tile.load",{tile:t})}}.bind(this),this.workerID)},_abortTile:function(t){t.aborted=!0},_addTile:function(t){this.fire("tile.add",{tile:t})},_removeTile:function(t){this.fire("tile.remove",{tile:t})},_unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},null,t.workerID)},redoPlacement:s.redoPlacement,_redoTilePlacement:function(t){t.redoPlacement(this)}})},{"../data/bucket":247,"../util/evented":341,"../util/util":349,"./source":279,"./tile_pyramid":282,"resolve-url":405}],275:[function(t,e,r){"use strict";function n(t){this.features=t,this.length=t.length,this.extent=s}function i(t){this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=s}var o=t("point-geometry"),a=t("vector-tile").VectorTileFeature,s=t("../data/bucket").EXTENT;e.exports=n,n.prototype.feature=function(t){return new i(this.features[t])},i.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var r=t[e],n=[],i=0;i<r.length;i++)n.push(new o(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry},i.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-(1/0),n=1/0,i=-(1/0),o=0;o<t.length;o++)for(var a=t[o],s=0;s<a.length;s++){var l=a[s];e=Math.min(e,l.x),r=Math.max(r,l.x),n=Math.min(n,l.y),i=Math.max(i,l.y)}return[e,n,r,i]},i.prototype.toGeoJSON=a.prototype.toGeoJSON},{"../data/bucket":247,"point-geometry":404,"vector-tile":413}],276:[function(t,e,r){"use strict";function n(t){this.urls=t.urls,this.coordinates=t.coordinates,c.getImage(t.url,function(e,r){e||(this.image=r,this.image.addEventListener("load",function(){this.map._rerender()}.bind(this)),this._loaded=!0,this.map&&this.setCoordinates(t.coordinates))}.bind(this))}var i=t("../util/util"),o=t("./tile"),a=t("./tile_coord"),s=t("../geo/lng_lat"),l=t("point-geometry"),u=t("../util/evented"),c=t("../util/ajax"),h=t("../data/bucket").EXTENT,f=t("../render/draw_raster").RasterBoundsArray,d=t("../data/buffer"),p=t("../render/vertex_array_object");e.exports=n,n.prototype=i.inherit(u,{onAdd:function(t){this.map=t,this.image&&this.setCoordinates(this.coordinates)},setCoordinates:function(t){this.coordinates=t;var e=this.map,r=t.map(function(t){return e.transform.locationCoordinate(s.convert(t)).zoomTo(0)}),n=this.centerCoord=i.getCoordinatesCenter(r);n.column=Math.round(n.column),n.row=Math.round(n.row);var u=r.map(function(t){var e=t.zoomTo(n.zoom);return new l(Math.round((e.column-n.column)*h),Math.round((e.row-n.row)*h))}),c=32767,v=new f;return v.emplaceBack(u[0].x,u[0].y,0,0),v.emplaceBack(u[1].x,u[1].y,c,0),v.emplaceBack(u[3].x,u[3].y,0,c),v.emplaceBack(u[2].x,u[2].y,c,c),this.tile=new o(new a(n.zoom,n.column,n.row)),this.tile.buckets={},this.tile.boundsBuffer=new d(v.serialize(),f.serialize(),d.BufferType.VERTEX),this.tile.boundsVAO=new p,this.fire("change"),this},loaded:function(){return this.image&&this.image.complete},update:function(){},reload:function(){},prepare:function(){if(this._loaded&&this.loaded()){var t=this.map.painter,e=t.gl;this.tile.texture?(e.bindTexture(e.TEXTURE_2D,this.tile.texture),e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,this.image)):(this.tile.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.tile.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.image))}},getVisibleCoordinates:function(){return this.tile?[this.tile.coord]:[]},getTile:function(){return this.tile},serialize:function(){return{type:"image",urls:this.urls,coordinates:this.coordinates}}})},{"../data/bucket":247,"../data/buffer":252,"../geo/lng_lat":256,"../render/draw_raster":267,"../render/vertex_array_object":273,"../util/ajax":334,"../util/evented":341,"../util/util":349,"./tile":280,"./tile_coord":281,"point-geometry":404}],277:[function(t,e,r){"use strict";var n=t("../data/bucket");e.exports=function(t,e,r){return e*(n.EXTENT/(t.tileSize*Math.pow(2,r-t.coord.z)))}},{"../data/bucket":247}],278:[function(t,e,r){"use strict";function n(t){i.extend(this,i.pick(t,["url","tileSize"])),s._loadTileJSON.call(this,t)}var i=t("../util/util"),o=t("../util/ajax"),a=t("../util/evented"),s=t("./source"),l=t("../util/mapbox").normalizeTileURL;e.exports=n,n.prototype=i.inherit(a,{minzoom:0,maxzoom:22,roundZoom:!0,tileSize:512,_loaded:!1,onAdd:function(t){this.map=t},loaded:function(){return this._pyramid&&this._pyramid.loaded()},update:function(t){this._pyramid&&this._pyramid.update(this.used,t,this.map.style.rasterFadeDuration)},reload:function(){},serialize:function(){return{type:"raster",url:this.url,tileSize:this.tileSize}},getVisibleCoordinates:s._getVisibleCoordinates,getTile:s._getTile,_loadTile:function(t){function e(e,r){if(delete t.request,!t.aborted){if(e)return t.errored=!0,void this.fire("tile.error",{tile:t,error:e});var n=this.map.painter.gl;t.texture=this.map.painter.getTexture(r.width),t.texture?(n.bindTexture(n.TEXTURE_2D,t.texture),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,r)):(t.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,t.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR_MIPMAP_NEAREST),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,r),t.texture.size=r.width),n.generateMipmap(n.TEXTURE_2D),t.timeAdded=(new Date).getTime(),this.map.animationLoop.set(this.style.rasterFadeDuration),t.source=this,t.loaded=!0,this.fire("tile.load",{tile:t})}}var r=l(t.coord.url(this.tiles),this.url,this.tileSize);t.request=o.getImage(r,e.bind(this))},_abortTile:function(t){t.aborted=!0,t.request&&(t.request.abort(),delete t.request)},_addTile:function(t){this.fire("tile.add",{tile:t})},_removeTile:function(t){this.fire("tile.remove",{tile:t})},_unloadTile:function(t){t.texture&&this.map.painter.saveTexture(t.texture)}})},{"../util/ajax":334,"../util/evented":341,"../util/mapbox":346,"../util/util":349,"./source":279}],279:[function(t,e,r){"use strict";function n(t,e){var r=t.tile.coord,n=e.tile.coord;return r.z-n.z||r.y-n.y||r.x-n.x}function i(t){for(var e=t[0]||{},r=1;r<t.length;r++){var n=t[r];for(var i in n){var o=n[i],a=e[i];if(void 0===a)a=e[i]=o;else for(var s=0;s<o.length;s++)a.push(o[s])}}return e}var o=t("../util/util"),a=t("../util/ajax"),s=t("../util/browser"),l=t("./tile_pyramid"),u=t("../util/mapbox").normalizeSourceURL,c=t("./tile_coord");r._loadTileJSON=function(t){var e=function(t,e){return t?void this.fire("error",{error:t}):(o.extend(this,o.pick(e,["tiles","minzoom","maxzoom","attribution"])),e.vector_layers&&(this.vectorLayers=e.vector_layers,this.vectorLayerIds=this.vectorLayers.map(function(t){return t.id})),this._pyramid=new l({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom,reparseOverscaled:this.reparseOverscaled,load:this._loadTile.bind(this),abort:this._abortTile.bind(this),unload:this._unloadTile.bind(this),add:this._addTile.bind(this),remove:this._removeTile.bind(this),redoPlacement:this._redoTilePlacement?this._redoTilePlacement.bind(this):void 0}),void this.fire("load"))}.bind(this);t.url?a.getJSON(u(t.url),e):s.frame(e.bind(this,null,t))},r.redoPlacement=function(){if(this._pyramid)for(var t=this._pyramid.orderedIDs(),e=0;e<t.length;e++){var r=this._pyramid.getTile(t[e]);this._redoTilePlacement(r)}},r._getTile=function(t){return this._pyramid.getTile(t.id)},r._getVisibleCoordinates=function(){return this._pyramid?this._pyramid.renderedIDs().map(c.fromID):[]},r._queryRenderedVectorFeatures=function(t,e,r,o){if(!this._pyramid)return{};var a=this._pyramid.tilesIn(t);a.sort(n);for(var s=this.map.style._layers,l=[],u=0;u<a.length;u++){var c=a[u];c.tile.featureIndex&&l.push(c.tile.featureIndex.query({queryGeometry:c.queryGeometry,scale:c.scale,tileSize:c.tile.tileSize,bearing:o,params:e},s))}return i(l)},r._querySourceFeatures=function(t){if(!this._pyramid)return[];for(var e=this._pyramid,r=e.renderedIDs().map(function(t){return e.getTile(t)}),n=[],i={},o=0;o<r.length;o++){var a=r[o],s=new c(Math.min(a.sourceMaxZoom,a.coord.z),a.coord.x,a.coord.y,0).id;i[s]||(i[s]=!0,a.querySourceFeatures(n,t))}return n},r.create=function(e){var n={vector:t("./vector_tile_source"),raster:t("./raster_tile_source"),geojson:t("./geojson_source"),video:t("./video_source"),image:t("./image_source")};return r.is(e)?e:new n[e.type](e)},r.is=function(e){var r={vector:t("./vector_tile_source"),raster:t("./raster_tile_source"),geojson:t("./geojson_source"),video:t("./video_source"),image:t("./image_source")};for(var n in r)if(e instanceof r[n])return!0;return!1}},{"../util/ajax":334,"../util/browser":335,"../util/mapbox":346,"../util/util":349,"./geojson_source":274,"./image_source":276,"./raster_tile_source":278,"./tile_coord":281,"./tile_pyramid":282,"./vector_tile_source":283,"./video_source":284}],280:[function(t,e,r){"use strict";function n(t,e,r){this.coord=t,this.uid=o.uniqueId(),this.loaded=!1,this.isUnloaded=!1,this.uses=0,this.tileSize=e,this.sourceMaxZoom=r,this.buckets={}}function i(t,e){for(var r={},n=0;n<t.length;n++){var i=e.getLayer(t[n].layerId);if(i){var s=a.create(o.extend({layer:i,childLayers:t[n].childLayerIds.map(e.getLayer.bind(e)).filter(function(t){return t})},t[n]));r[s.id]=s}}return r}var o=t("../util/util"),a=t("../data/bucket"),s=t("../data/feature_index"),l=t("vector-tile"),u=t("pbf"),c=t("../util/vectortile_to_geojson"),h=t("feature-filter"),f=t("../symbol/collision_tile"),d=t("../symbol/collision_box");e.exports=n,n.prototype={loadVectorData:function(t,e){this.loaded=!0,t&&(this.collisionBoxArray=new d(t.collisionBoxArray),this.collisionTile=new f(t.collisionTile,this.collisionBoxArray),this.featureIndex=new s(t.featureIndex,t.rawTileData,this.collisionTile),this.rawTileData=t.rawTileData,this.buckets=i(t.buckets,e))},reloadSymbolData:function(t,e,r){if(!this.isUnloaded){this.collisionTile=new f(t.collisionTile,this.collisionBoxArray),this.featureIndex.setCollisionTile(this.collisionTile);for(var n in this.buckets){var a=this.buckets[n];"symbol"===a.type&&(a.destroy(e.gl),delete this.buckets[n])}o.extend(this.buckets,i(t.buckets,r))}},unloadVectorData:function(t){for(var e in this.buckets){var r=this.buckets[e];r.destroy(t.gl)}this.collisionBoxArray=null,this.collisionTile=null,this.featureIndex=null,this.rawTileData=null,this.buckets=null,this.loaded=!1,this.isUnloaded=!0},redoPlacement:function(t){function e(e,r){this.reloadSymbolData(r,t.map.painter,t.map.style),t.fire("tile.load",{tile:this}),this.redoingPlacement=!1,this.redoWhenDone&&(this.redoPlacement(t),this.redoWhenDone=!1)}return!this.loaded||this.redoingPlacement?void(this.redoWhenDone=!0):(this.redoingPlacement=!0,void t.dispatcher.send("redo placement",{uid:this.uid,source:t.id,angle:t.map.transform.angle,pitch:t.map.transform.pitch,showCollisionBoxes:t.map.showCollisionBoxes},e.bind(this),this.workerID))},getBucket:function(t){return this.buckets&&this.buckets[t.ref||t.id]},querySourceFeatures:function(t,e){if(this.rawTileData){this.vtLayers||(this.vtLayers=new l.VectorTile(new u(new Uint8Array(this.rawTileData))).layers);var r=this.vtLayers._geojsonTileLayer||this.vtLayers[e.sourceLayer];if(r)for(var n=h(e.filter),i={z:this.coord.z,x:this.coord.x,y:this.coord.y},o=0;o<r.length;o++){var a=r.feature(o);if(n(a)){var s=new c(a,this.coord.z,this.coord.x,this.coord.y);s.tile=i,t.push(s)}}}}}},{"../data/bucket":247,"../data/feature_index":253,"../symbol/collision_box":306,"../symbol/collision_tile":308,"../util/util":349,"../util/vectortile_to_geojson":350,"feature-filter":352,pbf:402,"vector-tile":413}],281:[function(t,e,r){"use strict";function n(t,e,r,n){s(!isNaN(t)&&t>=0&&t%1===0),s(!isNaN(e)&&e>=0&&e%1===0),s(!isNaN(r)&&r>=0&&r%1===0),isNaN(n)&&(n=0),this.z=+t,this.x=+e,this.y=+r,this.w=+n,n*=2,0>n&&(n=-1*n-1);var i=1<<this.z;this.id=32*(i*i*n+i*this.y+this.x)+this.z,this.posMatrix=null}function i(t,e){if(t.row>e.row){var r=t;t=e,e=r}return{x0:t.column,y0:t.row,x1:e.column,y1:e.row,dx:e.column-t.column,dy:e.row-t.row}}function o(t,e,r,n,i){var o=Math.max(r,Math.floor(e.y0)),a=Math.min(n,Math.ceil(e.y1));if(t.x0===e.x0&&t.y0===e.y0?t.x0+e.dy/t.dy*t.dx<e.x1:t.x1-e.dy/t.dy*t.dx<e.x0){var s=t;t=e,e=s}for(var l=t.dx/t.dy,u=e.dx/e.dy,c=t.dx>0,h=e.dx<0,f=o;a>f;f++){var d=l*Math.max(0,Math.min(t.dy,f+c-t.y0))+t.x0,p=u*Math.max(0,Math.min(e.dy,f+h-e.y0))+e.x0;i(Math.floor(p),Math.ceil(d),f)}}function a(t,e,r,n,a,s){var l,u=i(t,e),c=i(e,r),h=i(r,t);u.dy>c.dy&&(l=u,u=c,c=l),u.dy>h.dy&&(l=u,u=h,h=l),c.dy>h.dy&&(l=c,c=h,h=l),u.dy&&o(h,u,n,a,s),c.dy&&o(h,c,n,a,s)}var s=t("assert"),l=t("../geo/coordinate");e.exports=n,n.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y},n.prototype.toCoordinate=function(t){var e=Math.min(this.z,t),r=Math.pow(2,e),n=this.y,i=this.x+r*this.w;return new l(i,n,e)},n.fromID=function(t){var e=t%32,r=1<<e,i=(t-e)/32,o=i%r,a=(i-o)/r%r,s=Math.floor(i/(r*r));return s%2!==0&&(s=-1*s-1),s/=2,new n(e,o,a,s)},n.prototype.url=function(t,e){return t[(this.x+this.y)%t.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace("{z}",Math.min(this.z,e||this.z)).replace("{x}",this.x).replace("{y}",this.y)},n.prototype.parent=function(t){return 0===this.z?null:this.z>t?new n(this.z-1,this.x,this.y,this.w):new n(this.z-1,Math.floor(this.x/2),Math.floor(this.y/2),this.w)},n.prototype.wrapped=function(){return new n(this.z,this.x,this.y,0)},n.prototype.children=function(t){if(this.z>=t)return[new n(this.z+1,this.x,this.y,this.w)];var e=this.z+1,r=2*this.x,i=2*this.y;return[new n(e,r,i,this.w),new n(e,r+1,i,this.w),new n(e,r,i+1,this.w),new n(e,r+1,i+1,this.w)]},n.cover=function(t,e,r){function i(t,e,i){var a,l,u;if(i>=0&&o>=i)for(a=t;e>a;a++)l=(a%o+o)%o,u=new n(r,l,i,Math.floor(a/o)),s[u.id]=u}var o=1<<t,s={};return a(e[0],e[1],e[2],0,o,i),a(e[2],e[3],e[0],0,o,i),Object.keys(s).map(function(t){return s[t]})}},{"../geo/coordinate":255,assert:52}],282:[function(t,e,r){"use strict";function n(t){this.tileSize=t.tileSize,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,this.roundZoom=t.roundZoom,this.reparseOverscaled=t.reparseOverscaled,this._load=t.load,this._abort=t.abort,this._unload=t.unload,this._add=t.add,this._remove=t.remove,this._redoPlacement=t.redoPlacement,this._tiles={},this._cache=new u(0,function(t){return this._unload(t)}.bind(this)),this._filterRendered=this._filterRendered.bind(this)}function i(t,e,r){var n=r.zoomTo(Math.min(t.z,e));return{x:(n.column-(t.x+t.w*Math.pow(2,t.z)))*f,y:(n.row-t.y)*f}}function o(t,e){return t%32-e%32}var a=t("./tile"),s=t("./tile_coord"),l=t("point-geometry"),u=t("../util/lru_cache"),c=t("../geo/coordinate"),h=t("../util/util"),f=t("../data/bucket").EXTENT;e.exports=n,n.maxOverzooming=10,n.maxUnderzooming=3,n.prototype={loaded:function(){for(var t in this._tiles)if(!this._tiles[t].loaded&&!this._tiles[t].errored)return!1;return!0},orderedIDs:function(){return Object.keys(this._tiles).map(Number).sort(o)},renderedIDs:function(){return this.orderedIDs().filter(this._filterRendered)},_filterRendered:function(t){return this._tiles[t].loaded&&!this._coveredTiles[t]},reload:function(){this._cache.reset();for(var t in this._tiles)this._load(this._tiles[t])},getTile:function(t){return this._tiles[t]},getZoom:function(t){return t.zoom+Math.log(t.tileSize/this.tileSize)/Math.LN2},coveringZoomLevel:function(t){return(this.roundZoom?Math.round:Math.floor)(this.getZoom(t))},coveringTiles:function(t){var e=this.coveringZoomLevel(t),r=e;if(e<this.minzoom)return[];e>this.maxzoom&&(e=this.maxzoom);var n=t,i=n.locationCoordinate(n.center)._zoomTo(e),o=new l(i.column-.5,i.row-.5);return s.cover(e,[n.pointCoordinate(new l(0,0))._zoomTo(e),n.pointCoordinate(new l(n.width,0))._zoomTo(e),n.pointCoordinate(new l(n.width,n.height))._zoomTo(e),n.pointCoordinate(new l(0,n.height))._zoomTo(e)],this.reparseOverscaled?r:e).sort(function(t,e){return o.dist(t)-o.dist(e)})},findLoadedChildren:function(t,e,r){var n=!1;for(var i in this._tiles){var o=this._tiles[i];if(!(r[i]||!o.loaded||o.coord.z<=t.z||o.coord.z>e)){ var a=Math.pow(2,Math.min(o.coord.z,this.maxzoom)-Math.min(t.z,this.maxzoom));if(Math.floor(o.coord.x/a)===t.x&&Math.floor(o.coord.y/a)===t.y)for(r[i]=!0,n=!0;o&&o.coord.z-1>t.z;){var s=o.coord.parent(this.maxzoom).id;o=this._tiles[s],o&&o.loaded&&(delete r[i],r[s]=!0)}}}return n},findLoadedParent:function(t,e,r){for(var n=t.z-1;n>=e;n--){t=t.parent(this.maxzoom);var i=this._tiles[t.id];if(i&&i.loaded)return r[t.id]=!0,i;if(this._cache.has(t.id))return this.addTile(t),r[t.id]=!0,this._tiles[t.id]}},updateCacheSize:function(t){var e=Math.ceil(t.width/t.tileSize)+1,r=Math.ceil(t.height/t.tileSize)+1,n=e*r,i=5;this._cache.setMaxSize(Math.floor(n*i))},update:function(t,e,r){var i,o,a;this.updateCacheSize(e);var l=(this.roundZoom?Math.round:Math.floor)(this.getZoom(e)),u=Math.max(l-n.maxOverzooming,this.minzoom),c=Math.max(l+n.maxUnderzooming,this.minzoom),f={},d=(new Date).getTime();this._coveredTiles={};var p=t?this.coveringTiles(e):[];for(i=0;i<p.length;i++)o=p[i],a=this.addTile(o),f[o.id]=!0,a.loaded||this.findLoadedChildren(o,c,f)||this.findLoadedParent(o,u,f);for(var v={},m=Object.keys(f),g=0;g<m.length;g++){var y=m[g];o=s.fromID(y),a=this._tiles[y],a&&a.timeAdded>d-(r||0)&&(this.findLoadedChildren(o,c,f)&&(f[y]=!0),this.findLoadedParent(o,u,v))}var b;for(b in v)f[b]||(this._coveredTiles[b]=!0);for(b in v)f[b]=!0;var x=h.keysDifference(this._tiles,f);for(i=0;i<x.length;i++)this.removeTile(+x[i]);this.transform=e},addTile:function(t){var e=this._tiles[t.id];if(e)return e;var r=t.wrapped();if(e=this._tiles[r.id],e||(e=this._cache.get(r.id),e&&this._redoPlacement&&this._redoPlacement(e)),!e){var n=t.z,i=n>this.maxzoom?Math.pow(2,n-this.maxzoom):1;e=new a(r,this.tileSize*i,this.maxzoom),this._load(e)}return e.uses++,this._tiles[t.id]=e,this._add(e,t),e},removeTile:function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._remove(e),e.uses>0||(e.loaded?this._cache.add(e.coord.wrapped().id,e):(this._abort(e),this._unload(e))))},clearTiles:function(){for(var t in this._tiles)this.removeTile(t);this._cache.reset()},tilesIn:function(t){for(var e={},r=this.orderedIDs(),n=1/0,o=1/0,a=-(1/0),l=-(1/0),u=t[0].zoom,h=0;h<t.length;h++){var d=t[h];n=Math.min(n,d.column),o=Math.min(o,d.row),a=Math.max(a,d.column),l=Math.max(l,d.row)}for(var p=0;p<r.length;p++){var v=this._tiles[r[p]],m=s.fromID(r[p]),g=[i(m,v.sourceMaxZoom,new c(n,o,u)),i(m,v.sourceMaxZoom,new c(a,l,u))];if(g[0].x<f&&g[0].y<f&&g[1].x>=0&&g[1].y>=0){for(var y=[],b=0;b<t.length;b++)y.push(i(m,v.sourceMaxZoom,t[b]));var x=e[v.coord.id];void 0===x&&(x=e[v.coord.id]={tile:v,queryGeometry:[],scale:Math.pow(2,this.transform.zoom-v.coord.z)}),x.queryGeometry.push(y)}}var _=[];for(var w in e)_.push(e[w]);return _}}},{"../data/bucket":247,"../geo/coordinate":255,"../util/lru_cache":345,"../util/util":349,"./tile":280,"./tile_coord":281,"point-geometry":404}],283:[function(t,e,r){"use strict";function n(t){if(i.extend(this,i.pick(t,["url","tileSize"])),this._options=i.extend({type:"vector"},t),512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");a._loadTileJSON.call(this,t)}var i=t("../util/util"),o=t("../util/evented"),a=t("./source"),s=t("../util/mapbox").normalizeTileURL;e.exports=n,n.prototype=i.inherit(o,{minzoom:0,maxzoom:22,tileSize:512,reparseOverscaled:!0,_loaded:!1,isTileClipped:!0,onAdd:function(t){this.map=t},loaded:function(){return this._pyramid&&this._pyramid.loaded()},update:function(t){this._pyramid&&this._pyramid.update(this.used,t)},reload:function(){this._pyramid&&this._pyramid.reload()},serialize:function(){return i.extend({},this._options)},getVisibleCoordinates:a._getVisibleCoordinates,getTile:a._getTile,queryRenderedFeatures:a._queryRenderedVectorFeatures,querySourceFeatures:a._querySourceFeatures,_loadTile:function(t){var e=t.coord.z>this.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,r={url:s(t.coord.url(this.tiles,this.maxzoom),this.url),uid:t.uid,coord:t.coord,zoom:t.coord.z,tileSize:this.tileSize*e,source:this.id,overscaling:e,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID?(r.rawTileData=t.rawTileData,this.dispatcher.send("reload tile",r,this._tileLoaded.bind(this,t),t.workerID)):t.workerID=this.dispatcher.send("load tile",r,this._tileLoaded.bind(this,t))},_tileLoaded:function(t,e,r){if(!t.aborted){if(e)return t.errored=!0,void this.fire("tile.error",{tile:t,error:e});t.loadVectorData(r,this.map.style),t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(this)),this.fire("tile.load",{tile:t}),this.fire("tile.stats",r.bucketStats)}},_abortTile:function(t){t.aborted=!0,this.dispatcher.send("abort tile",{uid:t.uid,source:this.id},null,t.workerID)},_addTile:function(t){this.fire("tile.add",{tile:t})},_removeTile:function(t){this.fire("tile.remove",{tile:t})},_unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},null,t.workerID)},redoPlacement:a.redoPlacement,_redoTilePlacement:function(t){t.redoPlacement(this)}})},{"../util/evented":341,"../util/mapbox":346,"../util/util":349,"./source":279}],284:[function(t,e,r){"use strict";function n(t){this.urls=t.urls,this.coordinates=t.coordinates,c.getVideo(t.urls,function(e,r){if(!e){this.video=r,this.video.loop=!0;var n;this.video.addEventListener("playing",function(){n=this.map.style.animationLoop.set(1/0),this.map._rerender()}.bind(this)),this.video.addEventListener("pause",function(){this.map.style.animationLoop.cancel(n)}.bind(this)),this._loaded=!0,this.map&&(this.video.play(),this.setCoordinates(t.coordinates))}}.bind(this))}var i=t("../util/util"),o=t("./tile"),a=t("./tile_coord"),s=t("../geo/lng_lat"),l=t("point-geometry"),u=t("../util/evented"),c=t("../util/ajax"),h=t("../data/bucket").EXTENT,f=t("../render/draw_raster").RasterBoundsArray,d=t("../data/buffer"),p=t("../render/vertex_array_object");e.exports=n,n.prototype=i.inherit(u,{roundZoom:!0,getVideo:function(){return this.video},onAdd:function(t){this.map=t,this.video&&(this.video.play(),this.setCoordinates(this.coordinates))},setCoordinates:function(t){this.coordinates=t;var e=this.map,r=t.map(function(t){return e.transform.locationCoordinate(s.convert(t)).zoomTo(0)}),n=this.centerCoord=i.getCoordinatesCenter(r);n.column=Math.round(n.column),n.row=Math.round(n.row);var u=r.map(function(t){var e=t.zoomTo(n.zoom);return new l(Math.round((e.column-n.column)*h),Math.round((e.row-n.row)*h))}),c=32767,v=new f;return v.emplaceBack(u[0].x,u[0].y,0,0),v.emplaceBack(u[1].x,u[1].y,c,0),v.emplaceBack(u[3].x,u[3].y,0,c),v.emplaceBack(u[2].x,u[2].y,c,c),this.tile=new o(new a(n.zoom,n.column,n.row)),this.tile.buckets={},this.tile.boundsBuffer=new d(v.serialize(),f.serialize(),d.BufferType.VERTEX),this.tile.boundsVAO=new p,this.fire("change"),this},loaded:function(){return this.video&&this.video.readyState>=2},update:function(){},reload:function(){},prepare:function(){if(this._loaded&&!(this.video.readyState<2)){var t=this.map.painter.gl;this.tile.texture?(t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.tile.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.video)),this._currentTime=this.video.currentTime}},getVisibleCoordinates:function(){return this.tile?[this.tile.coord]:[]},getTile:function(){return this.tile},serialize:function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}})},{"../data/bucket":247,"../data/buffer":252,"../geo/lng_lat":256,"../render/draw_raster":267,"../render/vertex_array_object":273,"../util/ajax":334,"../util/evented":341,"../util/util":349,"./tile":280,"./tile_coord":281,"point-geometry":404}],285:[function(t,e,r){"use strict";function n(t){this.self=t,this.actor=new o(t,this),this.loading={},this.loaded={},this.geoJSONIndexes={}}function i(t){var e={};for(var r in t){var n=t[r],i=n.ref||n.id,o=t[i];o.layout&&"none"===o.layout.visibility||(e[i]=e[i]||[],r===i?e[i].unshift(n):e[i].push(n))}return e}var o=t("../util/actor"),a=t("./worker_tile"),s=t("../style/style_layer"),l=t("../util/util"),u=t("../util/ajax"),c=t("vector-tile"),h=t("pbf"),f=t("supercluster"),d=t("geojson-vt"),p=t("geojson-rewind"),v=t("./geojson_wrapper"),m=t("vt-pbf");e.exports=function(t){return new n(t)},l.extend(n.prototype,{"set layers":function(t){function e(t){var e=s.create(t,t.ref&&r.layers[t.ref]);e.updatePaintTransitions({},{transition:!1}),r.layers[e.id]=e}this.layers={};for(var r=this,n=[],o=0;o<t.length;o++){var a=t[o];"fill"!==a.type&&"line"!==a.type&&"circle"!==a.type&&"symbol"!==a.type||(a.ref?n.push(o):e(a))}for(var l=0;l<n.length;l++)e(t[n[l]]);this.layerFamilies=i(this.layers)},"update layers":function(t){function e(t){var e=o.layers[t.ref];o.layers[t.id]?o.layers[t.id].set(t,e):o.layers[t.id]=s.create(t,e),o.layers[t.id].updatePaintTransitions({},{transition:!1})}var r,n,o=this;for(r in t)n=t[r],n.ref&&e(n);for(r in t)n=t[r],n.ref||e(n);this.layerFamilies=i(this.layers)},"load tile":function(t,e){function r(t,r){return delete this.loading[n][i],t?e(t):(o.data=new c.VectorTile(new h(new Uint8Array(r))),o.parse(o.data,this.layerFamilies,this.actor,r,e),this.loaded[n]=this.loaded[n]||{},void(this.loaded[n][i]=o))}var n=t.source,i=t.uid;this.loading[n]||(this.loading[n]={});var o=this.loading[n][i]=new a(t);o.xhr=u.getArrayBuffer(t.url,r.bind(this))},"reload tile":function(t,e){var r=this.loaded[t.source],n=t.uid;if(r&&r[n]){var i=r[n];i.parse(i.data,this.layerFamilies,this.actor,t.rawTileData,e)}},"abort tile":function(t){var e=this.loading[t.source],r=t.uid;e&&e[r]&&(e[r].xhr.abort(),delete e[r])},"remove tile":function(t){var e=this.loaded[t.source],r=t.uid;e&&e[r]&&delete e[r]},"redo placement":function(t,e){var r=this.loaded[t.source],n=this.loading[t.source],i=t.uid;if(r&&r[i]){var o=r[i],a=o.redoPlacement(t.angle,t.pitch,t.showCollisionBoxes);a.result&&e(null,a.result,a.transferables)}else n&&n[i]&&(n[i].angle=t.angle)},"parse geojson":function(t,e){var r=function(r,n){if(p(n,!0),r)return e(r);if("object"!=typeof n)return e(new Error("Input data is not a valid GeoJSON object."));try{this.geoJSONIndexes[t.source]=t.cluster?f(t.superclusterOptions).load(n.features):d(n,t.geojsonVtOptions)}catch(r){return e(r)}e(null)}.bind(this);if(t.url)u.getJSON(t.url,r);else{if("string"!=typeof t.data)return e(new Error("Input data is not a valid GeoJSON object."));r(null,JSON.parse(t.data))}},"load geojson tile":function(t,e){var r=t.source,n=t.coord;if(!this.geoJSONIndexes[r])return e(null,null);var i=this.geoJSONIndexes[r].getTile(Math.min(n.z,t.maxZoom),n.x,n.y),o=i?new a(t):void 0;if(this.loaded[r]=this.loaded[r]||{},this.loaded[r][t.uid]=o,!i)return e(null,null);var s=new v(i.features);s.name="_geojsonTileLayer";var l=m({layers:{_geojsonTileLayer:s}}).buffer;o.parse(s,this.layerFamilies,this.actor,l,e)}})},{"../style/style_layer":293,"../util/actor":333,"../util/ajax":334,"../util/util":349,"./geojson_wrapper":275,"./worker_tile":286,"geojson-rewind":353,"geojson-vt":358,pbf:402,supercluster:407,"vector-tile":413,"vt-pbf":417}],286:[function(t,e,r){"use strict";function n(t){this.coord=t.coord,this.uid=t.uid,this.zoom=t.zoom,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=t.overscaling,this.angle=t.angle,this.pitch=t.pitch,this.showCollisionBoxes=t.showCollisionBoxes}function i(t){for(var e in t.arrayGroups)for(var r=t.arrayGroups[e],n=0;n<r.length;n++){var i=r[n];for(var o in i){var a=i[o];for(var s in a)if(a[s].length>0)return!0}}return!1}function o(t){return t.serialize()}function a(t){var e=[];for(var r in t){var n=t[r];for(var i in n.arrayGroups)for(var o=n.arrayGroups[i],a=0;a<o.length;a++){var s=o[a];for(var l in s){var u=s[l];for(var c in u)e.push(u[c].arrayBuffer)}}}return e}function s(t){return t.id}var l=t("../data/feature_index"),u=t("../symbol/collision_tile"),c=t("../data/bucket"),h=t("../symbol/collision_box"),f=t("../util/dictionary_coder");e.exports=n,n.prototype.parse=function(t,e,r,n,d){function p(t,e){for(var r=0;r<t.length;r++){var n=t.feature(r);n.index=r;for(var i in e)e[i].filter(n)&&e[i].features.push(n)}}function v(t){if(t)return d(t);if(F++,2===F){for(var e=P.length-1;e>=0;e--)m(T,P[e]);g()}}function m(t,e){var r=Date.now();e.populateBuffers(w,O,D);var n=Date.now()-r;if("symbol"!==e.type)for(var i=0;i<e.features.length;i++){var o=e.features[i];M.insert(o,o.index,e.sourceLayerIndex,e.index)}e.features=null,A._total+=n,A[e.id]=(A[e.id]||0)+n}function g(){T.status="done",T.redoPlacementAfterDone&&(T.redoPlacement(T.angle,T.pitch,null),T.redoPlacementAfterDone=!1);var t=M.serialize(),e=w.serialize(),r=T.collisionBoxArray.serialize(),s=[n].concat(t.transferables).concat(e.transferables),l=I.filter(i);d(null,{buckets:l.map(o),bucketStats:A,featureIndex:t.data,collisionTile:e.data,collisionBoxArray:r,rawTileData:n},a(l).concat(s))}this.status="parsing",this.data=t,this.collisionBoxArray=new h;var y,b,x,_,w=new u(this.angle,this.pitch,this.collisionBoxArray),M=new l(this.coord,this.overscaling,w,t.layers),k=new f(t.layers?Object.keys(t.layers).sort():["_geojsonTileLayer"]),A={_total:0},T=this,E={},S={},L=0;for(var z in e)b=e[z][0],b.source===this.source&&(b.ref||b.minzoom&&this.zoom<b.minzoom||b.maxzoom&&this.zoom>=b.maxzoom||b.layout&&"none"===b.layout.visibility||t.layers&&!t.layers[b.sourceLayer]||(_=c.create({layer:b,index:L++,childLayers:e[z],zoom:this.zoom,overscaling:this.overscaling,showCollisionBoxes:this.showCollisionBoxes,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:k.encode(b.sourceLayer||"_geojsonTileLayer")}),_.createFilter(),E[b.id]=_,t.layers&&(x=b.sourceLayer,S[x]=S[x]||{},S[x][b.id]=_)));if(t.layers)for(x in S)b=t.layers[x],b&&p(b,S[x]);else p(t,E);var I=[],P=this.symbolBuckets=[],C=[];M.bucketLayerIDs={};for(var R in E)_=E[R],0!==_.features.length&&(M.bucketLayerIDs[_.index]=_.childLayers.map(s),I.push(_),"symbol"===_.type?P.push(_):C.push(_));var D={},O={},F=0;if(P.length>0){for(y=P.length-1;y>=0;y--)P[y].updateIcons(D),P[y].updateFont(O);for(var j in O)O[j]=Object.keys(O[j]).map(Number);D=Object.keys(D),r.send("get glyphs",{uid:this.uid,stacks:O},function(t,e){O=e,v(t)}),D.length?r.send("get icons",{icons:D},function(t,e){D=e,v(t)}):v()}for(y=C.length-1;y>=0;y--)m(this,C[y]);return 0===P.length?g():void 0},n.prototype.redoPlacement=function(t,e,r){if("done"!==this.status)return this.redoPlacementAfterDone=!0,this.angle=t,{};for(var n=new u(t,e,this.collisionBoxArray),s=this.symbolBuckets,l=s.length-1;l>=0;l--)s[l].placeFeatures(n,r);var c=n.serialize(),h=s.filter(i);return{result:{buckets:h.map(o),collisionTile:c.data},transferables:a(h).concat(c.transferables)}}},{"../data/bucket":247,"../data/feature_index":253,"../symbol/collision_box":306,"../symbol/collision_tile":308,"../util/dictionary_coder":340}],287:[function(t,e,r){"use strict";function n(){this.n=0,this.times=[]}e.exports=n,n.prototype.stopped=function(){return this.times=this.times.filter(function(t){return t.time>=(new Date).getTime()}),!this.times.length},n.prototype.set=function(t){return this.times.push({id:this.n,time:t+(new Date).getTime()}),this.n++},n.prototype.cancel=function(t){this.times=this.times.filter(function(e){return e.id!==t})}},{}],288:[function(t,e,r){"use strict";function n(t){this.base=t,this.retina=s.devicePixelRatio>1;var e=this.retina?"@2x":"";a.getJSON(l(t,e,".json"),function(t,e){return t?void this.fire("error",{error:t}):(this.data=e,void(this.img&&this.fire("load")))}.bind(this)),a.getImage(l(t,e,".png"),function(t,e){if(t)return void this.fire("error",{error:t});for(var r=e.getData(),n=e.data=new Uint8Array(r.length),i=0;i<r.length;i+=4){var o=r[i+3]/255;n[i+0]=r[i+0]*o,n[i+1]=r[i+1]*o,n[i+2]=r[i+2]*o,n[i+3]=r[i+3]}this.img=e,this.data&&this.fire("load")}.bind(this))}function i(){}var o=t("../util/evented"),a=t("../util/ajax"),s=t("../util/browser"),l=t("../util/mapbox").normalizeSpriteURL;e.exports=n,n.prototype=Object.create(o),n.prototype.toJSON=function(){return this.base},n.prototype.loaded=function(){return!(!this.data||!this.img)},n.prototype.resize=function(){if(s.devicePixelRatio>1!==this.retina){var t=new n(this.base);t.on("load",function(){this.img=t.img,this.data=t.data,this.retina=t.retina}.bind(this))}},i.prototype={x:0,y:0,width:0,height:0,pixelRatio:1,sdf:!1},n.prototype.getSpritePosition=function(t){if(!this.loaded())return new i;var e=this.data&&this.data[t];return e&&this.img?e:new i}},{"../util/ajax":334,"../util/browser":335,"../util/evented":341,"../util/mapbox":346}],289:[function(t,e,r){"use strict";function n(t){if(l[t])return l[t];if(Array.isArray(t))return t;if(t&&t.stops)return s.extend({},t,{stops:t.stops.map(i)});if("string"==typeof t){var e=a(t);if(!e)throw new Error("Invalid color "+t);var r=o(e);return l[t]=r,r}throw new Error("Invalid color "+t)}function i(t){return[t[0],n(t[1])]}function o(t){return[t[0]/255,t[1]/255,t[2]/255,t[3]/1]}var a=t("csscolorparser").parseCSSColor,s=t("../util/util"),l={};e.exports=n},{"../util/util":349,csscolorparser:351}],290:[function(t,e,r){"use strict";function n(t,e){this.animationLoop=e||new v,this.dispatcher=new p(Math.max(d.hardwareConcurrency-1,1),this),this.spriteAtlas=new l(512,512),this.lineAtlas=new u(256,512),this._layers={},this._order=[],this._groups=[],this.sources={},this.zoomHistory={},c.bindAll(["_forwardSourceEvent","_forwardTileEvent","_forwardLayerEvent","_redoPlacement"],this),this._resetUpdates();var r=function(t,e){if(t)return void this.fire("error",{error:t});if(!m.emitErrors(this,m(e))){this._loaded=!0,this.stylesheet=e,this.updateClasses();var r=e.sources;for(var n in r)this.addSource(n,r[n]);e.sprite&&(this.sprite=new a(e.sprite),this.sprite.on("load",this.fire.bind(this,"change"))),this.glyphSource=new s(e.glyphs),this._resolve(),this.fire("load")}}.bind(this);"string"==typeof t?h.getJSON(f(t),r):d.frame(r.bind(this,null,t)),this.on("source.load",function(t){var e=t.source;if(e&&e.vectorLayerIds)for(var r in this._layers){var n=this._layers[r];n.source===e.id&&this._validateLayer(n)}})}var i=t("../util/evented"),o=t("./style_layer"),a=t("./image_sprite"),s=t("../symbol/glyph_source"),l=t("../symbol/sprite_atlas"),u=t("../render/line_atlas"),c=t("../util/util"),h=t("../util/ajax"),f=t("../util/mapbox").normalizeStyleURL,d=t("../util/browser"),p=t("../util/dispatcher"),v=t("./animation_loop"),m=t("./validate_style"),g=t("../source/source"),y=t("./style_spec"),b=t("./style_function");e.exports=n,n.prototype=c.inherit(i,{_loaded:!1,_validateLayer:function(t){var e=this.sources[t.source];t.sourceLayer&&e&&e.vectorLayerIds&&-1===e.vectorLayerIds.indexOf(t.sourceLayer)&&this.fire("error",{error:new Error('Source layer "'+t.sourceLayer+'" does not exist on source "'+e.id+'" as specified by style layer "'+t.id+'"')})},loaded:function(){if(!this._loaded)return!1;for(var t in this.sources)if(!this.sources[t].loaded())return!1;return!this.sprite||this.sprite.loaded()},_resolve:function(){var t,e;this._layers={},this._order=this.stylesheet.layers.map(function(t){return t.id});for(var r=0;r<this.stylesheet.layers.length;r++)e=this.stylesheet.layers[r],e.ref||(t=o.create(e),this._layers[t.id]=t,t.on("error",this._forwardLayerEvent));for(var n=0;n<this.stylesheet.layers.length;n++)if(e=this.stylesheet.layers[n],e.ref){var i=this.getLayer(e.ref);t=o.create(e,i),this._layers[t.id]=t,t.on("error",this._forwardLayerEvent)}this._groupLayers(),this._updateWorkerLayers()},_groupLayers:function(){var t;this._groups=[];for(var e=0;e<this._order.length;++e){var r=this._layers[this._order[e]];t&&r.source===t.source||(t=[],t.source=r.source,this._groups.push(t)),t.push(r)}},_updateWorkerLayers:function(t){this.dispatcher.broadcast(t?"update layers":"set layers",this._serializeLayers(t))},_serializeLayers:function(t){t=t||this._order;for(var e=[],r={includeRefProperties:!0},n=0;n<t.length;n++)e.push(this._layers[t[n]].serialize(r));return e},_applyClasses:function(t,e){if(this._loaded){t=t||[],e=e||{transition:!0};var r=this.stylesheet.transition||{},n=this._updates.allPaintProps?this._layers:this._updates.paintProps;for(var i in n){var o=this._layers[i],a=this._updates.paintProps[i];if(this._updates.allPaintProps||a.all)o.updatePaintTransitions(t,e,r,this.animationLoop);else for(var s in a)this._layers[i].updatePaintTransition(s,t,e,r,this.animationLoop)}}},_recalculate:function(t){for(var e in this.sources)this.sources[e].used=!1;this._updateZoomHistory(t),this.rasterFadeDuration=300;for(var r in this._layers){var n=this._layers[r];n.recalculate(t,this.zoomHistory),!n.isHidden(t)&&n.source&&(this.sources[n.source].used=!0)}var i=300;Math.floor(this.z)!==Math.floor(t)&&this.animationLoop.set(i),this.z=t,this.fire("zoom")},_updateZoomHistory:function(t){var e=this.zoomHistory;void 0===e.lastIntegerZoom&&(e.lastIntegerZoom=Math.floor(t),e.lastIntegerZoomTime=0,e.lastZoom=t),Math.floor(e.lastZoom)<Math.floor(t)?(e.lastIntegerZoom=Math.floor(t),e.lastIntegerZoomTime=Date.now()):Math.floor(e.lastZoom)>Math.floor(t)&&(e.lastIntegerZoom=Math.floor(t+1),e.lastIntegerZoomTime=Date.now()),e.lastZoom=t},_checkLoaded:function(){if(!this._loaded)throw new Error("Style is not done loading")},update:function(t,e){if(!this._updates.changed)return this;if(this._updates.allLayers)this._groupLayers(),this._updateWorkerLayers();else{var r=Object.keys(this._updates.layers);r.length&&this._updateWorkerLayers(r)}var n,i=Object.keys(this._updates.sources);for(n=0;n<i.length;n++)this._reloadSource(i[n]);for(n=0;n<this._updates.events.length;n++){var o=this._updates.events[n];this.fire(o[0],o[1])}return this._applyClasses(t,e),this._updates.changed&&this.fire("change"),this._resetUpdates(),this},_resetUpdates:function(){this._updates={events:[],layers:{},sources:{},paintProps:{}}},addSource:function(t,e){if(this._checkLoaded(),void 0!==this.sources[t])throw new Error("There is already a source with this ID");return!g.is(e)&&this._handleErrors(m.source,"sources."+t,e)?this:(e=g.create(e),this.sources[t]=e,e.id=t,e.style=this,e.dispatcher=this.dispatcher,e.on("load",this._forwardSourceEvent).on("error",this._forwardSourceEvent).on("change",this._forwardSourceEvent).on("tile.add",this._forwardTileEvent).on("tile.load",this._forwardTileEvent).on("tile.error",this._forwardTileEvent).on("tile.remove",this._forwardTileEvent).on("tile.stats",this._forwardTileEvent),this._updates.events.push(["source.add",{source:e}]),this._updates.changed=!0,this)},removeSource:function(t){if(this._checkLoaded(),void 0===this.sources[t])throw new Error("There is no source with this ID");var e=this.sources[t];return delete this.sources[t],e.off("load",this._forwardSourceEvent).off("error",this._forwardSourceEvent).off("change",this._forwardSourceEvent).off("tile.add",this._forwardTileEvent).off("tile.load",this._forwardTileEvent).off("tile.error",this._forwardTileEvent).off("tile.remove",this._forwardTileEvent).off("tile.stats",this._forwardTileEvent),this._updates.events.push(["source.remove",{source:e}]),this._updates.changed=!0,this},getSource:function(t){return this.sources[t]},addLayer:function(t,e){if(this._checkLoaded(),!(t instanceof o)){if(this._handleErrors(m.layer,"layers."+t.id,t,!1,{arrayIndex:-1}))return this;var r=t.ref&&this.getLayer(t.ref);t=o.create(t,r)}return this._validateLayer(t),t.on("error",this._forwardLayerEvent),this._layers[t.id]=t,this._order.splice(e?this._order.indexOf(e):1/0,0,t.id),this._updates.allLayers=!0,t.source&&(this._updates.sources[t.source]=!0),this._updates.events.push(["layer.add",{layer:t}]),this.updateClasses(t.id)},removeLayer:function(t){this._checkLoaded();var e=this._layers[t];if(void 0===e)throw new Error("There is no layer with this ID");for(var r in this._layers)this._layers[r].ref===t&&this.removeLayer(r);return e.off("error",this._forwardLayerEvent),delete this._layers[t],this._order.splice(this._order.indexOf(t),1),this._updates.allLayers=!0,this._updates.events.push(["layer.remove",{layer:e}]),this._updates.changed=!0,this},getLayer:function(t){return this._layers[t]},getReferentLayer:function(t){var e=this.getLayer(t);return e.ref&&(e=this.getLayer(e.ref)),e},setLayerZoomRange:function(t,e,r){this._checkLoaded();var n=this.getReferentLayer(t);return n.minzoom===e&&n.maxzoom===r?this:(null!=e&&(n.minzoom=e),null!=r&&(n.maxzoom=r),this._updateLayer(n))},setFilter:function(t,e){this._checkLoaded();var r=this.getReferentLayer(t);return this._handleErrors(m.filter,"layers."+r.id+".filter",e)?this:c.deepEqual(r.filter,e)?this:(r.filter=c.clone(e),this._updateLayer(r))},getFilter:function(t){return this.getReferentLayer(t).filter},setLayoutProperty:function(t,e,r){this._checkLoaded();var n=this.getReferentLayer(t);return c.deepEqual(n.getLayoutProperty(e),r)?this:(n.setLayoutProperty(e,r),this._updateLayer(n))},getLayoutProperty:function(t,e){return this.getReferentLayer(t).getLayoutProperty(e)},setPaintProperty:function(t,e,r,n){this._checkLoaded();var i=this.getLayer(t);if(c.deepEqual(i.getPaintProperty(e,n),r))return this;var o=i.isPaintValueFeatureConstant(e);i.setPaintProperty(e,r,n);var a=!(b.isFunctionDefinition(r)&&"zoom"!==r.property&&void 0!==r.property);return a&&o||(this._updates.layers[t]=!0,i.source&&(this._updates.sources[i.source]=!0)),this.updateClasses(t,e)},getPaintProperty:function(t,e,r){return this.getLayer(t).getPaintProperty(e,r)},updateClasses:function(t,e){if(this._updates.changed=!0,t){var r=this._updates.paintProps;r[t]||(r[t]={}),r[t][e||"all"]=!0}else this._updates.allPaintProps=!0;return this},serialize:function(){return c.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:c.mapObject(this.sources,function(t){return t.serialize()}),layers:this._order.map(function(t){return this._layers[t].serialize()},this)},function(t){return void 0!==t})},_updateLayer:function(t){return this._updates.layers[t.id]=!0,t.source&&(this._updates.sources[t.source]=!0),this._updates.changed=!0,this},_flattenRenderedFeatures:function(t){for(var e=[],r=this._order.length-1;r>=0;r--)for(var n=this._order[r],i=0;i<t.length;i++){var o=t[i][n];if(o)for(var a=0;a<o.length;a++)e.push(o[a])}return e},queryRenderedFeatures:function(t,e,r,n){e&&e.filter&&this._handleErrors(m.filter,"queryRenderedFeatures.filter",e.filter,!0);var i=[];for(var o in this.sources){var a=this.sources[o];a.queryRenderedFeatures&&i.push(a.queryRenderedFeatures(t,e,r,n))}return this._flattenRenderedFeatures(i)},querySourceFeatures:function(t,e){e&&e.filter&&this._handleErrors(m.filter,"querySourceFeatures.filter",e.filter,!0);var r=this.getSource(t);return r&&r.querySourceFeatures?r.querySourceFeatures(e):[]},_handleErrors:function(t,e,r,n,i){var o=n?m.throwErrors:m.emitErrors,a=t.call(m,c.extend({key:e,style:this.serialize(),value:r,styleSpec:y},i));return o.call(m,this,a)},_remove:function(){this.dispatcher.remove()},_reloadSource:function(t){this.sources[t].reload()},_updateSources:function(t){for(var e in this.sources)this.sources[e].update(t)},_redoPlacement:function(){for(var t in this.sources)this.sources[t].redoPlacement&&this.sources[t].redoPlacement()},_forwardSourceEvent:function(t){this.fire("source."+t.type,c.extend({source:t.target},t))},_forwardTileEvent:function(t){this.fire(t.type,c.extend({source:t.target},t))},_forwardLayerEvent:function(t){this.fire("layer."+t.type,c.extend({layer:{id:t.target.id}},t))},"get sprite json":function(t,e){var r=this.sprite;r.loaded()?e(null,{sprite:r.data,retina:r.retina}):r.on("load",function(){e(null,{sprite:r.data,retina:r.retina})})},"get icons":function(t,e){var r=this.sprite,n=this.spriteAtlas;r.loaded()?(n.setSprite(r),n.addIcons(t.icons,e)):r.on("load",function(){n.setSprite(r),n.addIcons(t.icons,e)})},"get glyphs":function(t,e){function r(t,r,n){t&&console.error(t),o[n]=r,i--,0===i&&e(null,o)}var n=t.stacks,i=Object.keys(n).length,o={};for(var a in n)this.glyphSource.getSimpleGlyphs(a,n[a],t.uid,r)}})},{"../render/line_atlas":270,"../source/source":279,"../symbol/glyph_source":311,"../symbol/sprite_atlas":316,"../util/ajax":334,"../util/browser":335,"../util/dispatcher":337,"../util/evented":341,"../util/mapbox":346,"../util/util":349,"./animation_loop":287,"./image_sprite":288,"./style_function":292,"./style_layer":293,"./style_spec":300,"./validate_style":302}],291:[function(t,e,r){"use strict";function n(t,e){this.type=t.type,this.transitionable=t.transition,this.value=s.clone(e),this.isFunction=!!e.stops,this.json=JSON.stringify(this.value);var r="color"===this.type?a(this.value):e;if(this.calculate=o[t.function||"piecewise-constant"](r),this.isFeatureConstant=this.calculate.isFeatureConstant,this.isZoomConstant=this.calculate.isZoomConstant,"piecewise-constant"===t.function&&t.transition&&(this.calculate=i(this.calculate)),!this.isFeatureConstant&&!this.isZoomConstant){this.stopZoomLevels=[];for(var n=[],l=this.value.stops,u=0;u<this.value.stops.length;u++){var c=l[u][0].zoom;this.stopZoomLevels.indexOf(c)<0&&(this.stopZoomLevels.push(c),n.push([c,n.length]))}this.calculateInterpolationT=o.interpolated({stops:n,base:e.base})}}function i(t){return function(e,r){var n,i,o,a=e.zoom,s=e.zoomHistory,l=e.duration,u=a%1,c=Math.min((Date.now()-s.lastIntegerZoomTime)/l,1),h=1,f=1;return a>s.lastIntegerZoom?(n=u+(1-u)*c,h*=2,i=t({zoom:a-1},r),o=t({zoom:a},r)):(n=1-(1-c)*u,o=t({zoom:a},r),i=t({zoom:a+1},r),h/=2),{from:i,fromScale:h,to:o,toScale:f,t:n}}}var o=t("./style_function"),a=t("./parse_color"),s=t("../util/util");e.exports=n},{"../util/util":349,"./parse_color":289,"./style_function":292}],292:[function(t,e,r){"use strict";var n=t("mapbox-gl-function");r.interpolated=function(t){var e=n.interpolated(t),r=function(t,r){return e(t&&t.zoom,r||{})};return r.isFeatureConstant=e.isFeatureConstant,r.isZoomConstant=e.isZoomConstant,r},r["piecewise-constant"]=function(t){var e=n["piecewise-constant"](t),r=function(t,r){return e(t&&t.zoom,r||{})};return r.isFeatureConstant=e.isFeatureConstant,r.isZoomConstant=e.isZoomConstant,r},r.isFunctionDefinition=n.isFunctionDefinition},{"mapbox-gl-function":374}],293:[function(t,e,r){"use strict";function n(t,e){this.set(t,e)}function i(t){return t.value}var o=t("../util/util"),a=t("./style_transition"),s=t("./style_declaration"),l=t("./style_spec"),u=t("./validate_style"),c=t("./parse_color"),h=t("../util/evented");e.exports=n;var f="-transition";n.create=function(e,r){var n={background:t("./style_layer/background_style_layer"),circle:t("./style_layer/circle_style_layer"),fill:t("./style_layer/fill_style_layer"),line:t("./style_layer/line_style_layer"),raster:t("./style_layer/raster_style_layer"),symbol:t("./style_layer/symbol_style_layer")};return new n[(r||e).type](e,r)},n.prototype=o.inherit(h,{set:function(t,e){this.id=t.id,this.ref=t.ref,this.metadata=t.metadata,this.type=(e||t).type,this.source=(e||t).source,this.sourceLayer=(e||t)["source-layer"],this.minzoom=(e||t).minzoom,this.maxzoom=(e||t).maxzoom,this.filter=(e||t).filter,this.paint={},this.layout={},this._paintSpecifications=l["paint_"+this.type],this._layoutSpecifications=l["layout_"+this.type],this._paintTransitions={},this._paintTransitionOptions={},this._paintDeclarations={},this._layoutDeclarations={},this._layoutFunctions={};var r,n;for(var i in t){var o=i.match(/^paint(?:\.(.*))?/);if(o){var a=o[1]||"";for(r in t[i])this.setPaintProperty(r,t[i][r],a)}}if(this.ref)this._layoutDeclarations=e._layoutDeclarations;else for(n in t.layout)this.setLayoutProperty(n,t.layout[n]);for(r in this._paintSpecifications)this.paint[r]=this.getPaintValue(r); for(n in this._layoutSpecifications)this._updateLayoutValue(n)},setLayoutProperty:function(t,e){if(null==e)delete this._layoutDeclarations[t];else{var r="layers."+this.id+".layout."+t;if(this._handleErrors(u.layoutProperty,r,t,e))return;this._layoutDeclarations[t]=new s(this._layoutSpecifications[t],e)}this._updateLayoutValue(t)},getLayoutProperty:function(t){return this._layoutDeclarations[t]&&this._layoutDeclarations[t].value},getLayoutValue:function(t,e,r){var n=this._layoutSpecifications[t],i=this._layoutDeclarations[t];return i?i.calculate(e,r):n.default},setPaintProperty:function(t,e,r){var n="layers."+this.id+(r?'["paint.'+r+'"].':".paint.")+t;if(o.endsWith(t,f))if(this._paintTransitionOptions[r||""]||(this._paintTransitionOptions[r||""]={}),null===e||void 0===e)delete this._paintTransitionOptions[r||""][t];else{if(this._handleErrors(u.paintProperty,n,t,e))return;this._paintTransitionOptions[r||""][t]=e}else if(this._paintDeclarations[r||""]||(this._paintDeclarations[r||""]={}),null===e||void 0===e)delete this._paintDeclarations[r||""][t];else{if(this._handleErrors(u.paintProperty,n,t,e))return;this._paintDeclarations[r||""][t]=new s(this._paintSpecifications[t],e)}},getPaintProperty:function(t,e){return e=e||"",o.endsWith(t,f)?this._paintTransitionOptions[e]&&this._paintTransitionOptions[e][t]:this._paintDeclarations[e]&&this._paintDeclarations[e][t]&&this._paintDeclarations[e][t].value},getPaintValue:function(t,e,r){var n=this._paintSpecifications[t],i=this._paintTransitions[t];return i?i.calculate(e,r):"color"===n.type&&n.default?c(n.default):n.default},getPaintValueStopZoomLevels:function(t){var e=this._paintTransitions[t];return e?e.declaration.stopZoomLevels:[]},getPaintInterpolationT:function(t,e){var r=this._paintTransitions[t];return r.declaration.calculateInterpolationT({zoom:e})},isPaintValueFeatureConstant:function(t){var e=this._paintTransitions[t];return e?e.declaration.isFeatureConstant:!0},isPaintValueZoomConstant:function(t){var e=this._paintTransitions[t];return e?e.declaration.isZoomConstant:!0},isHidden:function(t){return this.minzoom&&t<this.minzoom?!0:this.maxzoom&&t>=this.maxzoom?!0:"none"===this.layout.visibility?!0:0===this.paint[this.type+"-opacity"]},updatePaintTransitions:function(t,e,r,n){for(var i=o.extend({},this._paintDeclarations[""]),a=0;a<t.length;a++)o.extend(i,this._paintDeclarations[t[a]]);var s;for(s in i)this._applyPaintDeclaration(s,i[s],e,r,n);for(s in this._paintTransitions)s in i||this._applyPaintDeclaration(s,null,e,r,n)},updatePaintTransition:function(t,e,r,n,i){for(var o=this._paintDeclarations[""][t],a=0;a<e.length;a++){var s=this._paintDeclarations[e[a]];s&&s[t]&&(o=s[t])}this._applyPaintDeclaration(t,o,r,n,i)},recalculate:function(t,e){for(var r in this._paintTransitions)this.paint[r]=this.getPaintValue(r,{zoom:t,zoomHistory:e});for(var n in this._layoutFunctions)this.layout[n]=this.getLayoutValue(n,{zoom:t,zoomHistory:e})},serialize:function(t){var e={id:this.id,ref:this.ref,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom};for(var r in this._paintDeclarations){var n=""===r?"paint":"paint."+r;e[n]=o.mapObject(this._paintDeclarations[r],i)}return(!this.ref||t&&t.includeRefProperties)&&o.extend(e,{type:this.type,source:this.source,"source-layer":this.sourceLayer,filter:this.filter,layout:o.mapObject(this._layoutDeclarations,i)}),o.filterObject(e,function(t,e){return void 0!==t&&!("layout"===e&&!Object.keys(t).length)})},_applyPaintDeclaration:function(t,e,r,n,i){var l=r.transition?this._paintTransitions[t]:void 0;if(null===e||void 0===e){var u=this._paintSpecifications[t];e=new s(u,u.default)}if(!l||l.declaration.json!==e.json){var c=o.extend({duration:300,delay:0},n,this.getPaintProperty(t+f)),h=this._paintTransitions[t]=new a(e,l,c);h.instant()||(h.loopID=i.set(h.endTime-Date.now())),l&&i.cancel(l.loopID)}},_updateLayoutValue:function(t){var e=this._layoutDeclarations[t];e&&e.isFunction?this._layoutFunctions[t]=!0:(delete this._layoutFunctions[t],this.layout[t]=this.getLayoutValue(t))},_handleErrors:function(t,e,r,n){return u.emitErrors(this,t.call(u,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:l,style:{glyphs:!0,sprite:!0}}))}})},{"../util/evented":341,"../util/util":349,"./parse_color":289,"./style_declaration":291,"./style_layer/background_style_layer":294,"./style_layer/circle_style_layer":295,"./style_layer/fill_style_layer":296,"./style_layer/line_style_layer":297,"./style_layer/raster_style_layer":298,"./style_layer/symbol_style_layer":299,"./style_spec":300,"./style_transition":301,"./validate_style":302}],294:[function(t,e,r){"use strict";function n(){o.apply(this,arguments)}var i=t("../../util/util"),o=t("../style_layer");e.exports=n,n.prototype=i.inherit(o,{})},{"../../util/util":349,"../style_layer":293}],295:[function(t,e,r){"use strict";function n(){o.apply(this,arguments)}var i=t("../../util/util"),o=t("../style_layer");e.exports=n,n.prototype=i.inherit(o,{})},{"../../util/util":349,"../style_layer":293}],296:[function(t,e,r){"use strict";function n(){o.apply(this,arguments)}var i=t("../../util/util"),o=t("../style_layer");e.exports=n,n.prototype=i.inherit(o,{})},{"../../util/util":349,"../style_layer":293}],297:[function(t,e,r){"use strict";function n(){o.apply(this,arguments)}var i=t("../../util/util"),o=t("../style_layer");e.exports=n,n.prototype=i.inherit(o,{getPaintValue:function(t,e,r){var n=o.prototype.getPaintValue.apply(this,arguments);if(n&&"line-dasharray"===t){var i=Math.floor(e.zoom);this._flooredZoom!==i&&(this._flooredZoom=i,this._flooredLineWidth=this.getPaintValue("line-width",e,r)),n.fromScale*=this._flooredLineWidth,n.toScale*=this._flooredLineWidth}return n}})},{"../../util/util":349,"../style_layer":293}],298:[function(t,e,r){"use strict";function n(){o.apply(this,arguments)}var i=t("../../util/util"),o=t("../style_layer");e.exports=n,n.prototype=i.inherit(o,{})},{"../../util/util":349,"../style_layer":293}],299:[function(t,e,r){"use strict";function n(){o.apply(this,arguments)}var i=t("../../util/util"),o=t("../style_layer");e.exports=n,n.prototype=i.inherit(o,{isHidden:function(){if(o.prototype.isHidden.apply(this,arguments))return!0;var t=0===this.paint["text-opacity"]||!this.layout["text-field"],e=0===this.paint["icon-opacity"]||!this.layout["icon-image"];return!(!t||!e)},getLayoutValue:function(t,e,r){return("text-rotation-alignment"!==t||"line"!==this.getLayoutValue("symbol-placement",e,r)||this.getLayoutProperty("text-rotation-alignment"))&&("icon-rotation-alignment"!==t||"line"!==this.getLayoutValue("symbol-placement",e,r)||this.getLayoutProperty("icon-rotation-alignment"))?o.prototype.getLayoutValue.apply(this,arguments):"map"}})},{"../../util/util":349,"../style_layer":293}],300:[function(t,e,r){"use strict";e.exports=t("mapbox-gl-style-spec/reference/latest")},{"mapbox-gl-style-spec/reference/latest":397}],301:[function(t,e,r){"use strict";function n(t,e,r){this.declaration=t,this.startTime=this.endTime=(new Date).getTime();var n=t.type;"string"!==n&&"array"!==n||!t.transitionable?this.interp=a[n]:this.interp=i,this.oldTransition=e,this.duration=r.duration||0,this.delay=r.delay||0,this.instant()||(this.endTime=this.startTime+this.duration+this.delay,this.ease=o.easeCubicInOut),e&&e.endTime<=this.startTime&&delete e.oldTransition}function i(t,e,r){return{from:t.to,fromScale:t.toScale,to:e.to,toScale:e.toScale,t:r}}var o=t("../util/util"),a=t("../util/interpolate");e.exports=n,n.prototype.instant=function(){return!this.oldTransition||!this.interp||0===this.duration&&0===this.delay},n.prototype.calculate=function(t,e){var r=this.declaration.calculate(o.extend({},t,{duration:this.duration}),e);if(this.instant())return r;var n=t.time||Date.now();if(n<this.endTime){var i=this.oldTransition.calculate(o.extend({},t,{time:this.startTime}),e),a=this.ease((n-this.startTime-this.delay)/this.duration);r=this.interp(i,r,a)}return r}},{"../util/interpolate":343,"../util/util":349}],302:[function(t,e,r){"use strict";e.exports=t("mapbox-gl-style-spec/lib/validate_style.min"),e.exports.emitErrors=function(t,e){if(e&&e.length){for(var r=0;r<e.length;r++)t.fire("error",{error:new Error(e[r].message)});return!0}return!1},e.exports.throwErrors=function(t,e){if(e)for(var r=0;r<e.length;r++)throw new Error(e[r].message)}},{"mapbox-gl-style-spec/lib/validate_style.min":396}],303:[function(t,e,r){"use strict";function n(t,e,r,n){this.x=t,this.y=e,this.angle=r,void 0!==n&&(this.segment=n)}var i=t("point-geometry");e.exports=n,n.prototype=Object.create(i.prototype),n.prototype.clone=function(){return new n(this.x,this.y,this.angle,this.segment)}},{"point-geometry":404}],304:[function(t,e,r){"use strict";function n(t,e,r,n,i){if(void 0===e.segment)return!0;for(var o=e,a=e.segment+1,s=0;s>-r/2;){if(a--,0>a)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;for(var l=[],u=0;r/2>s;){var c=t[a-1],h=t[a],f=t[a+1];if(!f)return!1;var d=c.angleTo(h)-h.angleTo(f);for(d=Math.abs((d+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:d}),u+=d;s-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;a++,s+=h.dist(f)}return!0}e.exports=n},{}],305:[function(t,e,r){"use strict";function n(t,e,r,n,o){for(var a=[],s=0;s<t.length;s++)for(var l,u=t[s],c=0;c<u.length-1;c++){var h=u[c],f=u[c+1];h.x<e&&f.x<e||(h.x<e?h=new i(e,h.y+(f.y-h.y)*((e-h.x)/(f.x-h.x)))._round():f.x<e&&(f=new i(e,h.y+(f.y-h.y)*((e-h.x)/(f.x-h.x)))._round()),h.y<r&&f.y<r||(h.y<r?h=new i(h.x+(f.x-h.x)*((r-h.y)/(f.y-h.y)),r)._round():f.y<r&&(f=new i(h.x+(f.x-h.x)*((r-h.y)/(f.y-h.y)),r)._round()),h.x>=n&&f.x>=n||(h.x>=n?h=new i(n,h.y+(f.y-h.y)*((n-h.x)/(f.x-h.x)))._round():f.x>=n&&(f=new i(n,h.y+(f.y-h.y)*((n-h.x)/(f.x-h.x)))._round()),h.y>=o&&f.y>=o||(h.y>=o?h=new i(h.x+(f.x-h.x)*((o-h.y)/(f.y-h.y)),o)._round():f.y>=o&&(f=new i(h.x+(f.x-h.x)*((o-h.y)/(f.y-h.y)),o)._round()),l&&h.equals(l[l.length-1])||(l=[h],a.push(l)),l.push(f)))))}return a}var i=t("point-geometry");e.exports=n},{"point-geometry":404}],306:[function(t,e,r){"use strict";var n=t("../util/struct_array"),i=t("../util/util"),o=t("point-geometry"),a=e.exports=new n({members:[{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Float32",name:"maxScale"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"bbox0"},{type:"Int16",name:"bbox1"},{type:"Int16",name:"bbox2"},{type:"Int16",name:"bbox3"},{type:"Float32",name:"placementScale"}]});i.extendAll(a.prototype.StructType.prototype,{get anchorPoint(){return new o(this.anchorPointX,this.anchorPointY)}})},{"../util/struct_array":347,"../util/util":349,"point-geometry":404}],307:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s,l,u,c){var h=a.top*s-l,f=a.bottom*s+l,d=a.left*s-l,p=a.right*s+l;if(this.boxStartIndex=t.length,u){var v=f-h,m=p-d;if(v>0)if(v=Math.max(10*s,v),c){var g=e[r.segment+1].sub(e[r.segment])._unit()._mult(m),y=[r.sub(g),r.add(g)];this._addLineCollisionBoxes(t,y,r,0,m,v,n,i,o)}else this._addLineCollisionBoxes(t,e,r,r.segment,m,v,n,i,o)}else t.emplaceBack(r.x,r.y,d,h,p,f,1/0,n,i,o,0,0,0,0,0);this.boxEndIndex=t.length}e.exports=n,n.prototype._addLineCollisionBoxes=function(t,e,r,n,i,o,a,s,l){var u=o/2,c=Math.floor(i/u),h=-o/2,f=this.boxes,d=r,p=n+1,v=h;do{if(p--,0>p)return f;v-=e[p].dist(d),d=e[p]}while(v>-i/2);for(var m=e[p].dist(e[p+1]),g=0;c>g;g++){for(var y=-i/2+g*u;y>v+m;){if(v+=m,p++,p+1>=e.length)return f;m=e[p].dist(e[p+1])}var b=y-v,x=e[p],_=e[p+1],w=_.sub(x)._unit()._mult(b)._add(x)._round(),M=Math.max(Math.abs(y-h)-u/2,0),k=i/2/M;t.emplaceBack(w.x,w.y,-o/2,-o/2,o/2,o/2,k,a,s,l,0,0,0,0,0)}return f}},{}],308:[function(t,e,r){"use strict";function n(t,e,r){if("object"==typeof t){var n=t;r=e,t=n.angle,e=n.pitch,this.grid=new a(n.grid),this.ignoredGrid=new a(n.ignoredGrid)}else this.grid=new a(o,12,6),this.ignoredGrid=new a(o,12,0);this.angle=t,this.pitch=e;var i=Math.sin(t),s=Math.cos(t);if(this.rotationMatrix=[s,-i,i,s],this.reverseRotationMatrix=[s,i,-i,s],this.yStretch=1/Math.cos(e/180*Math.PI),this.yStretch=Math.pow(this.yStretch,1.3),this.collisionBoxArray=r,0===r.length){r.emplaceBack();var l=32767;r.emplaceBack(0,0,0,-l,0,l,l,0,0,0,0,0,0,0,0,0),r.emplaceBack(o,0,0,-l,0,l,l,0,0,0,0,0,0,0,0,0),r.emplaceBack(0,0,-l,0,l,0,l,0,0,0,0,0,0,0,0,0),r.emplaceBack(0,o,-l,0,l,0,l,0,0,0,0,0,0,0,0,0)}this.tempCollisionBox=r.get(0),this.edges=[r.get(1),r.get(2),r.get(3),r.get(4)]}var i=t("point-geometry"),o=t("../data/bucket").EXTENT,a=t("grid-index");e.exports=n,n.prototype.serialize=function(){var t={angle:this.angle,pitch:this.pitch,grid:this.grid.toArrayBuffer(),ignoredGrid:this.ignoredGrid.toArrayBuffer()};return{data:t,transferables:[t.grid,t.ignoredGrid]}},n.prototype.minScale=.25,n.prototype.maxScale=2,n.prototype.placeCollisionFeature=function(t,e,r){for(var n=this.collisionBoxArray,o=this.minScale,a=this.rotationMatrix,s=this.yStretch,l=t.boxStartIndex;l<t.boxEndIndex;l++){var u=n.get(l),c=u.anchorPoint._matMult(a),h=c.x,f=c.y,d=h+u.x1,p=f+u.y1*s,v=h+u.x2,m=f+u.y2*s;if(u.bbox0=d,u.bbox1=p,u.bbox2=v,u.bbox3=m,!e)for(var g=this.grid.query(d,p,v,m),y=0;y<g.length;y++){var b=n.get(g[y]),x=b.anchorPoint._matMult(a);if(o=this.getPlacementScale(o,c,u,x,b),o>=this.maxScale)return o}if(r){var _;if(this.angle){var w=this.reverseRotationMatrix,M=new i(u.x1,u.y1).matMult(w),k=new i(u.x2,u.y1).matMult(w),A=new i(u.x1,u.y2).matMult(w),T=new i(u.x2,u.y2).matMult(w);_=this.tempCollisionBox,_.anchorPointX=u.anchorPoint.x,_.anchorPointY=u.anchorPoint.y,_.x1=Math.min(M.x,k.x,A.x,T.x),_.y1=Math.min(M.y,k.x,A.x,T.x),_.x2=Math.max(M.x,k.x,A.x,T.x),_.y2=Math.max(M.y,k.x,A.x,T.x),_.maxScale=u.maxScale}else _=u;for(var E=0;E<this.edges.length;E++){var S=this.edges[E];if(o=this.getPlacementScale(o,u.anchorPoint,_,S.anchorPoint,S),o>=this.maxScale)return o}}}return o},n.prototype.queryRenderedSymbols=function(t,e,r,n,o){var a={},s=[],l=this.collisionBoxArray,u=this.rotationMatrix,c=new i(t,e)._matMult(u),h=this.tempCollisionBox;h.anchorX=c.x,h.anchorY=c.y,h.x1=0,h.y1=0,h.x2=r-t,h.y2=n-e,h.maxScale=o,o=h.maxScale;for(var f=[c.x+h.x1/o,c.y+h.y1/o*this.yStretch,c.x+h.x2/o,c.y+h.y2/o*this.yStretch],d=this.grid.query(f[0],f[1],f[2],f[3]),p=this.ignoredGrid.query(f[0],f[1],f[2],f[3]),v=0;v<p.length;v++)d.push(p[v]);for(var m=0;m<d.length;m++){var g=l.get(d[m]),y=g.sourceLayerIndex,b=g.featureIndex;if(void 0===a[y]&&(a[y]={}),!a[y][b]){var x=g.anchorPoint.matMult(u),_=this.getPlacementScale(this.minScale,c,h,x,g);_>=o&&(a[y][b]=!0,s.push(d[m]))}}return s},n.prototype.getPlacementScale=function(t,e,r,n,i){var o=e.x-n.x,a=e.y-n.y,s=(i.x1-r.x2)/o,l=(i.x2-r.x1)/o,u=(i.y1-r.y2)*this.yStretch/a,c=(i.y2-r.y1)*this.yStretch/a;(isNaN(s)||isNaN(l))&&(s=l=1),(isNaN(u)||isNaN(c))&&(u=c=1);var h=Math.min(Math.max(s,l),Math.max(u,c)),f=i.maxScale,d=r.maxScale;return h>f&&(h=f),h>d&&(h=d),h>t&&h>=i.placementScale&&(t=h),t},n.prototype.insertCollisionFeature=function(t,e,r){for(var n=r?this.ignoredGrid:this.grid,i=this.collisionBoxArray,o=t.boxStartIndex;o<t.boxEndIndex;o++){var a=i.get(o);a.placementScale=e,e<this.maxScale&&n.insert(o,a.bbox0,a.bbox1,a.bbox2,a.bbox3)}}},{"../data/bucket":247,"grid-index":373,"point-geometry":404}],309:[function(t,e,r){"use strict";function n(t,e,r,n,o,a,s,l,u){var c=n?.6*a*s:0,h=Math.max(n?n.right-n.left:0,o?o.right-o.left:0),f=0===t[0].x||t[0].x===u||0===t[0].y||t[0].y===u;e/4>e-h*s&&(e=h*s+e/4);var d=2*a,p=f?e/2*l%e:(h/2+d)*s*l%e;return i(t,p,e,c,r,h*s,f,!1,u)}function i(t,e,r,n,l,u,c,h,f){for(var d=u/2,p=0,v=0;v<t.length-1;v++)p+=t[v].dist(t[v+1]);for(var m=0,g=e-r,y=[],b=0;b<t.length-1;b++){for(var x=t[b],_=t[b+1],w=x.dist(_),M=_.angleTo(x);m+w>g+r;){g+=r;var k=(g-m)/w,A=o(x.x,_.x,k),T=o(x.y,_.y,k);if(A>=0&&f>A&&T>=0&&f>T&&g-d>=0&&p>=g+d){var E=new a(A,T,M,b)._round();n&&!s(t,E,u,n,l)||y.push(E)}}m+=w}return h||y.length||c||(y=i(t,m/2,r,n,l,u,c,!0,f)),y}var o=t("../util/interpolate"),a=t("../symbol/anchor"),s=t("./check_max_angle");e.exports=n},{"../symbol/anchor":303,"../util/interpolate":343,"./check_max_angle":304}],310:[function(t,e,r){"use strict";function n(t,e){this.width=t,this.height=e,this.bin=new i(t,e),this.index={},this.ids={},this.data=new Uint8Array(t*e)}var i=t("shelf-pack");e.exports=n,n.prototype.getGlyphs=function(){var t,e,r,n={};for(var i in this.ids)t=i.split("#"),e=t[0],r=t[1],n[e]||(n[e]=[]),n[e].push(r);return n},n.prototype.getRects=function(){var t,e,r,n={};for(var i in this.ids)t=i.split("#"),e=t[0],r=t[1],n[e]||(n[e]={}),n[e][r]=this.index[i];return n},n.prototype.addGlyph=function(t,e,r,n){if(!r)return null;var i=e+"#"+r.id;if(this.index[i])return this.ids[i].indexOf(t)<0&&this.ids[i].push(t),this.index[i];if(!r.bitmap)return null;var o=r.width+2*n,a=r.height+2*n,s=1,l=o+2*s,u=a+2*s;l+=4-l%4,u+=4-u%4;var c=this.bin.packOne(l,u);if(c||(this.resize(),c=this.bin.packOne(l,u)),!c)return console.warn("glyph bitmap overflow"),null;this.index[i]=c,this.ids[i]=[t];for(var h=this.data,f=r.bitmap,d=0;a>d;d++)for(var p=this.width*(c.y+d+s)+c.x+s,v=o*d,m=0;o>m;m++)h[p+m]=f[v+m];return this.dirty=!0,c},n.prototype.resize=function(){var t=this.width,e=this.height;if(!(t>512||e>512)){this.texture&&(this.gl&&this.gl.deleteTexture(this.texture),this.texture=null),this.width*=2,this.height*=2,this.bin.resize(this.width,this.height);for(var r,n,i=new ArrayBuffer(this.width*this.height),o=0;e>o;o++)r=new Uint8Array(this.data.buffer,e*o,t),n=new Uint8Array(i,e*o*2,t),n.set(r);this.data=new Uint8Array(i)}},n.prototype.bind=function(t){this.gl=t,this.texture?t.bindTexture(t.TEXTURE_2D,this.texture):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,null))},n.prototype.updateTexture=function(t){this.bind(t),this.dirty&&(t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data),this.dirty=!1)}},{"shelf-pack":406}],311:[function(t,e,r){"use strict";function n(t){this.url=t&&a(t),this.atlases={},this.stacks={},this.loading={}}function i(t,e,r){var n=1;this.advance=t.advance,this.left=t.left-r-n,this.top=t.top+r+n,this.rect=e}function o(t,e,r,n){return n=n||"abc",r.replace("{s}",n[t.length%n.length]).replace("{fontstack}",t).replace("{range}",e)}var a=t("../util/mapbox").normalizeGlyphsURL,s=t("../util/ajax").getArrayBuffer,l=t("../util/glyphs"),u=t("../symbol/glyph_atlas"),c=t("pbf");e.exports=n,n.prototype.getSimpleGlyphs=function(t,e,r,n){void 0===this.stacks[t]&&(this.stacks[t]={}),void 0===this.atlases[t]&&(this.atlases[t]=new u(128,128));for(var o,a={},s=this.stacks[t],l=this.atlases[t],c=3,h={},f=0,d=0;d<e.length;d++){var p=e[d];if(o=Math.floor(p/256),s[o]){var v=s[o].glyphs[p],m=l.addGlyph(r,t,v,c);v&&(a[p]=new i(v,m,c))}else void 0===h[o]&&(h[o]=[],f++),h[o].push(p)}f||n(void 0,a,t);var g=function(e,o,s){if(!e)for(var u=this.stacks[t][o]=s.stacks[0],d=0;d<h[o].length;d++){var p=h[o][d],v=u.glyphs[p],m=l.addGlyph(r,t,v,c);v&&(a[p]=new i(v,m,c))}f--,f||n(void 0,a,t)}.bind(this);for(var y in h)this.loadRange(t,y,g)},n.prototype.loadRange=function(t,e,r){if(256*e>65535)return r("glyphs > 65535 not supported");void 0===this.loading[t]&&(this.loading[t]={});var n=this.loading[t];if(n[e])n[e].push(r);else{n[e]=[r];var i=256*e+"-"+(256*e+255),a=o(t,i,this.url);s(a,function(t,r){for(var i=!t&&new l(new c(new Uint8Array(r))),o=0;o<n[e].length;o++)n[e][o](t,e,i);delete n[e]})}},n.prototype.getGlyphAtlas=function(t){return this.atlases[t]}},{"../symbol/glyph_atlas":310,"../util/ajax":334,"../util/glyphs":342,"../util/mapbox":346,pbf:402}],312:[function(t,e,r){"use strict";e.exports=function(t,e,r){function n(n){c.push(t[n]),h.push(r[n]),f.push(e[n]),d++}function i(t,e,r){var n=u[t];return delete u[t],u[e]=n,h[n][0].pop(),h[n][0]=h[n][0].concat(r[0]),n}function o(t,e,r){var n=l[e];return delete l[e],l[t]=n,h[n][0].shift(),h[n][0]=r[0].concat(h[n][0]),n}function a(t,e,r){var n=r?e[0][e[0].length-1]:e[0][0];return t+":"+n.x+":"+n.y}var s,l={},u={},c=[],h=[],f=[],d=0;for(s=0;s<t.length;s++){var p=r[s],v=e[s];if(v){var m=a(v,p),g=a(v,p,!0);if(m in u&&g in l&&u[m]!==l[g]){var y=o(m,g,p),b=i(m,g,h[y]);delete l[m],delete u[g],u[a(v,h[b],!0)]=b,h[y]=null}else m in u?i(m,g,p):g in l?o(m,g,p):(n(s),l[m]=d-1,u[g]=d-1)}else n(s)}return{features:c,textFeatures:f,geometries:h}}},{}],313:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s,l){this.anchorPoint=t,this.tl=e,this.tr=r,this.bl=n,this.br=i,this.tex=o,this.angle=a,this.minScale=s,this.maxScale=l}function i(t,e,r,i,o,a){var u=e.image.rect,c=1,h=e.left-c,f=h+u.w/e.image.pixelRatio,d=e.top-c,p=d+u.h/e.image.pixelRatio,v=new s(h,d),m=new s(f,d),g=new s(f,p),y=new s(h,p),b=o["icon-rotate"]*Math.PI/180;if(a){var x=i[t.segment];if(t.y===x.y&&t.x===x.x&&t.segment+1<i.length){var _=i[t.segment+1];b+=Math.atan2(t.y-_.y,t.x-_.x)+Math.PI}else b+=Math.atan2(t.y-x.y,t.x-x.x)}if(b){var w=Math.sin(b),M=Math.cos(b),k=[M,-w,w,M];v=v.matMult(k),m=m.matMult(k),y=y.matMult(k),g=g.matMult(k)}return[new n(new s(t.x,t.y),v,m,y,g,e.image.rect,0,l,1/0)]}function o(t,e,r,i,o,u){for(var c=o["text-rotate"]*Math.PI/180,h=o["text-keep-upright"],f=e.positionedGlyphs,d=[],p=0;p<f.length;p++){var v=f[p],m=v.glyph,g=m.rect;if(g){var y,b=(v.x+m.advance/2)*r,x=l;u?(y=[],x=a(y,t,b,i,t.segment,!0),h&&(x=Math.min(x,a(y,t,b,i,t.segment,!1)))):y=[{anchorPoint:new s(t.x,t.y),offset:0,angle:0,maxScale:1/0,minScale:l}];for(var _=v.x+m.left,w=v.y-m.top,M=_+g.w,k=w+g.h,A=new s(_,w),T=new s(M,w),E=new s(_,k),S=new s(M,k),L=0;L<y.length;L++){var z=y[L],I=A,P=T,C=E,R=S,D=z.angle+c;if(D){var O=Math.sin(D),F=Math.cos(D),j=[F,-O,O,F];I=I.matMult(j),P=P.matMult(j),C=C.matMult(j),R=R.matMult(j)}var N=Math.max(z.minScale,x),B=(t.angle+c+z.offset+2*Math.PI)%(2*Math.PI);d.push(new n(z.anchorPoint,I,P,C,R,g,B,N,z.maxScale))}}}return d}function a(t,e,r,n,i,o){var a=!o;0>r&&(o=!o),o&&i++;var u=new s(e.x,e.y),c=n[i],h=1/0;r=Math.abs(r);for(var f=l;;){var d=u.dist(c),p=r/d,v=Math.atan2(c.y-u.y,c.x-u.x);if(o||(v+=Math.PI),a&&(v+=Math.PI),t.push({anchorPoint:u,offset:a?Math.PI:0,minScale:p,maxScale:h,angle:(v+2*Math.PI)%(2*Math.PI)}),f>=p)break;for(u=c;u.equals(c);)if(i+=o?1:-1,c=n[i],!c)return p;var m=c.sub(u)._unit();u=u.sub(m._mult(d)),h=p}return f}var s=t("point-geometry");e.exports={getIconQuads:i,getGlyphQuads:o};var l=.5},{"point-geometry":404}],314:[function(t,e,r){"use strict";function n(t,e,r){for(var n=[],o=0,a=t.length;a>o;o++){var s=i(t[o].properties,e["text-field"]);if(s){s=s.toString();var l=e["text-transform"];"uppercase"===l?s=s.toLocaleUpperCase():"lowercase"===l&&(s=s.toLocaleLowerCase());for(var u=0;u<s.length;u++)r[s.charCodeAt(u)]=!0;n[o]=s}else n[o]=null}return n}var i=t("../util/token");e.exports=n},{"../util/token":348}],315:[function(t,e,r){"use strict";function n(t,e,r,n){this.codePoint=t,this.x=e,this.y=r,this.glyph=n}function i(t,e,r,n,i,o){this.positionedGlyphs=t,this.text=e,this.top=r,this.bottom=n,this.left=i,this.right=o}function o(t,e,r,o,s,l,u,c,h){for(var f=[],d=new i(f,t,h[1],h[1],h[0],h[0]),p=-17,v=0,m=p,g=0;g<t.length;g++){var y=t.charCodeAt(g),b=e[y];b&&(f.push(new n(y,v,m,b)),v+=b.advance+c)}return f.length?(a(d,e,o,r,s,l,u,h),d):!1}function a(t,e,r,n,i,o,a,u){var c=null,d=0,p=0,v=0,m=0,g=t.positionedGlyphs;if(n)for(var y=0;y<g.length;y++){var b=g[y];if(b.x-=d,b.y+=r*v,b.x>n&&null!==c){var x=g[c+1].x;m=Math.max(x,m);for(var _=c+1;y>=_;_++)g[_].y+=r,g[_].x-=x;if(a){var w=c;h[g[c].codePoint]&&w--,s(g,e,p,w,a)}p=c+1,c=null,d+=x,v++}f[b.codePoint]&&(c=y)}var M=g[g.length-1],k=M.x+e[M.codePoint].advance;m=Math.max(m,k);var A=(v+1)*r;s(g,e,p,g.length-1,a),l(g,a,i,o,m,r,v,u),t.top+=-o*A,t.bottom=t.top+A,t.left+=-i*m,t.right=t.left+m}function s(t,e,r,n,i){for(var o=e[t[n].codePoint].advance,a=(t[n].x+o)*i,s=r;n>=s;s++)t[s].x-=a}function l(t,e,r,n,i,o,a,s){for(var l=(e-r)*i+s[0],u=(-n*(a+1)+.5)*o+s[1],c=0;c<t.length;c++)t[c].x+=l,t[c].y+=u}function u(t,e){if(!t||!t.rect)return null;var r=e["icon-offset"][0],n=e["icon-offset"][1],i=r-t.width/2,o=i+t.width,a=n-t.height/2,s=a+t.height;return new c(t,a,s,i,o)}function c(t,e,r,n,i){this.image=t,this.top=e,this.bottom=r,this.left=n,this.right=i}e.exports={shapeText:o,shapeIcon:u};var h={32:!0,8203:!0},f={32:!0,38:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0}},{}],316:[function(t,e,r){"use strict";function n(t,e){this.width=t,this.height=e,this.bin=new a(t,e),this.images={},this.data=!1,this.texture=0,this.filter=0,this.pixelRatio=1,this.dirty=!0}function i(t,e,r,n,i,o,a,s,l,u,c){var h,f,d=n*e+r,p=s*o+a;if(c)for(p-=o,f=-1;u>=f;f++,d=((f+u)%u+n)*e+r,p+=o)for(h=-1;l>=h;h++)i[p+h]=t[d+(h+l)%l];else for(f=0;u>f;f++,d+=e,p+=o)for(h=0;l>h;h++)i[p+h]=t[d+h]}function o(t,e,r,n,i){this.rect=t,this.width=e,this.height=r,this.sdf=n,this.pixelRatio=i}var a=t("shelf-pack"),s=t("../util/browser");e.exports=n,n.prototype.allocateImage=function(t,e){t/=this.pixelRatio,e/=this.pixelRatio;var r=2,n=t+r+(4-(t+r)%4),i=e+r+(4-(e+r)%4),o=this.bin.packOne(n,i);return o?o:(console.warn("SpriteAtlas out of space."),null)},n.prototype.getImage=function(t,e){if(this.images[t])return this.images[t];if(!this.sprite)return null;var r=this.sprite.getSpritePosition(t);if(!r.width||!r.height)return null;var n=this.allocateImage(r.width,r.height);if(!n)return null;var i=new o(n,r.width/r.pixelRatio,r.height/r.pixelRatio,r.sdf,r.pixelRatio/this.pixelRatio);return this.images[t]=i,this.copy(n,r,e),i},n.prototype.getPosition=function(t,e){var r=this.getImage(t,e),n=r&&r.rect;if(!n)return null;var i=r.width*r.pixelRatio,o=r.height*r.pixelRatio,a=1;return{size:[r.width,r.height],tl:[(n.x+a)/this.width,(n.y+a)/this.height],br:[(n.x+a+i)/this.width,(n.y+a+o)/this.height]}},n.prototype.allocate=function(){if(!this.data){var t=Math.floor(this.width*this.pixelRatio),e=Math.floor(this.height*this.pixelRatio);this.data=new Uint32Array(t*e);for(var r=0;r<this.data.length;r++)this.data[r]=0}},n.prototype.copy=function(t,e,r){if(this.sprite.img.data){var n=new Uint32Array(this.sprite.img.data.buffer);this.allocate();var o=this.data,a=1;i(n,this.sprite.img.width,e.x,e.y,o,this.width*this.pixelRatio,(t.x+a)*this.pixelRatio,(t.y+a)*this.pixelRatio,e.width,e.height,r),this.dirty=!0}},n.prototype.setSprite=function(t){t&&(this.pixelRatio=s.devicePixelRatio>1?2:1,this.canvas&&(this.canvas.width=this.width*this.pixelRatio,this.canvas.height=this.height*this.pixelRatio)),this.sprite=t},n.prototype.addIcons=function(t,e){for(var r=0;r<t.length;r++)this.getImage(t[r]);e(null,this.images)},n.prototype.bind=function(t,e){var r=!1;this.texture?t.bindTexture(t.TEXTURE_2D,this.texture):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),r=!0);var n=e?t.LINEAR:t.NEAREST;n!==this.filter&&(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,n),this.filter=n),this.dirty&&(this.allocate(),r?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width*this.pixelRatio,this.height*this.pixelRatio,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(this.data.buffer)):t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width*this.pixelRatio,this.height*this.pixelRatio,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(this.data.buffer)),this.dirty=!1)}},{"../util/browser":335,"shelf-pack":406}],317:[function(t,e,r){"use strict";var n=t("../util/util"),i=t("../util/interpolate"),o=t("../util/browser"),a=t("../geo/lng_lat"),s=t("../geo/lng_lat_bounds"),l=t("point-geometry"),u=e.exports=function(){};n.extend(u.prototype,{getCenter:function(){return this.transform.center},setCenter:function(t,e){return this.jumpTo({center:t},e),this},panBy:function(t,e,r){return this.panTo(this.transform.center,n.extend({offset:l.convert(t).mult(-1)},e),r),this},panTo:function(t,e,r){return this.easeTo(n.extend({center:t},e),r)},getZoom:function(){return this.transform.zoom},setZoom:function(t,e){return this.jumpTo({zoom:t},e),this},zoomTo:function(t,e,r){return this.easeTo(n.extend({zoom:t},e),r)},zoomIn:function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},zoomOut:function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},getBearing:function(){return this.transform.bearing},setBearing:function(t,e){return this.jumpTo({bearing:t},e),this},rotateTo:function(t,e,r){return this.easeTo(n.extend({bearing:t},e),r)},resetNorth:function(t,e){return this.rotateTo(0,n.extend({duration:1e3},t),e),this},snapToNorth:function(t,e){return Math.abs(this.getBearing())<this.options.bearingSnap?this.resetNorth(t,e):this},getPitch:function(){return this.transform.pitch},setPitch:function(t,e){return this.jumpTo({pitch:t},e),this},fitBounds:function(t,e,r){e=n.extend({padding:0,offset:[0,0],maxZoom:1/0},e),t=s.convert(t);var i=l.convert(e.offset),o=this.transform,a=o.project(t.getNorthWest()),u=o.project(t.getSouthEast()),c=u.sub(a),h=(o.width-2*e.padding-2*Math.abs(i.x))/c.x,f=(o.height-2*e.padding-2*Math.abs(i.y))/c.y;return e.center=o.unproject(a.add(u).div(2)),e.zoom=Math.min(o.scaleZoom(o.scale*Math.min(h,f)),e.maxZoom),e.bearing=0,e.linear?this.easeTo(e,r):this.flyTo(e,r)},jumpTo:function(t,e){this.stop();var r=this.transform,n=!1,i=!1,o=!1;return"zoom"in t&&r.zoom!==+t.zoom&&(n=!0,r.zoom=+t.zoom),"center"in t&&(r.center=a.convert(t.center)),"bearing"in t&&r.bearing!==+t.bearing&&(i=!0,r.bearing=+t.bearing),"pitch"in t&&r.pitch!==+t.pitch&&(o=!0,r.pitch=+t.pitch),this.fire("movestart",e).fire("move",e),n&&this.fire("zoomstart",e).fire("zoom",e).fire("zoomend",e),i&&this.fire("rotate",e),o&&this.fire("pitch",e),this.fire("moveend",e)},easeTo:function(t,e){this.stop(),t=n.extend({offset:[0,0],duration:500,easing:n.ease},t);var r,o,s=this.transform,u=l.convert(t.offset),c=this.getZoom(),h=this.getBearing(),f=this.getPitch(),d="zoom"in t?+t.zoom:c,p="bearing"in t?this._normalizeBearing(t.bearing,h):h,v="pitch"in t?+t.pitch:f;"center"in t?(r=a.convert(t.center),o=s.centerPoint.add(u)):"around"in t?(r=a.convert(t.around),o=s.locationPoint(r)):(o=s.centerPoint.add(u),r=s.pointLocation(o));var m=s.locationPoint(r);return t.animate===!1&&(t.duration=0),this.zooming=d!==c,this.rotating=h!==p,this.pitching=v!==f,t.noMoveStart||this.fire("movestart",e),this.zooming&&this.fire("zoomstart",e),clearTimeout(this._onEaseEnd),this._ease(function(t){this.zooming&&(s.zoom=i(c,d,t)),this.rotating&&(s.bearing=i(h,p,t)),this.pitching&&(s.pitch=i(f,v,t)),s.setLocationAtPoint(r,m.add(o.sub(m)._mult(t))),this.fire("move",e),this.zooming&&this.fire("zoom",e),this.rotating&&this.fire("rotate",e),this.pitching&&this.fire("pitch",e)},function(){t.delayEndEvents?this._onEaseEnd=setTimeout(this._easeToEnd.bind(this,e),t.delayEndEvents):this._easeToEnd(e)}.bind(this),t),this},_easeToEnd:function(t){this.zooming&&this.fire("zoomend",t),this.fire("moveend",t),this.zooming=!1,this.rotating=!1,this.pitching=!1},flyTo:function(t,e){function r(t){var e=(A*A-k*k+(t?-1:1)*L*L*T*T)/(2*(t?A:k)*L*T);return Math.log(Math.sqrt(e*e+1)-e)}function o(t){return(Math.exp(t)-Math.exp(-t))/2}function s(t){return(Math.exp(t)+Math.exp(-t))/2}function u(t){return o(t)/s(t)}this.stop(),t=n.extend({offset:[0,0],speed:1.2,curve:1.42,easing:n.ease},t);var c=this.transform,h=l.convert(t.offset),f=this.getZoom(),d=this.getBearing(),p=this.getPitch(),v="center"in t?a.convert(t.center):this.getCenter(),m="zoom"in t?+t.zoom:f,g="bearing"in t?this._normalizeBearing(t.bearing,d):d,y="pitch"in t?+t.pitch:p;Math.abs(c.center.lng)+Math.abs(v.lng)>180&&(c.center.lng>0&&v.lng<0?v.lng+=360:c.center.lng<0&&v.lng>0&&(v.lng-=360));var b=c.zoomScale(m-f),x=c.point,_="center"in t?c.project(v).sub(h.div(b)):x,w=c.worldSize,M=t.curve,k=Math.max(c.width,c.height),A=k/b,T=_.sub(x).mag(); if("minZoom"in t){var E=n.clamp(Math.min(t.minZoom,f,m),c.minZoom,c.maxZoom),S=k/c.zoomScale(E-f);M=Math.sqrt(S/T*2)}var L=M*M,z=r(0),I=function(t){return s(z)/s(z+M*t)},P=function(t){return k*((s(z)*u(z+M*t)-o(z))/L)/T},C=(r(1)-z)/M;if(Math.abs(T)<1e-6){if(Math.abs(k-A)<1e-6)return this.easeTo(t);var R=k>A?-1:1;C=Math.abs(Math.log(A/k))/M,P=function(){return 0},I=function(t){return Math.exp(R*M*t)}}if("duration"in t)t.duration=+t.duration;else{var D="screenSpeed"in t?+t.screenSpeed/M:+t.speed;t.duration=1e3*C/D}return this.zooming=!0,d!==g&&(this.rotating=!0),p!==y&&(this.pitching=!0),this.fire("movestart",e),this.fire("zoomstart",e),this._ease(function(t){var r=t*C,n=P(r);c.zoom=f+c.scaleZoom(1/I(r)),c.center=c.unproject(x.add(_.sub(x).mult(n)),w),this.rotating&&(c.bearing=i(d,g,t)),this.pitching&&(c.pitch=i(p,y,t)),this.fire("move",e),this.fire("zoom",e),this.rotating&&this.fire("rotate",e),this.pitching&&this.fire("pitch",e)},function(){this.fire("zoomend",e),this.fire("moveend",e),this.zooming=!1,this.rotating=!1,this.pitching=!1},t),this},isEasing:function(){return!!this._abortFn},stop:function(){return this._abortFn&&(this._abortFn(),this._finishEase()),this},_ease:function(t,e,r){this._finishFn=e,this._abortFn=o.timed(function(e){t.call(this,r.easing(e)),1===e&&this._finishEase()},r.animate===!1?0:r.duration,this)},_finishEase:function(){delete this._abortFn;var t=this._finishFn;delete this._finishFn,t.call(this)},_normalizeBearing:function(t,e){t=n.wrap(t,-180,180);var r=Math.abs(t-e);return Math.abs(t-360-e)<r&&(t-=360),Math.abs(t+360-e)<r&&(t+=360),t},_updateEasing:function(t,e,r){var i;if(this.ease){var o=this.ease,a=(Date.now()-o.start)/o.duration,s=o.easing(a+.01)-o.easing(a),l=.27/Math.sqrt(s*s+1e-4)*.01,u=Math.sqrt(.0729-l*l);i=n.bezier(l,u,.25,1)}else i=r?n.bezier.apply(n,r):n.ease;return this.ease={start:(new Date).getTime(),to:Math.pow(2,e),duration:t,easing:i},i}})},{"../geo/lng_lat":256,"../geo/lng_lat_bounds":257,"../util/browser":335,"../util/interpolate":343,"../util/util":349,"point-geometry":404}],318:[function(t,e,r){"use strict";function n(t){a.setOptions(this,t)}var i=t("./control"),o=t("../../util/dom"),a=t("../../util/util");e.exports=n,n.createAttributionString=function(t){var e=[];for(var r in t){var n=t[r];n.attribution&&e.indexOf(n.attribution)<0&&e.push(n.attribution)}return e.sort(function(t,e){return t.length-e.length}),e=e.filter(function(t,r){for(var n=r+1;n<e.length;n++)if(e[n].indexOf(t)>=0)return!1;return!0}),e.join(" | ")},n.prototype=a.inherit(i,{options:{position:"bottom-right"},onAdd:function(t){var e="mapboxgl-ctrl-attrib",r=this._container=o.create("div",e,t.getContainer());return this._update(),t.on("source.load",this._update.bind(this)),t.on("source.change",this._update.bind(this)),t.on("source.remove",this._update.bind(this)),t.on("moveend",this._updateEditLink.bind(this)),r},_update:function(){this._map.style&&(this._container.innerHTML=n.createAttributionString(this._map.style.sources)),this._editLink=this._container.getElementsByClassName("mapbox-improve-map")[0],this._updateEditLink()},_updateEditLink:function(){if(this._editLink){var t=this._map.getCenter();this._editLink.href="https://www.mapbox.com/map-feedback/#/"+t.lng+"/"+t.lat+"/"+Math.round(this._map.getZoom()+1)}}})},{"../../util/dom":338,"../../util/util":349,"./control":319}],319:[function(t,e,r){"use strict";function n(){}e.exports=n,n.prototype={addTo:function(t){this._map=t;var e=this._container=this.onAdd(t);if(this.options&&this.options.position){var r=this.options.position,n=t._controlCorners[r];e.className+=" mapboxgl-ctrl",-1!==r.indexOf("bottom")?n.insertBefore(e,n.firstChild):n.appendChild(e)}return this},remove:function(){return this._container.parentNode.removeChild(this._container),this.onRemove&&this.onRemove(this._map),this._map=null,this}}},{}],320:[function(t,e,r){"use strict";function n(t){s.setOptions(this,t)}var i=t("./control"),o=t("../../util/browser"),a=t("../../util/dom"),s=t("../../util/util");e.exports=n;var l={enableHighAccuracy:!1,timeout:6e3};n.prototype=s.inherit(i,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",r=this._container=a.create("div",e+"-group",t.getContainer());return o.supportsGeolocation?(this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._geolocateButton=a.create("button",e+"-icon "+e+"-geolocate",this._container),this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)),r):r},_onContextMenu:function(t){t.preventDefault()},_onClickGeolocate:function(){navigator.geolocation.getCurrentPosition(this._success.bind(this),this._error.bind(this),l),this._timeoutId=setTimeout(this._finish.bind(this),1e4)},_success:function(t){this._map.jumpTo({center:[t.coords.longitude,t.coords.latitude],zoom:17,bearing:0,pitch:0}),this._finish()},_error:function(){this._finish()},_finish:function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}})},{"../../util/browser":335,"../../util/dom":338,"../../util/util":349,"./control":319}],321:[function(t,e,r){"use strict";function n(t){s.setOptions(this,t)}function i(t){return new MouseEvent(t.type,{button:2,buttons:2,bubbles:!0,cancelable:!0,detail:t.detail,view:t.view,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,movementX:t.movementX,movementY:t.movementY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey})}var o=t("./control"),a=t("../../util/dom"),s=t("../../util/util");e.exports=n,n.prototype=s.inherit(o,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",r=this._container=a.create("div",e+"-group",t.getContainer());return this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._zoomInButton=this._createButton(e+"-icon "+e+"-zoom-in",t.zoomIn.bind(t)),this._zoomOutButton=this._createButton(e+"-icon "+e+"-zoom-out",t.zoomOut.bind(t)),this._compass=this._createButton(e+"-icon "+e+"-compass",t.resetNorth.bind(t)),this._compassArrow=a.create("div","arrow",this._compass),this._compass.addEventListener("mousedown",this._onCompassDown.bind(this)),this._onCompassMove=this._onCompassMove.bind(this),this._onCompassUp=this._onCompassUp.bind(this),t.on("rotate",this._rotateCompassArrow.bind(this)),this._rotateCompassArrow(),this._el=t.getCanvasContainer(),r},_onContextMenu:function(t){t.preventDefault()},_onCompassDown:function(t){0===t.button&&(a.disableDrag(),document.addEventListener("mousemove",this._onCompassMove),document.addEventListener("mouseup",this._onCompassUp),this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassMove:function(t){0===t.button&&(this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassUp:function(t){0===t.button&&(document.removeEventListener("mousemove",this._onCompassMove),document.removeEventListener("mouseup",this._onCompassUp),a.enableDrag(),this._el.dispatchEvent(i(t)),t.stopPropagation())},_createButton:function(t,e){var r=a.create("button",t,this._container);return r.addEventListener("click",function(){e()}),r},_rotateCompassArrow:function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t}})},{"../../util/dom":338,"../../util/util":349,"./control":319}],322:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../geo/lng_lat_bounds"),a=t("../../util/util");e.exports=n,n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onMouseDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onMouseDown),this._enabled=!1)},_onMouseDown:function(t){t.shiftKey&&0===t.button&&(document.addEventListener("mousemove",this._onMouseMove,!1),document.addEventListener("keydown",this._onKeyDown,!1),document.addEventListener("mouseup",this._onMouseUp,!1),i.disableDrag(),this._startPos=i.mousePos(this._el,t),this._active=!0)},_onMouseMove:function(t){var e=this._startPos,r=i.mousePos(this._el,t);this._box||(this._box=i.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var n=Math.min(e.x,r.x),o=Math.max(e.x,r.x),a=Math.min(e.y,r.y),s=Math.max(e.y,r.y);i.setTransform(this._box,"translate("+n+"px,"+a+"px)"),this._box.style.width=o-n+"px",this._box.style.height=s-a+"px"},_onMouseUp:function(t){if(0===t.button){var e=this._startPos,r=i.mousePos(this._el,t),n=new o(this._map.unproject(e),this._map.unproject(r));this._finish(),e.x===r.x&&e.y===r.y?this._fireEvent("boxzoomcancel",t):this._map.fitBounds(n,{linear:!0}).fire("boxzoomend",{originalEvent:t,boxZoomBounds:n})}},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",t))},_finish:function(){this._active=!1,document.removeEventListener("mousemove",this._onMouseMove,!1),document.removeEventListener("keydown",this._onKeyDown,!1),document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.parentNode.removeChild(this._box),this._box=null),i.enableDrag()},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})}}},{"../../geo/lng_lat_bounds":257,"../../util/dom":338,"../../util/util":349}],323:[function(t,e,r){"use strict";function n(t){this._map=t,this._onDblClick=this._onDblClick.bind(this)}e.exports=n,n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._map.on("dblclick",this._onDblClick),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._map.off("dblclick",this._onDblClick),this._enabled=!1)},_onDblClick:function(t){this._map.zoomTo(this._map.getZoom()+(t.originalEvent.shiftKey?-1:1),{around:t.lngLat})}}},{}],324:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../util/util");e.exports=n;var a=.3,s=o.bezier(0,0,a,1),l=1400,u=2500;n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._el.addEventListener("touchstart",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._el.removeEventListener("touchstart",this._onDown),this._enabled=!1)},_onDown:function(t){this._ignoreEvent(t)||this.isActive()||(t.touches?(document.addEventListener("touchmove",this._onMove),document.addEventListener("touchend",this._onTouchEnd)):(document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onMouseUp)),this._active=!1,this._startPos=this._pos=i.mousePos(this._el,t),this._inertia=[[Date.now(),this._pos]])},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("dragstart",t),this._fireEvent("movestart",t));var e=i.mousePos(this._el,t),r=this._map;r.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),e]),r.transform.setLocationAtPoint(r.transform.pointLocation(this._pos),e),this._fireEvent("drag",t),this._fireEvent("move",t),this._pos=e,t.preventDefault()}},_onUp:function(t){if(this.isActive()){this._active=!1,this._fireEvent("dragend",t),this._drainInertiaBuffer();var e=function(){this._fireEvent("moveend",t)}.bind(this),r=this._inertia;if(r.length<2)return void e();var n=r[r.length-1],i=r[0],o=n[1].sub(i[1]),c=(n[0]-i[0])/1e3;if(0===c||n[1].equals(i[1]))return void e();var h=o.mult(a/c),f=h.mag();f>l&&(f=l,h._unit()._mult(f));var d=f/(u*a),p=h.mult(-d/2);this._map.panBy(p,{duration:1e3*d,easing:s,noMoveStart:!0},{originalEvent:t})}},_onMouseUp:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onMouseUp))},_onTouchEnd:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onTouchEnd))},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})},_ignoreEvent:function(t){var e=this._map;if(e.boxZoom&&e.boxZoom.isActive())return!0;if(e.dragRotate&&e.dragRotate.isActive())return!0;if(t.touches)return t.touches.length>1;if(t.ctrlKey)return!0;var r=1,n=0;return"mousemove"===t.type?t.buttons&0===r:t.button!==n},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),r=160;t.length>0&&e-t[0][0]>r;)t.shift()}}},{"../../util/dom":338,"../../util/util":349}],325:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),o=t("point-geometry"),a=t("../../util/util");e.exports=n;var s=.25,l=a.bezier(0,0,s,1),u=180,c=720;n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._enabled=!1)},_onDown:function(t){if(!this._ignoreEvent(t)&&!this.isActive()){document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onUp),this._active=!1,this._inertia=[[Date.now(),this._map.getBearing()]],this._startPos=this._pos=i.mousePos(this._el,t),this._center=this._map.transform.centerPoint;var e=this._startPos.sub(this._center),r=e.mag();200>r&&(this._center=this._startPos.add(new o(-200,0)._rotate(e.angle()))),t.preventDefault()}},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("rotatestart",t),this._fireEvent("movestart",t));var e=this._map;e.stop();var r=this._pos,n=i.mousePos(this._el,t),o=this._center,a=r.sub(o).angleWith(n.sub(o))/Math.PI*180,s=e.getBearing()-a,l=this._inertia,u=l[l.length-1];this._drainInertiaBuffer(),l.push([Date.now(),e._normalizeBearing(s,u[1])]),e.transform.bearing=s,this._fireEvent("rotate",t),this._fireEvent("move",t),this._pos=n}},_onUp:function(t){if(!this._ignoreEvent(t)&&(document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onUp),this.isActive())){this._active=!1,this._fireEvent("rotateend",t),this._drainInertiaBuffer();var e=this._map,r=e.getBearing(),n=this._inertia,i=function(){Math.abs(r)<e.options.bearingSnap?e.resetNorth({noMoveStart:!0},{originalEvent:t}):this._fireEvent("moveend",t)}.bind(this);if(n.length<2)return void i();var o=n[0],a=n[n.length-1],h=n[n.length-2],f=e._normalizeBearing(r,h[1]),d=a[1]-o[1],p=0>d?-1:1,v=(a[0]-o[0])/1e3;if(0===d||0===v)return void i();var m=Math.abs(d*(s/v));m>u&&(m=u);var g=m/(c*s),y=p*m*(g/2);f+=y,Math.abs(e._normalizeBearing(f,0))<e.options.bearingSnap&&(f=e._normalizeBearing(0,f)),e.rotateTo(f,{duration:1e3*g,easing:l,noMoveStart:!0},{originalEvent:t})}},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})},_ignoreEvent:function(t){var e=this._map;if(e.boxZoom&&e.boxZoom.isActive())return!0;if(e.dragPan&&e.dragPan.isActive())return!0;if(t.touches)return t.touches.length>1;var r=t.ctrlKey?1:2,n=t.ctrlKey?0:2;return"mousemove"===t.type?t.buttons&0===r:t.button!==n},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),r=160;t.length>0&&e-t[0][0]>r;)t.shift()}}},{"../../util/dom":338,"../../util/util":349,"point-geometry":404}],326:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),this._onKeyDown=this._onKeyDown.bind(this)}e.exports=n;var i=80,o=2,a=5;n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=this._map,r={originalEvent:t};switch(t.keyCode){case 61:case 107:case 171:case 187:e.zoomTo(Math.round(e.getZoom())+(t.shiftKey?2:1),r);break;case 189:case 109:case 173:e.zoomTo(Math.round(e.getZoom())-(t.shiftKey?2:1),r);break;case 37:t.shiftKey?e.easeTo({bearing:e.getBearing()-o},r):(t.preventDefault(),e.panBy([-i,0],r));break;case 39:t.shiftKey?e.easeTo({bearing:e.getBearing()+o},r):(t.preventDefault(),e.panBy([i,0],r));break;case 38:t.shiftKey?e.easeTo({pitch:e.getPitch()+a},r):(t.preventDefault(),e.panBy([0,-i],r));break;case 40:t.shiftKey?e.easeTo({pitch:Math.max(e.getPitch()-a,0)},r):(t.preventDefault(),e.panBy([0,i],r))}}}}},{}],327:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../util/browser"),a=t("../../util/util");e.exports=n;var s="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"",l=-1!==s.indexOf("firefox"),u=-1!==s.indexOf("safari")&&-1===s.indexOf("chrom");n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("wheel",this._onWheel,!1),this._el.addEventListener("mousewheel",this._onWheel,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("wheel",this._onWheel),this._el.removeEventListener("mousewheel",this._onWheel),this._enabled=!1)},_onWheel:function(t){var e;"wheel"===t.type?(e=t.deltaY,l&&t.deltaMode===window.WheelEvent.DOM_DELTA_PIXEL&&(e/=o.devicePixelRatio),t.deltaMode===window.WheelEvent.DOM_DELTA_LINE&&(e*=40)):"mousewheel"===t.type&&(e=-t.wheelDeltaY,u&&(e/=3));var r=o.now(),n=r-(this._time||0);this._pos=i.mousePos(this._el,t),this._time=r,0!==e&&e%4.000244140625===0?(this._type="wheel",e=Math.floor(e/4)):0!==e&&Math.abs(e)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40)):this._type||(this._type=Math.abs(n*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&this._zoom(-e,t),t.preventDefault()},_onTimeout:function(){this._type="wheel",this._zoom(-this._lastValue)},_zoom:function(t,e){if(0!==t){var r=this._map,n=2/(1+Math.exp(-Math.abs(t/100)));0>t&&0!==n&&(n=1/n);var i=r.ease?r.ease.to:r.transform.scale,o=r.transform.scaleZoom(i*n);r.zoomTo(o,{duration:0,around:r.unproject(this._pos),delayEndEvents:200},{originalEvent:e})}}}},{"../../util/browser":335,"../../util/dom":338,"../../util/util":349}],328:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../util/util");e.exports=n;var a=.15,s=o.bezier(0,0,a,1),l=12,u=2.5,c=.15,h=4;n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("touchstart",this._onStart,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("touchstart",this._onStart),this._enabled=!1)},disableRotation:function(){this._rotationDisabled=!0},enableRotation:function(){this._rotationDisabled=!1},_onStart:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),r=i.mousePos(this._el,t.touches[1]);this._startVec=e.sub(r),this._startScale=this._map.transform.scale,this._startBearing=this._map.transform.bearing,this._gestureIntent=void 0,this._inertia=[],document.addEventListener("touchmove",this._onMove,!1),document.addEventListener("touchend",this._onEnd,!1)}},_onMove:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),r=i.mousePos(this._el,t.touches[1]),n=e.add(r).div(2),o=e.sub(r),a=o.mag()/this._startVec.mag(),s=this._rotationDisabled?0:180*o.angleWith(this._startVec)/Math.PI,l=this._map;if(this._gestureIntent){var u={duration:0,around:l.unproject(n)};"rotate"===this._gestureIntent&&(u.bearing=this._startBearing+s),"zoom"!==this._gestureIntent&&"rotate"!==this._gestureIntent||(u.zoom=l.transform.scaleZoom(this._startScale*a)),l.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),a,n]),l.easeTo(u,{originalEvent:t})}else{var f=Math.abs(1-a)>c,d=Math.abs(s)>h;d?this._gestureIntent="rotate":f&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._startVec=o,this._startScale=l.transform.scale,this._startBearing=l.transform.bearing)}t.preventDefault()}},_onEnd:function(t){document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onEnd),this._drainInertiaBuffer();var e=this._inertia,r=this._map;if(e.length<2)return void r.snapToNorth({},{originalEvent:t});var n=e[e.length-1],i=e[0],o=r.transform.scaleZoom(this._startScale*n[1]),c=r.transform.scaleZoom(this._startScale*i[1]),h=o-c,f=(n[0]-i[0])/1e3,d=n[2];if(0===f||o===c)return void r.snapToNorth({},{originalEvent:t});var p=h*a/f;Math.abs(p)>u&&(p=p>0?u:-u);var v=1e3*Math.abs(p/(l*a)),m=o+p*v/2e3;0>m&&(m=0),r.easeTo({zoom:m,duration:v,easing:s,around:r.unproject(d)},{originalEvent:t})},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),r=160;t.length>2&&e-t[0][0]>r;)t.shift()}}},{"../../util/dom":338,"../../util/util":349}],329:[function(t,e,r){"use strict";function n(){i.bindAll(["_onHashChange","_updateHash"],this)}e.exports=n;var i=t("../util/util");n.prototype={addTo:function(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},remove:function(){return window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),delete this._map,this},_onHashChange:function(){var t=location.hash.replace("#","").split("/");return t.length>=3?(this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:+(t[3]||0)}),!0):!1},_updateHash:function(){var t=this._map.getCenter(),e=this._map.getZoom(),r=this._map.getBearing(),n=Math.max(0,Math.ceil(Math.log(e)/Math.LN2)),i="#"+Math.round(100*e)/100+"/"+t.lat.toFixed(n)+"/"+t.lng.toFixed(n)+(r?"/"+Math.round(10*r)/10:"");window.history.replaceState("","",i)}}},{"../util/util":349}],330:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer();for(var e in i)t[e]=new i[e](t);a.bindHandlers(this)}var i={scrollZoom:t("./handler/scroll_zoom"),boxZoom:t("./handler/box_zoom"),dragRotate:t("./handler/drag_rotate"),dragPan:t("./handler/drag_pan"),keyboard:t("./handler/keyboard"),doubleClickZoom:t("./handler/dblclick_zoom"),touchZoomRotate:t("./handler/touch_zoom_rotate")},o=t("../util/dom"),a=t("../util/util"),s=t("point-geometry");e.exports=n,n.prototype={enable:function(){var t=this._map.options,e=this._el;for(var r in i)t[r]&&this._map[r].enable();e.addEventListener("mousedown",this._onMouseDown,!1),e.addEventListener("mouseup",this._onMouseUp,!1),e.addEventListener("mousemove",this._onMouseMove,!1),e.addEventListener("touchstart",this._onTouchStart,!1),e.addEventListener("touchend",this._onTouchEnd,!1),e.addEventListener("touchmove",this._onTouchMove,!1),e.addEventListener("touchcancel",this._onTouchCancel,!1),e.addEventListener("click",this._onClick,!1),e.addEventListener("dblclick",this._onDblClick,!1),e.addEventListener("contextmenu",this._onContextMenu,!1)},disable:function(){var t=this._map.options,e=this._el;for(var r in i)t[r]&&this._map[r].disable();e.removeEventListener("mousedown",this._onMouseDown),e.removeEventListener("mouseup",this._onMouseUp),e.removeEventListener("mousemove",this._onMouseMove),e.removeEventListener("touchstart",this._onTouchStart),e.removeEventListener("touchend",this._onTouchEnd),e.removeEventListener("touchmove",this._onTouchMove),e.removeEventListener("touchcancel",this._onTouchCancel),e.removeEventListener("click",this._onClick),e.removeEventListener("dblclick",this._onDblClick),e.removeEventListener("contextmenu",this._onContextMenu)},_onMouseDown:function(t){this._map.stop(),this._startPos=o.mousePos(this._el,t),this._fireMouseEvent("mousedown",t)},_onMouseUp:function(t){var e=this._map,r=e.dragRotate&&e.dragRotate.isActive();this._contextMenuEvent&&!r&&this._fireMouseEvent("contextmenu",this._contextMenuEvent),this._contextMenuEvent=null,this._fireMouseEvent("mouseup",t)},_onMouseMove:function(t){var e=this._map,r=this._el;if(!(e.dragPan&&e.dragPan.isActive()||e.dragRotate&&e.dragRotate.isActive())){for(var n=t.toElement||t.target;n&&n!==r;)n=n.parentNode;n===r&&this._fireMouseEvent("mousemove",t)}},_onTouchStart:function(t){this._map.stop(),this._fireTouchEvent("touchstart",t),!t.touches||t.touches.length>1||(this._tapped?(clearTimeout(this._tapped),this._tapped=null,this._fireMouseEvent("dblclick",t)):this._tapped=setTimeout(this._onTouchTimeout,300))},_onTouchMove:function(t){this._fireTouchEvent("touchmove",t)},_onTouchEnd:function(t){this._fireTouchEvent("touchend",t)},_onTouchCancel:function(t){this._fireTouchEvent("touchcancel",t)},_onTouchTimeout:function(){this._tapped=null},_onClick:function(t){var e=o.mousePos(this._el,t);e.equals(this._startPos)&&this._fireMouseEvent("click",t)},_onDblClick:function(t){this._fireMouseEvent("dblclick",t),t.preventDefault()},_onContextMenu:function(t){this._contextMenuEvent=t,t.preventDefault()},_fireMouseEvent:function(t,e){var r=o.mousePos(this._el,e);return this._map.fire(t,{lngLat:this._map.unproject(r),point:r,originalEvent:e})},_fireTouchEvent:function(t,e){var r=o.touchPos(this._el,e),n=r.reduce(function(t,e,r,n){return t.add(e.div(n.length))},new s(0,0));return this._map.fire(t,{lngLat:this._map.unproject(n),point:n,lngLats:r.map(function(t){return this._map.unproject(t)},this),points:r,originalEvent:e})}}},{"../util/dom":338,"../util/util":349,"./handler/box_zoom":322,"./handler/dblclick_zoom":323,"./handler/drag_pan":324,"./handler/drag_rotate":325,"./handler/keyboard":326,"./handler/scroll_zoom":327,"./handler/touch_zoom_rotate":328,"point-geometry":404}],331:[function(t,e,r){"use strict";function n(t){t.parentNode&&t.parentNode.removeChild(t)}var i=t("../util/canvas"),o=t("../util/util"),a=t("../util/browser"),s=t("../util/evented"),l=t("../util/dom"),u=t("../style/style"),c=t("../style/animation_loop"),h=t("../render/painter"),f=t("../geo/transform"),d=t("./hash"),p=t("./interaction"),v=t("./camera"),m=t("../geo/lng_lat"),g=t("../geo/lng_lat_bounds"),y=t("point-geometry"),b=t("./control/attribution"),x=0,_=20,w=e.exports=function(t){t=o.inherit(this.options,t),this._interactive=t.interactive,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,"string"==typeof t.container?this._container=document.getElementById(t.container):this._container=t.container,this.animationLoop=new c,this.transform=new f(t.minZoom,t.maxZoom),t.maxBounds&&this.setMaxBounds(t.maxBounds),o.bindAll(["_forwardStyleEvent","_forwardSourceEvent","_forwardLayerEvent","_forwardTileEvent","_onStyleLoad","_onStyleChange","_onSourceAdd","_onSourceRemove","_onSourceUpdate","_onWindowResize","onError","_update","_render"],this),this._setupContainer(),this._setupPainter(),this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),this.on("moveend",function(){this.animationLoop.set(300),this._rerender()}.bind(this)),"undefined"!=typeof window&&window.addEventListener("resize",this._onWindowResize,!1),this.interaction=new p(this),t.interactive&&this.interaction.enable(),this._hash=t.hash&&(new d).addTo(this),this._hash&&this._hash._onHashChange()||this.jumpTo(t),this.stacks={},this._classes=[],this.resize(),t.classes&&this.setClasses(t.classes),t.style&&this.setStyle(t.style),t.attributionControl&&this.addControl(new b(t.attributionControl)),this.on("style.error",this.onError),this.on("source.error",this.onError),this.on("tile.error",this.onError),this.on("layer.error",this.onError)};o.extend(w.prototype,s),o.extend(w.prototype,v.prototype),o.extend(w.prototype,{options:{center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:x,maxZoom:_,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,bearingSnap:7,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1},addControl:function(t){return t.addTo(this),this},addClass:function(t,e){return this._classes.indexOf(t)>=0||""===t?this:(this._classes.push(t),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},removeClass:function(t,e){var r=this._classes.indexOf(t);return 0>r||""===t?this:(this._classes.splice(r,1),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},setClasses:function(t,e){for(var r={},n=0;n<t.length;n++)""!==t[n]&&(r[t[n]]=!0);return this._classes=Object.keys(r),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0)},hasClass:function(t){return this._classes.indexOf(t)>=0},getClasses:function(){return this._classes},resize:function(){var t=0,e=0;return this._container&&(t=this._container.offsetWidth||400,e=this._container.offsetHeight||300),this._canvas.resize(t,e),this.transform.resize(t,e),this.painter.resize(t,e),this.fire("movestart").fire("move").fire("resize").fire("moveend")},getBounds:function(){var t=new g(this.transform.pointLocation(new y(0,0)),this.transform.pointLocation(this.transform.size));return(this.transform.angle||this.transform.pitch)&&(t.extend(this.transform.pointLocation(new y(this.transform.size.x,0))),t.extend(this.transform.pointLocation(new y(0,this.transform.size.y)))),t},setMaxBounds:function(t){if(t){var e=g.convert(t);this.transform.lngRange=[e.getWest(),e.getEast()],this.transform.latRange=[e.getSouth(),e.getNorth()],this.transform._constrain(),this._update()}else null!==t&&void 0!==t||(this.transform.lngRange=[],this.transform.latRange=[],this._update());return this},setMinZoom:function(t){if(t=null===t||void 0===t?x:t,t>=x&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between "+x+" and the current maxZoom, inclusive")},setMaxZoom:function(t){if(t=null===t||void 0===t?_:t,t>=this.transform.minZoom&&_>=t)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be between the current minZoom and "+_+", inclusive")},project:function(t){return this.transform.locationPoint(m.convert(t))},unproject:function(t){return this.transform.pointLocation(y.convert(t))},queryRenderedFeatures:function(t,e){t instanceof y||Array.isArray(t)||(e=t,t=void 0);var r=this._makeQueryGeometry(t);return this.style.queryRenderedFeatures(r,e,this.transform.zoom,this.transform.angle)},_makeQueryGeometry:function(t){void 0===t&&(t=[y.convert([0,0]),y.convert([this.transform.width,this.transform.height])]);var e,r=t instanceof y||"number"==typeof t[0];if(r){var n=y.convert(t);e=[n]}else{var i=[y.convert(t[0]),y.convert(t[1])];e=[i[0],new y(i[1].x,i[0].y),i[1],new y(i[0].x,i[1].y),i[0]]}return e=e.map(function(t){return this.transform.pointCoordinate(t)}.bind(this))},querySourceFeatures:function(t,e){return this.style.querySourceFeatures(t,e)},setStyle:function(t){return this.style&&(this.style.off("load",this._onStyleLoad).off("error",this._forwardStyleEvent).off("change",this._onStyleChange).off("source.add",this._onSourceAdd).off("source.remove",this._onSourceRemove).off("source.load",this._onSourceUpdate).off("source.error",this._forwardSourceEvent).off("source.change",this._onSourceUpdate).off("layer.add",this._forwardLayerEvent).off("layer.remove",this._forwardLayerEvent).off("layer.error",this._forwardLayerEvent).off("tile.add",this._forwardTileEvent).off("tile.remove",this._forwardTileEvent).off("tile.load",this._update).off("tile.error",this._forwardTileEvent).off("tile.stats",this._forwardTileEvent)._remove(),this.off("rotate",this.style._redoPlacement), this.off("pitch",this.style._redoPlacement)),t?(t instanceof u?this.style=t:this.style=new u(t,this.animationLoop),this.style.on("load",this._onStyleLoad).on("error",this._forwardStyleEvent).on("change",this._onStyleChange).on("source.add",this._onSourceAdd).on("source.remove",this._onSourceRemove).on("source.load",this._onSourceUpdate).on("source.error",this._forwardSourceEvent).on("source.change",this._onSourceUpdate).on("layer.add",this._forwardLayerEvent).on("layer.remove",this._forwardLayerEvent).on("layer.error",this._forwardLayerEvent).on("tile.add",this._forwardTileEvent).on("tile.remove",this._forwardTileEvent).on("tile.load",this._update).on("tile.error",this._forwardTileEvent).on("tile.stats",this._forwardTileEvent),this.on("rotate",this.style._redoPlacement),this.on("pitch",this.style._redoPlacement),this):(this.style=null,this)},getStyle:function(){return this.style.serialize()},addSource:function(t,e){return this.style.addSource(t,e),this._update(!0),this},removeSource:function(t){return this.style.removeSource(t),this._update(!0),this},getSource:function(t){return this.style.getSource(t)},addLayer:function(t,e){return this.style.addLayer(t,e),this._update(!0),this},removeLayer:function(t){return this.style.removeLayer(t),this._update(!0),this},getLayer:function(t){return this.style.getLayer(t)},setFilter:function(t,e){return this.style.setFilter(t,e),this._update(!0),this},setLayerZoomRange:function(t,e,r){return this.style.setLayerZoomRange(t,e,r),this._update(!0),this},getFilter:function(t){return this.style.getFilter(t)},setPaintProperty:function(t,e,r,n){return this.style.setPaintProperty(t,e,r,n),this._update(!0),this},getPaintProperty:function(t,e,r){return this.style.getPaintProperty(t,e,r)},setLayoutProperty:function(t,e,r){return this.style.setLayoutProperty(t,e,r),this._update(!0),this},getLayoutProperty:function(t,e){return this.style.getLayoutProperty(t,e)},getContainer:function(){return this._container},getCanvasContainer:function(){return this._canvasContainer},getCanvas:function(){return this._canvas.getElement()},_setupContainer:function(){var t=this._container;t.classList.add("mapboxgl-map");var e=this._canvasContainer=l.create("div","mapboxgl-canvas-container",t);this._interactive&&e.classList.add("mapboxgl-interactive"),this._canvas=new i(this,e);var r=this._controlContainer=l.create("div","mapboxgl-control-container",t),n=this._controlCorners={};["top-left","top-right","bottom-left","bottom-right"].forEach(function(t){n[t]=l.create("div","mapboxgl-ctrl-"+t,r)})},_setupPainter:function(){var t=this._canvas.getWebGLContext({failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer});return t?void(this.painter=new h(t,this.transform)):void console.error("Failed to initialize WebGL")},_contextLost:function(t){t.preventDefault(),this._frameId&&a.cancelFrame(this._frameId),this.fire("webglcontextlost",{originalEvent:t})},_contextRestored:function(t){this._setupPainter(),this.resize(),this._update(),this.fire("webglcontextrestored",{originalEvent:t})},loaded:function(){return this._styleDirty||this._sourcesDirty?!1:!(!this.style||!this.style.loaded())},_update:function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this._rerender(),this):this},_render:function(){return this.style&&this._styleDirty&&(this._styleDirty=!1,this.style.update(this._classes,this._classOptions),this._classOptions=null,this.style._recalculate(this.transform.zoom)),this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.painter.render(this.style,{debug:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,vertices:this.vertices,rotating:this.rotating,zooming:this.zooming}),this.fire("render"),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire("load")),this._frameId=null,this.animationLoop.stopped()||(this._styleDirty=!0),(this._sourcesDirty||this._repaint||!this.animationLoop.stopped())&&this._rerender(),this},remove:function(){this._hash&&this._hash.remove(),a.cancelFrame(this._frameId),this.setStyle(null),"undefined"!=typeof window&&window.removeEventListener("resize",this._onWindowResize,!1),n(this._canvasContainer),n(this._controlContainer),this._container.classList.remove("mapboxgl-map")},onError:function(t){console.error(t.error)},_rerender:function(){this.style&&!this._frameId&&(this._frameId=a.frame(this._render))},_forwardStyleEvent:function(t){this.fire("style."+t.type,o.extend({style:t.target},t))},_forwardSourceEvent:function(t){this.fire(t.type,o.extend({style:t.target},t))},_forwardLayerEvent:function(t){this.fire(t.type,o.extend({style:t.target},t))},_forwardTileEvent:function(t){this.fire(t.type,o.extend({style:t.target},t))},_onStyleLoad:function(t){this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this.style.update(this._classes,{transition:!1}),this._forwardStyleEvent(t)},_onStyleChange:function(t){this._update(!0),this._forwardStyleEvent(t)},_onSourceAdd:function(t){var e=t.source;e.onAdd&&e.onAdd(this),this._forwardSourceEvent(t)},_onSourceRemove:function(t){var e=t.source;e.onRemove&&e.onRemove(this),this._forwardSourceEvent(t)},_onSourceUpdate:function(t){this._update(),this._forwardSourceEvent(t)},_onWindowResize:function(){this.stop().resize()._update()}}),o.extendAll(w.prototype,{_showTileBoundaries:!1,get showTileBoundaries(){return this._showTileBoundaries},set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())},_showCollisionBoxes:!1,get showCollisionBoxes(){return this._showCollisionBoxes},set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,this.style._redoPlacement())},_showOverdrawInspector:!1,get showOverdrawInspector(){return this._showOverdrawInspector},set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())},_repaint:!1,get repaint(){return this._repaint},set repaint(t){this._repaint=t,this._update()},_vertices:!1,get vertices(){return this._vertices},set vertices(t){this._vertices=t,this._update()}})},{"../geo/lng_lat":256,"../geo/lng_lat_bounds":257,"../geo/transform":258,"../render/painter":271,"../style/animation_loop":287,"../style/style":290,"../util/browser":335,"../util/canvas":336,"../util/dom":338,"../util/evented":341,"../util/util":349,"./camera":317,"./control/attribution":318,"./hash":329,"./interaction":330,"point-geometry":404}],332:[function(t,e,r){"use strict";function n(t){i.setOptions(this,t),i.bindAll(["_update","_onClickClose"],this)}e.exports=n;var i=t("../util/util"),o=t("../util/evented"),a=t("../util/dom"),s=t("../geo/lng_lat");n.prototype=i.inherit(o,{options:{closeButton:!0,closeOnClick:!0},addTo:function(t){return this._map=t,this._map.on("move",this._update),this.options.closeOnClick&&this._map.on("click",this._onClickClose),this._update(),this},remove:function(){return this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._container&&(this._container.parentNode.removeChild(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("click",this._onClickClose),delete this._map),this},getLngLat:function(){return this._lngLat},setLngLat:function(t){return this._lngLat=s.convert(t),this._update(),this},setText:function(t){return this.setDOMContent(document.createTextNode(t))},setHTML:function(t){var e,r=document.createDocumentFragment(),n=document.createElement("body");for(n.innerHTML=t;;){if(e=n.firstChild,!e)break;r.appendChild(e)}return this.setDOMContent(r)},setDOMContent:function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},_createContent:function(){this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._content=a.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=a.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClickClose))},_update:function(){if(this._map&&this._lngLat&&this._content){this._container||(this._container=a.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=a.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content));var t=this._map.project(this._lngLat).round(),e=this.options.anchor;if(!e){var r=this._container.offsetWidth,n=this._container.offsetHeight;e=t.y<n?["top"]:t.y>this._map.transform.height-n?["bottom"]:[],t.x<r/2?e.push("left"):t.x>this._map.transform.width-r/2&&e.push("right"),e=0===e.length?"bottom":e.join("-")}var i={top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},o=this._container.classList;for(var s in i)o.remove("mapboxgl-popup-anchor-"+s);o.add("mapboxgl-popup-anchor-"+e),a.setTransform(this._container,i[e]+" translate("+t.x+"px,"+t.y+"px)")}},_onClickClose:function(){this.remove()}})},{"../geo/lng_lat":256,"../util/dom":338,"../util/evented":341,"../util/util":349}],333:[function(t,e,r){"use strict";function n(t,e){this.target=t,this.parent=e,this.callbacks={},this.callbackID=0,this.receive=this.receive.bind(this),this.target.addEventListener("message",this.receive,!1)}e.exports=n,n.prototype.receive=function(t){var e,r=t.data;if("<response>"===r.type)e=this.callbacks[r.id],delete this.callbacks[r.id],e(r.error||null,r.data);else if("undefined"!=typeof r.id){var n=r.id;this.parent[r.type](r.data,function(t,e,r){this.postMessage({type:"<response>",id:String(n),error:t?String(t):null,data:e},r)}.bind(this))}else this.parent[r.type](r.data)},n.prototype.send=function(t,e,r,n){var i=null;r&&(this.callbacks[i=this.callbackID++]=r),this.postMessage({type:t,id:String(i),data:e},n)},n.prototype.postMessage=function(t,e){this.target.postMessage(t,e)}},{}],334:[function(t,e,r){"use strict";function n(t){var e=document.createElement("a");return e.href=t,e.protocol===document.location.protocol&&e.host===document.location.host}r.getJSON=function(t,e){var r=new XMLHttpRequest;return r.open("GET",t,!0),r.setRequestHeader("Accept","application/json"),r.onerror=function(t){e(t)},r.onload=function(){if(r.status>=200&&r.status<300&&r.response){var t;try{t=JSON.parse(r.response)}catch(n){return e(n)}e(null,t)}else e(new Error(r.statusText))},r.send(),r},r.getArrayBuffer=function(t,e){var r=new XMLHttpRequest;return r.open("GET",t,!0),r.responseType="arraybuffer",r.onerror=function(t){e(t)},r.onload=function(){r.status>=200&&r.status<300&&r.response?e(null,r.response):e(new Error(r.statusText))},r.send(),r},r.getImage=function(t,e){return r.getArrayBuffer(t,function(t,r){if(t)return e(t);var n=new Image;n.onload=function(){e(null,n),(window.URL||window.webkitURL).revokeObjectURL(n.src)};var i=new Blob([new Uint8Array(r)],{type:"image/png"});return n.src=(window.URL||window.webkitURL).createObjectURL(i),n.getData=function(){var t=document.createElement("canvas"),e=t.getContext("2d");return t.width=n.width,t.height=n.height,e.drawImage(n,0,0),e.getImageData(0,0,n.width,n.height).data},n})},r.getVideo=function(t,e){var r=document.createElement("video");r.onloadstart=function(){e(null,r)};for(var i=0;i<t.length;i++){var o=document.createElement("source");n(t[i])||(r.crossOrigin="Anonymous"),o.src=t[i],r.appendChild(o)}return r.getData=function(){return r},r}},{}],335:[function(t,e,r){"use strict";e.exports.now=function(){return window.performance&&window.performance.now?window.performance.now.bind(window.performance):Date.now.bind(Date)}();var n=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;r.frame=function(t){return n(t)};var i=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame;r.cancelFrame=function(t){i(t)},r.timed=function(t,n,i){function o(l){a||(l=e.exports.now(),l>=s+n?t.call(i,1):(t.call(i,(l-s)/n),r.frame(o)))}if(!n)return t.call(i,1),null;var a=!1,s=e.exports.now();return r.frame(o),function(){a=!0}},r.supported=t("mapbox-gl-js-supported"),r.hardwareConcurrency=navigator.hardwareConcurrency||8,Object.defineProperty(r,"devicePixelRatio",{get:function(){return window.devicePixelRatio}}),r.supportsWebp=!1;var o=document.createElement("img");o.onload=function(){r.supportsWebp=!0},o.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=",r.supportsGeolocation=!!navigator.geolocation},{"mapbox-gl-js-supported":375}],336:[function(t,e,r){"use strict";function n(t,e){this.canvas=document.createElement("canvas"),t&&e&&(this.canvas.style.position="absolute",this.canvas.classList.add("mapboxgl-canvas"),this.canvas.addEventListener("webglcontextlost",t._contextLost.bind(t),!1),this.canvas.addEventListener("webglcontextrestored",t._contextRestored.bind(t),!1),this.canvas.setAttribute("tabindex",0),e.appendChild(this.canvas))}var i=t("../util"),o=t("mapbox-gl-js-supported");e.exports=n,n.prototype.resize=function(t,e){var r=window.devicePixelRatio||1;this.canvas.width=r*t,this.canvas.height=r*e,this.canvas.style.width=t+"px",this.canvas.style.height=e+"px"},n.prototype.getWebGLContext=function(t){return t=i.extend({},t,o.webGLContextAttributes),this.canvas.getContext("webgl",t)||this.canvas.getContext("experimental-webgl",t)},n.prototype.getElement=function(){return this.canvas}},{"../util":349,"mapbox-gl-js-supported":375}],337:[function(t,e,r){"use strict";function n(e,r){this.actors=[],this.currentActor=0;for(var n=0;e>n;n++){var a=new o(t("../../source/worker")),s=new i(a,r);s.name="Worker "+n,this.actors.push(s)}}var i=t("../actor"),o=t("webworkify");e.exports=n,n.prototype={broadcast:function(t,e){for(var r=0;r<this.actors.length;r++)this.actors[r].send(t,e)},send:function(t,e,r,n,i){return("number"!=typeof n||isNaN(n))&&(n=this.currentActor=(this.currentActor+1)%this.actors.length),this.actors[n].send(t,e,r,i),n},remove:function(){for(var t=0;t<this.actors.length;t++)this.actors[t].target.terminate();this.actors=[]}}},{"../../source/worker":285,"../actor":333,webworkify:420}],338:[function(t,e,r){"use strict";function n(t){for(var e=0;e<t.length;e++)if(t[e]in s)return t[e]}function i(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",i,!0)}var o=t("point-geometry");r.create=function(t,e,r){var n=document.createElement(t);return e&&(n.className=e),r&&r.appendChild(n),n};var a,s=document.documentElement.style,l=n(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]);r.disableDrag=function(){l&&(a=s[l],s[l]="none")},r.enableDrag=function(){l&&(s[l]=a)};var u=n(["transform","WebkitTransform"]);r.setTransform=function(t,e){t.style[u]=e},r.suppressClick=function(){window.addEventListener("click",i,!0),window.setTimeout(function(){window.removeEventListener("click",i,!0)},0)},r.mousePos=function(t,e){var r=t.getBoundingClientRect();return e=e.touches?e.touches[0]:e,new o(e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop)},r.touchPos=function(t,e){for(var r=t.getBoundingClientRect(),n=[],i=0;i<e.touches.length;i++)n.push(new o(e.touches[i].clientX-r.left-t.clientLeft,e.touches[i].clientY-r.top-t.clientTop));return n}},{"point-geometry":404}],339:[function(t,e,r){"use strict";e.exports={API_URL:"https://api.mapbox.com",REQUIRE_ACCESS_TOKEN:!0}},{}],340:[function(t,e,r){"use strict";function n(t){this._stringToNumber={},this._numberToString=[];for(var e=0;e<t.length;e++){var r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}}var i=t("assert");e.exports=n,n.prototype.encode=function(t){return i(t in this._stringToNumber),this._stringToNumber[t]},n.prototype.decode=function(t){return i(t<this._numberToString.length),this._numberToString[t]}},{assert:52}],341:[function(t,e,r){"use strict";var n=t("./util"),i={on:function(t,e){return this._events=this._events||{},this._events[t]=this._events[t]||[],this._events[t].push(e),this},off:function(t,e){if(!t)return delete this._events,this;if(!this.listens(t))return this;if(e){var r=this._events[t].indexOf(e);r>=0&&this._events[t].splice(r,1),this._events[t].length||delete this._events[t]}else delete this._events[t];return this},once:function(t,e){var r=function(n){this.off(t,r),e.call(this,n)}.bind(this);return this.on(t,r),this},fire:function(t,e){if(!this.listens(t))return this;e=n.extend({},e),n.extend(e,{type:t,target:this});for(var r=this._events[t].slice(),i=0;i<r.length;i++)r[i].call(this,e);return this},listens:function(t){return!(!this._events||!this._events[t])}};e.exports=i},{"./util":349}],342:[function(t,e,r){"use strict";function n(t,e){this.stacks=t.readFields(i,[],e)}function i(t,e,r){if(1===t){var n=r.readMessage(o,{glyphs:{}});e.push(n)}}function o(t,e,r){if(1===t)e.name=r.readString();else if(2===t)e.range=r.readString();else if(3===t){var n=r.readMessage(a,{});e.glyphs[n.id]=n}}function a(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint())}e.exports=n},{}],343:[function(t,e,r){"use strict";function n(t,e,r){return t*(1-r)+e*r}e.exports=n,n.number=n,n.vec2=function(t,e,r){return[n(t[0],e[0],r),n(t[1],e[1],r)]},n.color=function(t,e,r){return[n(t[0],e[0],r),n(t[1],e[1],r),n(t[2],e[2],r),n(t[3],e[3],r)]},n.array=function(t,e,r){return t.map(function(t,i){return n(t,e[i],r)})}},{}],344:[function(t,e,r){"use strict";function n(t,e,r){for(var n=0;n<t.length;n++)for(var i=t[n],o=0;o<e.length;o++)for(var a=e[o],s=0;s<a.length;s++){var l=a[s];if(d(i,l))return!0;if(c(l,i,r))return!0}return!1}function i(t,e){if(1===t.length&&1===t[0].length)return f(e,t[0][0]);for(var r=0;r<e.length;r++)for(var n=e[r],i=0;i<n.length;i++)if(f(t,n[i]))return!0;for(var o=0;o<t.length;o++){for(var a=t[o],l=0;l<a.length;l++)if(f(e,a[l]))return!0;for(var u=0;u<e.length;u++)if(s(a,e[u]))return!0}return!1}function o(t,e,r){for(var n=0;n<e.length;n++)for(var i=e[n],o=0;o<t.length;o++){var s=t[o];if(s.length>=3)for(var l=0;l<i.length;l++)if(d(s,i[l]))return!0;if(a(s,i,r))return!0}return!1}function a(t,e,r){if(t.length>1){if(s(t,e))return!0;for(var n=0;n<e.length;n++)if(c(e[n],t,r))return!0}for(var i=0;i<t.length;i++)if(c(t[i],e,r))return!0;return!1}function s(t,e){for(var r=0;r<t.length-1;r++)for(var n=t[r],i=t[r+1],o=0;o<e.length-1;o++){var a=e[o],s=e[o+1];if(u(n,i,a,s))return!0}return!1}function l(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function u(t,e,r,n){return l(t,r,n)!==l(e,r,n)&&l(t,e,r)!==l(t,e,n)}function c(t,e,r){var n=r*r;if(1===e.length)return t.distSqr(e[0])<n;for(var i=1;i<e.length;i++){var o=e[i-1],a=e[i];if(h(t,o,a)<n)return!0}return!1}function h(t,e,r){var n=e.distSqr(r);if(0===n)return t.distSqr(e);var i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return 0>i?t.distSqr(e):i>1?t.distSqr(r):t.distSqr(r.sub(e)._mult(i)._add(e))}function f(t,e){for(var r,n,i,o=!1,a=0;a<t.length;a++){r=t[a];for(var s=0,l=r.length-1;s<r.length;l=s++)n=r[s],i=r[l],n.y>e.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(o=!o)}return o}function d(t,e){for(var r=!1,n=0,i=t.length-1;n<t.length;i=n++){var o=t[n],a=t[i];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}e.exports={multiPolygonIntersectsBufferedMultiPoint:n,multiPolygonIntersectsMultiPolygon:i,multiPolygonIntersectsBufferedMultiLine:o}},{}],345:[function(t,e,r){"use strict";function n(t,e){this.max=t,this.onRemove=e,this.reset()}e.exports=n,n.prototype.reset=function(){for(var t in this.data)this.onRemove(this.data[t]);return this.data={},this.order=[],this},n.prototype.add=function(t,e){if(this.has(t))this.order.splice(this.order.indexOf(t),1),this.data[t]=e,this.order.push(t);else if(this.data[t]=e,this.order.push(t),this.order.length>this.max){var r=this.get(this.order[0]);r&&this.onRemove(r)}return this},n.prototype.has=function(t){return t in this.data},n.prototype.keys=function(){return this.order},n.prototype.get=function(t){if(!this.has(t))return null;var e=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),e},n.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this.get(this.order[0]);e&&this.onRemove(e)}return this}},{}],346:[function(t,e,r){"use strict";function n(t,e,r){if(r=r||i.ACCESS_TOKEN,!r&&i.REQUIRE_ACCESS_TOKEN)throw new Error("An API access token is required to use Mapbox GL. See https://www.mapbox.com/developers/api/#access-tokens");if(t=t.replace(/^mapbox:\/\//,i.API_URL+e),t+=-1!==t.indexOf("?")?"&access_token=":"?access_token=",i.REQUIRE_ACCESS_TOKEN){if("s"===r[0])throw new Error("Use a public access token (pk.*) with Mapbox GL JS, not a secret access token (sk.*). See https://www.mapbox.com/developers/api/#access-tokens");t+=r}return t}var i=t("./config"),o=t("./browser");e.exports.normalizeStyleURL=function(t,e){if(!t.match(/^mapbox:\/\/styles\//))return t;var r=t.split("/"),i=r[3],o=r[4],a=r[5]?"/draft":"";return n("mapbox://"+i+"/"+o+a,"/styles/v1/",e)},e.exports.normalizeSourceURL=function(t,e){return t.match(/^mapbox:\/\//)?n(t+".json","/v4/",e)+"&secure":t},e.exports.normalizeGlyphsURL=function(t,e){if(!t.match(/^mapbox:\/\//))return t;var r=t.split("/")[3];return n("mapbox://"+r+"/{fontstack}/{range}.pbf","/fonts/v1/",e)},e.exports.normalizeSpriteURL=function(t,e,r,i){if(!t.match(/^mapbox:\/\/sprites\//))return t+e+r;var o=t.split("/"),a=o[3],s=o[4],l=o[5]?"/draft":"";return n("mapbox://"+a+"/"+s+l+"/sprite"+e+r,"/styles/v1/",i)},e.exports.normalizeTileURL=function(t,e,r){if(!e||!e.match(/^mapbox:\/\//))return t;t=t.replace(/([?&]access_token=)tk\.[^&]+/,"1"+i.ACCESS_TOKEN);var n=o.supportsWebp?"webp":"$1";return t.replace(/\.((?:png|jpg)\d*)(?=$|\?)/,o.devicePixelRatio>=2||512===r?"@2x."+n:"."+n)}},{"./browser":335,"./config":339}],347:[function(t,e,r){"use strict";function n(t){function e(){f.apply(this,arguments)}function r(){d.apply(this,arguments),this.members=e.prototype.members}var n=JSON.stringify(t);if(m[n])return m[n];void 0===t.alignment&&(t.alignment=1),e.prototype=Object.create(f.prototype);var s=0,u=0,g=["Uint8"];return e.prototype.members=t.members.map(function(r){r={name:r.name,type:r.type,components:r.components||1},p(r.name.length),p(r.type in v),g.indexOf(r.type)<0&&g.push(r.type);var n=a(r.type);u=Math.max(u,n),r.offset=s=o(s,Math.max(t.alignment,n));for(var i=0;i<r.components;i++)Object.defineProperty(e.prototype,r.name+(1===r.components?"":i),{get:c(r,i),set:h(r,i)});return s+=n*r.components,r}),e.prototype.alignment=t.alignment,e.prototype.size=o(s,Math.max(u,t.alignment)),r.serialize=i,r.prototype=Object.create(d.prototype),r.prototype.StructType=e,r.prototype.bytesPerElement=e.prototype.size,r.prototype.emplaceBack=l(e.prototype.members,e.prototype.size),r.prototype._usedTypes=g,m[n]=r,r}function i(){return{members:this.prototype.StructType.prototype.members,alignment:this.prototype.StructType.prototype.alignment,bytesPerElement:this.prototype.bytesPerElement}}function o(t,e){return Math.ceil(t/e)*e}function a(t){return v[t].BYTES_PER_ELEMENT}function s(t){return t.toLowerCase()}function l(t,e){for(var r=[],n=[],i="var i = this.length;\nthis.resize(this.length + 1);\n",o=0;o<t.length;o++){var l=t[o],u=a(l.type);r.indexOf(u)<0&&(r.push(u),i+="var o"+u.toFixed(0)+" = i * "+(e/u).toFixed(0)+";\n");for(var c=0;c<l.components;c++){var h="v"+n.length,f="o"+u.toFixed(0)+" + "+(l.offset/u+c).toFixed(0);i+="this."+s(l.type)+"["+f+"] = "+h+";\n",n.push(h)}}return i+="return i;",new Function(n,i)}function u(t,e){var r="this._pos"+a(t.type).toFixed(0),n=(t.offset/a(t.type)+e).toFixed(0),i=r+" + "+n;return"this._structArray."+s(t.type)+"["+i+"]"}function c(t,e){return new Function([],"return "+u(t,e)+";")}function h(t,e){return new Function(["x"],u(t,e)+" = x;")}function f(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}function d(t){void 0!==t?(this.arrayBuffer=t.arrayBuffer,this.length=t.length,this.capacity=this.arrayBuffer.byteLength/this.bytesPerElement,this._refreshViews()):(this.capacity=-1,this.resize(0))}var p=t("assert");e.exports=n;var v={Int8:Int8Array,Uint8:Uint8Array,Uint8Clamped:Uint8ClampedArray,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array,Float64:Float64Array},m={};d.prototype.DEFAULT_CAPACITY=128,d.prototype.RESIZE_MULTIPLIER=5,d.prototype.serialize=function(){return this.trim(),{length:this.length,arrayBuffer:this.arrayBuffer}},d.prototype.get=function(t){return new this.StructType(this,t)},d.prototype.trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},d.prototype.resize=function(t){if(this.length=t,t>this.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*this.RESIZE_MULTIPLIER),this.DEFAULT_CAPACITY),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},d.prototype._refreshViews=function(){for(var t=0;t<this._usedTypes.length;t++){var e=this._usedTypes[t];this[s(e)]=new v[e](this.arrayBuffer)}}},{assert:52}],348:[function(t,e,r){"use strict";function n(t,e){return e.replace(/{([^{}()<>$=:;.,^]+)}/g,function(e,r){return r in t?t[r]:""})}e.exports=n},{}],349:[function(t,e,r){"use strict";var n=t("unitbezier"),i=t("../geo/coordinate");r.easeCubicInOut=function(t){if(0>=t)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(.5>t?r:3*(t-e)+r-.75)},r.bezier=function(t,e,r,i){var o=new n(t,e,r,i);return function(t){return o.solve(t)}},r.ease=r.bezier(.25,.1,.25,1),r.premultiply=function(t){if(!t)return null;var e=t[3];return[t[0]*e,t[1]*e,t[2]*e,e]},r.clamp=function(t,e,r){return Math.min(r,Math.max(e,t))},r.wrap=function(t,e,r){var n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i},r.coalesce=function(){for(var t=0;t<arguments.length;t++){var e=arguments[t];if(null!==e&&void 0!==e)return e}},r.asyncAll=function(t,e,r){if(!t.length)return r(null,[]);var n=t.length,i=new Array(t.length),o=null;t.forEach(function(t,a){e(t,function(t,e){t&&(o=t),i[a]=e,0===--n&&r(o,i)})})},r.keysDifference=function(t,e){var r=[];for(var n in t)n in e||r.push(n);return r},r.extend=function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)t[n]=r[n]}return t},r.extendAll=function(t,e){for(var r in e)Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r));return t},r.inherit=function(t,e){var n="function"==typeof t?t.prototype:t,i=Object.create(n);return r.extendAll(i,e),i},r.pick=function(t,e){for(var r={},n=0;n<e.length;n++){var i=e[n];i in t&&(r[i]=t[i])}return r};var o=1;r.uniqueId=function(){return o++},r.debounce=function(t,e){var r,n;return function(){n=arguments,clearTimeout(r),r=setTimeout(function(){t.apply(null,n)},e)}},r.bindAll=function(t,e){t.forEach(function(t){e[t]=e[t].bind(e)})},r.bindHandlers=function(t){for(var e in t)"function"==typeof t[e]&&0===e.indexOf("_on")&&(t[e]=t[e].bind(t))},r.setOptions=function(t,e){t.hasOwnProperty("options")||(t.options=t.options?Object.create(t.options):{});for(var r in e)t.options[r]=e[r];return t.options},r.getCoordinatesCenter=function(t){for(var e=1/0,r=1/0,n=-(1/0),o=-(1/0),a=0;a<t.length;a++)e=Math.min(e,t[a].column),r=Math.min(r,t[a].row),n=Math.max(n,t[a].column),o=Math.max(o,t[a].row);var s=n-e,l=o-r,u=Math.max(s,l);return new i((e+n)/2,(r+o)/2,0).zoomTo(Math.floor(-Math.log(u)/Math.LN2))},r.endsWith=function(t,e){return-1!==t.indexOf(e,t.length-e.length)},r.startsWith=function(t,e){return 0===t.indexOf(e)},r.mapObject=function(t,e,r){var n={};for(var i in t)n[i]=e.call(r||this,t[i],i,t);return n},r.filterObject=function(t,e,r){var n={};for(var i in t)e.call(r||this,t[i],i,t)&&(n[i]=t[i]);return n},r.deepEqual=function a(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(!a(t[r],e[r]))return!1;return!0}if("object"==typeof t){if("object"!=typeof e)return!1;var n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(var i in t)if(!a(t[i],e[i]))return!1;return!0}return t===e},r.clone=function(t){return Array.isArray(t)?t.map(r.clone):"object"==typeof t?r.mapObject(t,r.clone):t},r.arraysIntersect=function(t,e){for(var r=0;r<t.length;r++)if(e.indexOf(t[r])>=0)return!0;return!1}},{"../geo/coordinate":255,unitbezier:412}],350:[function(t,e,r){"use strict";function n(t,e,r,n){this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,t._id&&(this.id=t._id)}function i(t,e,r,n,i){for(var o=e*Math.pow(2,r),a=e*n,s=e*i,l=0;l<t.length;l++)for(var u=t[l],c=0;c<u.length;c++){var h=u[c],f=180-360*(h.y+s)/o;u[c]=[360*(h.x+a)/o-180,360/Math.PI*Math.atan(Math.exp(f*Math.PI/180))-90]}return t}var o=t("vector-tile").VectorTileFeature;e.exports=n,n.prototype={type:"Feature",get geometry(){if(void 0===this._geometry){var t=this._vectorTileFeature,e=i(t.loadGeometry(),t.extent,t._z,t._x,t._y),r=o.types[t.type];"Point"===r&&1===e.length?e=e[0][0]:"Point"===r?(e=e[0],r="MultiPoint"):"LineString"===r&&1===e.length?e=e[0]:"LineString"===r&&(r="MultiLineString"),this._geometry={type:r,coordinates:e},this._vectorTileFeature=null}return this._geometry},set geometry(t){this._geometry=t},toJSON:function(){var t={};for(var e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}},{"vector-tile":413}],351:[function(t,e,r){function n(t){return t=Math.round(t),0>t?0:t>255?255:t}function i(t){return 0>t?0:t>1?1:t}function o(t){return n("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function a(t){return i("%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))}function s(t,e,r){return 0>r?r+=1:r>1&&(r-=1),1>6*r?t+(e-t)*r*6:1>2*r?e:2>3*r?t+(e-t)*(2/3-r)*6:t}function l(t){var e=t.replace(/ /g,"").toLowerCase();if(e in u)return u[e].slice();if("#"===e[0]){if(4===e.length){var r=parseInt(e.substr(1),16);return r>=0&&4095>=r?[(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,1]:null}if(7===e.length){var r=parseInt(e.substr(1),16);return r>=0&&16777215>=r?[(16711680&r)>>16,(65280&r)>>8,255&r,1]:null}return null}var i=e.indexOf("("),l=e.indexOf(")");if(-1!==i&&l+1===e.length){var c=e.substr(0,i),h=e.substr(i+1,l-(i+1)).split(","),f=1;switch(c){case"rgba":if(4!==h.length)return null;f=a(h.pop());case"rgb":return 3!==h.length?null:[o(h[0]),o(h[1]),o(h[2]),f];case"hsla":if(4!==h.length)return null;f=a(h.pop());case"hsl":if(3!==h.length)return null;var d=(parseFloat(h[0])%360+360)%360/360,p=a(h[1]),v=a(h[2]),m=.5>=v?v*(p+1):v+p-v*p,g=2*v-m;return[n(255*s(g,m,d+1/3)),n(255*s(g,m,d)),n(255*s(g,m,d-1/3)),f];default:return null}}return null}var u={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1], dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};try{r.parseCSSColor=l}catch(c){}},{}],352:[function(t,e,r){"use strict";function n(t){return new Function("f","var p = (f && f.properties || {}); return "+i(t))}function i(t){if(!t)return"true";var e=t[0];if(t.length<=1)return"any"===e?"false":"true";var r="=="===e?a(t[1],t[2],"===",!1):"!="===e?a(t[1],t[2],"!==",!1):"<"===e||">"===e||"<="===e||">="===e?a(t[1],t[2],e,!0):"any"===e?s(t.slice(1),"||"):"all"===e?s(t.slice(1),"&&"):"none"===e?c(s(t.slice(1),"||")):"in"===e?l(t[1],t.slice(2)):"!in"===e?c(l(t[1],t.slice(2))):"has"===e?u(t[1]):"!has"===e?c(u([t[1]])):"true";return"("+r+")"}function o(t){return"$type"===t?"f.type":"p["+JSON.stringify(t)+"]"}function a(t,e,r,n){var i=o(t),a="$type"===t?f.indexOf(e):JSON.stringify(e);return(n?"typeof "+i+"=== typeof "+a+"&&":"")+i+r+a}function s(t,e){return t.map(i).join(e)}function l(t,e){"$type"===t&&(e=e.map(function(t){return f.indexOf(t)}));var r=JSON.stringify(e.sort(h)),n=o(t);return e.length<=200?r+".indexOf("+n+") !== -1":"function(v, a, i, j) {while (i <= j) { var m = (i + j) >> 1;    if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;}return false; }("+n+", "+r+",0,"+(e.length-1)+")"}function u(t){return JSON.stringify(t)+" in p"}function c(t){return"!("+t+")"}function h(t,e){return e>t?-1:t>e?1:0}e.exports=n;var f=["Unknown","Point","LineString","Polygon"]},{}],353:[function(t,e,r){function n(t,e){switch(t&&t.type||null){case"FeatureCollection":return t.features=t.features.map(i(n,e)),t;case"Feature":return t.geometry=n(t.geometry,e),t;case"Polygon":case"MultiPolygon":return o(t,e);default:return t}}function i(t,e){return function(r){return t(r,e)}}function o(t,e){return"Polygon"===t.type?t.coordinates=a(t.coordinates,e):"MultiPolygon"===t.type&&(t.coordinates=t.coordinates.map(i(a,e))),t}function a(t,e){e=!!e,t[0]=s(t[0],!e);for(var r=1;r<t.length;r++)t[r]=s(t[r],e);return t}function s(t,e){return l(t)===e?t:t.reverse()}function l(t){return u.ring(t)>=0}var u=t("geojson-area");e.exports=n},{"geojson-area":354}],354:[function(t,e,r){function n(t){if("Polygon"===t.type)return i(t.coordinates);if("MultiPolygon"===t.type){for(var e=0,r=0;r<t.coordinates.length;r++)e+=i(t.coordinates[r]);return e}return null}function i(t){var e=0;if(t&&t.length>0){e+=Math.abs(o(t[0]));for(var r=1;r<t.length;r++)e-=Math.abs(o(t[r]))}return e}function o(t){var e=0;if(t.length>2){for(var r,n,i=0;i<t.length-1;i++)r=t[i],n=t[i+1],e+=a(n[0]-r[0])*(2+Math.sin(a(r[1]))+Math.sin(a(n[1])));e=e*s.RADIUS*s.RADIUS/2}return e}function a(t){return t*Math.PI/180}var s=t("wgs84");e.exports.geometry=n,e.exports.ring=o},{wgs84:355}],355:[function(t,e,r){e.exports.RADIUS=6378137,e.exports.FLATTENING=1/298.257223563,e.exports.POLAR_RADIUS=6356752.3142},{}],356:[function(t,e,r){"use strict";function n(t,e,r,n,a,s,l,u){if(r/=e,n/=e,l>=r&&n>=u)return t;if(l>n||r>u)return null;for(var c=[],h=0;h<t.length;h++){var f,d,p=t[h],v=p.geometry,m=p.type;if(f=p.min[a],d=p.max[a],f>=r&&n>=d)c.push(p);else if(!(f>n||r>d)){var g=1===m?i(v,r,n,a):o(v,r,n,a,s,3===m);g.length&&c.push({geometry:g,type:m,tags:t[h].tags||null,min:p.min,max:p.max})}}return c.length?c:null}function i(t,e,r,n){for(var i=[],o=0;o<t.length;o++){var a=t[o],s=a[n];s>=e&&r>=s&&i.push(a)}return i}function o(t,e,r,n,i,o){for(var s=[],l=0;l<t.length;l++){var u,c,h,f=0,d=0,p=null,v=t[l],m=v.area,g=v.dist,y=v.length,b=[];for(c=0;y-1>c;c++)u=p||v[c],p=v[c+1],f=d||u[n],d=p[n],e>f?d>r?(b.push(i(u,p,e),i(u,p,r)),o||(b=a(s,b,m,g))):d>=e&&b.push(i(u,p,e)):f>r?e>d?(b.push(i(u,p,r),i(u,p,e)),o||(b=a(s,b,m,g))):r>=d&&b.push(i(u,p,r)):(b.push(u),e>d?(b.push(i(u,p,e)),o||(b=a(s,b,m,g))):d>r&&(b.push(i(u,p,r)),o||(b=a(s,b,m,g))));u=v[y-1],f=u[n],f>=e&&r>=f&&b.push(u),h=b[b.length-1],o&&h&&(b[0][0]!==h[0]||b[0][1]!==h[1])&&b.push(b[0]),a(s,b,m,g)}return s}function a(t,e,r,n){return e.length&&(e.area=r,e.dist=n,t.push(e)),[]}e.exports=n},{}],357:[function(t,e,r){"use strict";function n(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)i(r,t.features[n],e);else"Feature"===t.type?i(r,t,e):i(r,{geometry:t},e);return r}function i(t,e,r){var n,l,u,c=e.geometry,h=c.type,f=c.coordinates,d=e.properties;if("Point"===h)t.push(o(d,1,[s(f)]));else if("MultiPoint"===h)t.push(o(d,1,a(f)));else if("LineString"===h)t.push(o(d,2,[a(f,r)]));else if("MultiLineString"===h||"Polygon"===h){for(u=[],n=0;n<f.length;n++)u.push(a(f[n],r));t.push(o(d,"Polygon"===h?3:2,u))}else if("MultiPolygon"===h){for(u=[],n=0;n<f.length;n++)for(l=0;l<f[n].length;l++)u.push(a(f[n][l],r));t.push(o(d,3,u))}else{if("GeometryCollection"!==h)throw new Error("Input data is not a valid GeoJSON object.");for(n=0;n<c.geometries.length;n++)i(t,{geometry:c.geometries[n],properties:d},r)}}function o(t,e,r){var n={geometry:r,type:e,tags:t||null,min:[2,1],max:[-1,0]};return u(n),n}function a(t,e){for(var r=[],n=0;n<t.length;n++)r.push(s(t[n]));return e&&(h(r,e),l(r)),r}function s(t){var e=Math.sin(t[1]*Math.PI/180),r=t[0]/360+.5,n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n=-1>n?-1:n>1?1:n,[r,n,0]}function l(t){for(var e,r,n=0,i=0,o=0;o<t.length-1;o++)e=r||t[o],r=t[o+1],n+=e[0]*r[1]-r[0]*e[1],i+=Math.abs(r[0]-e[0])+Math.abs(r[1]-e[1]);t.area=Math.abs(n/2),t.dist=i}function u(t){var e=t.geometry,r=t.min,n=t.max;if(1===t.type)c(r,n,e);else for(var i=0;i<e.length;i++)c(r,n,e[i]);return t}function c(t,e,r){for(var n,i=0;i<r.length;i++)n=r[i],t[0]=Math.min(n[0],t[0]),e[0]=Math.max(n[0],e[0]),t[1]=Math.min(n[1],t[1]),e[1]=Math.max(n[1],e[1])}e.exports=n;var h=t("./simplify")},{"./simplify":359}],358:[function(t,e,r){"use strict";function n(t,e){return new i(t,e)}function i(t,e){e=this.options=l(Object.create(this.options),e);var r=e.debug;r&&console.time("preprocess data");var n=1<<e.maxZoom,i=c(t,e.tolerance/(n*e.extent));this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),i=d(i,e.buffer/e.extent,a),i.length&&this.splitTile(i,0,0,0),r&&(i.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function o(t,e,r){return 32*((1<<t)*r+e)+t}function a(t,e,r){return[r,(r-t[0])*(e[1]-t[1])/(e[0]-t[0])+t[1],1]}function s(t,e,r){return[(r-t[1])*(e[0]-t[0])/(e[1]-t[1])+t[0],r,1]}function l(t,e){for(var r in e)t[r]=e[r];return t}function u(t,e,r){var n=t.source;if(1!==n.length)return!1;var i=n[0];if(3!==i.type||i.geometry.length>1)return!1;var o=i.geometry[0].length;if(5!==o)return!1;for(var a=0;o>a;a++){var s=h.point(i.geometry[0][a],e,t.z2,t.x,t.y);if(s[0]!==-r&&s[0]!==e+r||s[1]!==-r&&s[1]!==e+r)return!1}return!0}e.exports=n;var c=t("./convert"),h=t("./transform"),f=t("./clip"),d=t("./wrap"),p=t("./tile");i.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,solidChildren:!1,tolerance:3,extent:4096,buffer:64,debug:0},i.prototype.splitTile=function(t,e,r,n,i,l,c){for(var h=[t,e,r,n],d=this.options,v=d.debug,m=null;h.length;){n=h.pop(),r=h.pop(),e=h.pop(),t=h.pop();var g=1<<e,y=o(e,r,n),b=this.tiles[y],x=e===d.maxZoom?0:d.tolerance/(g*d.extent);if(!b&&(v>1&&console.time("creation"),b=this.tiles[y]=p(t,g,r,n,x,e===d.maxZoom),this.tileCoords.push({z:e,x:r,y:n}),v)){v>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,b.numFeatures,b.numPoints,b.numSimplified),console.timeEnd("creation"));var _="z"+e;this.stats[_]=(this.stats[_]||0)+1,this.total++}if(b.source=t,i){if(e===d.maxZoom||e===i)continue;var w=1<<i-e;if(r!==Math.floor(l/w)||n!==Math.floor(c/w))continue}else if(e===d.indexMaxZoom||b.numPoints<=d.indexMaxPoints)continue;if(d.solidChildren||!u(b,d.extent,d.buffer)){b.source=null,v>1&&console.time("clipping");var M,k,A,T,E,S,L=.5*d.buffer/d.extent,z=.5-L,I=.5+L,P=1+L;M=k=A=T=null,E=f(t,g,r-L,r+I,0,a,b.min[0],b.max[0]),S=f(t,g,r+z,r+P,0,a,b.min[0],b.max[0]),E&&(M=f(E,g,n-L,n+I,1,s,b.min[1],b.max[1]),k=f(E,g,n+z,n+P,1,s,b.min[1],b.max[1])),S&&(A=f(S,g,n-L,n+I,1,s,b.min[1],b.max[1]),T=f(S,g,n+z,n+P,1,s,b.min[1],b.max[1])),v>1&&console.timeEnd("clipping"),M&&h.push(M,e+1,2*r,2*n),k&&h.push(k,e+1,2*r,2*n+1),A&&h.push(A,e+1,2*r+1,2*n),T&&h.push(T,e+1,2*r+1,2*n+1)}else i&&(m=e)}return m},i.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,a=n.debug,s=1<<t;e=(e%s+s)%s;var l=o(t,e,r);if(this.tiles[l])return h.tile(this.tiles[l],i);a>1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var c,f=t,d=e,p=r;!c&&f>0;)f--,d=Math.floor(d/2),p=Math.floor(p/2),c=this.tiles[o(f,d,p)];if(!c||!c.source)return null;if(a>1&&console.log("found parent tile z%d-%d-%d",f,d,p),u(c,i,n.buffer))return h.tile(c,i);a>1&&console.time("drilling down");var v=this.splitTile(c.source,f,d,p,t,e,r);if(a>1&&console.timeEnd("drilling down"),null!==v){var m=1<<t-v;l=o(v,Math.floor(e/m),Math.floor(r/m))}return this.tiles[l]?h.tile(this.tiles[l],i):null}},{"./clip":356,"./convert":357,"./tile":360,"./transform":361,"./wrap":362}],359:[function(t,e,r){"use strict";function n(t,e){var r,n,o,a,s=e*e,l=t.length,u=0,c=l-1,h=[];for(t[u][2]=1,t[c][2]=1;c;){for(n=0,r=u+1;c>r;r++)o=i(t[r],t[u],t[c]),o>n&&(a=r,n=o);n>s?(t[a][2]=n,h.push(u),h.push(a),u=a):(c=h.pop(),u=h.pop())}}function i(t,e,r){var n=e[0],i=e[1],o=r[0],a=r[1],s=t[0],l=t[1],u=o-n,c=a-i;if(0!==u||0!==c){var h=((s-n)*u+(l-i)*c)/(u*u+c*c);h>1?(n=o,i=a):h>0&&(n+=u*h,i+=c*h)}return u=s-n,c=l-i,u*u+c*c}e.exports=n},{}],360:[function(t,e,r){"use strict";function n(t,e,r,n,o,a){for(var s={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z2:e,transformed:!1,min:[2,1],max:[-1,0]},l=0;l<t.length;l++){s.numFeatures++,i(s,t[l],o,a);var u=t[l].min,c=t[l].max;u[0]<s.min[0]&&(s.min[0]=u[0]),u[1]<s.min[1]&&(s.min[1]=u[1]),c[0]>s.max[0]&&(s.max[0]=c[0]),c[1]>s.max[1]&&(s.max[1]=c[1])}return s}function i(t,e,r,n){var i,o,a,s,l=e.geometry,u=e.type,c=[],h=r*r;if(1===u)for(i=0;i<l.length;i++)c.push(l[i]),t.numPoints++,t.numSimplified++;else for(i=0;i<l.length;i++)if(a=l[i],n||!(2===u&&a.dist<r||3===u&&a.area<h)){var f=[];for(o=0;o<a.length;o++)s=a[o],(n||s[2]>h)&&(f.push(s),t.numSimplified++),t.numPoints++;c.push(f)}else t.numPoints+=a.length;c.length&&t.features.push({geometry:c,type:u,tags:e.tags||null})}e.exports=n},{}],361:[function(t,e,r){"use strict";function n(t,e){if(t.transformed)return t;var r,n,o,a=t.z2,s=t.x,l=t.y;for(r=0;r<t.features.length;r++){var u=t.features[r],c=u.geometry,h=u.type;if(1===h)for(n=0;n<c.length;n++)c[n]=i(c[n],e,a,s,l);else for(n=0;n<c.length;n++){var f=c[n];for(o=0;o<f.length;o++)f[o]=i(f[o],e,a,s,l)}}return t.transformed=!0,t}function i(t,e,r,n,i){var o=Math.round(e*(t[0]*r-n)),a=Math.round(e*(t[1]*r-i));return[o,a]}r.tile=n,r.point=i},{}],362:[function(t,e,r){"use strict";function n(t,e,r){var n=t,o=a(t,1,-1-e,e,0,r,-1,2),s=a(t,1,1-e,2+e,0,r,-1,2);return(o||s)&&(n=a(t,1,-e,1+e,0,r,-1,2),o&&(n=i(o,1).concat(n)),s&&(n=n.concat(i(s,-1)))),n}function i(t,e){for(var r=[],n=0;n<t.length;n++){var i,a=t[n],s=a.type;if(1===s)i=o(a.geometry,e);else{i=[];for(var l=0;l<a.geometry.length;l++)i.push(o(a.geometry[l],e))}r.push({geometry:i,type:s,tags:a.tags,min:[a.min[0]+e,a.min[1]],max:[a.max[0]+e,a.max[1]]})}return r}function o(t,e){var r=[];r.area=t.area,r.dist=t.dist;for(var n=0;n<t.length;n++)r.push([t[n][0]+e,t[n][1],t[n][2]]);return r}var a=t("./clip");e.exports=n},{"./clip":356}],363:[function(t,e,r){r.glMatrix=t("./gl-matrix/common.js"),r.mat2=t("./gl-matrix/mat2.js"),r.mat2d=t("./gl-matrix/mat2d.js"),r.mat3=t("./gl-matrix/mat3.js"),r.mat4=t("./gl-matrix/mat4.js"),r.quat=t("./gl-matrix/quat.js"),r.vec2=t("./gl-matrix/vec2.js"),r.vec3=t("./gl-matrix/vec3.js"),r.vec4=t("./gl-matrix/vec4.js")},{"./gl-matrix/common.js":364,"./gl-matrix/mat2.js":365,"./gl-matrix/mat2d.js":366,"./gl-matrix/mat3.js":367,"./gl-matrix/mat4.js":368,"./gl-matrix/quat.js":369,"./gl-matrix/vec2.js":370,"./gl-matrix/vec3.js":371,"./gl-matrix/vec4.js":372}],364:[function(t,e,r){var n={};n.EPSILON=1e-6,n.ARRAY_TYPE="undefined"!=typeof Float32Array?Float32Array:Array,n.RANDOM=Math.random,n.ENABLE_SIMD=!1,n.SIMD_AVAILABLE=n.ARRAY_TYPE===Float32Array&&"SIMD"in this,n.USE_SIMD=n.ENABLE_SIMD&&n.SIMD_AVAILABLE,n.setMatrixArrayType=function(t){n.ARRAY_TYPE=t};var i=Math.PI/180;n.toRadian=function(t){return t*i},n.equals=function(t,e){return Math.abs(t-e)<=n.EPSILON*Math.max(1,Math.abs(t),Math.abs(e))},e.exports=n},{}],365:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},i.clone=function(t){var e=new n.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},i.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},i.fromValues=function(t,e,r,i){var o=new n.ARRAY_TYPE(4);return o[0]=t,o[1]=e,o[2]=r,o[3]=i,o},i.set=function(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t},i.transpose=function(t,e){if(t===e){var r=e[1];t[1]=e[2],t[2]=r}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t},i.invert=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*o-i*n;return a?(a=1/a,t[0]=o*a,t[1]=-n*a,t[2]=-i*a,t[3]=r*a,t):null},i.adjoint=function(t,e){var r=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=r,t},i.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},i.multiply=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=r[0],l=r[1],u=r[2],c=r[3];return t[0]=n*s+o*l,t[1]=i*s+a*l,t[2]=n*u+o*c,t[3]=i*u+a*c,t},i.mul=i.multiply,i.rotate=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+o*s,t[1]=i*l+a*s,t[2]=n*-s+o*l,t[3]=i*-s+a*l,t},i.scale=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=r[0],l=r[1];return t[0]=n*s,t[1]=i*s,t[2]=o*l,t[3]=a*l,t},i.fromRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t},i.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t},i.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},i.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))},i.LDU=function(t,e,r,n){return t[2]=n[2]/n[0],r[0]=n[0],r[1]=n[1],r[3]=n[3]-t[2]*r[1],[t,e,r]},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t},i.sub=i.subtract,i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},i.equals=function(t,e){var r=t[0],i=t[1],o=t[2],a=t[3],s=e[0],l=e[1],u=e[2],c=e[3];return Math.abs(r-s)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-l)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))&&Math.abs(a-c)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))},i.multiplyScalar=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},i.multiplyScalarAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t},e.exports=i},{"./common.js":364}],366:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(6);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},i.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},i.fromValues=function(t,e,r,i,o,a){var s=new n.ARRAY_TYPE(6);return s[0]=t,s[1]=e,s[2]=r,s[3]=i,s[4]=o,s[5]=a,s},i.set=function(t,e,r,n,i,o,a){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=o,t[5]=a,t},i.invert=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=r*o-n*i;return l?(l=1/l,t[0]=o*l,t[1]=-n*l,t[2]=-i*l,t[3]=r*l,t[4]=(i*s-o*a)*l,t[5]=(n*a-r*s)*l,t):null},i.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},i.multiply=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=r[0],c=r[1],h=r[2],f=r[3],d=r[4],p=r[5];return t[0]=n*u+o*c,t[1]=i*u+a*c,t[2]=n*h+o*f,t[3]=i*h+a*f,t[4]=n*d+o*p+s,t[5]=i*d+a*p+l,t},i.mul=i.multiply,i.rotate=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=Math.sin(r),c=Math.cos(r);return t[0]=n*c+o*u,t[1]=i*c+a*u,t[2]=n*-u+o*c,t[3]=i*-u+a*c,t[4]=s,t[5]=l,t},i.scale=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=r[0],c=r[1];return t[0]=n*u,t[1]=i*u,t[2]=o*c,t[3]=a*c,t[4]=s,t[5]=l,t},i.translate=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=r[0],c=r[1];return t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=n*u+o*c+s,t[5]=i*u+a*c+l,t},i.fromRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t[4]=0,t[5]=0,t},i.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t},i.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t},i.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},i.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)},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t},i.sub=i.subtract,i.multiplyScalar=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t},i.multiplyScalarAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]},i.equals=function(t,e){var r=t[0],i=t[1],o=t[2],a=t[3],s=t[4],l=t[5],u=e[0],c=e[1],h=e[2],f=e[3],d=e[4],p=e[5];return Math.abs(r-u)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(u))&&Math.abs(i-c)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(o-h)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(a-f)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(f))&&Math.abs(s-d)<=n.EPSILON*Math.max(1,Math.abs(s),Math.abs(d))&&Math.abs(l-p)<=n.EPSILON*Math.max(1,Math.abs(l),Math.abs(p))},e.exports=i},{"./common.js":364}],367:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(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},i.fromMat4=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t},i.clone=function(t){var e=new n.ARRAY_TYPE(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},i.fromValues=function(t,e,r,i,o,a,s,l,u){var c=new n.ARRAY_TYPE(9);return c[0]=t,c[1]=e,c[2]=r,c[3]=i,c[4]=o,c[5]=a,c[6]=s,c[7]=l,c[8]=u,c},i.set=function(t,e,r,n,i,o,a,s,l,u){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=l,t[8]=u,t},i.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},i.transpose=function(t,e){if(t===e){var r=e[1],n=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,t[7]=i}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t},i.invert=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=c*a-s*u,f=-c*o+s*l,d=u*o-a*l,p=r*h+n*f+i*d;return p?(p=1/p,t[0]=h*p,t[1]=(-c*n+i*u)*p,t[2]=(s*n-i*a)*p,t[3]=f*p,t[4]=(c*r-i*l)*p,t[5]=(-s*r+i*o)*p,t[6]=d*p,t[7]=(-u*r+n*l)*p,t[8]=(a*r-n*o)*p,t):null},i.adjoint=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8];return t[0]=a*c-s*u,t[1]=i*u-n*c,t[2]=n*s-i*a,t[3]=s*l-o*c,t[4]=r*c-i*l,t[5]=i*o-r*s,t[6]=o*u-a*l,t[7]=n*l-r*u,t[8]=r*a-n*o,t},i.determinant=function(t){var e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8];return e*(u*o-a*l)+r*(-u*i+a*s)+n*(l*i-o*s)},i.multiply=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],f=r[0],d=r[1],p=r[2],v=r[3],m=r[4],g=r[5],y=r[6],b=r[7],x=r[8];return t[0]=f*n+d*a+p*u,t[1]=f*i+d*s+p*c,t[2]=f*o+d*l+p*h,t[3]=v*n+m*a+g*u,t[4]=v*i+m*s+g*c,t[5]=v*o+m*l+g*h,t[6]=y*n+b*a+x*u,t[7]=y*i+b*s+x*c,t[8]=y*o+b*l+x*h,t},i.mul=i.multiply,i.translate=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],f=r[0],d=r[1];return t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=f*n+d*a+u,t[7]=f*i+d*s+c,t[8]=f*o+d*l+h,t},i.rotate=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],f=Math.sin(r),d=Math.cos(r);return t[0]=d*n+f*a,t[1]=d*i+f*s,t[2]=d*o+f*l,t[3]=d*a-f*n,t[4]=d*s-f*i,t[5]=d*l-f*o,t[6]=u,t[7]=c,t[8]=h,t},i.scale=function(t,e,r){var n=r[0],i=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},i.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t},i.fromRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=-r,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},i.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},i.fromMat2d=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t},i.fromQuat=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,s=n+n,l=i+i,u=r*a,c=n*a,h=n*s,f=i*a,d=i*s,p=i*l,v=o*a,m=o*s,g=o*l;return t[0]=1-h-p,t[3]=c-g,t[6]=f+m,t[1]=c+g,t[4]=1-u-p,t[7]=d-v,t[2]=f-m,t[5]=d+v,t[8]=1-u-h,t},i.normalFromMat4=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=e[9],f=e[10],d=e[11],p=e[12],v=e[13],m=e[14],g=e[15],y=r*s-n*a,b=r*l-i*a,x=r*u-o*a,_=n*l-i*s,w=n*u-o*s,M=i*u-o*l,k=c*v-h*p,A=c*m-f*p,T=c*g-d*p,E=h*m-f*v,S=h*g-d*v,L=f*g-d*m,z=y*L-b*S+x*E+_*T-w*A+M*k;return z?(z=1/z,t[0]=(s*L-l*S+u*E)*z,t[1]=(l*T-a*L-u*A)*z,t[2]=(a*S-s*T+u*k)*z,t[3]=(i*S-n*L-o*E)*z,t[4]=(r*L-i*T+o*A)*z,t[5]=(n*T-r*S-o*k)*z,t[6]=(v*M-m*w+g*_)*z,t[7]=(m*x-p*M-g*b)*z,t[8]=(p*w-v*x+g*y)*z,t):null},i.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},i.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))},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t},i.sub=i.subtract,i.multiplyScalar=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t},i.multiplyScalarAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},i.equals=function(t,e){var r=t[0],i=t[1],o=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],f=e[0],d=e[1],p=e[2],v=e[3],m=e[4],g=e[5],y=t[6],b=e[7],x=e[8];return Math.abs(r-f)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(f))&&Math.abs(i-d)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(o-p)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(a-v)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(s-m)<=n.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(l-g)<=n.EPSILON*Math.max(1,Math.abs(l),Math.abs(g))&&Math.abs(u-y)<=n.EPSILON*Math.max(1,Math.abs(u),Math.abs(y))&&Math.abs(c-b)<=n.EPSILON*Math.max(1,Math.abs(c),Math.abs(b))&&Math.abs(h-x)<=n.EPSILON*Math.max(1,Math.abs(h),Math.abs(x))},e.exports=i},{"./common.js":364}],368:[function(t,e,r){var n=t("./common.js"),i={scalar:{},SIMD:{}};i.create=function(){var t=new n.ARRAY_TYPE(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},i.clone=function(t){var e=new n.ARRAY_TYPE(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},i.fromValues=function(t,e,r,i,o,a,s,l,u,c,h,f,d,p,v,m){var g=new n.ARRAY_TYPE(16);return g[0]=t,g[1]=e,g[2]=r,g[3]=i,g[4]=o,g[5]=a,g[6]=s,g[7]=l,g[8]=u,g[9]=c,g[10]=h,g[11]=f,g[12]=d,g[13]=p,g[14]=v,g[15]=m,g},i.set=function(t,e,r,n,i,o,a,s,l,u,c,h,f,d,p,v,m){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=l,t[8]=u,t[9]=c,t[10]=h,t[11]=f,t[12]=d,t[13]=p,t[14]=v,t[15]=m,t},i.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},i.scalar.transpose=function(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=i,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t},i.SIMD.transpose=function(t,e){var r,n,i,o,a,s,l,u,c,h;return r=SIMD.Float32x4.load(e,0),n=SIMD.Float32x4.load(e,4),i=SIMD.Float32x4.load(e,8),o=SIMD.Float32x4.load(e,12),a=SIMD.Float32x4.shuffle(r,n,0,1,4,5),s=SIMD.Float32x4.shuffle(i,o,0,1,4,5),l=SIMD.Float32x4.shuffle(a,s,0,2,4,6),u=SIMD.Float32x4.shuffle(a,s,1,3,5,7),SIMD.Float32x4.store(t,0,l),SIMD.Float32x4.store(t,4,u),a=SIMD.Float32x4.shuffle(r,n,2,3,6,7),s=SIMD.Float32x4.shuffle(i,o,2,3,6,7),c=SIMD.Float32x4.shuffle(a,s,0,2,4,6),h=SIMD.Float32x4.shuffle(a,s,1,3,5,7),SIMD.Float32x4.store(t,8,c),SIMD.Float32x4.store(t,12,h),t},i.transpose=n.USE_SIMD?i.SIMD.transpose:i.scalar.transpose,i.scalar.invert=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=e[9],f=e[10],d=e[11],p=e[12],v=e[13],m=e[14],g=e[15],y=r*s-n*a,b=r*l-i*a,x=r*u-o*a,_=n*l-i*s,w=n*u-o*s,M=i*u-o*l,k=c*v-h*p,A=c*m-f*p,T=c*g-d*p,E=h*m-f*v,S=h*g-d*v,L=f*g-d*m,z=y*L-b*S+x*E+_*T-w*A+M*k;return z?(z=1/z,t[0]=(s*L-l*S+u*E)*z,t[1]=(i*S-n*L-o*E)*z,t[2]=(v*M-m*w+g*_)*z,t[3]=(f*w-h*M-d*_)*z,t[4]=(l*T-a*L-u*A)*z,t[5]=(r*L-i*T+o*A)*z,t[6]=(m*x-p*M-g*b)*z,t[7]=(c*M-f*x+d*b)*z,t[8]=(a*S-s*T+u*k)*z,t[9]=(n*T-r*S-o*k)*z,t[10]=(p*w-v*x+g*y)*z,t[11]=(h*x-c*w-d*y)*z,t[12]=(s*A-a*E-l*k)*z,t[13]=(r*E-n*A+i*k)*z,t[14]=(v*b-p*_-m*y)*z,t[15]=(c*_-h*b+f*y)*z,t):null},i.SIMD.invert=function(t,e){var r,n,i,o,a,s,l,u,c,h,f=SIMD.Float32x4.load(e,0),d=SIMD.Float32x4.load(e,4),p=SIMD.Float32x4.load(e,8),v=SIMD.Float32x4.load(e,12);return a=SIMD.Float32x4.shuffle(f,d,0,1,4,5),n=SIMD.Float32x4.shuffle(p,v,0,1,4,5),r=SIMD.Float32x4.shuffle(a,n,0,2,4,6),n=SIMD.Float32x4.shuffle(n,a,1,3,5,7),a=SIMD.Float32x4.shuffle(f,d,2,3,6,7),o=SIMD.Float32x4.shuffle(p,v,2,3,6,7),i=SIMD.Float32x4.shuffle(a,o,0,2,4,6),o=SIMD.Float32x4.shuffle(o,a,1,3,5,7),a=SIMD.Float32x4.mul(i,o),a=SIMD.Float32x4.swizzle(a,1,0,3,2),s=SIMD.Float32x4.mul(n,a),l=SIMD.Float32x4.mul(r,a),a=SIMD.Float32x4.swizzle(a,2,3,0,1),s=SIMD.Float32x4.sub(SIMD.Float32x4.mul(n,a),s),l=SIMD.Float32x4.sub(SIMD.Float32x4.mul(r,a),l),l=SIMD.Float32x4.swizzle(l,2,3,0,1),a=SIMD.Float32x4.mul(n,i),a=SIMD.Float32x4.swizzle(a,1,0,3,2),s=SIMD.Float32x4.add(SIMD.Float32x4.mul(o,a),s),c=SIMD.Float32x4.mul(r,a),a=SIMD.Float32x4.swizzle(a,2,3,0,1),s=SIMD.Float32x4.sub(s,SIMD.Float32x4.mul(o,a)),c=SIMD.Float32x4.sub(SIMD.Float32x4.mul(r,a),c),c=SIMD.Float32x4.swizzle(c,2,3,0,1),a=SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(n,2,3,0,1),o),a=SIMD.Float32x4.swizzle(a,1,0,3,2),i=SIMD.Float32x4.swizzle(i,2,3,0,1),s=SIMD.Float32x4.add(SIMD.Float32x4.mul(i,a),s),u=SIMD.Float32x4.mul(r,a),a=SIMD.Float32x4.swizzle(a,2,3,0,1),s=SIMD.Float32x4.sub(s,SIMD.Float32x4.mul(i,a)),u=SIMD.Float32x4.sub(SIMD.Float32x4.mul(r,a),u),u=SIMD.Float32x4.swizzle(u,2,3,0,1),a=SIMD.Float32x4.mul(r,n),a=SIMD.Float32x4.swizzle(a,1,0,3,2),u=SIMD.Float32x4.add(SIMD.Float32x4.mul(o,a),u),c=SIMD.Float32x4.sub(SIMD.Float32x4.mul(i,a),c),a=SIMD.Float32x4.swizzle(a,2,3,0,1),u=SIMD.Float32x4.sub(SIMD.Float32x4.mul(o,a),u),c=SIMD.Float32x4.sub(c,SIMD.Float32x4.mul(i,a)),a=SIMD.Float32x4.mul(r,o),a=SIMD.Float32x4.swizzle(a,1,0,3,2),l=SIMD.Float32x4.sub(l,SIMD.Float32x4.mul(i,a)),u=SIMD.Float32x4.add(SIMD.Float32x4.mul(n,a),u),a=SIMD.Float32x4.swizzle(a,2,3,0,1),l=SIMD.Float32x4.add(SIMD.Float32x4.mul(i,a),l),u=SIMD.Float32x4.sub(u,SIMD.Float32x4.mul(n,a)),a=SIMD.Float32x4.mul(r,i),a=SIMD.Float32x4.swizzle(a,1,0,3,2),l=SIMD.Float32x4.add(SIMD.Float32x4.mul(o,a),l),c=SIMD.Float32x4.sub(c,SIMD.Float32x4.mul(n,a)),a=SIMD.Float32x4.swizzle(a,2,3,0,1),l=SIMD.Float32x4.sub(l,SIMD.Float32x4.mul(o,a)),c=SIMD.Float32x4.add(SIMD.Float32x4.mul(n,a),c),
t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},i.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t},i.distance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return Math.sqrt(r*r+n*n+i*i+o*o)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return r*r+n*n+i*i+o*o},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.sqrt(e*e+r*r+n*n+i*i)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*r+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a),t[0]=r*a,t[1]=n*a,t[2]=i*a,t[3]=o*a),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},i.lerp=function(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t[3]=s+n*(r[3]-s),t},i.random=function(t,e){return e=e||1,t[0]=n.RANDOM(),t[1]=n.RANDOM(),t[2]=n.RANDOM(),t[3]=n.RANDOM(),i.normalize(t,t),i.scale(t,t,e),t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t},i.transformQuat=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*o-l*i,h=u*i+l*n-a*o,f=u*o+a*i-s*n,d=-a*n-s*i-l*o;return t[0]=c*u+d*-a+h*-l-f*-s,t[1]=h*u+d*-s+f*-a-c*-l,t[2]=f*u+d*-l+c*-s-h*-a,t[3]=e[3],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,o,a){var s,l;for(r||(r=4),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;l>s;s+=r)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],t[3]=e[s+3],o(t,t,a),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2],e[s+3]=t[3];return e}}(),i.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},i.equals=function(t,e){var r=t[0],i=t[1],o=t[2],a=t[3],s=e[0],l=e[1],u=e[2],c=e[3];return Math.abs(r-s)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-l)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))&&Math.abs(a-c)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))},e.exports=i},{"./common.js":364}],373:[function(t,e,r){"use strict";function n(t,e,r){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var o=new Int32Array(this.arrayBuffer);t=o[0],e=o[1],r=o[2],this.d=e+2*r;for(var a=0;a<this.d*this.d;a++){var s=o[i+a],l=o[i+a+1];n.push(s===l?null:o.subarray(s,l))}var u=o[i+n.length],c=o[i+n.length+1];this.keys=o.subarray(u,c),this.bboxes=o.subarray(c),this.insert=this._insertReadonly}else{this.d=e+2*r;for(var h=0;h<this.d*this.d;h++)n.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=r,this.scale=e/t,this.uid=0;var f=r/e*t;this.min=-f,this.max=t+f}e.exports=n;var i=3;n.prototype.insert=function(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)},n.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},n.prototype._insertCell=function(t,e,r,n,i,o){this.cells[i].push(o)},n.prototype.query=function(t,e,r,n){var i=this.min,o=this.max;if(i>=t&&i>=e&&r>=o&&n>=o)return this.keys.slice();var a=[],s={};return this._forEachCell(t,e,r,n,this._queryCell,a,s),a},n.prototype._queryCell=function(t,e,r,n,i,o,a){var s=this.cells[i];if(null!==s)for(var l=this.keys,u=this.bboxes,c=0;c<s.length;c++){var h=s[c];if(void 0===a[h]){var f=4*h;t<=u[f+2]&&e<=u[f+3]&&r>=u[f+0]&&n>=u[f+1]?(a[h]=!0,o.push(l[h])):a[h]=!1}}},n.prototype._forEachCell=function(t,e,r,n,i,o,a){for(var s=this._convertToCellCoord(t),l=this._convertToCellCoord(e),u=this._convertToCellCoord(r),c=this._convertToCellCoord(n),h=s;u>=h;h++)for(var f=l;c>=f;f++){var d=this.d*f+h;if(i.call(this,t,e,r,n,d,o,a))return}},n.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},n.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=i+this.cells.length+1+1,r=0,n=0;n<this.cells.length;n++)r+=this.cells[n].length;var o=new Int32Array(e+r+this.keys.length+this.bboxes.length);o[0]=this.extent,o[1]=this.n,o[2]=this.padding;for(var a=e,s=0;s<t.length;s++){var l=t[s];o[i+s]=a,o.set(l,a),a+=l.length}return o[i+t.length]=a,o.set(this.keys,a),a+=this.keys.length,o[i+t.length+1]=a,o.set(this.bboxes,a),a+=this.bboxes.length,o.buffer}},{}],374:[function(t,e,r){"use strict";function n(t,e){var r;if(c(t)){var s,l="object"==typeof t.stops[0][0],u=l||void 0!==t.property,h=l||!u,f=t.type||e||"exponential";if("exponential"===f)s=a;else if("interval"===f)s=o;else{if("categorical"!==f)throw new Error('Unknown function type "'+f+'"');s=i}if(l){for(var d={},p=[],v=0;v<t.stops.length;v++){var m=t.stops[v];void 0===d[m[0].zoom]&&(d[m[0].zoom]={zoom:m[0].zoom,type:t.type,property:t.property,stops:[]}),d[m[0].zoom].stops.push([m[0].value,m[1]])}for(var g in d)p.push([d[g].zoom,n(d[g])]);r=function(e,r){return a({stops:p,base:t.base},e)(e,r)},r.isFeatureConstant=!1,r.isZoomConstant=!1}else h?(r=function(e){return s(t,e)},r.isFeatureConstant=!0,r.isZoomConstant=!1):(r=function(e,r){return s(t,r[t.property])},r.isFeatureConstant=!1,r.isZoomConstant=!0)}else r=function(){return t},r.isFeatureConstant=!0,r.isZoomConstant=!0;return r}function i(t,e){for(var r=0;r<t.stops.length;r++)if(e===t.stops[r][0])return t.stops[r][1];return t.stops[0][1]}function o(t,e){for(var r=0;r<t.stops.length&&!(e<t.stops[r][0]);r++);return t.stops[Math.max(r-1,0)][1]}function a(t,e){for(var r=void 0!==t.base?t.base:1,n=0;;){if(n>=t.stops.length)break;if(e<=t.stops[n][0])break;n++}return 0===n?t.stops[n][1]:n===t.stops.length?t.stops[n-1][1]:s(e,r,t.stops[n-1][0],t.stops[n][0],t.stops[n-1][1],t.stops[n][1])}function s(t,e,r,n,i,o){return"function"==typeof i?function(){var a=i.apply(void 0,arguments),l=o.apply(void 0,arguments);return s(t,e,r,n,a,l)}:i.length?u(t,e,r,n,i,o):l(t,e,r,n,i,o)}function l(t,e,r,n,i,o){var a,s=n-r,l=t-r;return a=1===e?l/s:(Math.pow(e,l)-1)/(Math.pow(e,s)-1),i*(1-a)+o*a}function u(t,e,r,n,i,o){for(var a=[],s=0;s<i.length;s++)a[s]=l(t,e,r,n,i[s],o[s]);return a}function c(t){return"object"==typeof t&&t.stops}e.exports.isFunctionDefinition=c,e.exports.interpolated=function(t){return n(t,"exponential")},e.exports["piecewise-constant"]=function(t){return n(t,"interval")}},{}],375:[function(t,e,r){"use strict";function n(t){return!!(i()&&o()&&a()&&s()&&l()&&u()&&c(t&&t.failIfMajorPerformanceCaveat))}function i(){return"undefined"!=typeof window&&"undefined"!=typeof document}function o(){return Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray}function a(){return Function.prototype&&Function.prototype.bind}function s(){return Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions}function l(){return"JSON"in window&&"parse"in JSON&&"stringify"in JSON}function u(){return"Worker"in window}function c(t){return void 0===f[t]&&(f[t]=h(t)),f[t]}function h(t){var e=document.createElement("canvas"),r=Object.create(n.webGLContextAttributes);return r.failIfMajorPerformanceCaveat=t,e.probablySupportsContext?e.probablySupportsContext("webgl",r)||e.probablySupportsContext("experimental-webgl",r):e.supportsContext?e.supportsContext("webgl",r)||e.supportsContext("experimental-webgl",r):e.getContext("webgl",r)||e.getContext("experimental-webgl",r)}"undefined"!=typeof e&&e.exports?e.exports=n:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=n);var f={};n.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}},{}],376:[function(t,e,r){"use strict";function n(t,e){this.message=(t?t+": ":"")+i.apply(i,Array.prototype.slice.call(arguments,2)),null!==e&&void 0!==e&&e.__line__&&(this.line=e.__line__)}var i=t("util").format;e.exports=n},{util:62}],377:[function(t,e,r){"use strict";e.exports=function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)t[n]=r[n]}return t}},{}],378:[function(t,e,r){"use strict";e.exports=function(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}},{}],379:[function(t,e,r){"use strict";e.exports=function(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}},{}],380:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type"),o=t("../util/extend");e.exports=function(e){var r=t("./validate_function"),a=t("./validate_object"),s={"*":function(){return[]},array:t("./validate_array"),"boolean":t("./validate_boolean"),number:t("./validate_number"),color:t("./validate_color"),constants:t("./validate_constants"),"enum":t("./validate_enum"),filter:t("./validate_filter"),"function":t("./validate_function"),layer:t("./validate_layer"),object:t("./validate_object"),source:t("./validate_source"),string:t("./validate_string")},l=e.value,u=e.valueSpec,c=e.key,h=e.styleSpec,f=e.style;if("string"===i(l)&&"@"===l[0]){if(h.$version>7)return[new n(c,l,"constants have been deprecated as of v8")];if(!(l in f.constants))return[new n(c,l,'constant "%s" not found',l)];e=o({},e,{value:f.constants[l]})}return u.function&&"object"===i(l)?r(e):u.type&&s[u.type]?s[u.type](e):a(o({},e,{valueSpec:u.type?h[u.type]:u}))}},{"../error/validation_error":376,"../util/extend":377,"../util/get_type":378,"./validate_array":381,"./validate_boolean":382,"./validate_color":383,"./validate_constants":384,"./validate_enum":385,"./validate_filter":386,"./validate_function":387,"./validate_layer":389,"./validate_number":391,"./validate_object":392,"./validate_source":394,"./validate_string":395}],381:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("./validate"),o=t("../error/validation_error");e.exports=function(t){var e=t.value,r=t.valueSpec,a=t.style,s=t.styleSpec,l=t.key,u=t.arrayElementValidator||i;if("array"!==n(e))return[new o(l,e,"array expected, %s found",n(e))];if(r.length&&e.length!==r.length)return[new o(l,e,"array length %d expected, length %d found",r.length,e.length)];if(r["min-length"]&&e.length<r["min-length"])return[new o(l,e,"array length at least %d expected, length %d found",r["min-length"],e.length)];var c={type:r.value};s.$version<7&&(c.function=r.function),"object"===n(r.value)&&(c=r.value);for(var h=[],f=0;f<e.length;f++)h=h.concat(u({array:e,arrayIndex:f,value:e[f],valueSpec:c,style:a,styleSpec:s,key:l+"["+f+"]"}));return h}},{"../error/validation_error":376,"../util/get_type":378,"./validate":380}],382:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("../error/validation_error");e.exports=function(t){var e=t.value,r=t.key,o=n(e);return"boolean"!==o?[new i(r,e,"boolean expected, %s found",o)]:[]}},{"../error/validation_error":376,"../util/get_type":378}],383:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type"),o=t("csscolorparser").parseCSSColor;e.exports=function(t){var e=t.key,r=t.value,a=i(r);return"string"!==a?[new n(e,r,"color expected, %s found",a)]:null===o(r)?[new n(e,r,'color expected, "%s" found',r)]:[]}},{"../error/validation_error":376,"../util/get_type":378,csscolorparser:351}],384:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type");e.exports=function(t){var e=t.key,r=t.value,o=t.styleSpec;if(o.$version>7)return r?[new n(e,r,"constants have been deprecated as of v8")]:[];var a=i(r);if("object"!==a)return[new n(e,r,"object expected, %s found",a)];var s=[];for(var l in r)"@"!==l[0]&&s.push(new n(e+"."+l,r[l],'constants must start with "@"'));return s}},{"../error/validation_error":376,"../util/get_type":378}],385:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint");e.exports=function(t){var e=t.key,r=t.value,o=t.valueSpec,a=[];return-1===o.values.indexOf(i(r))&&a.push(new n(e,r,"expected one of [%s], %s found",o.values.join(", "),r)),a}},{"../error/validation_error":376,"../util/unbundle_jsonlint":379}],386:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("./validate_enum"),o=t("../util/get_type"),a=t("../util/unbundle_jsonlint");e.exports=function s(t){var e,r=t.value,l=t.key,u=t.styleSpec,c=[];if("array"!==o(r))return[new n(l,r,"array expected, %s found",o(r))];if(r.length<1)return[new n(l,r,"filter array must have at least 1 element")];switch(c=c.concat(i({key:l+"[0]",value:r[0],valueSpec:u.filter_operator,style:t.style,styleSpec:t.styleSpec})),a(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"==r[1]&&c.push(new n(l,r,'"$type" cannot be use with operator "%s"',r[0]));case"==":case"!=":3!=r.length&&c.push(new n(l,r,'filter array for operator "%s" must have 3 elements',r[0]));case"in":case"!in":r.length>=2&&(e=o(r[1]),"string"!==e?c.push(new n(l+"[1]",r[1],"string expected, %s found",e)):"@"===r[1][0]&&c.push(new n(l+"[1]",r[1],"filter key cannot be a constant")));for(var h=2;h<r.length;h++)e=o(r[h]),"$type"==r[1]?c=c.concat(i({key:l+"["+h+"]",value:r[h],valueSpec:u.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"===e&&"@"===r[h][0]?c.push(new n(l+"["+h+"]",r[h],"filter value cannot be a constant")):"string"!==e&&"number"!==e&&"boolean"!==e&&c.push(new n(l+"["+h+"]",r[h],"string, number, or boolean expected, %s found",e));break;case"any":case"all":case"none":for(h=1;h<r.length;h++)c=c.concat(s({key:l+"["+h+"]",value:r[h],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":e=o(r[1]),2!==r.length?c.push(new n(l,r,'filter array for "%s" operator must have 2 elements',r[0])):"string"!==e?c.push(new n(l+"[1]",r[1],"string expected, %s found",e)):"@"===r[1][0]&&c.push(new n(l+"[1]",r[1],"filter key cannot be a constant"))}return c}},{"../error/validation_error":376,"../util/get_type":378,"../util/unbundle_jsonlint":379,"./validate_enum":385}],387:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type"),o=t("./validate"),a=t("./validate_object"),s=t("./validate_array"),l=t("./validate_number");e.exports=function(t){function e(t){var e=[],o=t.value;return e=e.concat(s({key:t.key,value:o,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:r})),"array"===i(o)&&0===o.length&&e.push(new n(t.key,o,"array must have at least one stop")),e}function r(t){var e=[],r=t.value,s=t.key;if("array"!==i(r))return[new n(s,r,"array expected, %s found",i(r))];if(2!==r.length)return[new n(s,r,"array length %d expected, length %d found",2,r.length)];var d=i(r[0]);if(c||(c=d),d!==c)return[new n(s,r,"%s stop key type must match previous stop key type %s",d,c)];if("object"===d){if(void 0===r[0].zoom)return[new n(s,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new n(s,r,"object stop key must have value")];e=e.concat(a({key:s+"[0]",value:r[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:l,value:u}}))}else{var p=!f.property;e=e.concat((p?l:u)({key:s+"[0]",value:r[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec}))}return e=e.concat(o({key:s+"[1]",value:r[1],valueSpec:h,style:t.style,styleSpec:t.styleSpec})),"number"===i(r[0])&&("piecewise-constant"===h.function&&r[0]%1!==0&&e.push(new n(s+"[0]",r[0],"zoom level for piecewise-constant functions must be an integer")),0!==t.arrayIndex&&r[0]<t.array[t.arrayIndex-1][0]&&e.push(new n(s+"[0]",r[0],"array stops must appear in ascending order"))),e}function u(t){var e=[],r=i(t.value);return"number"!==r&&"string"!==r&&"array"!==r&&e.push(new n(t.key,t.value,"property value must be a number, string or array")),e}var c,h=t.valueSpec,f=t.value;return a({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:e}})}},{"../error/validation_error":376,"../util/get_type":378,"./validate":380,"./validate_array":381,"./validate_number":391,"./validate_object":392}],388:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("./validate_string");e.exports=function(t){var e=t.value,r=t.key,o=i(t);return o.length?o:(-1===e.indexOf("{fontstack}")&&o.push(new n(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&o.push(new n(r,e,'"glyphs" url must include a "{range}" token')),o)}},{"../error/validation_error":376,"./validate_string":395}],389:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint"),o=t("./validate_object"),a=t("./validate_filter"),s=t("./validate_paint_property"),l=t("./validate_layout_property"),u=t("../util/extend");e.exports=function(t){var e=[],r=t.value,c=t.key,h=t.style,f=t.styleSpec;r.type||r.ref||e.push(new n(c,r,'either "type" or "ref" is required'));var d=i(r.type),p=i(r.ref);if(r.id)for(var v=0;v<t.arrayIndex;v++){var m=h.layers[v];i(m.id)===i(r.id)&&e.push(new n(c,r.id,'duplicate layer id "%s", previously used at line %d',r.id,m.id.__line__))}if("ref"in r){["type","source","source-layer","filter","layout"].forEach(function(t){t in r&&e.push(new n(c,r[t],'"%s" is prohibited for ref layers',t))});var g;h.layers.forEach(function(t){t.id==p&&(g=t)}),g?g.ref?e.push(new n(c,r.ref,"ref cannot reference another ref layer")):d=i(g.type):e.push(new n(c,r.ref,'ref layer "%s" not found',p))}else if("background"!==d)if(r.source){var y=h.sources[r.source];y?"vector"==y.type&&"raster"==d?e.push(new n(c,r.source,'layer "%s" requires a raster source',r.id)):"raster"==y.type&&"raster"!=d?e.push(new n(c,r.source,'layer "%s" requires a vector source',r.id)):"vector"!=y.type||r["source-layer"]||e.push(new n(c,r,'layer "%s" must specify a "source-layer"',r.id)):e.push(new n(c,r.source,'source "%s" not found',r.source))}else e.push(new n(c,r,'missing required property "source"'));return e=e.concat(o({key:c,value:r,valueSpec:f.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{filter:a,layout:function(t){return o({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return l(u({layerType:d},t))}}})},paint:function(t){return o({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return s(u({layerType:d},t))}}})}}}))}},{"../error/validation_error":376,"../util/extend":377,"../util/unbundle_jsonlint":379,"./validate_filter":386,"./validate_layout_property":390,"./validate_object":392,"./validate_paint_property":393}],390:[function(t,e,r){"use strict";var n=t("./validate"),i=t("../error/validation_error");e.exports=function(t){var e=t.key,r=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o["layout_"+t.layerType];if(t.valueSpec||l[s]){var u=[];return"symbol"===t.layerType&&("icon-image"===s&&r&&!r.sprite?u.push(new i(e,a,'use of "icon-image" requires a style "sprite" property')):"text-field"===s&&r&&!r.glyphs&&u.push(new i(e,a,'use of "text-field" requires a style "glyphs" property'))),u.concat(n({key:t.key,value:a,valueSpec:t.valueSpec||l[s],style:r,styleSpec:o}))}return[new i(e,a,'unknown property "%s"',s)]}},{"../error/validation_error":376,"./validate":380}],391:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("../error/validation_error");e.exports=function(t){var e=t.key,r=t.value,o=t.valueSpec,a=n(r);return"number"!==a?[new i(e,r,"number expected, %s found",a)]:"minimum"in o&&r<o.minimum?[new i(e,r,"%s is less than the minimum value %s",r,o.minimum)]:"maximum"in o&&r>o.maximum?[new i(e,r,"%s is greater than the maximum value %s",r,o.maximum)]:[]}},{"../error/validation_error":376,"../util/get_type":378}],392:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type"),o=t("./validate");e.exports=function(t){var e=t.key,r=t.value,a=t.valueSpec,s=t.objectElementValidators||{},l=t.style,u=t.styleSpec,c=[],h=i(r);if("object"!==h)return[new n(e,r,"object expected, %s found",h)];for(var f in r){var d=f.split(".")[0],p=a&&(a[d]||a["*"]),v=s[d]||s["*"];p||v?c=c.concat((v||o)({key:(e?e+".":e)+f,value:r[f],valueSpec:p,style:l,styleSpec:u,object:r,objectKey:f})):""!==e&&1!==e.split(".").length&&c.push(new n(e,r[f],'unknown property "%s"',f))}for(d in a)a[d].required&&void 0===a[d].default&&void 0===r[d]&&c.push(new n(e,r,'missing required property "%s"',d));return c}},{"../error/validation_error":376,"../util/get_type":378,"./validate":380}],393:[function(t,e,r){"use strict";var n=t("./validate"),i=t("../error/validation_error");e.exports=function(t){var e=t.key,r=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o["paint_"+t.layerType],u=s.match(/^(.*)-transition$/);return u&&l[u[1]]&&l[u[1]].transition?n({key:e,value:a,valueSpec:o.transition,style:r,styleSpec:o}):t.valueSpec||l[s]?n({key:t.key,value:a,valueSpec:t.valueSpec||l[s],style:r,styleSpec:o}):[new i(e,a,'unknown property "%s"',s)]}},{"../error/validation_error":376,"./validate":380}],394:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint"),o=t("./validate_object"),a=t("./validate_enum");e.exports=function(t){var e=t.value,r=t.key,s=t.styleSpec,l=t.style;if(!e.type)return[new n(r,e,'"type" is required')];var u=i(e.type);switch(u){case"vector":case"raster":var c=[];if(c=c.concat(o({key:r,value:e,valueSpec:s.source_tile,style:t.style,styleSpec:s})),"url"in e)for(var h in e)["type","url","tileSize"].indexOf(h)<0&&c.push(new n(r+"."+h,e[h],'a source with a "url" property may not include a "%s" property',h));return c;case"geojson":return o({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s});case"video":return o({key:r,value:e,valueSpec:s.source_video,style:l,styleSpec:s});case"image":return o({key:r,value:e,valueSpec:s.source_image,style:l,styleSpec:s});default:return a({key:r+".type",value:e.type,valueSpec:{values:["vector","raster","geojson","video","image"]},style:l,styleSpec:s})}}},{"../error/validation_error":376,"../util/unbundle_jsonlint":379,"./validate_enum":385,"./validate_object":392}],395:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("../error/validation_error");e.exports=function(t){var e=t.value,r=t.key,o=n(e);return"string"!==o?[new i(r,e,"string expected, %s found",o)]:[]}},{"../error/validation_error":376,"../util/get_type":378}],396:[function(t,e,r){"use strict";function n(t,e){e=e||l;var r=[];return r=r.concat(s({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:u}})),e.$version>7&&t.constants&&(r=r.concat(a({key:"constants",value:t.constants,style:t,styleSpec:e}))),i(r)}function i(t){return[].concat(t).sort(function(t,e){return t.line-e.line})}function o(t){return function(){return i(t.apply(this,arguments))}}var a=t("./validate/validate_constants"),s=t("./validate/validate"),l=t("../reference/latest.min"),u=t("./validate/validate_glyphs_url");n.source=o(t("./validate/validate_source")),n.layer=o(t("./validate/validate_layer")),n.filter=o(t("./validate/validate_filter")),n.paintProperty=o(t("./validate/validate_paint_property")),n.layoutProperty=o(t("./validate/validate_layout_property")),e.exports=n},{"../reference/latest.min":398,"./validate/validate":380,"./validate/validate_constants":384,"./validate/validate_filter":386,"./validate/validate_glyphs_url":388,"./validate/validate_layer":389,"./validate/validate_layout_property":390,"./validate/validate_paint_property":393,"./validate/validate_source":394}],397:[function(t,e,r){e.exports=t("./v8.json")},{"./v8.json":399}],398:[function(t,e,r){e.exports=t("./v8.min.json")},{"./v8.min.json":400}],399:[function(t,e,r){e.exports={$version:8,root:{version:{required:!0,type:"enum",values:[8],doc:"Stylesheet version number. Must be 8.",example:8},name:{type:"string",doc:"A human-readable name for the style.",example:"Bright"},metadata:{type:"*",doc:"Arbitrary properties useful to track with the stylesheet, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'mapbox:'."},center:{type:"array",value:"number",doc:"Default map center in longitude and latitude. The style center will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:[-73.9749,40.7736]},zoom:{type:"number",doc:"Default zoom level. The style zoom will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:12.5},bearing:{type:"number","default":0,period:360,units:"degrees",doc:"Default bearing, in degrees. The style bearing will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:29},pitch:{type:"number","default":0,units:"degrees",doc:"Default pitch, in degrees. Zero is perpendicular to the surface. The style pitch will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:50},sources:{required:!0,type:"sources",doc:"Data source specifications.",example:{"mapbox-streets":{type:"vector",url:"mapbox://mapbox.mapbox-streets-v6"}}},sprite:{type:"string",doc:"A base URL for retrieving the sprite image and metadata. The extensions .png, .json and scale factor @2x.png will be automatically appended. This property is required if any layer uses the 'sprite-image' layout property.",example:"mapbox://sprites/mapbox/bright-v8"},glyphs:{type:"string",doc:"A URL template for loading signed-distance-field glyph sets in PBF format. The URL must include {fontstack} and {range} tokens. This property is required if any layer uses the 'text-field' layout property.",example:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},transition:{type:"transition",doc:"A global transition definition to use as a default across properties.",example:{duration:300,delay:0}},layers:{required:!0,type:"array",value:"layer",doc:"Layers will be drawn in the order of this array.",example:[{id:"water",source:"mapbox-streets","source-layer":"water",type:"fill",paint:{"fill-color":"#00ffff"}}]}},sources:{"*":{type:"source",doc:"Specification of a data source. For vector and raster sources, either TileJSON or a URL to a TileJSON must be provided. For GeoJSON and video sources, a URL must be provided."}},source:["source_tile","source_geojson","source_video","source_image"],source_tile:{type:{required:!0,type:"enum",values:["vector","raster"],doc:"The data type of the tile source."},url:{type:"string",doc:"A URL to a TileJSON resource. Supported protocols are http:, https:, and mapbox://<mapid>."},tiles:{type:"array",value:"string",doc:"An array of one or more tile source URLs, as in the TileJSON spec."},minzoom:{type:"number","default":0,doc:"Minimum zoom level for which tiles are available, as in the TileJSON spec."},maxzoom:{type:"number","default":22,doc:"Maximum zoom level for which tiles are available, as in the TileJSON spec. Data from tiles at the maxzoom are used when displaying the map at higher zoom levels."},tileSize:{type:"number","default":512,units:"pixels",doc:"The minimum visual size to display tiles for this layer. Only configurable for raster layers."},"*":{type:"*",doc:"Other keys to configure the data source."}},source_geojson:{type:{required:!0,type:"enum",values:["geojson"],doc:"The data type of the GeoJSON source."},data:{type:"*",doc:"A URL to a GeoJSON file, or inline GeoJSON."},maxzoom:{type:"number","default":14,doc:"Maximum zoom level at which to create vector tiles (higher means greater detail at high zoom levels)."},buffer:{type:"number","default":64,doc:"Tile buffer size on each side (higher means fewer rendering artifacts near tile edges but slower performance)."},tolerance:{type:"number","default":3,doc:"Douglas-Peucker simplification tolerance (higher means simpler geometries and faster performance)."},cluster:{type:"boolean","default":!1,doc:"If the data is a collection of point features, setting this to true clusters the points by radius into groups."},clusterRadius:{type:"number","default":400,doc:"Radius of each cluster when clustering points, relative to 4096 tile."},clusterMaxZoom:{type:"number",doc:"Max zoom to cluster points on. Defaults to one zoom less than maxzoom (so that last zoom features are not clustered)."}},source_video:{type:{required:!0,type:"enum",values:["video"],doc:"The data type of the video source."},urls:{required:!0,type:"array",value:"string",doc:"URLs to video content in order of preferred format."},coordinates:{required:!0,doc:"Corners of video specified in longitude, latitude pairs.",type:"array",length:4,value:{type:"array",length:2,value:"number",doc:"A single longitude, latitude pair."}}},source_image:{type:{required:!0,type:"enum",values:["image"],doc:"The data type of the image source."},url:{required:!0,type:"string",doc:"URL that points to an image"},coordinates:{required:!0,doc:"Corners of image specified in longitude, latitude pairs.",type:"array",length:4,value:{type:"array",length:2,value:"number",doc:"A single longitude, latitude pair."}}},layer:{id:{type:"string",doc:"Unique layer name.",required:!0},type:{type:"enum",values:["fill","line","symbol","circle","raster","background"],doc:"Rendering type of this layer."},metadata:{type:"*",doc:"Arbitrary properties useful to track with the layer, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'mapbox:'."},ref:{type:"string",doc:"References another layer to copy type, source, source-layer, minzoom, maxzoom, filter, and layout properties from. This allows the layers to share processing and be more efficient."},source:{type:"string",doc:"Name of a source description to be used for this layer."},"source-layer":{type:"string",doc:"Layer to use from a vector tile source. Required if the source supports multiple layers."},minzoom:{type:"number",minimum:0,maximum:22,doc:"The minimum zoom level on which the layer gets parsed and appears on."},maxzoom:{type:"number",minimum:0,maximum:22,doc:"The maximum zoom level on which the layer gets parsed and appears on."},interactive:{type:"boolean",doc:"Enable querying of feature data from this layer for interactivity.","default":!1},filter:{type:"filter",doc:"A expression specifying conditions on source features. Only features that match the filter are displayed."},layout:{type:"layout",doc:"Layout properties for the layer."},paint:{type:"paint",doc:"Default paint properties for this layer."},"paint.*":{type:"paint",doc:"Class-specific paint properties for this layer. The class name is the part after the first dot." }},layout:["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],layout_background:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. none hides this layer."}},layout_fill:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. none hides this layer."}},layout_circle:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. none hides this layer."}},layout_line:{"line-cap":{type:"enum","function":"piecewise-constant",values:["butt","round","square"],"default":"butt",doc:"The display of line endings."},"line-join":{type:"enum","function":"piecewise-constant",values:["bevel","round","miter"],"default":"miter",doc:"The display of lines when joining."},"line-miter-limit":{type:"number","default":2,"function":"interpolated",doc:"Used to automatically convert miter joins to bevel joins for sharp angles.",requires:[{"line-join":"miter"}]},"line-round-limit":{type:"number","default":1.05,"function":"interpolated",doc:"Used to automatically convert round joins to miter joins for shallow angles.",requires:[{"line-join":"round"}]},visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. none hides this layer."}},layout_symbol:{"symbol-placement":{type:"enum","function":"piecewise-constant",values:["point","line"],"default":"point",doc:"Label placement relative to its geometry. line can only be used on LineStrings and Polygons."},"symbol-spacing":{type:"number","default":250,minimum:1,"function":"interpolated",units:"pixels",doc:"Distance between two symbol anchors.",requires:[{"symbol-placement":"line"}]},"symbol-avoid-edges":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer."},"icon-allow-overlap":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, the icon will be visible even if it collides with other previously drawn symbols.",requires:["icon-image"]},"icon-ignore-placement":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, other symbols can be visible even if they collide with the icon.",requires:["icon-image"]},"icon-optional":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.",requires:["icon-image","text-field"]},"icon-rotation-alignment":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"viewport",doc:"Orientation of icon when map is rotated.",requires:["icon-image"]},"icon-size":{type:"number","default":1,minimum:0,"function":"interpolated",doc:"Scale factor for icon. 1 is original size, 3 triples the size.",requires:["icon-image"]},"icon-image":{type:"string","function":"piecewise-constant",doc:"A string with {tokens} replaced, referencing the data property to pull from.",tokens:!0},"icon-rotate":{type:"number","default":0,period:360,"function":"interpolated",units:"degrees",doc:"Rotates the icon clockwise.",requires:["icon-image"]},"icon-padding":{type:"number","default":2,minimum:0,"function":"interpolated",units:"pixels",doc:"Size of the additional area around the icon bounding box used for detecting symbol collisions.",requires:["icon-image"]},"icon-keep-upright":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, the icon may be flipped to prevent it from being rendered upside-down.",requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",doc:"Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up.",requires:["icon-image"]},"text-rotation-alignment":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"viewport",doc:"Orientation of text when map is rotated.",requires:["text-field"]},"text-field":{type:"string","function":"piecewise-constant","default":"",tokens:!0,doc:"Value to use for a text label. Feature properties are specified using tokens like {field_name}."},"text-font":{type:"array",value:"string","function":"piecewise-constant","default":["Open Sans Regular","Arial Unicode MS Regular"],doc:"Font stack to use for displaying text.",requires:["text-field"]},"text-size":{type:"number","default":16,minimum:0,units:"pixels","function":"interpolated",doc:"Font size.",requires:["text-field"]},"text-max-width":{type:"number","default":10,minimum:0,units:"em","function":"interpolated",doc:"The maximum line width for text wrapping.",requires:["text-field"]},"text-line-height":{type:"number","default":1.2,units:"em","function":"interpolated",doc:"Text leading value for multi-line text.",requires:["text-field"]},"text-letter-spacing":{type:"number","default":0,units:"em","function":"interpolated",doc:"Text tracking amount.",requires:["text-field"]},"text-justify":{type:"enum","function":"piecewise-constant",values:["left","center","right"],"default":"center",doc:"Text justification options.",requires:["text-field"]},"text-anchor":{type:"enum","function":"piecewise-constant",values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],"default":"center",doc:"Part of the text placed closest to the anchor.",requires:["text-field"]},"text-max-angle":{type:"number","default":45,units:"degrees","function":"interpolated",doc:"Maximum angle change between adjacent characters.",requires:["text-field",{"symbol-placement":"line"}]},"text-rotate":{type:"number","default":0,period:360,units:"degrees","function":"interpolated",doc:"Rotates the text clockwise.",requires:["text-field"]},"text-padding":{type:"number","default":2,minimum:0,units:"pixels","function":"interpolated",doc:"Size of the additional area around the text bounding box used for detecting symbol collisions.",requires:["text-field"]},"text-keep-upright":{type:"boolean","function":"piecewise-constant","default":!0,doc:"If true, the text may be flipped vertically to prevent it from being rendered upside-down.",requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{type:"enum","function":"piecewise-constant",values:["none","uppercase","lowercase"],"default":"none",doc:"Specifies how to capitalize text, similar to the CSS text-transform property.",requires:["text-field"]},"text-offset":{type:"array",doc:"Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up.",value:"number",units:"ems","function":"interpolated",length:2,"default":[0,0],requires:["text-field"]},"text-allow-overlap":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, the text will be visible even if it collides with other previously drawn symbols.",requires:["text-field"]},"text-ignore-placement":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, other symbols can be visible even if they collide with the text.",requires:["text-field"]},"text-optional":{type:"boolean","function":"piecewise-constant","default":!1,doc:"If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.",requires:["text-field","icon-image"]},visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. none hides this layer."}},layout_raster:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible",doc:"The display of this layer. none hides this layer."}},filter:{type:"array",value:"*",doc:"A filter selects specific features from a layer."},filter_operator:{type:"enum",values:["==","!=",">",">=","<","<=","in","!in","all","any","none","has","!has"],doc:"The filter operator."},geometry_type:{type:"enum",values:["Point","LineString","Polygon"],doc:"The geometry type for the filter to select."},color_operation:{type:"enum",values:["lighten","saturate","spin","fade","mix"],doc:"A color operation to apply."},"function":{stops:{type:"array",required:!0,doc:"An array of stops.",value:"function_stop"},base:{type:"number","default":1,minimum:0,doc:"The exponential base of the interpolation curve. It controls the rate at which the result increases. Higher values make the result increase more towards the high end of the range. With 1 the stops are interpolated linearly."},property:{type:"string",doc:"The name of a global property or feature property to use as the function input.","default":"zoom"},type:{type:"enum",values:["exponential","interval","categorical"],doc:"The interpolation strategy to use in function evaluation.","default":"exponential"}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2,doc:"Zoom level and value pair."},paint:["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],paint_fill:{"fill-antialias":{type:"boolean","function":"piecewise-constant","default":!0,doc:"Whether or not the fill should be antialiased."},"fill-opacity":{type:"number","function":"interpolated","default":1,minimum:0,maximum:1,doc:"The opacity given to the fill color.",transition:!0},"fill-color":{type:"color","default":"#000000",doc:"The color of the fill.","function":"interpolated",transition:!0,requires:[{"!":"fill-pattern"}]},"fill-outline-color":{type:"color",doc:"The outline color of the fill. Matches the value of fill-color if unspecified.","function":"interpolated",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}]},"fill-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively."},"fill-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen)","default":"map",requires:["fill-translate"]},"fill-pattern":{type:"string","function":"piecewise-constant",transition:!0,doc:"Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512)."}},paint_line:{"line-opacity":{type:"number",doc:"The opacity at which the line will be drawn.","function":"interpolated","default":1,minimum:0,maximum:1,transition:!0},"line-color":{type:"color",doc:"The color with which the line will be drawn.","default":"#000000","function":"interpolated",transition:!0,requires:[{"!":"line-pattern"}]},"line-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively."},"line-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen)","default":"map",requires:["line-translate"]},"line-width":{type:"number","default":1,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Stroke thickness."},"line-gap-width":{type:"number","default":0,minimum:0,doc:"Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap.","function":"interpolated",transition:!0,units:"pixels"},"line-offset":{type:"number","default":0,doc:'The line\'s offset perpendicular to its direction. Values may be positive or negative, where positive indicates "rightwards" (if you were moving in the direction of the line) and negative indicates "leftwards."',"function":"interpolated",transition:!0,units:"pixels"},"line-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Blur applied to the line, in pixels."},"line-dasharray":{type:"array",value:"number","function":"piecewise-constant",doc:"Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to pixels, multiply the length by the current line width.",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}]},"line-pattern":{type:"string","function":"piecewise-constant",transition:!0,doc:"Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512)."}},paint_circle:{"circle-radius":{type:"number","default":5,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Circle radius."},"circle-color":{type:"color","default":"#000000",doc:"The color of the circle.","function":"interpolated",transition:!0},"circle-blur":{type:"number","default":0,doc:"Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity.","function":"interpolated",transition:!0},"circle-opacity":{type:"number",doc:"The opacity at which the circle will be drawn.","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0},"circle-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively."},"circle-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen)","default":"map",requires:["circle-translate"]}},paint_symbol:{"icon-opacity":{doc:"The opacity at which the icon will be drawn.",type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0,requires:["icon-image"]},"icon-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,doc:"The color of the icon. This can only be used with sdf icons.",requires:["icon-image"]},"icon-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated",transition:!0,doc:"The color of the icon's halo. Icon halos can only be used with sdf icons.",requires:["icon-image"]},"icon-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Distance of halo to the icon outline.",requires:["icon-image"]},"icon-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Fade out the halo towards the outside.",requires:["icon-image"]},"icon-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",doc:"Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.",requires:["icon-image"]},"icon-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen).","default":"map",requires:["icon-image","icon-translate"]},"text-opacity":{type:"number",doc:"The opacity at which the text will be drawn.","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0,requires:["text-field"]},"text-color":{type:"color",doc:"The color with which the text will be drawn.","default":"#000000","function":"interpolated",transition:!0,requires:["text-field"]},"text-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated",transition:!0,doc:"The color of the text's halo, which helps it stand out from backgrounds.",requires:["text-field"]},"text-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.",requires:["text-field"]},"text-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",doc:"The halo's fadeout distance towards the outside.",requires:["text-field"]},"text-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",doc:"Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.",requires:["text-field"]},"text-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],doc:"Control whether the translation is relative to the map (north) or viewport (screen).","default":"map",requires:["text-field","text-translate"]}},paint_raster:{"raster-opacity":{type:"number",doc:"The opacity at which the image will be drawn.","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0},"raster-hue-rotate":{type:"number","default":0,period:360,"function":"interpolated",transition:!0,units:"degrees",doc:"Rotates hues around the color wheel."},"raster-brightness-min":{type:"number","function":"interpolated",doc:"Increase or reduce the brightness of the image. The value is the minimum brightness.","default":0,minimum:0,maximum:1,transition:!0},"raster-brightness-max":{type:"number","function":"interpolated",doc:"Increase or reduce the brightness of the image. The value is the maximum brightness.","default":1,minimum:0,maximum:1,transition:!0},"raster-saturation":{type:"number",doc:"Increase or reduce the saturation of the image.","default":0,minimum:-1,maximum:1,"function":"interpolated",transition:!0},"raster-contrast":{type:"number",doc:"Increase or reduce the contrast of the image.","default":0,minimum:-1,maximum:1,"function":"interpolated",transition:!0},"raster-fade-duration":{type:"number","default":300,minimum:0,"function":"interpolated",transition:!0,units:"milliseconds",doc:"Fade duration when a new tile is added."}},paint_background:{"background-color":{type:"color","default":"#000000",doc:"The color with which the background will be drawn.","function":"interpolated",transition:!0,requires:[{"!":"background-pattern"}]},"background-pattern":{type:"string","function":"piecewise-constant",transition:!0,doc:"Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512)."},"background-opacity":{type:"number","default":1,minimum:0,maximum:1,doc:"The opacity at which the background will be drawn.","function":"interpolated",transition:!0}},transition:{duration:{type:"number","default":300,minimum:0,units:"milliseconds",doc:"Time allotted for transitions to complete."},delay:{type:"number","default":0,minimum:0,units:"milliseconds",doc:"Length of time before a transition begins."}}}},{}],400:[function(t,e,r){e.exports={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number","default":0,period:360,units:"degrees"},pitch:{type:"number","default":0,units:"degrees"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_tile","source_geojson","source_video","source_image"],source_tile:{type:{required:!0,type:"enum",values:["vector","raster"]},url:{type:"string"},tiles:{type:"array",value:"string"},minzoom:{type:"number","default":0},maxzoom:{type:"number","default":22},tileSize:{type:"number","default":512,units:"pixels"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:["geojson"]},data:{type:"*"},maxzoom:{type:"number","default":14},buffer:{type:"number","default":64},tolerance:{type:"number","default":3},cluster:{type:"boolean","default":!1},clusterRadius:{type:"number","default":400},clusterMaxZoom:{type:"number"}},source_video:{type:{required:!0,type:"enum",values:["video"]},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:["image"]},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:["fill","line","symbol","circle","raster","background"]},metadata:{type:"*"},ref:{type:"string"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:22},maxzoom:{type:"number",minimum:0,maximum:22},interactive:{type:"boolean","default":!1},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"},"paint.*":{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],layout_background:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},layout_fill:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},layout_circle:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},layout_line:{"line-cap":{type:"enum","function":"piecewise-constant",values:["butt","round","square"],"default":"butt"},"line-join":{type:"enum","function":"piecewise-constant",values:["bevel","round","miter"],"default":"miter"},"line-miter-limit":{type:"number","default":2,"function":"interpolated",requires:[{"line-join":"miter"}]},"line-round-limit":{type:"number","default":1.05,"function":"interpolated",requires:[{"line-join":"round"}]},visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},layout_symbol:{"symbol-placement":{type:"enum","function":"piecewise-constant",values:["point","line"],"default":"point"},"symbol-spacing":{type:"number","default":250,minimum:1,"function":"interpolated",units:"pixels",requires:[{"symbol-placement":"line"}]},"symbol-avoid-edges":{type:"boolean","function":"piecewise-constant","default":!1},"icon-allow-overlap":{type:"boolean","function":"piecewise-constant","default":!1,requires:["icon-image"]},"icon-ignore-placement":{type:"boolean","function":"piecewise-constant","default":!1,requires:["icon-image"]},"icon-optional":{type:"boolean","function":"piecewise-constant","default":!1,requires:["icon-image","text-field"]},"icon-rotation-alignment":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"viewport",requires:["icon-image"]},"icon-size":{type:"number","default":1,minimum:0,"function":"interpolated",requires:["icon-image"]},"icon-image":{type:"string","function":"piecewise-constant",tokens:!0},"icon-rotate":{type:"number","default":0,period:360,"function":"interpolated",units:"degrees",requires:["icon-image"]},"icon-padding":{type:"number","default":2,minimum:0,"function":"interpolated",units:"pixels",requires:["icon-image"]},"icon-keep-upright":{type:"boolean","function":"piecewise-constant","default":!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",requires:["icon-image"]},"text-rotation-alignment":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"viewport",requires:["text-field"]},"text-field":{type:"string","function":"piecewise-constant","default":"",tokens:!0},"text-font":{type:"array",value:"string","function":"piecewise-constant","default":["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"]},"text-size":{type:"number","default":16,minimum:0,units:"pixels","function":"interpolated",requires:["text-field"]},"text-max-width":{type:"number","default":10,minimum:0,units:"em","function":"interpolated",requires:["text-field"]},"text-line-height":{type:"number","default":1.2,units:"em","function":"interpolated",requires:["text-field"]},"text-letter-spacing":{type:"number","default":0,units:"em","function":"interpolated",requires:["text-field"]},"text-justify":{type:"enum","function":"piecewise-constant",values:["left","center","right"],"default":"center",requires:["text-field"]},"text-anchor":{type:"enum","function":"piecewise-constant",values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],"default":"center",requires:["text-field"]},"text-max-angle":{type:"number","default":45,units:"degrees","function":"interpolated",requires:["text-field",{"symbol-placement":"line"}]},"text-rotate":{type:"number","default":0,period:360,units:"degrees","function":"interpolated",requires:["text-field"]},"text-padding":{type:"number","default":2,minimum:0,units:"pixels","function":"interpolated",requires:["text-field"]},"text-keep-upright":{type:"boolean","function":"piecewise-constant","default":!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{type:"enum","function":"piecewise-constant",values:["none","uppercase","lowercase"],"default":"none",requires:["text-field"]},"text-offset":{type:"array",value:"number",units:"ems","function":"interpolated",length:2,"default":[0,0],requires:["text-field"]},"text-allow-overlap":{type:"boolean","function":"piecewise-constant","default":!1,requires:["text-field"]},"text-ignore-placement":{type:"boolean","function":"piecewise-constant","default":!1,requires:["text-field"]},"text-optional":{type:"boolean","function":"piecewise-constant","default":!1,requires:["text-field","icon-image"]},visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},layout_raster:{visibility:{type:"enum","function":"piecewise-constant",values:["visible","none"],"default":"visible"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:["==","!=",">",">=","<","<=","in","!in","all","any","none","has","!has"]},geometry_type:{type:"enum",values:["Point","LineString","Polygon"]},color_operation:{type:"enum",values:["lighten","saturate","spin","fade","mix"]},"function":{stops:{type:"array",required:!0,value:"function_stop"},base:{type:"number","default":1,minimum:0},property:{type:"string","default":"\$zoom"},type:{type:"enum",values:["exponential","interval","categorical"],"default":"exponential"}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2},paint:["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],paint_fill:{"fill-antialias":{type:"boolean","function":"piecewise-constant","default":!0},"fill-opacity":{type:"number","function":"interpolated","default":1,minimum:0,maximum:1,transition:!0},"fill-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,requires:[{"!":"fill-pattern"}]},"fill-outline-color":{type:"color","function":"interpolated",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}]},"fill-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels"},"fill-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"map",requires:["fill-translate"]},"fill-pattern":{type:"string","function":"piecewise-constant",transition:!0}},paint_line:{"line-opacity":{type:"number","function":"interpolated","default":1,minimum:0,maximum:1,transition:!0},"line-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,requires:[{"!":"line-pattern"}]},"line-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels"},"line-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"map",requires:["line-translate"]},"line-width":{type:"number","default":1,minimum:0,"function":"interpolated",transition:!0,units:"pixels"},"line-gap-width":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels"},"line-offset":{type:"number","default":0,"function":"interpolated",transition:!0,units:"pixels"},"line-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels"},"line-dasharray":{type:"array",value:"number","function":"piecewise-constant",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}]},"line-pattern":{type:"string","function":"piecewise-constant",transition:!0}},paint_circle:{"circle-radius":{type:"number","default":5,minimum:0,"function":"interpolated",transition:!0,units:"pixels"},"circle-color":{type:"color","default":"#000000","function":"interpolated",transition:!0},"circle-blur":{type:"number","default":0,"function":"interpolated",transition:!0},"circle-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0},"circle-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels"},"circle-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"map",requires:["circle-translate"]}},paint_symbol:{"icon-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0,requires:["icon-image"]},"icon-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,requires:["icon-image"]},"icon-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated",transition:!0,requires:["icon-image"]},"icon-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",requires:["icon-image"]},"icon-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"map",requires:["icon-image","icon-translate"]},"text-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0,requires:["text-field"]},"text-color":{type:"color","default":"#000000","function":"interpolated",transition:!0,requires:["text-field"]},"text-halo-color":{type:"color","default":"rgba(0, 0, 0, 0)","function":"interpolated",transition:!0,requires:["text-field"]},"text-halo-width":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",requires:["text-field"]},"text-halo-blur":{type:"number","default":0,minimum:0,"function":"interpolated",transition:!0,units:"pixels",requires:["text-field"]},"text-translate":{type:"array",value:"number",length:2,"default":[0,0],"function":"interpolated",transition:!0,units:"pixels",requires:["text-field"]},"text-translate-anchor":{type:"enum","function":"piecewise-constant",values:["map","viewport"],"default":"map",requires:["text-field","text-translate"]}},paint_raster:{"raster-opacity":{type:"number","default":1,minimum:0,maximum:1,"function":"interpolated",transition:!0},"raster-hue-rotate":{type:"number","default":0,period:360,"function":"interpolated",transition:!0,units:"degrees"},"raster-brightness-min":{type:"number","function":"interpolated","default":0,minimum:0,maximum:1,transition:!0},"raster-brightness-max":{type:"number","function":"interpolated","default":1,minimum:0,maximum:1,transition:!0},"raster-saturation":{type:"number","default":0,minimum:-1,maximum:1,"function":"interpolated",
}function i(t){return t.target||t.srcElement||window}function o(t){if("object"==typeof t){if("offsetX"in t)return t.offsetX;var e=i(t),r=e.getBoundingClientRect();return t.clientX-r.left}return 0}function a(t){if("object"==typeof t){if("offsetY"in t)return t.offsetY;var e=i(t),r=e.getBoundingClientRect();return t.clientY-r.top}return 0}r.buttons=n,r.element=i,r.x=o,r.y=a},{}],423:[function(t,e,r){e.exports=function(t,e){e||(e=[0,""]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",e}},{}],424:[function(t,e,r){"use strict";function n(t,e){var r=a(getComputedStyle(t).getPropertyValue(e));return r[0]*o(r[1],t)}function i(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var i=n(r,"font-size")/128;return e.removeChild(r),i}function o(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return i(t,e);case"em":return n(e,"font-size");case"rem":return n(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return s;case"cm":return s/2.54;case"mm":return s/25.4;case"pt":return s/72;case"pc":return s/6}return 1}var a=t("parse-unit");e.exports=o;var s=96},{"parse-unit":423}],425:[function(t,e,r){"use strict";function n(t,e,r){"function"==typeof t&&(r=!!e,e=t,t=window);var n=i("ex",t),o=function(t){r&&t.preventDefault();var i=t.deltaX||0,o=t.deltaY||0,a=t.deltaZ||0,s=t.deltaMode,l=1;switch(s){case 1:l=n;break;case 2:l=window.innerHeight}return i*=l,o*=l,a*=l,i||o||a?e(i,o,a):void 0};return t.addEventListener("wheel",o),o}var i=t("to-px");e.exports=n},{"to-px":424}],426:[function(t,e,r){"use strict";var n=t("cwise/lib/wrapper")({args:["index","array","scalar"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{_inline_1_arg1_=_inline_1_arg2_.apply(void 0,_inline_1_arg0_)}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:[],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"cwise",blockSize:64});e.exports=function(t,e){return n(t,e),t}},{"cwise/lib/wrapper":118}],427:[function(t,e,r){"use strict";function n(t,e){switch(e.length){case 0:break;case 1:t[0]=1/e[0];break;case 4:i(t,e);break;case 9:o(t,e);break;case 16:a(t,e);break;default:throw new Error("currently supports matrices up to 4x4")}return t}e.exports=n;var i=t("gl-mat2/invert"),o=t("gl-mat3/invert"),a=t("gl-mat4/invert")},{"gl-mat2/invert":428,"gl-mat3/invert":136,"gl-mat4/invert":143}],428:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*o-i*n;return a?(a=1/a,t[0]=o*a,t[1]=-n*a,t[2]=-i*a,t[3]=r*a,t):null}e.exports=n},{}],429:[function(t,e,r){"use strict";function n(t,e){var r=Math.floor(e),n=e-r,i=r>=0&&r<t.shape[0],o=r+1>=0&&r+1<t.shape[0],a=i?+t.get(r):0,s=o?+t.get(r+1):0;return(1-n)*a+n*s}function i(t,e,r){var n=Math.floor(e),i=e-n,o=n>=0&&n<t.shape[0],a=n+1>=0&&n+1<t.shape[0],s=Math.floor(r),l=r-s,u=s>=0&&s<t.shape[1],c=s+1>=0&&s+1<t.shape[1],h=o&&u?t.get(n,s):0,f=o&&c?t.get(n,s+1):0,d=a&&u?t.get(n+1,s):0,p=a&&c?t.get(n+1,s+1):0;return(1-l)*((1-i)*h+i*d)+l*((1-i)*f+i*p)}function o(t,e,r,n){var i=Math.floor(e),o=e-i,a=i>=0&&i<t.shape[0],s=i+1>=0&&i+1<t.shape[0],l=Math.floor(r),u=r-l,c=l>=0&&l<t.shape[1],h=l+1>=0&&l+1<t.shape[1],f=Math.floor(n),d=n-f,p=f>=0&&f<t.shape[2],v=f+1>=0&&f+1<t.shape[2],m=a&&c&&p?t.get(i,l,f):0,g=a&&h&&p?t.get(i,l+1,f):0,y=s&&c&&p?t.get(i+1,l,f):0,b=s&&h&&p?t.get(i+1,l+1,f):0,x=a&&c&&v?t.get(i,l,f+1):0,_=a&&h&&v?t.get(i,l+1,f+1):0,w=s&&c&&v?t.get(i+1,l,f+1):0,M=s&&h&&v?t.get(i+1,l+1,f+1):0;return(1-d)*((1-u)*((1-o)*m+o*y)+u*((1-o)*g+o*b))+d*((1-u)*((1-o)*x+o*w)+u*((1-o)*_+o*M))}function a(t){var e,r,n=0|t.shape.length,i=new Array(n),o=new Array(n),a=new Array(n),s=new Array(n);for(e=0;n>e;++e)r=+arguments[e+1],i[e]=Math.floor(r),o[e]=r-i[e],a[e]=0<=i[e]&&i[e]<t.shape[e],s[e]=0<=i[e]+1&&i[e]+1<t.shape[e];var l,u,c,h=0;t:for(e=0;1<<n>e;++e){for(u=1,c=t.offset,l=0;n>l;++l)if(e&1<<l){if(!s[l])continue t;u*=o[l],c+=t.stride[l]*(i[l]+1)}else{if(!a[l])continue t;u*=1-o[l],c+=t.stride[l]*i[l]}h+=u*t.data[c]}return h}function s(t,e,r,s){switch(t.shape.length){case 0:return 0;case 1:return n(t,e);case 2:return i(t,e,r);case 3:return o(t,e,r,s);default:return a.apply(void 0,arguments)}}e.exports=s,e.exports.d1=n,e.exports.d2=i,e.exports.d3=o},{}],430:[function(t,e,r){"use strict";var n=t("ndarray-linear-interpolate"),i=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=new Array(_inline_9_arg4_)}",args:[{name:"_inline_9_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_9_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_9_arg2_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_9_arg3_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_9_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_10_arg2_(this_warped,_inline_10_arg0_),_inline_10_arg1_=_inline_10_arg3_.apply(void 0,this_warped)}",args:[{name:"_inline_10_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_10_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_10_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_10_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_10_arg4_",lvalue:!1,rvalue:!1,count:0}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warpND",blockSize:64}),o=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_13_arg2_(this_warped,_inline_13_arg0_),_inline_13_arg1_=_inline_13_arg3_(_inline_13_arg4_,this_warped[0])}",args:[{name:"_inline_13_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_13_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_13_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_13_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_13_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp1D",blockSize:64}),a=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0,0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_16_arg2_(this_warped,_inline_16_arg0_),_inline_16_arg1_=_inline_16_arg3_(_inline_16_arg4_,this_warped[0],this_warped[1])}",args:[{name:"_inline_16_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_16_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_16_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_16_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_16_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp2D",blockSize:64}),s=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0,0,0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_19_arg2_(this_warped,_inline_19_arg0_),_inline_19_arg1_=_inline_19_arg3_(_inline_19_arg4_,this_warped[0],this_warped[1],this_warped[2])}",args:[{name:"_inline_19_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_19_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_19_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_19_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_19_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp3D",blockSize:64});e.exports=function(t,e,r){switch(e.shape.length){case 1:o(t,r,n.d1,e);break;case 2:a(t,r,n.d2,e);break;case 3:s(t,r,n.d3,e);break;default:i(t,r,n.bind(void 0,e),e.shape.length)}return t}},{"cwise/lib/wrapper":118,"ndarray-linear-interpolate":429}],431:[function(t,e,r){"use strict";function n(t,e,r){var n=e.dimension,a=o([],r);return i(t,e,function(t,e){for(var r=0;n>r;++r){t[r]=a[(n+1)*n+r];for(var i=0;n>i;++i)t[r]+=a[(n+1)*i+r]*e[i]}for(var o=a[(n+1)*(n+1)-1],i=0;n>i;++i)o+=a[(n+1)*i+n]*e[i];for(var s=1/o,r=0;n>r;++r)t[r]*=s;return t}),t}var i=t("ndarray-warp"),o=t("gl-matrix-invert");e.exports=n},{"gl-matrix-invert":427,"ndarray-warp":430}],432:[function(t,e,r){"use strict";function n(t){if(!t)return s;for(var e=0;e<t.args.length;++e){var r=t.args[e];0===e?t.args[e]={name:r,lvalue:!0,rvalue:!!t.rvalue,count:t.count||1}:t.args[e]={name:r,lvalue:!1,rvalue:!0,count:1}}return t.thisVars||(t.thisVars=[]),t.localVars||(t.localVars=[]),t}function i(t){return a({args:t.args,pre:n(t.pre),body:n(t.body),post:n(t.proc),funcName:t.funcName})}function o(t){for(var e=[],r=0;r<t.args.length;++r)e.push("a"+r);var n=new Function("P",["return function ",t.funcName,"_ndarrayops(",e.join(","),") {P(",e.join(","),");return a0}"].join(""));return n(i(t))}var a=t("cwise-compiler"),s={body:"",args:[],thisVars:[],localVars:[]},l={add:"+",sub:"-",mul:"*",div:"/",mod:"%",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"};!function(){for(var t in l){var e=l[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];r[t]=o({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=o({args:["array"],body:{args:["a"],body:"a="+e+"a"},rvalue:!0,count:2,funcName:t+"eq"})}}();var c={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in c){var e=c[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var h=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;t<h.length;++t){var e=h[t];r[e]=o({args:["array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b)",thisVars:["this_f"]},funcName:e}),r[e+"eq"]=o({args:["array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a"],body:"a=this_f(a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"eq"})}}();var f=["max","min","atan2","pow"];!function(){for(var t=0;t<f.length;++t){var e=f[t];r[e]=o({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:e}),r[e+"s"]=o({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:e+"s"}),r[e+"eq"]=o({args:["array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"eq"}),r[e+"seq"]=o({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"seq"})}}();var d=["atan2","pow"];!function(){for(var t=0;t<d.length;++t){var e=d[t];r[e+"op"]=o({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:e+"op"}),r[e+"ops"]=o({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:e+"ops"}),r[e+"opeq"]=o({args:["array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"opeq"}),r[e+"opseq"]=o({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"opseq"})}}(),r.any=a({args:["array"],pre:s,body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"if(a){return true}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return false"},funcName:"any"}),r.all=a({args:["array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1}],body:"if(!x){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"all"}),r.sum=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s+=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"sum"}),r.prod=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=1"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s*=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"prod"}),r.norm2squared=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm2squared"}),r.norm2=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return Math.sqrt(this_s)"},funcName:"norm2"}),r.norminf=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:4}],body:"if(-a>this_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),r.norm1=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),r.sup=a({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),r.inf=a({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_<this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),r.argmin=a({args:["index","array","shape"],pre:{body:"{this_v=Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_<this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),r.argmax=a({args:["index","array","shape"],pre:{body:"{this_v=-Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_>this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),r.random=o({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),r.assign=o({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=o({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=a({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":115}],433:[function(t,e,r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;t<r.length;++t)r[t]=[Math.abs(e[t]),t];r.sort(n);var i=new Array(r.length);for(t=0;t<i.length;++t)i[t]=r[t][1];return i}function o(t,e){var r=["View",e,"d",t].join("");0>e&&(r="View_Nil"+t);var n="generic"===t;if(-1===e){var o="function "+r+"(a){this.data=a;};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+r+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+r+"(a){return new "+r+"(a);}",a=new Function(o);return a()}if(0===e){var o="function "+r+"(a,d) {this.data = a;this.offset = d};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+r+"_copy() {return new "+r+"(this.data,this.offset)};proto.pick=function "+r+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+r+"_get(){return "+(n?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+r+"_set(v){return "+(n?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+r+"(a,b,c,d){return new "+r+"(a,d)}",a=new Function("TrivialArray",o);return a(h[t][0])}var o=["'use strict'"],s=l(e),u=s.map(function(t){return"i"+t}),c="this.offset+"+s.map(function(t){return"this.stride["+t+"]*i"+t}).join("+"),f=s.map(function(t){return"b"+t}).join(","),d=s.map(function(t){return"c"+t}).join(",");o.push("function "+r+"(a,"+f+","+d+",d){this.data=a","this.shape=["+f+"]","this.stride=["+d+"]","this.offset=d|0}","var proto="+r+".prototype","proto.dtype='"+t+"'","proto.dimension="+e),o.push("Object.defineProperty(proto,'size',{get:function "+r+"_size(){return "+s.map(function(t){return"this.shape["+t+"]"}).join("*"),"}})"),1===e?o.push("proto.order=[0]"):(o.push("Object.defineProperty(proto,'order',{get:"),4>e?(o.push("function "+r+"_order(){"),2===e?o.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&o.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):o.push("ORDER})")),o.push("proto.set=function "+r+"_set("+u.join(",")+",v){"),n?o.push("return this.data.set("+c+",v)}"):o.push("return this.data["+c+"]=v}"),o.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?o.push("return this.data.get("+c+")}"):o.push("return this.data["+c+"]}"),o.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),o.push("proto.hi=function "+r+"_hi("+u.join(",")+"){return new "+r+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var p=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),v=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});o.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+v.join(","));for(var m=0;e>m;++m)o.push("if(typeof i"+m+"==='number'&&i"+m+">=0){d=i"+m+"|0;b+=c"+m+"*d;a"+m+"-=d}");o.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),o.push("proto.step=function "+r+"_step("+u.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var m=0;e>m;++m)o.push("if(typeof i"+m+"==='number'){d=i"+m+"|0;if(d<0){c+=b"+m+"*(a"+m+"-1);a"+m+"=ceil(-a"+m+"/d)}else{a"+m+"=ceil(a"+m+"/d)}b"+m+"*=d}");o.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"b"+t}).join(",")+",c)}");for(var g=new Array(e),y=new Array(e),m=0;e>m;++m)g[m]="a[i"+m+"]",y[m]="b[i"+m+"]";o.push("proto.transpose=function "+r+"_transpose("+u+"){"+u.map(function(t,e){return t+"=("+t+"===undefined?"+e+":"+t+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+r+"(this.data,"+g.join(",")+","+y.join(",")+",this.offset)}"),o.push("proto.pick=function "+r+"_pick("+u+"){var a=[],b=[],c=this.offset");for(var m=0;e>m;++m)o.push("if(typeof i"+m+"==='number'&&i"+m+">=0){c=(c+this.stride["+m+"]*i"+m+")|0}else{a.push(this.shape["+m+"]);b.push(this.stride["+m+"])}");o.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),o.push("return function construct_"+r+"(data,shape,stride,offset){return new "+r+"(data,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var a=new Function("CTOR_LIST","ORDER",o.join("\n"));return a(h[t],i)}function a(t){if(u(t))return"buffer";if(c)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,r,n){if(void 0===t){var i=h.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===r){r=new Array(s);for(var l=s-1,u=1;l>=0;--l)r[l]=u,u*=e[l]}if(void 0===n){n=0;for(var l=0;s>l;++l)r[l]<0&&(n-=(e[l]-1)*r[l])}for(var c=a(t),f=h[c];f.length<=s+1;)f.push(o(c,f.length-1));var i=f[s+1];return i(t,e,r,n)}var l=t("iota-array"),u=t("is-buffer"),c="undefined"!=typeof Float64Array,h={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};e.exports=s},{"iota-array":245,"is-buffer":246}],434:[function(t,e,r){"use strict";function n(t,e){if("string"!=typeof t)throw new TypeError("repeat-string expects a string.");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;for(i===t&&"undefined"!=typeof i||(i=t,o="");r>o.length&&e>0&&(1&e&&(o+=t),e>>=1);)t+=t;return o.substr(0,r)}var i,o="";e.exports=n},{}],435:[function(t,e,r){(function(t){e.exports=t.performance&&t.performance.now?function(){return performance.now()}:Date.now||function(){return+new Date}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],436:[function(t,e,r){"use strict";function n(t){for(var e="robustLinearSolve"+t+"d",r=["function ",e,"(A,b){return ["],n=0;t>n;++n){r.push("det([");for(var i=0;t>i;++i){i>0&&r.push(","),r.push("[");for(var o=0;t>o;++o)o>0&&r.push(","),o===n?r.push("+b[",i,"]"):r.push("+A[",i,"][",o,"]");r.push("]")}r.push("]),")}r.push("det(A)]}return ",e);var a=new Function("det",r.join(""));return a(6>t?s[t]:s)}function i(){return[0]}function o(t,e){return[[e[0]],[t[0][0]]]}function a(){for(;u.length<l;)u.push(n(u.length));for(var t=[],r=["function dispatchLinearSolve(A,b){switch(A.length){"],i=0;l>i;++i)t.push("s"+i),r.push("case ",i,":return s",i,"(A,b);");r.push("}var s=CACHE[A.length];if(!s)s=CACHE[A.length]=g(A.length);return s(A,b)}return dispatchLinearSolve"),t.push("CACHE","g",r.join(""));var o=Function.apply(void 0,t);e.exports=o.apply(void 0,u.concat([u,n]));for(var i=0;l>i;++i)e.exports[i]=u[i]}var s=t("robust-determinant"),l=6,u=[i,o];a()},{"robust-determinant":438}],437:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=t[t.length-1],n=e,i=e-2;i>=0;--i){var o=r,a=t[i];r=o+a;var s=r-o,l=a-s;l&&(t[--n]=r,r=l)}for(var u=0,i=n;e>i;++i){var o=t[i],a=r;r=o+a;var s=r-o,l=a-s;l&&(t[u++]=l)}return t[u++]=r,t.length=u,t}e.exports=n},{}],438:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;n<t.length;++n)for(var i=r[n-1]=new Array(t.length-1),o=0,a=0;o<t.length;++o)o!==e&&(i[a++]=t[n][o]);return r}function i(t){for(var e=new Array(t),r=0;t>r;++r){e[r]=new Array(t);for(var n=0;t>n;++n)e[r][n]=["m[",r,"][",n,"]"].join("")}return e}function o(t){return 1&t?"-":""}function a(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("");for(var e=[],r=0;r<t.length;++r)e.push(["scale(",s(n(t,r)),",",o(r),t[0][r],")"].join(""));return a(e)}function l(t){var e=new Function("sum","scale","prod","compress",["function robustDeterminant",t,"(m){return compress(",s(i(t)),")};return robustDeterminant",t].join(""));return e(h,f,c,d)}function u(){for(;v.length<p;)v.push(l(v.length));for(var t=[],r=["function robustDeterminant(m){switch(m.length){"],n=0;p>n;++n)t.push("det"+n),r.push("case ",n,":return det",n,"(m);");r.push("}var det=CACHE[m.length];if(!det)det=CACHE[m.length]=gen(m.length);return det(m);}return robustDeterminant"),t.push("CACHE","gen",r.join(""));var i=Function.apply(void 0,t);e.exports=i.apply(void 0,v.concat([v,l]));for(var n=0;n<v.length;++n)e.exports[n]=v[n]}var c=t("two-product"),h=t("robust-sum"),f=t("robust-scale"),d=t("robust-compress"),p=6,v=[function(){return[0]},function(t){return[t[0][0]]}];u()},{"robust-compress":437,"robust-scale":440,"robust-sum":442,"two-product":456}],439:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;n<t.length;++n)for(var i=r[n-1]=new Array(t.length-1),o=0,a=0;o<t.length;++o)o!==e&&(i[a++]=t[n][o]);return r}function i(t){for(var e=new Array(t),r=0;t>r;++r){e[r]=new Array(t);for(var n=0;t>n;++n)e[r][n]=["m",n,"[",t-r-1,"]"].join("")}return e}function o(t){return 1&t?"-":""}function a(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;r<t.length;++r)e.push(["scale(",a(s(n(t,r))),",",o(r),t[0][r],")"].join(""));return e}function l(t){for(var e=[],r=[],o=i(t),l=[],u=0;t>u;++u)0===(1&u)?e.push.apply(e,s(n(o,u))):r.push.apply(r,s(n(o,u))),l.push("m"+u);var c=a(e),v=a(r),m="orientation"+t+"Exact",g=["function ",m,"(",l.join(),"){var p=",c,",n=",v,",d=sub(p,n);return d[d.length-1];};return ",m].join(""),y=new Function("sum","prod","scale","sub",g);return y(f,h,d,p)}function u(t){var e=_[t.length];return e||(e=_[t.length]=l(t.length)),e.apply(void 0,t)}function c(){for(;_.length<=v;)_.push(l(_.length));for(var t=[],r=["slow"],n=0;v>=n;++n)t.push("a"+n),r.push("o"+n);for(var i=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;v>=n;++n)i.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i<arguments.length;++i){s[i]=arguments[i]};return slow(s);}return getOrientation"),r.push(i.join(""));var o=Function.apply(void 0,r);e.exports=o.apply(void 0,[u].concat(_));for(var n=0;v>=n;++n)e.exports[n]=_[n]}var h=t("two-product"),f=t("robust-sum"),d=t("robust-scale"),p=t("robust-subtract"),v=5,m=1.1102230246251565e-16,g=(3+16*m)*m,y=(7+56*m)*m,b=l(3),x=l(4),_=[function(){return 0},function(){return 0},function(t,e){return e[0]-t[0]},fu`