Skip to content

Instantly share code, notes, and snippets.

@thejeshgn
Created December 19, 2021 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thejeshgn/dd0ffa5b5791d2ee553b2a722450c78b to your computer and use it in GitHub Desktop.
Save thejeshgn/dd0ffa5b5791d2ee553b2a722450c78b to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
<html>
<head><meta charset="utf-8" /></head>
<body>
<script type="text/javascript">!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Plotly=t()}}((function(){return function t(e,r,n){function i(o,s){if(!r[o]){if(!e[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[o]={exports:{}};e[o][0].call(u.exports,(function(t){return i(e[o][1][t]||t)}),u,u.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(t,e,r){"use strict";var n=t("plotly.js/src/components/annotations"),i=t("plotly.js");n.add=function(t){var e=t._fullLayout.annotations.length;i.relayout(t,"annotations["+e+"]","add")},n.ARROWPATHS=t("plotly.js/src/components/annotations/arrow_paths"),n.arrowhead=t("plotly.js/src/components/annotations/draw_arrow_head"),e.exports=n},{"plotly.js":675,"plotly.js/src/components/annotations":717,"plotly.js/src/components/annotations/arrow_paths":708,"plotly.js/src/components/annotations/draw_arrow_head":716}],2:[function(t,e,r){"use strict";var n=t("plotly.js/src/plots/cartesian/axes"),i=t("plotly.js/src/plots/cartesian/axis_autotype");n.name2id=t("plotly.js/src/plots/cartesian/axis_ids").name2id,n.autoType=function(t,e,r){return i(t,e,r||{autotypenumbers:"convert types"})},n.layoutAttributes=t("plotly.js/src/plots/cartesian/layout_attributes"),e.exports=n},{"plotly.js/src/plots/cartesian/axes":911,"plotly.js/src/plots/cartesian/axis_autotype":912,"plotly.js/src/plots/cartesian/axis_ids":914,"plotly.js/src/plots/cartesian/layout_attributes":925}],3:[function(t,e,r){"use strict";var n=t("plotly.js"),i=t("plotly.js/src/plots/plots"),a=t("./lib"),o="breakpoints",s="_"+o,l={_isLinkedToArray:"breakpoint",editType:"calc",description:["Layout breakpoints are a plot.ly exclusive feature.","Set width / height / aspect ratio breakpoints linked to","frames to create multi-display graphs."].join(" "),enabled:{valType:"boolean",dflt:!0,role:"info",editType:"calc",description:["Determines whether this breakpoint is enabled or disabled."].join(" ")},type:{valType:"enumerated",values:["width","height","aspectratio"],dflt:"width",role:"info",editType:"calc",description:["Sets the type of breakpoint, that is, whether the breakpoint","is applied via width or height or aspect ratio value."].join(" ")},range:{valType:"info_array",role:"info",editType:"calc",items:[{valType:"number",min:0,dflt:0},{valType:"number",min:0,dflt:1/0}],description:["Sets the range (in px) for *width* and *height* types,","or *aspectratio* (unitless)."].join(" ")},frame:{valType:"string",strict:!0,noBlank:!0,dflt:null,editType:"calc",role:"info",description:["Sets the frame name to be applied on this breakpoint."].join(" ")}};function c(t){var e=n.Lib.extendFlat({},t);return delete e.autosize,delete e.width,delete e.height,i.extendLayout({},e)}e.exports={moduleType:"component",name:o,layoutAttributes:l,supplyLayoutDefaults:function(t,e){var r,n,i=Array.isArray(t[o])?t[o]:[],s=e[o]=[];function c(t,e){return a.coerce(r,n,l,t,e)}for(var u=0;u<i.length;u++){var f=a.isPlainObject(i[u]);if(r=i[u]||{},n={},c("enabled",f)){c("type");var h=c("frame"),p=c("range");h&&p[1]>p[0]||(n.enabled=!1)}s.push(n)}},apply:function(t){var e,r,i=t._fullLayout,a=t.layout||{},l=a[o],u=i[o];if(0===u.length)return Promise.resolve();function f(t){var e;switch(t.type){case"aspectratio":e=i.height/i.width;break;case"width":e=i.width;break;case"height":e=i.height;break;default:return!1}return e>=t.range[0]&&e<=t.range[1]}t[s]||(t[s]={layout:n.Lib.extendDeepNoArrays({},a),frameName:""});for(var h=0;h<u.length;h++){var p=u[h],d=t._transitionData._frameHash[p.frame];if(d&&p.enabled&&f(p)){e=d;break}}return!e&&t[s].frameName?(t.layout=c(t[s].layout),t[s].frameName="",r=!0):e&&e.name!==t[s].frameName?(t.layout=c(e.layout||{}),t.layout[o]=l,t[s].frameName=e.name,r=!0):r=!1,r?n.redraw(t):Promise.resolve()}}},{"./lib":10,"plotly.js":675,"plotly.js/src/plots/plots":974}],4:[function(t,e,r){var n=t("../../plotly");function i(t){return t[0]<t[1]?t[0]:t[1]}function a(t){return t[0]>t[1]?t[0]:t[1]}function o(t,e,r){return[r*t+(1-r)*e,r*e+(1-r)*t]}function s(t,e,r){return Math.abs(e-t)<r&&(e=t+r*(e>t?1:-1),console.log("Moving a y value so the guesses are unequal",e)),e}function l(t){for(var e=0,r=0;r<t.length;r++)e+=t[r];return e}function c(t,e,r){var c=n.Lib.findBin,u=n.Lib.constrain,f=t.length,h=t[0],p=t[f-1]-h,d=h+.1*p,m=h+.9*p,g=(d+m)/2,v=c(h+.2*p,t)+1,y=c(h+.4*p,t,!0)+1,x=c(h+.6*p,t)+1,b=c(h+.8*p,t,!0)+1;y>=x&&(y=v,x=b);var _=l(e.slice(0,v))/v,w=l(e.slice(b))/(f-b),T=b>v?l(e.slice(y,x))/(x-y):.3*_+.7*w;r||(r={});var M=o(_,w,.02);if(r.nostraight){var k=o(_,w,.45);T>i(k)&&T<a(k)&&(T=T<(_+w)/2?i(k):a(k),console.log("moving y away from centre to",T))}if(r.monotonic&&(T<=i(M)||T>=a(M))&&(T=u(T,i(M),a(M)),console.log("moving y2 within bounds to",T)),r.unequal){var A=.02*(a(M)-i(M));T=s(_,T,A),T=s(w,T,A),w=s(_,w,A)}var S=1e-5;return Math.abs(M[0]-M[1])<S&&(_=i(M)-2,w=a(M)+2,T=i(M)+.8,console.log("reticulating splines on tight bounds")),{x:[d,g,m],y:[_,T,w]}}r.exponential=function(t,e){if(t.length<3)return{params:{},err:"Exponential fitting requires a minimum of 3 points"};for(var r=c(t,e,{nostraight:!0,monotonic:!0}),n=r.y[0],i=r.y[1],a=r.y[2],o=r.x[0],s=r.x[1],l=(r.x[2],Math.pow(i-n,2)/(a-2*i+n)),u=(a-i)/(i-n),f=t[u>1?t.length-1:0],h=0;h<t.length;h++)t[h]-=f;function p(t){for(var e={},r=0;r<t.length;r++)"b"===t[r].name?e.b=t[r]:"c"===t[r].name&&(e.c=t[r]);if(!e.b||!e.c)throw new Error("exponential autoguess could not locate a or b param");return e}var d={prefit:function(t){var e=p(t);e.b.value*=Math.exp(e.c.value*f)},postfit:function(t){var e=p(t);e.b.value/=Math.exp(e.c.value*f)}},m=n-l,g=Math.log(u)/(s-o);return{params:{a:m,b:l*Math.exp(-g*o),c:g},err:"",xshift:f,pshift:d}},r.inverse=function(t,e,r){if(t.length<3)return{params:{},err:"Inverse fitting requires a minimum of 3 points"};var n=c(t,e,{nostraight:!0,unequal:!0}),i=n.y[0],a=n.y[1],o=n.y[2],s=n.x[0],l=n.x[1],u=n.x[2];r&&(s*=s,l*=l,u*=u);var f=i-2*a+o;return{params:{a:2*(l-s)*(i-o)*(i-a)*(a-o)/(f*f),x0:s-2*(l-s)*(a-o)/f,y0:(2*i*o-a*(i+o))/f},err:""}},r.inverse2=function(t,e){return r.inverse(t,e,!0)},r.inverseSimple=function(t,e,r){if(t.length<3)return{params:{},err:"Inverse fitting requires a minimum of 3 points"};var n=c(t,e,{nostraight:!0,unequal:!0}),i=n.y[0],a=n.y[2],o=n.x[0],s=n.x[2];return r&&(o*=o,s*=s),{params:{a:o*s*(a-i)/(o-s),y0:(o*i-s*a)/(o-s)},err:""}},r.inverseSimple2=function(t,e){return r.inverseSimple(t,e,!0)},r.peak=function(t,e){var r,i,a,o,s,l,c,u,f,h,p,d=Math.min(t.length,100),m=t.length/d,g=(t[t.length-1]-t[0])/(d-1/m),v=[],y=[],x=0;for(s=0;s<d;s++){for(v.push(t[0]+g*(s+.5-.5/m)),c=0,l=x;l<t.length&&t[l]<v[s]+g/2;l++)c+=e[l];if(f=l>x?c/(l-x):null,y.push(f),x=l,null!==f){for(u=y.length-1,l=h;l<u;l++)y[l]=p+(f-p)*(l-h)/(u-h);h=u,p=f}}var b,_,w,T,M=(y=n.Lib.smooth(y,.1*y.length)).slice().sort(),k=M[0],A=M[Math.floor((M.length-1)/2)],S=M[M.length-1],E=!1;for(A>.75*S+.25*k?(r=S,i=k-S,b=y.indexOf(k)):(r=k,i=S-k,b=y.indexOf(S)),T=r+i/2,s=b;s>=0;s--){if(i>0?y[s]<T:y[s]>T){_=v[0]+g*(s+(r+i/2-y[s])/(y[s+1]-y[s]));break}0===s&&(_=v[0],E=!0)}for(s=b;s<y.length;s++){if(i>0?y[s]<T:y[s]>T){w=v[0]+g*(s-(r+i/2-y[s])/(y[s-1]-y[s]));break}s===y.length-1&&(w=v[y.length-1],E=!0)}a=(_+w)/2;var C=w-_,L=.1*y.length*g;return E&&(L/=2),{params:{a:r,h:i*=C/(o=Math.max(2*g,C/5,Math.sqrt(C*C-L*L)||0)),x0:a,FWHM:o},err:""}},r.gauss=function(t,e){var n=r.peak(t,e);return n.params.w=n.params.FWHM/Math.sqrt(8*Math.log(2)),delete n.params.FWHM,n}},{"../../plotly":16}],5:[function(t,e,r){var n=t("plotly.js/src/plots/cartesian/constants").BADNUM,i=t("../../plotly"),a=t("./funcSolver"),o=t("../transformUtils"),s=o.cleanNumber,l=o.calcRange,c=o.computeCalcData,u=o.fill,f=o.stripValueAcrossRows,h=o.sortArraysByFirstArray,p=o.findInsertionIndex,d=o.computeCorrelation,m=t("./predefinedFunctions").findVariantByFunction,g=t("fast-isnumeric"),v=t("../math"),y=t("plotly.js/src/plots/attributes"),x=t("plotly.js/src/traces/scatter/attributes"),b=i.Lib.isPlainObject,_=i.Lib.extendDeepNoArrays,w=a();function T(t){throw new Error(t)}function M(){this.moduleType="transform",this.makesData=!0,this.name="fit",this.attributes={inputUid:{valType:"string",editType:"calc"},fitfunction:{valType:"string",dflt:"m*x + b",editType:"calc"},parameters:{valType:"data_array",dflt:[{name:"m",hold:!1},{name:"b",hold:!1}],editType:"calc"},inputxrange:{valType:"data_array",dflt:[],editType:"calc"},outputxrange:{valType:"data_array",dflt:[],editType:"calc"},regressor:{valType:"string",dflt:"x",editType:"calc"},regressand:{valType:"string",dflt:"y",editType:"calc"},interpolation:{valType:"number",editType:"calc"},correlation:{valType:"number",editType:"calc"},rms:{valType:"number",editType:"calc"},xmid:{description:"Midpoint of the regressor not necessarily x.",valType:"any",editType:"calc"},ymid:{description:"Midpoint of the regressand not necessarily y.",valType:"any",editType:"calc"},editType:"calc"}}e.exports=M,M.prototype.supplyDefaults=function(t){var e=this.attributes,r={},n=function(n,a){return i.Lib.coerce(t,r,e,n,a)};return n("inputUid"),n("fitfunction"),n("parameters"),n("inputxrange"),n("outputxrange"),n("regressor"),n("regressand"),n("interpolation"),n("correlation"),n("rms"),n("xmid"),n("ymid"),r},M.prototype.transform=function(t,e){var r,a,o=e.transform,M=e.fullTrace,k=M._input;for(r=0;r<e.fullData.length;r++)e.fullData[r]._input.uid===o.inputUid&&(a=e.fullData[r]);a||T("Cannot find parent trace to fit in state.fullData");var A=a[o.regressor]||[],S=a[o.regressand]||[],E=o.regressor+"calendar",C=o.regressand+"calendar",L=a[E],P=a[C],I=c(A,L),O=I.calcData,z=I.axes,D=(I=c(S,P)).calcData,N=I.axes,R=u(1,D.length),F=f(n,O,D,R),B=F[0],j=F[1],U=F[2];h(B,j,U);var V,q=l(B,o.inputxrange,L),H=q[0],G=q[1],Y=p(B,H),W=p(B,G);if(B[W]>G&&(W-=1),F=[B,j,U].map((function(t){return t.slice(Y,W+1)})),B=F[0],j=F[1],U=F[2],"date"===z.type)for(V=B[0],r=0;r<B.length;r++)B[r]=B[r]-V,B[r]=B[r]/1e5;var Z=o.parameters.map((function(t){return t.value&&(t.value=s(t.value)),t})),X=m(o.fitfunction),J=null;if(X){var K=X.autoguess(B,j);K.err&&T("guess for "+X.name+" failed with "+K.err),J=K.pshift,Z=Z.map((function(t){var e=K.params[t.name];return!g(t.value)&&g(e)&&!t.hold&&(t.value=e),t})),J&&"function"==typeof J.prefit&&J.prefit(Z)}var $=Z.filter((function(t){return!t.hold})),Q={};Z.filter((function(t){return t.hold})).forEach((function(t){Q[t.name]=t.value||0}));var tt=v.compile(o.fitfunction),et=function(t,e){for(var r=0;r<e.length;r++)Q[$[r].name]=e[r];return Q.x=t,tt.eval(Q)},rt=$.map((function(t){return t.value})),nt=w.run(B,j,U,rt,et);$.forEach((function(t,e){t.value=nt.params[e],t.error=nt.err[e]})),J&&"function"==typeof J.postfit&&J.postfit(Z);var it=O.slice(),at=(q=l(it.filter(g),o.outputxrange,L))[0],ot=q[1],st=null;if(g(o.interpolation)&&(st=s(o.interpolation)),st){it=[];var lt=(ot-at)/st,ct=at;for(r=0;r<=st;r++)it[r]=ct,ct+=lt}else{var ut;it.length>1&&(ut=O[0]>O[1]),it=it.filter(g).sort((function(t,e){return t-e}));var ft=p(it,at),ht=p(it,ot);it[ht]>ot&&(ht-=1),it=it.slice(ft,ht+1),ut&&it.reverse()}var pt=$.map((function(t){return t.value})),dt=new Array(it.length);if(V)for(r=0;r<it.length;r++)g(it[r])?dt[r]=et((it[r]-V)/1e5,pt):dt[r]=n;else for(r=0;r<it.length;r++)g(it[r])?dt[r]=et(it[r],pt):dt[r]=n;for(r=0;r<it.length;r++)it[r]=z.c2d(it[r]),dt[r]=N.c2d(dt[r]);o.rms=nt.rms,o.correlation=d(j,nt.fit);var mt=(it.length-1)/2,gt=Math.floor(mt),vt=Math.ceil(mt);o.xmid=z.l2d((z.d2l(it[gt])+z.d2l(it[vt]))/2),o.ymid=N.l2d((N.d2l(dt[gt])+N.d2l(dt[vt]))/2);var yt,xt=_({},k),bt=i.Lib.coerce.bind(i.Lib,k,xt);return b(a.marker)?yt=a.marker.color:b(a.line)&&(yt=a.line.color),bt(y,"type","scatter"),bt(y,"name","Fit of "+a.name),bt(y,"opacity",.5),bt(x,"mode","lines"),Array.isArray(yt)||bt(x,"line.color",yt),bt(x,"line.width",4),xt[o.regressor]=it,xt[o.regressand]=dt,xt.transforms=M.transforms,xt[E]=L,xt[C]=P,[xt]}},{"../../plotly":16,"../math":11,"../transformUtils":15,"./funcSolver":6,"./predefinedFunctions":8,"fast-isnumeric":214,"plotly.js/src/plots/attributes":907,"plotly.js/src/plots/cartesian/constants":917,"plotly.js/src/traces/scatter/attributes":1270}],6:[function(t,e,r){var n=t("fast-isnumeric"),i=Math.PI,a=i/2;function o(t,e){return Math.max(t,e)}function s(t){return Math.abs(t)}function l(t){return Math.sqrt(t)}function c(t,e,r,n){for(var i=1,a=i,o=e;o<=r;)a+=i*=t*o/(o-n),o+=2;return a}function u(t,e){var r,n=(t=s(t))/l(e),i=(r=n,Math.atan(r));if(1===e)return 1-i/a;var o=function(t){return Math.sin(t)}(i),u=function(t){return Math.cos(t)}(i);return e%2==1?1-(i+o*u*c(u*u,2,e-3,-1))/a:1-o*c(u*u,1,e-3,-1)}function f(t){var e;return s(t)<5e-5&&(t=0),(e=(e=" "+(t+(t>0?5e-5:-5e-5))).substring(0,e.indexOf(".")+5)).substring(e.length-10,e.length)}function h(t){var e;return s(t)<5e-7&&(t=0),(e=(e=" "+(t+(t>0?5e-7:-5e-7))).substring(0,e.indexOf(".")+7)).substring(e.length-18,e.length)}function p(t,e,r){return t*(r+1)+e}function d(t,e,r,n){return"number"!=typeof t?n:o(e,(i=r,a=t,Math.min(i,a)));var i,a}e.exports=function(t){t||(t={});var e=t.log||!1,r={};function i(t){e&&console.log("starting Iterate",t);var r,n=t.params.slice(0),i=[1,1,1,1,1,1,1,1],a=[0,0,0,0,0,0,0,0,0],c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];r="cov"in t&&t.cov?t.cov:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];var m,g,v,y,x,b,_,w=decodeURI("%0D")+decodeURI("%0A"),T=0,M=0,k=0,A=t.data.length,S="npar"in t?t.npar:t.params.length,E=d(t.nvar,1,8,1),C=A-S,L=(m=C,function(t,e){for(var r,n=.5,i=.25;i>1e-15;)n+=t(r=1/n-1)>e?-i:i,i/=2;return r}((function(t){return u(t,m)}),.05)),P=d(t.pctile/100,0,1,.5),I=t.func,O=0,z={params:[],fit:[],res:[],conf_lo:[],conf_hi:[],rms:0,corr:0,cov:[]},D=[];for(M=0;M<S*(S+1);M++)c[M]=0;for(T=0;T<A;T++){v=t.data[T][0],y=I(v,n);var N=g=t.data[T][E];for(0===(x="w"===t.errorform?t.data[T][E+1]:1)&&(x=.001),t.leastabs&&(x*=o(l(s(g-y)*(g<y?P:1-P)),.001*g)),D.push(x),M=0;M<S;M++){_=0===(b=n[M])?1e-4:b/1e3,e&&0===T&&console.log(T,M,_),n[M]=b+_;var R,F=I(v,n);t.centered?(n[M]=b-_,R=I(v,n),a[M]=(F-R)/(2*_*x)):a[M]=(F-y)/(_*x),n[M]=b}a[S]=(g-y)/x,O+=a[S]*a[S];var B=0;for(M=0;M<S;M++){for(k=0;k<=S;k++)c[p(M,k,S)]+=a[M]*a[k];for(B+=r[p(M,M,S)]*a[M]*a[M],k=M+1;k<S;k++)B+=2*r[p(M,k,S)]*a[M]*a[k]}var j=y,U=y-L*(B=x*l(B)),V=y+L*B;z.fit.push(j),z.res.push(N-j),z.conf_lo.push(U),z.conf_hi.push(V)}var q=l(O/o(1,C));e&&console.log("RMS Error = "+h(q)+"; d.f = "+C+"; SSq = "+h(O));var H,G,Y=A*(G=O/A,Math.log(G))+2*(S+1);for(H=A>=S+2?Y+2*(S+1)*(S+1+1)/(A-(S+1)-1):Y,e&&console.log("AIC = "+h(Y)+"; AIC(corrected) = "+h(H)),T=0;T<S;T++){var W=c[p(T,T,S)]||1e-15*O;for(c[p(T,T,S)]=1,k=0;k<=S;k++)c[p(T,k,S)]=c[p(T,k,S)]/W;for(M=0;M<S;M++)if(T!=M)for(W=c[p(M,T,S)],c[p(M,T,S)]=0,k=0;k<=S;k++)c[p(M,k,S)]-=W*c[p(T,k,S)]}var Z=n.slice();function X(t){for(T=0;T<S;T++)n[T]=Z[T]+t*c[p(T,S,S)]}function J(e){var r;for(O=0,T=0;T<A;T++)r=(t.data[T][E]-I(t.data[T][0],e))/D[T],O+=r*r;return l(O/o(1,C))}for(e&&console.log(w+"Parameter Estimates..."),X(1),T=0;T<S;T++)i[T]=q*l(c[p(T,T,S)]),e&&console.log("p"+(T+1)+"="+h(n[T])+" +/- "+h(i[T])+"; p="+f(u(n[T]/i[T],C)));e&&console.log(w+"Covariance Matrix Terms and Error-Correlations...");var K,$=1,Q=J(n),tt=Q,et=Q;if(Q>q){for(;$>.01&&tt>=q;)X($/=2),Q=tt,tt=J(n);tt<q?(X($*(3*q+Q-4*tt)/(2*q+2*Q-4*tt)),(et=J(n))>tt&&(X($),et=tt),console.log("took a smaller step than originally calculated",$)):(console.log("Oops - didnt find a lower RMS anywhere on the old to new parameter vector - stopping"),et=q,n=Z)}for(M=0;M<S;M++)for(k=M;k<S;k++)if(r[p(M,k,S)]=c[p(M,k,S)]*q*q,e){var rt="B("+(M+1)+","+(k+1)+")=";M!=k&&(rt+="B("+(k+1)+","+(M+1)+")="),K=f(K=c[p(M,k,S)]/l(c[p(M,M,S)]*c[p(k,k,S)])),rt+=" "+r[p(M,k,S)]+"; r="+K.substring(K.length-7,K.length),console.log(rt)}for(T=0;T<8;T++)z.params[T]={val:n[T],err:i[T],pval:h(u(n[T]/i[T],C))};return z.rms=et,z.cov=r,z}return r.run=function(t,r,a,o,s,l,c){function u(e){for(var r=[],n=0;n<t.length;++n)r[n]=s(t[n],e);return r}l||(l=20),c||(c=1e-4);for(var f,h,p,d,m,g,v=0,y=function(t,e,r){for(var n=[],i=0;i<t.length;i++)n[i]=r?[t[i],e[i],r[i]]:[t[i],e[i]];return n}(t,r,a),x=u(o);v<l;){if(p=u(d=(m=i({data:y,params:o,npar:o.length,errorform:a.length?"w":"",func:s,cov:g})).params.slice(0,o.length).map((function(t){return t.val}))),f=m.rms,0===v&&(h=f+c+1),e&&console.log("NEWFITTER params = "+d+"\n oldparams = "+o+"\nrms = "+m.rms+" prms = "+h),d.filter(n).length!==d.length){console.log("oops, non-numeric parameter... stopping."),d=o;break}if(o=d,g=m.cov,x=p,Math.abs(f-h)<c)break;v++,h=f}return{fit:x,rms:f,err:m.params.slice(0,o.length).map((function(t){return t.err})),params:o,iterations:v}},r}},{"fast-isnumeric":214}],7:[function(t,e,r){e.exports=function(t,e,r){function n(t,e){this.x=t,this.y=e}function i(t,e,r,n){for(var i=r+1;i<n;i++)t[e][i]/=t[e][r];t[e][r]=1}function a(t,e,r,n,i){for(var a=0;a<n;a++)if(a!=e&&0!=t[a][r]){for(var o=r+1;o<i;o++)t[a][o]-=t[a][r]*t[e][o];t[a][r]=0}}function o(t,e){e+=1;var r,n,o,s,l,c,u,f=t.length,h=2*e-1,p=Array();for(r=0;r<e;r++){u=Array();for(var d=0;d<=e;d++)u[d]=0;p[r]=u}var m=Array();for(r=0;r<h;r++)m[r]=0;for(m[0]=f,r=0;r<t.length;r++){for(n=t[r],l=1;l<h;l++)m[l]+=Math.pow(n.x,l);for(p[0][e]+=n.y,l=1;l<e;l++)p[l][e]+=Math.pow(n.x,l)*n.y}for(l=0;l<e;l++)for(c=0;c<e;c++)p[l][c]=m[l+c];for(function(t){for(var e,r,n=t.length,o=t[0].length,s=0,l=0;s<n&&l<o;){for(e=s;e<n&&0==t[e][l];)e++;e<n&&(e!=s&&(r=t[s],t[s]=t[e],t[e]=r),1!=t[s][l]&&i(t,s,l,o),a(t,s,l,n,o),s++),l++}}(p),o=Array(),r=0;r<p.length;r++)s=p[r],o[r]=s[e];return o}var s,l;n.prototype.toString=function(){return this.x+","+this.y},Array.isArray(r)?(l=r.length-1,s=r):(l=r,s=["a","b","c","d","e","f","g","h","i"]);for(var c=function(t,e,r){for(var i=[],a=0;a<t.length;a++){var s=t[a],l=e[a];"string"==typeof s&&(s=Number(s.replace(/[^0-9.-]/g,""))),"string"==typeof l&&(l=Number(l.replace(/[^0-9.-]/g,""))),i[a]=new n(s,l)}return o(i,r)}(t,e,l),u={err:"",params:{}},f=0;f<=l;f++)u.params[s[f]]=c[f];return u}},{}],8:[function(t,e,r){"use strict";var n=t("./autoGuess"),i=t("./polySolver"),a=t("../transformUtils").find,o=t("../math"),s=[{libname:"Linear",variants:[{name:"Linear",func:"m*x + b",info:"",autoguess:function(t,e){return i(t,e,["b","m"])}}]},{libname:"Quadratic",variants:[{name:"Quadratic",func:"a*x^2 + b*x + c",info:"",autoguess:function(t,e){return i(t,e,["c","b","a"])}}]},{libname:"Polynomial",variants:[{name:"1st order",func:"a + b*x",info:"",autoguess:function(t,e){return i(t,e,1)}},{name:"2nd order",func:"a + b*x + c*x^2",info:"",autoguess:function(t,e){return i(t,e,2)}},{name:"3rd order",func:"a + b*x + c*x^2 + d*x^3",info:"",autoguess:function(t,e){return i(t,e,3)}},{name:"4th order",func:"a + b*x + c*x^2 + d*x^3 + e*x^4",info:"",autoguess:function(t,e){return i(t,e,4)}},{name:"5th order",func:"a + b*x + c*x^2 + d*x^3 + e*x^4 + f*x^5",info:"",autoguess:function(t,e){return i(t,e,5)}},{name:"6th order",func:"a + b*x + c*x^2 + d*x^3 + e*x^4 + f*x^5 + g*x^6",info:"",autoguess:function(t,e){return i(t,e,6)}}]},{libname:"Exponential",variants:[{name:"Exponential",func:"a + b*exp(c*x)",info:"",autoguess:n.exponential}]},{libname:"Peak",variants:[{name:"Gaussian",func:"a + h*exp( -(x-x0)^2/(2*w^2) )",info:"",autoguess:n.gauss},{name:"Gaussian FWHM",func:"a + h*exp( -4*log(2)*((x-x0)/FWHM)^2 )",info:"",autoguess:n.peak},{name:"Cauchy-Lorentz",func:"a + h/(1 + 4*((x-x0)/FWHM)^2)",info:"",autoguess:n.peak}]},{libname:"Inverse",variants:[{name:"y0 + a/x",func:"y0 + a/x",info:"",autoguess:n.inverseSimple},{name:"y0 + a/(x-x0)",func:"y0 + a/(x-x0)",info:"",autoguess:n.inverse}]},{libname:"Inverse squared",variants:[{name:"y0 + a/x<sup>2</sup>",func:"y0 + a/x^2",info:"",autoguess:n.inverseSimple2},{name:"y0 + a/(x-x0)<sup>2</sup>",func:"y0 + a/(x-x0)^2",info:"",autoguess:n.inverse2}]}];function l(t,e){return a((function(e){return e.func===t}),e.variants,null)}function c(t,e){return a((function(e){return Boolean(l(t,e))}),s,e)}e.exports={predefinedFunctions:s,findVariantByFunction:function(t){var e=c(t,null);return e?l(t,e):null},findFamilyByFunction:c,findFamilyByFamilyName:function(t){return a((function(e){return e.libname===t}),s,"")},extractParameterNames:function(t){return function(t){return o.parse(t).filter((function(t){return t.isSymbolNode})).map((function(t){return t.name}))}(t).filter((function(t){return"x"!==t}))}}},{"../math":11,"../transformUtils":15,"./autoGuess":4,"./polySolver":7}],9:[function(t,e,r){"use strict";e.exports=function(t){var e,r={modeBarButtonsToRemove:["sendDataToCloud"],queueLength:100,workspace:!1};return"USE_CONTENT_DELIVERY_NETWORKS"in(t=t||{})&&!t.USE_CONTENT_DELIVERY_NETWORKS&&(t.DEBUG_MODE||"on_prem"===t.PLOTLY_ENV?e="/static/":t.DOMAIN_WEBAPP&&(e="//"+t.DOMAIN_WEBAPP+"/static/"),e?r.topojsonURL=e+"plotlyjs/build/topojson/":console.warn("Missing environment variable to setup non-CDN topojson URL")),r}},{}],10:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("plotly.js/src/lib");i.addStyleRule=function(t,e){if(!i.styleSheet){var r=document.createElement("style");r.appendChild(document.createTextNode("")),document.head.appendChild(r),i.styleSheet=r.sheet}var n=i.styleSheet;n.insertRule?n.insertRule(t+"{"+e+"}",0):n.addRule?n.addRule(t,e,0):i.warn("addStyleRule failed")},i.transformUtils=t("./transformUtils"),i.isNumeric=n,i.fitUtils={},i.extendFlat(i.fitUtils,t("./fits/predefinedFunctions")),i.math=t("./math"),e.exports=i},{"./fits/predefinedFunctions":8,"./math":11,"./transformUtils":15,"fast-isnumeric":214,"plotly.js/src/lib":861}],11:[function(t,e,r){var n=t("mathjs/core").create();n.import(t("mathjs/lib/type/complex")),n.import(t("mathjs/lib/type/bignumber")),n.import(t("mathjs/lib/function/arithmetic")),n.import(t("mathjs/lib/constants")),n.import(t("mathjs/lib/expression/function/compile")),n.import(t("mathjs/lib/expression/function/eval")),n.import(t("mathjs/lib/expression/function/parse")),n.import(t("mathjs/lib/expression/function/parser")),n.import(t("mathjs/lib/expression/node")),n.import(t("mathjs/lib/expression/transform")),n.import(t("mathjs/lib/expression/parse")),n.import(t("mathjs/lib/function/trigonometry")),e.exports=n},{"mathjs/core":440,"mathjs/lib/constants":441,"mathjs/lib/expression/function/compile":450,"mathjs/lib/expression/function/eval":451,"mathjs/lib/expression/function/parse":452,"mathjs/lib/expression/function/parser":453,"mathjs/lib/expression/node":472,"mathjs/lib/expression/parse":477,"mathjs/lib/expression/transform":482,"mathjs/lib/function/arithmetic":507,"mathjs/lib/function/trigonometry":559,"mathjs/lib/type/bignumber":570,"mathjs/lib/type/complex":573}],12:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("./transformUtils").getWindow;e.exports=function(t,e,r){var a,o;if(t.length!==e.length)throw new Error("x and y must be equal length arrays");if(!n(r.windowlength))throw new Error("window length must be specified");if(r.windowlength>t.length||r.windowlength<1)return{x:[],y:[]};var s=r.windowlength,l=Boolean(r.center),c=r.windowtype||"boxcar",u=i(c,s),f=u.reduce((function(t,e){return t+e}),0),h=l?Math.floor(s/2):s-1,p=l?s-h-1:0,d=t.slice(h,t.length-p),m=new Array(d.length),g=0;for(a=0;a<m.length;a++){var v=0;for(o=0;o<s;o++)v+=e[a+o]*u[o];m[g]=v/f,g++}return{x:d,y:m}}},{"./transformUtils":15,"fast-isnumeric":214}],13:[function(t,e,r){"use strict";var n=t("plotly.js/src/plots/cartesian/constants").BADNUM,i=t("../plotly"),a=t("./movingAverage"),o=t("plotly.js/src/plots/attributes"),s=t("plotly.js/src/traces/scatter/attributes"),l=t("./transformUtils"),c=l.computeCalcData,u=i.Lib.extendDeepNoArrays,f=l.fill,h=i.Lib.isPlainObject,p=l.stripValueAcrossRows,d={MOVING_AVERAGE:"moving-average",AVERAGE:"average"},m=Object.keys(d).map((function(t){return d[t]}));function g(t){if(this.moduleType="transform",this.makesData=!0,-1===m.indexOf(t)){var e=JSON.stringify(m);throw new Error("MovingAverageTransform supports "+e+" "+t+" not recognized")}this.name=t,this.attributes={type:{valType:"string",role:"info",editType:"calc"},center:{valType:"boolean",role:"info",dflt:!0,editType:"calc"},inputUid:{valType:"string",role:"info",editType:"calc"},range:{valType:"data_array",dflt:[],editType:"calc"},skipmissing:{valType:"boolean",editType:"calc"},windowlength:{valType:"integer",role:"info",min:1,dflt:5,editType:"calc"},windowtype:{valType:"enumerated",role:"info",values:["boxcar","triangle"],dflt:"boxcar",editType:"calc"},editType:"calc"}}e.exports=g,g.prototype.supplyDefaults=function(t){var e={},r=this.attributes,n=function(n,a){return i.Lib.coerce(t,e,r,n,a)};return n("inputUid"),this.name===d.MOVING_AVERAGE&&(n("range"),n("windowlength"),n("windowtype"),n("center")),this.name===d.AVERAGE&&n("skipmissing",!0),e},g.prototype.transform=function(t,e){var r=e.transform,l=e.fullTrace,m=l._input,g=e.fullData.find((function(t){return t._input.uid===r.inputUid}));if(!g)throw new Error("Cannot find parent trace of "+this.name+" in state.fullData");if(!Array.isArray(g.x)||!Array.isArray(g.y))throw new Error("movingAverageTransform only supports traces with x and y arrays");var v,y,x,b=g.x,_=g.y,w=c(_).calcData;if(r.skipmissing){var T=p(n,b,w);v=T[0],y=T[1]}else v=b,y=w;this.name===d.MOVING_AVERAGE?x=a(v,y,{windowlength:r.windowlength,center:r.center,windowtype:r.windowtype}):((x=a(v,y,{windowlength:v.length,windowtype:"boxcar"})).x=v,x.y=f(x.y[0],v.length));var M,k=u({},m),A=i.Lib.coerce.bind(i.Lib,m,k);return h(g.marker)?M=g.marker.color:h(g.line)&&(M=g.line.color),A(o,"type","scatter"),A(o,"name","Moving average of "+g.name),A(o,"opacity",.5),A(s,"mode","lines"),Array.isArray(M)||A(s,"line.color",M),A(s,"line.width",4),k.x=x.x,k.y=x.y,k.transforms=l.transforms,[k]}},{"../plotly":16,"./movingAverage":12,"./transformUtils":15,"plotly.js/src/plots/attributes":907,"plotly.js/src/plots/cartesian/constants":917,"plotly.js/src/traces/scatter/attributes":1270}],14:[function(t,e,r){"use strict";var n=t("plotly.js/src/lib"),i=t("plotly.js/src/components/sliders/defaults"),a=t("fast-isnumeric");r.moduleType="transform",r.name="populate-slider";function o(t,e,r,i){var o,s,l=Object.keys(i),c={};for(o=0;o<l.length;o++)s=i[l[o]],c=n.extendDeep(c,s.animationopts);for(Array.isArray(e.steps)?e.steps.length=0:e.steps=[],o=0;o<r.length;o++){var u=r[o],f="slider-"+t+"-"+u;e.steps[o]={label:u,value:u,args:[[f],c],method:"animate"}}var h=e.active;a(h)&&h>e.steps.length-1&&(e.active=e.steps.length-1)}function s(t,e){var r,n,i=Object.keys(e);for(r=0;r<i.length;r++)if(n=e[i[r]].framegroup)return n;return"populate-slider-group-"+t}function l(t,e,r,n,i,a){var o,s,l,c,f,h,p,d=Object.keys(n),m={},g=i._frames,v=[];for(o=0;o<g.length;o++)null!==g[o]&&g[o].group!==e||v.push(o);for(o=0;o<r.length;o++)for(l=r[o],c={name:"slider-"+t+"-"+r[o],group:e},void 0===(f=v[o])&&(f=g.length),m[l]=f,g[f]=c,c.data||(c.data=[]),c.traces||(c.traces=[]),s=0;s<d.length;s++)h=n[d[s]],c.traces[s]=parseInt(d[s]),p=u(a[c.traces[s]]._input.transforms,"filterId",h.pairedfilterid),c.data[s]={},c.data[s]["transforms["+p+"].value"]=l;for(o=r.length;o<v.length;o++)g[v[o]]=null;!function(t){for(var e,r=t._frames,n=t._frameHash={},i=0;i<r.length;i++)(e=r[i])&&e.name&&(n[e.name]=e)}(i)}function c(t,e){var r,n,i=e.active;if(a(i)){var o=e.steps[i].value;for(var s in t){if(!(n=t[s]).enabled)return;if(!(r=n._filterTransform).enabled)return;r.value=o}}}function u(t,e,r){for(var n=0;n<t.length;n++)if(t[n][e]===r)return n;return-1}r.attributes={pairedfilterid:{valType:"string",role:"info",description:"Id of the filter transform.",editType:"calc"},sliderid:{valType:"string",role:"info",description:"Id of the slider.",dflt:"__sldr__",editType:"calc"},framegroup:{valType:"string",role:"info",description:"A group name for the generated set of frames",editType:"calc"},enabled:{valType:"boolean",role:"info",dflt:!0,description:"Whether the transform is ignored or not.",editType:"calc"},animationopts:{valType:"any",role:"info",editType:"calc"},editType:"calc"},r.supplyDefaults=function(t){var e={};function i(i,a){return n.coerce(t,e,r.attributes,i,a)}if(i("enabled")){if(i("sliderid","__sldr__"),!t.pairedfilterid)throw new Error("must supply pairedfilterid");i("pairedfilterid"),i("framegroup"),i("animationopts")}return e},r.transform=function(t){return t},r.supplyLayoutDefaults=function(t,e,n,a){var f,h,p,d,m,g,v,y,x=function(t){var e,n,i,a,o,s,l,c,f,h,p={},d={};for(e=0;e<t.length;e++)if((a=t[e])&&a.visible&&(o=t[e].transforms)){for(i=o.length,n=0;n<i&&(s=o[n]).type!==r.name;n++);if(n!==i&&s.enabled&&(f=s.sliderid,h=s.pairedfilterid,(l=o[u(a._input.transforms,"filterId",h)]).enabled&&Array.isArray(c=l.target)))for(s._filterTransform=l,d[f]||(d[f]={}),d[f][a.index]=s,p[f]||(p[f]={}),n=0;n<c.length;n++)p[f][c[n]]=!0}return{bySlider:p,transformsByTrace:d}}(n),b=Object.keys(x.bySlider);if(!b.length)return t;for(f=t.sliders=t.sliders||[],h=0;h<b.length;h++)d=b[h],g=-1===(m=u(t.sliders,"sliderid",d))?f[f.length]={sliderid:d,currentvalue:{visible:!1},pad:{t:60}}:f[m],v=x.transformsByTrace[d],p=Object.keys(x.bySlider[d]),y=s(d,v),o(d,g,p,v),l(d,y,p,v,a,n),c(v,g);return i(t,e),t}},{"fast-isnumeric":214,"plotly.js/src/components/sliders/defaults":818,"plotly.js/src/lib":861}],15:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../plotly"),a={H:["%H:%M:%S~%L","%H:%M:%S","%H:%M"],I:["%I:%M:%S~%L%p","%I:%M:%S%p","%I:%M%p"],D:["%H","%I%p","%Hh"]},o={Y:["%Y~%m~%d","%Y%m%d","%y%m%d","%m~%d~%Y","%d~%m~%Y"],Yb:["%b~%d~%Y","%d~%b~%Y","%Y~%d~%b","%Y~%b~%d"],y:["%m~%d~%y","%d~%m~%y","%y~%m~%d"],yb:["%b~%d~%y","%d~%b~%y","%y~%d~%b","%y~%b~%d"]},s=i.d3.time.format.utc,l={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(s),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(s)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(s)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach((function(t){o[t].forEach((function(e){l[t].D.push(s(e)),["H","I","D"].forEach((function(r){a[r].forEach((function(n){var i=l[t][r];i.push(s(e+"~"+n)),i.push(s(n+"~"+e))}))}))}))}));var c=/[a-z]*/g,u=function(t){return t.substr(0,3)},f=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,h=/[\s,\/\-\.\(\)]+/g,p=/~?([ap])~?m(~|$)/,d=function(t,e){return e+"m "},m=/\d\d\d\d/,g=/(^|~)[a-z]{3}/,v=/[ap]m/,y=/:/,x=/q([1-4])/,b=["31~mar","30~jun","30~sep","31~dec"],_=function(t,e){return b[e-1]},w=/ ?([+\-]\d\d:?\d\d|Z)$/;var T=e.exports={parseDate:function(t,e){if(t&&t.getTime)return t;if(e&&"string"==typeof e&&"gregorian"!==e)return new Date(i.Lib.dateTime2ms(t,e));if("string"!=typeof t)return!1;var r,n,a=null,o=function(t){var e;return e=m.test(t)?"Y":"y",e+=g.test(t)?"b":""}(t=t.toLowerCase().replace(c,u).replace(f,"").replace(h,"~").replace(p,d).replace(x,_).trim().replace(w,"")),s=function(t){return y.test(t)?v.test(t)?"I":"H":"D"}(t);n=(r=l[o][s]).length;for(var b=0;b<n&&!(a=r[b].parse(t));b++);return a instanceof Date&&a},getColAxes:function(t,e){var r={calendar:e};return r.type=i.Axes.autoType(t,e),i.Axes.setConvert(r),r},computeCalcData:function(t,e){var r=T.getColAxes(t,e);r._categories=[];for(var n=[],i=0;i<t.length;i++)n[i]=r.d2c(t[i]);return{calcData:n,axes:r}},findInsertionIndex:function(t,e){var r=0,n=t.length;if(e<t[0])return r;if(e>t[n-1])return n;for(var i=-1;r<n;)if(t[i=Math.floor((r+n)/2)]<e)r=i+1;else{if(!(t[i]>e))return i;n=i}return r},stripValueAcrossRows:function(t){var e,r,n=[].slice.call(arguments),i=n.slice(1),a=Math.min.apply(Math,i.map((function(t){return t.length}))),o=i.map((function(){return[]})),s=0;t:for(e=0;e<a;e++){for(r=0;r<i.length;r++)if(i[r][e]===t)continue t;for(r=0;r<i.length;r++)o[r][s]=i[r][e];s++}return o},sortArraysByFirstArray:function(){var t,e,r=[].slice.call(arguments),n=Math.min.apply(Math,r.map((function(t){return t.length}))),i=[];for(t=0;t<n;t++)for(i[t]=[],e=0;e<r.length;e++)i[t][e]=r[e][t];for(i.sort((function(t,e){return t[0]-e[0]})),t=0;t<i.length;t++)for(e=0;e<r.length;e++)r[e][t]=i[t][e]},calcRange:function(t,e,r){e||(e=[]);var i=e.map((function(t){var e=T.parseDate(t,r);return!1===e?t:e.getTime()}));return i=i.map(T.cleanNumber),n(i[0])||(i[0]=T.min(t)),n(i[1])||(i[1]=T.max(t)),i[0]>i[1]&&(i=[i[1],i[0]]),i},cleanNumber:function(t){if(null===t||"undefined"==typeof t||!1===t)return"";if(n(t))return Number(t);var e=t.toString().replace(/[^0-9.-]/g,"");return n(e)?Number(e):""},min:function(t){for(var e=t[0],r=1;r<t.length;r++)e>t[r]&&(e=t[r]);return e},max:function(t){for(var e=t[0],r=1;r<t.length;r++)e<t[r]&&(e=t[r]);return e},getWindow:function(t,e){var r,n=new Array(e);if("triangle"===t){var i=Math.floor(e/2);for(r=0;r<=e-1;r++)n[r]=i-Math.abs(i-r)+1}else{if("boxcar"!==t)throw new Error("getWindow: unrecognized windowtype "+t);for(r=0;r<e;r++)n[r]=1}return n},fill:function(t,e){for(var r=new Array(e),n=0;n<e;n++)r[n]=t;return r},find:function(t,e,r){if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var n,i=e.length>>>0,a=0;a<i;a++)if(t(n=e[a],a,e))return n;return r},computeCorrelation:function(t,e){var r,n=[],i=[],a=[];for(r=0;r<t.length;r++)n[r]=t[r]*e[r],i[r]=t[r]*t[r],a[r]=e[r]*e[r];var o=0,s=0,l=0,c=0,u=0;for(r=0;r<t.length;r++)o+=t[r],s+=e[r],l+=n[r],c+=i[r],u+=a[r];var f=t.length*l-o*s,h=t.length*c-o*o,p=t.length*u-s*s;return f/Math.sqrt(h*p)}}},{"../plotly":16,"fast-isnumeric":214}],16:[function(t,e,r){"use strict";var n=e.exports=t("plotly.js");n.calendarSchema=t("plotly.js/src/components/calendars").schema.traces,n.Lib=t("./addons/lib"),n.util=t("plotly.js/src/lib/svg_text_utils"),n.Plots=t("plotly.js/src/plots/plots"),n.Axes=t("./addons/axes"),n.Gl3dLayout=t("plotly.js/src/plots/gl3d"),n.GeoLayout=t("plotly.js/src/plots/geo"),n.Color=t("plotly.js/src/components/color"),n.Colorscale=t("plotly.js/src/components/colorscale"),n.Drawing=t("plotly.js/src/components/drawing"),n.ErrorBars=t("plotly.js/src/components/errorbars"),n.Annotations=t("./addons/annotations"),n.Legend=t("plotly.js/src/components/legend"),n.Scatter3D=t("plotly.js/src/traces/scatter3d"),n.Plots._supplyDefaults=function(t){t._context||(t._context={}),t._context.locale||(t._context.locale="en"),t._context.locales||(t._context.locales={}),n.Plots.supplyDefaults(t)},n.Axes._listIds=function(t,e){return n.Plots._supplyDefaults(t),n.Axes.listIds(t,e)||[]};var i,a=t("./addons/movingAverageTransform"),o=t("./addons/breakpoints"),s=t("./addons/fits/fitTransform"),l=t("./addons/populateSliderTransform");if(n.register([o,l,new a("moving-average"),new a("average"),new s]),n.Breakpoints=o,n.getStreambedPlotConfig=t("./addons/get-streambed-plot-config"),n.setPlotConfig(n.getStreambedPlotConfig(window.ENV)),window.ENV)i=window.ENV.CUSTOM_STYLE;else if(window.process&&window.process.env&&window.process.__node_webkit)i=window.process.env.PLOTLY_CUSTOM_STYLE;else try{i=window.require("electron").remote.process.env.PLOTLY_CUSTOM_STYLE}catch(t){}switch(i){case"open-office-2015":t("./styles/open_office_2015")();break;case"chromite":t("./styles/chromite")();break;case"astrophyllite":t("./styles/astrophyllite")();break;case"seifertite":t("./styles/seifertite")()}},{"./addons/annotations":1,"./addons/axes":2,"./addons/breakpoints":3,"./addons/fits/fitTransform":5,"./addons/get-streambed-plot-config":9,"./addons/lib":10,"./addons/movingAverageTransform":13,"./addons/populateSliderTransform":14,"./styles/astrophyllite":17,"./styles/chromite":18,"./styles/open_office_2015":19,"./styles/seifertite":20,"plotly.js":675,"plotly.js/src/components/calendars":724,"plotly.js/src/components/color":726,"plotly.js/src/components/colorscale":738,"plotly.js/src/components/drawing":748,"plotly.js/src/components/errorbars":754,"plotly.js/src/components/legend":783,"plotly.js/src/lib/svg_text_utils":886,"plotly.js/src/plots/geo":943,"plotly.js/src/plots/gl3d":953,"plotly.js/src/plots/plots":974,"plotly.js/src/traces/scatter3d":1303}],17:[function(t,e,r){"use strict";var n=t("../plotly");n.Color.addOpacity;e.exports=function(){n.Plots.layoutAttributes.colorway.dflt=["rgb(0,77,113)","rgb(86,90,92)","rgba(86,90,92,0.3)","rgb(0,179,227)","rgb(168,180,0)"],n.Plots.layoutAttributes.font.family.dflt='"Roboto", verdana, arial, sans-serif'}},{"../plotly":16}],18:[function(t,e,r){"use strict";var n=t("../plotly");e.exports=function(){n.Plots.layoutAttributes.colorway.dflt=["#ff6a00","#00B67D","#FA4092","#FFC000","#aaa293","#ffa666","#fb8cbe","#66d3b0","#ffd966","#ccc7be"],n.Plots.layoutAttributes.font.family.dflt='"Arial", arial, sans-serif',n.Color.defaultLine="#444",n.Plots.layoutAttributes.font.color.dflt="#464646",n.Plots.layoutAttributes.title.font.color.dflt="#464646",n.Plots.layoutAttributes.paper_bgcolor.dflt="#ffffff",n.Plots.layoutAttributes.plot_bgcolor.dflt="#ffffff",n.Axes.layoutAttributes.color.dflt="#f7f4ef"}},{"../plotly":16}],19:[function(t,e,r){"use strict";var n=t("../plotly");e.exports=function(){n.Plots.layoutAttributes.colorway.dflt=["#CC0000","#5E6A71","#BBDDE7","#55aab2","#a4b0b7"],n.Plots.layoutAttributes.font.family.dflt='"Overpass", verdana, arial, sans-serif',n.Plots.fontWeight=900}},{"../plotly":16}],20:[function(t,e,r){"use strict";var n=t("../plotly");e.exports=function(){n.Plots.layoutAttributes.colorway.dflt=["#3d7dba","#784139","#c39709","#518000","#827ac9","#aba091","#516e5c","#6291a6","#a64a36"],n.Plots.layoutAttributes.font.size.dflt=14}},{"../plotly":16}],21:[function(t,e,r){"use strict";e.exports=function(t){var e=(t=t||{}).eye||[0,0,1],r=t.center||[0,0,0],s=t.up||[0,1,0],l=t.distanceLimits||[0,1/0],c=t.mode||"turntable",u=n(),f=i(),h=a();return u.setDistanceLimits(l[0],l[1]),u.lookAt(0,e,r,s),f.setDistanceLimits(l[0],l[1]),f.lookAt(0,e,r,s),h.setDistanceLimits(l[0],l[1]),h.lookAt(0,e,r,s),new o({turntable:u,orbit:f,matrix:h},c)};var n=t("turntable-camera-controller"),i=t("orbit-camera-controller"),a=t("matrix-camera-controller");function o(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}var s=o.prototype;[["flush",1],["idle",1],["lookAt",4],["rotate",4],["pan",4],["translate",4],["setMatrix",2],["setDistanceLimits",2],["setDistance",2]].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()+")}";s[e]=Function.apply(null,r.concat(i))})),s.recalcMatrix=function(t){this._active.recalcMatrix(t)},s.getDistance=function(t){return this._active.getDistance(t)},s.getDistanceLimits=function(t){return this._active.getDistanceLimits(t)},s.lastT=function(){return this._active.lastT()},s.setMode=function(t){if(t!==this._mode){var e=this._controllerNames.indexOf(t);if(!(e<0)){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}}},s.getMode=function(){return this._mode}},{"matrix-camera-controller":615,"orbit-camera-controller":636,"turntable-camera-controller":1516}],22:[function(t,e,r){!function(n,i){"object"==typeof r&&"undefined"!=typeof e?i(r,t("d3-array"),t("d3-collection"),t("d3-shape"),t("elementary-circuits-directed-graph")):i(n.d3=n.d3||{},n.d3,n.d3,n.d3,null)}(this,(function(t,e,r,n,i){"use strict";function a(t){return t.target.depth}function o(t,e){return t.sourceLinks.length?t.depth:e-1}function s(t){return function(){return t}}i=i&&i.hasOwnProperty("default")?i.default:i;var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function c(t,e){return f(t.source,e.source)||t.index-e.index}function u(t,e){return f(t.target,e.target)||t.index-e.index}function f(t,e){return t.partOfCycle===e.partOfCycle?t.y0-e.y0:"top"===t.circularLinkType||"bottom"===e.circularLinkType?-1:1}function h(t){return t.value}function p(t){return(t.y0+t.y1)/2}function d(t){return p(t.source)}function m(t){return p(t.target)}function g(t){return t.index}function v(t){return t.nodes}function y(t){return t.links}function x(t,e){var r=t.get(e);if(!r)throw new Error("missing: "+e);return r}function b(t,e){return e(t)}function _(t,e,r){var n=0;if(null===r){for(var a=[],o=0;o<t.links.length;o++){var s=t.links[o],l=s.source.index,c=s.target.index;a[l]||(a[l]=[]),a[c]||(a[c]=[]),-1===a[l].indexOf(c)&&a[l].push(c)}var u=i(a);u.sort((function(t,e){return t.length-e.length}));var f={};for(o=0;o<u.length;o++){var h=u[o].slice(-2);f[h[0]]||(f[h[0]]={}),f[h[0]][h[1]]=!0}t.links.forEach((function(t){var e=t.target.index,r=t.source.index;e===r||f[r]&&f[r][e]?(t.circular=!0,t.circularLinkID=n,n+=1):t.circular=!1}))}else t.links.forEach((function(t){t.source[r]<t.target[r]?t.circular=!1:(t.circular=!0,t.circularLinkID=n,n+=1)}))}function w(t,e){var r=0,n=0;t.links.forEach((function(i){i.circular&&(i.source.circularLinkType||i.target.circularLinkType?i.circularLinkType=i.source.circularLinkType?i.source.circularLinkType:i.target.circularLinkType:i.circularLinkType=r<n?"top":"bottom","top"==i.circularLinkType?r+=1:n+=1,t.nodes.forEach((function(t){b(t,e)!=b(i.source,e)&&b(t,e)!=b(i.target,e)||(t.circularLinkType=i.circularLinkType)})))})),t.links.forEach((function(t){t.circular&&(t.source.circularLinkType==t.target.circularLinkType&&(t.circularLinkType=t.source.circularLinkType),H(t,e)&&(t.circularLinkType=t.source.circularLinkType))}))}function T(t){var e=Math.abs(t.y1-t.y0),r=Math.abs(t.target.x0-t.source.x1);return Math.atan(r/e)}function M(t,e){var r=0;t.sourceLinks.forEach((function(t){r=t.circular&&!H(t,e)?r+1:r}));var n=0;return t.targetLinks.forEach((function(t){n=t.circular&&!H(t,e)?n+1:n})),r+n}function k(t){var e=t.source.sourceLinks,r=0;e.forEach((function(t){r=t.circular?r+1:r}));var n=t.target.targetLinks,i=0;return n.forEach((function(t){i=t.circular?i+1:i})),!(r>1||i>1)}function A(t,e,r){return t.sort(E),t.forEach((function(n,i){var a,o,s=0;if(H(n,r)&&k(n))n.circularPathData.verticalBuffer=s+n.width/2;else{for(var l=0;l<i;l++)if(a=t[i],o=t[l],!(a.source.column<o.target.column||a.target.column>o.source.column)){var c=t[l].circularPathData.verticalBuffer+t[l].width/2+e;s=c>s?c:s}n.circularPathData.verticalBuffer=s+n.width/2}})),t}function S(t,r,i,a){var o=e.min(t.links,(function(t){return t.source.y0}));t.links.forEach((function(t){t.circular&&(t.circularPathData={})})),A(t.links.filter((function(t){return"top"==t.circularLinkType})),r,a),A(t.links.filter((function(t){return"bottom"==t.circularLinkType})),r,a),t.links.forEach((function(e){if(e.circular){if(e.circularPathData.arcRadius=e.width+10,e.circularPathData.leftNodeBuffer=5,e.circularPathData.rightNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,H(e,a)&&k(e))e.circularPathData.leftSmallArcRadius=10+e.width/2,e.circularPathData.leftLargeArcRadius=10+e.width/2,e.circularPathData.rightSmallArcRadius=10+e.width/2,e.circularPathData.rightLargeArcRadius=10+e.width/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+25+e.circularPathData.verticalBuffer,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-25-e.circularPathData.verticalBuffer,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius);else{var s=e.source.column,l=e.circularLinkType,c=t.links.filter((function(t){return t.source.column==s&&t.circularLinkType==l}));"bottom"==e.circularLinkType?c.sort(L):c.sort(C);var u=0;c.forEach((function(t,n){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=10+e.width/2+u,e.circularPathData.leftLargeArcRadius=10+e.width/2+n*r+u),u+=t.width})),s=e.target.column,c=t.links.filter((function(t){return t.target.column==s&&t.circularLinkType==l})),"bottom"==e.circularLinkType?c.sort(I):c.sort(P),u=0,c.forEach((function(t,n){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=10+e.width/2+u,e.circularPathData.rightLargeArcRadius=10+e.width/2+n*r+u),u+=t.width})),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i,e.source.y1,e.target.y1)+25+e.circularPathData.verticalBuffer,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius):(e.circularPathData.verticalFullExtent=o-25-e.circularPathData.verticalBuffer,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius)}e.circularPathData.leftInnerExtent=e.circularPathData.sourceX+e.circularPathData.leftNodeBuffer,e.circularPathData.rightInnerExtent=e.circularPathData.targetX-e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.sourceX+e.circularPathData.leftLargeArcRadius+e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.targetX-e.circularPathData.rightLargeArcRadius-e.circularPathData.rightNodeBuffer}if(e.circular)e.path=function(t){var e="";e="top"==t.circularLinkType?"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 0 "+t.circularPathData.leftFullExtent+" "+(t.circularPathData.sourceY-t.circularPathData.leftSmallArcRadius)+" L"+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 0 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 0 "+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" L"+t.circularPathData.rightFullExtent+" "+(t.circularPathData.targetY-t.circularPathData.rightSmallArcRadius)+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 0 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY:"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 1 "+t.circularPathData.leftFullExtent+" "+(t.circularPathData.sourceY+t.circularPathData.leftSmallArcRadius)+" L"+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 1 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 1 "+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" L"+t.circularPathData.rightFullExtent+" "+(t.circularPathData.targetY+t.circularPathData.rightSmallArcRadius)+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 1 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY;return e}(e);else{var f=n.linkHorizontal().source((function(t){return[t.source.x0+(t.source.x1-t.source.x0),t.y0]})).target((function(t){return[t.target.x0,t.y1]}));e.path=f(e)}}))}function E(t,e){return O(t)==O(e)?"bottom"==t.circularLinkType?L(t,e):C(t,e):O(e)-O(t)}function C(t,e){return t.y0-e.y0}function L(t,e){return e.y0-t.y0}function P(t,e){return t.y1-e.y1}function I(t,e){return e.y1-t.y1}function O(t){return t.target.column-t.source.column}function z(t){return t.target.x0-t.source.x1}function D(t,e){var r=T(t),n=z(e)/Math.tan(r);return"up"==q(t)?t.y1+n:t.y1-n}function N(t,e){var r=T(t),n=z(e)/Math.tan(r);return"up"==q(t)?t.y1-n:t.y1+n}function R(t,e,r,n){t.links.forEach((function(i){if(!i.circular&&i.target.column-i.source.column>1){var a=i.source.column+1,o=i.target.column-1,s=1,l=o-a+1;for(s=1;a<=o;a++,s++)t.nodes.forEach((function(o){if(o.column==a){var c,u=s/(l+1),f=Math.pow(1-u,3),h=3*u*Math.pow(1-u,2),p=3*Math.pow(u,2)*(1-u),d=Math.pow(u,3),m=f*i.y0+h*i.y0+p*i.y1+d*i.y1,g=m-i.width/2,v=m+i.width/2;g>o.y0&&g<o.y1?(c=o.y1-g+10,c="bottom"==o.circularLinkType?c:-c,o=B(o,c,e,r),t.nodes.forEach((function(t){b(t,n)!=b(o,n)&&t.column==o.column&&F(o,t)&&B(t,c,e,r)}))):(v>o.y0&&v<o.y1||g<o.y0&&v>o.y1)&&(c=v-o.y0+10,o=B(o,c,e,r),t.nodes.forEach((function(t){b(t,n)!=b(o,n)&&t.column==o.column&&t.y0<o.y1&&t.y1>o.y1&&B(t,c,e,r)})))}}))}}))}function F(t,e){return t.y0>e.y0&&t.y0<e.y1||(t.y1>e.y0&&t.y1<e.y1||t.y0<e.y0&&t.y1>e.y1)}function B(t,e,r,n){return t.y0+e>=r&&t.y1+e<=n&&(t.y0=t.y0+e,t.y1=t.y1+e,t.targetLinks.forEach((function(t){t.y1=t.y1+e})),t.sourceLinks.forEach((function(t){t.y0=t.y0+e}))),t}function j(t,e,r,n){t.nodes.forEach((function(i){n&&i.y+(i.y1-i.y0)>e&&(i.y=i.y-(i.y+(i.y1-i.y0)-e));var a=t.links.filter((function(t){return b(t.source,r)==b(i,r)})),o=a.length;o>1&&a.sort((function(t,e){if(!t.circular&&!e.circular){if(t.target.column==e.target.column)return t.y1-e.y1;if(!V(t,e))return t.y1-e.y1;if(t.target.column>e.target.column){var r=N(e,t);return t.y1-r}if(e.target.column>t.target.column)return N(t,e)-e.y1}return t.circular&&!e.circular?"top"==t.circularLinkType?-1:1:e.circular&&!t.circular?"top"==e.circularLinkType?1:-1:t.circular&&e.circular?t.circularLinkType===e.circularLinkType&&"top"==t.circularLinkType?t.target.column===e.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:t.circularLinkType===e.circularLinkType&&"bottom"==t.circularLinkType?t.target.column===e.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:"top"==t.circularLinkType?-1:1:void 0}));var s=i.y0;a.forEach((function(t){t.y0=s+t.width/2,s+=t.width})),a.forEach((function(t,e){if("bottom"==t.circularLinkType){for(var r=e+1,n=0;r<o;r++)n+=a[r].width;t.y0=i.y1-n-t.width/2}}))}))}function U(t,e,r){t.nodes.forEach((function(e){var n=t.links.filter((function(t){return b(t.target,r)==b(e,r)})),i=n.length;i>1&&n.sort((function(t,e){if(!t.circular&&!e.circular){if(t.source.column==e.source.column)return t.y0-e.y0;if(!V(t,e))return t.y0-e.y0;if(e.source.column<t.source.column){var r=D(e,t);return t.y0-r}if(t.source.column<e.source.column)return D(t,e)-e.y0}return t.circular&&!e.circular?"top"==t.circularLinkType?-1:1:e.circular&&!t.circular?"top"==e.circularLinkType?1:-1:t.circular&&e.circular?t.circularLinkType===e.circularLinkType&&"top"==t.circularLinkType?t.source.column===e.source.column?t.source.y1-e.source.y1:t.source.column-e.source.column:t.circularLinkType===e.circularLinkType&&"bottom"==t.circularLinkType?t.source.column===e.source.column?t.source.y1-e.source.y1:e.source.column-t.source.column:"top"==t.circularLinkType?-1:1:void 0}));var a=e.y0;n.forEach((function(t){t.y1=a+t.width/2,a+=t.width})),n.forEach((function(t,r){if("bottom"==t.circularLinkType){for(var a=r+1,o=0;a<i;a++)o+=n[a].width;t.y1=e.y1-o-t.width/2}}))}))}function V(t,e){return q(t)==q(e)}function q(t){return t.y0-t.y1>0?"up":"down"}function H(t,e){return b(t.source,e)==b(t.target,e)}function G(t,r,n){var i=t.nodes,a=t.links,o=!1,s=!1;if(a.forEach((function(t){"top"==t.circularLinkType?o=!0:"bottom"==t.circularLinkType&&(s=!0)})),0==o||0==s){var l=e.min(i,(function(t){return t.y0})),c=(n-r)/(e.max(i,(function(t){return t.y1}))-l);i.forEach((function(t){var e=(t.y1-t.y0)*c;t.y0=(t.y0-l)*c,t.y1=t.y0+e})),a.forEach((function(t){t.y0=(t.y0-l)*c,t.y1=(t.y1-l)*c,t.width=t.width*c}))}}t.sankeyCircular=function(){var t,n,i=0,a=0,b=1,T=1,k=24,A=g,E=o,C=v,L=y,P=32,I=2,O=null;function z(){var t={nodes:C.apply(null,arguments),links:L.apply(null,arguments)};D(t),_(t,A,O),N(t),F(t),w(t,A),B(t,P,A),V(t);for(var e=4,r=0;r<e;r++)j(t,T,A),U(t,T,A),R(t,a,T,A),j(t,T,A),U(t,T,A);return G(t,a,T),S(t,I,T,A),t}function D(t){t.nodes.forEach((function(t,e){t.index=e,t.sourceLinks=[],t.targetLinks=[]}));var e=r.map(t.nodes,A);return t.links.forEach((function(t,r){t.index=r;var n=t.source,i=t.target;"object"!==("undefined"==typeof n?"undefined":l(n))&&(n=t.source=x(e,n)),"object"!==("undefined"==typeof i?"undefined":l(i))&&(i=t.target=x(e,i)),n.sourceLinks.push(t),i.targetLinks.push(t)})),t}function N(t){t.nodes.forEach((function(t){t.partOfCycle=!1,t.value=Math.max(e.sum(t.sourceLinks,h),e.sum(t.targetLinks,h)),t.sourceLinks.forEach((function(e){e.circular&&(t.partOfCycle=!0,t.circularLinkType=e.circularLinkType)})),t.targetLinks.forEach((function(e){e.circular&&(t.partOfCycle=!0,t.circularLinkType=e.circularLinkType)}))}))}function F(t){var e,r,n;for(e=t.nodes,r=[],n=0;e.length;++n,e=r,r=[])e.forEach((function(t){t.depth=n,t.sourceLinks.forEach((function(t){r.indexOf(t.target)<0&&!t.circular&&r.push(t.target)}))}));for(e=t.nodes,r=[],n=0;e.length;++n,e=r,r=[])e.forEach((function(t){t.height=n,t.targetLinks.forEach((function(t){r.indexOf(t.source)<0&&!t.circular&&r.push(t.source)}))}));t.nodes.forEach((function(t){t.column=Math.floor(E.call(null,t,n))}))}function B(o,s,l){var c=r.nest().key((function(t){return t.column})).sortKeys(e.ascending).entries(o.nodes).map((function(t){return t.values}));!function(r){if(n){var s=1/0;c.forEach((function(t){var e=T*n/(t.length+1);s=e<s?e:s})),t=s}var l=e.min(c,(function(r){return(T-a-(r.length-1)*t)/e.sum(r,h)}));l*=.3,o.links.forEach((function(t){t.width=t.value*l}));var u=function(t){var r=0,n=0,i=0,a=0,o=e.max(t.nodes,(function(t){return t.column}));return t.links.forEach((function(t){t.circular&&("top"==t.circularLinkType?r+=t.width:n+=t.width,0==t.target.column&&(a+=t.width),t.source.column==o&&(i+=t.width))})),{top:r=r>0?r+25+10:r,bottom:n=n>0?n+25+10:n,left:a=a>0?a+25+10:a,right:i=i>0?i+25+10:i}}(o),f=function(t,r){var n=e.max(t.nodes,(function(t){return t.column})),o=b-i,s=T-a,l=o/(o+r.right+r.left),c=s/(s+r.top+r.bottom);return i=i*l+r.left,b=0==r.right?b:b*l,a=a*c+r.top,T*=c,t.nodes.forEach((function(t){t.x0=i+t.column*((b-i-k)/n),t.x1=t.x0+k})),c}(o,u);l*=f,o.links.forEach((function(t){t.width=t.value*l})),c.forEach((function(t){var e=t.length;t.forEach((function(t,n){t.depth==c.length-1&&1==e||0==t.depth&&1==e?(t.y0=T/2-t.value*l,t.y1=t.y0+t.value*l):t.partOfCycle?0==M(t,r)?(t.y0=T/2+n,t.y1=t.y0+t.value*l):"top"==t.circularLinkType?(t.y0=a+n,t.y1=t.y0+t.value*l):(t.y0=T-t.value*l-n,t.y1=t.y0+t.value*l):0==u.top||0==u.bottom?(t.y0=(T-a)/e*n,t.y1=t.y0+t.value*l):(t.y0=(T-a)/2-e/2+n,t.y1=t.y0+t.value*l)}))}))}(l),y();for(var u=1,g=s;g>0;--g)v(u*=.99,l),y();function v(t,r){var n=c.length;c.forEach((function(i){var a=i.length,o=i[0].depth;i.forEach((function(i){var s;if(i.sourceLinks.length||i.targetLinks.length)if(i.partOfCycle&&M(i,r)>0);else if(0==o&&1==a)s=i.y1-i.y0,i.y0=T/2-s/2,i.y1=T/2+s/2;else if(o==n-1&&1==a)s=i.y1-i.y0,i.y0=T/2-s/2,i.y1=T/2+s/2;else{var l=e.mean(i.sourceLinks,m),c=e.mean(i.targetLinks,d),u=((l&&c?(l+c)/2:l||c)-p(i))*t;i.y0+=u,i.y1+=u}}))}))}function y(){c.forEach((function(e){var r,n,i,o=a,s=e.length;for(e.sort(f),i=0;i<s;++i)(n=o-(r=e[i]).y0)>0&&(r.y0+=n,r.y1+=n),o=r.y1+t;if((n=o-t-T)>0)for(o=r.y0-=n,r.y1-=n,i=s-2;i>=0;--i)(n=(r=e[i]).y1+t-o)>0&&(r.y0-=n,r.y1-=n),o=r.y0}))}}function V(t){t.nodes.forEach((function(t){t.sourceLinks.sort(u),t.targetLinks.sort(c)})),t.nodes.forEach((function(t){var e=t.y0,r=e,n=t.y1,i=n;t.sourceLinks.forEach((function(t){t.circular?(t.y0=n-t.width/2,n-=t.width):(t.y0=e+t.width/2,e+=t.width)})),t.targetLinks.forEach((function(t){t.circular?(t.y1=i-t.width/2,i-=t.width):(t.y1=r+t.width/2,r+=t.width)}))}))}return z.nodeId=function(t){return arguments.length?(A="function"==typeof t?t:s(t),z):A},z.nodeAlign=function(t){return arguments.length?(E="function"==typeof t?t:s(t),z):E},z.nodeWidth=function(t){return arguments.length?(k=+t,z):k},z.nodePadding=function(e){return arguments.length?(t=+e,z):t},z.nodes=function(t){return arguments.length?(C="function"==typeof t?t:s(t),z):C},z.links=function(t){return arguments.length?(L="function"==typeof t?t:s(t),z):L},z.size=function(t){return arguments.length?(i=a=0,b=+t[0],T=+t[1],z):[b-i,T-a]},z.extent=function(t){return arguments.length?(i=+t[0][0],b=+t[1][0],a=+t[0][1],T=+t[1][1],z):[[i,a],[b,T]]},z.iterations=function(t){return arguments.length?(P=+t,z):P},z.circularLinkGap=function(t){return arguments.length?(I=+t,z):I},z.nodePaddingRatio=function(t){return arguments.length?(n=+t,z):n},z.sortNodes=function(t){return arguments.length?(O=t,z):O},z.update=function(t){return w(t,A),V(t),t.links.forEach((function(t){t.circular&&(t.circularLinkType=t.y0+t.y1<T?"top":"bottom",t.source.circularLinkType=t.circularLinkType,t.target.circularLinkType=t.circularLinkType)})),j(t,T,A,!1),U(t,T,A),S(t,I,T,A),t},z},t.sankeyCenter=function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?e.min(t.sourceLinks,a)-1:0},t.sankeyLeft=function(t){return t.depth},t.sankeyRight=function(t,e){return e-1-t.height},t.sankeyJustify=o,Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-array":125,"d3-collection":126,"d3-shape":134,"elementary-circuits-directed-graph":150}],23:[function(t,e,r){!function(n,i){"object"==typeof r&&"undefined"!=typeof e?i(r,t("d3-array"),t("d3-collection"),t("d3-shape")):i(n.d3=n.d3||{},n.d3,n.d3,n.d3)}(this,(function(t,e,r,n){"use strict";function i(t){return t.target.depth}function a(t,e){return t.sourceLinks.length?t.depth:e-1}function o(t){return function(){return t}}function s(t,e){return c(t.source,e.source)||t.index-e.index}function l(t,e){return c(t.target,e.target)||t.index-e.index}function c(t,e){return t.y0-e.y0}function u(t){return t.value}function f(t){return(t.y0+t.y1)/2}function h(t){return f(t.source)*t.value}function p(t){return f(t.target)*t.value}function d(t){return t.index}function m(t){return t.nodes}function g(t){return t.links}function v(t,e){var r=t.get(e);if(!r)throw new Error("missing: "+e);return r}function y(t){return[t.source.x1,t.y0]}function x(t){return[t.target.x0,t.y1]}t.sankey=function(){var t=0,n=0,i=1,y=1,x=24,b=8,_=d,w=a,T=m,M=g,k=32;function A(){var t={nodes:T.apply(null,arguments),links:M.apply(null,arguments)};return S(t),E(t),C(t),L(t),P(t),t}function S(t){t.nodes.forEach((function(t,e){t.index=e,t.sourceLinks=[],t.targetLinks=[]}));var e=r.map(t.nodes,_);t.links.forEach((function(t,r){t.index=r;var n=t.source,i=t.target;"object"!=typeof n&&(n=t.source=v(e,n)),"object"!=typeof i&&(i=t.target=v(e,i)),n.sourceLinks.push(t),i.targetLinks.push(t)}))}function E(t){t.nodes.forEach((function(t){t.value=Math.max(e.sum(t.sourceLinks,u),e.sum(t.targetLinks,u))}))}function C(e){var r,n,a;for(r=e.nodes,n=[],a=0;r.length;++a,r=n,n=[])r.forEach((function(t){t.depth=a,t.sourceLinks.forEach((function(t){n.indexOf(t.target)<0&&n.push(t.target)}))}));for(r=e.nodes,n=[],a=0;r.length;++a,r=n,n=[])r.forEach((function(t){t.height=a,t.targetLinks.forEach((function(t){n.indexOf(t.source)<0&&n.push(t.source)}))}));var o=(i-t-x)/(a-1);e.nodes.forEach((function(e){e.x1=(e.x0=t+Math.max(0,Math.min(a-1,Math.floor(w.call(null,e,a))))*o)+x}))}function L(t){var i=r.nest().key((function(t){return t.x0})).sortKeys(e.ascending).entries(t.nodes).map((function(t){return t.values}));!function(){var r=e.max(i,(function(t){return t.length})),a=2/3*(y-n)/(r-1);b>a&&(b=a);var o=e.min(i,(function(t){return(y-n-(t.length-1)*b)/e.sum(t,u)}));i.forEach((function(t){t.forEach((function(t,e){t.y1=(t.y0=e)+t.value*o}))})),t.links.forEach((function(t){t.width=t.value*o}))}(),d();for(var a=1,o=k;o>0;--o)l(a*=.99),d(),s(a),d();function s(t){i.forEach((function(r){r.forEach((function(r){if(r.targetLinks.length){var n=(e.sum(r.targetLinks,h)/e.sum(r.targetLinks,u)-f(r))*t;r.y0+=n,r.y1+=n}}))}))}function l(t){i.slice().reverse().forEach((function(r){r.forEach((function(r){if(r.sourceLinks.length){var n=(e.sum(r.sourceLinks,p)/e.sum(r.sourceLinks,u)-f(r))*t;r.y0+=n,r.y1+=n}}))}))}function d(){i.forEach((function(t){var e,r,i,a=n,o=t.length;for(t.sort(c),i=0;i<o;++i)(r=a-(e=t[i]).y0)>0&&(e.y0+=r,e.y1+=r),a=e.y1+b;if((r=a-b-y)>0)for(a=e.y0-=r,e.y1-=r,i=o-2;i>=0;--i)(r=(e=t[i]).y1+b-a)>0&&(e.y0-=r,e.y1-=r),a=e.y0}))}}function P(t){t.nodes.forEach((function(t){t.sourceLinks.sort(l),t.targetLinks.sort(s)})),t.nodes.forEach((function(t){var e=t.y0,r=e;t.sourceLinks.forEach((function(t){t.y0=e+t.width/2,e+=t.width})),t.targetLinks.forEach((function(t){t.y1=r+t.width/2,r+=t.width}))}))}return A.update=function(t){return P(t),t},A.nodeId=function(t){return arguments.length?(_="function"==typeof t?t:o(t),A):_},A.nodeAlign=function(t){return arguments.length?(w="function"==typeof t?t:o(t),A):w},A.nodeWidth=function(t){return arguments.length?(x=+t,A):x},A.nodePadding=function(t){return arguments.length?(b=+t,A):b},A.nodes=function(t){return arguments.length?(T="function"==typeof t?t:o(t),A):T},A.links=function(t){return arguments.length?(M="function"==typeof t?t:o(t),A):M},A.size=function(e){return arguments.length?(t=n=0,i=+e[0],y=+e[1],A):[i-t,y-n]},A.extent=function(e){return arguments.length?(t=+e[0][0],i=+e[1][0],n=+e[0][1],y=+e[1][1],A):[[t,n],[i,y]]},A.iterations=function(t){return arguments.length?(k=+t,A):k},A},t.sankeyCenter=function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?e.min(t.sourceLinks,i)-1:0},t.sankeyLeft=function(t){return t.depth},t.sankeyRight=function(t,e){return e-1-t.height},t.sankeyJustify=a,t.sankeyLinkHorizontal=function(){return n.linkHorizontal().source(y).target(x)},Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-array":125,"d3-collection":126,"d3-shape":134}],24:[function(t,e,r){"use strict";e.exports=t("./quad")},{"./quad":25}],25:[function(t,e,r){"use strict";var n=t("binary-search-bounds"),i=t("clamp"),a=t("parse-rect"),o=t("array-bounds"),s=t("pick-by-alias"),l=t("defined"),c=t("flatten-vertex-data"),u=t("is-obj"),f=t("dtype"),h=t("math-log2");function p(t,e){for(var r=e[0],n=e[1],a=1/(e[2]-r),o=1/(e[3]-n),s=new Array(t.length),l=0,c=t.length/2;l<c;l++)s[2*l]=i((t[2*l]-r)*a,0,1),s[2*l+1]=i((t[2*l+1]-n)*o,0,1);return s}e.exports=function(t,e){e||(e={}),t=c(t,"float64"),e=s(e,{bounds:"range bounds dataBox databox",maxDepth:"depth maxDepth maxdepth level maxLevel maxlevel levels",dtype:"type dtype format out dst output destination"});var r=l(e.maxDepth,255),i=l(e.bounds,o(t,2));i[0]===i[2]&&i[2]++,i[1]===i[3]&&i[3]++;var d,m=p(t,i),g=t.length>>>1;e.dtype||(e.dtype="array"),"string"==typeof e.dtype?d=new(f(e.dtype))(g):e.dtype&&(d=e.dtype,Array.isArray(d)&&(d.length=g));for(var v=0;v<g;++v)d[v]=v;var y=[],x=[],b=[],_=[];!function t(e,n,i,a,o,s){if(!a.length)return null;var l=y[o]||(y[o]=[]),c=b[o]||(b[o]=[]),u=x[o]||(x[o]=[]),f=l.length;if(++o>r||s>1073741824){for(var h=0;h<a.length;h++)l.push(a[h]),c.push(s),u.push(null,null,null,null);return f}if(l.push(a[0]),c.push(s),a.length<=1)return u.push(null,null,null,null),f;for(var p=.5*i,d=e+p,g=n+p,v=[],_=[],w=[],T=[],M=1,k=a.length;M<k;M++){var A=a[M],S=m[2*A],E=m[2*A+1];S<d?E<g?v.push(A):_.push(A):E<g?w.push(A):T.push(A)}return s<<=2,u.push(t(e,n,p,v,o,s),t(e,g,p,_,o,s+1),t(d,n,p,w,o,s+2),t(d,g,p,T,o,s+3)),f}(0,0,1,d,0,1);for(var w=0,T=0;T<y.length;T++){var M=y[T];if(d.set)d.set(M,w);else for(var k=0,A=M.length;k<A;k++)d[k+w]=M[k];var S=w+y[T].length;_[T]=[w,S],w=S}return d.range=function(){var e,r=[],n=arguments.length;for(;n--;)r[n]=arguments[n];if(u(r[r.length-1])){var o=r.pop();r.length||null==o.x&&null==o.l&&null==o.left||(r=[o],e={}),e=s(o,{level:"level maxLevel",d:"d diam diameter r radius px pxSize pixel pixelSize maxD size minSize",lod:"lod details ranges offsets"})}else e={};r.length||(r=i);var c=a.apply(void 0,r),f=[Math.min(c.x,c.x+c.width),Math.min(c.y,c.y+c.height),Math.max(c.x,c.x+c.width),Math.max(c.y,c.y+c.height)],d=f[0],m=f[1],g=f[2],v=f[3],b=p([d,m,g,v],i),_=b[0],w=b[1],T=b[2],M=b[3],k=l(e.level,y.length);if(null!=e.d){var A;"number"==typeof e.d?A=[e.d,e.d]:e.d.length&&(A=e.d),k=Math.min(Math.max(Math.ceil(-h(Math.abs(A[0])/(i[2]-i[0]))),Math.ceil(-h(Math.abs(A[1])/(i[3]-i[1])))),k)}if(k=Math.min(k,y.length),e.lod)return E(_,w,T,M,k);var S=[];function C(e,r,n,i,a,o){if(null!==a&&null!==o&&!(_>e+n||w>r+n||T<e||M<r||i>=k||a===o)){var s=y[i];void 0===o&&(o=s.length);for(var l=a;l<o;l++){var c=s[l],u=t[2*c],f=t[2*c+1];u>=d&&u<=g&&f>=m&&f<=v&&S.push(c)}var h=x[i],p=h[4*a+0],b=h[4*a+1],A=h[4*a+2],E=h[4*a+3],P=L(h,a+1),I=.5*n,O=i+1;C(e,r,I,O,p,b||A||E||P),C(e,r+I,I,O,b,A||E||P),C(e+I,r,I,O,A,E||P),C(e+I,r+I,I,O,E,P)}}function L(t,e){for(var r=null,n=0;null===r;)if(r=t[4*e+n],++n>t.length)return null;return r}return C(0,0,1,0,0,1),S},d;function E(t,e,r,i,a){for(var o=[],s=0;s<a;s++){var l=b[s],c=_[s][0],u=C(t,e,s),f=C(r,i,s),h=n.ge(l,u),p=n.gt(l,f,h,l.length-1);o[s]=[h+c,p+c]}return o}function C(t,e,r){for(var n=1,i=.5,a=.5,o=.5,s=0;s<r;s++)n<<=2,n+=t<i?e<a?0:1:e<a?2:3,o*=.5,i+=t<i?-o:o,a+=e<a?-o:o;return n}}},{"array-bounds":37,"binary-search-bounds":64,clamp:87,defined:140,dtype:146,"flatten-vertex-data":217,"is-obj":428,"math-log2":439,"parse-rect":639,"pick-by-alias":646}],26:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("@turf/meta");function i(t){var e=0;if(t&&t.length>0){e+=Math.abs(a(t[0]));for(var r=1;r<t.length;r++)e-=Math.abs(a(t[r]))}return e}function a(t){var e,r,n,i,a,s,l=0,c=t.length;if(c>2){for(s=0;s<c;s++)s===c-2?(n=c-2,i=c-1,a=0):s===c-1?(n=c-1,i=0,a=1):(n=s,i=s+1,a=s+2),e=t[n],r=t[i],l+=(o(t[a][0])-o(e[0]))*Math.sin(o(r[1]));l=6378137*l*6378137/2}return l}function o(t){return t*Math.PI/180}r.default=function(t){return n.geomReduce(t,(function(t,e){return t+function(t){var e,r=0;switch(t.type){case"Polygon":return i(t.coordinates);case"MultiPolygon":for(e=0;e<t.coordinates.length;e++)r+=i(t.coordinates[e]);return r;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(e)}),0)}},{"@turf/meta":30}],27:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("@turf/meta");function i(t){var e=[1/0,1/0,-1/0,-1/0];return n.coordEach(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}i.default=i,r.default=i},{"@turf/meta":30}],28:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("@turf/meta"),i=t("@turf/helpers");r.default=function(t,e){void 0===e&&(e={});var r=0,a=0,o=0;return n.coordEach(t,(function(t){r+=t[0],a+=t[1],o++}),!0),i.point([r/o,a/o],e.properties)}},{"@turf/helpers":29,"@turf/meta":30}],29:[function(t,e,r){"use strict";function n(t,e,r){void 0===r&&(r={});var n={type:"Feature"};return(0===r.id||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=e||{},n.geometry=t,n}function i(t,e,r){if(void 0===r&&(r={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!d(t[0])||!d(t[1]))throw new Error("coordinates must contain numbers");return n({type:"Point",coordinates:t},e,r)}function a(t,e,r){void 0===r&&(r={});for(var i=0,a=t;i<a.length;i++){var o=a[i];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}return n({type:"Polygon",coordinates:t},e,r)}function o(t,e,r){if(void 0===r&&(r={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return n({type:"LineString",coordinates:t},e,r)}function s(t,e){void 0===e&&(e={});var r={type:"FeatureCollection"};return e.id&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.features=t,r}function l(t,e,r){return void 0===r&&(r={}),n({type:"MultiLineString",coordinates:t},e,r)}function c(t,e,r){return void 0===r&&(r={}),n({type:"MultiPoint",coordinates:t},e,r)}function u(t,e,r){return void 0===r&&(r={}),n({type:"MultiPolygon",coordinates:t},e,r)}function f(t,e){void 0===e&&(e="kilometers");var n=r.factors[e];if(!n)throw new Error(e+" units is invalid");return t*n}function h(t,e){void 0===e&&(e="kilometers");var n=r.factors[e];if(!n)throw new Error(e+" units is invalid");return t/n}function p(t){return 180*(t%(2*Math.PI))/Math.PI}function d(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.earthRadius=6371008.8,r.factors={centimeters:100*r.earthRadius,centimetres:100*r.earthRadius,degrees:r.earthRadius/111325,feet:3.28084*r.earthRadius,inches:39.37*r.earthRadius,kilometers:r.earthRadius/1e3,kilometres:r.earthRadius/1e3,meters:r.earthRadius,metres:r.earthRadius,miles:r.earthRadius/1609.344,millimeters:1e3*r.earthRadius,millimetres:1e3*r.earthRadius,nauticalmiles:r.earthRadius/1852,radians:1,yards:r.earthRadius/1.0936},r.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/r.earthRadius,yards:1/1.0936},r.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046},r.feature=n,r.geometry=function(t,e,r){switch(void 0===r&&(r={}),t){case"Point":return i(e).geometry;case"LineString":return o(e).geometry;case"Polygon":return a(e).geometry;case"MultiPoint":return c(e).geometry;case"MultiLineString":return l(e).geometry;case"MultiPolygon":return u(e).geometry;default:throw new Error(t+" is invalid")}},r.point=i,r.points=function(t,e,r){return void 0===r&&(r={}),s(t.map((function(t){return i(t,e)})),r)},r.polygon=a,r.polygons=function(t,e,r){return void 0===r&&(r={}),s(t.map((function(t){return a(t,e)})),r)},r.lineString=o,r.lineStrings=function(t,e,r){return void 0===r&&(r={}),s(t.map((function(t){return o(t,e)})),r)},r.featureCollection=s,r.multiLineString=l,r.multiPoint=c,r.multiPolygon=u,r.geometryCollection=function(t,e,r){return void 0===r&&(r={}),n({type:"GeometryCollection",geometries:t},e,r)},r.round=function(t,e){if(void 0===e&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(t*r)/r},r.radiansToLength=f,r.lengthToRadians=h,r.lengthToDegrees=function(t,e){return p(h(t,e))},r.bearingToAzimuth=function(t){var e=t%360;return e<0&&(e+=360),e},r.radiansToDegrees=p,r.degreesToRadians=function(t){return t%360*Math.PI/180},r.convertLength=function(t,e,r){if(void 0===e&&(e="kilometers"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("length must be a positive number");return f(h(t,e),r)},r.convertArea=function(t,e,n){if(void 0===e&&(e="meters"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var i=r.areaFactors[e];if(!i)throw new Error("invalid original units");var a=r.areaFactors[n];if(!a)throw new Error("invalid final units");return t/i*a},r.isNumber=d,r.isObject=function(t){return!!t&&t.constructor===Object},r.validateBBox=function(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!d(t))throw new Error("bbox must only contain numbers")}))},r.validateId=function(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")}},{}],30:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("@turf/helpers");function i(t,e,r){if(null!==t)for(var n,a,o,s,l,c,u,f,h=0,p=0,d=t.type,m="FeatureCollection"===d,g="Feature"===d,v=m?t.features.length:1,y=0;y<v;y++){l=(f=!!(u=m?t.features[y].geometry:g?t.geometry:t)&&"GeometryCollection"===u.type)?u.geometries.length:1;for(var x=0;x<l;x++){var b=0,_=0;if(null!==(s=f?u.geometries[x]:u)){c=s.coordinates;var w=s.type;switch(h=!r||"Polygon"!==w&&"MultiPolygon"!==w?0:1,w){case null:break;case"Point":if(!1===e(c,p,y,b,_))return!1;p++,b++;break;case"LineString":case"MultiPoint":for(n=0;n<c.length;n++){if(!1===e(c[n],p,y,b,_))return!1;p++,"MultiPoint"===w&&b++}"LineString"===w&&b++;break;case"Polygon":case"MultiLineString":for(n=0;n<c.length;n++){for(a=0;a<c[n].length-h;a++){if(!1===e(c[n][a],p,y,b,_))return!1;p++}"MultiLineString"===w&&b++,"Polygon"===w&&_++}"Polygon"===w&&b++;break;case"MultiPolygon":for(n=0;n<c.length;n++){for(_=0,a=0;a<c[n].length;a++){for(o=0;o<c[n][a].length-h;o++){if(!1===e(c[n][a][o],p,y,b,_))return!1;p++}_++}b++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(!1===i(s.geometries[n],e,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function a(t,e){var r;switch(t.type){case"FeatureCollection":for(r=0;r<t.features.length&&!1!==e(t.features[r].properties,r);r++);break;case"Feature":e(t.properties,0)}}function o(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var r=0;r<t.features.length&&!1!==e(t.features[r],r);r++);}function s(t,e){var r,n,i,a,o,s,l,c,u,f,h=0,p="FeatureCollection"===t.type,d="Feature"===t.type,m=p?t.features.length:1;for(r=0;r<m;r++){for(s=p?t.features[r].geometry:d?t.geometry:t,c=p?t.features[r].properties:d?t.properties:{},u=p?t.features[r].bbox:d?t.bbox:void 0,f=p?t.features[r].id:d?t.id:void 0,o=(l=!!s&&"GeometryCollection"===s.type)?s.geometries.length:1,i=0;i<o;i++)if(null!==(a=l?s.geometries[i]:s))switch(a.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===e(a,h,c,u,f))return!1;break;case"GeometryCollection":for(n=0;n<a.geometries.length;n++)if(!1===e(a.geometries[n],h,c,u,f))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,h,c,u,f))return!1;h++}}function l(t,e){s(t,(function(t,r,i,a,o){var s,l=null===t?null:t.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return!1!==e(n.feature(t,i,{bbox:a,id:o}),r,0)&&void 0}switch(l){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var c=0;c<t.coordinates.length;c++){var u={type:s,coordinates:t.coordinates[c]};if(!1===e(n.feature(u,i),r,c))return!1}}))}function c(t,e){l(t,(function(t,r,a){var o=0;if(t.geometry){var s=t.geometry.type;if("Point"!==s&&"MultiPoint"!==s){var l,c=0,u=0,f=0;return!1!==i(t,(function(i,s,h,p,d){if(void 0===l||r>c||p>u||d>f)return l=i,c=r,u=p,f=d,void(o=0);var m=n.lineString([l,i],t.properties);if(!1===e(m,r,a,d,o))return!1;o++,l=i}))&&void 0}}}))}function u(t,e){if(!t)throw new Error("geojson is required");l(t,(function(t,r,i){if(null!==t.geometry){var a=t.geometry.type,o=t.geometry.coordinates;switch(a){case"LineString":if(!1===e(t,r,i,0,0))return!1;break;case"Polygon":for(var s=0;s<o.length;s++)if(!1===e(n.lineString(o[s],t.properties),r,i,s))return!1}}}))}r.coordEach=i,r.coordReduce=function(t,e,r,n){var a=r;return i(t,(function(t,n,i,o,s){a=0===n&&void 0===r?t:e(a,t,n,i,o,s)}),n),a},r.propEach=a,r.propReduce=function(t,e,r){var n=r;return a(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n},r.featureEach=o,r.featureReduce=function(t,e,r){var n=r;return o(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n},r.coordAll=function(t){var e=[];return i(t,(function(t){e.push(t)})),e},r.geomEach=s,r.geomReduce=function(t,e,r){var n=r;return s(t,(function(t,i,a,o,s){n=0===i&&void 0===r?t:e(n,t,i,a,o,s)})),n},r.flattenEach=l,r.flattenReduce=function(t,e,r){var n=r;return l(t,(function(t,i,a){n=0===i&&0===a&&void 0===r?t:e(n,t,i,a)})),n},r.segmentEach=c,r.segmentReduce=function(t,e,r){var n=r,i=!1;return c(t,(function(t,a,o,s,l){n=!1===i&&void 0===r?t:e(n,t,a,o,s,l),i=!0})),n},r.lineEach=u,r.lineReduce=function(t,e,r){var n=r;return u(t,(function(t,i,a,o){n=0===i&&void 0===r?t:e(n,t,i,a,o)})),n},r.findSegment=function(t,e){if(e=e||{},!n.isObject(e))throw new Error("options is invalid");var r,i=e.featureIndex||0,a=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.segmentIndex||0,l=e.properties;switch(t.type){case"FeatureCollection":i<0&&(i=t.features.length+i),l=l||t.features[i].properties,r=t.features[i].geometry;break;case"Feature":l=l||t.properties,r=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=t;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var c=r.coordinates;switch(r.type){case"Point":case"MultiPoint":return null;case"LineString":return s<0&&(s=c.length+s-1),n.lineString([c[s],c[s+1]],l,e);case"Polygon":return o<0&&(o=c.length+o),s<0&&(s=c[o].length+s-1),n.lineString([c[o][s],c[o][s+1]],l,e);case"MultiLineString":return a<0&&(a=c.length+a),s<0&&(s=c[a].length+s-1),n.lineString([c[a][s],c[a][s+1]],l,e);case"MultiPolygon":return a<0&&(a=c.length+a),o<0&&(o=c[a].length+o),s<0&&(s=c[a][o].length-s-1),n.lineString([c[a][o][s],c[a][o][s+1]],l,e)}throw new Error("geojson is invalid")},r.findPoint=function(t,e){if(e=e||{},!n.isObject(e))throw new Error("options is invalid");var r,i=e.featureIndex||0,a=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.coordIndex||0,l=e.properties;switch(t.type){case"FeatureCollection":i<0&&(i=t.features.length+i),l=l||t.features[i].properties,r=t.features[i].geometry;break;case"Feature":l=l||t.properties,r=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=t;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var c=r.coordinates;switch(r.type){case"Point":return n.point(c,l,e);case"MultiPoint":return a<0&&(a=c.length+a),n.point(c[a],l,e);case"LineString":return s<0&&(s=c.length+s),n.point(c[s],l,e);case"Polygon":return o<0&&(o=c.length+o),s<0&&(s=c[o].length+s),n.point(c[o][s],l,e);case"MultiLineString":return a<0&&(a=c.length+a),s<0&&(s=c[a].length+s),n.point(c[a][s],l,e);case"MultiPolygon":return a<0&&(a=c.length+a),o<0&&(o=c[a].length+o),s<0&&(s=c[a][o].length-s),n.point(c[a][o][s],l,e)}throw new Error("geojson is invalid")}},{"@turf/helpers":29}],31:[function(t,e,r){"use strict";var n="undefined"==typeof WeakMap?t("weak-map"):WeakMap,i=t("gl-buffer"),a=t("gl-vao"),o=new n;e.exports=function(t){var e=o.get(t),r=e&&(e._triangleBuffer.handle||e._triangleBuffer.buffer);if(!r||!t.isBuffer(r)){var n=i(t,new Float32Array([-1,-1,-1,4,4,-1]));(e=a(t,[{buffer:n,type:t.FLOAT,size:2}]))._triangleBuffer=n,o.set(t,e)}e.bind(),t.drawArrays(t.TRIANGLES,0,3),e.unbind()}},{"gl-buffer":231,"gl-vao":318,"weak-map":1538}],32:[function(t,e,r){e.exports=function(t){var e=0,r=0,n=0,i=0;return t.map((function(t){var a=(t=t.slice())[0],o=a.toUpperCase();if(a!=o)switch(t[0]=o,a){case"a":t[6]+=n,t[7]+=i;break;case"v":t[1]+=i;break;case"h":t[1]+=n;break;default:for(var s=1;s<t.length;)t[s++]+=n,t[s++]+=i}switch(o){case"Z":n=e,i=r;break;case"H":n=t[1];break;case"V":i=t[1];break;case"M":n=e=t[1],i=r=t[2];break;default:n=t[t.length-2],i=t[t.length-1]}return t}))}},{}],33:[function(t,e,r){var n=t("pad-left");e.exports=function(t,e,r){e="number"==typeof e?e:1,r=r||": ";var i=t.split(/\r?\n/),a=String(i.length+e-1).length;return i.map((function(t,i){var o=i+e,s=String(o).length;return n(o,a-s)+r+t})).join("\n")}},{"pad-left":637}],34:[function(t,e,r){"use strict";e.exports=function(t){var e=t.length;if(0===e)return[];if(1===e)return[0];for(var r=t[0].length,n=[t[0]],a=[0],o=1;o<e;++o)if(n.push(t[o]),i(n,r)){if(a.push(o),a.length===r+1)return a}else n.pop();return a};var n=t("robust-orientation");function i(t,e){for(var r=new Array(e+1),i=0;i<t.length;++i)r[i]=t[i];for(i=0;i<=t.length;++i){for(var a=t.length;a<=e;++a){for(var o=new Array(e),s=0;s<e;++s)o[s]=Math.pow(a+1-i,s);r[a]=o}if(n.apply(void 0,r))return!0}return!1}},{"robust-orientation":1485}],35:[function(t,e,r){"use strict";e.exports=function(t,e){return n(e).filter((function(r){for(var n=new Array(r.length),a=0;a<r.length;++a)n[a]=e[r[a]];return i(n)*t<1}))};var n=t("delaunay-triangulate"),i=t("circumradius")},{circumradius:86,"delaunay-triangulate":141}],36:[function(t,e,r){e.exports=function(t,e){return i(n(t,e))};var n=t("alpha-complex"),i=t("simplicial-complex-boundary")},{"alpha-complex":35,"simplicial-complex-boundary":1491}],37:[function(t,e,r){"use strict";e.exports=function(t,e){if(!t||null==t.length)throw Error("Argument should be an array");e=null==e?1:Math.floor(e);for(var r=Array(2*e),n=0;n<e;n++){for(var i=-1/0,a=1/0,o=n,s=t.length;o<s;o+=e)t[o]>i&&(i=t[o]),t[o]<a&&(a=t[o]);r[n]=a,r[e+n]=i}return r}},{}],38:[function(t,e,r){"use strict";e.exports=function(t,e,r){if("function"==typeof Array.prototype.findIndex)return t.findIndex(e,r);if("function"!=typeof e)throw new TypeError("predicate must be a function");var n=Object(t),i=n.length;if(0===i)return-1;for(var a=0;a<i;a++)if(e.call(r,n[a],a,n))return a;return-1}},{}],39:[function(t,e,r){"use strict";var n=t("array-bounds");e.exports=function(t,e,r){if(!t||null==t.length)throw Error("Argument should be an array");null==e&&(e=1);null==r&&(r=n(t,e));for(var i=0;i<e;i++){var a=r[e+i],o=r[i],s=i,l=t.length;if(a===1/0&&o===-1/0)for(s=i;s<l;s+=e)t[s]=t[s]===a?1:t[s]===o?0:.5;else if(a===1/0)for(s=i;s<l;s+=e)t[s]=t[s]===a?1:0;else if(o===-1/0)for(s=i;s<l;s+=e)t[s]=t[s]===o?0:1;else{var c=a-o;for(s=i;s<l;s+=e)isNaN(t[s])||(t[s]=0===c?.5:(t[s]-o)/c)}}return t}},{"array-bounds":37}],40:[function(t,e,r){e.exports=function(t,e){var r="number"==typeof t,n="number"==typeof e;r&&!n?(e=t,t=0):r||n||(t=0,e=0);var i=(e|=0)-(t|=0);if(i<0)throw new Error("array length must be positive");for(var a=new Array(i),o=0,s=t;o<i;o++,s++)a[o]=s;return a}},{}],41:[function(t,e,r){(function(r){(function(){"use strict";var n=t("object-assign");
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/function i(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);i<a;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0}function a(t){return r.Buffer&&"function"==typeof r.Buffer.isBuffer?r.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}var o=t("util/"),s=Object.prototype.hasOwnProperty,l=Array.prototype.slice,c="foo"===function(){}.name;function u(t){return Object.prototype.toString.call(t)}function f(t){return!a(t)&&("function"==typeof r.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}var h=e.exports=y,p=/\s*function\s+([^\(\s]*)\s*/;function d(t){if(o.isFunction(t)){if(c)return t.name;var e=t.toString().match(p);return e&&e[1]}}function m(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function g(t){if(c||!o.isFunction(t))return o.inspect(t);var e=d(t);return"[Function"+(e?": "+e:"")+"]"}function v(t,e,r,n,i){throw new h.AssertionError({message:r,actual:t,expected:e,operator:n,stackStartFunction:i})}function y(t,e){t||v(t,!0,e,"==",h.ok)}function x(t,e,r,n){if(t===e)return!0;if(a(t)&&a(e))return 0===i(t,e);if(o.isDate(t)&&o.isDate(e))return t.getTime()===e.getTime();if(o.isRegExp(t)&&o.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"==typeof t||null!==e&&"object"==typeof e){if(f(t)&&f(e)&&u(t)===u(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===i(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(a(t)!==a(e))return!1;var s=(n=n||{actual:[],expected:[]}).actual.indexOf(t);return-1!==s&&s===n.expected.indexOf(e)||(n.actual.push(t),n.expected.push(e),function(t,e,r,n){if(null==t||null==e)return!1;if(o.isPrimitive(t)||o.isPrimitive(e))return t===e;if(r&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var i=b(t),a=b(e);if(i&&!a||!i&&a)return!1;if(i)return t=l.call(t),e=l.call(e),x(t,e,r);var s,c,u=T(t),f=T(e);if(u.length!==f.length)return!1;for(u.sort(),f.sort(),c=u.length-1;c>=0;c--)if(u[c]!==f[c])return!1;for(c=u.length-1;c>=0;c--)if(s=u[c],!x(t[s],e[s],r,n))return!1;return!0}(t,e,r,n))}return r?t===e:t==e}function b(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function _(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function w(t,e,r,n){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&v(i,r,"Missing expected exception"+n);var a="string"==typeof n,s=!t&&i&&!r;if((!t&&o.isError(i)&&a&&_(i,r)||s)&&v(i,r,"Got unwanted exception"+n),t&&i&&r&&!_(i,r)||!t&&i)throw i}h.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=function(t){return m(g(t.actual),128)+" "+t.operator+" "+m(g(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||v;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=d(e),a=n.indexOf("\n"+i);if(a>=0){var o=n.indexOf("\n",a+1);n=n.substring(o+1)}this.stack=n}}},o.inherits(h.AssertionError,Error),h.fail=v,h.ok=y,h.equal=function(t,e,r){t!=e&&v(t,e,r,"==",h.equal)},h.notEqual=function(t,e,r){t==e&&v(t,e,r,"!=",h.notEqual)},h.deepEqual=function(t,e,r){x(t,e,!1)||v(t,e,r,"deepEqual",h.deepEqual)},h.deepStrictEqual=function(t,e,r){x(t,e,!0)||v(t,e,r,"deepStrictEqual",h.deepStrictEqual)},h.notDeepEqual=function(t,e,r){x(t,e,!1)&&v(t,e,r,"notDeepEqual",h.notDeepEqual)},h.notDeepStrictEqual=function t(e,r,n){x(e,r,!0)&&v(e,r,n,"notDeepStrictEqual",t)},h.strictEqual=function(t,e,r){t!==e&&v(t,e,r,"===",h.strictEqual)},h.notStrictEqual=function(t,e,r){t===e&&v(t,e,r,"!==",h.notStrictEqual)},h.throws=function(t,e,r){w(!0,t,e,r)},h.doesNotThrow=function(t,e,r){w(!1,t,e,r)},h.ifError=function(t){if(t)throw t},h.strict=n((function t(e,r){e||v(e,!0,r,"==",t)}),h,{equal:h.strictEqual,deepEqual:h.deepStrictEqual,notEqual:h.notStrictEqual,notDeepEqual:h.notDeepStrictEqual}),h.strict.strict=h.strict;var T=Object.keys||function(t){var e=[];for(var r in t)s.call(t,r)&&e.push(r);return e}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"object-assign":634,"util/":44}],42:[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}},{}],43:[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}},{}],44:[function(t,e,r){(function(e,n){(function(){var i=/%[sdj%]/g;r.format=function(t){if(!v(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(s(arguments[r]));return e.join(" ")}r=1;for(var n=arguments,a=n.length,o=String(t).replace(i,(function(t){if("%%"===t)return"%";if(r>=a)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(t){return"[Circular]"}default:return t}})),l=n[r];r<a;l=n[++r])m(l)||!b(l)?o+=" "+l:o+=" "+s(l);return o},r.deprecate=function(t,i){if(y(n.process))return function(){return r.deprecate(t,i).apply(this,arguments)};if(!0===e.noDeprecation)return t;var a=!1;return function(){if(!a){if(e.throwDeprecation)throw new Error(i);e.traceDeprecation?console.trace(i):console.error(i),a=!0}return t.apply(this,arguments)}};var a,o={};function s(t,e){var n={seen:[],stylize:c};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),d(e)?n.showHidden=e:e&&r._extend(n,e),y(n.showHidden)&&(n.showHidden=!1),y(n.depth)&&(n.depth=2),y(n.colors)&&(n.colors=!1),y(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=l),u(n,t,n.depth)}function l(t,e){var r=s.styles[e];return r?"\x1b["+s.colors[r][0]+"m"+t+"\x1b["+s.colors[r][1]+"m":t}function c(t,e){return t}function u(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 v(i)||(i=u(t,i,n)),i}var a=function(t,e){if(y(e))return t.stylize("undefined","undefined");if(v(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(g(e))return t.stylize(""+e,"number");if(d(e))return t.stylize(""+e,"boolean");if(m(e))return t.stylize("null","null")}(t,e);if(a)return a;var o=Object.keys(e),s=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),w(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return f(e);if(0===o.length){if(T(e)){var l=e.name?": "+e.name:"";return t.stylize("[Function"+l+"]","special")}if(x(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(_(e))return t.stylize(Date.prototype.toString.call(e),"date");if(w(e))return f(e)}var c,b="",M=!1,k=["{","}"];(p(e)&&(M=!0,k=["[","]"]),T(e))&&(b=" [Function"+(e.name?": "+e.name:"")+"]");return x(e)&&(b=" "+RegExp.prototype.toString.call(e)),_(e)&&(b=" "+Date.prototype.toUTCString.call(e)),w(e)&&(b=" "+f(e)),0!==o.length||M&&0!=e.length?n<0?x(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),c=M?function(t,e,r,n,i){for(var a=[],o=0,s=e.length;o<s;++o)E(e,String(o))?a.push(h(t,e,r,n,String(o),!0)):a.push("");return i.forEach((function(i){i.match(/^\d+$/)||a.push(h(t,e,r,n,i,!0))})),a}(t,e,n,s,o):o.map((function(r){return h(t,e,n,s,r,M)})),t.seen.pop(),function(t,e,r){if(t.reduce((function(t,e){return e.indexOf("\n")>=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(c,b,k)):k[0]+b+k[1]}function f(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i,a){var o,s,l;if((l=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=l.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):l.set&&(s=t.stylize("[Setter]","special")),E(n,i)||(o="["+i+"]"),s||(t.seen.indexOf(l.value)<0?(s=m(r)?u(t,l.value,null):u(t,l.value,r-1)).indexOf("\n")>-1&&(s=a?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")),y(o)){if(a&&i.match(/^\d+$/))return s;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+s}function p(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function m(t){return null===t}function g(t){return"number"==typeof t}function v(t){return"string"==typeof t}function y(t){return void 0===t}function x(t){return b(t)&&"[object RegExp]"===M(t)}function b(t){return"object"==typeof t&&null!==t}function _(t){return b(t)&&"[object Date]"===M(t)}function w(t){return b(t)&&("[object Error]"===M(t)||t instanceof Error)}function T(t){return"function"==typeof t}function M(t){return Object.prototype.toString.call(t)}function k(t){return t<10?"0"+t.toString(10):t.toString(10)}r.debuglog=function(t){if(y(a)&&(a=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!o[t])if(new RegExp("\\b"+t+"\\b","i").test(a)){var n=e.pid;o[t]=function(){var e=r.format.apply(r,arguments);console.error("%s %d: %s",t,n,e)}}else o[t]=function(){};return o[t]},r.inspect=s,s.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]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=p,r.isBoolean=d,r.isNull=m,r.isNullOrUndefined=function(t){return null==t},r.isNumber=g,r.isString=v,r.isSymbol=function(t){return"symbol"==typeof t},r.isUndefined=y,r.isRegExp=x,r.isObject=b,r.isDate=_,r.isError=w,r.isFunction=T,r.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t},r.isBuffer=t("./support/isBuffer");var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function S(){var t=new Date,e=[k(t.getHours()),k(t.getMinutes()),k(t.getSeconds())].join(":");return[t.getDate(),A[t.getMonth()],e].join(" ")}function E(t,e){return Object.prototype.hasOwnProperty.call(t,e)}r.log=function(){console.log("%s - %s",S(),r.format.apply(r,arguments))},r.inherits=t("inherits"),r._extend=function(t,e){if(!e||!b(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":43,_process:1465,inherits:42}],45:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],46:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r=e.length,a=new Array(r+1),o=0;o<r;++o){for(var s=new Array(r+1),l=0;l<=r;++l)s[l]=t[l][o];a[o]=s}a[r]=new Array(r+1);for(o=0;o<=r;++o)a[r][o]=1;var c=new Array(r+1);for(o=0;o<r;++o)c[o]=e[o];c[r]=1;var u=n(a,c),f=i(u[r+1]);0===f&&(f=1);var h=new Array(r+1);for(o=0;o<=r;++o)h[o]=i(u[o])/f;return h};var n=t("robust-linear-solve");function i(t){for(var e=0,r=0;r<t.length;++r)e+=t[r];return e}},{"robust-linear-solve":1484}],47:[function(t,e,r){"use strict";r.byteLength=function(t){var e=c(t),r=e[0],n=e[1];return 3*(r+n)/4-n},r.toByteArray=function(t){var e,r,n=c(t),o=n[0],s=n[1],l=new a(function(t,e,r){return 3*(e+r)/4-r}(0,o,s)),u=0,f=s>0?o-4:o;for(r=0;r<f;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],l[u++]=e>>16&255,l[u++]=e>>8&255,l[u++]=255&e;2===s&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,l[u++]=255&e);1===s&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,l[u++]=e>>8&255,l[u++]=255&e);return l},r.fromByteArray=function(t){for(var e,r=t.length,i=r%3,a=[],o=0,s=r-i;o<s;o+=16383)a.push(u(t,o,o+16383>s?s:o+16383));1===i?(e=t[r-1],a.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],a.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return a.join("")};for(var n=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=o.length;s<l;++s)n[s]=o[s],i[o.charCodeAt(s)]=s;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function u(t,e,r){for(var i,a,o=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),o.push(n[(a=i)>>18&63]+n[a>>12&63]+n[a>>6&63]+n[63&a]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],48:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=function(t,e){return n(t[0].mul(e[1]).add(e[0].mul(t[1])),t[1].mul(e[1]))}},{"./lib/rationalize":58}],49:[function(t,e,r){"use strict";e.exports=function(t,e){return t[0].mul(e[1]).cmp(e[0].mul(t[1]))}},{}],50:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=function(t,e){return n(t[0].mul(e[1]),t[1].mul(e[0]))}},{"./lib/rationalize":58}],51:[function(t,e,r){"use strict";var n=t("./is-rat"),i=t("./lib/is-bn"),a=t("./lib/num-to-bn"),o=t("./lib/str-to-bn"),s=t("./lib/rationalize"),l=t("./div");e.exports=function t(e,r){if(n(e))return r?l(e,t(r)):[e[0].clone(),e[1].clone()];var c,u,f=0;if(i(e))c=e.clone();else if("string"==typeof e)c=o(e);else{if(0===e)return[a(0),a(1)];if(e===Math.floor(e))c=a(e);else{for(;e!==Math.floor(e);)e*=Math.pow(2,256),f-=256;c=a(e)}}if(n(r))c.mul(r[1]),u=r[0].clone();else if(i(r))u=r.clone();else if("string"==typeof r)u=o(r);else if(r)if(r===Math.floor(r))u=a(r);else{for(;r!==Math.floor(r);)r*=Math.pow(2,256),f+=256;u=a(r)}else u=a(1);f>0?c=c.ushln(f):f<0&&(u=u.ushln(-f));return s(c,u)}},{"./div":50,"./is-rat":52,"./lib/is-bn":56,"./lib/num-to-bn":57,"./lib/rationalize":58,"./lib/str-to-bn":59}],52:[function(t,e,r){"use strict";var n=t("./lib/is-bn");e.exports=function(t){return Array.isArray(t)&&2===t.length&&n(t[0])&&n(t[1])}},{"./lib/is-bn":56}],53:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return t.cmp(new n(0))}},{"bn.js":67}],54:[function(t,e,r){"use strict";var n=t("./bn-sign");e.exports=function(t){var e=t.length,r=t.words,i=0;if(1===e)i=r[0];else if(2===e)i=r[0]+67108864*r[1];else for(var a=0;a<e;a++){var o=r[a];i+=o*Math.pow(67108864,a)}return n(t)*i}},{"./bn-sign":53}],55:[function(t,e,r){"use strict";var n=t("double-bits"),i=t("bit-twiddle").countTrailingZeros;e.exports=function(t){var e=i(n.lo(t));if(e<32)return e;var r=i(n.hi(t));if(r>20)return 52;return r+32}},{"bit-twiddle":65,"double-bits":143}],56:[function(t,e,r){"use strict";t("bn.js");e.exports=function(t){return t&&"object"==typeof t&&Boolean(t.words)}},{"bn.js":67}],57:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("double-bits");e.exports=function(t){var e=i.exponent(t);return e<52?new n(t):new n(t*Math.pow(2,52-e)).ushln(e-52)}},{"bn.js":67,"double-bits":143}],58:[function(t,e,r){"use strict";var n=t("./num-to-bn"),i=t("./bn-sign");e.exports=function(t,e){var r=i(t),a=i(e);if(0===r)return[n(0),n(1)];if(0===a)return[n(0),n(0)];a<0&&(t=t.neg(),e=e.neg());var o=t.gcd(e);if(o.cmpn(1))return[t.div(o),e.div(o)];return[t,e]}},{"./bn-sign":53,"./num-to-bn":57}],59:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return new n(t)}},{"bn.js":67}],60:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=function(t,e){return n(t[0].mul(e[0]),t[1].mul(e[1]))}},{"./lib/rationalize":58}],61:[function(t,e,r){"use strict";var n=t("./lib/bn-sign");e.exports=function(t){return n(t[0])*n(t[1])}},{"./lib/bn-sign":53}],62:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=function(t,e){return n(t[0].mul(e[1]).sub(t[1].mul(e[0])),t[1].mul(e[1]))}},{"./lib/rationalize":58}],63:[function(t,e,r){"use strict";var n=t("./lib/bn-to-num"),i=t("./lib/ctz");e.exports=function(t){var e=t[0],r=t[1];if(0===e.cmpn(0))return 0;var a=e.abs().divmod(r.abs()),o=a.div,s=n(o),l=a.mod,c=e.negative!==r.negative?-1:1;if(0===l.cmpn(0))return c*s;if(s){var u=i(s)+4,f=n(l.ushln(u).divRound(r));return c*(s+f*Math.pow(2,-u))}var h=r.bitLength()-l.bitLength()+53;f=n(l.ushln(h).divRound(r));return h<1023?c*f*Math.pow(2,-h):(f*=Math.pow(2,-1023),c*f*Math.pow(2,1023-h))}},{"./lib/bn-to-num":54,"./lib/ctz":55}],64:[function(t,e,r){"use strict";function n(t,e,r,n,i){for(var a=i+1;n<=i;){var o=n+i>>>1,s=t[o];(void 0!==r?r(s,e):s-e)>=0?(a=o,i=o-1):n=o+1}return a}function i(t,e,r,n,i){for(var a=i+1;n<=i;){var o=n+i>>>1,s=t[o];(void 0!==r?r(s,e):s-e)>0?(a=o,i=o-1):n=o+1}return a}function a(t,e,r,n,i){for(var a=n-1;n<=i;){var o=n+i>>>1,s=t[o];(void 0!==r?r(s,e):s-e)<0?(a=o,n=o+1):i=o-1}return a}function o(t,e,r,n,i){for(var a=n-1;n<=i;){var o=n+i>>>1,s=t[o];(void 0!==r?r(s,e):s-e)<=0?(a=o,n=o+1):i=o-1}return a}function s(t,e,r,n,i){for(;n<=i;){var a=n+i>>>1,o=t[a],s=void 0!==r?r(o,e):o-e;if(0===s)return a;s<=0?n=a+1:i=a-1}return-1}function l(t,e,r,n,i,a){return"function"==typeof r?a(t,e,r,void 0===n?0:0|n,void 0===i?t.length-1:0|i):a(t,e,void 0,void 0===r?0:0|r,void 0===n?t.length-1:0|n)}e.exports={ge:function(t,e,r,i,a){return l(t,e,r,i,a,n)},gt:function(t,e,r,n,a){return l(t,e,r,n,a,i)},lt:function(t,e,r,n,i){return l(t,e,r,n,i,a)},le:function(t,e,r,n,i){return l(t,e,r,n,i,o)},eq:function(t,e,r,n,i){return l(t,e,r,n,i,s)}}},{}],65:[function(t,e,r){"use strict";function n(t){var e=32;return(t&=-t)&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}r.INT_BITS=32,r.INT_MAX=2147483647,r.INT_MIN=-1<<31,r.sign=function(t){return(t>0)-(t<0)},r.abs=function(t){var e=t>>31;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(t<e)},r.max=function(t,e){return t^(t^e)&-(t<e)},r.isPow2=function(t){return!(t&t-1||!t)},r.log2=function(t){var e,r;return e=(t>65535)<<4,e|=r=((t>>>=e)>255)<<3,e|=r=((t>>>=r)>15)<<2,(e|=r=((t>>>=r)>3)<<1)|(t>>>=r)>>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 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(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)+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1};var i=new Array(256);!function(t){for(var e=0;e<256;++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}}(i),r.reverse=function(t){return i[255&t]<<24|i[t>>>8&255]<<16|i[t>>>16&255]<<8|i[t>>>24&255]},r.interleave2=function(t,e){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))<<1},r.deinterleave2=function(t,e){return(t=65535&((t=16711935&((t=252645135&((t=858993459&((t=t>>>e&1431655765)|t>>>1))|t>>>2))|t>>>4))|t>>>16))<<16>>16},r.interleave3=function(t,e,r){return t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2),(t|=(e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2))<<1)|(r=1227133513&((r=3272356035&((r=251719695&((r=4278190335&((r&=1023)|r<<16))|r<<8))|r<<4))|r<<2))<<2},r.deinterleave3=function(t,e){return(t=1023&((t=4278190335&((t=251719695&((t=3272356035&((t=t>>>e&1227133513)|t>>>2))|t>>>4))|t>>>8))|t>>>16))<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],66:[function(t,e,r){"use strict";var n=t("clamp");e.exports=function(t,e){e||(e={});var r,o,s,l,c,u,f,h,p,d,m,g=null==e.cutoff?.25:e.cutoff,v=null==e.radius?8:e.radius,y=e.channel||0;if(ArrayBuffer.isView(t)||Array.isArray(t)){if(!e.width||!e.height)throw Error("For raw data width and height should be provided by options");r=e.width,o=e.height,l=t,u=e.stride?e.stride:Math.floor(t.length/r/o)}else window.HTMLCanvasElement&&t instanceof window.HTMLCanvasElement?(f=(h=t).getContext("2d"),r=h.width,o=h.height,p=f.getImageData(0,0,r,o),l=p.data,u=4):window.CanvasRenderingContext2D&&t instanceof window.CanvasRenderingContext2D?(h=t.canvas,f=t,r=h.width,o=h.height,p=f.getImageData(0,0,r,o),l=p.data,u=4):window.ImageData&&t instanceof window.ImageData&&(p=t,r=t.width,o=t.height,l=p.data,u=4);if(s=Math.max(r,o),window.Uint8ClampedArray&&l instanceof window.Uint8ClampedArray||window.Uint8Array&&l instanceof window.Uint8Array)for(c=l,l=Array(r*o),d=0,m=c.length;d<m;d++)l[d]=c[d*u+y]/255;else if(1!==u)throw Error("Raw data can have only 1 value per pixel");var x=Array(r*o),b=Array(r*o),_=Array(s),w=Array(s),T=Array(s+1),M=Array(s);for(d=0,m=r*o;d<m;d++){var k=l[d];x[d]=1===k?0:0===k?i:Math.pow(Math.max(0,.5-k),2),b[d]=1===k?i:0===k?0:Math.pow(Math.max(0,k-.5),2)}a(x,r,o,_,w,M,T),a(b,r,o,_,w,M,T);var A=window.Float32Array?new Float32Array(r*o):new Array(r*o);for(d=0,m=r*o;d<m;d++)A[d]=n(1-((x[d]-b[d])/v+g),0,1);return A};var i=1e20;function a(t,e,r,n,i,a,s){for(var l=0;l<e;l++){for(var c=0;c<r;c++)n[c]=t[c*e+l];for(o(n,i,a,s,r),c=0;c<r;c++)t[c*e+l]=i[c]}for(c=0;c<r;c++){for(l=0;l<e;l++)n[l]=t[c*e+l];for(o(n,i,a,s,e),l=0;l<e;l++)t[c*e+l]=Math.sqrt(i[l])}}function o(t,e,r,n,a){r[0]=0,n[0]=-i,n[1]=+i;for(var o=1,s=0;o<a;o++){for(var l=(t[o]+o*o-(t[r[s]]+r[s]*r[s]))/(2*o-2*r[s]);l<=n[s];)s--,l=(t[o]+o*o-(t[r[s]]+r[s]*r[s]))/(2*o-2*r[s]);r[++s]=o,n[s]=l,n[s+1]=+i}for(o=0,s=0;o<a;o++){for(;n[s+1]<o;)s++;e[o]=(o-r[s])*(o-r[s])+t[r[s]]}}},{clamp:87}],67:[function(t,e,r){!function(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof e?e.exports=a:r.BN=a,a.BN=a,a.wordSize=26;try{o="undefined"!=typeof window&&"undefined"!=typeof window.Buffer?window.Buffer:t("buffer").Buffer}catch(t){}function s(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function l(t,e,r){var n=s(t,r);return r-1>=e&&(n|=s(t,r-1)<<4),n}function c(t,e,r,n){for(var i=0,a=Math.min(t.length,r),o=e;o<a;o++){var s=t.charCodeAt(o)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(n("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 a,o,s=0;if("be"===r)for(i=t.length-1,a=0;i>=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(i=0,a=0;i<t.length;i+=3)o=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,a=0,o=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=l(t,e,n)<<a,this.words[o]|=67108863&i,a>=18?(a-=18,o+=1,this.words[o]|=i>>>26):a+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=l(t,e,n)<<a,this.words[o]|=67108863&i,a>=18?(a-=18,o+=1,this.words[o]|=i>>>26):a+=8;this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var a=t.length-r,o=a%n,s=Math.min(a,a-o)+r,l=0,u=r;u<s;u+=n)l=c(t,u,u+n,e),this.imuln(i),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l);if(0!==o){var f=1;for(l=c(t,u,t.length,e),u=0;u<o;u++)f*=e;this.imuln(f),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l)}this.strip()},a.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.negative=this.negative,t.red=this.red},a.prototype.clone=function(){var t=new a(null);return this.copy(t),t},a.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","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"],f=[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],h=[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];function p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],a=0|e.words[0],o=i*a,s=67108863&o,l=o/67108864|0;r.words[0]=s;for(var c=1;c<n;c++){for(var u=l>>>26,f=67108863&l,h=Math.min(c,e.length-1),p=Math.max(0,c-t.length+1);p<=h;p++){var d=c-p|0;u+=(o=(i=0|t.words[d])*(a=0|e.words[p])+f)/67108864|0,f=67108863&o}r.words[c]=0|f,l=0|u}return 0!==l?r.words[c]=0|l:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],l=(16777215&(s<<i|a)).toString(16);r=0!==(a=s>>>24-i&16777215)||o!==this.length-1?u[6-l.length]+l+r:l+r,(i+=2)>=26&&(i-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=f[t],p=h[t];r="";var d=this.clone();for(d.negative=0;!d.isZero();){var m=d.modn(p).toString(t);r=(d=d.idivn(p)).isZero()?m+r:u[c-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return n("undefined"!=typeof o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,"byte array longer than desired length"),n(a>0,"Requested array length <= 0"),this.strip();var o,s,l="le"===e,c=new t(a),u=this.clone();if(l){for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),c[s]=o;for(;s<a;s++)c[s]=0}else{for(s=0;s<a-i;s++)c[s]=0;for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),c[a-s-1]=o}return c},Math.clz32?a.prototype._countBits=function(t){return 32-Math.clz32(t)}:a.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},a.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},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())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},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},a.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(t){for(;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()},a.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},a.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){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()},a.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},a.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){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()},a.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},a.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},a.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,a=0;a<n.length;a++)e=(0|r.words[a])+(0|n.words[a])+i,this.words[a]=67108863&e,i=e>>>26;for(;0!==i&&a<r.length;a++)e=(0|r.words[a])+i,this.words[a]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this},a.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var a=0,o=0;o<n.length;o++)a=(e=(0|r.words[o])-(0|n.words[o])+a)>>26,this.words[o]=67108863&e;for(;0!==a&&o<r.length;o++)a=(e=(0|r.words[o])+a)>>26,this.words[o]=67108863&e;if(0===a&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this.strip()},a.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var n,i,a,o=t.words,s=e.words,l=r.words,c=0,u=0|o[0],f=8191&u,h=u>>>13,p=0|o[1],d=8191&p,m=p>>>13,g=0|o[2],v=8191&g,y=g>>>13,x=0|o[3],b=8191&x,_=x>>>13,w=0|o[4],T=8191&w,M=w>>>13,k=0|o[5],A=8191&k,S=k>>>13,E=0|o[6],C=8191&E,L=E>>>13,P=0|o[7],I=8191&P,O=P>>>13,z=0|o[8],D=8191&z,N=z>>>13,R=0|o[9],F=8191&R,B=R>>>13,j=0|s[0],U=8191&j,V=j>>>13,q=0|s[1],H=8191&q,G=q>>>13,Y=0|s[2],W=8191&Y,Z=Y>>>13,X=0|s[3],J=8191&X,K=X>>>13,$=0|s[4],Q=8191&$,tt=$>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],at=8191&it,ot=it>>>13,st=0|s[7],lt=8191&st,ct=st>>>13,ut=0|s[8],ft=8191&ut,ht=ut>>>13,pt=0|s[9],dt=8191&pt,mt=pt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(c+(n=Math.imul(f,U))|0)+((8191&(i=(i=Math.imul(f,V))+Math.imul(h,U)|0))<<13)|0;c=((a=Math.imul(h,V))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(d,U),i=(i=Math.imul(d,V))+Math.imul(m,U)|0,a=Math.imul(m,V);var vt=(c+(n=n+Math.imul(f,H)|0)|0)+((8191&(i=(i=i+Math.imul(f,G)|0)+Math.imul(h,H)|0))<<13)|0;c=((a=a+Math.imul(h,G)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,U),i=(i=Math.imul(v,V))+Math.imul(y,U)|0,a=Math.imul(y,V),n=n+Math.imul(d,H)|0,i=(i=i+Math.imul(d,G)|0)+Math.imul(m,H)|0,a=a+Math.imul(m,G)|0;var yt=(c+(n=n+Math.imul(f,W)|0)|0)+((8191&(i=(i=i+Math.imul(f,Z)|0)+Math.imul(h,W)|0))<<13)|0;c=((a=a+Math.imul(h,Z)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(b,U),i=(i=Math.imul(b,V))+Math.imul(_,U)|0,a=Math.imul(_,V),n=n+Math.imul(v,H)|0,i=(i=i+Math.imul(v,G)|0)+Math.imul(y,H)|0,a=a+Math.imul(y,G)|0,n=n+Math.imul(d,W)|0,i=(i=i+Math.imul(d,Z)|0)+Math.imul(m,W)|0,a=a+Math.imul(m,Z)|0;var xt=(c+(n=n+Math.imul(f,J)|0)|0)+((8191&(i=(i=i+Math.imul(f,K)|0)+Math.imul(h,J)|0))<<13)|0;c=((a=a+Math.imul(h,K)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(T,U),i=(i=Math.imul(T,V))+Math.imul(M,U)|0,a=Math.imul(M,V),n=n+Math.imul(b,H)|0,i=(i=i+Math.imul(b,G)|0)+Math.imul(_,H)|0,a=a+Math.imul(_,G)|0,n=n+Math.imul(v,W)|0,i=(i=i+Math.imul(v,Z)|0)+Math.imul(y,W)|0,a=a+Math.imul(y,Z)|0,n=n+Math.imul(d,J)|0,i=(i=i+Math.imul(d,K)|0)+Math.imul(m,J)|0,a=a+Math.imul(m,K)|0;var bt=(c+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(h,Q)|0))<<13)|0;c=((a=a+Math.imul(h,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,U),i=(i=Math.imul(A,V))+Math.imul(S,U)|0,a=Math.imul(S,V),n=n+Math.imul(T,H)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(M,H)|0,a=a+Math.imul(M,G)|0,n=n+Math.imul(b,W)|0,i=(i=i+Math.imul(b,Z)|0)+Math.imul(_,W)|0,a=a+Math.imul(_,Z)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,K)|0)+Math.imul(y,J)|0,a=a+Math.imul(y,K)|0,n=n+Math.imul(d,Q)|0,i=(i=i+Math.imul(d,tt)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,tt)|0;var _t=(c+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(h,rt)|0))<<13)|0;c=((a=a+Math.imul(h,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(C,U),i=(i=Math.imul(C,V))+Math.imul(L,U)|0,a=Math.imul(L,V),n=n+Math.imul(A,H)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(S,H)|0,a=a+Math.imul(S,G)|0,n=n+Math.imul(T,W)|0,i=(i=i+Math.imul(T,Z)|0)+Math.imul(M,W)|0,a=a+Math.imul(M,Z)|0,n=n+Math.imul(b,J)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(_,J)|0,a=a+Math.imul(_,K)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,Q)|0,a=a+Math.imul(y,tt)|0,n=n+Math.imul(d,rt)|0,i=(i=i+Math.imul(d,nt)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,nt)|0;var wt=(c+(n=n+Math.imul(f,at)|0)|0)+((8191&(i=(i=i+Math.imul(f,ot)|0)+Math.imul(h,at)|0))<<13)|0;c=((a=a+Math.imul(h,ot)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(I,U),i=(i=Math.imul(I,V))+Math.imul(O,U)|0,a=Math.imul(O,V),n=n+Math.imul(C,H)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(L,H)|0,a=a+Math.imul(L,G)|0,n=n+Math.imul(A,W)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(S,W)|0,a=a+Math.imul(S,Z)|0,n=n+Math.imul(T,J)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(M,J)|0,a=a+Math.imul(M,K)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,Q)|0,a=a+Math.imul(_,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,a=a+Math.imul(y,nt)|0,n=n+Math.imul(d,at)|0,i=(i=i+Math.imul(d,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var Tt=(c+(n=n+Math.imul(f,lt)|0)|0)+((8191&(i=(i=i+Math.imul(f,ct)|0)+Math.imul(h,lt)|0))<<13)|0;c=((a=a+Math.imul(h,ct)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(D,U),i=(i=Math.imul(D,V))+Math.imul(N,U)|0,a=Math.imul(N,V),n=n+Math.imul(I,H)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(O,H)|0,a=a+Math.imul(O,G)|0,n=n+Math.imul(C,W)|0,i=(i=i+Math.imul(C,Z)|0)+Math.imul(L,W)|0,a=a+Math.imul(L,Z)|0,n=n+Math.imul(A,J)|0,i=(i=i+Math.imul(A,K)|0)+Math.imul(S,J)|0,a=a+Math.imul(S,K)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(M,Q)|0,a=a+Math.imul(M,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,nt)|0,n=n+Math.imul(v,at)|0,i=(i=i+Math.imul(v,ot)|0)+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,n=n+Math.imul(d,lt)|0,i=(i=i+Math.imul(d,ct)|0)+Math.imul(m,lt)|0,a=a+Math.imul(m,ct)|0;var Mt=(c+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,ht)|0)+Math.imul(h,ft)|0))<<13)|0;c=((a=a+Math.imul(h,ht)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(F,U),i=(i=Math.imul(F,V))+Math.imul(B,U)|0,a=Math.imul(B,V),n=n+Math.imul(D,H)|0,i=(i=i+Math.imul(D,G)|0)+Math.imul(N,H)|0,a=a+Math.imul(N,G)|0,n=n+Math.imul(I,W)|0,i=(i=i+Math.imul(I,Z)|0)+Math.imul(O,W)|0,a=a+Math.imul(O,Z)|0,n=n+Math.imul(C,J)|0,i=(i=i+Math.imul(C,K)|0)+Math.imul(L,J)|0,a=a+Math.imul(L,K)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(S,Q)|0,a=a+Math.imul(S,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(M,rt)|0,a=a+Math.imul(M,nt)|0,n=n+Math.imul(b,at)|0,i=(i=i+Math.imul(b,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,n=n+Math.imul(v,lt)|0,i=(i=i+Math.imul(v,ct)|0)+Math.imul(y,lt)|0,a=a+Math.imul(y,ct)|0,n=n+Math.imul(d,ft)|0,i=(i=i+Math.imul(d,ht)|0)+Math.imul(m,ft)|0,a=a+Math.imul(m,ht)|0;var kt=(c+(n=n+Math.imul(f,dt)|0)|0)+((8191&(i=(i=i+Math.imul(f,mt)|0)+Math.imul(h,dt)|0))<<13)|0;c=((a=a+Math.imul(h,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(F,H),i=(i=Math.imul(F,G))+Math.imul(B,H)|0,a=Math.imul(B,G),n=n+Math.imul(D,W)|0,i=(i=i+Math.imul(D,Z)|0)+Math.imul(N,W)|0,a=a+Math.imul(N,Z)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,K)|0)+Math.imul(O,J)|0,a=a+Math.imul(O,K)|0,n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(L,Q)|0,a=a+Math.imul(L,tt)|0,n=n+Math.imul(A,rt)|0,i=(i=i+Math.imul(A,nt)|0)+Math.imul(S,rt)|0,a=a+Math.imul(S,nt)|0,n=n+Math.imul(T,at)|0,i=(i=i+Math.imul(T,ot)|0)+Math.imul(M,at)|0,a=a+Math.imul(M,ot)|0,n=n+Math.imul(b,lt)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(_,lt)|0,a=a+Math.imul(_,ct)|0,n=n+Math.imul(v,ft)|0,i=(i=i+Math.imul(v,ht)|0)+Math.imul(y,ft)|0,a=a+Math.imul(y,ht)|0;var At=(c+(n=n+Math.imul(d,dt)|0)|0)+((8191&(i=(i=i+Math.imul(d,mt)|0)+Math.imul(m,dt)|0))<<13)|0;c=((a=a+Math.imul(m,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(F,W),i=(i=Math.imul(F,Z))+Math.imul(B,W)|0,a=Math.imul(B,Z),n=n+Math.imul(D,J)|0,i=(i=i+Math.imul(D,K)|0)+Math.imul(N,J)|0,a=a+Math.imul(N,K)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(O,Q)|0,a=a+Math.imul(O,tt)|0,n=n+Math.imul(C,rt)|0,i=(i=i+Math.imul(C,nt)|0)+Math.imul(L,rt)|0,a=a+Math.imul(L,nt)|0,n=n+Math.imul(A,at)|0,i=(i=i+Math.imul(A,ot)|0)+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,n=n+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(M,lt)|0,a=a+Math.imul(M,ct)|0,n=n+Math.imul(b,ft)|0,i=(i=i+Math.imul(b,ht)|0)+Math.imul(_,ft)|0,a=a+Math.imul(_,ht)|0;var St=(c+(n=n+Math.imul(v,dt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,dt)|0))<<13)|0;c=((a=a+Math.imul(y,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(F,J),i=(i=Math.imul(F,K))+Math.imul(B,J)|0,a=Math.imul(B,K),n=n+Math.imul(D,Q)|0,i=(i=i+Math.imul(D,tt)|0)+Math.imul(N,Q)|0,a=a+Math.imul(N,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(O,rt)|0,a=a+Math.imul(O,nt)|0,n=n+Math.imul(C,at)|0,i=(i=i+Math.imul(C,ot)|0)+Math.imul(L,at)|0,a=a+Math.imul(L,ot)|0,n=n+Math.imul(A,lt)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(S,lt)|0,a=a+Math.imul(S,ct)|0,n=n+Math.imul(T,ft)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(M,ft)|0,a=a+Math.imul(M,ht)|0;var Et=(c+(n=n+Math.imul(b,dt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(_,dt)|0))<<13)|0;c=((a=a+Math.imul(_,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(F,Q),i=(i=Math.imul(F,tt))+Math.imul(B,Q)|0,a=Math.imul(B,tt),n=n+Math.imul(D,rt)|0,i=(i=i+Math.imul(D,nt)|0)+Math.imul(N,rt)|0,a=a+Math.imul(N,nt)|0,n=n+Math.imul(I,at)|0,i=(i=i+Math.imul(I,ot)|0)+Math.imul(O,at)|0,a=a+Math.imul(O,ot)|0,n=n+Math.imul(C,lt)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(L,lt)|0,a=a+Math.imul(L,ct)|0,n=n+Math.imul(A,ft)|0,i=(i=i+Math.imul(A,ht)|0)+Math.imul(S,ft)|0,a=a+Math.imul(S,ht)|0;var Ct=(c+(n=n+Math.imul(T,dt)|0)|0)+((8191&(i=(i=i+Math.imul(T,mt)|0)+Math.imul(M,dt)|0))<<13)|0;c=((a=a+Math.imul(M,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(F,rt),i=(i=Math.imul(F,nt))+Math.imul(B,rt)|0,a=Math.imul(B,nt),n=n+Math.imul(D,at)|0,i=(i=i+Math.imul(D,ot)|0)+Math.imul(N,at)|0,a=a+Math.imul(N,ot)|0,n=n+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(O,lt)|0,a=a+Math.imul(O,ct)|0,n=n+Math.imul(C,ft)|0,i=(i=i+Math.imul(C,ht)|0)+Math.imul(L,ft)|0,a=a+Math.imul(L,ht)|0;var Lt=(c+(n=n+Math.imul(A,dt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(S,dt)|0))<<13)|0;c=((a=a+Math.imul(S,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(F,at),i=(i=Math.imul(F,ot))+Math.imul(B,at)|0,a=Math.imul(B,ot),n=n+Math.imul(D,lt)|0,i=(i=i+Math.imul(D,ct)|0)+Math.imul(N,lt)|0,a=a+Math.imul(N,ct)|0,n=n+Math.imul(I,ft)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(O,ft)|0,a=a+Math.imul(O,ht)|0;var Pt=(c+(n=n+Math.imul(C,dt)|0)|0)+((8191&(i=(i=i+Math.imul(C,mt)|0)+Math.imul(L,dt)|0))<<13)|0;c=((a=a+Math.imul(L,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(F,lt),i=(i=Math.imul(F,ct))+Math.imul(B,lt)|0,a=Math.imul(B,ct),n=n+Math.imul(D,ft)|0,i=(i=i+Math.imul(D,ht)|0)+Math.imul(N,ft)|0,a=a+Math.imul(N,ht)|0;var It=(c+(n=n+Math.imul(I,dt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(O,dt)|0))<<13)|0;c=((a=a+Math.imul(O,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(F,ft),i=(i=Math.imul(F,ht))+Math.imul(B,ft)|0,a=Math.imul(B,ht);var Ot=(c+(n=n+Math.imul(D,dt)|0)|0)+((8191&(i=(i=i+Math.imul(D,mt)|0)+Math.imul(N,dt)|0))<<13)|0;c=((a=a+Math.imul(N,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var zt=(c+(n=Math.imul(F,dt))|0)+((8191&(i=(i=Math.imul(F,mt))+Math.imul(B,dt)|0))<<13)|0;return c=((a=Math.imul(B,mt))+(i>>>13)|0)+(zt>>>26)|0,zt&=67108863,l[0]=gt,l[1]=vt,l[2]=yt,l[3]=xt,l[4]=bt,l[5]=_t,l[6]=wt,l[7]=Tt,l[8]=Mt,l[9]=kt,l[10]=At,l[11]=St,l[12]=Et,l[13]=Ct,l[14]=Lt,l[15]=Pt,l[16]=It,l[17]=Ot,l[18]=zt,0!==c&&(l[19]=c,r.length++),r};function m(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(d=p),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?p(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,a=0;a<r.length-1;a++){var o=i;i=0;for(var s=67108863&n,l=Math.min(a,e.length-1),c=Math.max(0,a-t.length+1);c<=l;c++){var u=a-c,f=(0|t.words[u])*(0|e.words[c]),h=67108863&f;s=67108863&(h=h+s|0),i+=(o=(o=o+(f/67108864|0)|0)+(h>>>26)|0)>>>26,o&=67108863}r.words[a]=s,n=o,o=i}return 0!==n?r.words[a]=n:r.length--,r.strip()}(this,t,e):m(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},g.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},g.prototype.permute=function(t,e,r,n,i,a){for(var o=0;o<a;o++)n[o]=e[t[o]],i[o]=r[t[o]]},g.prototype.transform=function(t,e,r,n,i,a){this.permute(a,t,e,r,n,i);for(var o=1;o<i;o<<=1)for(var s=o<<1,l=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),u=0;u<i;u+=s)for(var f=l,h=c,p=0;p<o;p++){var d=r[u+p],m=n[u+p],g=r[u+p+o],v=n[u+p+o],y=f*g-h*v;v=f*v+h*g,g=y,r[u+p]=d+g,n[u+p]=m+v,r[u+p+o]=d-g,n[u+p+o]=m-v,p!==s&&(y=l*f-c*h,h=l*h+c*f,f=y)}},g.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},g.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},g.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},g.prototype.convert13b=function(t,e,r,i){for(var a=0,o=0;o<e;o++)a+=0|t[o],r[2*o]=8191&a,a>>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o<i;++o)r[o]=0;n(0===a),n(0==(-8192&a))},g.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},g.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),a=this.stub(n),o=new Array(n),s=new Array(n),l=new Array(n),c=new Array(n),u=new Array(n),f=new Array(n),h=r.words;h.length=n,this.convert13b(t.words,t.length,o,n),this.convert13b(e.words,e.length,c,n),this.transform(o,a,s,l,n,i),this.transform(c,a,u,f,n,i);for(var p=0;p<n;p++){var d=s[p]*u[p]-l[p]*f[p];l[p]=s[p]*f[p]+l[p]*u[p],s[p]=d}return this.conjugate(s,l,n),this.transform(s,l,h,a,n,i),this.conjugate(h,a,n),this.normalize13b(h,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},a.prototype.mul=function(t){var e=new a(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},a.prototype.mulf=function(t){var e=new a(null);return e.words=new Array(this.length+t.length),m(this,t,e)},a.prototype.imul=function(t){return this.clone().mulTo(t,this)},a.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,a=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=(t.words[n]&1<<i)>>>i}return e}(t);if(0===e.length)return new a(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},a.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e<this.length;e++){var s=this.words[e]&a,l=(0|this.words[e])-s<<r;this.words[e]=l|o,o=s>>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},a.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},a.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<<a,l=r;if(i-=o,i=Math.max(0,i),l){for(var c=0;c<o;c++)l.words[c]=this.words[c];l.length=o}if(0===o);else if(this.length>o)for(this.length-=o,c=0;c<this.length;c++)this.words[c]=this.words[c+o];else this.words[0]=0,this.length=1;var u=0;for(c=this.length-1;c>=0&&(0!==u||c>=i);c--){var f=0|this.words[c];this.words[c]=u<<26-a|f>>>a,u=f&s}return l&&0!==u&&(l.words[l.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r)&&!!(this.words[r]&i)},a.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},a.prototype.maskn=function(t){return this.clone().imaskn(t)},a.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},a.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},a.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},a.prototype.addn=function(t){return this.clone().iaddn(t)},a.prototype.subn=function(t){return this.clone().isubn(t)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(t,e,r){var i,a,o=t.length+r;this._expand(o);var s=0;for(i=0;i<t.length;i++){a=(0|this.words[i+r])+s;var l=(0|t.words[i])*e;s=((a-=67108863&l)>>26)-(l/67108864|0),this.words[i+r]=67108863&a}for(;i<this.length-r;i++)s=(a=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&a;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(a=-(0|this.words[i])+s)>>26,this.words[i]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var s,l=n.length-i.length;if("mod"!==e){(s=new a(null)).length=l+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var u=n.clone()._ishlnsubmul(i,1,l);0===u.negative&&(n=u,s&&(s.words[l]=1));for(var f=l-1;f>=0;f--){var h=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(h=Math.min(h/o|0,67108863),n._ishlnsubmul(i,h,f);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=h)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},a.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},a.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new a(1),o=new a(0),s=new a(0),l=new a(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var u=r.clone(),f=e.clone();!e.isZero();){for(var h=0,p=1;0==(e.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(u),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var d=0,m=1;0==(r.words[0]&m)&&d<26;++d,m<<=1);if(d>0)for(r.iushrn(d);d-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(u),l.isub(f)),s.iushrn(1),l.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),o.isub(l)):(r.isub(e),s.isub(i),l.isub(o))}return{a:s,b:l,gcd:r.iushln(c)}},a.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new a(1),s=new a(0),l=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,u=1;0==(e.words[0]&u)&&c<26;++c,u<<=1);if(c>0)for(e.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(l),o.iushrn(1);for(var f=0,h=1;0==(r.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(i=0===e.cmpn(1)?o:s).cmpn(0)<0&&i.iadd(t),i},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var a=e;e=r,r=a}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var a=i,o=r;0!==a&&o<this.length;o++){var s=0|this.words[o];a=(s+=a)>>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},a.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},a.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=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new T(t)},a.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function x(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function T(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){T.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(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=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).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):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(x,y),x.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n<r;n++)e.words[n]=t.words[n];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,n=10;n<t.length;n++){var a=0|t.words[n];t.words[n-10]=(4194303&a)<<4|i>>>22,i=a}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},x.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(b,y),i(_,y),i(w,y),w.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new x;else if("p224"===t)e=new b;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new w}return v[t]=e,e},T.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},T.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},T.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},T.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},T.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)},T.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},T.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)},T.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},T.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},T.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},T.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},T.prototype.isqr=function(t){return this.imul(t,t.clone())},T.prototype.sqr=function(t){return this.mul(t,t)},T.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var s=new a(1).toRed(this),l=s.redNeg(),c=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new a(2*u*u).toRed(this);0!==this.pow(u,c).cmp(l);)u.redIAdd(l);for(var f=this.pow(u,i),h=this.pow(t,i.addn(1).iushrn(1)),p=this.pow(t,i),d=o;0!==p.cmp(s);){for(var m=p,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g<d);var v=this.pow(f,new a(1).iushln(d-g-1));h=h.redMul(v),f=v.redSqr(),p=p.redMul(f),d=g}return h},T.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},T.prototype.pow=function(t,e){if(e.isZero())return new a(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new a(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],o=0,s=0,l=e.bitLength()%26;for(0===l&&(l=26),n=e.length-1;n>=0;n--){for(var c=e.words[n],u=l-1;u>=0;u--){var f=c>>u&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==o?(o<<=1,o|=f,(4===++s||0===n&&0===u)&&(i=this.mul(i,r[o]),s=0,o=0)):s=0}l=26}return i},T.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},T.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new M(t)},i(M,T),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())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).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(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)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}("undefined"==typeof e||e,this)},{buffer:76}],68:[function(t,e,r){"use strict";e.exports=function(t){var e,r,n,i=t.length,a=0;for(e=0;e<i;++e)a+=t[e].length;var o=new Array(a),s=0;for(e=0;e<i;++e){var l=t[e],c=l.length;for(r=0;r<c;++r){var u=o[s++]=new Array(c-1),f=0;for(n=0;n<c;++n)n!==r&&(u[f++]=l[n]);if(1&r){var h=u[1];u[1]=u[0],u[0]=h}}}return o}},{}],69:[function(t,e,r){"use strict";e.exports=function(t,e,r){switch(arguments.length){case 1:return f(t);case 2:return"function"==typeof e?c(t,t,e,!0):h(t,e);case 3:return c(t,e,r,!1);default:throw new Error("box-intersect: Invalid arguments")}};var n,i=t("typedarray-pool"),a=t("./lib/sweep"),o=t("./lib/intersect");function s(t,e){for(var r=0;r<t;++r)if(!(e[r]<=e[r+t]))return!0;return!1}function l(t,e,r,n){for(var i=0,a=0,o=0,l=t.length;o<l;++o){var c=t[o];if(!s(e,c)){for(var u=0;u<2*e;++u)r[i++]=c[u];n[a++]=o}}return a}function c(t,e,r,n){var s=t.length,c=e.length;if(!(s<=0||c<=0)){var u=t[0].length>>>1;if(!(u<=0)){var f,h=i.mallocDouble(2*u*s),p=i.mallocInt32(s);if((s=l(t,u,h,p))>0){if(1===u&&n)a.init(s),f=a.sweepComplete(u,r,0,s,h,p,0,s,h,p);else{var d=i.mallocDouble(2*u*c),m=i.mallocInt32(c);(c=l(e,u,d,m))>0&&(a.init(s+c),f=1===u?a.sweepBipartite(u,r,0,s,h,p,0,c,d,m):o(u,r,n,s,h,p,c,d,m),i.free(d),i.free(m))}i.free(h),i.free(p)}return f}}}function u(t,e){n.push([t,e])}function f(t){return n=[],c(t,t,u,!0),n}function h(t,e){return n=[],c(t,e,u,!1),n}},{"./lib/intersect":71,"./lib/sweep":75,"typedarray-pool":1531}],70:[function(t,e,r){"use strict";var n=["d","ax","vv","rs","re","rb","ri","bs","be","bb","bi"];function i(t){var e="bruteForce"+(t?"Full":"Partial"),r=[],i=n.slice();t||i.splice(3,0,"fp");var a=["function "+e+"("+i.join()+"){"];function o(e,i){var o=function(t,e,r){var i="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),a=["function ",i,"(",n.join(),"){","var ","es","=2*","d",";"],o="for(var i=rs,rp=es*rs;i<re;++i,rp+=es){var x0=rb[ax+rp],x1=rb[ax+rp+d],xi=ri[i];",s="for(var j=bs,bp=es*bs;j<be;++j,bp+=es){var y0=bb[ax+bp],"+(r?"y1=bb[ax+bp+d],":"")+"yi=bi[j];";return t?a.push(o,"Q",":",s):a.push(s,"Q",":",o),r?a.push("if(y1<x0||x1<y0)continue;"):e?a.push("if(y0<=x0||x1<y0)continue;"):a.push("if(y0<x0||x1<y0)continue;"),a.push("for(var k=ax+1;k<d;++k){var r0=rb[k+rp],r1=rb[k+d+rp],b0=bb[k+bp],b1=bb[k+d+bp];if(r1<b0||b1<r0)continue Q;}var rv=vv("),e?a.push("yi,xi"):a.push("xi,yi"),a.push(");if(rv!==void 0)return rv;}}}"),{name:i,code:a.join("")}}(e,i,t);r.push(o.code),a.push("return "+o.name+"("+n.join()+");")}a.push("if(re-rs>be-bs){"),t?(o(!0,!1),a.push("}else{"),o(!1,!1)):(a.push("if(fp){"),o(!0,!0),a.push("}else{"),o(!0,!1),a.push("}}else{if(fp){"),o(!1,!0),a.push("}else{"),o(!1,!1),a.push("}")),a.push("}}return "+e);var s=r.join("")+a.join("");return new Function(s)()}r.partial=i(!1),r.full=i(!0)},{}],71:[function(t,e,r){"use strict";e.exports=function(t,e,r,a,u,w,T,M,k){!function(t,e){var r=8*i.log2(e+1)*(t+1)|0,a=i.nextPow2(6*r);v.length<a&&(n.free(v),v=n.mallocInt32(a));var o=i.nextPow2(2*r);y.length<o&&(n.free(y),y=n.mallocDouble(o))}(t,a+T);var A,S=0,E=2*t;x(S++,0,0,a,0,T,r?16:0,-1/0,1/0),r||x(S++,0,0,T,0,a,1,-1/0,1/0);for(;S>0;){var C=6*(S-=1),L=v[C],P=v[C+1],I=v[C+2],O=v[C+3],z=v[C+4],D=v[C+5],N=2*S,R=y[N],F=y[N+1],B=1&D,j=!!(16&D),U=u,V=w,q=M,H=k;if(B&&(U=M,V=k,q=u,H=w),!(2&D&&(I=p(t,L,P,I,U,V,F),P>=I)||4&D&&(P=d(t,L,P,I,U,V,R))>=I)){var G=I-P,Y=z-O;if(j){if(t*G*(G+Y)<1<<22){if(void 0!==(A=l.scanComplete(t,L,e,P,I,U,V,O,z,q,H)))return A;continue}}else{if(t*Math.min(G,Y)<128){if(void 0!==(A=o(t,L,e,B,P,I,U,V,O,z,q,H)))return A;continue}if(t*G*Y<1<<22){if(void 0!==(A=l.scanBipartite(t,L,e,B,P,I,U,V,O,z,q,H)))return A;continue}}var W=f(t,L,P,I,U,V,R,F);if(P<W)if(t*(W-P)<128){if(void 0!==(A=s(t,L+1,e,P,W,U,V,O,z,q,H)))return A}else if(L===t-2){if(void 0!==(A=B?l.sweepBipartite(t,e,O,z,q,H,P,W,U,V):l.sweepBipartite(t,e,P,W,U,V,O,z,q,H)))return A}else x(S++,L+1,P,W,O,z,B,-1/0,1/0),x(S++,L+1,O,z,P,W,1^B,-1/0,1/0);if(W<I){var Z=c(t,L,O,z,q,H),X=q[E*Z+L],J=h(t,L,Z,z,q,H,X);if(J<z&&x(S++,L,W,I,J,z,(4|B)+(j?16:0),X,F),O<Z&&x(S++,L,W,I,O,Z,(2|B)+(j?16:0),R,X),Z+1===J){if(void 0!==(A=j?_(t,L,e,W,I,U,V,Z,q,H[Z]):b(t,L,e,B,W,I,U,V,Z,q,H[Z])))return A}else if(Z<J){var K;if(j){if(K=m(t,L,W,I,U,V,X),W<K){var $=h(t,L,W,K,U,V,X);if(L===t-2){if(W<$&&void 0!==(A=l.sweepComplete(t,e,W,$,U,V,Z,J,q,H)))return A;if($<K&&void 0!==(A=l.sweepBipartite(t,e,$,K,U,V,Z,J,q,H)))return A}else W<$&&x(S++,L+1,W,$,Z,J,16,-1/0,1/0),$<K&&(x(S++,L+1,$,K,Z,J,0,-1/0,1/0),x(S++,L+1,Z,J,$,K,1,-1/0,1/0))}}else K=B?g(t,L,W,I,U,V,X):m(t,L,W,I,U,V,X),W<K&&(L===t-2?A=B?l.sweepBipartite(t,e,Z,J,q,H,W,K,U,V):l.sweepBipartite(t,e,W,K,U,V,Z,J,q,H):(x(S++,L+1,W,K,Z,J,B,-1/0,1/0),x(S++,L+1,Z,J,W,K,1^B,-1/0,1/0)))}}}}};var n=t("typedarray-pool"),i=t("bit-twiddle"),a=t("./brute"),o=a.partial,s=a.full,l=t("./sweep"),c=t("./median"),u=t("./partition"),f=u("!(lo>=p0)&&!(p1>=hi)",["p0","p1"]),h=u("lo===p0",["p0"]),p=u("lo<p0",["p0"]),d=u("hi<=p0",["p0"]),m=u("lo<=p0&&p0<=hi",["p0"]),g=u("lo<p0&&p0<=hi",["p0"]),v=n.mallocInt32(1024),y=n.mallocDouble(1024);function x(t,e,r,n,i,a,o,s,l){var c=6*t;v[c]=e,v[c+1]=r,v[c+2]=n,v[c+3]=i,v[c+4]=a,v[c+5]=o;var u=2*t;y[u]=s,y[u+1]=l}function b(t,e,r,n,i,a,o,s,l,c,u){var f=2*t,h=l*f,p=c[h+e];t:for(var d=i,m=i*f;d<a;++d,m+=f){var g=o[m+e],v=o[m+e+t];if(!(p<g||v<p)&&(!n||p!==g)){for(var y,x=s[d],b=e+1;b<t;++b){g=o[m+b],v=o[m+b+t];var _=c[h+b],w=c[h+b+t];if(v<_||w<g)continue t}if(void 0!==(y=n?r(u,x):r(x,u)))return y}}}function _(t,e,r,n,i,a,o,s,l,c){var u=2*t,f=s*u,h=l[f+e];t:for(var p=n,d=n*u;p<i;++p,d+=u){var m=o[p];if(m!==c){var g=a[d+e],v=a[d+e+t];if(!(h<g||v<h)){for(var y=e+1;y<t;++y){g=a[d+y],v=a[d+y+t];var x=l[f+y],b=l[f+y+t];if(v<x||b<g)continue t}var _=r(m,c);if(void 0!==_)return _}}}}},{"./brute":70,"./median":72,"./partition":73,"./sweep":75,"bit-twiddle":65,"typedarray-pool":1531}],72:[function(t,e,r){"use strict";e.exports=function(t,e,r,a,o,s){if(a<=r+1)return r;var l=r,c=a,u=a+r>>>1,f=2*t,h=u,p=o[f*u+e];for(;l<c;){if(c-l<8){i(t,e,l,c,o,s),p=o[f*u+e];break}var d=c-l,m=Math.random()*d+l|0,g=o[f*m+e],v=Math.random()*d+l|0,y=o[f*v+e],x=Math.random()*d+l|0,b=o[f*x+e];g<=y?b>=y?(h=v,p=y):g>=b?(h=m,p=g):(h=x,p=b):y>=b?(h=v,p=y):b>=g?(h=m,p=g):(h=x,p=b);for(var _=f*(c-1),w=f*h,T=0;T<f;++T,++_,++w){var M=o[_];o[_]=o[w],o[w]=M}var k=s[c-1];s[c-1]=s[h],s[h]=k,h=n(t,e,l,c-1,o,s,p);for(_=f*(c-1),w=f*h,T=0;T<f;++T,++_,++w){M=o[_];o[_]=o[w],o[w]=M}k=s[c-1];if(s[c-1]=s[h],s[h]=k,u<h){for(c=h-1;l<c&&o[f*(c-1)+e]===p;)c-=1;c+=1}else{if(!(h<u))break;for(l=h+1;l<c&&o[f*l+e]===p;)l+=1}}return n(t,e,r,u,o,s,o[f*u+e])};var n=t("./partition")("lo<p0",["p0"]);function i(t,e,r,n,i,a){for(var o=2*t,s=o*(r+1)+e,l=r+1;l<n;++l,s+=o)for(var c=i[s],u=l,f=o*(l-1);u>r&&i[f+e]>c;--u,f-=o){for(var h=f,p=f+o,d=0;d<o;++d,++h,++p){var m=i[h];i[h]=i[p],i[p]=m}var g=a[u];a[u]=a[u-1],a[u-1]=g}}},{"./partition":73}],73:[function(t,e,r){"use strict";e.exports=function(t,e){var r="abcdef".split("").concat(e),n=[];t.indexOf("lo")>=0&&n.push("lo=e[k+n]");t.indexOf("hi")>=0&&n.push("hi=e[k+o]");return r.push("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".replace("_",n.join()).replace("$",t)),Function.apply(void 0,r)}},{}],74:[function(t,e,r){"use strict";e.exports=function(t,e){e<=128?n(0,e-1,t):function t(e,r,u){var f=(r-e+1)/6|0,h=e+f,p=r-f,d=e+r>>1,m=d-f,g=d+f,v=h,y=m,x=d,b=g,_=p,w=e+1,T=r-1,M=0;l(v,y,u)&&(M=v,v=y,y=M);l(b,_,u)&&(M=b,b=_,_=M);l(v,x,u)&&(M=v,v=x,x=M);l(y,x,u)&&(M=y,y=x,x=M);l(v,b,u)&&(M=v,v=b,b=M);l(x,b,u)&&(M=x,x=b,b=M);l(y,_,u)&&(M=y,y=_,_=M);l(y,x,u)&&(M=y,y=x,x=M);l(b,_,u)&&(M=b,b=_,_=M);for(var k=u[2*y],A=u[2*y+1],S=u[2*b],E=u[2*b+1],C=2*v,L=2*x,P=2*_,I=2*h,O=2*d,z=2*p,D=0;D<2;++D){var N=u[C+D],R=u[L+D],F=u[P+D];u[I+D]=N,u[O+D]=R,u[z+D]=F}a(m,e,u),a(g,r,u);for(var B=w;B<=T;++B)if(c(B,k,A,u))B!==w&&i(B,w,u),++w;else if(!c(B,S,E,u))for(;;){if(c(T,S,E,u)){c(T,k,A,u)?(o(B,w,T,u),++w,--T):(i(B,T,u),--T);break}if(--T<B)break}s(e,w-1,k,A,u),s(r,T+1,S,E,u),w-2-e<=32?n(e,w-2,u):t(e,w-2,u);r-(T+2)<=32?n(T+2,r,u):t(T+2,r,u);T-w<=32?n(w,T,u):t(w,T,u)}(0,e-1,t)};function n(t,e,r){for(var n=2*(t+1),i=t+1;i<=e;++i){for(var a=r[n++],o=r[n++],s=i,l=n-2;s-- >t;){var c=r[l-2],u=r[l-1];if(c<a)break;if(c===a&&u<o)break;r[l]=c,r[l+1]=u,l-=2}r[l]=a,r[l+1]=o}}function i(t,e,r){e*=2;var n=r[t*=2],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){e*=2,r[t*=2]=r[e],r[t+1]=r[e+1]}function o(t,e,r,n){e*=2,r*=2;var i=n[t*=2],a=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]=a}function s(t,e,r,n,i){e*=2,i[t*=2]=i[e],i[e]=r,i[t+1]=i[e+1],i[e+1]=n}function l(t,e,r){e*=2;var n=r[t*=2],i=r[e];return!(n<i)&&(n!==i||r[t+1]>r[e+1])}function c(t,e,r,n){var i=n[t*=2];return i<e||i===e&&n[t+1]<r}},{}],75:[function(t,e,r){"use strict";e.exports={init:function(t){var e=i.nextPow2(t);o.length<e&&(n.free(o),o=n.mallocInt32(e));s.length<e&&(n.free(s),s=n.mallocInt32(e));l.length<e&&(n.free(l),l=n.mallocInt32(e));c.length<e&&(n.free(c),c=n.mallocInt32(e));u.length<e&&(n.free(u),u=n.mallocInt32(e));f.length<e&&(n.free(f),f=n.mallocInt32(e));var r=8*e;h.length<r&&(n.free(h),h=n.mallocDouble(r))},sweepBipartite:function(t,e,r,n,i,u,f,m,g,v){for(var y=0,x=2*t,b=t-1,_=x-1,w=r;w<n;++w){var T=u[w],M=x*w;h[y++]=i[M+b],h[y++]=-(T+1),h[y++]=i[M+_],h[y++]=T}for(w=f;w<m;++w){T=v[w]+(1<<28);var k=x*w;h[y++]=g[k+b],h[y++]=-T,h[y++]=g[k+_],h[y++]=T}var A=y>>>1;a(h,A);var S=0,E=0;for(w=0;w<A;++w){var C=0|h[2*w+1];if(C>=1<<28)p(l,c,E--,C=C-(1<<28)|0);else if(C>=0)p(o,s,S--,C);else if(C<=-(1<<28)){C=-C-(1<<28)|0;for(var L=0;L<S;++L){if(void 0!==(P=e(o[L],C)))return P}d(l,c,E++,C)}else{C=-C-1|0;for(L=0;L<E;++L){var P;if(void 0!==(P=e(C,l[L])))return P}d(o,s,S++,C)}}},sweepComplete:function(t,e,r,n,i,m,g,v,y,x){for(var b=0,_=2*t,w=t-1,T=_-1,M=r;M<n;++M){var k=m[M]+1<<1,A=_*M;h[b++]=i[A+w],h[b++]=-k,h[b++]=i[A+T],h[b++]=k}for(M=g;M<v;++M){k=x[M]+1<<1;var S=_*M;h[b++]=y[S+w],h[b++]=1|-k,h[b++]=y[S+T],h[b++]=1|k}var E=b>>>1;a(h,E);var C=0,L=0,P=0;for(M=0;M<E;++M){var I=0|h[2*M+1],O=1&I;if(M<E-1&&I>>1==h[2*M+3]>>1&&(O=2,M+=1),I<0){for(var z=-(I>>1)-1,D=0;D<P;++D){if(void 0!==(N=e(u[D],z)))return N}if(0!==O)for(D=0;D<C;++D){if(void 0!==(N=e(o[D],z)))return N}if(1!==O)for(D=0;D<L;++D){var N;if(void 0!==(N=e(l[D],z)))return N}0===O?d(o,s,C++,z):1===O?d(l,c,L++,z):2===O&&d(u,f,P++,z)}else{z=(I>>1)-1;0===O?p(o,s,C--,z):1===O?p(l,c,L--,z):2===O&&p(u,f,P--,z)}}},scanBipartite:function(t,e,r,n,i,l,c,u,f,m,g,v){var y=0,x=2*t,b=e,_=e+t,w=1,T=1;n?T=1<<28:w=1<<28;for(var M=i;M<l;++M){var k=M+w,A=x*M;h[y++]=c[A+b],h[y++]=-k,h[y++]=c[A+_],h[y++]=k}for(M=f;M<m;++M){k=M+T;var S=x*M;h[y++]=g[S+b],h[y++]=-k}var E=y>>>1;a(h,E);var C=0;for(M=0;M<E;++M){var L=0|h[2*M+1];if(L<0){var P=!1;if((k=-L)>=1<<28?(P=!n,k-=1<<28):(P=!!n,k-=1),P)d(o,s,C++,k);else{var I=v[k],O=x*k,z=g[O+e+1],D=g[O+e+1+t];t:for(var N=0;N<C;++N){var R=o[N],F=x*R;if(!(D<c[F+e+1]||c[F+e+1+t]<z)){for(var B=e+2;B<t;++B)if(g[O+B+t]<c[F+B]||c[F+B+t]<g[O+B])continue t;var j,U=u[R];if(void 0!==(j=n?r(I,U):r(U,I)))return j}}}}else p(o,s,C--,L-w)}},scanComplete:function(t,e,r,n,i,s,l,c,u,f,p){for(var d=0,m=2*t,g=e,v=e+t,y=n;y<i;++y){var x=y+(1<<28),b=m*y;h[d++]=s[b+g],h[d++]=-x,h[d++]=s[b+v],h[d++]=x}for(y=c;y<u;++y){x=y+1;var _=m*y;h[d++]=f[_+g],h[d++]=-x}var w=d>>>1;a(h,w);var T=0;for(y=0;y<w;++y){var M=0|h[2*y+1];if(M<0){if((x=-M)>=1<<28)o[T++]=x-(1<<28);else{var k=p[x-=1],A=m*x,S=f[A+e+1],E=f[A+e+1+t];t:for(var C=0;C<T;++C){var L=o[C],P=l[L];if(P===k)break;var I=m*L;if(!(E<s[I+e+1]||s[I+e+1+t]<S)){for(var O=e+2;O<t;++O)if(f[A+O+t]<s[I+O]||s[I+O+t]<f[A+O])continue t;var z=r(P,k);if(void 0!==z)return z}}}}else{for(x=M-(1<<28),C=T-1;C>=0;--C)if(o[C]===x){for(O=C+1;O<T;++O)o[O-1]=o[O];break}--T}}}};var n=t("typedarray-pool"),i=t("bit-twiddle"),a=t("./sort"),o=n.mallocInt32(1024),s=n.mallocInt32(1024),l=n.mallocInt32(1024),c=n.mallocInt32(1024),u=n.mallocInt32(1024),f=n.mallocInt32(1024),h=n.mallocDouble(8192);function p(t,e,r,n){var i=e[n],a=t[r-1];t[i]=a,e[a]=i}function d(t,e,r,n){t[r]=n,e[n]=r}},{"./sort":74,"bit-twiddle":65,"typedarray-pool":1531}],76:[function(t,e,r){},{}],77:[function(t,e,r){arguments[4][76][0].apply(r,arguments)},{dup:76}],78:[function(t,e,r){(function(e){(function(){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
"use strict";var e=t("base64-js"),n=t("ieee754");r.Buffer=a,r.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},r.INSPECT_MAX_BYTES=50;function i(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=a.prototype,e}function a(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return o(t,e,r)}function o(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|f(t,e),n=i(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(F(t,ArrayBuffer)||t&&F(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r);return n.__proto__=a.prototype,n}(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return a.from(n,e,r);var o=function(t){if(a.isBuffer(t)){var e=0|u(t.length),r=i(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||B(t.length)?i(0):c(t);if("Buffer"===t.type&&Array.isArray(t.data))return c(t.data)}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function s(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function l(t){return s(t),i(t<0?0:0|u(t))}function c(t){for(var e=t.length<0?0:0|u(t.length),r=i(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function u(t){if(t>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function f(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||F(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return D(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return N(t).length;default:if(i)return n?-1:D(t).length;e=(""+e).toLowerCase(),i=!0}}function h(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return A(this,e,r);case"utf8":case"utf-8":return T(this,e,r);case"ascii":return M(this,e,r);case"latin1":case"binary":return k(this,e,r);case"base64":return w(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function d(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),B(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,i){var a,o=1,s=t.length,l=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,s/=2,l/=2,r/=2}function c(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i){var u=-1;for(a=r;a<s;a++)if(c(t,a)===c(e,-1===u?0:a-u)){if(-1===u&&(u=a),a-u+1===l)return u*o}else-1!==u&&(a-=a-u),u=-1}else for(r+l>s&&(r=s-l),a=r;a>=0;a--){for(var f=!0,h=0;h<l;h++)if(c(t,a+h)!==c(e,h)){f=!1;break}if(f)return a}return-1}function g(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=e.length;n>a/2&&(n=a/2);for(var o=0;o<n;++o){var s=parseInt(e.substr(2*o,2),16);if(B(s))return o;t[r+o]=s}return o}function v(t,e,r,n){return R(D(e,t.length-r),t,r,n)}function y(t,e,r,n){return R(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function x(t,e,r,n){return y(t,e,r,n)}function b(t,e,r,n){return R(N(e),t,r,n)}function _(t,e,r,n){return R(function(t,e){for(var r,n,i,a=[],o=0;o<t.length&&!((e-=2)<0);++o)r=t.charCodeAt(o),n=r>>8,i=r%256,a.push(i),a.push(n);return a}(e,t.length-r),t,r,n)}function w(t,r,n){return 0===r&&n===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,n))}function T(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var a,o,s,l,c=t[i],u=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=r)switch(f){case 1:c<128&&(u=c);break;case 2:128==(192&(a=t[i+1]))&&(l=(31&c)<<6|63&a)>127&&(u=l);break;case 3:a=t[i+1],o=t[i+2],128==(192&a)&&128==(192&o)&&(l=(15&c)<<12|(63&a)<<6|63&o)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:a=t[i+1],o=t[i+2],s=t[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(l=(15&c)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&l<1114112&&(u=l)}null===u?(u=65533,f=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),i+=f}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}r.kMaxLength=2147483647,a.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),a.poolSize=8192,a.from=function(t,e,r){return o(t,e,r)},a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,a.alloc=function(t,e,r){return function(t,e,r){return s(t),t<=0?i(t):void 0!==e?"string"==typeof r?i(t).fill(e,r):i(t).fill(e):i(t)}(t,e,r)},a.allocUnsafe=function(t){return l(t)},a.allocUnsafeSlow=function(t){return l(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==a.prototype},a.compare=function(t,e){if(F(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),F(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=a.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(F(o,Uint8Array)&&(o=a.from(o)),!a.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},a.byteLength=f,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)p(this,e,e+1);return this},a.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)p(this,e,e+3),p(this,e+1,e+2);return this},a.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)p(this,e,e+7),p(this,e+1,e+6),p(this,e+2,e+5),p(this,e+3,e+4);return this},a.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?T(this,0,t):h.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"},a.prototype.compare=function(t,e,r,n,i){if(F(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),l=Math.min(o,s),c=this.slice(n,i),u=t.slice(e,r),f=0;f<l;++f)if(c[f]!==u[f]){o=c[f],s=u[f];break}return o<s?-1:s<o?1:0},a.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return d(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return d(this,t,e,r,!1)},a.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))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return g(this,t,e,r);case"utf8":case"utf-8":return v(this,t,e,r);case"ascii":return y(this,t,e,r);case"latin1":case"binary":return x(this,t,e,r);case"base64":return b(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function M(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function k(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function A(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=e;a<r;++a)i+=z(t[a]);return i}function S(t,e,r){for(var n=t.slice(e,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}function E(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function C(t,e,r,n,i,o){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function L(t,e,r,n,i,a){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function P(t,e,r,i,a){return e=+e,r>>>=0,a||L(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function I(t,e,r,i,a){return e=+e,r>>>=0,a||L(t,0,r,8),n.write(t,e,r,i,52,8),r+8}a.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return n.__proto__=a.prototype,n},a.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||E(t,e,this.length);for(var n=this[t],i=1,a=0;++a<e&&(i*=256);)n+=this[t+a]*i;return n},a.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||E(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},a.prototype.readUInt8=function(t,e){return t>>>=0,e||E(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||E(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||E(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||E(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||E(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||E(t,e,this.length);for(var n=this[t],i=1,a=0;++a<e&&(i*=256);)n+=this[t+a]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||E(t,e,this.length);for(var n=e,i=1,a=this[t+--n];n>0&&(i*=256);)a+=this[t+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*e)),a},a.prototype.readInt8=function(t,e){return t>>>=0,e||E(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||E(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||E(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||E(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||E(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return t>>>=0,e||E(t,4,this.length),n.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||E(t,4,this.length),n.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||E(t,8,this.length),n.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||E(t,8,this.length),n.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||C(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,a=0;for(this[e]=255&t;++a<r&&(i*=256);)this[e+a]=t/i&255;return e+r},a.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||C(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,a=1;for(this[e+i]=255&t;--i>=0&&(a*=256);)this[e+i]=t/a&255;return e+r},a.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);C(this,t,e,r,i-1,-i)}var a=0,o=1,s=0;for(this[e]=255&t;++a<r&&(o*=256);)t<0&&0===s&&0!==this[e+a-1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);C(this,t,e,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeFloatLE=function(t,e,r){return P(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return P(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return I(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return I(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,n){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)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=n-r;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(e,r,n);else if(this===t&&r<e&&e<n)for(var o=i-1;o>=0;--o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return i},a.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=a.isBuffer(t)?t:a.from(t,n),l=s.length;if(0===l)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=s[o%l]}return this};var O=/[^+/0-9A-Za-z-_]/g;function z(t){return t<16?"0"+t.toString(16):t.toString(16)}function D(t,e){var r;e=e||1/0;for(var n=t.length,i=null,a=[],o=0;o<n;++o){if((r=t.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function N(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(O,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function R(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function F(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function B(t){return t!=t}}).call(this)}).call(this,t("buffer").Buffer)},{"base64-js":47,buffer:78,ieee754:402}],79:[function(t,e,r){"use strict";var n=t("./lib/monotone"),i=t("./lib/triangulation"),a=t("./lib/delaunay"),o=t("./lib/filter");function s(t){return[Math.min(t[0],t[1]),Math.max(t[0],t[1])]}function l(t,e){return t[0]-e[0]||t[1]-e[1]}function c(t,e,r){return e in t?t[e]:r}e.exports=function(t,e,r){Array.isArray(e)?(r=r||{},e=e||[]):(r=e||{},e=[]);var u=!!c(r,"delaunay",!0),f=!!c(r,"interior",!0),h=!!c(r,"exterior",!0),p=!!c(r,"infinity",!1);if(!f&&!h||0===t.length)return[];var d=n(t,e);if(u||f!==h||p){for(var m=i(t.length,function(t){return t.map(s).sort(l)}(e)),g=0;g<d.length;++g){var v=d[g];m.addTriangle(v[0],v[1],v[2])}return u&&a(t,m),h?f?p?o(m,0,p):m.cells():o(m,1,p):o(m,-1)}return d}},{"./lib/delaunay":80,"./lib/filter":81,"./lib/monotone":82,"./lib/triangulation":83}],80:[function(t,e,r){"use strict";var n=t("robust-in-sphere")[4];t("binary-search-bounds");function i(t,e,r,i,a,o){var s=e.opposite(i,a);if(!(s<0)){if(a<i){var l=i;i=a,a=l,l=o,o=s,s=l}e.isConstraint(i,a)||n(t[i],t[a],t[o],t[s])<0&&r.push(i,a)}}e.exports=function(t,e){for(var r=[],a=t.length,o=e.stars,s=0;s<a;++s)for(var l=o[s],c=1;c<l.length;c+=2){if(!((p=l[c])<s)&&!e.isConstraint(s,p)){for(var u=l[c-1],f=-1,h=1;h<l.length;h+=2)if(l[h-1]===p){f=l[h];break}f<0||n(t[s],t[p],t[u],t[f])<0&&r.push(s,p)}}for(;r.length>0;){for(var p=r.pop(),d=(s=r.pop(),u=-1,f=-1,l=o[s],1);d<l.length;d+=2){var m=l[d-1],g=l[d];m===p?f=g:g===p&&(u=m)}u<0||f<0||(n(t[s],t[p],t[u],t[f])>=0||(e.flip(s,p),i(t,e,r,u,s,f),i(t,e,r,s,f,u),i(t,e,r,f,p,u),i(t,e,r,p,u,f)))}}},{"binary-search-bounds":64,"robust-in-sphere":1483}],81:[function(t,e,r){"use strict";var n,i=t("binary-search-bounds");function a(t,e,r,n,i,a,o){this.cells=t,this.neighbor=e,this.flags=n,this.constraint=r,this.active=i,this.next=a,this.boundary=o}function o(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}e.exports=function(t,e,r){var n=function(t,e){for(var r=t.cells(),n=r.length,i=0;i<n;++i){var s=(v=r[i])[0],l=v[1],c=v[2];l<c?l<s&&(v[0]=l,v[1]=c,v[2]=s):c<s&&(v[0]=c,v[1]=s,v[2]=l)}r.sort(o);var u=new Array(n);for(i=0;i<u.length;++i)u[i]=0;var f=[],h=[],p=new Array(3*n),d=new Array(3*n),m=null;e&&(m=[]);var g=new a(r,p,d,u,f,h,m);for(i=0;i<n;++i)for(var v=r[i],y=0;y<3;++y){s=v[y],l=v[(y+1)%3];var x=p[3*i+y]=g.locate(l,s,t.opposite(l,s)),b=d[3*i+y]=t.isConstraint(s,l);x<0&&(b?h.push(i):(f.push(i),u[i]=1),e&&m.push([l,s,-1]))}return g}(t,r);if(0===e)return r?n.cells.concat(n.boundary):n.cells;var i=1,s=n.active,l=n.next,c=n.flags,u=n.cells,f=n.constraint,h=n.neighbor;for(;s.length>0||l.length>0;){for(;s.length>0;){var p=s.pop();if(c[p]!==-i){c[p]=i;u[p];for(var d=0;d<3;++d){var m=h[3*p+d];m>=0&&0===c[m]&&(f[3*p+d]?l.push(m):(s.push(m),c[m]=i))}}}var g=l;l=s,s=g,l.length=0,i=-i}var v=function(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}(u,c,e);if(r)return v.concat(n.boundary);return v},a.prototype.locate=(n=[0,0,0],function(t,e,r){var a=t,s=e,l=r;return e<r?e<t&&(a=e,s=r,l=t):r<t&&(a=r,s=t,l=e),a<0?-1:(n[0]=a,n[1]=s,n[2]=l,i.eq(this.cells,n,o))})},{"binary-search-bounds":64}],82:[function(t,e,r){"use strict";var n=t("binary-search-bounds"),i=t("robust-orientation")[3];function a(t,e,r,n,i){this.a=t,this.b=e,this.idx=r,this.lowerIds=n,this.upperIds=i}function o(t,e,r,n){this.a=t,this.b=e,this.type=r,this.idx=n}function s(t,e){var r=t.a[0]-e.a[0]||t.a[1]-e.a[1]||t.type-e.type;return r||(0!==t.type&&(r=i(t.a,t.b,e.b))?r:t.idx-e.idx)}function l(t,e){return i(t.a,t.b,e)}function c(t,e,r,a,o){for(var s=n.lt(e,a,l),c=n.gt(e,a,l),u=s;u<c;++u){for(var f=e[u],h=f.lowerIds,p=h.length;p>1&&i(r[h[p-2]],r[h[p-1]],a)>0;)t.push([h[p-1],h[p-2],o]),p-=1;h.length=p,h.push(o);var d=f.upperIds;for(p=d.length;p>1&&i(r[d[p-2]],r[d[p-1]],a)<0;)t.push([d[p-2],d[p-1],o]),p-=1;d.length=p,d.push(o)}}function u(t,e){var r;return(r=t.a[0]<e.a[0]?i(t.a,t.b,e.a):i(e.b,e.a,t.a))?r:(r=e.b[0]<t.b[0]?i(t.a,t.b,e.b):i(e.b,e.a,t.b))||t.idx-e.idx}function f(t,e,r){var i=n.le(t,r,u),o=t[i],s=o.upperIds,l=s[s.length-1];o.upperIds=[l],t.splice(i+1,0,new a(r.a,r.b,r.idx,[l],s))}function h(t,e,r){var i=r.a;r.a=r.b,r.b=i;var a=n.eq(t,r,u),o=t[a];t[a-1].upperIds=o.upperIds,t.splice(a,1)}e.exports=function(t,e){for(var r=t.length,n=e.length,i=[],l=0;l<r;++l)i.push(new o(t[l],null,0,l));for(l=0;l<n;++l){var u=e[l],p=t[u[0]],d=t[u[1]];p[0]<d[0]?i.push(new o(p,d,2,l),new o(d,p,1,l)):p[0]>d[0]&&i.push(new o(d,p,2,l),new o(p,d,1,l))}i.sort(s);for(var m=i[0].a[0]-(1+Math.abs(i[0].a[0]))*Math.pow(2,-52),g=[new a([m,1],[m,0],-1,[],[],[],[])],v=[],y=(l=0,i.length);l<y;++l){var x=i[l],b=x.type;0===b?c(v,g,t,x.a,x.idx):2===b?f(g,t,x):h(g,t,x)}return v}},{"binary-search-bounds":64,"robust-orientation":1485}],83:[function(t,e,r){"use strict";var n=t("binary-search-bounds");function i(t,e){this.stars=t,this.edges=e}e.exports=function(t,e){for(var r=new Array(t),n=0;n<t;++n)r[n]=[];return new i(r,e)};var a=i.prototype;function o(t,e,r){for(var n=1,i=t.length;n<i;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)}a.isConstraint=function(){var t=[0,0];function e(t,e){return t[0]-e[0]||t[1]-e[1]}return function(r,i){return t[0]=Math.min(r,i),t[1]=Math.max(r,i),n.eq(this.edges,t,e)>=0}}(),a.removeTriangle=function(t,e,r){var n=this.stars;o(n[t],e,r),o(n[e],r,t),o(n[r],t,e)},a.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r),n[e].push(r,t),n[r].push(t,e)},a.opposite=function(t,e){for(var r=this.stars[e],n=1,i=r.length;n<i;n+=2)if(r[n]===t)return r[n-1];return-1},a.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)},a.edges=function(){for(var t=this.stars,e=[],r=0,n=t.length;r<n;++r)for(var i=t[r],a=0,o=i.length;a<o;a+=2)e.push([i[a],i[a+1]]);return e},a.cells=function(){for(var t=this.stars,e=[],r=0,n=t.length;r<n;++r)for(var i=t[r],a=0,o=i.length;a<o;a+=2){var s=i[a],l=i[a+1];r<Math.min(s,l)&&e.push([r,s,l])}return e}},{"binary-search-bounds":64}],84:[function(t,e,r){"use strict";e.exports=function(t){for(var e=1,r=1;r<t.length;++r)for(var n=0;n<r;++n)if(t[r]<t[n])e=-e;else if(t[n]===t[r])return 0;return e}},{}],85:[function(t,e,r){"use strict";var n=t("dup"),i=t("robust-linear-solve");function a(t,e){for(var r=0,n=t.length,i=0;i<n;++i)r+=t[i]*e[i];return r}function o(t){var e=t.length;if(0===e)return[];t[0].length;var r=n([t.length+1,t.length+1],1),o=n([t.length+1],1);r[e][e]=0;for(var s=0;s<e;++s){for(var l=0;l<=s;++l)r[l][s]=r[s][l]=2*a(t[s],t[l]);o[s]=a(t[s],t[s])}var c=i(r,o),u=0,f=c[e+1];for(s=0;s<f.length;++s)u+=f[s];var h=new Array(e);for(s=0;s<e;++s){f=c[s];var p=0;for(l=0;l<f.length;++l)p+=f[l];h[s]=p/u}return h}function s(t){if(0===t.length)return[];for(var e=t[0].length,r=n([e]),i=o(t),a=0;a<t.length;++a)for(var s=0;s<e;++s)r[s]+=t[a][s]*i[a];return r}s.barycenetric=o,e.exports=s},{dup:147,"robust-linear-solve":1484}],86:[function(t,e,r){e.exports=function(t){for(var e=n(t),r=0,i=0;i<t.length;++i)for(var a=t[i],o=0;o<e.length;++o)r+=Math.pow(a[o]-e[o],2);return Math.sqrt(r/t.length)};var n=t("circumcenter")},{circumcenter:85}],87:[function(t,e,r){e.exports=function(t,e,r){return e<r?t<e?e:t>r?r:t:t<r?r:t>e?e:t}},{}],88:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n;if(r){n=e;for(var i=new Array(e.length),a=0;a<e.length;++a){var o=e[a];i[a]=[o[0],o[1],r[a]]}e=i}var s=function(t,e,r){var n=d(t,[],p(t));return v(e,n,r),!!n}(t,e,!!r);for(;y(t,e,!!r);)s=!0;if(r&&s){n.length=0,r.length=0;for(a=0;a<e.length;++a){o=e[a];n.push([o[0],o[1]]),r.push(o[2])}}return s};var n=t("union-find"),i=t("box-intersect"),a=t("robust-segment-intersect"),o=t("big-rat"),s=t("big-rat/cmp"),l=t("big-rat/to-float"),c=t("rat-vec"),u=t("nextafter"),f=t("./lib/rat-seg-intersect");function h(t){var e=l(t);return[u(e,-1/0),u(e,1/0)]}function p(t){for(var e=new Array(t.length),r=0;r<t.length;++r){var n=t[r];e[r]=[u(n[0],-1/0),u(n[1],-1/0),u(n[0],1/0),u(n[1],1/0)]}return e}function d(t,e,r){for(var a=e.length,o=new n(a),s=[],l=0;l<e.length;++l){var c=e[l],f=h(c[0]),p=h(c[1]);s.push([u(f[0],-1/0),u(p[0],-1/0),u(f[1],1/0),u(p[1],1/0)])}i(s,(function(t,e){o.link(t,e)}));var d=!0,m=new Array(a);for(l=0;l<a;++l){(v=o.find(l))!==l&&(d=!1,t[v]=[Math.min(t[l][0],t[v][0]),Math.min(t[l][1],t[v][1])])}if(d)return null;var g=0;for(l=0;l<a;++l){var v;(v=o.find(l))===l?(m[l]=g,t[g++]=t[l]):m[l]=-1}t.length=g;for(l=0;l<a;++l)m[l]<0&&(m[l]=m[o.find(l)]);return m}function m(t,e){return t[0]-e[0]||t[1]-e[1]}function g(t,e){var r=t[0]-e[0]||t[1]-e[1];return r||(t[2]<e[2]?-1:t[2]>e[2]?1:0)}function v(t,e,r){if(0!==t.length){if(e)for(var n=0;n<t.length;++n){var i=e[(o=t[n])[0]],a=e[o[1]];o[0]=Math.min(i,a),o[1]=Math.max(i,a)}else for(n=0;n<t.length;++n){var o;i=(o=t[n])[0],a=o[1];o[0]=Math.min(i,a),o[1]=Math.max(i,a)}r?t.sort(g):t.sort(m);var s=1;for(n=1;n<t.length;++n){var l=t[n-1],c=t[n];(c[0]!==l[0]||c[1]!==l[1]||r&&c[2]!==l[2])&&(t[s++]=c)}t.length=s}}function y(t,e,r){var n=function(t,e){for(var r=new Array(e.length),n=0;n<e.length;++n){var i=e[n],a=t[i[0]],o=t[i[1]];r[n]=[u(Math.min(a[0],o[0]),-1/0),u(Math.min(a[1],o[1]),-1/0),u(Math.max(a[0],o[0]),1/0),u(Math.max(a[1],o[1]),1/0)]}return r}(t,e),h=function(t,e,r){var n=[];return i(r,(function(r,i){var o=e[r],s=e[i];if(o[0]!==s[0]&&o[0]!==s[1]&&o[1]!==s[0]&&o[1]!==s[1]){var l=t[o[0]],c=t[o[1]],u=t[s[0]],f=t[s[1]];a(l,c,u,f)&&n.push([r,i])}})),n}(t,e,n),m=p(t),g=function(t,e,r,n){var o=[];return i(r,n,(function(r,n){var i=e[r];if(i[0]!==n&&i[1]!==n){var s=t[n],l=t[i[0]],c=t[i[1]];a(l,c,s,s)&&o.push([r,n])}})),o}(t,e,n,m),y=d(t,function(t,e,r,n,i){var a,u,h=t.map((function(t){return[o(t[0]),o(t[1])]}));for(a=0;a<r.length;++a){var p=r[a];u=p[0];var d=p[1],m=e[u],g=e[d],v=f(c(t[m[0]]),c(t[m[1]]),c(t[g[0]]),c(t[g[1]]));if(v){var y=t.length;t.push([l(v[0]),l(v[1])]),h.push(v),n.push([u,y],[d,y])}}for(n.sort((function(t,e){if(t[0]!==e[0])return t[0]-e[0];var r=h[t[1]],n=h[e[1]];return s(r[0],n[0])||s(r[1],n[1])})),a=n.length-1;a>=0;--a){var x=e[u=(S=n[a])[0]],b=x[0],_=x[1],w=t[b],T=t[_];if((w[0]-T[0]||w[1]-T[1])<0){var M=b;b=_,_=M}x[0]=b;var k,A=x[1]=S[1];for(i&&(k=x[2]);a>0&&n[a-1][0]===u;){var S,E=(S=n[--a])[1];i?e.push([A,E,k]):e.push([A,E]),A=E}i?e.push([A,_,k]):e.push([A,_])}return h}(t,e,h,g,r));return v(e,y,r),!!y||(h.length>0||g.length>0)}},{"./lib/rat-seg-intersect":89,"big-rat":51,"big-rat/cmp":49,"big-rat/to-float":63,"box-intersect":69,nextafter:631,"rat-vec":1469,"robust-segment-intersect":1488,"union-find":1532}],89:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var a=s(e,t),f=s(n,r),h=u(a,f);if(0===o(h))return null;var p=s(t,r),d=u(f,p),m=i(d,h),g=c(a,m);return l(t,g)};var n=t("big-rat/mul"),i=t("big-rat/div"),a=t("big-rat/sub"),o=t("big-rat/sign"),s=t("rat-vec/sub"),l=t("rat-vec/add"),c=t("rat-vec/muls");function u(t,e){return a(n(t[0],e[1]),n(t[1],e[0]))}},{"big-rat/div":50,"big-rat/mul":60,"big-rat/sign":61,"big-rat/sub":62,"rat-vec/add":1468,"rat-vec/muls":1470,"rat-vec/sub":1471}],90:[function(t,e,r){"use strict";var n=t("clamp");function i(t,e){null==e&&(e=!0);var r=t[0],i=t[1],a=t[2],o=t[3];return null==o&&(o=e?1:255),e&&(r*=255,i*=255,a*=255,o*=255),16777216*(r=255&n(r,0,255))+((i=255&n(i,0,255))<<16)+((a=255&n(a,0,255))<<8)+(o=255&n(o,0,255))}e.exports=i,e.exports.to=i,e.exports.from=function(t,e){var r=(t=+t)>>>24,n=(16711680&t)>>>16,i=(65280&t)>>>8,a=255&t;return!1===e?[r,n,i,a]:[r/255,n/255,i/255,a/255]}},{clamp:87}],91:[function(t,e,r){"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},{}],92:[function(t,e,r){"use strict";var n=t("color-rgba"),i=t("dtype");e.exports=function(t,e){"float"!==e&&e||(e="array"),"uint"===e&&(e="uint8"),"uint_clamped"===e&&(e="uint8_clamped");var r=new(i(e))(4),a="uint8"!==e&&"uint8_clamped"!==e;return t.length&&"string"!=typeof t||((t=n(t))[0]/=255,t[1]/=255,t[2]/=255),function(t){return t instanceof Uint8Array||t instanceof Uint8ClampedArray||!!(Array.isArray(t)&&(t[0]>1||0===t[0])&&(t[1]>1||0===t[1])&&(t[2]>1||0===t[2])&&(!t[3]||t[3]>1))}(t)?(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=null!=t[3]?t[3]:255,a&&(r[0]/=255,r[1]/=255,r[2]/=255,r[3]/=255),r):(a?(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=null!=t[3]?t[3]:1):(r[0]=Math.min(Math.max(Math.floor(255*t[0]),0),255),r[1]=Math.min(Math.max(Math.floor(255*t[1]),0),255),r[2]=Math.min(Math.max(Math.floor(255*t[2]),0),255),r[3]=null==t[3]?255:Math.min(Math.max(Math.floor(255*t[3]),0),255)),r)}},{"color-rgba":94,dtype:146}],93:[function(t,e,r){"use strict";var n=t("color-name");e.exports=function(t){var e,r,a=[],o=1;if("string"==typeof t)if(n[t])a=n[t].slice(),r="rgb";else if("transparent"===t)o=0,r="rgb",a=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var s=(u=t.slice(1)).length;o=1,s<=4?(a=[parseInt(u[0]+u[0],16),parseInt(u[1]+u[1],16),parseInt(u[2]+u[2],16)],4===s&&(o=parseInt(u[3]+u[3],16)/255)):(a=[parseInt(u[0]+u[1],16),parseInt(u[2]+u[3],16),parseInt(u[4]+u[5],16)],8===s&&(o=parseInt(u[6]+u[7],16)/255)),a[0]||(a[0]=0),a[1]||(a[1]=0),a[2]||(a[2]=0),r="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var l=e[1],c="rgb"===l,u=l.replace(/a$/,"");r=u;s="cmyk"===u?4:"gray"===u?1:3;a=e[2].trim().split(/\s*[,\/]\s*|\s+/).map((function(t,e){if(/%$/.test(t))return e===s?parseFloat(t)/100:"rgb"===u?255*parseFloat(t)/100:parseFloat(t);if("h"===u[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==i[t])return i[t]}return parseFloat(t)})),l===u&&a.push(1),o=c||void 0===a[s]?1:a[s],a=a.slice(0,s)}else t.length>10&&/[0-9](?:\s|\/)/.test(t)&&(a=t.match(/([0-9]+)/g).map((function(t){return parseFloat(t)})),r=t.match(/([a-z])/gi).join("").toLowerCase());else isNaN(t)?Array.isArray(t)||t.length?(a=[t[0],t[1],t[2]],r="rgb",o=4===t.length?t[3]:1):t instanceof Object&&(null!=t.r||null!=t.red||null!=t.R?(r="rgb",a=[t.r||t.red||t.R||0,t.g||t.green||t.G||0,t.b||t.blue||t.B||0]):(r="hsl",a=[t.h||t.hue||t.H||0,t.s||t.saturation||t.S||0,t.l||t.lightness||t.L||t.b||t.brightness]),o=t.a||t.alpha||t.opacity||1,null!=t.opacity&&(o/=100)):(r="rgb",a=[t>>>16,(65280&t)>>>8,255&t]);return{space:r,values:a,alpha:o}};var i={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}},{"color-name":91}],94:[function(t,e,r){"use strict";var n=t("color-parse"),i=t("color-space/hsl");e.exports=function(t){var e;Array.isArray(t)&&t.raw&&(t=String.raw.apply(null,arguments));var r=n(t);return r.space?((e=Array(3))[0]=Math.min(Math.max(r.values[0],0),255),e[1]=Math.min(Math.max(r.values[1],0),255),e[2]=Math.min(Math.max(r.values[2],0),255),"h"===r.space[0]&&(e=i.rgb(e)),e.push(Math.min(Math.max(r.alpha,0),1)),e):[]}},{"color-parse":93,"color-space/hsl":95}],95:[function(t,e,r){"use strict";var n=t("./rgb");e.exports={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(t){var e,r,n,i,a,o=t[0]/360,s=t[1]/100,l=t[2]/100;if(0===s)return[a=255*l,a,a];e=2*l-(r=l<.5?l*(1+s):l+s-l*s),i=[0,0,0];for(var c=0;c<3;c++)(n=o+1/3*-(c-1))<0?n++:n>1&&n--,a=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,i[c]=255*a;return i}},n.hsl=function(t){var e,r,n=t[0]/255,i=t[1]/255,a=t[2]/255,o=Math.min(n,i,a),s=Math.max(n,i,a),l=s-o;return s===o?e=0:n===s?e=(i-a)/l:i===s?e=2+(a-n)/l:a===s&&(e=4+(n-i)/l),(e=Math.min(60*e,360))<0&&(e+=360),r=(o+s)/2,[e,100*(s===o?0:r<=.5?l/(s+o):l/(2-s-o)),100*r]}},{"./rgb":96}],96:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],97:[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]}],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:1,rgb:[255,255,255,1]}],viridis:[{index:0,rgb:[68,1,84]},{index:.13,rgb:[71,44,122]},{index:.25,rgb:[59,81,139]},{index:.38,rgb:[44,113,142]},{index:.5,rgb:[33,144,141]},{index:.63,rgb:[39,173,129]},{index:.75,rgb:[92,200,99]},{index:.88,rgb:[170,220,50]},{index:1,rgb:[253,231,37]}],inferno:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[31,12,72]},{index:.25,rgb:[85,15,109]},{index:.38,rgb:[136,34,106]},{index:.5,rgb:[186,54,85]},{index:.63,rgb:[227,89,51]},{index:.75,rgb:[249,140,10]},{index:.88,rgb:[249,201,50]},{index:1,rgb:[252,255,164]}],magma:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[28,16,68]},{index:.25,rgb:[79,18,123]},{index:.38,rgb:[129,37,129]},{index:.5,rgb:[181,54,122]},{index:.63,rgb:[229,80,100]},{index:.75,rgb:[251,135,97]},{index:.88,rgb:[254,194,135]},{index:1,rgb:[252,253,191]}],plasma:[{index:0,rgb:[13,8,135]},{index:.13,rgb:[75,3,161]},{index:.25,rgb:[125,3,168]},{index:.38,rgb:[168,34,150]},{index:.5,rgb:[203,70,121]},{index:.63,rgb:[229,107,93]},{index:.75,rgb:[248,148,65]},{index:.88,rgb:[253,195,40]},{index:1,rgb:[240,249,33]}],warm:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[172,0,187]},{index:.25,rgb:[219,0,170]},{index:.38,rgb:[255,0,130]},{index:.5,rgb:[255,63,74]},{index:.63,rgb:[255,123,0]},{index:.75,rgb:[234,176,0]},{index:.88,rgb:[190,228,0]},{index:1,rgb:[147,255,0]}],cool:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[116,0,218]},{index:.25,rgb:[98,74,237]},{index:.38,rgb:[68,146,231]},{index:.5,rgb:[0,204,197]},{index:.63,rgb:[0,247,146]},{index:.75,rgb:[0,255,88]},{index:.88,rgb:[40,255,8]},{index:1,rgb:[147,255,0]}],"rainbow-soft":[{index:0,rgb:[125,0,179]},{index:.1,rgb:[199,0,180]},{index:.2,rgb:[255,0,121]},{index:.3,rgb:[255,108,0]},{index:.4,rgb:[222,194,0]},{index:.5,rgb:[150,255,0]},{index:.6,rgb:[0,255,55]},{index:.7,rgb:[0,246,150]},{index:.8,rgb:[50,167,222]},{index:.9,rgb:[103,51,235]},{index:1,rgb:[124,0,186]}],bathymetry:[{index:0,rgb:[40,26,44]},{index:.13,rgb:[59,49,90]},{index:.25,rgb:[64,76,139]},{index:.38,rgb:[63,110,151]},{index:.5,rgb:[72,142,158]},{index:.63,rgb:[85,174,163]},{index:.75,rgb:[120,206,163]},{index:.88,rgb:[187,230,172]},{index:1,rgb:[253,254,204]}],cdom:[{index:0,rgb:[47,15,62]},{index:.13,rgb:[87,23,86]},{index:.25,rgb:[130,28,99]},{index:.38,rgb:[171,41,96]},{index:.5,rgb:[206,67,86]},{index:.63,rgb:[230,106,84]},{index:.75,rgb:[242,149,103]},{index:.88,rgb:[249,193,135]},{index:1,rgb:[254,237,176]}],chlorophyll:[{index:0,rgb:[18,36,20]},{index:.13,rgb:[25,63,41]},{index:.25,rgb:[24,91,59]},{index:.38,rgb:[13,119,72]},{index:.5,rgb:[18,148,80]},{index:.63,rgb:[80,173,89]},{index:.75,rgb:[132,196,122]},{index:.88,rgb:[175,221,162]},{index:1,rgb:[215,249,208]}],density:[{index:0,rgb:[54,14,36]},{index:.13,rgb:[89,23,80]},{index:.25,rgb:[110,45,132]},{index:.38,rgb:[120,77,178]},{index:.5,rgb:[120,113,213]},{index:.63,rgb:[115,151,228]},{index:.75,rgb:[134,185,227]},{index:.88,rgb:[177,214,227]},{index:1,rgb:[230,241,241]}],"freesurface-blue":[{index:0,rgb:[30,4,110]},{index:.13,rgb:[47,14,176]},{index:.25,rgb:[41,45,236]},{index:.38,rgb:[25,99,212]},{index:.5,rgb:[68,131,200]},{index:.63,rgb:[114,156,197]},{index:.75,rgb:[157,181,203]},{index:.88,rgb:[200,208,216]},{index:1,rgb:[241,237,236]}],"freesurface-red":[{index:0,rgb:[60,9,18]},{index:.13,rgb:[100,17,27]},{index:.25,rgb:[142,20,29]},{index:.38,rgb:[177,43,27]},{index:.5,rgb:[192,87,63]},{index:.63,rgb:[205,125,105]},{index:.75,rgb:[216,162,148]},{index:.88,rgb:[227,199,193]},{index:1,rgb:[241,237,236]}],oxygen:[{index:0,rgb:[64,5,5]},{index:.13,rgb:[106,6,15]},{index:.25,rgb:[144,26,7]},{index:.38,rgb:[168,64,3]},{index:.5,rgb:[188,100,4]},{index:.63,rgb:[206,136,11]},{index:.75,rgb:[220,174,25]},{index:.88,rgb:[231,215,44]},{index:1,rgb:[248,254,105]}],par:[{index:0,rgb:[51,20,24]},{index:.13,rgb:[90,32,35]},{index:.25,rgb:[129,44,34]},{index:.38,rgb:[159,68,25]},{index:.5,rgb:[182,99,19]},{index:.63,rgb:[199,134,22]},{index:.75,rgb:[212,171,35]},{index:.88,rgb:[221,210,54]},{index:1,rgb:[225,253,75]}],phase:[{index:0,rgb:[145,105,18]},{index:.13,rgb:[184,71,38]},{index:.25,rgb:[186,58,115]},{index:.38,rgb:[160,71,185]},{index:.5,rgb:[110,97,218]},{index:.63,rgb:[50,123,164]},{index:.75,rgb:[31,131,110]},{index:.88,rgb:[77,129,34]},{index:1,rgb:[145,105,18]}],salinity:[{index:0,rgb:[42,24,108]},{index:.13,rgb:[33,50,162]},{index:.25,rgb:[15,90,145]},{index:.38,rgb:[40,118,137]},{index:.5,rgb:[59,146,135]},{index:.63,rgb:[79,175,126]},{index:.75,rgb:[120,203,104]},{index:.88,rgb:[193,221,100]},{index:1,rgb:[253,239,154]}],temperature:[{index:0,rgb:[4,35,51]},{index:.13,rgb:[23,51,122]},{index:.25,rgb:[85,59,157]},{index:.38,rgb:[129,79,143]},{index:.5,rgb:[175,95,130]},{index:.63,rgb:[222,112,101]},{index:.75,rgb:[249,146,66]},{index:.88,rgb:[249,196,65]},{index:1,rgb:[232,250,91]}],turbidity:[{index:0,rgb:[34,31,27]},{index:.13,rgb:[65,50,41]},{index:.25,rgb:[98,69,52]},{index:.38,rgb:[131,89,57]},{index:.5,rgb:[161,112,59]},{index:.63,rgb:[185,140,66]},{index:.75,rgb:[202,174,88]},{index:.88,rgb:[216,209,126]},{index:1,rgb:[233,246,171]}],"velocity-blue":[{index:0,rgb:[17,32,64]},{index:.13,rgb:[35,52,116]},{index:.25,rgb:[29,81,156]},{index:.38,rgb:[31,113,162]},{index:.5,rgb:[50,144,169]},{index:.63,rgb:[87,173,176]},{index:.75,rgb:[149,196,189]},{index:.88,rgb:[203,221,211]},{index:1,rgb:[254,251,230]}],"velocity-green":[{index:0,rgb:[23,35,19]},{index:.13,rgb:[24,64,38]},{index:.25,rgb:[11,95,45]},{index:.38,rgb:[39,123,35]},{index:.5,rgb:[95,146,12]},{index:.63,rgb:[152,165,18]},{index:.75,rgb:[201,186,69]},{index:.88,rgb:[233,216,137]},{index:1,rgb:[255,253,205]}],cubehelix:[{index:0,rgb:[0,0,0]},{index:.07,rgb:[22,5,59]},{index:.13,rgb:[60,4,105]},{index:.2,rgb:[109,1,135]},{index:.27,rgb:[161,0,147]},{index:.33,rgb:[210,2,142]},{index:.4,rgb:[251,11,123]},{index:.47,rgb:[255,29,97]},{index:.53,rgb:[255,54,69]},{index:.6,rgb:[255,85,46]},{index:.67,rgb:[255,120,34]},{index:.73,rgb:[255,157,37]},{index:.8,rgb:[241,191,57]},{index:.87,rgb:[224,220,93]},{index:.93,rgb:[218,241,142]},{index:1,rgb:[227,253,198]}]}},{}],98:[function(t,e,r){"use strict";var n=t("./colorScale"),i=t("lerp");function a(t){return[t[0]/255,t[1]/255,t[2]/255,t[3]]}function o(t){for(var e,r="#",n=0;n<3;++n)r+=("00"+(e=(e=t[n]).toString(16))).substr(e.length);return r}function s(t){return"rgba("+t.join(",")+")"}e.exports=function(t){var e,r,l,c,u,f,h,p,d,m;t||(t={});p=(t.nshades||72)-1,h=t.format||"hex",(f=t.colormap)||(f="jet");if("string"==typeof f){if(f=f.toLowerCase(),!n[f])throw Error(f+" not a supported colorscale");u=n[f]}else{if(!Array.isArray(f))throw Error("unsupported colormap option",f);u=f.slice()}if(u.length>p+1)throw new Error(f+" map requires nshades to be at least size "+u.length);d=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:t.alpha.slice():"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1];e=u.map((function(t){return Math.round(t.index*p)})),d[0]=Math.min(Math.max(d[0],0),1),d[1]=Math.min(Math.max(d[1],0),1);var g=u.map((function(t,e){var r=u[e].index,n=u[e].rgb.slice();return 4===n.length&&n[3]>=0&&n[3]<=1||(n[3]=d[0]+(d[1]-d[0])*r),n})),v=[];for(m=0;m<e.length-1;++m){c=e[m+1]-e[m],r=g[m],l=g[m+1];for(var y=0;y<c;y++){var x=y/c;v.push([Math.round(i(r[0],l[0],x)),Math.round(i(r[1],l[1],x)),Math.round(i(r[2],l[2],x)),i(r[3],l[3],x)])}}v.push(u[u.length-1].rgb.concat(d[1])),"hex"===h?v=v.map(o):"rgbaString"===h?v=v.map(s):"float"===h&&(v=v.map(a));return v}},{"./colorScale":97,lerp:432}],99:[function(t,e,r){"use strict";e.exports=function(t,e,r,a){var o=n(e,r,a);if(0===o){var s=i(n(t,e,r)),c=i(n(t,e,a));if(s===c){if(0===s){var u=l(t,e,r),f=l(t,e,a);return u===f?0:u?1:-1}return 0}return 0===c?s>0||l(t,e,a)?-1:1:0===s?c>0||l(t,e,r)?1:-1:i(c-s)}var h=n(t,e,r);return h>0?o>0&&n(t,e,a)>0?1:-1:h<0?o>0||n(t,e,a)>0?1:-1:n(t,e,a)>0||l(t,e,r)?1:-1};var n=t("robust-orientation"),i=t("signum"),a=t("two-sum"),o=t("robust-product"),s=t("robust-sum");function l(t,e,r){var n=a(t[0],-e[0]),i=a(t[1],-e[1]),l=a(r[0],-e[0]),c=a(r[1],-e[1]),u=s(o(n,l),o(i,c));return u[u.length-1]>=0}},{"robust-orientation":1485,"robust-product":1486,"robust-sum":1490,signum:100,"two-sum":1518}],100:[function(t,e,r){"use strict";e.exports=function(t){return t<0?-1:t>0?1:0}},{}],101:[function(t,e,r){e.exports=function(t,e){var r=t.length,a=t.length-e.length;if(a)return a;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:return t[0]+t[1]-e[0]-e[1]||n(t[0],t[1])-n(e[0],e[1]);case 3:var o=t[0]+t[1],s=e[0]+e[1];if(a=o+t[2]-(s+e[2]))return a;var l=n(t[0],t[1]),c=n(e[0],e[1]);return n(l,t[2])-n(c,e[2])||n(l+t[2],o)-n(c+e[2],s);case 4:var u=t[0],f=t[1],h=t[2],p=t[3],d=e[0],m=e[1],g=e[2],v=e[3];return u+f+h+p-(d+m+g+v)||n(u,f,h,p)-n(d,m,g,v,d)||n(u+f,u+h,u+p,f+h,f+p,h+p)-n(d+m,d+g,d+v,m+g,m+v,g+v)||n(u+f+h,u+f+p,u+h+p,f+h+p)-n(d+m+g,d+m+v,d+g+v,m+g+v);default:for(var y=t.slice().sort(i),x=e.slice().sort(i),b=0;b<r;++b)if(a=y[b]-x[b])return a;return 0}};var n=Math.min;function i(t,e){return t-e}},{}],102:[function(t,e,r){"use strict";var n=t("compare-cell"),i=t("cell-orientation");e.exports=function(t,e){return n(t,e)||i(t)-i(e)}},{"cell-orientation":84,"compare-cell":101}],103:[function(t,e,r){
/**
* @license Complex.js v2.0.3 11/02/2016
*
* Copyright (c) 2016, Robert Eisele (robert@xarg.org)
* Dual licensed under the MIT or GPL Version 2 licenses.
**/
!function(t){"use strict";var n={re:0,im:0},i=function(t){return.5*(Math.exp(t)+Math.exp(-t))},a=function(t){return.5*(Math.exp(t)-Math.exp(-t))},o=function(){throw SyntaxError("Invalid Param")};function s(t,e){var r=Math.abs(t),n=Math.abs(e);return 0===t?Math.log(n):0===e?Math.log(r):r<3e3&&n<3e3?.5*Math.log(t*t+e*e):Math.log(t/Math.cos(Math.atan2(e,t)))}var l=function(t,e){if(null==t)n.re=n.im=0;else if(void 0!==e)n.re=t,n.im=e;else switch(typeof t){case"object":"im"in t&&"re"in t?(n.re=t.re,n.im=t.im):"abs"in t&&"arg"in t?(n.re=t.abs*Math.cos(t.arg),n.im=t.abs*Math.sin(t.arg)):"r"in t&&"phi"in t?(n.re=t.r*Math.cos(t.phi),n.im=t.r*Math.sin(t.phi)):2===t.length?(n.re=t[0],n.im=t[1]):o();break;case"string":n.im=n.re=0;var r=t.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),i=1,a=0;null===r&&o();for(var s=0;s<r.length;s++){var l=r[s];" "===l||"\t"===l||"\n"===l||("+"===l?i++:"-"===l?a++:"i"===l||"I"===l?(i+a===0&&o()," "===r[s+1]||isNaN(r[s+1])?n.im+=parseFloat((a%2?"-":"")+"1"):(n.im+=parseFloat((a%2?"-":"")+r[s+1]),s++),i=a=0):((i+a===0||isNaN(l))&&o(),"i"===r[s+1]||"I"===r[s+1]?(n.im+=parseFloat((a%2?"-":"")+l),s++):n.re+=parseFloat((a%2?"-":"")+l),i=a=0))}i+a>0&&o();break;case"number":n.im=0,n.re=t;break;default:o()}isNaN(n.re)||isNaN(n.im)};function c(t,e){if(!(this instanceof c))return new c(t,e);l(t,e),this.re=n.re,this.im=n.im}c.prototype={re:0,im:0,sign:function(){var t=this.abs();return new c(this.re/t,this.im/t)},add:function(t,e){return l(t,e),new c(this.re+n.re,this.im+n.im)},sub:function(t,e){return l(t,e),new c(this.re-n.re,this.im-n.im)},mul:function(t,e){return l(t,e),0===n.im&&0===this.im?new c(this.re*n.re,0):new c(this.re*n.re-this.im*n.im,this.re*n.im+this.im*n.re)},div:function(t,e){l(t,e),t=this.re,e=this.im;var r,i,a=n.re,o=n.im;return 0===o?0===a?new c(0!==t?t/0:0,0!==e?e/0:0):new c(t/a,e/a):Math.abs(a)<Math.abs(o)?new c((t*(i=a/o)+e)/(r=a*i+o),(e*i-t)/r):new c((t+e*(i=o/a))/(r=o*i+a),(e-t*i)/r)},pow:function(t,e){if(l(t,e),t=this.re,e=this.im,0===t&&0===e)return c.ZERO;if(0===n.im){if(0===e&&t>=0)return new c(Math.pow(t,n.re),0);if(0===t)switch((n.re%4+4)%4){case 0:return new c(Math.pow(e,n.re),0);case 1:return new c(0,Math.pow(e,n.re));case 2:return new c(-Math.pow(e,n.re),0);case 3:return new c(0,-Math.pow(e,n.re))}}var r=Math.atan2(e,t),i=s(t,e);return t=Math.exp(n.re*i-n.im*r),e=n.im*i+n.re*r,new c(t*Math.cos(e),t*Math.sin(e))},sqrt:function(){var t,e,r=this.re,n=this.im,i=this.abs();if(r>=0){if(0===n)return new c(Math.sqrt(r),0);t=.5*Math.sqrt(2*(i+r))}else t=Math.abs(n)/Math.sqrt(2*(i-r));return e=r<=0?.5*Math.sqrt(2*(i-r)):Math.abs(n)/Math.sqrt(2*(i+r)),new c(t,n<0?-e:e)},exp:function(){var t=Math.exp(this.re);return this.im,new c(t*Math.cos(this.im),t*Math.sin(this.im))},log:function(){var t=this.re,e=this.im;return new c(s(t,e),Math.atan2(e,t))},abs:function(){return t=this.re,e=this.im,r=Math.abs(t),n=Math.abs(e),r<3e3&&n<3e3?Math.sqrt(r*r+n*n):(r<n?(r=n,n=t/e):n=e/t,r*Math.sqrt(1+n*n));var t,e,r,n},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var t=this.re,e=this.im;return new c(Math.sin(t)*i(e),Math.cos(t)*a(e))},cos:function(){var t=this.re,e=this.im;return new c(Math.cos(t)*i(e),-Math.sin(t)*a(e))},tan:function(){var t=2*this.re,e=2*this.im,r=Math.cos(t)+i(e);return new c(Math.sin(t)/r,a(e)/r)},cot:function(){var t=2*this.re,e=2*this.im,r=Math.cos(t)-i(e);return new c(-Math.sin(t)/r,a(e)/r)},sec:function(){var t=this.re,e=this.im,r=.5*i(2*e)+.5*Math.cos(2*t);return new c(Math.cos(t)*i(e)/r,Math.sin(t)*a(e)/r)},csc:function(){var t=this.re,e=this.im,r=.5*i(2*e)-.5*Math.cos(2*t);return new c(Math.sin(t)*i(e)/r,-Math.cos(t)*a(e)/r)},asin:function(){var t=this.re,e=this.im,r=new c(e*e-t*t+1,-2*t*e).sqrt(),n=new c(r.re-e,r.im+t).log();return new c(n.im,-n.re)},acos:function(){var t=this.re,e=this.im,r=new c(e*e-t*t+1,-2*t*e).sqrt(),n=new c(r.re-e,r.im+t).log();return new c(Math.PI/2-n.im,n.re)},atan:function(){var t=this.re,e=this.im;if(0===t){if(1===e)return new c(0,1/0);if(-1===e)return new c(0,-1/0)}var r=t*t+(1-e)*(1-e),n=new c((1-e*e-t*t)/r,-2*t/r).log();return new c(-.5*n.im,.5*n.re)},acot:function(){var t=this.re,e=this.im;if(0===e)return new c(Math.atan2(1,t),0);var r=t*t+e*e;return 0!==r?new c(t/r,-e/r).atan():new c(0!==t?t/0:0,0!==e?-e/0:0).atan()},asec:function(){var t=this.re,e=this.im;if(0===t&&0===e)return new c(0,1/0);var r=t*t+e*e;return 0!==r?new c(t/r,-e/r).acos():new c(0!==t?t/0:0,0!==e?-e/0:0).acos()},acsc:function(){var t=this.re,e=this.im;if(0===t&&0===e)return new c(Math.PI/2,1/0);var r=t*t+e*e;return 0!==r?new c(t/r,-e/r).asin():new c(0!==t?t/0:0,0!==e?-e/0:0).asin()},sinh:function(){var t=this.re,e=this.im;return new c(a(t)*Math.cos(e),i(t)*Math.sin(e))},cosh:function(){var t=this.re,e=this.im;return new c(i(t)*Math.cos(e),a(t)*Math.sin(e))},tanh:function(){var t=2*this.re,e=2*this.im,r=i(t)+Math.cos(e);return new c(a(t)/r,Math.sin(e)/r)},coth:function(){var t=2*this.re,e=2*this.im,r=i(t)-Math.cos(e);return new c(a(t)/r,-Math.sin(e)/r)},csch:function(){var t=this.re,e=this.im,r=Math.cos(2*e)-i(2*t);return new c(-2*a(t)*Math.cos(e)/r,2*i(t)*Math.sin(e)/r)},sech:function(){var t=this.re,e=this.im,r=Math.cos(2*e)+i(2*t);return new c(2*i(t)*Math.cos(e)/r,-2*a(t)*Math.sin(e)/r)},asinh:function(){var t=this.im;this.im=-this.re,this.re=t;var e=this.asin();return this.re=-this.im,this.im=t,t=e.re,e.re=-e.im,e.im=t,e},acosh:function(){var t,e=this.acos();return e.im<=0?(t=e.re,e.re=-e.im,e.im=t):(t=e.im,e.im=-e.re,e.re=t),e},atanh:function(){var t=this.re,e=this.im,r=t>1&&0===e,n=1-t,i=1+t,a=n*n+e*e,o=0!==a?new c((i*n-e*e)/a,(e*n+i*e)/a):new c(-1!==t?t/0:0,0!==e?e/0:0),l=o.re;return o.re=s(o.re,o.im)/2,o.im=Math.atan2(o.im,l)/2,r&&(o.im=-o.im),o},acoth:function(){var t=this.re,e=this.im;if(0===t&&0===e)return new c(0,Math.PI/2);var r=t*t+e*e;return 0!==r?new c(t/r,-e/r).atanh():new c(0!==t?t/0:0,0!==e?-e/0:0).atanh()},acsch:function(){var t=this.re,e=this.im;if(0===e)return new c(0!==t?Math.log(t+Math.sqrt(t*t+1)):1/0,0);var r=t*t+e*e;return 0!==r?new c(t/r,-e/r).asinh():new c(0!==t?t/0:0,0!==e?-e/0:0).asinh()},asech:function(){var t=this.re,e=this.im;if(0===t&&0===e)return new c(1/0,0);var r=t*t+e*e;return 0!==r?new c(t/r,-e/r).acosh():new c(0!==t?t/0:0,0!==e?-e/0:0).acosh()},inverse:function(){var t=this.re,e=this.im,r=t*t+e*e;return new c(0!==t?t/r:0,0!==e?-e/r:0)},conjugate:function(){return new c(this.re,-this.im)},neg:function(){return new c(-this.re,-this.im)},ceil:function(t){return t=Math.pow(10,t||0),new c(Math.ceil(this.re*t)/t,Math.ceil(this.im*t)/t)},floor:function(t){return t=Math.pow(10,t||0),new c(Math.floor(this.re*t)/t,Math.floor(this.im*t)/t)},round:function(t){return t=Math.pow(10,t||0),new c(Math.round(this.re*t)/t,Math.round(this.im*t)/t)},equals:function(t,e){return l(t,e),Math.abs(n.re-this.re)<=c.EPSILON&&Math.abs(n.im-this.im)<=c.EPSILON},clone:function(){return new c(this.re,this.im)},toString:function(){var t=this.re,e=this.im,r="";return isNaN(t)||isNaN(e)?"NaN":(0!==t&&(r+=t),0!==e&&(0!==t?r+=e<0?" - ":" + ":e<0&&(r+="-"),1!==(e=Math.abs(e))&&(r+=e),r+="i"),r||"0")},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)}},c.ZERO=new c(0,0),c.ONE=new c(1,0),c.I=new c(0,1),c.PI=new c(Math.PI,0),c.E=new c(Math.E,0),c.EPSILON=1e-16,"object"==typeof r?e.exports=c:t.Complex=c}(this)},{}],104:[function(t,e,r){"use strict";var n=t("./lib/ch1d"),i=t("./lib/ch2d"),a=t("./lib/chnd");e.exports=function(t){var e=t.length;if(0===e)return[];if(1===e)return[[0]];var r=t[0].length;if(0===r)return[];if(1===r)return n(t);if(2===r)return i(t);return a(t,r)}},{"./lib/ch1d":105,"./lib/ch2d":106,"./lib/chnd":107}],105:[function(t,e,r){"use strict";e.exports=function(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 e<r?[[e],[r]]:e>r?[[r],[e]]:[[e]]}},{}],106:[function(t,e,r){"use strict";e.exports=function(t){var e=n(t),r=e.length;if(r<=2)return[];for(var i=new Array(r),a=e[r-1],o=0;o<r;++o){var s=e[o];i[o]=[a,s],a=s}return i};var n=t("monotone-convex-hull-2d")},{"monotone-convex-hull-2d":617}],107:[function(t,e,r){"use strict";e.exports=function(t,e){try{return n(t,!0)}catch(o){var r=i(t);if(r.length<=e)return[];var a=function(t,e){for(var r=t.length,n=new Array(r),i=0;i<e.length;++i)n[i]=t[e[i]];var a=e.length;for(i=0;i<r;++i)e.indexOf(i)<0&&(n[a++]=t[i]);return n}(t,r);return function(t,e){for(var r=t.length,n=e.length,i=0;i<r;++i)for(var a=t[i],o=0;o<a.length;++o){var s=a[o];if(s<n)a[o]=e[s];else{s-=n;for(var l=0;l<n;++l)s>=e[l]&&(s+=1);a[o]=s}}return t}(n(a,!0),r)}};var n=t("incremental-convex-hull"),i=t("affine-hull")},{"affine-hull":34,"incremental-convex-hull":419}],108:[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",CPV:"verde",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CYM:"cayman",CAF:"\\bcentral.african.republic",TCD:"\\bchad",CHL:"\\bchile",CHN:"^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai)(?!.*\\brep).*china|^(?=.*peo)(?=.*rep).*china",CXR:"christmas",CCK:"\\bcocos|keeling",COL:"colombia",COM:"comoro",COG:"^(?!.*\\bdem)(?!.*\\bd[\\.]?r)(?!.*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",CSK:"czechoslovakia",CZE:"^(?=.*rep).*czech|czechia|bohemia",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bd[\\.]?r|\\bd[\\.]?r.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",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)|(^republic.*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|people|north|d.*p.*.r).*\\bkorea|dprk|korea.*(d.*p.*r)",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)",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:"fed.*micronesia|micronesia.*fed",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",KOR:"^(?!.*d.*p.*r)(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea(?!.*d.*p.*r)",MDA:"moldov|b(a|e)ssarabia",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:"south.africa|s\\\\..?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|^(?!.*peo)(?=.*rep).*china",TJK:"tajik",THA:"thailand|\\bsiam",MKD:"macedonia|fyrom",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\\.?$",TZA:"tanzania",USA:"united.?states\\b(?!.*islands)|\\bu\\.?s\\.?a\\.?\\b|^\\s*u\\.?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"}},{}],109:[function(t,e,r){e.exports=["xx-small","x-small","small","medium","large","x-large","xx-large","larger","smaller"]},{}],110:[function(t,e,r){e.exports=["normal","condensed","semi-condensed","extra-condensed","ultra-condensed","expanded","semi-expanded","extra-expanded","ultra-expanded"]},{}],111:[function(t,e,r){e.exports=["normal","italic","oblique"]},{}],112:[function(t,e,r){e.exports=["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900"]},{}],113:[function(t,e,r){"use strict";e.exports={parse:t("./parse"),stringify:t("./stringify")}},{"./parse":115,"./stringify":116}],114:[function(t,e,r){"use strict";var n=t("css-font-size-keywords");e.exports={isSize:function(t){return/^[\d\.]/.test(t)||-1!==t.indexOf("/")||-1!==n.indexOf(t)}}},{"css-font-size-keywords":109}],115:[function(t,e,r){"use strict";var n=t("unquote"),i=t("css-global-keywords"),a=t("css-system-font-keywords"),o=t("css-font-weight-keywords"),s=t("css-font-style-keywords"),l=t("css-font-stretch-keywords"),c=t("string-split-by"),u=t("./lib/util").isSize;e.exports=h;var f=h.cache={};function h(t){if("string"!=typeof t)throw new Error("Font argument must be a string.");if(f[t])return f[t];if(""===t)throw new Error("Cannot parse an empty string.");if(-1!==a.indexOf(t))return f[t]={system:t};for(var e,r={style:"normal",variant:"normal",weight:"normal",stretch:"normal",lineHeight:"normal",size:"1rem",family:["serif"]},h=c(t,/\s+/);e=h.shift();){if(-1!==i.indexOf(e))return["style","variant","weight","stretch"].forEach((function(t){r[t]=e})),f[t]=r;if(-1===s.indexOf(e))if("normal"!==e&&"small-caps"!==e)if(-1===l.indexOf(e)){if(-1===o.indexOf(e)){if(u(e)){var d=c(e,"/");if(r.size=d[0],null!=d[1]?r.lineHeight=p(d[1]):"/"===h[0]&&(h.shift(),r.lineHeight=p(h.shift())),!h.length)throw new Error("Missing required font-family.");return r.family=c(h.join(" "),/\s*,\s*/).map(n),f[t]=r}throw new Error("Unknown or unsupported font token: "+e)}r.weight=e}else r.stretch=e;else r.variant=e;else r.style=e}throw new Error("Missing required font-size.")}function p(t){var e=parseFloat(t);return e.toString()===t?e:t}},{"./lib/util":114,"css-font-stretch-keywords":110,"css-font-style-keywords":111,"css-font-weight-keywords":112,"css-global-keywords":117,"css-system-font-keywords":118,"string-split-by":1503,unquote:1534}],116:[function(t,e,r){"use strict";var n=t("pick-by-alias"),i=t("./lib/util").isSize,a=m(t("css-global-keywords")),o=m(t("css-system-font-keywords")),s=m(t("css-font-weight-keywords")),l=m(t("css-font-style-keywords")),c=m(t("css-font-stretch-keywords")),u={normal:1,"small-caps":1},f={serif:1,"sans-serif":1,monospace:1,cursive:1,fantasy:1,"system-ui":1},h="1rem",p="serif";function d(t,e){if(t&&!e[t]&&!a[t])throw Error("Unknown keyword `"+t+"`");return t}function m(t){for(var e={},r=0;r<t.length;r++)e[t[r]]=1;return e}e.exports=function(t){if((t=n(t,{style:"style fontstyle fontStyle font-style slope distinction",variant:"variant font-variant fontVariant fontvariant var capitalization",weight:"weight w font-weight fontWeight fontweight",stretch:"stretch font-stretch fontStretch fontstretch width",size:"size s font-size fontSize fontsize height em emSize",lineHeight:"lh line-height lineHeight lineheight leading",family:"font family fontFamily font-family fontfamily type typeface face",system:"system reserved default global"})).system)return t.system&&d(t.system,o),t.system;if(d(t.style,l),d(t.variant,u),d(t.weight,s),d(t.stretch,c),null==t.size&&(t.size=h),"number"==typeof t.size&&(t.size+="px"),!i)throw Error("Bad size value `"+t.size+"`");t.family||(t.family=p),Array.isArray(t.family)&&(t.family.length||(t.family=[p]),t.family=t.family.map((function(t){return f[t]?t:'"'+t+'"'})).join(", "));var e=[];return e.push(t.style),t.variant!==t.style&&e.push(t.variant),t.weight!==t.variant&&t.weight!==t.style&&e.push(t.weight),t.stretch!==t.weight&&t.stretch!==t.variant&&t.stretch!==t.style&&e.push(t.stretch),e.push(t.size+(null==t.lineHeight||"normal"===t.lineHeight||t.lineHeight+""=="1"?"":"/"+t.lineHeight)),e.push(t.family),e.filter(Boolean).join(" ")}},{"./lib/util":114,"css-font-stretch-keywords":110,"css-font-style-keywords":111,"css-font-weight-keywords":112,"css-global-keywords":117,"css-system-font-keywords":118,"pick-by-alias":646}],117:[function(t,e,r){e.exports=["inherit","initial","unset"]},{}],118:[function(t,e,r){e.exports=["caption","icon","menu","message-box","small-caption","status-bar"]},{}],119:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i,a){var o=i-1,s=i*i,l=o*o,c=(1+2*i)*l,u=i*l,f=s*(3-2*i),h=s*o;if(t.length){a||(a=new Array(t.length));for(var p=t.length-1;p>=0;--p)a[p]=c*t[p]+u*e[p]+f*r[p]+h*n[p];return a}return c*t+u*e+f*r+h*n},e.exports.derivative=function(t,e,r,n,i,a){var o=6*i*i-6*i,s=3*i*i-4*i+1,l=-6*i*i+6*i,c=3*i*i-2*i;if(t.length){a||(a=new Array(t.length));for(var u=t.length-1;u>=0;--u)a[u]=o*t[u]+s*e[u]+l*r[u]+c*n[u];return a}return o*t+s*e+l*r[u]+c*n}},{}],120:[function(t,e,r){"use strict";var n=t("./lib/thunk.js");function i(){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}e.exports=function(t){var e=new i;e.pre=t.pre,e.body=t.body,e.post=t.post;var r=t.args.slice(0);e.argTypes=r;for(var a=0;a<r.length;++a){var o=r[a];if("array"===o||"object"==typeof o&&o.blockIndices){if(e.argTypes[a]="array",e.arrayArgs.push(a),e.arrayBlockIndices.push(o.blockIndices?o.blockIndices:0),e.shimArgs.push("array"+a),a<e.pre.args.length&&e.pre.args[a].count>0)throw new Error("cwise: pre() block may not reference array args");if(a<e.post.args.length&&e.post.args[a].count>0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===o)e.scalarArgs.push(a),e.shimArgs.push("scalar"+a);else if("index"===o){if(e.indexArgs.push(a),a<e.pre.args.length&&e.pre.args[a].count>0)throw new Error("cwise: pre() block may not reference array index");if(a<e.body.args.length&&e.body.args[a].lvalue)throw new Error("cwise: body() block may not write to array index");if(a<e.post.args.length&&e.post.args[a].count>0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===o){if(e.shapeArgs.push(a),a<e.pre.args.length&&e.pre.args[a].lvalue)throw new Error("cwise: pre() block may not write to array shape");if(a<e.body.args.length&&e.body.args[a].lvalue)throw new Error("cwise: body() block may not write to array shape");if(a<e.post.args.length&&e.post.args[a].lvalue)throw new Error("cwise: post() block may not write to array shape")}else{if("object"!=typeof o||!o.offset)throw new Error("cwise: Unknown argument type "+r[a]);e.argTypes[a]="offset",e.offsetArgs.push({array:o.array,offset:o.offset}),e.offsetArgIndex.push(a)}}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,n(e)}},{"./lib/thunk.js":122}],121:[function(t,e,r){"use strict";var n=t("uniq");function i(t,e,r){var n,i,a=t.length,o=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],c=[],u=0,f=0;for(n=0;n<a;++n)c.push(["i",n,"=0"].join(""));for(i=0;i<o;++i)for(n=0;n<a;++n)f=u,u=t[n],0===n?c.push(["d",i,"s",n,"=t",i,"p",u].join("")):c.push(["d",i,"s",n,"=(t",i,"p",u,"-s",f,"*t",i,"p",f,")"].join(""));for(c.length>0&&l.push("var "+c.join(",")),n=a-1;n>=0;--n)u=t[n],l.push(["for(i",n,"=0;i",n,"<s",u,";++i",n,"){"].join(""));for(l.push(r),n=0;n<a;++n){for(f=u,u=t[n],i=0;i<o;++i)l.push(["p",i,"+=d",i,"s",n].join(""));s&&(n>0&&l.push(["index[",f,"]-=s",f].join("")),l.push(["++index[",u,"]"].join(""))),l.push("}")}return l.join("\n")}function a(t,e,r){for(var n=t.body,i=[],a=[],o=0;o<t.args.length;++o){var s=t.args[o];if(!(s.count<=0)){var l=new RegExp(s.name,"g"),c="",u=e.arrayArgs.indexOf(o);switch(e.argTypes[o]){case"offset":var f=e.offsetArgIndex.indexOf(o);u=e.offsetArgs[f].array,c="+q"+f;case"array":c="p"+u+c;var h="l"+o,p="a"+u;if(0===e.arrayBlockIndices[u])1===s.count?"generic"===r[u]?s.lvalue?(i.push(["var ",h,"=",p,".get(",c,")"].join("")),n=n.replace(l,h),a.push([p,".set(",c,",",h,")"].join(""))):n=n.replace(l,[p,".get(",c,")"].join("")):n=n.replace(l,[p,"[",c,"]"].join("")):"generic"===r[u]?(i.push(["var ",h,"=",p,".get(",c,")"].join("")),n=n.replace(l,h),s.lvalue&&a.push([p,".set(",c,",",h,")"].join(""))):(i.push(["var ",h,"=",p,"[",c,"]"].join("")),n=n.replace(l,h),s.lvalue&&a.push([p,"[",c,"]=",h].join("")));else{for(var d=[s.name],m=[c],g=0;g<Math.abs(e.arrayBlockIndices[u]);g++)d.push("\\s*\\[([^\\]]+)\\]"),m.push("$"+(g+1)+"*t"+u+"b"+g);if(l=new RegExp(d.join(""),"g"),c=m.join("+"),"generic"===r[u])throw new Error("cwise: Generic arrays not supported in combination with blocks!");n=n.replace(l,[p,"[",c,"]"].join(""))}break;case"scalar":n=n.replace(l,"Y"+e.scalarArgs.indexOf(o));break;case"index":n=n.replace(l,"index");break;case"shape":n=n.replace(l,"shape")}}}return[i.join("\n"),n,a.join("\n")].join("\n").trim()}function o(t){for(var e=new Array(t.length),r=!0,n=0;n<t.length;++n){var i=t[n],a=i.match(/\d+/);a=a?a[0]:"",0===i.charAt(0)?e[n]="u"+i.charAt(1)+a:e[n]=i.charAt(0)+a,n>0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}e.exports=function(t,e){for(var r=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,s=new Array(t.arrayArgs.length),l=new Array(t.arrayArgs.length),c=0;c<t.arrayArgs.length;++c)l[c]=e[2*c],s[c]=e[2*c+1];var u=[],f=[],h=[],p=[],d=[];for(c=0;c<t.arrayArgs.length;++c){t.arrayBlockIndices[c]<0?(h.push(0),p.push(r),u.push(r),f.push(r+t.arrayBlockIndices[c])):(h.push(t.arrayBlockIndices[c]),p.push(t.arrayBlockIndices[c]+r),u.push(0),f.push(t.arrayBlockIndices[c]));for(var m=[],g=0;g<s[c].length;g++)h[c]<=s[c][g]&&s[c][g]<p[c]&&m.push(s[c][g]-h[c]);d.push(m)}var v=["SS"],y=["'use strict'"],x=[];for(g=0;g<r;++g)x.push(["s",g,"=SS[",g,"]"].join(""));for(c=0;c<t.arrayArgs.length;++c){v.push("a"+c),v.push("t"+c),v.push("p"+c);for(g=0;g<r;++g)x.push(["t",c,"p",g,"=t",c,"[",h[c]+g,"]"].join(""));for(g=0;g<Math.abs(t.arrayBlockIndices[c]);++g)x.push(["t",c,"b",g,"=t",c,"[",u[c]+g,"]"].join(""))}for(c=0;c<t.scalarArgs.length;++c)v.push("Y"+c);if(t.shapeArgs.length>0&&x.push("shape=SS.slice(0)"),t.indexArgs.length>0){var b=new Array(r);for(c=0;c<r;++c)b[c]="0";x.push(["index=[",b.join(","),"]"].join(""))}for(c=0;c<t.offsetArgs.length;++c){var _=t.offsetArgs[c],w=[];for(g=0;g<_.offset.length;++g)0!==_.offset[g]&&(1===_.offset[g]?w.push(["t",_.array,"p",g].join("")):w.push([_.offset[g],"*t",_.array,"p",g].join("")));0===w.length?x.push("q"+c+"=0"):x.push(["q",c,"=",w.join("+")].join(""))}var T=n([].concat(t.pre.thisVars).concat(t.body.thisVars).concat(t.post.thisVars));for((x=x.concat(T)).length>0&&y.push("var "+x.join(",")),c=0;c<t.arrayArgs.length;++c)y.push("p"+c+"|=0");t.pre.body.length>3&&y.push(a(t.pre,t,l));var M=a(t.body,t,l),k=function(t){for(var e=0,r=t[0].length;e<r;){for(var n=1;n<t.length;++n)if(t[n][e]!==t[0][e])return e;++e}return e}(d);k<r?y.push(function(t,e,r,n){for(var a=e.length,o=r.arrayArgs.length,s=r.blockSize,l=r.indexArgs.length>0,c=[],u=0;u<o;++u)c.push(["var offset",u,"=p",u].join(""));for(u=t;u<a;++u)c.push(["for(var j"+u+"=SS[",e[u],"]|0;j",u,">0;){"].join("")),c.push(["if(j",u,"<",s,"){"].join("")),c.push(["s",e[u],"=j",u].join("")),c.push(["j",u,"=0"].join("")),c.push(["}else{s",e[u],"=",s].join("")),c.push(["j",u,"-=",s,"}"].join("")),l&&c.push(["index[",e[u],"]=j",u].join(""));for(u=0;u<o;++u){for(var f=["offset"+u],h=t;h<a;++h)f.push(["j",h,"*t",u,"p",e[h]].join(""));c.push(["p",u,"=(",f.join("+"),")"].join(""))}for(c.push(i(e,r,n)),u=t;u<a;++u)c.push("}");return c.join("\n")}(k,d[0],t,M)):y.push(i(d[0],t,M)),t.post.body.length>3&&y.push(a(t.post,t,l)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+y.join("\n")+"\n----------");var A=[t.funcName||"unnamed","_cwise_loop_",s[0].join("s"),"m",k,o(l)].join("");return new Function(["function ",A,"(",v.join(","),"){",y.join("\n"),"} return ",A].join(""))()}},{uniq:1533}],122:[function(t,e,r){"use strict";var n=t("./compile.js");e.exports=function(t){var e=["'use strict'","var CACHED={}"],r=[],i=t.funcName+"_cwise_thunk";e.push(["return function ",i,"(",t.shimArgs.join(","),"){"].join(""));for(var a=[],o=[],s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")],l=[],c=[],u=0;u<t.arrayArgs.length;++u){var f=t.arrayArgs[u];r.push(["t",f,"=array",f,".dtype,","r",f,"=array",f,".order"].join("")),a.push("t"+f),a.push("r"+f),o.push("t"+f),o.push("r"+f+".join()"),s.push("array"+f+".data"),s.push("array"+f+".stride"),s.push("array"+f+".offset|0"),u>0&&(l.push("array"+t.arrayArgs[0]+".shape.length===array"+f+".shape.length+"+(Math.abs(t.arrayBlockIndices[0])-Math.abs(t.arrayBlockIndices[u]))),c.push("array"+t.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[0])+"]===array"+f+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[u])+"]"))}for(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--\x3e0;) {"),e.push("if (!("+c.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}")),u=0;u<t.scalarArgs.length;++u)s.push("scalar"+t.scalarArgs[u]);return r.push(["type=[",o.join(","),"].join()"].join("")),r.push("proc=CACHED[type]"),e.push("var "+r.join(",")),e.push(["if(!proc){","CACHED[type]=proc=compile([",a.join(","),"])}","return proc(",s.join(","),")}"].join("")),t.debug&&console.log("-----Generated thunk:\n"+e.join("\n")+"\n----------"),new Function("compile",e.join("\n"))(n.bind(void 0,t))}},{"./compile.js":121}],123:[function(t,e,r){"use strict";var n,i=t("type/value/is"),a=t("type/value/ensure"),o=t("type/plain-function/ensure"),s=t("es5-ext/object/copy"),l=t("es5-ext/object/normalize-options"),c=t("es5-ext/object/map"),u=Function.prototype.bind,f=Object.defineProperty,h=Object.prototype.hasOwnProperty;n=function(t,e,r){var n,i=a(e)&&o(e.value);return delete(n=s(e)).writable,delete n.value,n.get=function(){return!r.overwriteDefinition&&h.call(this,t)?i:(e.value=u.call(i,r.resolveContext?r.resolveContext(this):this),f(this,t,e),this[t])},n},e.exports=function(t){var e=l(arguments[1]);return i(e.resolveContext)&&o(e.resolveContext),c(t,(function(t,r){return n(r,t,e)}))}},{"es5-ext/object/copy":167,"es5-ext/object/map":175,"es5-ext/object/normalize-options":176,"type/plain-function/ensure":1524,"type/value/ensure":1528,"type/value/is":1529}],124:[function(t,e,r){"use strict";var n=t("type/value/is"),i=t("type/plain-function/is"),a=t("es5-ext/object/assign"),o=t("es5-ext/object/normalize-options"),s=t("es5-ext/string/#/contains");(e.exports=function(t,e){var r,i,l,c,u;return arguments.length<2||"string"!=typeof t?(c=e,e=t,t=null):c=arguments[2],n(t)?(r=s.call(t,"c"),i=s.call(t,"e"),l=s.call(t,"w")):(r=l=!0,i=!1),u={value:e,configurable:r,enumerable:i,writable:l},c?a(o(c),u):u}).gs=function(t,e,r){var l,c,u,f;return"string"!=typeof t?(u=r,r=e,e=t,t=null):u=arguments[3],n(e)?i(e)?n(r)?i(r)||(u=r,r=void 0):r=void 0:(u=e,e=r=void 0):e=void 0,n(t)?(l=s.call(t,"c"),c=s.call(t,"e")):(l=!0,c=!1),f={get:e,set:r,configurable:l,enumerable:c},u?a(o(u),f):f}},{"es5-ext/object/assign":164,"es5-ext/object/normalize-options":176,"es5-ext/string/#/contains":183,"type/plain-function/is":1525,"type/value/is":1529}],125:[function(t,e,r){!function(t,n){n("object"==typeof r&&"undefined"!=typeof e?r:t.d3=t.d3||{})}(this,(function(t){"use strict";function e(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function r(t){var r;return 1===t.length&&(r=t,t=function(t,n){return e(r(t),n)}),{left:function(e,r,n,i){for(null==n&&(n=0),null==i&&(i=e.length);n<i;){var a=n+i>>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(null==n&&(n=0),null==i&&(i=e.length);n<i;){var a=n+i>>>1;t(e[a],r)>0?i=a:n=a+1}return n}}}var n=r(e),i=n.right,a=n.left;function o(t,e){return[t,e]}function s(t){return null===t?NaN:+t}function l(t,e){var r,n,i=t.length,a=0,o=-1,l=0,c=0;if(null==e)for(;++o<i;)isNaN(r=s(t[o]))||(c+=(n=r-l)*(r-(l+=n/++a)));else for(;++o<i;)isNaN(r=s(e(t[o],o,t)))||(c+=(n=r-l)*(r-(l+=n/++a)));if(a>1)return c/(a-1)}function c(t,e){var r=l(t,e);return r?Math.sqrt(r):r}function u(t,e){var r,n,i,a=t.length,o=-1;if(null==e){for(;++o<a;)if(null!=(r=t[o])&&r>=r)for(n=i=r;++o<a;)null!=(r=t[o])&&(n>r&&(n=r),i<r&&(i=r))}else for(;++o<a;)if(null!=(r=e(t[o],o,t))&&r>=r)for(n=i=r;++o<a;)null!=(r=e(t[o],o,t))&&(n>r&&(n=r),i<r&&(i=r));return[n,i]}var f=Array.prototype,h=f.slice,p=f.map;function d(t){return function(){return t}}function m(t){return t}function g(t,e,r){t=+t,e=+e,r=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+r;for(var n=-1,i=0|Math.max(0,Math.ceil((e-t)/r)),a=new Array(i);++n<i;)a[n]=t+n*r;return a}var v=Math.sqrt(50),y=Math.sqrt(10),x=Math.sqrt(2);function b(t,e,r){var n=(e-t)/Math.max(0,r),i=Math.floor(Math.log(n)/Math.LN10),a=n/Math.pow(10,i);return i>=0?(a>=v?10:a>=y?5:a>=x?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=v?10:a>=y?5:a>=x?2:1)}function _(t,e,r){var n=Math.abs(e-t)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),a=n/i;return a>=v?i*=10:a>=y?i*=5:a>=x&&(i*=2),e<t?-i:i}function w(t){return Math.ceil(Math.log(t.length)/Math.LN2)+1}function T(t,e,r){if(null==r&&(r=s),n=t.length){if((e=+e)<=0||n<2)return+r(t[0],0,t);if(e>=1)return+r(t[n-1],n-1,t);var n,i=(n-1)*e,a=Math.floor(i),o=+r(t[a],a,t);return o+(+r(t[a+1],a+1,t)-o)*(i-a)}}function M(t,e){var r,n,i=t.length,a=-1;if(null==e){for(;++a<i;)if(null!=(r=t[a])&&r>=r)for(n=r;++a<i;)null!=(r=t[a])&&n>r&&(n=r)}else for(;++a<i;)if(null!=(r=e(t[a],a,t))&&r>=r)for(n=r;++a<i;)null!=(r=e(t[a],a,t))&&n>r&&(n=r);return n}function k(t){if(!(i=t.length))return[];for(var e=-1,r=M(t,A),n=new Array(r);++e<r;)for(var i,a=-1,o=n[e]=new Array(i);++a<i;)o[a]=t[a][e];return n}function A(t){return t.length}t.bisect=i,t.bisectRight=i,t.bisectLeft=a,t.ascending=e,t.bisector=r,t.cross=function(t,e,r){var n,i,a,s,l=t.length,c=e.length,u=new Array(l*c);for(null==r&&(r=o),n=a=0;n<l;++n)for(s=t[n],i=0;i<c;++i,++a)u[a]=r(s,e[i]);return u},t.descending=function(t,e){return e<t?-1:e>t?1:e>=t?0:NaN},t.deviation=c,t.extent=u,t.histogram=function(){var t=m,e=u,r=w;function n(n){var a,o,s=n.length,l=new Array(s);for(a=0;a<s;++a)l[a]=t(n[a],a,n);var c=e(l),u=c[0],f=c[1],h=r(l,u,f);Array.isArray(h)||(h=_(u,f,h),h=g(Math.ceil(u/h)*h,f,h));for(var p=h.length;h[0]<=u;)h.shift(),--p;for(;h[p-1]>f;)h.pop(),--p;var d,m=new Array(p+1);for(a=0;a<=p;++a)(d=m[a]=[]).x0=a>0?h[a-1]:u,d.x1=a<p?h[a]:f;for(a=0;a<s;++a)u<=(o=l[a])&&o<=f&&m[i(h,o,0,p)].push(n[a]);return m}return n.value=function(e){return arguments.length?(t="function"==typeof e?e:d(e),n):t},n.domain=function(t){return arguments.length?(e="function"==typeof t?t:d([t[0],t[1]]),n):e},n.thresholds=function(t){return arguments.length?(r="function"==typeof t?t:Array.isArray(t)?d(h.call(t)):d(t),n):r},n},t.thresholdFreedmanDiaconis=function(t,r,n){return t=p.call(t,s).sort(e),Math.ceil((n-r)/(2*(T(t,.75)-T(t,.25))*Math.pow(t.length,-1/3)))},t.thresholdScott=function(t,e,r){return Math.ceil((r-e)/(3.5*c(t)*Math.pow(t.length,-1/3)))},t.thresholdSturges=w,t.max=function(t,e){var r,n,i=t.length,a=-1;if(null==e){for(;++a<i;)if(null!=(r=t[a])&&r>=r)for(n=r;++a<i;)null!=(r=t[a])&&r>n&&(n=r)}else for(;++a<i;)if(null!=(r=e(t[a],a,t))&&r>=r)for(n=r;++a<i;)null!=(r=e(t[a],a,t))&&r>n&&(n=r);return n},t.mean=function(t,e){var r,n=t.length,i=n,a=-1,o=0;if(null==e)for(;++a<n;)isNaN(r=s(t[a]))?--i:o+=r;else for(;++a<n;)isNaN(r=s(e(t[a],a,t)))?--i:o+=r;if(i)return o/i},t.median=function(t,r){var n,i=t.length,a=-1,o=[];if(null==r)for(;++a<i;)isNaN(n=s(t[a]))||o.push(n);else for(;++a<i;)isNaN(n=s(r(t[a],a,t)))||o.push(n);return T(o.sort(e),.5)},t.merge=function(t){for(var e,r,n,i=t.length,a=-1,o=0;++a<i;)o+=t[a].length;for(r=new Array(o);--i>=0;)for(e=(n=t[i]).length;--e>=0;)r[--o]=n[e];return r},t.min=M,t.pairs=function(t,e){null==e&&(e=o);for(var r=0,n=t.length-1,i=t[0],a=new Array(n<0?0:n);r<n;)a[r]=e(i,i=t[++r]);return a},t.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},t.quantile=T,t.range=g,t.scan=function(t,r){if(n=t.length){var n,i,a=0,o=0,s=t[o];for(null==r&&(r=e);++a<n;)(r(i=t[a],s)<0||0!==r(s,s))&&(s=i,o=a);return 0===r(s,s)?o:void 0}},t.shuffle=function(t,e,r){for(var n,i,a=(null==r?t.length:r)-(e=null==e?0:+e);a;)i=Math.random()*a--|0,n=t[a+e],t[a+e]=t[i+e],t[i+e]=n;return t},t.sum=function(t,e){var r,n=t.length,i=-1,a=0;if(null==e)for(;++i<n;)(r=+t[i])&&(a+=r);else for(;++i<n;)(r=+e(t[i],i,t))&&(a+=r);return a},t.ticks=function(t,e,r){var n,i,a,o,s=-1;if(r=+r,(t=+t)===(e=+e)&&r>0)return[t];if((n=e<t)&&(i=t,t=e,e=i),0===(o=b(t,e,r))||!isFinite(o))return[];if(o>0)for(t=Math.ceil(t/o),e=Math.floor(e/o),a=new Array(i=Math.ceil(e-t+1));++s<i;)a[s]=(t+s)*o;else for(t=Math.floor(t*o),e=Math.ceil(e*o),a=new Array(i=Math.ceil(t-e+1));++s<i;)a[s]=(t-s)/o;return n&&a.reverse(),a},t.tickIncrement=b,t.tickStep=_,t.transpose=k,t.variance=l,t.zip=function(){return k(arguments)},Object.defineProperty(t,"__esModule",{value:!0})}))},{}],126:[function(t,e,r){!function(t,n){n("object"==typeof r&&"undefined"!=typeof e?r:t.d3=t.d3||{})}(this,(function(t){"use strict";function e(){}function r(t,r){var n=new e;if(t instanceof e)t.each((function(t,e){n.set(e,t)}));else if(Array.isArray(t)){var i,a=-1,o=t.length;if(null==r)for(;++a<o;)n.set(a,t[a]);else for(;++a<o;)n.set(r(i=t[a],a,t),i)}else if(t)for(var s in t)n.set(s,t[s]);return n}function n(){return{}}function i(t,e,r){t[e]=r}function a(){return r()}function o(t,e,r){t.set(e,r)}function s(){}e.prototype=r.prototype={constructor:e,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,e){return this["$"+t]=e,this},remove:function(t){var e="$"+t;return e in this&&delete this[e]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)"$"===e[0]&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)"$"===e[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var e in this)"$"===e[0]&&t(this[e],e.slice(1),this)}};var l=r.prototype;function c(t,e){var r=new s;if(t instanceof s)t.each((function(t){r.add(t)}));else if(t){var n=-1,i=t.length;if(null==e)for(;++n<i;)r.add(t[n]);else for(;++n<i;)r.add(e(t[n],n,t))}return r}s.prototype=c.prototype={constructor:s,has:l.has,add:function(t){return this["$"+(t+="")]=t,this},remove:l.remove,clear:l.clear,values:l.keys,size:l.size,empty:l.empty,each:l.each},t.nest=function(){var t,e,s,l=[],c=[];function u(n,i,a,o){if(i>=l.length)return null!=t&&n.sort(t),null!=e?e(n):n;for(var s,c,f,h=-1,p=n.length,d=l[i++],m=r(),g=a();++h<p;)(f=m.get(s=d(c=n[h])+""))?f.push(c):m.set(s,[c]);return m.each((function(t,e){o(g,e,u(t,i,a,o))})),g}return s={object:function(t){return u(t,0,n,i)},map:function(t){return u(t,0,a,o)},entries:function(t){return function t(r,n){if(++n>l.length)return r;var i,a=c[n-1];return null!=e&&n>=l.length?i=r.entries():(i=[],r.each((function(e,r){i.push({key:r,values:t(e,n)})}))),null!=a?i.sort((function(t,e){return a(t.key,e.key)})):i}(u(t,0,a,o),0)},key:function(t){return l.push(t),s},sortKeys:function(t){return c[l.length-1]=t,s},sortValues:function(e){return t=e,s},rollup:function(t){return e=t,s}}},t.set=c,t.map=r,t.keys=function(t){var e=[];for(var r in t)e.push(r);return e},t.values=function(t){var e=[];for(var r in t)e.push(t[r]);return e},t.entries=function(t){var e=[];for(var r in t)e.push({key:r,value:t[r]});return e},Object.defineProperty(t,"__esModule",{value:!0})}))},{}],127:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";function e(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function r(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function n(){}var i="\\s*([+-]?\\d+)\\s*",a="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",o="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",s=/^#([0-9a-f]{3,8})$/,l=new RegExp("^rgb\\("+[i,i,i]+"\\)$"),c=new RegExp("^rgb\\("+[o,o,o]+"\\)$"),u=new RegExp("^rgba\\("+[i,i,i,a]+"\\)$"),f=new RegExp("^rgba\\("+[o,o,o,a]+"\\)$"),h=new RegExp("^hsl\\("+[a,o,o]+"\\)$"),p=new RegExp("^hsla\\("+[a,o,o,a]+"\\)$"),d={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function m(){return this.rgb().formatHex()}function g(){return this.rgb().formatRgb()}function v(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=s.exec(t))?(r=e[1].length,e=parseInt(e[1],16),6===r?y(e):3===r?new w(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===r?x(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===r?x(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=l.exec(t))?new w(e[1],e[2],e[3],1):(e=c.exec(t))?new w(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=u.exec(t))?x(e[1],e[2],e[3],e[4]):(e=f.exec(t))?x(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=h.exec(t))?A(e[1],e[2]/100,e[3]/100,1):(e=p.exec(t))?A(e[1],e[2]/100,e[3]/100,e[4]):d.hasOwnProperty(t)?y(d[t]):"transparent"===t?new w(NaN,NaN,NaN,0):null}function y(t){return new w(t>>16&255,t>>8&255,255&t,1)}function x(t,e,r,n){return n<=0&&(t=e=r=NaN),new w(t,e,r,n)}function b(t){return t instanceof n||(t=v(t)),t?new w((t=t.rgb()).r,t.g,t.b,t.opacity):new w}function _(t,e,r,n){return 1===arguments.length?b(t):new w(t,e,r,null==n?1:n)}function w(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function T(){return"#"+k(this.r)+k(this.g)+k(this.b)}function M(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function k(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function A(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new C(t,e,r,n)}function S(t){if(t instanceof C)return new C(t.h,t.s,t.l,t.opacity);if(t instanceof n||(t=v(t)),!t)return new C;if(t instanceof C)return t;var e=(t=t.rgb()).r/255,r=t.g/255,i=t.b/255,a=Math.min(e,r,i),o=Math.max(e,r,i),s=NaN,l=o-a,c=(o+a)/2;return l?(s=e===o?(r-i)/l+6*(r<i):r===o?(i-e)/l+2:(e-r)/l+4,l/=c<.5?o+a:2-o-a,s*=60):l=c>0&&c<1?0:s,new C(s,l,c,t.opacity)}function E(t,e,r,n){return 1===arguments.length?S(t):new C(t,e,r,null==n?1:n)}function C(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function L(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}e(n,v,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:m,formatHex:m,formatHsl:function(){return S(this).formatHsl()},formatRgb:g,toString:g}),e(w,_,r(n,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new w(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new w(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:T,formatHex:T,formatRgb:M,toString:M})),e(C,E,r(n,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new C(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new C(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new w(L(t>=240?t-240:t+120,i,n),L(t,i,n),L(t<120?t+240:t-120,i,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var P=Math.PI/180,I=180/Math.PI,O=6/29,z=3*O*O;function D(t){if(t instanceof R)return new R(t.l,t.a,t.b,t.opacity);if(t instanceof H)return G(t);t instanceof w||(t=b(t));var e,r,n=U(t.r),i=U(t.g),a=U(t.b),o=F((.2225045*n+.7168786*i+.0606169*a)/1);return n===i&&i===a?e=r=o:(e=F((.4360747*n+.3850649*i+.1430804*a)/.96422),r=F((.0139322*n+.0971045*i+.7141733*a)/.82521)),new R(116*o-16,500*(e-o),200*(o-r),t.opacity)}function N(t,e,r,n){return 1===arguments.length?D(t):new R(t,e,r,null==n?1:n)}function R(t,e,r,n){this.l=+t,this.a=+e,this.b=+r,this.opacity=+n}function F(t){return t>.008856451679035631?Math.pow(t,1/3):t/z+4/29}function B(t){return t>O?t*t*t:z*(t-4/29)}function j(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function U(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function V(t){if(t instanceof H)return new H(t.h,t.c,t.l,t.opacity);if(t instanceof R||(t=D(t)),0===t.a&&0===t.b)return new H(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*I;return new H(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function q(t,e,r,n){return 1===arguments.length?V(t):new H(t,e,r,null==n?1:n)}function H(t,e,r,n){this.h=+t,this.c=+e,this.l=+r,this.opacity=+n}function G(t){if(isNaN(t.h))return new R(t.l,0,0,t.opacity);var e=t.h*P;return new R(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}e(R,N,r(n,{brighter:function(t){return new R(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new R(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,r=isNaN(this.b)?t:t-this.b/200;return new w(j(3.1338561*(e=.96422*B(e))-1.6168667*(t=1*B(t))-.4906146*(r=.82521*B(r))),j(-.9787684*e+1.9161415*t+.033454*r),j(.0719453*e-.2289914*t+1.4052427*r),this.opacity)}})),e(H,q,r(n,{brighter:function(t){return new H(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new H(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return G(this).rgb()}}));var Y=-.14861,W=1.78277,Z=-.29227,X=-.90649,J=1.97294,K=J*X,$=J*W,Q=W*Z-X*Y;function tt(t){if(t instanceof rt)return new rt(t.h,t.s,t.l,t.opacity);t instanceof w||(t=b(t));var e=t.r/255,r=t.g/255,n=t.b/255,i=(Q*n+K*e-$*r)/(Q+K-$),a=n-i,o=(J*(r-i)-Z*a)/X,s=Math.sqrt(o*o+a*a)/(J*i*(1-i)),l=s?Math.atan2(o,a)*I-120:NaN;return new rt(l<0?l+360:l,s,i,t.opacity)}function et(t,e,r,n){return 1===arguments.length?tt(t):new rt(t,e,r,null==n?1:n)}function rt(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}e(rt,et,r(n,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new rt(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new rt(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*P,e=+this.l,r=isNaN(this.s)?0:this.s*e*(1-e),n=Math.cos(t),i=Math.sin(t);return new w(255*(e+r*(Y*n+W*i)),255*(e+r*(Z*n+X*i)),255*(e+r*(J*n)),this.opacity)}})),t.color=v,t.cubehelix=et,t.gray=function(t,e){return new R(t,0,0,null==e?1:e)},t.hcl=q,t.hsl=E,t.lab=N,t.lch=function(t,e,r,n){return 1===arguments.length?V(t):new H(r,e,t,null==n?1:n)},t.rgb=_,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],128:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";var e={value:function(){}};function r(){for(var t,e=0,r=arguments.length,i={};e<r;++e){if(!(t=arguments[e]+"")||t in i||/[\s.]/.test(t))throw new Error("illegal type: "+t);i[t]=[]}return new n(i)}function n(t){this._=t}function i(t,e){return t.trim().split(/^|\s+/).map((function(t){var r="",n=t.indexOf(".");if(n>=0&&(r=t.slice(n+1),t=t.slice(0,n)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:r}}))}function a(t,e){for(var r,n=0,i=t.length;n<i;++n)if((r=t[n]).name===e)return r.value}function o(t,r,n){for(var i=0,a=t.length;i<a;++i)if(t[i].name===r){t[i]=e,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=n&&t.push({name:r,value:n}),t}n.prototype=r.prototype={constructor:n,on:function(t,e){var r,n=this._,s=i(t+"",n),l=-1,c=s.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++l<c;)if(r=(t=s[l]).type)n[r]=o(n[r],t.name,e);else if(null==e)for(r in n)n[r]=o(n[r],t.name,null);return this}for(;++l<c;)if((r=(t=s[l]).type)&&(r=a(n[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new n(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,i=new Array(r),a=0;a<r;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,r=(n=this._[t]).length;a<r;++a)n[a].value.apply(e,i)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],i=0,a=n.length;i<a;++i)n[i].value.apply(e,r)}},t.dispatch=r,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],129:[function(t,e,r){!function(n,i){"object"==typeof r&&"undefined"!=typeof e?i(r,t("d3-quadtree"),t("d3-collection"),t("d3-dispatch"),t("d3-timer")):i(n.d3=n.d3||{},n.d3,n.d3,n.d3,n.d3)}(this,(function(t,e,r,n,i){"use strict";function a(t){return function(){return t}}function o(){return 1e-6*(Math.random()-.5)}function s(t){return t.x+t.vx}function l(t){return t.y+t.vy}function c(t){return t.index}function u(t,e){var r=t.get(e);if(!r)throw new Error("missing: "+e);return r}function f(t){return t.x}function h(t){return t.y}var p=Math.PI*(3-Math.sqrt(5));t.forceCenter=function(t,e){var r;function n(){var n,i,a=r.length,o=0,s=0;for(n=0;n<a;++n)o+=(i=r[n]).x,s+=i.y;for(o=o/a-t,s=s/a-e,n=0;n<a;++n)(i=r[n]).x-=o,i.y-=s}return null==t&&(t=0),null==e&&(e=0),n.initialize=function(t){r=t},n.x=function(e){return arguments.length?(t=+e,n):t},n.y=function(t){return arguments.length?(e=+t,n):e},n},t.forceCollide=function(t){var r,n,i=1,c=1;function u(){for(var t,a,u,h,p,d,m,g=r.length,v=0;v<c;++v)for(a=e.quadtree(r,s,l).visitAfter(f),t=0;t<g;++t)u=r[t],d=n[u.index],m=d*d,h=u.x+u.vx,p=u.y+u.vy,a.visit(y);function y(t,e,r,n,a){var s=t.data,l=t.r,c=d+l;if(!s)return e>h+c||n<h-c||r>p+c||a<p-c;if(s.index>u.index){var f=h-s.x-s.vx,g=p-s.y-s.vy,v=f*f+g*g;v<c*c&&(0===f&&(v+=(f=o())*f),0===g&&(v+=(g=o())*g),v=(c-(v=Math.sqrt(v)))/v*i,u.vx+=(f*=v)*(c=(l*=l)/(m+l)),u.vy+=(g*=v)*c,s.vx-=f*(c=1-c),s.vy-=g*c)}}}function f(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function h(){if(r){var e,i,a=r.length;for(n=new Array(a),e=0;e<a;++e)i=r[e],n[i.index]=+t(i,e,r)}}return"function"!=typeof t&&(t=a(null==t?1:+t)),u.initialize=function(t){r=t,h()},u.iterations=function(t){return arguments.length?(c=+t,u):c},u.strength=function(t){return arguments.length?(i=+t,u):i},u.radius=function(e){return arguments.length?(t="function"==typeof e?e:a(+e),h(),u):t},u},t.forceLink=function(t){var e,n,i,s,l,f=c,h=function(t){return 1/Math.min(s[t.source.index],s[t.target.index])},p=a(30),d=1;function m(r){for(var i=0,a=t.length;i<d;++i)for(var s,c,u,f,h,p,m,g=0;g<a;++g)c=(s=t[g]).source,f=(u=s.target).x+u.vx-c.x-c.vx||o(),h=u.y+u.vy-c.y-c.vy||o(),f*=p=((p=Math.sqrt(f*f+h*h))-n[g])/p*r*e[g],h*=p,u.vx-=f*(m=l[g]),u.vy-=h*m,c.vx+=f*(m=1-m),c.vy+=h*m}function g(){if(i){var a,o,c=i.length,h=t.length,p=r.map(i,f);for(a=0,s=new Array(c);a<h;++a)(o=t[a]).index=a,"object"!=typeof o.source&&(o.source=u(p,o.source)),"object"!=typeof o.target&&(o.target=u(p,o.target)),s[o.source.index]=(s[o.source.index]||0)+1,s[o.target.index]=(s[o.target.index]||0)+1;for(a=0,l=new Array(h);a<h;++a)o=t[a],l[a]=s[o.source.index]/(s[o.source.index]+s[o.target.index]);e=new Array(h),v(),n=new Array(h),y()}}function v(){if(i)for(var r=0,n=t.length;r<n;++r)e[r]=+h(t[r],r,t)}function y(){if(i)for(var e=0,r=t.length;e<r;++e)n[e]=+p(t[e],e,t)}return null==t&&(t=[]),m.initialize=function(t){i=t,g()},m.links=function(e){return arguments.length?(t=e,g(),m):t},m.id=function(t){return arguments.length?(f=t,m):f},m.iterations=function(t){return arguments.length?(d=+t,m):d},m.strength=function(t){return arguments.length?(h="function"==typeof t?t:a(+t),v(),m):h},m.distance=function(t){return arguments.length?(p="function"==typeof t?t:a(+t),y(),m):p},m},t.forceManyBody=function(){var t,r,n,i,s=a(-30),l=1,c=1/0,u=.81;function p(i){var a,o=t.length,s=e.quadtree(t,f,h).visitAfter(m);for(n=i,a=0;a<o;++a)r=t[a],s.visit(g)}function d(){if(t){var e,r,n=t.length;for(i=new Array(n),e=0;e<n;++e)r=t[e],i[r.index]=+s(r,e,t)}}function m(t){var e,r,n,a,o,s=0,l=0;if(t.length){for(n=a=o=0;o<4;++o)(e=t[o])&&(r=Math.abs(e.value))&&(s+=e.value,l+=r,n+=r*e.x,a+=r*e.y);t.x=n/l,t.y=a/l}else{(e=t).x=e.data.x,e.y=e.data.y;do{s+=i[e.data.index]}while(e=e.next)}t.value=s}function g(t,e,a,s){if(!t.value)return!0;var f=t.x-r.x,h=t.y-r.y,p=s-e,d=f*f+h*h;if(p*p/u<d)return d<c&&(0===f&&(d+=(f=o())*f),0===h&&(d+=(h=o())*h),d<l&&(d=Math.sqrt(l*d)),r.vx+=f*t.value*n/d,r.vy+=h*t.value*n/d),!0;if(!(t.length||d>=c)){(t.data!==r||t.next)&&(0===f&&(d+=(f=o())*f),0===h&&(d+=(h=o())*h),d<l&&(d=Math.sqrt(l*d)));do{t.data!==r&&(p=i[t.data.index]*n/d,r.vx+=f*p,r.vy+=h*p)}while(t=t.next)}}return p.initialize=function(e){t=e,d()},p.strength=function(t){return arguments.length?(s="function"==typeof t?t:a(+t),d(),p):s},p.distanceMin=function(t){return arguments.length?(l=t*t,p):Math.sqrt(l)},p.distanceMax=function(t){return arguments.length?(c=t*t,p):Math.sqrt(c)},p.theta=function(t){return arguments.length?(u=t*t,p):Math.sqrt(u)},p},t.forceRadial=function(t,e,r){var n,i,o,s=a(.1);function l(t){for(var a=0,s=n.length;a<s;++a){var l=n[a],c=l.x-e||1e-6,u=l.y-r||1e-6,f=Math.sqrt(c*c+u*u),h=(o[a]-f)*i[a]*t/f;l.vx+=c*h,l.vy+=u*h}}function c(){if(n){var e,r=n.length;for(i=new Array(r),o=new Array(r),e=0;e<r;++e)o[e]=+t(n[e],e,n),i[e]=isNaN(o[e])?0:+s(n[e],e,n)}}return"function"!=typeof t&&(t=a(+t)),null==e&&(e=0),null==r&&(r=0),l.initialize=function(t){n=t,c()},l.strength=function(t){return arguments.length?(s="function"==typeof t?t:a(+t),c(),l):s},l.radius=function(e){return arguments.length?(t="function"==typeof e?e:a(+e),c(),l):t},l.x=function(t){return arguments.length?(e=+t,l):e},l.y=function(t){return arguments.length?(r=+t,l):r},l},t.forceSimulation=function(t){var e,a=1,o=.001,s=1-Math.pow(o,1/300),l=0,c=.6,u=r.map(),f=i.timer(d),h=n.dispatch("tick","end");function d(){m(),h.call("tick",e),a<o&&(f.stop(),h.call("end",e))}function m(r){var n,i,o=t.length;void 0===r&&(r=1);for(var f=0;f<r;++f)for(a+=(l-a)*s,u.each((function(t){t(a)})),n=0;n<o;++n)null==(i=t[n]).fx?i.x+=i.vx*=c:(i.x=i.fx,i.vx=0),null==i.fy?i.y+=i.vy*=c:(i.y=i.fy,i.vy=0);return e}function g(){for(var e,r=0,n=t.length;r<n;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var i=10*Math.sqrt(r),a=r*p;e.x=i*Math.cos(a),e.y=i*Math.sin(a)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function v(e){return e.initialize&&e.initialize(t),e}return null==t&&(t=[]),g(),e={tick:m,restart:function(){return f.restart(d),e},stop:function(){return f.stop(),e},nodes:function(r){return arguments.length?(t=r,g(),u.each(v),e):t},alpha:function(t){return arguments.length?(a=+t,e):a},alphaMin:function(t){return arguments.length?(o=+t,e):o},alphaDecay:function(t){return arguments.length?(s=+t,e):+s},alphaTarget:function(t){return arguments.length?(l=+t,e):l},velocityDecay:function(t){return arguments.length?(c=1-t,e):1-c},force:function(t,r){return arguments.length>1?(null==r?u.remove(t):u.set(t,v(r)),e):u.get(t)},find:function(e,r,n){var i,a,o,s,l,c=0,u=t.length;for(null==n?n=1/0:n*=n,c=0;c<u;++c)(o=(i=e-(s=t[c]).x)*i+(a=r-s.y)*a)<n&&(l=s,n=o);return l},on:function(t,r){return arguments.length>1?(h.on(t,r),e):h.on(t)}}},t.forceX=function(t){var e,r,n,i=a(.1);function o(t){for(var i,a=0,o=e.length;a<o;++a)(i=e[a]).vx+=(n[a]-i.x)*r[a]*t}function s(){if(e){var a,o=e.length;for(r=new Array(o),n=new Array(o),a=0;a<o;++a)r[a]=isNaN(n[a]=+t(e[a],a,e))?0:+i(e[a],a,e)}}return"function"!=typeof t&&(t=a(null==t?0:+t)),o.initialize=function(t){e=t,s()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:a(+t),s(),o):i},o.x=function(e){return arguments.length?(t="function"==typeof e?e:a(+e),s(),o):t},o},t.forceY=function(t){var e,r,n,i=a(.1);function o(t){for(var i,a=0,o=e.length;a<o;++a)(i=e[a]).vy+=(n[a]-i.y)*r[a]*t}function s(){if(e){var a,o=e.length;for(r=new Array(o),n=new Array(o),a=0;a<o;++a)r[a]=isNaN(n[a]=+t(e[a],a,e))?0:+i(e[a],a,e)}}return"function"!=typeof t&&(t=a(null==t?0:+t)),o.initialize=function(t){e=t,s()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:a(+t),s(),o):i},o.y=function(e){return arguments.length?(t="function"==typeof e?e:a(+e),s(),o):t},o},Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-collection":126,"d3-dispatch":128,"d3-quadtree":133,"d3-timer":137}],130:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";function e(t,e){return t.parent===e.parent?1:2}function r(t,e){return t+e.x}function n(t,e){return Math.max(t,e.y)}function i(t){var e=0,r=t.children,n=r&&r.length;if(n)for(;--n>=0;)e+=r[n].value;else e=1;t.value=e}function a(t,e){var r,n,i,a,s,u=new c(t),f=+t.value&&(u.value=t.value),h=[u];for(null==e&&(e=o);r=h.pop();)if(f&&(r.value=+r.data.value),(i=e(r.data))&&(s=i.length))for(r.children=new Array(s),a=s-1;a>=0;--a)h.push(n=r.children[a]=new c(i[a])),n.parent=r,n.depth=r.depth+1;return u.eachBefore(l)}function o(t){return t.children}function s(t){t.data=t.data.data}function l(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function c(t){this.data=t,this.depth=this.height=0,this.parent=null}c.prototype=a.prototype={constructor:c,count:function(){return this.eachAfter(i)},each:function(t){var e,r,n,i,a=this,o=[a];do{for(e=o.reverse(),o=[];a=e.pop();)if(t(a),r=a.children)for(n=0,i=r.length;n<i;++n)o.push(r[n])}while(o.length);return this},eachAfter:function(t){for(var e,r,n,i=this,a=[i],o=[];i=a.pop();)if(o.push(i),e=i.children)for(r=0,n=e.length;r<n;++r)a.push(e[r]);for(;i=o.pop();)t(i);return this},eachBefore:function(t){for(var e,r,n=this,i=[n];n=i.pop();)if(t(n),e=n.children)for(r=e.length-1;r>=0;--r)i.push(e[r]);return this},sum:function(t){return this.eachAfter((function(e){for(var r=+t(e.data)||0,n=e.children,i=n&&n.length;--i>=0;)r+=n[i].value;e.value=r}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,r=function(t,e){if(t===e)return t;var r=t.ancestors(),n=e.ancestors(),i=null;t=r.pop(),e=n.pop();for(;t===e;)i=t,t=r.pop(),e=n.pop();return i}(e,t),n=[e];e!==r;)e=e.parent,n.push(e);for(var i=n.length;t!==r;)n.splice(i,0,t),t=t.parent;return n},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){var t=[];return this.each((function(e){t.push(e)})),t},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(r){r!==t&&e.push({source:r.parent,target:r})})),e},copy:function(){return a(this).eachBefore(s)}};var u=Array.prototype.slice;function f(t){for(var e,r,n=0,i=(t=function(t){for(var e,r,n=t.length;n;)r=Math.random()*n--|0,e=t[n],t[n]=t[r],t[r]=e;return t}(u.call(t))).length,a=[];n<i;)e=t[n],r&&d(r,e)?++n:(r=g(a=h(a,e)),n=0);return r}function h(t,e){var r,n;if(m(e,t))return[e];for(r=0;r<t.length;++r)if(p(e,t[r])&&m(v(t[r],e),t))return[t[r],e];for(r=0;r<t.length-1;++r)for(n=r+1;n<t.length;++n)if(p(v(t[r],t[n]),e)&&p(v(t[r],e),t[n])&&p(v(t[n],e),t[r])&&m(y(t[r],t[n],e),t))return[t[r],t[n],e];throw new Error}function p(t,e){var r=t.r-e.r,n=e.x-t.x,i=e.y-t.y;return r<0||r*r<n*n+i*i}function d(t,e){var r=t.r-e.r+1e-6,n=e.x-t.x,i=e.y-t.y;return r>0&&r*r>n*n+i*i}function m(t,e){for(var r=0;r<e.length;++r)if(!d(t,e[r]))return!1;return!0}function g(t){switch(t.length){case 1:return{x:(e=t[0]).x,y:e.y,r:e.r};case 2:return v(t[0],t[1]);case 3:return y(t[0],t[1],t[2])}var e}function v(t,e){var r=t.x,n=t.y,i=t.r,a=e.x,o=e.y,s=e.r,l=a-r,c=o-n,u=s-i,f=Math.sqrt(l*l+c*c);return{x:(r+a+l/f*u)/2,y:(n+o+c/f*u)/2,r:(f+i+s)/2}}function y(t,e,r){var n=t.x,i=t.y,a=t.r,o=e.x,s=e.y,l=e.r,c=r.x,u=r.y,f=r.r,h=n-o,p=n-c,d=i-s,m=i-u,g=l-a,v=f-a,y=n*n+i*i-a*a,x=y-o*o-s*s+l*l,b=y-c*c-u*u+f*f,_=p*d-h*m,w=(d*b-m*x)/(2*_)-n,T=(m*g-d*v)/_,M=(p*x-h*b)/(2*_)-i,k=(h*v-p*g)/_,A=T*T+k*k-1,S=2*(a+w*T+M*k),E=w*w+M*M-a*a,C=-(A?(S+Math.sqrt(S*S-4*A*E))/(2*A):E/S);return{x:n+w+T*C,y:i+M+k*C,r:C}}function x(t,e,r){var n,i,a,o,s=t.x-e.x,l=t.y-e.y,c=s*s+l*l;c?(i=e.r+r.r,i*=i,o=t.r+r.r,i>(o*=o)?(n=(c+o-i)/(2*c),a=Math.sqrt(Math.max(0,o/c-n*n)),r.x=t.x-n*s-a*l,r.y=t.y-n*l+a*s):(n=(c+i-o)/(2*c),a=Math.sqrt(Math.max(0,i/c-n*n)),r.x=e.x+n*s-a*l,r.y=e.y+n*l+a*s)):(r.x=e.x+r.r,r.y=e.y)}function b(t,e){var r=t.r+e.r-1e-6,n=e.x-t.x,i=e.y-t.y;return r>0&&r*r>n*n+i*i}function _(t){var e=t._,r=t.next._,n=e.r+r.r,i=(e.x*r.r+r.x*e.r)/n,a=(e.y*r.r+r.y*e.r)/n;return i*i+a*a}function w(t){this._=t,this.next=null,this.previous=null}function T(t){if(!(i=t.length))return 0;var e,r,n,i,a,o,s,l,c,u,h;if((e=t[0]).x=0,e.y=0,!(i>1))return e.r;if(r=t[1],e.x=-r.r,r.x=e.r,r.y=0,!(i>2))return e.r+r.r;x(r,e,n=t[2]),e=new w(e),r=new w(r),n=new w(n),e.next=n.previous=r,r.next=e.previous=n,n.next=r.previous=e;t:for(s=3;s<i;++s){x(e._,r._,n=t[s]),n=new w(n),l=r.next,c=e.previous,u=r._.r,h=e._.r;do{if(u<=h){if(b(l._,n._)){r=l,e.next=r,r.previous=e,--s;continue t}u+=l._.r,l=l.next}else{if(b(c._,n._)){(e=c).next=r,r.previous=e,--s;continue t}h+=c._.r,c=c.previous}}while(l!==c.next);for(n.previous=e,n.next=r,e.next=r.previous=r=n,a=_(e);(n=n.next)!==r;)(o=_(n))<a&&(e=n,a=o);r=e.next}for(e=[r._],n=r;(n=n.next)!==r;)e.push(n._);for(n=f(e),s=0;s<i;++s)(e=t[s]).x-=n.x,e.y-=n.y;return n.r}function M(t){return null==t?null:k(t)}function k(t){if("function"!=typeof t)throw new Error;return t}function A(){return 0}function S(t){return function(){return t}}function E(t){return Math.sqrt(t.value)}function C(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function L(t,e){return function(r){if(n=r.children){var n,i,a,o=n.length,s=t(r)*e||0;if(s)for(i=0;i<o;++i)n[i].r+=s;if(a=T(n),s)for(i=0;i<o;++i)n[i].r-=s;r.r=a+s}}}function P(t){return function(e){var r=e.parent;e.r*=t,r&&(e.x=r.x+t*e.x,e.y=r.y+t*e.y)}}function I(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function O(t,e,r,n,i){for(var a,o=t.children,s=-1,l=o.length,c=t.value&&(n-e)/t.value;++s<l;)(a=o[s]).y0=r,a.y1=i,a.x0=e,a.x1=e+=a.value*c}var z={depth:-1},D={};function N(t){return t.id}function R(t){return t.parentId}function F(t,e){return t.parent===e.parent?1:2}function B(t){var e=t.children;return e?e[0]:t.t}function j(t){var e=t.children;return e?e[e.length-1]:t.t}function U(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 V(t,e,r){return t.a.parent===e.parent?t.a:r}function q(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}function H(t,e,r,n,i){for(var a,o=t.children,s=-1,l=o.length,c=t.value&&(i-r)/t.value;++s<l;)(a=o[s]).x0=e,a.x1=n,a.y0=r,a.y1=r+=a.value*c}q.prototype=Object.create(c.prototype);var G=(1+Math.sqrt(5))/2;function Y(t,e,r,n,i,a){for(var o,s,l,c,u,f,h,p,d,m,g,v=[],y=e.children,x=0,b=0,_=y.length,w=e.value;x<_;){l=i-r,c=a-n;do{u=y[b++].value}while(!u&&b<_);for(f=h=u,g=u*u*(m=Math.max(c/l,l/c)/(w*t)),d=Math.max(h/g,g/f);b<_;++b){if(u+=s=y[b].value,s<f&&(f=s),s>h&&(h=s),g=u*u*m,(p=Math.max(h/g,g/f))>d){u-=s;break}d=p}v.push(o={value:u,dice:l<c,children:y.slice(x,b)}),o.dice?O(o,r,n,i,w?n+=c*u/w:a):H(o,r,n,w?r+=l*u/w:i,a),w-=u,x=b}return v}var W=function t(e){function r(t,r,n,i,a){Y(e,t,r,n,i,a)}return r.ratio=function(e){return t((e=+e)>1?e:1)},r}(G);var Z=function t(e){function r(t,r,n,i,a){if((o=t._squarify)&&o.ratio===e)for(var o,s,l,c,u,f=-1,h=o.length,p=t.value;++f<h;){for(l=(s=o[f]).children,c=s.value=0,u=l.length;c<u;++c)s.value+=l[c].value;s.dice?O(s,r,n,i,n+=(a-n)*s.value/p):H(s,r,n,r+=(i-r)*s.value/p,a),p-=s.value}else t._squarify=o=Y(e,t,r,n,i,a),o.ratio=e}return r.ratio=function(e){return t((e=+e)>1?e:1)},r}(G);t.cluster=function(){var t=e,i=1,a=1,o=!1;function s(e){var s,l=0;e.eachAfter((function(e){var i=e.children;i?(e.x=function(t){return t.reduce(r,0)/t.length}(i),e.y=function(t){return 1+t.reduce(n,0)}(i)):(e.x=s?l+=t(e,s):0,e.y=0,s=e)}));var c=function(t){for(var e;e=t.children;)t=e[0];return t}(e),u=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(e),f=c.x-t(c,u)/2,h=u.x+t(u,c)/2;return e.eachAfter(o?function(t){t.x=(t.x-e.x)*i,t.y=(e.y-t.y)*a}:function(t){t.x=(t.x-f)/(h-f)*i,t.y=(1-(e.y?t.y/e.y:1))*a})}return s.separation=function(e){return arguments.length?(t=e,s):t},s.size=function(t){return arguments.length?(o=!1,i=+t[0],a=+t[1],s):o?null:[i,a]},s.nodeSize=function(t){return arguments.length?(o=!0,i=+t[0],a=+t[1],s):o?[i,a]:null},s},t.hierarchy=a,t.pack=function(){var t=null,e=1,r=1,n=A;function i(i){return i.x=e/2,i.y=r/2,t?i.eachBefore(C(t)).eachAfter(L(n,.5)).eachBefore(P(1)):i.eachBefore(C(E)).eachAfter(L(A,1)).eachAfter(L(n,i.r/Math.min(e,r))).eachBefore(P(Math.min(e,r)/(2*i.r))),i}return i.radius=function(e){return arguments.length?(t=M(e),i):t},i.size=function(t){return arguments.length?(e=+t[0],r=+t[1],i):[e,r]},i.padding=function(t){return arguments.length?(n="function"==typeof t?t:S(+t),i):n},i},t.packEnclose=f,t.packSiblings=function(t){return T(t),t},t.partition=function(){var t=1,e=1,r=0,n=!1;function i(i){var a=i.height+1;return i.x0=i.y0=r,i.x1=t,i.y1=e/a,i.eachBefore(function(t,e){return function(n){n.children&&O(n,n.x0,t*(n.depth+1)/e,n.x1,t*(n.depth+2)/e);var i=n.x0,a=n.y0,o=n.x1-r,s=n.y1-r;o<i&&(i=o=(i+o)/2),s<a&&(a=s=(a+s)/2),n.x0=i,n.y0=a,n.x1=o,n.y1=s}}(e,a)),n&&i.eachBefore(I),i}return i.round=function(t){return arguments.length?(n=!!t,i):n},i.size=function(r){return arguments.length?(t=+r[0],e=+r[1],i):[t,e]},i.padding=function(t){return arguments.length?(r=+t,i):r},i},t.stratify=function(){var t=N,e=R;function r(r){var n,i,a,o,s,u,f,h=r.length,p=new Array(h),d={};for(i=0;i<h;++i)n=r[i],s=p[i]=new c(n),null!=(u=t(n,i,r))&&(u+="")&&(d[f="$"+(s.id=u)]=f in d?D:s);for(i=0;i<h;++i)if(s=p[i],null!=(u=e(r[i],i,r))&&(u+="")){if(!(o=d["$"+u]))throw new Error("missing: "+u);if(o===D)throw new Error("ambiguous: "+u);o.children?o.children.push(s):o.children=[s],s.parent=o}else{if(a)throw new Error("multiple roots");a=s}if(!a)throw new Error("no root");if(a.parent=z,a.eachBefore((function(t){t.depth=t.parent.depth+1,--h})).eachBefore(l),a.parent=null,h>0)throw new Error("cycle");return a}return r.id=function(e){return arguments.length?(t=k(e),r):t},r.parentId=function(t){return arguments.length?(e=k(t),r):e},r},t.tree=function(){var t=F,e=1,r=1,n=null;function i(i){var l=function(t){for(var e,r,n,i,a,o=new q(t,0),s=[o];e=s.pop();)if(n=e._.children)for(e.children=new Array(a=n.length),i=a-1;i>=0;--i)s.push(r=e.children[i]=new q(n[i],i)),r.parent=e;return(o.parent=new q(null,0)).children=[o],o}(i);if(l.eachAfter(a),l.parent.m=-l.z,l.eachBefore(o),n)i.eachBefore(s);else{var c=i,u=i,f=i;i.eachBefore((function(t){t.x<c.x&&(c=t),t.x>u.x&&(u=t),t.depth>f.depth&&(f=t)}));var h=c===u?1:t(c,u)/2,p=h-c.x,d=e/(u.x+h+p),m=r/(f.depth||1);i.eachBefore((function(t){t.x=(t.x+p)*d,t.y=t.depth*m}))}return i}function a(e){var r=e.children,n=e.parent.children,i=e.i?n[e.i-1]:null;if(r){!function(t){for(var e,r=0,n=0,i=t.children,a=i.length;--a>=0;)(e=i[a]).z+=r,e.m+=r,r+=e.s+(n+=e.c)}(e);var a=(r[0].z+r[r.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-a):e.z=a}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,r,n){if(r){for(var i,a=e,o=e,s=r,l=a.parent.children[0],c=a.m,u=o.m,f=s.m,h=l.m;s=j(s),a=B(a),s&&a;)l=B(l),(o=j(o)).a=e,(i=s.z+f-a.z-c+t(s._,a._))>0&&(U(V(s,e,n),e,i),c+=i,u+=i),f+=s.m,c+=a.m,h+=l.m,u+=o.m;s&&!j(o)&&(o.t=s,o.m+=f-u),a&&!B(l)&&(l.t=a,l.m+=c-h,n=e)}return n}(e,i,e.parent.A||n[0])}function o(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=e,t.y=t.depth*r}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(n=!1,e=+t[0],r=+t[1],i):n?null:[e,r]},i.nodeSize=function(t){return arguments.length?(n=!0,e=+t[0],r=+t[1],i):n?[e,r]:null},i},t.treemap=function(){var t=W,e=!1,r=1,n=1,i=[0],a=A,o=A,s=A,l=A,c=A;function u(t){return t.x0=t.y0=0,t.x1=r,t.y1=n,t.eachBefore(f),i=[0],e&&t.eachBefore(I),t}function f(e){var r=i[e.depth],n=e.x0+r,u=e.y0+r,f=e.x1-r,h=e.y1-r;f<n&&(n=f=(n+f)/2),h<u&&(u=h=(u+h)/2),e.x0=n,e.y0=u,e.x1=f,e.y1=h,e.children&&(r=i[e.depth+1]=a(e)/2,n+=c(e)-r,u+=o(e)-r,(f-=s(e)-r)<n&&(n=f=(n+f)/2),(h-=l(e)-r)<u&&(u=h=(u+h)/2),t(e,n,u,f,h))}return u.round=function(t){return arguments.length?(e=!!t,u):e},u.size=function(t){return arguments.length?(r=+t[0],n=+t[1],u):[r,n]},u.tile=function(e){return arguments.length?(t=k(e),u):t},u.padding=function(t){return arguments.length?u.paddingInner(t).paddingOuter(t):u.paddingInner()},u.paddingInner=function(t){return arguments.length?(a="function"==typeof t?t:S(+t),u):a},u.paddingOuter=function(t){return arguments.length?u.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):u.paddingTop()},u.paddingTop=function(t){return arguments.length?(o="function"==typeof t?t:S(+t),u):o},u.paddingRight=function(t){return arguments.length?(s="function"==typeof t?t:S(+t),u):s},u.paddingBottom=function(t){return arguments.length?(l="function"==typeof t?t:S(+t),u):l},u.paddingLeft=function(t){return arguments.length?(c="function"==typeof t?t:S(+t),u):c},u},t.treemapBinary=function(t,e,r,n,i){var a,o,s=t.children,l=s.length,c=new Array(l+1);for(c[0]=o=a=0;a<l;++a)c[a+1]=o+=s[a].value;!function t(e,r,n,i,a,o,l){if(e>=r-1){var u=s[e];return u.x0=i,u.y0=a,u.x1=o,void(u.y1=l)}var f=c[e],h=n/2+f,p=e+1,d=r-1;for(;p<d;){var m=p+d>>>1;c[m]<h?p=m+1:d=m}h-c[p-1]<c[p]-h&&e+1<p&&--p;var g=c[p]-f,v=n-g;if(o-i>l-a){var y=(i*v+o*g)/n;t(e,p,g,i,a,y,l),t(p,r,v,y,a,o,l)}else{var x=(a*v+l*g)/n;t(e,p,g,i,a,o,x),t(p,r,v,i,x,o,l)}}(0,l,t.value,e,r,n,i)},t.treemapDice=O,t.treemapResquarify=Z,t.treemapSlice=H,t.treemapSliceDice=function(t,e,r,n,i){(1&t.depth?H:O)(t,e,r,n,i)},t.treemapSquarify=W,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],131:[function(t,e,r){!function(n,i){"object"==typeof r&&"undefined"!=typeof e?i(r,t("d3-color")):i((n=n||self).d3=n.d3||{},n.d3)}(this,(function(t,e){"use strict";function r(t,e,r,n,i){var a=t*t,o=a*t;return((1-3*t+3*a-o)*e+(4-6*a+3*o)*r+(1+3*t+3*a-3*o)*n+o*i)/6}function n(t){var e=t.length-1;return function(n){var i=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),a=t[i],o=t[i+1],s=i>0?t[i-1]:2*a-o,l=i<e-1?t[i+2]:2*o-a;return r((n-i/e)*e,s,a,o,l)}}function i(t){var e=t.length;return function(n){var i=Math.floor(((n%=1)<0?++n:n)*e),a=t[(i+e-1)%e],o=t[i%e],s=t[(i+1)%e],l=t[(i+2)%e];return r((n-i/e)*e,a,o,s,l)}}function a(t){return function(){return t}}function o(t,e){return function(r){return t+r*e}}function s(t,e){var r=e-t;return r?o(t,r>180||r<-180?r-360*Math.round(r/360):r):a(isNaN(t)?e:t)}function l(t){return 1==(t=+t)?c:function(e,r){return r-e?function(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}(e,r,t):a(isNaN(e)?r:e)}}function c(t,e){var r=e-t;return r?o(t,r):a(isNaN(t)?e:t)}var u=function t(r){var n=l(r);function i(t,r){var i=n((t=e.rgb(t)).r,(r=e.rgb(r)).r),a=n(t.g,r.g),o=n(t.b,r.b),s=c(t.opacity,r.opacity);return function(e){return t.r=i(e),t.g=a(e),t.b=o(e),t.opacity=s(e),t+""}}return i.gamma=t,i}(1);function f(t){return function(r){var n,i,a=r.length,o=new Array(a),s=new Array(a),l=new Array(a);for(n=0;n<a;++n)i=e.rgb(r[n]),o[n]=i.r||0,s[n]=i.g||0,l[n]=i.b||0;return o=t(o),s=t(s),l=t(l),i.opacity=1,function(t){return i.r=o(t),i.g=s(t),i.b=l(t),i+""}}}var h=f(n),p=f(i);function d(t,e){e||(e=[]);var r,n=t?Math.min(e.length,t.length):0,i=e.slice();return function(a){for(r=0;r<n;++r)i[r]=t[r]*(1-a)+e[r]*a;return i}}function m(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function g(t,e){var r,n=e?e.length:0,i=t?Math.min(n,t.length):0,a=new Array(i),o=new Array(n);for(r=0;r<i;++r)a[r]=T(t[r],e[r]);for(;r<n;++r)o[r]=e[r];return function(t){for(r=0;r<i;++r)o[r]=a[r](t);return o}}function v(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function y(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function x(t,e){var r,n={},i={};for(r in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)r in t?n[r]=T(t[r],e[r]):i[r]=e[r];return function(t){for(r in n)i[r]=n[r](t);return i}}var b=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_=new RegExp(b.source,"g");function w(t,e){var r,n,i,a=b.lastIndex=_.lastIndex=0,o=-1,s=[],l=[];for(t+="",e+="";(r=b.exec(t))&&(n=_.exec(e));)(i=n.index)>a&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:y(r,n)})),a=_.lastIndex;return a<e.length&&(i=e.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var r,n=0;n<e;++n)s[(r=l[n]).i]=r.x(t);return s.join("")})}function T(t,r){var n,i=typeof r;return null==r||"boolean"===i?a(r):("number"===i?y:"string"===i?(n=e.color(r))?(r=n,u):w:r instanceof e.color?u:r instanceof Date?v:m(r)?d:Array.isArray(r)?g:"function"!=typeof r.valueOf&&"function"!=typeof r.toString||isNaN(r)?x:y)(t,r)}var M,k,A,S,E=180/Math.PI,C={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function L(t,e,r,n,i,a){var o,s,l;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(l=t*r+e*n)&&(r-=t*l,n-=e*l),(s=Math.sqrt(r*r+n*n))&&(r/=s,n/=s,l/=s),t*n<e*r&&(t=-t,e=-e,l=-l,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(e,t)*E,skewX:Math.atan(l)*E,scaleX:o,scaleY:s}}function P(t,e,r,n){function i(t){return t.length?t.pop()+" ":""}return function(a,o){var s=[],l=[];return a=t(a),o=t(o),function(t,n,i,a,o,s){if(t!==i||n!==a){var l=o.push("translate(",null,e,null,r);s.push({i:l-4,x:y(t,i)},{i:l-2,x:y(n,a)})}else(i||a)&&o.push("translate("+i+e+a+r)}(a.translateX,a.translateY,o.translateX,o.translateY,s,l),function(t,e,r,a){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),a.push({i:r.push(i(r)+"rotate(",null,n)-2,x:y(t,e)})):e&&r.push(i(r)+"rotate("+e+n)}(a.rotate,o.rotate,s,l),function(t,e,r,a){t!==e?a.push({i:r.push(i(r)+"skewX(",null,n)-2,x:y(t,e)}):e&&r.push(i(r)+"skewX("+e+n)}(a.skewX,o.skewX,s,l),function(t,e,r,n,a,o){if(t!==r||e!==n){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:y(t,r)},{i:s-2,x:y(e,n)})}else 1===r&&1===n||a.push(i(a)+"scale("+r+","+n+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,s,l),a=o=null,function(t){for(var e,r=-1,n=l.length;++r<n;)s[(e=l[r]).i]=e.x(t);return s.join("")}}}var I=P((function(t){return"none"===t?C:(M||(M=document.createElement("DIV"),k=document.documentElement,A=document.defaultView),M.style.transform=t,t=A.getComputedStyle(k.appendChild(M),null).getPropertyValue("transform"),k.removeChild(M),L(+(t=t.slice(7,-1).split(","))[0],+t[1],+t[2],+t[3],+t[4],+t[5]))}),"px, ","px)","deg)"),O=P((function(t){return null==t?C:(S||(S=document.createElementNS("http://www.w3.org/2000/svg","g")),S.setAttribute("transform",t),(t=S.transform.baseVal.consolidate())?L((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):C)}),", ",")",")"),z=Math.SQRT2;function D(t){return((t=Math.exp(t))+1/t)/2}function N(t){return function(r,n){var i=t((r=e.hsl(r)).h,(n=e.hsl(n)).h),a=c(r.s,n.s),o=c(r.l,n.l),s=c(r.opacity,n.opacity);return function(t){return r.h=i(t),r.s=a(t),r.l=o(t),r.opacity=s(t),r+""}}}var R=N(s),F=N(c);function B(t){return function(r,n){var i=t((r=e.hcl(r)).h,(n=e.hcl(n)).h),a=c(r.c,n.c),o=c(r.l,n.l),s=c(r.opacity,n.opacity);return function(t){return r.h=i(t),r.c=a(t),r.l=o(t),r.opacity=s(t),r+""}}}var j=B(s),U=B(c);function V(t){return function r(n){function i(r,i){var a=t((r=e.cubehelix(r)).h,(i=e.cubehelix(i)).h),o=c(r.s,i.s),s=c(r.l,i.l),l=c(r.opacity,i.opacity);return function(t){return r.h=a(t),r.s=o(t),r.l=s(Math.pow(t,n)),r.opacity=l(t),r+""}}return n=+n,i.gamma=r,i}(1)}var q=V(s),H=V(c);t.interpolate=T,t.interpolateArray=function(t,e){return(m(e)?d:g)(t,e)},t.interpolateBasis=n,t.interpolateBasisClosed=i,t.interpolateCubehelix=q,t.interpolateCubehelixLong=H,t.interpolateDate=v,t.interpolateDiscrete=function(t){var e=t.length;return function(r){return t[Math.max(0,Math.min(e-1,Math.floor(r*e)))]}},t.interpolateHcl=j,t.interpolateHclLong=U,t.interpolateHsl=R,t.interpolateHslLong=F,t.interpolateHue=function(t,e){var r=s(+t,+e);return function(t){var e=r(t);return e-360*Math.floor(e/360)}},t.interpolateLab=function(t,r){var n=c((t=e.lab(t)).l,(r=e.lab(r)).l),i=c(t.a,r.a),a=c(t.b,r.b),o=c(t.opacity,r.opacity);return function(e){return t.l=n(e),t.a=i(e),t.b=a(e),t.opacity=o(e),t+""}},t.interpolateNumber=y,t.interpolateNumberArray=d,t.interpolateObject=x,t.interpolateRgb=u,t.interpolateRgbBasis=h,t.interpolateRgbBasisClosed=p,t.interpolateRound=function(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}},t.interpolateString=w,t.interpolateTransformCss=I,t.interpolateTransformSvg=O,t.interpolateZoom=function(t,e){var r,n,i=t[0],a=t[1],o=t[2],s=e[0],l=e[1],c=e[2],u=s-i,f=l-a,h=u*u+f*f;if(h<1e-12)n=Math.log(c/o)/z,r=function(t){return[i+t*u,a+t*f,o*Math.exp(z*t*n)]};else{var p=Math.sqrt(h),d=(c*c-o*o+4*h)/(2*o*2*p),m=(c*c-o*o-4*h)/(2*c*2*p),g=Math.log(Math.sqrt(d*d+1)-d),v=Math.log(Math.sqrt(m*m+1)-m);n=(v-g)/z,r=function(t){var e,r=t*n,s=D(g),l=o/(2*p)*(s*(e=z*r+g,((e=Math.exp(2*e))-1)/(e+1))-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[i+l*u,a+l*f,o*s/D(z*r+g)]}}return r.duration=1e3*n,r},t.piecewise=function(t,e){for(var r=0,n=e.length-1,i=e[0],a=new Array(n<0?0:n);r<n;)a[r]=t(i,i=e[++r]);return function(t){var e=Math.max(0,Math.min(n-1,Math.floor(t*=n)));return a[e](t-e)}},t.quantize=function(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t(n/(e-1));return r},Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-color":127}],132:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";var e=Math.PI,r=2*e,n=r-1e-6;function i(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function a(){return new i}i.prototype=a.prototype={constructor:i,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,r,n){this._+="Q"+ +t+","+ +e+","+(this._x1=+r)+","+(this._y1=+n)},bezierCurveTo:function(t,e,r,n,i,a){this._+="C"+ +t+","+ +e+","+ +r+","+ +n+","+(this._x1=+i)+","+(this._y1=+a)},arcTo:function(t,r,n,i,a){t=+t,r=+r,n=+n,i=+i,a=+a;var o=this._x1,s=this._y1,l=n-t,c=i-r,u=o-t,f=s-r,h=u*u+f*f;if(a<0)throw new Error("negative radius: "+a);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=r);else if(h>1e-6)if(Math.abs(f*l-c*u)>1e-6&&a){var p=n-o,d=i-s,m=l*l+c*c,g=p*p+d*d,v=Math.sqrt(m),y=Math.sqrt(h),x=a*Math.tan((e-Math.acos((m+h-g)/(2*v*y)))/2),b=x/y,_=x/v;Math.abs(b-1)>1e-6&&(this._+="L"+(t+b*u)+","+(r+b*f)),this._+="A"+a+","+a+",0,0,"+ +(f*p>u*d)+","+(this._x1=t+_*l)+","+(this._y1=r+_*c)}else this._+="L"+(this._x1=t)+","+(this._y1=r);else;},arc:function(t,i,a,o,s,l){t=+t,i=+i,l=!!l;var c=(a=+a)*Math.cos(o),u=a*Math.sin(o),f=t+c,h=i+u,p=1^l,d=l?o-s:s-o;if(a<0)throw new Error("negative radius: "+a);null===this._x1?this._+="M"+f+","+h:(Math.abs(this._x1-f)>1e-6||Math.abs(this._y1-h)>1e-6)&&(this._+="L"+f+","+h),a&&(d<0&&(d=d%r+r),d>n?this._+="A"+a+","+a+",0,1,"+p+","+(t-c)+","+(i-u)+"A"+a+","+a+",0,1,"+p+","+(this._x1=f)+","+(this._y1=h):d>1e-6&&(this._+="A"+a+","+a+",0,"+ +(d>=e)+","+p+","+(this._x1=t+a*Math.cos(s))+","+(this._y1=i+a*Math.sin(s))))},rect:function(t,e,r,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +r+"v"+ +n+"h"+-r+"Z"},toString:function(){return this._}},t.path=a,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],133:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";function e(t,e,r,n){if(isNaN(e)||isNaN(r))return t;var i,a,o,s,l,c,u,f,h,p=t._root,d={data:n},m=t._x0,g=t._y0,v=t._x1,y=t._y1;if(!p)return t._root=d,t;for(;p.length;)if((c=e>=(a=(m+v)/2))?m=a:v=a,(u=r>=(o=(g+y)/2))?g=o:y=o,i=p,!(p=p[f=u<<1|c]))return i[f]=d,t;if(s=+t._x.call(null,p.data),l=+t._y.call(null,p.data),e===s&&r===l)return d.next=p,i?i[f]=d:t._root=d,t;do{i=i?i[f]=new Array(4):t._root=new Array(4),(c=e>=(a=(m+v)/2))?m=a:v=a,(u=r>=(o=(g+y)/2))?g=o:y=o}while((f=u<<1|c)==(h=(l>=o)<<1|s>=a));return i[h]=p,i[f]=d,t}function r(t,e,r,n,i){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=i}function n(t){return t[0]}function i(t){return t[1]}function a(t,e,r){var a=new o(null==e?n:e,null==r?i:r,NaN,NaN,NaN,NaN);return null==t?a:a.addAll(t)}function o(t,e,r,n,i,a){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=i,this._y1=a,this._root=void 0}function s(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var l=a.prototype=o.prototype;l.copy=function(){var t,e,r=new o(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=s(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var i=0;i<4;++i)(e=n.source[i])&&(e.length?t.push({source:e,target:n.target[i]=new Array(4)}):n.target[i]=s(e));return r},l.add=function(t){var r=+this._x.call(null,t),n=+this._y.call(null,t);return e(this.cover(r,n),r,n,t)},l.addAll=function(t){var r,n,i,a,o=t.length,s=new Array(o),l=new Array(o),c=1/0,u=1/0,f=-1/0,h=-1/0;for(n=0;n<o;++n)isNaN(i=+this._x.call(null,r=t[n]))||isNaN(a=+this._y.call(null,r))||(s[n]=i,l[n]=a,i<c&&(c=i),i>f&&(f=i),a<u&&(u=a),a>h&&(h=a));if(c>f||u>h)return this;for(this.cover(c,u).cover(f,h),n=0;n<o;++n)e(this,s[n],l[n],t[n]);return this},l.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var r=this._x0,n=this._y0,i=this._x1,a=this._y1;if(isNaN(r))i=(r=Math.floor(t))+1,a=(n=Math.floor(e))+1;else{for(var o,s,l=i-r,c=this._root;r>t||t>=i||n>e||e>=a;)switch(s=(e<n)<<1|t<r,(o=new Array(4))[s]=c,c=o,l*=2,s){case 0:i=r+l,a=n+l;break;case 1:r=i-l,a=n+l;break;case 2:i=r+l,n=a-l;break;case 3:r=i-l,n=a-l}this._root&&this._root.length&&(this._root=c)}return this._x0=r,this._y0=n,this._x1=i,this._y1=a,this},l.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},l.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},l.find=function(t,e,n){var i,a,o,s,l,c,u,f=this._x0,h=this._y0,p=this._x1,d=this._y1,m=[],g=this._root;for(g&&m.push(new r(g,f,h,p,d)),null==n?n=1/0:(f=t-n,h=e-n,p=t+n,d=e+n,n*=n);c=m.pop();)if(!(!(g=c.node)||(a=c.x0)>p||(o=c.y0)>d||(s=c.x1)<f||(l=c.y1)<h))if(g.length){var v=(a+s)/2,y=(o+l)/2;m.push(new r(g[3],v,y,s,l),new r(g[2],a,y,v,l),new r(g[1],v,o,s,y),new r(g[0],a,o,v,y)),(u=(e>=y)<<1|t>=v)&&(c=m[m.length-1],m[m.length-1]=m[m.length-1-u],m[m.length-1-u]=c)}else{var x=t-+this._x.call(null,g.data),b=e-+this._y.call(null,g.data),_=x*x+b*b;if(_<n){var w=Math.sqrt(n=_);f=t-w,h=e-w,p=t+w,d=e+w,i=g.data}}return i},l.remove=function(t){if(isNaN(a=+this._x.call(null,t))||isNaN(o=+this._y.call(null,t)))return this;var e,r,n,i,a,o,s,l,c,u,f,h,p=this._root,d=this._x0,m=this._y0,g=this._x1,v=this._y1;if(!p)return this;if(p.length)for(;;){if((c=a>=(s=(d+g)/2))?d=s:g=s,(u=o>=(l=(m+v)/2))?m=l:v=l,e=p,!(p=p[f=u<<1|c]))return this;if(!p.length)break;(e[f+1&3]||e[f+2&3]||e[f+3&3])&&(r=e,h=f)}for(;p.data!==t;)if(n=p,!(p=p.next))return this;return(i=p.next)&&delete p.next,n?(i?n.next=i:delete n.next,this):e?(i?e[f]=i:delete e[f],(p=e[0]||e[1]||e[2]||e[3])&&p===(e[3]||e[2]||e[1]||e[0])&&!p.length&&(r?r[h]=p:this._root=p),this):(this._root=i,this)},l.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},l.root=function(){return this._root},l.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},l.visit=function(t){var e,n,i,a,o,s,l=[],c=this._root;for(c&&l.push(new r(c,this._x0,this._y0,this._x1,this._y1));e=l.pop();)if(!t(c=e.node,i=e.x0,a=e.y0,o=e.x1,s=e.y1)&&c.length){var u=(i+o)/2,f=(a+s)/2;(n=c[3])&&l.push(new r(n,u,f,o,s)),(n=c[2])&&l.push(new r(n,i,f,u,s)),(n=c[1])&&l.push(new r(n,u,a,o,f)),(n=c[0])&&l.push(new r(n,i,a,u,f))}return this},l.visitAfter=function(t){var e,n=[],i=[];for(this._root&&n.push(new r(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var a=e.node;if(a.length){var o,s=e.x0,l=e.y0,c=e.x1,u=e.y1,f=(s+c)/2,h=(l+u)/2;(o=a[0])&&n.push(new r(o,s,l,f,h)),(o=a[1])&&n.push(new r(o,f,l,c,h)),(o=a[2])&&n.push(new r(o,s,h,f,u)),(o=a[3])&&n.push(new r(o,f,h,c,u))}i.push(e)}for(;e=i.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},l.x=function(t){return arguments.length?(this._x=t,this):this._x},l.y=function(t){return arguments.length?(this._y=t,this):this._y},t.quadtree=a,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],134:[function(t,e,r){!function(n,i){"object"==typeof r&&"undefined"!=typeof e?i(r,t("d3-path")):i((n=n||self).d3=n.d3||{},n.d3)}(this,(function(t,e){"use strict";function r(t){return function(){return t}}var n=Math.abs,i=Math.atan2,a=Math.cos,o=Math.max,s=Math.min,l=Math.sin,c=Math.sqrt,u=Math.PI,f=u/2,h=2*u;function p(t){return t>1?0:t<-1?u:Math.acos(t)}function d(t){return t>=1?f:t<=-1?-f:Math.asin(t)}function m(t){return t.innerRadius}function g(t){return t.outerRadius}function v(t){return t.startAngle}function y(t){return t.endAngle}function x(t){return t&&t.padAngle}function b(t,e,r,n,i,a,o,s){var l=r-t,c=n-e,u=o-i,f=s-a,h=f*l-u*c;if(!(h*h<1e-12))return[t+(h=(u*(e-a)-f*(t-i))/h)*l,e+h*c]}function _(t,e,r,n,i,a,s){var l=t-r,u=e-n,f=(s?a:-a)/c(l*l+u*u),h=f*u,p=-f*l,d=t+h,m=e+p,g=r+h,v=n+p,y=(d+g)/2,x=(m+v)/2,b=g-d,_=v-m,w=b*b+_*_,T=i-a,M=d*v-g*m,k=(_<0?-1:1)*c(o(0,T*T*w-M*M)),A=(M*_-b*k)/w,S=(-M*b-_*k)/w,E=(M*_+b*k)/w,C=(-M*b+_*k)/w,L=A-y,P=S-x,I=E-y,O=C-x;return L*L+P*P>I*I+O*O&&(A=E,S=C),{cx:A,cy:S,x01:-h,y01:-p,x11:A*(i/T-1),y11:S*(i/T-1)}}function w(t){this._context=t}function T(t){return new w(t)}function M(t){return t[0]}function k(t){return t[1]}function A(){var t=M,n=k,i=r(!0),a=null,o=T,s=null;function l(r){var l,c,u,f=r.length,h=!1;for(null==a&&(s=o(u=e.path())),l=0;l<=f;++l)!(l<f&&i(c=r[l],l,r))===h&&((h=!h)?s.lineStart():s.lineEnd()),h&&s.point(+t(c,l,r),+n(c,l,r));if(u)return s=null,u+""||null}return l.x=function(e){return arguments.length?(t="function"==typeof e?e:r(+e),l):t},l.y=function(t){return arguments.length?(n="function"==typeof t?t:r(+t),l):n},l.defined=function(t){return arguments.length?(i="function"==typeof t?t:r(!!t),l):i},l.curve=function(t){return arguments.length?(o=t,null!=a&&(s=o(a)),l):o},l.context=function(t){return arguments.length?(null==t?a=s=null:s=o(a=t),l):a},l}function S(){var t=M,n=null,i=r(0),a=k,o=r(!0),s=null,l=T,c=null;function u(r){var u,f,h,p,d,m=r.length,g=!1,v=new Array(m),y=new Array(m);for(null==s&&(c=l(d=e.path())),u=0;u<=m;++u){if(!(u<m&&o(p=r[u],u,r))===g)if(g=!g)f=u,c.areaStart(),c.lineStart();else{for(c.lineEnd(),c.lineStart(),h=u-1;h>=f;--h)c.point(v[h],y[h]);c.lineEnd(),c.areaEnd()}g&&(v[u]=+t(p,u,r),y[u]=+i(p,u,r),c.point(n?+n(p,u,r):v[u],a?+a(p,u,r):y[u]))}if(d)return c=null,d+""||null}function f(){return A().defined(o).curve(l).context(s)}return u.x=function(e){return arguments.length?(t="function"==typeof e?e:r(+e),n=null,u):t},u.x0=function(e){return arguments.length?(t="function"==typeof e?e:r(+e),u):t},u.x1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:r(+t),u):n},u.y=function(t){return arguments.length?(i="function"==typeof t?t:r(+t),a=null,u):i},u.y0=function(t){return arguments.length?(i="function"==typeof t?t:r(+t),u):i},u.y1=function(t){return arguments.length?(a=null==t?null:"function"==typeof t?t:r(+t),u):a},u.lineX0=u.lineY0=function(){return f().x(t).y(i)},u.lineY1=function(){return f().x(t).y(a)},u.lineX1=function(){return f().x(n).y(i)},u.defined=function(t){return arguments.length?(o="function"==typeof t?t:r(!!t),u):o},u.curve=function(t){return arguments.length?(l=t,null!=s&&(c=l(s)),u):l},u.context=function(t){return arguments.length?(null==t?s=c=null:c=l(s=t),u):s},u}function E(t,e){return e<t?-1:e>t?1:e>=t?0:NaN}function C(t){return t}w.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var L=I(T);function P(t){this._curve=t}function I(t){function e(e){return new P(t(e))}return e._curve=t,e}function O(t){var e=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?e(I(t)):e()._curve},t}function z(){return O(A().curve(L))}function D(){var t=S().curve(L),e=t.curve,r=t.lineX0,n=t.lineX1,i=t.lineY0,a=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return O(r())},delete t.lineX0,t.lineEndAngle=function(){return O(n())},delete t.lineX1,t.lineInnerRadius=function(){return O(i())},delete t.lineY0,t.lineOuterRadius=function(){return O(a())},delete t.lineY1,t.curve=function(t){return arguments.length?e(I(t)):e()._curve},t}function N(t,e){return[(e=+e)*Math.cos(t-=Math.PI/2),e*Math.sin(t)]}P.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};var R=Array.prototype.slice;function F(t){return t.source}function B(t){return t.target}function j(t){var n=F,i=B,a=M,o=k,s=null;function l(){var r,l=R.call(arguments),c=n.apply(this,l),u=i.apply(this,l);if(s||(s=r=e.path()),t(s,+a.apply(this,(l[0]=c,l)),+o.apply(this,l),+a.apply(this,(l[0]=u,l)),+o.apply(this,l)),r)return s=null,r+""||null}return l.source=function(t){return arguments.length?(n=t,l):n},l.target=function(t){return arguments.length?(i=t,l):i},l.x=function(t){return arguments.length?(a="function"==typeof t?t:r(+t),l):a},l.y=function(t){return arguments.length?(o="function"==typeof t?t:r(+t),l):o},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},l}function U(t,e,r,n,i){t.moveTo(e,r),t.bezierCurveTo(e=(e+n)/2,r,e,i,n,i)}function V(t,e,r,n,i){t.moveTo(e,r),t.bezierCurveTo(e,r=(r+i)/2,n,r,n,i)}function q(t,e,r,n,i){var a=N(e,r),o=N(e,r=(r+i)/2),s=N(n,r),l=N(n,i);t.moveTo(a[0],a[1]),t.bezierCurveTo(o[0],o[1],s[0],s[1],l[0],l[1])}var H={draw:function(t,e){var r=Math.sqrt(e/u);t.moveTo(r,0),t.arc(0,0,r,0,h)}},G={draw:function(t,e){var r=Math.sqrt(e/5)/2;t.moveTo(-3*r,-r),t.lineTo(-r,-r),t.lineTo(-r,-3*r),t.lineTo(r,-3*r),t.lineTo(r,-r),t.lineTo(3*r,-r),t.lineTo(3*r,r),t.lineTo(r,r),t.lineTo(r,3*r),t.lineTo(-r,3*r),t.lineTo(-r,r),t.lineTo(-3*r,r),t.closePath()}},Y=Math.sqrt(1/3),W=2*Y,Z={draw:function(t,e){var r=Math.sqrt(e/W),n=r*Y;t.moveTo(0,-r),t.lineTo(n,0),t.lineTo(0,r),t.lineTo(-n,0),t.closePath()}},X=Math.sin(u/10)/Math.sin(7*u/10),J=Math.sin(h/10)*X,K=-Math.cos(h/10)*X,$={draw:function(t,e){var r=Math.sqrt(.8908130915292852*e),n=J*r,i=K*r;t.moveTo(0,-r),t.lineTo(n,i);for(var a=1;a<5;++a){var o=h*a/5,s=Math.cos(o),l=Math.sin(o);t.lineTo(l*r,-s*r),t.lineTo(s*n-l*i,l*n+s*i)}t.closePath()}},Q={draw:function(t,e){var r=Math.sqrt(e),n=-r/2;t.rect(n,n,r,r)}},tt=Math.sqrt(3),et={draw:function(t,e){var r=-Math.sqrt(e/(3*tt));t.moveTo(0,2*r),t.lineTo(-tt*r,-r),t.lineTo(tt*r,-r),t.closePath()}},rt=-.5,nt=Math.sqrt(3)/2,it=1/Math.sqrt(12),at=3*(it/2+1),ot={draw:function(t,e){var r=Math.sqrt(e/at),n=r/2,i=r*it,a=n,o=r*it+r,s=-a,l=o;t.moveTo(n,i),t.lineTo(a,o),t.lineTo(s,l),t.lineTo(rt*n-nt*i,nt*n+rt*i),t.lineTo(rt*a-nt*o,nt*a+rt*o),t.lineTo(rt*s-nt*l,nt*s+rt*l),t.lineTo(rt*n+nt*i,rt*i-nt*n),t.lineTo(rt*a+nt*o,rt*o-nt*a),t.lineTo(rt*s+nt*l,rt*l-nt*s),t.closePath()}},st=[H,G,Z,Q,$,et,ot];function lt(){}function ct(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function ut(t){this._context=t}function ft(t){this._context=t}function ht(t){this._context=t}function pt(t,e){this._basis=new ut(t),this._beta=e}ut.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:ct(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ct(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},ft.prototype={areaStart:lt,areaEnd:lt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:ct(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},ht.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:ct(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},pt.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,r=t.length-1;if(r>0)for(var n,i=t[0],a=e[0],o=t[r]-i,s=e[r]-a,l=-1;++l<=r;)n=l/r,this._basis.point(this._beta*t[l]+(1-this._beta)*(i+n*o),this._beta*e[l]+(1-this._beta)*(a+n*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var dt=function t(e){function r(t){return 1===e?new ut(t):new pt(t,e)}return r.beta=function(e){return t(+e)},r}(.85);function mt(t,e,r){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-r),t._x2,t._y2)}function gt(t,e){this._context=t,this._k=(1-e)/6}gt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:mt(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:mt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var vt=function t(e){function r(t){return new gt(t,e)}return r.tension=function(e){return t(+e)},r}(0);function yt(t,e){this._context=t,this._k=(1-e)/6}yt.prototype={areaStart:lt,areaEnd:lt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:mt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var xt=function t(e){function r(t){return new yt(t,e)}return r.tension=function(e){return t(+e)},r}(0);function bt(t,e){this._context=t,this._k=(1-e)/6}bt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:mt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var _t=function t(e){function r(t){return new bt(t,e)}return r.tension=function(e){return t(+e)},r}(0);function wt(t,e,r){var n=t._x1,i=t._y1,a=t._x2,o=t._y2;if(t._l01_a>1e-12){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);n=(n*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,i=(i*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>1e-12){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);a=(a*c+t._x1*t._l23_2a-e*t._l12_2a)/u,o=(o*c+t._y1*t._l23_2a-r*t._l12_2a)/u}t._context.bezierCurveTo(n,i,a,o,t._x2,t._y2)}function Tt(t,e){this._context=t,this._alpha=e}Tt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:wt(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Mt=function t(e){function r(t){return e?new Tt(t,e):new gt(t,0)}return r.alpha=function(e){return t(+e)},r}(.5);function kt(t,e){this._context=t,this._alpha=e}kt.prototype={areaStart:lt,areaEnd:lt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:wt(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var At=function t(e){function r(t){return e?new kt(t,e):new yt(t,0)}return r.alpha=function(e){return t(+e)},r}(.5);function St(t,e){this._context=t,this._alpha=e}St.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:wt(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Et=function t(e){function r(t){return e?new St(t,e):new bt(t,0)}return r.alpha=function(e){return t(+e)},r}(.5);function Ct(t){this._context=t}function Lt(t){return t<0?-1:1}function Pt(t,e,r){var n=t._x1-t._x0,i=e-t._x1,a=(t._y1-t._y0)/(n||i<0&&-0),o=(r-t._y1)/(i||n<0&&-0),s=(a*i+o*n)/(n+i);return(Lt(a)+Lt(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function It(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function Ot(t,e,r){var n=t._x0,i=t._y0,a=t._x1,o=t._y1,s=(a-n)/3;t._context.bezierCurveTo(n+s,i+s*e,a-s,o-s*r,a,o)}function zt(t){this._context=t}function Dt(t){this._context=new Nt(t)}function Nt(t){this._context=t}function Rt(t){this._context=t}function Ft(t){var e,r,n=t.length-1,i=new Array(n),a=new Array(n),o=new Array(n);for(i[0]=0,a[0]=2,o[0]=t[0]+2*t[1],e=1;e<n-1;++e)i[e]=1,a[e]=4,o[e]=4*t[e]+2*t[e+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*t[n-1]+t[n],e=1;e<n;++e)r=i[e]/a[e-1],a[e]-=r,o[e]-=r*o[e-1];for(i[n-1]=o[n-1]/a[n-1],e=n-2;e>=0;--e)i[e]=(o[e]-i[e+1])/a[e];for(a[n-1]=(t[n]+i[n-1])/2,e=0;e<n-1;++e)a[e]=2*t[e+1]-i[e+1];return[i,a]}function Bt(t,e){this._context=t,this._t=e}function jt(t,e){if((i=t.length)>1)for(var r,n,i,a=1,o=t[e[0]],s=o.length;a<i;++a)for(n=o,o=t[e[a]],r=0;r<s;++r)o[r][1]+=o[r][0]=isNaN(n[r][1])?n[r][0]:n[r][1]}function Ut(t){for(var e=t.length,r=new Array(e);--e>=0;)r[e]=e;return r}function Vt(t,e){return t[e]}function qt(t){var e=t.map(Ht);return Ut(t).sort((function(t,r){return e[t]-e[r]}))}function Ht(t){for(var e,r=-1,n=0,i=t.length,a=-1/0;++r<i;)(e=+t[r][1])>a&&(a=e,n=r);return n}function Gt(t){var e=t.map(Yt);return Ut(t).sort((function(t,r){return e[t]-e[r]}))}function Yt(t){for(var e,r=0,n=-1,i=t.length;++n<i;)(e=+t[n][1])&&(r+=e);return r}Ct.prototype={areaStart:lt,areaEnd:lt,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}},zt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Ot(this,this._t0,It(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var r=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,Ot(this,It(this,r=Pt(this,t,e)),r);break;default:Ot(this,this._t0,r=Pt(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=r}}},(Dt.prototype=Object.create(zt.prototype)).point=function(t,e){zt.prototype.point.call(this,e,t)},Nt.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,r,n,i,a){this._context.bezierCurveTo(e,t,n,r,a,i)}},Rt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,r=t.length;if(r)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===r)this._context.lineTo(t[1],e[1]);else for(var n=Ft(t),i=Ft(e),a=0,o=1;o<r;++a,++o)this._context.bezierCurveTo(n[0][a],i[0][a],n[1][a],i[1][a],t[o],e[o]);(this._line||0!==this._line&&1===r)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}},Bt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}}this._x=t,this._y=e}},t.arc=function(){var t=m,o=g,w=r(0),T=null,M=v,k=y,A=x,S=null;function E(){var r,m,g=+t.apply(this,arguments),v=+o.apply(this,arguments),y=M.apply(this,arguments)-f,x=k.apply(this,arguments)-f,E=n(x-y),C=x>y;if(S||(S=r=e.path()),v<g&&(m=v,v=g,g=m),v>1e-12)if(E>h-1e-12)S.moveTo(v*a(y),v*l(y)),S.arc(0,0,v,y,x,!C),g>1e-12&&(S.moveTo(g*a(x),g*l(x)),S.arc(0,0,g,x,y,C));else{var L,P,I=y,O=x,z=y,D=x,N=E,R=E,F=A.apply(this,arguments)/2,B=F>1e-12&&(T?+T.apply(this,arguments):c(g*g+v*v)),j=s(n(v-g)/2,+w.apply(this,arguments)),U=j,V=j;if(B>1e-12){var q=d(B/g*l(F)),H=d(B/v*l(F));(N-=2*q)>1e-12?(z+=q*=C?1:-1,D-=q):(N=0,z=D=(y+x)/2),(R-=2*H)>1e-12?(I+=H*=C?1:-1,O-=H):(R=0,I=O=(y+x)/2)}var G=v*a(I),Y=v*l(I),W=g*a(D),Z=g*l(D);if(j>1e-12){var X,J=v*a(O),K=v*l(O),$=g*a(z),Q=g*l(z);if(E<u&&(X=b(G,Y,$,Q,J,K,W,Z))){var tt=G-X[0],et=Y-X[1],rt=J-X[0],nt=K-X[1],it=1/l(p((tt*rt+et*nt)/(c(tt*tt+et*et)*c(rt*rt+nt*nt)))/2),at=c(X[0]*X[0]+X[1]*X[1]);U=s(j,(g-at)/(it-1)),V=s(j,(v-at)/(it+1))}}R>1e-12?V>1e-12?(L=_($,Q,G,Y,v,V,C),P=_(J,K,W,Z,v,V,C),S.moveTo(L.cx+L.x01,L.cy+L.y01),V<j?S.arc(L.cx,L.cy,V,i(L.y01,L.x01),i(P.y01,P.x01),!C):(S.arc(L.cx,L.cy,V,i(L.y01,L.x01),i(L.y11,L.x11),!C),S.arc(0,0,v,i(L.cy+L.y11,L.cx+L.x11),i(P.cy+P.y11,P.cx+P.x11),!C),S.arc(P.cx,P.cy,V,i(P.y11,P.x11),i(P.y01,P.x01),!C))):(S.moveTo(G,Y),S.arc(0,0,v,I,O,!C)):S.moveTo(G,Y),g>1e-12&&N>1e-12?U>1e-12?(L=_(W,Z,J,K,g,-U,C),P=_(G,Y,$,Q,g,-U,C),S.lineTo(L.cx+L.x01,L.cy+L.y01),U<j?S.arc(L.cx,L.cy,U,i(L.y01,L.x01),i(P.y01,P.x01),!C):(S.arc(L.cx,L.cy,U,i(L.y01,L.x01),i(L.y11,L.x11),!C),S.arc(0,0,g,i(L.cy+L.y11,L.cx+L.x11),i(P.cy+P.y11,P.cx+P.x11),C),S.arc(P.cx,P.cy,U,i(P.y11,P.x11),i(P.y01,P.x01),!C))):S.arc(0,0,g,D,z,C):S.lineTo(W,Z)}else S.moveTo(0,0);if(S.closePath(),r)return S=null,r+""||null}return E.centroid=function(){var e=(+t.apply(this,arguments)+ +o.apply(this,arguments))/2,r=(+M.apply(this,arguments)+ +k.apply(this,arguments))/2-u/2;return[a(r)*e,l(r)*e]},E.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:r(+e),E):t},E.outerRadius=function(t){return arguments.length?(o="function"==typeof t?t:r(+t),E):o},E.cornerRadius=function(t){return arguments.length?(w="function"==typeof t?t:r(+t),E):w},E.padRadius=function(t){return arguments.length?(T=null==t?null:"function"==typeof t?t:r(+t),E):T},E.startAngle=function(t){return arguments.length?(M="function"==typeof t?t:r(+t),E):M},E.endAngle=function(t){return arguments.length?(k="function"==typeof t?t:r(+t),E):k},E.padAngle=function(t){return arguments.length?(A="function"==typeof t?t:r(+t),E):A},E.context=function(t){return arguments.length?(S=null==t?null:t,E):S},E},t.area=S,t.areaRadial=D,t.curveBasis=function(t){return new ut(t)},t.curveBasisClosed=function(t){return new ft(t)},t.curveBasisOpen=function(t){return new ht(t)},t.curveBundle=dt,t.curveCardinal=vt,t.curveCardinalClosed=xt,t.curveCardinalOpen=_t,t.curveCatmullRom=Mt,t.curveCatmullRomClosed=At,t.curveCatmullRomOpen=Et,t.curveLinear=T,t.curveLinearClosed=function(t){return new Ct(t)},t.curveMonotoneX=function(t){return new zt(t)},t.curveMonotoneY=function(t){return new Dt(t)},t.curveNatural=function(t){return new Rt(t)},t.curveStep=function(t){return new Bt(t,.5)},t.curveStepAfter=function(t){return new Bt(t,1)},t.curveStepBefore=function(t){return new Bt(t,0)},t.line=A,t.lineRadial=z,t.linkHorizontal=function(){return j(U)},t.linkRadial=function(){var t=j(q);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t},t.linkVertical=function(){return j(V)},t.pie=function(){var t=C,e=E,n=null,i=r(0),a=r(h),o=r(0);function s(r){var s,l,c,u,f,p=r.length,d=0,m=new Array(p),g=new Array(p),v=+i.apply(this,arguments),y=Math.min(h,Math.max(-h,a.apply(this,arguments)-v)),x=Math.min(Math.abs(y)/p,o.apply(this,arguments)),b=x*(y<0?-1:1);for(s=0;s<p;++s)(f=g[m[s]=s]=+t(r[s],s,r))>0&&(d+=f);for(null!=e?m.sort((function(t,r){return e(g[t],g[r])})):null!=n&&m.sort((function(t,e){return n(r[t],r[e])})),s=0,c=d?(y-p*b)/d:0;s<p;++s,v=u)l=m[s],u=v+((f=g[l])>0?f*c:0)+b,g[l]={data:r[l],index:s,value:f,startAngle:v,endAngle:u,padAngle:x};return g}return s.value=function(e){return arguments.length?(t="function"==typeof e?e:r(+e),s):t},s.sortValues=function(t){return arguments.length?(e=t,n=null,s):e},s.sort=function(t){return arguments.length?(n=t,e=null,s):n},s.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:r(+t),s):i},s.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:r(+t),s):a},s.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:r(+t),s):o},s},t.pointRadial=N,t.radialArea=D,t.radialLine=z,t.stack=function(){var t=r([]),e=Ut,n=jt,i=Vt;function a(r){var a,o,s=t.apply(this,arguments),l=r.length,c=s.length,u=new Array(c);for(a=0;a<c;++a){for(var f,h=s[a],p=u[a]=new Array(l),d=0;d<l;++d)p[d]=f=[0,+i(r[d],h,d,r)],f.data=r[d];p.key=h}for(a=0,o=e(u);a<c;++a)u[o[a]].index=a;return n(u,o),u}return a.keys=function(e){return arguments.length?(t="function"==typeof e?e:r(R.call(e)),a):t},a.value=function(t){return arguments.length?(i="function"==typeof t?t:r(+t),a):i},a.order=function(t){return arguments.length?(e=null==t?Ut:"function"==typeof t?t:r(R.call(t)),a):e},a.offset=function(t){return arguments.length?(n=null==t?jt:t,a):n},a},t.stackOffsetDiverging=function(t,e){if((s=t.length)>0)for(var r,n,i,a,o,s,l=0,c=t[e[0]].length;l<c;++l)for(a=o=0,r=0;r<s;++r)(i=(n=t[e[r]][l])[1]-n[0])>0?(n[0]=a,n[1]=a+=i):i<0?(n[1]=o,n[0]=o+=i):(n[0]=0,n[1]=i)},t.stackOffsetExpand=function(t,e){if((n=t.length)>0){for(var r,n,i,a=0,o=t[0].length;a<o;++a){for(i=r=0;r<n;++r)i+=t[r][a][1]||0;if(i)for(r=0;r<n;++r)t[r][a][1]/=i}jt(t,e)}},t.stackOffsetNone=jt,t.stackOffsetSilhouette=function(t,e){if((r=t.length)>0){for(var r,n=0,i=t[e[0]],a=i.length;n<a;++n){for(var o=0,s=0;o<r;++o)s+=t[o][n][1]||0;i[n][1]+=i[n][0]=-s/2}jt(t,e)}},t.stackOffsetWiggle=function(t,e){if((i=t.length)>0&&(n=(r=t[e[0]]).length)>0){for(var r,n,i,a=0,o=1;o<n;++o){for(var s=0,l=0,c=0;s<i;++s){for(var u=t[e[s]],f=u[o][1]||0,h=(f-(u[o-1][1]||0))/2,p=0;p<s;++p){var d=t[e[p]];h+=(d[o][1]||0)-(d[o-1][1]||0)}l+=f,c+=h*f}r[o-1][1]+=r[o-1][0]=a,l&&(a-=c/l)}r[o-1][1]+=r[o-1][0]=a,jt(t,e)}},t.stackOrderAppearance=qt,t.stackOrderAscending=Gt,t.stackOrderDescending=function(t){return Gt(t).reverse()},t.stackOrderInsideOut=function(t){var e,r,n=t.length,i=t.map(Yt),a=qt(t),o=0,s=0,l=[],c=[];for(e=0;e<n;++e)r=a[e],o<s?(o+=i[r],l.push(r)):(s+=i[r],c.push(r));return c.reverse().concat(l)},t.stackOrderNone=Ut,t.stackOrderReverse=function(t){return Ut(t).reverse()},t.symbol=function(){var t=r(H),n=r(64),i=null;function a(){var r;if(i||(i=r=e.path()),t.apply(this,arguments).draw(i,+n.apply(this,arguments)),r)return i=null,r+""||null}return a.type=function(e){return arguments.length?(t="function"==typeof e?e:r(e),a):t},a.size=function(t){return arguments.length?(n="function"==typeof t?t:r(+t),a):n},a.context=function(t){return arguments.length?(i=null==t?null:t,a):i},a},t.symbolCircle=H,t.symbolCross=G,t.symbolDiamond=Z,t.symbolSquare=Q,t.symbolStar=$,t.symbolTriangle=et,t.symbolWye=ot,t.symbols=st,Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-path":132}],135:[function(t,e,r){!function(n,i){"object"==typeof r&&"undefined"!=typeof e?i(r,t("d3-time")):i((n=n||self).d3=n.d3||{},n.d3)}(this,(function(t,e){"use strict";function r(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function n(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function i(t,e,r){return{y:t,m:e,d:r,H:0,M:0,S:0,L:0}}function a(t){var a=t.dateTime,o=t.date,l=t.time,c=t.periods,u=t.days,f=t.shortDays,h=t.months,Y=t.shortMonths,ht=p(c),Mt=d(c),kt=p(u),At=d(u),St=p(f),Et=d(f),Ct=p(h),Lt=d(h),Pt=p(Y),It=d(Y),Ot={a:function(t){return f[t.getDay()]},A:function(t){return u[t.getDay()]},b:function(t){return Y[t.getMonth()]},B:function(t){return h[t.getMonth()]},c:null,d:D,e:D,f:j,g:K,G:Q,H:N,I:R,j:F,L:B,m:U,M:V,p:function(t){return c[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:wt,s:Tt,S:q,u:H,U:G,V:W,w:Z,W:X,x:null,X:null,y:J,Y:$,Z:tt,"%":_t},zt={a:function(t){return f[t.getUTCDay()]},A:function(t){return u[t.getUTCDay()]},b:function(t){return Y[t.getUTCMonth()]},B:function(t){return h[t.getUTCMonth()]},c:null,d:et,e:et,f:ot,g:vt,G:xt,H:rt,I:nt,j:it,L:at,m:st,M:lt,p:function(t){return c[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:wt,s:Tt,S:ct,u:ut,U:ft,V:pt,w:dt,W:mt,x:null,X:null,y:gt,Y:yt,Z:bt,"%":_t},Dt={a:function(t,e,r){var n=St.exec(e.slice(r));return n?(t.w=Et[n[0].toLowerCase()],r+n[0].length):-1},A:function(t,e,r){var n=kt.exec(e.slice(r));return n?(t.w=At[n[0].toLowerCase()],r+n[0].length):-1},b:function(t,e,r){var n=Pt.exec(e.slice(r));return n?(t.m=It[n[0].toLowerCase()],r+n[0].length):-1},B:function(t,e,r){var n=Ct.exec(e.slice(r));return n?(t.m=Lt[n[0].toLowerCase()],r+n[0].length):-1},c:function(t,e,r){return Ft(t,a,e,r)},d:k,e:k,f:P,g:_,G:b,H:S,I:S,j:A,L:L,m:M,M:E,p:function(t,e,r){var n=ht.exec(e.slice(r));return n?(t.p=Mt[n[0].toLowerCase()],r+n[0].length):-1},q:T,Q:O,s:z,S:C,u:g,U:v,V:y,w:m,W:x,x:function(t,e,r){return Ft(t,o,e,r)},X:function(t,e,r){return Ft(t,l,e,r)},y:_,Y:b,Z:w,"%":I};function Nt(t,e){return function(r){var n,i,a,o=[],l=-1,c=0,u=t.length;for(r instanceof Date||(r=new Date(+r));++l<u;)37===t.charCodeAt(l)&&(o.push(t.slice(c,l)),null!=(i=s[n=t.charAt(++l)])?n=t.charAt(++l):i="e"===n?" ":"0",(a=e[n])&&(n=a(r,i)),o.push(n),c=l+1);return o.push(t.slice(c,l)),o.join("")}}function Rt(t,a){return function(o){var s,l,c=i(1900,void 0,1);if(Ft(c,t,o+="",0)!=o.length)return null;if("Q"in c)return new Date(c.Q);if("s"in c)return new Date(1e3*c.s+("L"in c?c.L:0));if(a&&!("Z"in c)&&(c.Z=0),"p"in c&&(c.H=c.H%12+12*c.p),void 0===c.m&&(c.m="q"in c?c.q:0),"V"in c){if(c.V<1||c.V>53)return null;"w"in c||(c.w=1),"Z"in c?(l=(s=n(i(c.y,0,1))).getUTCDay(),s=l>4||0===l?e.utcMonday.ceil(s):e.utcMonday(s),s=e.utcDay.offset(s,7*(c.V-1)),c.y=s.getUTCFullYear(),c.m=s.getUTCMonth(),c.d=s.getUTCDate()+(c.w+6)%7):(l=(s=r(i(c.y,0,1))).getDay(),s=l>4||0===l?e.timeMonday.ceil(s):e.timeMonday(s),s=e.timeDay.offset(s,7*(c.V-1)),c.y=s.getFullYear(),c.m=s.getMonth(),c.d=s.getDate()+(c.w+6)%7)}else("W"in c||"U"in c)&&("w"in c||(c.w="u"in c?c.u%7:"W"in c?1:0),l="Z"in c?n(i(c.y,0,1)).getUTCDay():r(i(c.y,0,1)).getDay(),c.m=0,c.d="W"in c?(c.w+6)%7+7*c.W-(l+5)%7:c.w+7*c.U-(l+6)%7);return"Z"in c?(c.H+=c.Z/100|0,c.M+=c.Z%100,n(c)):r(c)}}function Ft(t,e,r,n){for(var i,a,o=0,l=e.length,c=r.length;o<l;){if(n>=c)return-1;if(37===(i=e.charCodeAt(o++))){if(i=e.charAt(o++),!(a=Dt[i in s?e.charAt(o++):i])||(n=a(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}return Ot.x=Nt(o,Ot),Ot.X=Nt(l,Ot),Ot.c=Nt(a,Ot),zt.x=Nt(o,zt),zt.X=Nt(l,zt),zt.c=Nt(a,zt),{format:function(t){var e=Nt(t+="",Ot);return e.toString=function(){return t},e},parse:function(t){var e=Rt(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=Nt(t+="",zt);return e.toString=function(){return t},e},utcParse:function(t){var e=Rt(t+="",!0);return e.toString=function(){return t},e}}}var o,s={"-":"",_:" ",0:"0"},l=/^\s*\d+/,c=/^%/,u=/[\\^$*+?|[\]().{}]/g;function f(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a<r?new Array(r-a+1).join(e)+i:i)}function h(t){return t.replace(u,"\\$&")}function p(t){return new RegExp("^(?:"+t.map(h).join("|")+")","i")}function d(t){for(var e={},r=-1,n=t.length;++r<n;)e[t[r].toLowerCase()]=r;return e}function m(t,e,r){var n=l.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function g(t,e,r){var n=l.exec(e.slice(r,r+1));return n?(t.u=+n[0],r+n[0].length):-1}function v(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.U=+n[0],r+n[0].length):-1}function y(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.V=+n[0],r+n[0].length):-1}function x(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.W=+n[0],r+n[0].length):-1}function b(t,e,r){var n=l.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function _(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function w(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function T(t,e,r){var n=l.exec(e.slice(r,r+1));return n?(t.q=3*n[0]-3,r+n[0].length):-1}function M(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function k(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function A(t,e,r){var n=l.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function S(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function E(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function C(t,e,r){var n=l.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function L(t,e,r){var n=l.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function P(t,e,r){var n=l.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function I(t,e,r){var n=c.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function O(t,e,r){var n=l.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function z(t,e,r){var n=l.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function D(t,e){return f(t.getDate(),e,2)}function N(t,e){return f(t.getHours(),e,2)}function R(t,e){return f(t.getHours()%12||12,e,2)}function F(t,r){return f(1+e.timeDay.count(e.timeYear(t),t),r,3)}function B(t,e){return f(t.getMilliseconds(),e,3)}function j(t,e){return B(t,e)+"000"}function U(t,e){return f(t.getMonth()+1,e,2)}function V(t,e){return f(t.getMinutes(),e,2)}function q(t,e){return f(t.getSeconds(),e,2)}function H(t){var e=t.getDay();return 0===e?7:e}function G(t,r){return f(e.timeSunday.count(e.timeYear(t)-1,t),r,2)}function Y(t){var r=t.getDay();return r>=4||0===r?e.timeThursday(t):e.timeThursday.ceil(t)}function W(t,r){return t=Y(t),f(e.timeThursday.count(e.timeYear(t),t)+(4===e.timeYear(t).getDay()),r,2)}function Z(t){return t.getDay()}function X(t,r){return f(e.timeMonday.count(e.timeYear(t)-1,t),r,2)}function J(t,e){return f(t.getFullYear()%100,e,2)}function K(t,e){return f((t=Y(t)).getFullYear()%100,e,2)}function $(t,e){return f(t.getFullYear()%1e4,e,4)}function Q(t,r){var n=t.getDay();return f((t=n>=4||0===n?e.timeThursday(t):e.timeThursday.ceil(t)).getFullYear()%1e4,r,4)}function tt(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+f(e/60|0,"0",2)+f(e%60,"0",2)}function et(t,e){return f(t.getUTCDate(),e,2)}function rt(t,e){return f(t.getUTCHours(),e,2)}function nt(t,e){return f(t.getUTCHours()%12||12,e,2)}function it(t,r){return f(1+e.utcDay.count(e.utcYear(t),t),r,3)}function at(t,e){return f(t.getUTCMilliseconds(),e,3)}function ot(t,e){return at(t,e)+"000"}function st(t,e){return f(t.getUTCMonth()+1,e,2)}function lt(t,e){return f(t.getUTCMinutes(),e,2)}function ct(t,e){return f(t.getUTCSeconds(),e,2)}function ut(t){var e=t.getUTCDay();return 0===e?7:e}function ft(t,r){return f(e.utcSunday.count(e.utcYear(t)-1,t),r,2)}function ht(t){var r=t.getUTCDay();return r>=4||0===r?e.utcThursday(t):e.utcThursday.ceil(t)}function pt(t,r){return t=ht(t),f(e.utcThursday.count(e.utcYear(t),t)+(4===e.utcYear(t).getUTCDay()),r,2)}function dt(t){return t.getUTCDay()}function mt(t,r){return f(e.utcMonday.count(e.utcYear(t)-1,t),r,2)}function gt(t,e){return f(t.getUTCFullYear()%100,e,2)}function vt(t,e){return f((t=ht(t)).getUTCFullYear()%100,e,2)}function yt(t,e){return f(t.getUTCFullYear()%1e4,e,4)}function xt(t,r){var n=t.getUTCDay();return f((t=n>=4||0===n?e.utcThursday(t):e.utcThursday.ceil(t)).getUTCFullYear()%1e4,r,4)}function bt(){return"+0000"}function _t(){return"%"}function wt(t){return+t}function Tt(t){return Math.floor(+t/1e3)}function Mt(e){return o=a(e),t.timeFormat=o.format,t.timeParse=o.parse,t.utcFormat=o.utcFormat,t.utcParse=o.utcParse,o}Mt({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",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"]});var kt=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var At=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:t.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");t.isoFormat=kt,t.isoParse=At,t.timeFormatDefaultLocale=Mt,t.timeFormatLocale=a,Object.defineProperty(t,"__esModule",{value:!0})}))},{"d3-time":136}],136:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";var e=new Date,r=new Date;function n(t,i,a,o){function s(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return s.floor=function(e){return t(e=new Date(+e)),e},s.ceil=function(e){return t(e=new Date(e-1)),i(e,1),t(e),e},s.round=function(t){var e=s(t),r=s.ceil(t);return t-e<r-t?e:r},s.offset=function(t,e){return i(t=new Date(+t),null==e?1:Math.floor(e)),t},s.range=function(e,r,n){var a,o=[];if(e=s.ceil(e),n=null==n?1:Math.floor(n),!(e<r&&n>0))return o;do{o.push(a=new Date(+e)),i(e,n),t(e)}while(a<e&&e<r);return o},s.filter=function(e){return n((function(r){if(r>=r)for(;t(r),!e(r);)r.setTime(r-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;i(t,-1),!e(t););else for(;--r>=0;)for(;i(t,1),!e(t););}))},a&&(s.count=function(n,i){return e.setTime(+n),r.setTime(+i),t(e),t(r),Math.floor(a(e,r))},s.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?s.filter(o?function(e){return o(e)%t==0}:function(e){return s.count(0,e)%t==0}):s:null}),s}var i=n((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?n((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,r){e.setTime(+e+r*t)}),(function(e,r){return(r-e)/t})):i:null};var a=i.range,o=n((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()})),s=o.range,l=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()})),c=l.range,u=n((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()})),f=u.range,h=n((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1})),p=h.range;function d(t){return n((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var m=d(0),g=d(1),v=d(2),y=d(3),x=d(4),b=d(5),_=d(6),w=m.range,T=g.range,M=v.range,k=y.range,A=x.range,S=b.range,E=_.range,C=n((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})),L=C.range,P=n((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));P.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,r){e.setFullYear(e.getFullYear()+r*t)})):null};var I=P.range,O=n((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getUTCMinutes()})),z=O.range,D=n((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getUTCHours()})),N=D.range,R=n((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1})),F=R.range;function B(t){return n((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}var j=B(0),U=B(1),V=B(2),q=B(3),H=B(4),G=B(5),Y=B(6),W=j.range,Z=U.range,X=V.range,J=q.range,K=H.range,$=G.range,Q=Y.range,tt=n((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})),et=tt.range,rt=n((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));rt.every=function(t){return isFinite(t=Math.floor(t))&&t>0?n((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,r){e.setUTCFullYear(e.getUTCFullYear()+r*t)})):null};var nt=rt.range;t.timeDay=h,t.timeDays=p,t.timeFriday=b,t.timeFridays=S,t.timeHour=u,t.timeHours=f,t.timeInterval=n,t.timeMillisecond=i,t.timeMilliseconds=a,t.timeMinute=l,t.timeMinutes=c,t.timeMonday=g,t.timeMondays=T,t.timeMonth=C,t.timeMonths=L,t.timeSaturday=_,t.timeSaturdays=E,t.timeSecond=o,t.timeSeconds=s,t.timeSunday=m,t.timeSundays=w,t.timeThursday=x,t.timeThursdays=A,t.timeTuesday=v,t.timeTuesdays=M,t.timeWednesday=y,t.timeWednesdays=k,t.timeWeek=m,t.timeWeeks=w,t.timeYear=P,t.timeYears=I,t.utcDay=R,t.utcDays=F,t.utcFriday=G,t.utcFridays=$,t.utcHour=D,t.utcHours=N,t.utcMillisecond=i,t.utcMilliseconds=a,t.utcMinute=O,t.utcMinutes=z,t.utcMonday=U,t.utcMondays=Z,t.utcMonth=tt,t.utcMonths=et,t.utcSaturday=Y,t.utcSaturdays=Q,t.utcSecond=o,t.utcSeconds=s,t.utcSunday=j,t.utcSundays=W,t.utcThursday=H,t.utcThursdays=K,t.utcTuesday=V,t.utcTuesdays=X,t.utcWednesday=q,t.utcWednesdays=J,t.utcWeek=j,t.utcWeeks=W,t.utcYear=rt,t.utcYears=nt,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],137:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?n(r):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";var e,r,n=0,i=0,a=0,o=0,s=0,l=0,c="object"==typeof performance&&performance.now?performance:Date,u="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function f(){return s||(u(h),s=c.now()+l)}function h(){s=0}function p(){this._call=this._time=this._next=null}function d(t,e,r){var n=new p;return n.restart(t,e,r),n}function m(){f(),++n;for(var t,r=e;r;)(t=s-r._time)>=0&&r._call.call(null,t),r=r._next;--n}function g(){s=(o=c.now())+l,n=i=0;try{m()}finally{n=0,function(){var t,n,i=e,a=1/0;for(;i;)i._call?(a>i._time&&(a=i._time),t=i,i=i._next):(n=i._next,i._next=null,i=t?t._next=n:e=n);r=t,y(a)}(),s=0}}function v(){var t=c.now(),e=t-o;e>1e3&&(l-=e,o=t)}function y(t){n||(i&&(i=clearTimeout(i)),t-s>24?(t<1/0&&(i=setTimeout(g,t-c.now()-l)),a&&(a=clearInterval(a))):(a||(o=c.now(),a=setInterval(v,1e3)),n=1,u(g)))}p.prototype=d.prototype={constructor:p,restart:function(t,n,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?f():+i)+(null==n?0:+n),this._next||r===this||(r?r._next=this:e=this,r=this),this._call=t,this._time=i,y()},stop:function(){this._call&&(this._call=null,this._time=1/0,y())}},t.interval=function(t,e,r){var n=new p,i=e;return null==e?(n.restart(t,e,r),n):(e=+e,r=null==r?f():+r,n.restart((function a(o){o+=i,n.restart(a,i+=e,r),t(o)}),e,r),n)},t.now=f,t.timeout=function(t,e,r){var n=new p;return e=null==e?0:+e,n.restart((function(r){n.stop(),t(r+e)}),e,r),n},t.timer=d,t.timerFlush=m,Object.defineProperty(t,"__esModule",{value:!0})}))},{}],138:[function(t,e,r){!function(){var t={version:"3.5.17"},r=[].slice,n=function(t){return r.call(t)},i=this.document;function a(t){return t&&(t.ownerDocument||t.document||t).documentElement}function o(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(i)try{n(i.documentElement.childNodes)[0].nodeType}catch(t){n=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}),i)try{i.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var s=this.Element.prototype,l=s.setAttribute,c=s.setAttributeNS,u=this.CSSStyleDeclaration.prototype,f=u.setProperty;s.setAttribute=function(t,e){l.call(this,t,e+"")},s.setAttributeNS=function(t,e,r){c.call(this,t,e,r+"")},u.setProperty=function(t,e,r){f.call(this,t,e+"",r)}}function h(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function p(t){return null===t?NaN:+t}function d(t){return!isNaN(t)}function m(t){return{left:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n<i;){var a=n+i>>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n<i;){var a=n+i>>>1;t(e[a],r)>0?i=a:n=a+1}return n}}}t.ascending=h,t.descending=function(t,e){return e<t?-1:e>t?1:e>=t?0:NaN},t.min=function(t,e){var r,n,i=-1,a=t.length;if(1===arguments.length){for(;++i<a;)if(null!=(n=t[i])&&n>=n){r=n;break}for(;++i<a;)null!=(n=t[i])&&r>n&&(r=n)}else{for(;++i<a;)if(null!=(n=e.call(t,t[i],i))&&n>=n){r=n;break}for(;++i<a;)null!=(n=e.call(t,t[i],i))&&r>n&&(r=n)}return r},t.max=function(t,e){var r,n,i=-1,a=t.length;if(1===arguments.length){for(;++i<a;)if(null!=(n=t[i])&&n>=n){r=n;break}for(;++i<a;)null!=(n=t[i])&&n>r&&(r=n)}else{for(;++i<a;)if(null!=(n=e.call(t,t[i],i))&&n>=n){r=n;break}for(;++i<a;)null!=(n=e.call(t,t[i],i))&&n>r&&(r=n)}return r},t.extent=function(t,e){var r,n,i,a=-1,o=t.length;if(1===arguments.length){for(;++a<o;)if(null!=(n=t[a])&&n>=n){r=i=n;break}for(;++a<o;)null!=(n=t[a])&&(r>n&&(r=n),i<n&&(i=n))}else{for(;++a<o;)if(null!=(n=e.call(t,t[a],a))&&n>=n){r=i=n;break}for(;++a<o;)null!=(n=e.call(t,t[a],a))&&(r>n&&(r=n),i<n&&(i=n))}return[r,i]},t.sum=function(t,e){var r,n=0,i=t.length,a=-1;if(1===arguments.length)for(;++a<i;)d(r=+t[a])&&(n+=r);else for(;++a<i;)d(r=+e.call(t,t[a],a))&&(n+=r);return n},t.mean=function(t,e){var r,n=0,i=t.length,a=-1,o=i;if(1===arguments.length)for(;++a<i;)d(r=p(t[a]))?n+=r:--o;else for(;++a<i;)d(r=p(e.call(t,t[a],a)))?n+=r:--o;if(o)return n/o},t.quantile=function(t,e){var r=(t.length-1)*e+1,n=Math.floor(r),i=+t[n-1],a=r-n;return a?i+a*(t[n]-i):i},t.median=function(e,r){var n,i=[],a=e.length,o=-1;if(1===arguments.length)for(;++o<a;)d(n=p(e[o]))&&i.push(n);else for(;++o<a;)d(n=p(r.call(e,e[o],o)))&&i.push(n);if(i.length)return t.quantile(i.sort(h),.5)},t.variance=function(t,e){var r,n,i=t.length,a=0,o=0,s=-1,l=0;if(1===arguments.length)for(;++s<i;)d(r=p(t[s]))&&(o+=(n=r-a)*(r-(a+=n/++l)));else for(;++s<i;)d(r=p(e.call(t,t[s],s)))&&(o+=(n=r-a)*(r-(a+=n/++l)));if(l>1)return o/(l-1)},t.deviation=function(){var e=t.variance.apply(this,arguments);return e?Math.sqrt(e):e};var g=m(h);function v(t){return t.length}t.bisectLeft=g.left,t.bisect=t.bisectRight=g.right,t.bisector=function(t){return m(1===t.length?function(e,r){return h(t(e),r)}:t)},t.shuffle=function(t,e,r){(a=arguments.length)<3&&(r=t.length,a<2&&(e=0));for(var n,i,a=r-e;a;)i=Math.random()*a--|0,n=t[a+e],t[a+e]=t[i+e],t[i+e]=n;return t},t.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},t.pairs=function(t){for(var e=0,r=t.length-1,n=t[0],i=new Array(r<0?0:r);e<r;)i[e]=[n,n=t[++e]];return i},t.transpose=function(e){if(!(a=e.length))return[];for(var r=-1,n=t.min(e,v),i=new Array(n);++r<n;)for(var a,o=-1,s=i[r]=new Array(a);++o<a;)s[o]=e[o][r];return i},t.zip=function(){return t.transpose(arguments)},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e},t.values=function(t){var e=[];for(var r in t)e.push(t[r]);return e},t.entries=function(t){var e=[];for(var r in t)e.push({key:r,value:t[r]});return e},t.merge=function(t){for(var e,r,n,i=t.length,a=-1,o=0;++a<i;)o+=t[a].length;for(r=new Array(o);--i>=0;)for(e=(n=t[i]).length;--e>=0;)r[--o]=n[e];return r};var y=Math.abs;function x(t){for(var e=1;t*e%1;)e*=10;return e}function b(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function _(){this._=Object.create(null)}t.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=[],a=x(y(r)),o=-1;if(t*=a,e*=a,(r*=a)<0)for(;(n=t+r*++o)>e;)i.push(n/a);else for(;(n=t+r*++o)<e;)i.push(n/a);return i},t.map=function(t,e){var r=new _;if(t instanceof _)t.forEach((function(t,e){r.set(t,e)}));else if(Array.isArray(t)){var n,i=-1,a=t.length;if(1===arguments.length)for(;++i<a;)r.set(i,t[i]);else for(;++i<a;)r.set(e.call(t,n=t[i],i),n)}else for(var o in t)r.set(o,t[o]);return r};function w(t){return"__proto__"==(t+="")||"\0"===t[0]?"\0"+t:t}function T(t){return"\0"===(t+="")[0]?t.slice(1):t}function M(t){return w(t)in this._}function k(t){return(t=w(t))in this._&&delete this._[t]}function A(){var t=[];for(var e in this._)t.push(T(e));return t}function S(){var t=0;for(var e in this._)++t;return t}function E(){for(var t in this._)return!1;return!0}function C(){this._=Object.create(null)}function L(t){return t}function P(t,e,r){return function(){var n=r.apply(e,arguments);return n===e?t:n}}function I(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var r=0,n=O.length;r<n;++r){var i=O[r]+e;if(i in t)return i}}b(_,{has:M,get:function(t){return this._[w(t)]},set:function(t,e){return this._[w(t)]=e},remove:k,keys:A,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:T(e),value:this._[e]});return t},size:S,empty:E,forEach:function(t){for(var e in this._)t.call(this,T(e),this._[e])}}),t.nest=function(){var e,r,n={},i=[],a=[];function o(t,a,s){if(s>=i.length)return r?r.call(n,a):e?a.sort(e):a;for(var l,c,u,f,h=-1,p=a.length,d=i[s++],m=new _;++h<p;)(f=m.get(l=d(c=a[h])))?f.push(c):m.set(l,[c]);return t?(c=t(),u=function(e,r){c.set(e,o(t,r,s))}):(c={},u=function(e,r){c[e]=o(t,r,s)}),m.forEach(u),c}return n.map=function(t,e){return o(e,t,0)},n.entries=function(e){return function t(e,r){if(r>=i.length)return e;var n=[],o=a[r++];return e.forEach((function(e,i){n.push({key:e,values:t(i,r)})})),o?n.sort((function(t,e){return o(t.key,e.key)})):n}(o(t.map,e,0),0)},n.key=function(t){return i.push(t),n},n.sortKeys=function(t){return a[i.length-1]=t,n},n.sortValues=function(t){return e=t,n},n.rollup=function(t){return r=t,n},n},t.set=function(t){var e=new C;if(t)for(var r=0,n=t.length;r<n;++r)e.add(t[r]);return e},b(C,{has:M,add:function(t){return this._[w(t+="")]=!0,t},remove:k,values:A,size:S,empty:E,forEach:function(t){for(var e in this._)t.call(this,T(e))}}),t.behavior={},t.rebind=function(t,e){for(var r,n=1,i=arguments.length;++n<i;)t[r=arguments[n]]=P(t,e,e[r]);return t};var O=["webkit","ms","moz","Moz","o","O"];function z(){}function D(){}function N(t){var e=[],r=new _;function n(){for(var r,n=e,i=-1,a=n.length;++i<a;)(r=n[i].on)&&r.apply(this,arguments);return t}return n.on=function(n,i){var a,o=r.get(n);return arguments.length<2?o&&o.on:(o&&(o.on=null,e=e.slice(0,a=e.indexOf(o)).concat(e.slice(a+1)),r.remove(n)),i&&e.push(r.set(n,{on:i})),t)},n}function R(){t.event.preventDefault()}function F(){for(var e,r=t.event;e=r.sourceEvent;)r=e;return r}function B(e){for(var r=new D,n=0,i=arguments.length;++n<i;)r[arguments[n]]=N(r);return r.of=function(n,i){return function(a){try{var o=a.sourceEvent=t.event;a.target=e,t.event=a,r[a.type].apply(n,i)}finally{t.event=o}}},r}t.dispatch=function(){for(var t=new D,e=-1,r=arguments.length;++e<r;)t[arguments[e]]=N(t);return t},D.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}},t.event=null,t.requote=function(t){return t.replace(j,"\\$&")};var j=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,U={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]};function V(t){return U(t,Y),t}var q=function(t,e){return e.querySelector(t)},H=function(t,e){return e.querySelectorAll(t)},G=function(t,e){var r=t.matches||t[I(t,"matchesSelector")];return(G=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(q=function(t,e){return Sizzle(t,e)[0]||null},H=Sizzle,G=Sizzle.matchesSelector),t.selection=function(){return t.select(i.documentElement)};var Y=t.selection.prototype=[];function W(t){return"function"==typeof t?t:function(){return q(t,this)}}function Z(t){return"function"==typeof t?t:function(){return H(t,this)}}Y.select=function(t){var e,r,n,i,a=[];t=W(t);for(var o=-1,s=this.length;++o<s;){a.push(e=[]),e.parentNode=(n=this[o]).parentNode;for(var l=-1,c=n.length;++l<c;)(i=n[l])?(e.push(r=t.call(i,i.__data__,l,o)),r&&"__data__"in i&&(r.__data__=i.__data__)):e.push(null)}return V(a)},Y.selectAll=function(t){var e,r,i=[];t=Z(t);for(var a=-1,o=this.length;++a<o;)for(var s=this[a],l=-1,c=s.length;++l<c;)(r=s[l])&&(i.push(e=n(t.call(r,r.__data__,l,a))),e.parentNode=r);return V(i)};var X="http://www.w3.org/1999/xhtml",J={svg:"http://www.w3.org/2000/svg",xhtml:X,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function K(e,r){return e=t.ns.qualify(e),null==r?e.local?function(){this.removeAttributeNS(e.space,e.local)}:function(){this.removeAttribute(e)}:"function"==typeof r?e.local?function(){var t=r.apply(this,arguments);null==t?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,t)}:function(){var t=r.apply(this,arguments);null==t?this.removeAttribute(e):this.setAttribute(e,t)}:e.local?function(){this.setAttributeNS(e.space,e.local,r)}:function(){this.setAttribute(e,r)}}function $(t){return t.trim().replace(/\s+/g," ")}function Q(e){return new RegExp("(?:^|\\s+)"+t.requote(e)+"(?:\\s+|$)","g")}function tt(t){return(t+"").trim().split(/^|\s+/)}function et(t,e){var r=(t=tt(t).map(rt)).length;return"function"==typeof e?function(){for(var n=-1,i=e.apply(this,arguments);++n<r;)t[n](this,i)}:function(){for(var n=-1;++n<r;)t[n](this,e)}}function rt(t){var e=Q(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",$(i+" "+t))):r.setAttribute("class",$(i.replace(e," ")))}}function nt(t,e,r){return null==e?function(){this.style.removeProperty(t)}:"function"==typeof e?function(){var n=e.apply(this,arguments);null==n?this.style.removeProperty(t):this.style.setProperty(t,n,r)}:function(){this.style.setProperty(t,e,r)}}function it(t,e){return null==e?function(){delete this[t]}:"function"==typeof e?function(){var r=e.apply(this,arguments);null==r?delete this[t]:this[t]=r}:function(){this[t]=e}}function at(e){return"function"==typeof e?e:(e=t.ns.qualify(e)).local?function(){return this.ownerDocument.createElementNS(e.space,e.local)}:function(){var t=this.ownerDocument,r=this.namespaceURI;return r===X&&t.documentElement.namespaceURI===X?t.createElement(e):t.createElementNS(r,e)}}function ot(){var t=this.parentNode;t&&t.removeChild(this)}function st(t){return{__data__:t}}function lt(t){return function(){return G(this,t)}}function ct(t){return arguments.length||(t=h),function(e,r){return e&&r?t(e.__data__,r.__data__):!e-!r}}function ut(t,e){for(var r=0,n=t.length;r<n;r++)for(var i,a=t[r],o=0,s=a.length;o<s;o++)(i=a[o])&&e(i,o,r);return t}function ft(t){return U(t,ht),t}t.ns={prefix:J,qualify:function(t){var e=t.indexOf(":"),r=t;return e>=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),J.hasOwnProperty(r)?{space:J[r],local:t}:t}},Y.attr=function(e,r){if(arguments.length<2){if("string"==typeof e){var n=this.node();return(e=t.ns.qualify(e)).local?n.getAttributeNS(e.space,e.local):n.getAttribute(e)}for(r in e)this.each(K(r,e[r]));return this}return this.each(K(e,r))},Y.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=tt(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(!Q(t[i]).test(e))return!1;return!0}for(e in t)this.each(et(e,t[e]));return this}return this.each(et(t,e))},Y.style=function(t,e,r){var n=arguments.length;if(n<3){if("string"!=typeof t){for(r in n<2&&(e=""),t)this.each(nt(r,t[r],e));return this}if(n<2){var i=this.node();return o(i).getComputedStyle(i,null).getPropertyValue(t)}r=""}return this.each(nt(t,e,r))},Y.property=function(t,e){if(arguments.length<2){if("string"==typeof t)return this.node()[t];for(e in t)this.each(it(e,t[e]));return this}return this.each(it(t,e))},Y.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},Y.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},Y.append=function(t){return t=at(t),this.select((function(){return this.appendChild(t.apply(this,arguments))}))},Y.insert=function(t,e){return t=at(t),e=W(e),this.select((function(){return this.insertBefore(t.apply(this,arguments),e.apply(this,arguments)||null)}))},Y.remove=function(){return this.each(ot)},Y.data=function(t,e){var r,n,i=-1,a=this.length;if(!arguments.length){for(t=new Array(a=(r=this[0]).length);++i<a;)(n=r[i])&&(t[i]=n.__data__);return t}function o(t,r){var n,i,a,o=t.length,u=r.length,f=Math.min(o,u),h=new Array(u),p=new Array(u),d=new Array(o);if(e){var m,g=new _,v=new Array(o);for(n=-1;++n<o;)(i=t[n])&&(g.has(m=e.call(i,i.__data__,n))?d[n]=i:g.set(m,i),v[n]=m);for(n=-1;++n<u;)(i=g.get(m=e.call(r,a=r[n],n)))?!0!==i&&(h[n]=i,i.__data__=a):p[n]=st(a),g.set(m,!0);for(n=-1;++n<o;)n in v&&!0!==g.get(v[n])&&(d[n]=t[n])}else{for(n=-1;++n<f;)i=t[n],a=r[n],i?(i.__data__=a,h[n]=i):p[n]=st(a);for(;n<u;++n)p[n]=st(r[n]);for(;n<o;++n)d[n]=t[n]}p.update=h,p.parentNode=h.parentNode=d.parentNode=t.parentNode,s.push(p),l.push(h),c.push(d)}var s=ft([]),l=V([]),c=V([]);if("function"==typeof t)for(;++i<a;)o(r=this[i],t.call(r,r.parentNode.__data__,i));else for(;++i<a;)o(r=this[i],t);return l.enter=function(){return s},l.exit=function(){return c},l},Y.datum=function(t){return arguments.length?this.property("__data__",t):this.property("__data__")},Y.filter=function(t){var e,r,n,i=[];"function"!=typeof t&&(t=lt(t));for(var a=0,o=this.length;a<o;a++){i.push(e=[]),e.parentNode=(r=this[a]).parentNode;for(var s=0,l=r.length;s<l;s++)(n=r[s])&&t.call(n,n.__data__,s,a)&&e.push(n)}return V(i)},Y.order=function(){for(var t=-1,e=this.length;++t<e;)for(var r,n=this[t],i=n.length-1,a=n[i];--i>=0;)(r=n[i])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},Y.sort=function(t){t=ct.apply(this,arguments);for(var e=-1,r=this.length;++e<r;)this[e].sort(t);return this.order()},Y.each=function(t){return ut(this,(function(e,r,n){t.call(e,e.__data__,r,n)}))},Y.call=function(t){var e=n(arguments);return t.apply(e[0]=this,e),this},Y.empty=function(){return!this.node()},Y.node=function(){for(var t=0,e=this.length;t<e;t++)for(var r=this[t],n=0,i=r.length;n<i;n++){var a=r[n];if(a)return a}return null},Y.size=function(){var t=0;return ut(this,(function(){++t})),t};var ht=[];function pt(t){var e,r;return function(n,i,a){var o,s=t[a].update,l=s.length;for(a!=r&&(r=a,e=0),i>=e&&(e=i+1);!(o=s[e])&&++e<l;);return o}}function dt(e,r,i){var a="__on"+e,o=e.indexOf("."),s=gt;o>0&&(e=e.slice(0,o));var l=mt.get(e);function c(){var t=this[a];t&&(this.removeEventListener(e,t,t.$),delete this[a])}return l&&(e=l,s=vt),o?r?function(){var t=s(r,n(arguments));c.call(this),this.addEventListener(e,this[a]=t,t.$=i),t._=r}:c:r?z:function(){var r,n=new RegExp("^__on([^.]+)"+t.requote(e)+"$");for(var i in this)if(r=i.match(n)){var a=this[i];this.removeEventListener(r[1],a,a.$),delete this[i]}}}t.selection.enter=ft,t.selection.enter.prototype=ht,ht.append=Y.append,ht.empty=Y.empty,ht.node=Y.node,ht.call=Y.call,ht.size=Y.size,ht.select=function(t){for(var e,r,n,i,a,o=[],s=-1,l=this.length;++s<l;){n=(i=this[s]).update,o.push(e=[]),e.parentNode=i.parentNode;for(var c=-1,u=i.length;++c<u;)(a=i[c])?(e.push(n[c]=r=t.call(i.parentNode,a.__data__,c,s)),r.__data__=a.__data__):e.push(null)}return V(o)},ht.insert=function(t,e){return arguments.length<2&&(e=pt(this)),Y.insert.call(this,t,e)},t.select=function(t){var e;return"string"==typeof t?(e=[q(t,i)]).parentNode=i.documentElement:(e=[t]).parentNode=a(t),V([e])},t.selectAll=function(t){var e;return"string"==typeof t?(e=n(H(t,i))).parentNode=i.documentElement:(e=n(t)).parentNode=null,V([e])},Y.on=function(t,e,r){var n=arguments.length;if(n<3){if("string"!=typeof t){for(r in n<2&&(e=!1),t)this.each(dt(r,t[r],e));return this}if(n<2)return(n=this.node()["__on"+t])&&n._;r=!1}return this.each(dt(t,e,r))};var mt=t.map({mouseenter:"mouseover",mouseleave:"mouseout"});function gt(e,r){return function(n){var i=t.event;t.event=n,r[0]=this.__data__;try{e.apply(this,r)}finally{t.event=i}}}function vt(t,e){var r=gt(t,e);return function(t){var e=t.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||r.call(this,t)}}i&&mt.forEach((function(t){"on"+t in i&&mt.remove(t)}));var yt,xt=0;function bt(e){var r=".dragsuppress-"+ ++xt,n="click"+r,i=t.select(o(e)).on("touchmove"+r,R).on("dragstart"+r,R).on("selectstart"+r,R);if(null==yt&&(yt=!("onselectstart"in e)&&I(e.style,"userSelect")),yt){var s=a(e).style,l=s[yt];s[yt]="none"}return function(t){if(i.on(r,null),yt&&(s[yt]=l),t){var e=function(){i.on(n,null)};i.on(n,(function(){R(),e()}),!0),setTimeout(e,0)}}}t.mouse=function(t){return wt(t,F())};var _t=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;function wt(e,r){r.changedTouches&&(r=r.changedTouches[0]);var n=e.ownerSVGElement||e;if(n.createSVGPoint){var i=n.createSVGPoint();if(_t<0){var a=o(e);if(a.scrollX||a.scrollY){var s=(n=t.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important"))[0][0].getScreenCTM();_t=!(s.f||s.e),n.remove()}}return _t?(i.x=r.pageX,i.y=r.pageY):(i.x=r.clientX,i.y=r.clientY),[(i=i.matrixTransform(e.getScreenCTM().inverse())).x,i.y]}var l=e.getBoundingClientRect();return[r.clientX-l.left-e.clientLeft,r.clientY-l.top-e.clientTop]}function Tt(){return t.event.changedTouches[0].identifier}t.touch=function(t,e,r){if(arguments.length<3&&(r=e,e=F().changedTouches),e)for(var n,i=0,a=e.length;i<a;++i)if((n=e[i]).identifier===r)return wt(t,n)},t.behavior.drag=function(){var e=B(a,"drag","dragstart","dragend"),r=null,n=s(z,t.mouse,o,"mousemove","mouseup"),i=s(Tt,t.touch,L,"touchmove","touchend");function a(){this.on("mousedown.drag",n).on("touchstart.drag",i)}function s(n,i,a,o,s){return function(){var l,c=this,u=t.event.target.correspondingElement||t.event.target,f=c.parentNode,h=e.of(c,arguments),p=0,d=n(),m=".drag"+(null==d?"":"-"+d),g=t.select(a(u)).on(o+m,x).on(s+m,b),v=bt(u),y=i(f,d);function x(){var t,e,r=i(f,d);r&&(t=r[0]-y[0],e=r[1]-y[1],p|=t|e,y=r,h({type:"drag",x:r[0]+l[0],y:r[1]+l[1],dx:t,dy:e}))}function b(){i(f,d)&&(g.on(o+m,null).on(s+m,null),v(p),h({type:"dragend"}))}l=r?[(l=r.apply(c,arguments)).x-y[0],l.y-y[1]]:[0,0],h({type:"dragstart"})}}return a.origin=function(t){return arguments.length?(r=t,a):r},t.rebind(a,e,"on")},t.touches=function(t,e){return arguments.length<2&&(e=F().touches),e?n(e).map((function(e){var r=wt(t,e);return r.identifier=e.identifier,r})):[]};var Mt=1e-6,kt=1e-12,At=Math.PI,St=2*At,Et=St-Mt,Ct=At/2,Lt=At/180,Pt=180/At;function It(t){return t>0?1:t<0?-1:0}function Ot(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function zt(t){return t>1?0:t<-1?At:Math.acos(t)}function Dt(t){return t>1?Ct:t<-1?-Ct:Math.asin(t)}function Nt(t){return((t=Math.exp(t))+1/t)/2}function Rt(t){return(t=Math.sin(t/2))*t}var Ft=Math.SQRT2;t.interpolateZoom=function(t,e){var r,n,i=t[0],a=t[1],o=t[2],s=e[0],l=e[1],c=e[2],u=s-i,f=l-a,h=u*u+f*f;if(h<kt)n=Math.log(c/o)/Ft,r=function(t){return[i+t*u,a+t*f,o*Math.exp(Ft*t*n)]};else{var p=Math.sqrt(h),d=(c*c-o*o+4*h)/(2*o*2*p),m=(c*c-o*o-4*h)/(2*c*2*p),g=Math.log(Math.sqrt(d*d+1)-d),v=Math.log(Math.sqrt(m*m+1)-m);n=(v-g)/Ft,r=function(t){var e,r=t*n,s=Nt(g),l=o/(2*p)*(s*(e=Ft*r+g,((e=Math.exp(2*e))-1)/(e+1))-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[i+l*u,a+l*f,o*s/Nt(Ft*r+g)]}}return r.duration=1e3*n,r},t.behavior.zoom=function(){var e,r,n,a,s,l,c,u,f,h={x:0,y:0,k:1},p=[960,500],d=Ut,m=250,g=0,v="mousedown.zoom",y="mousemove.zoom",x="mouseup.zoom",b="touchstart.zoom",_=B(w,"zoomstart","zoom","zoomend");function w(t){t.on(v,P).on(jt+".zoom",O).on("dblclick.zoom",z).on(b,I)}function T(t){return[(t[0]-h.x)/h.k,(t[1]-h.y)/h.k]}function M(t){h.k=Math.max(d[0],Math.min(d[1],t))}function k(t,e){e=function(t){return[t[0]*h.k+h.x,t[1]*h.k+h.y]}(e),h.x+=t[0]-e[0],h.y+=t[1]-e[1]}function A(e,n,i,a){e.__chart__={x:h.x,y:h.y,k:h.k},M(Math.pow(2,a)),k(r=n,i),e=t.select(e),m>0&&(e=e.transition().duration(m)),e.call(w.event)}function S(){c&&c.domain(l.range().map((function(t){return(t-h.x)/h.k})).map(l.invert)),f&&f.domain(u.range().map((function(t){return(t-h.y)/h.k})).map(u.invert))}function E(t){g++||t({type:"zoomstart"})}function C(t){S(),t({type:"zoom",scale:h.k,translate:[h.x,h.y]})}function L(t){--g||(t({type:"zoomend"}),r=null)}function P(){var e=this,r=_.of(e,arguments),n=0,i=t.select(o(e)).on(y,l).on(x,c),a=T(t.mouse(e)),s=bt(e);function l(){n=1,k(t.mouse(e),a),C(r)}function c(){i.on(y,null).on(x,null),s(n),L(r)}vs.call(e),E(r)}function I(){var e,r=this,n=_.of(r,arguments),i={},a=0,o=".zoom-"+t.event.changedTouches[0].identifier,l="touchmove"+o,c="touchend"+o,u=[],f=t.select(r),p=bt(r);function d(){var n=t.touches(r);return e=h.k,n.forEach((function(t){t.identifier in i&&(i[t.identifier]=T(t))})),n}function m(){var e=t.event.target;t.select(e).on(l,g).on(c,y),u.push(e);for(var n=t.event.changedTouches,o=0,f=n.length;o<f;++o)i[n[o].identifier]=null;var p=d(),m=Date.now();if(1===p.length){if(m-s<500){var v=p[0];A(r,v,i[v.identifier],Math.floor(Math.log(h.k)/Math.LN2)+1),R()}s=m}else if(p.length>1){v=p[0];var x=p[1],b=v[0]-x[0],_=v[1]-x[1];a=b*b+_*_}}function g(){var o,l,c,u,f=t.touches(r);vs.call(r);for(var h=0,p=f.length;h<p;++h,u=null)if(c=f[h],u=i[c.identifier]){if(l)break;o=c,l=u}if(u){var d=(d=c[0]-o[0])*d+(d=c[1]-o[1])*d,m=a&&Math.sqrt(d/a);o=[(o[0]+c[0])/2,(o[1]+c[1])/2],l=[(l[0]+u[0])/2,(l[1]+u[1])/2],M(m*e)}s=null,k(o,l),C(n)}function y(){if(t.event.touches.length){for(var e=t.event.changedTouches,r=0,a=e.length;r<a;++r)delete i[e[r].identifier];for(var s in i)return void d()}t.selectAll(u).on(o,null),f.on(v,P).on(b,I),p(),L(n)}m(),E(n),f.on(v,null).on(b,m)}function O(){var i=_.of(this,arguments);a?clearTimeout(a):(vs.call(this),e=T(r=n||t.mouse(this)),E(i)),a=setTimeout((function(){a=null,L(i)}),50),R(),M(Math.pow(2,.002*Bt())*h.k),k(r,e),C(i)}function z(){var e=t.mouse(this),r=Math.log(h.k)/Math.LN2;A(this,e,T(e),t.event.shiftKey?Math.ceil(r)-1:Math.floor(r)+1)}return jt||(jt="onwheel"in i?(Bt=function(){return-t.event.deltaY*(t.event.deltaMode?120:1)},"wheel"):"onmousewheel"in i?(Bt=function(){return t.event.wheelDelta},"mousewheel"):(Bt=function(){return-t.event.detail},"MozMousePixelScroll")),w.event=function(e){e.each((function(){var e=_.of(this,arguments),n=h;bs?t.select(this).transition().each("start.zoom",(function(){h=this.__chart__||{x:0,y:0,k:1},E(e)})).tween("zoom:zoom",(function(){var i=p[0],a=p[1],o=r?r[0]:i/2,s=r?r[1]:a/2,l=t.interpolateZoom([(o-h.x)/h.k,(s-h.y)/h.k,i/h.k],[(o-n.x)/n.k,(s-n.y)/n.k,i/n.k]);return function(t){var r=l(t),n=i/r[2];this.__chart__=h={x:o-r[0]*n,y:s-r[1]*n,k:n},C(e)}})).each("interrupt.zoom",(function(){L(e)})).each("end.zoom",(function(){L(e)})):(this.__chart__=h,E(e),C(e),L(e))}))},w.translate=function(t){return arguments.length?(h={x:+t[0],y:+t[1],k:h.k},S(),w):[h.x,h.y]},w.scale=function(t){return arguments.length?(h={x:h.x,y:h.y,k:null},M(+t),S(),w):h.k},w.scaleExtent=function(t){return arguments.length?(d=null==t?Ut:[+t[0],+t[1]],w):d},w.center=function(t){return arguments.length?(n=t&&[+t[0],+t[1]],w):n},w.size=function(t){return arguments.length?(p=t&&[+t[0],+t[1]],w):p},w.duration=function(t){return arguments.length?(m=+t,w):m},w.x=function(t){return arguments.length?(c=t,l=t.copy(),h={x:0,y:0,k:1},w):c},w.y=function(t){return arguments.length?(f=t,u=t.copy(),h={x:0,y:0,k:1},w):f},t.rebind(w,_,"on")};var Bt,jt,Ut=[0,1/0];function Vt(){}function qt(t,e,r){return this instanceof qt?(this.h=+t,this.s=+e,void(this.l=+r)):arguments.length<2?t instanceof qt?new qt(t.h,t.s,t.l):le(""+t,ce,qt):new qt(t,e,r)}t.color=Vt,Vt.prototype.toString=function(){return this.rgb()+""},t.hsl=qt;var Ht=qt.prototype=new Vt;function Gt(t,e,r){var n,i;function a(t){return Math.round(255*function(t){return t>360?t-=360:t<0&&(t+=360),t<60?n+(i-n)*t/60:t<180?i:t<240?n+(i-n)*(240-t)/60:n}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)||e<0?0:e>1?1:e,n=2*(r=r<0?0:r>1?1:r)-(i=r<=.5?r*(1+e):r+e-r*e),new ne(a(t+120),a(t),a(t-120))}function Yt(e,r,n){return this instanceof Yt?(this.h=+e,this.c=+r,void(this.l=+n)):arguments.length<2?e instanceof Yt?new Yt(e.h,e.c,e.l):Qt(e instanceof Xt?e.l:(e=ue((e=t.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new Yt(e,r,n)}Ht.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new qt(this.h,this.s,this.l/t)},Ht.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new qt(this.h,this.s,t*this.l)},Ht.rgb=function(){return Gt(this.h,this.s,this.l)},t.hcl=Yt;var Wt=Yt.prototype=new Vt;function Zt(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new Xt(r,Math.cos(t*=Lt)*e,Math.sin(t)*e)}function Xt(t,e,r){return this instanceof Xt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof Xt?new Xt(t.l,t.a,t.b):t instanceof Yt?Zt(t.h,t.c,t.l):ue((t=ne(t)).r,t.g,t.b):new Xt(t,e,r)}Wt.brighter=function(t){return new Yt(this.h,this.c,Math.min(100,this.l+Jt*(arguments.length?t:1)))},Wt.darker=function(t){return new Yt(this.h,this.c,Math.max(0,this.l-Jt*(arguments.length?t:1)))},Wt.rgb=function(){return Zt(this.h,this.c,this.l).rgb()},t.lab=Xt;var Jt=18,Kt=Xt.prototype=new Vt;function $t(t,e,r){var n=(t+16)/116,i=n+e/500,a=n-r/200;return new ne(re(3.2404542*(i=.95047*te(i))-1.5371385*(n=1*te(n))-.4985314*(a=1.08883*te(a))),re(-.969266*i+1.8760108*n+.041556*a),re(.0556434*i-.2040259*n+1.0572252*a))}function Qt(t,e,r){return t>0?new Yt(Math.atan2(r,e)*Pt,Math.sqrt(e*e+r*r),t):new Yt(NaN,NaN,t)}function te(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function ee(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function re(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function ne(t,e,r){return this instanceof ne?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof ne?new ne(t.r,t.g,t.b):le(""+t,ne,Gt):new ne(t,e,r)}function ie(t){return new ne(t>>16,t>>8&255,255&t)}function ae(t){return ie(t)+""}Kt.brighter=function(t){return new Xt(Math.min(100,this.l+Jt*(arguments.length?t:1)),this.a,this.b)},Kt.darker=function(t){return new Xt(Math.max(0,this.l-Jt*(arguments.length?t:1)),this.a,this.b)},Kt.rgb=function(){return $t(this.l,this.a,this.b)},t.rgb=ne;var oe=ne.prototype=new Vt;function se(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function le(t,e,r){var n,i,a,o=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(he(i[0]),he(i[1]),he(i[2]))}return(a=pe.get(t))?e(a.r,a.g,a.b):(null==t||"#"!==t.charAt(0)||isNaN(a=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&a)>>4,o|=o>>4,s=240&a,s|=s>>4,l=15&a,l|=l<<4):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,l=255&a)),e(o,s,l))}function ce(t,e,r){var n,i,a=Math.min(t/=255,e/=255,r/=255),o=Math.max(t,e,r),s=o-a,l=(o+a)/2;return s?(i=l<.5?s/(o+a):s/(2-o-a),n=t==o?(e-r)/s+(e<r?6:0):e==o?(r-t)/s+2:(t-e)/s+4,n*=60):(n=NaN,i=l>0&&l<1?0:n),new qt(n,i,l)}function ue(t,e,r){var n=ee((.4124564*(t=fe(t))+.3575761*(e=fe(e))+.1804375*(r=fe(r)))/.95047),i=ee((.2126729*t+.7151522*e+.072175*r)/1);return Xt(116*i-16,500*(n-i),200*(i-ee((.0193339*t+.119192*e+.9503041*r)/1.08883)))}function fe(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function he(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}oe.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&&e<i&&(e=i),r&&r<i&&(r=i),n&&n<i&&(n=i),new ne(Math.min(255,e/t),Math.min(255,r/t),Math.min(255,n/t))):new ne(i,i,i)},oe.darker=function(t){return new ne((t=Math.pow(.7,arguments.length?t:1))*this.r,t*this.g,t*this.b)},oe.hsl=function(){return ce(this.r,this.g,this.b)},oe.toString=function(){return"#"+se(this.r)+se(this.g)+se(this.b)};var pe=t.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});function de(t){return"function"==typeof t?t:function(){return t}}function me(t){return function(e,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),ge(e,r,t,n)}}function ge(e,r,i,a){var o={},s=t.dispatch("beforesend","progress","load","error"),l={},c=new XMLHttpRequest,u=null;function f(){var t,e=c.status;if(!e&&function(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}(c)||e>=200&&e<300||304===e){try{t=i.call(o,c)}catch(t){return void s.error.call(o,t)}s.load.call(o,t)}else s.error.call(o,c)}return this.XDomainRequest&&!("withCredentials"in c)&&/^(http(s)?:)?\/\//.test(e)&&(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=f:c.onreadystatechange=function(){c.readyState>3&&f()},c.onprogress=function(e){var r=t.event;t.event=e;try{s.progress.call(o,c)}finally{t.event=r}},o.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?l[t]:(null==e?delete l[t]:l[t]=e+"",o)},o.mimeType=function(t){return arguments.length?(r=null==t?null:t+"",o):r},o.responseType=function(t){return arguments.length?(u=t,o):u},o.response=function(t){return i=t,o},["get","post"].forEach((function(t){o[t]=function(){return o.send.apply(o,[t].concat(n(arguments)))}})),o.send=function(t,n,i){if(2===arguments.length&&"function"==typeof n&&(i=n,n=null),c.open(t,e,!0),null==r||"accept"in l||(l.accept=r+",*/*"),c.setRequestHeader)for(var a in l)c.setRequestHeader(a,l[a]);return null!=r&&c.overrideMimeType&&c.overrideMimeType(r),null!=u&&(c.responseType=u),null!=i&&o.on("error",i).on("load",(function(t){i(null,t)})),s.beforesend.call(o,c),c.send(null==n?null:n),o},o.abort=function(){return c.abort(),o},t.rebind(o,s,"on"),null==a?o:o.get(function(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}(a))}pe.forEach((function(t,e){pe.set(t,ie(e))})),t.functor=de,t.xhr=me(L),t.dsv=function(t,e){var r=new RegExp('["'+t+"\n]"),n=t.charCodeAt(0);function i(t,r,n){arguments.length<3&&(n=r,r=null);var i=ge(t,e,null==r?a:o(r),n);return i.row=function(t){return arguments.length?i.response(null==(r=t)?a:o(t)):r},i}function a(t){return i.parse(t.responseText)}function o(t){return function(e){return i.parse(e.responseText,t)}}function s(e){return e.map(l).join(t)}function l(t){return r.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}return i.parse=function(t,e){var r;return i.parseRows(t,(function(t,n){if(r)return r(t,n-1);var i=new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+"]"})).join(",")+"}");r=e?function(t,r){return e(i(t),r)}:i}))},i.parseRows=function(t,e){var r,i,a={},o={},s=[],l=t.length,c=0,u=0;function f(){if(c>=l)return o;if(i)return i=!1,a;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++<l;)if(34===t.charCodeAt(r)){if(34!==t.charCodeAt(r+1))break;++r}return c=r+2,13===(s=t.charCodeAt(r+1))?(i=!0,10===t.charCodeAt(r+2)&&++c):10===s&&(i=!0),t.slice(e+1,r).replace(/""/g,'"')}for(;c<l;){var s,u=1;if(10===(s=t.charCodeAt(c++)))i=!0;else if(13===s)i=!0,10===t.charCodeAt(c)&&(++c,++u);else if(s!==n)continue;return t.slice(e,c-u)}return t.slice(e)}for(;(r=f())!==o;){for(var h=[];r!==a&&r!==o;)h.push(r),r=f();e&&null==(h=e(h,u++))||s.push(h)}return s},i.format=function(e){if(Array.isArray(e[0]))return i.formatRows(e);var r=new C,n=[];return e.forEach((function(t){for(var e in t)r.has(e)||n.push(r.add(e))})),[n.map(l).join(t)].concat(e.map((function(e){return n.map((function(t){return l(e[t])})).join(t)}))).join("\n")},i.formatRows=function(t){return t.map(s).join("\n")},i},t.csv=t.dsv(",","text/csv"),t.tsv=t.dsv("\t","text/tab-separated-values");var ve,ye,xe,be,_e=this[I(this,"requestAnimationFrame")]||function(t){setTimeout(t,17)};function we(t,e,r){var n=arguments.length;n<2&&(e=0),n<3&&(r=Date.now());var i=r+e,a={c:t,t:i,n:null};return ye?ye.n=a:ve=a,ye=a,xe||(be=clearTimeout(be),xe=1,_e(Te)),a}function Te(){var t=Me(),e=ke()-t;e>24?(isFinite(e)&&(clearTimeout(be),be=setTimeout(Te,e)),xe=0):(xe=1,_e(Te))}function Me(){for(var t=Date.now(),e=ve;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function ke(){for(var t,e=ve,r=1/0;e;)e.c?(e.t<r&&(r=e.t),e=(t=e).n):e=t?t.n=e.n:ve=e.n;return ye=t,r}function Ae(t,e){return e-(t?Math.ceil(Math.log(t)/Math.LN10):1)}t.timer=function(){we.apply(this,arguments)},t.timer.flush=function(){Me(),ke()},t.round=function(t,e){return e?Math.round(t*(e=Math.pow(10,e)))/e:Math.round(t)};var Se=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map((function(t,e){var r=Math.pow(10,3*y(8-e));return{scale:e>8?function(t){return t/r}:function(t){return t*r},symbol:t}}));function Ee(e){var r=e.decimal,n=e.thousands,i=e.grouping,a=e.currency,o=i&&n?function(t,e){for(var r=t.length,a=[],o=0,s=i[0],l=0;r>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),a.push(t.substring(r-=s,r+s)),!((l+=s+1)>e));)s=i[o=(o+1)%i.length];return a.reverse().join(n)}:L;return function(e){var n=Ce.exec(e),i=n[1]||" ",s=n[2]||">",l=n[3]||"-",c=n[4]||"",u=n[5],f=+n[6],h=n[7],p=n[8],d=n[9],m=1,g="",v="",y=!1,x=!0;switch(p&&(p=+p.substring(1)),(u||"0"===i&&"="===s)&&(u=i="0",s="="),d){case"n":h=!0,d="g";break;case"%":m=100,v="%",d="f";break;case"p":m=100,v="%",d="r";break;case"b":case"o":case"x":case"X":"#"===c&&(g="0"+d.toLowerCase());case"c":x=!1;case"d":y=!0,p=0;break;case"s":m=-1,d="r"}"$"===c&&(g=a[0],v=a[1]),"r"!=d||p||(d="g"),null!=p&&("g"==d?p=Math.max(1,Math.min(21,p)):"e"!=d&&"f"!=d||(p=Math.max(0,Math.min(20,p)))),d=Le.get(d)||Pe;var b=u&&h;return function(e){var n=v;if(y&&e%1)return"";var a=e<0||0===e&&1/e<0?(e=-e,"-"):"-"===l?"":l;if(m<0){var c=t.formatPrefix(e,p);e=c.scale(e),n=c.symbol+v}else e*=m;var _,w,T=(e=d(e,p)).lastIndexOf(".");if(T<0){var M=x?e.lastIndexOf("e"):-1;M<0?(_=e,w=""):(_=e.substring(0,M),w=e.substring(M))}else _=e.substring(0,T),w=r+e.substring(T+1);!u&&h&&(_=o(_,1/0));var k=g.length+_.length+w.length+(b?0:a.length),A=k<f?new Array(k=f-k+1).join(i):"";return b&&(_=o(A+_,A.length?f-w.length:1/0)),a+=g,e=_+w,("<"===s?a+e+A:">"===s?A+a+e:"^"===s?A.substring(0,k>>=1)+a+e+A.substring(k):a+(b?e:A+e))+n}}}t.formatPrefix=function(e,r){var n=0;return(e=+e)&&(e<0&&(e*=-1),r&&(e=t.round(e,Ae(e,r))),n=1+Math.floor(1e-12+Math.log(e)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),Se[8+n/3]};var Ce=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Le=t.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(e,r){return(e=t.round(e,Ae(e,r))).toFixed(Math.max(0,Math.min(20,Ae(e*(1+1e-15),r))))}});function Pe(t){return t+""}var Ie=t.time={},Oe=Date;function ze(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}ze.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(){De.setUTCDate.apply(this._,arguments)},setDay:function(){De.setUTCDay.apply(this._,arguments)},setFullYear:function(){De.setUTCFullYear.apply(this._,arguments)},setHours:function(){De.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){De.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){De.setUTCMinutes.apply(this._,arguments)},setMonth:function(){De.setUTCMonth.apply(this._,arguments)},setSeconds:function(){De.setUTCSeconds.apply(this._,arguments)},setTime:function(){De.setTime.apply(this._,arguments)}};var De=Date.prototype;function Ne(t,e,r){function n(e){var r=t(e),n=a(r,1);return e-r<n-e?r:n}function i(r){return e(r=t(new Oe(r-1)),1),r}function a(t,r){return e(t=new Oe(+t),r),t}function o(t,n,a){var o=i(t),s=[];if(a>1)for(;o<n;)r(o)%a||s.push(new Date(+o)),e(o,1);else for(;o<n;)s.push(new Date(+o)),e(o,1);return s}t.floor=t,t.round=n,t.ceil=i,t.offset=a,t.range=o;var s=t.utc=Re(t);return s.floor=s,s.round=Re(n),s.ceil=Re(i),s.offset=Re(a),s.range=function(t,e,r){try{Oe=ze;var n=new ze;return n._=t,o(n,e,r)}finally{Oe=Date}},t}function Re(t){return function(e,r){try{Oe=ze;var n=new ze;return n._=e,t(n,r)._}finally{Oe=Date}}}function Fe(e){var r=e.dateTime,n=e.date,i=e.time,a=e.periods,o=e.days,s=e.shortDays,l=e.months,c=e.shortMonths;function u(t){var e=t.length;function r(r){for(var n,i,a,o=[],s=-1,l=0;++s<e;)37===t.charCodeAt(s)&&(o.push(t.slice(l,s)),null!=(i=Be[n=t.charAt(++s)])&&(n=t.charAt(++s)),(a=_[n])&&(n=a(r,null==i?"e"===n?" ":"0":i)),o.push(n),l=s+1);return o.push(t.slice(l,s)),o.join("")}return r.parse=function(e){var r={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null};if(f(r,t,e,0)!=e.length)return null;"p"in r&&(r.H=r.H%12+12*r.p);var n=null!=r.Z&&Oe!==ze,i=new(n?ze:Oe);return"j"in r?i.setFullYear(r.y,0,r.j):"W"in r||"U"in r?("w"in r||(r.w="W"in r?1:0),i.setFullYear(r.y,0,1),i.setFullYear(r.y,0,"W"in r?(r.w+6)%7+7*r.W-(i.getDay()+5)%7:r.w+7*r.U-(i.getDay()+6)%7)):i.setFullYear(r.y,r.m,r.d),i.setHours(r.H+(r.Z/100|0),r.M+r.Z%100,r.S,r.L),n?i._:i},r.toString=function(){return t},r}function f(t,e,r,n){for(var i,a,o,s=0,l=e.length,c=r.length;s<l;){if(n>=c)return-1;if(37===(i=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=w[o in Be?e.charAt(s++):o])||(n=a(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}u.utc=function(t){var e=u(t);function r(t){try{var r=new(Oe=ze);return r._=t,e(r)}finally{Oe=Date}}return r.parse=function(t){try{Oe=ze;var r=e.parse(t);return r&&r._}finally{Oe=Date}},r.toString=e.toString,r},u.multi=u.utc.multi=or;var h=t.map(),p=qe(o),d=He(o),m=qe(s),g=He(s),v=qe(l),y=He(l),x=qe(c),b=He(c);a.forEach((function(t,e){h.set(t.toLowerCase(),e)}));var _={a:function(t){return s[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return l[t.getMonth()]},c:u(r),d:function(t,e){return Ve(t.getDate(),e,2)},e:function(t,e){return Ve(t.getDate(),e,2)},H:function(t,e){return Ve(t.getHours(),e,2)},I:function(t,e){return Ve(t.getHours()%12||12,e,2)},j:function(t,e){return Ve(1+Ie.dayOfYear(t),e,3)},L:function(t,e){return Ve(t.getMilliseconds(),e,3)},m:function(t,e){return Ve(t.getMonth()+1,e,2)},M:function(t,e){return Ve(t.getMinutes(),e,2)},p:function(t){return a[+(t.getHours()>=12)]},S:function(t,e){return Ve(t.getSeconds(),e,2)},U:function(t,e){return Ve(Ie.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ve(Ie.mondayOfYear(t),e,2)},x:u(n),X:u(i),y:function(t,e){return Ve(t.getFullYear()%100,e,2)},Y:function(t,e){return Ve(t.getFullYear()%1e4,e,4)},Z:ir,"%":function(){return"%"}},w={a:function(t,e,r){m.lastIndex=0;var n=m.exec(e.slice(r));return n?(t.w=g.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(t,e,r){p.lastIndex=0;var n=p.exec(e.slice(r));return n?(t.w=d.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(t,e,r){x.lastIndex=0;var n=x.exec(e.slice(r));return n?(t.m=b.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(t,e,r){v.lastIndex=0;var n=v.exec(e.slice(r));return n?(t.m=y.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(t,e,r){return f(t,_.c.toString(),e,r)},d:$e,e:$e,H:tr,I:tr,j:Qe,L:nr,m:Ke,M:er,p:function(t,e,r){var n=h.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)},S:rr,U:Ye,w:Ge,W:We,x:function(t,e,r){return f(t,_.x.toString(),e,r)},X:function(t,e,r){return f(t,_.X.toString(),e,r)},y:Xe,Y:Ze,Z:Je,"%":ar};return u}Ie.year=Ne((function(t){return(t=Ie.day(t)).setMonth(0,1),t}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t){return t.getFullYear()})),Ie.years=Ie.year.range,Ie.years.utc=Ie.year.utc.range,Ie.day=Ne((function(t){var e=new Oe(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})),Ie.days=Ie.day.range,Ie.days.utc=Ie.day.utc.range,Ie.dayOfYear=function(t){var e=Ie.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=Ie[t]=Ne((function(t){return(t=Ie.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=Ie.year(t).getDay();return Math.floor((Ie.dayOfYear(t)+(r+e)%7)/7)-(r!==e)}));Ie[t+"s"]=r.range,Ie[t+"s"].utc=r.utc.range,Ie[t+"OfYear"]=function(t){var r=Ie.year(t).getDay();return Math.floor((Ie.dayOfYear(t)+(r+e)%7)/7)}})),Ie.week=Ie.sunday,Ie.weeks=Ie.sunday.range,Ie.weeks.utc=Ie.sunday.utc.range,Ie.weekOfYear=Ie.sundayOfYear;var Be={"-":"",_:" ",0:"0"},je=/^\s*\d+/,Ue=/^%/;function Ve(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a<r?new Array(r-a+1).join(e)+i:i)}function qe(e){return new RegExp("^(?:"+e.map(t.requote).join("|")+")","i")}function He(t){for(var e=new _,r=-1,n=t.length;++r<n;)e.set(t[r].toLowerCase(),r);return e}function Ge(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function Ye(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r));return n?(t.U=+n[0],r+n[0].length):-1}function We(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r));return n?(t.W=+n[0],r+n[0].length):-1}function Ze(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function Xe(t,e,r){je.lastIndex=0;var n,i=je.exec(e.slice(r,r+2));return i?(t.y=(n=+i[0])+(n>68?1900:2e3),r+i[0].length):-1}function Je(t,e,r){return/^[+-]\d{4}$/.test(e=e.slice(r,r+5))?(t.Z=-e,r+5):-1}function Ke(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function $e(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function Qe(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function tr(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function er(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function rr(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function nr(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function ir(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=y(e)/60|0,i=y(e)%60;return r+Ve(n,"0",2)+Ve(i,"0",2)}function ar(t,e,r){Ue.lastIndex=0;var n=Ue.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function or(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)}}t.locale=function(t){return{numberFormat:Ee(t),timeFormat:Fe(t)}};var sr=t.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function lr(){}t.format=sr.numberFormat,t.geo={},lr.prototype={s:0,t:0,add:function(t){ur(t,this.t,cr),ur(cr.s,this.s,this),this.s?this.t+=cr.t:this.s=cr.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var cr=new lr;function ur(t,e,r){var n=r.s=t+e,i=n-t,a=n-i;r.t=t-a+(e-i)}function fr(t,e){t&&pr.hasOwnProperty(t.type)&&pr[t.type](t,e)}t.geo.stream=function(t,e){t&&hr.hasOwnProperty(t.type)?hr[t.type](t,e):fr(t,e)};var hr={Feature:function(t,e){fr(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)fr(r[n].geometry,e)}},pr={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){dr(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)dr(r[n],e,0)},Polygon:function(t,e){mr(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)mr(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)fr(r[n],e)}};function dr(t,e,r){var n,i=-1,a=t.length-r;for(e.lineStart();++i<a;)n=t[i],e.point(n[0],n[1],n[2]);e.lineEnd()}function mr(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)dr(t[r],e,1);e.polygonEnd()}t.geo.area=function(e){return gr=0,t.geo.stream(e,Cr),gr};var gr,vr,yr,xr,br,_r,wr,Tr,Mr,kr,Ar,Sr,Er=new lr,Cr={sphere:function(){gr+=4*At},point:z,lineStart:z,lineEnd:z,polygonStart:function(){Er.reset(),Cr.lineStart=Lr},polygonEnd:function(){var t=2*Er;gr+=t<0?4*At+t:t,Cr.lineStart=Cr.lineEnd=Cr.point=z}};function Lr(){var t,e,r,n,i;function a(t,e){e=e*Lt/2+At/4;var a=(t*=Lt)-r,o=a>=0?1:-1,s=o*a,l=Math.cos(e),c=Math.sin(e),u=i*c,f=n*l+u*Math.cos(s),h=u*o*Math.sin(s);Er.add(Math.atan2(h,f)),r=t,n=l,i=c}Cr.point=function(o,s){Cr.point=a,r=(t=o)*Lt,n=Math.cos(s=(e=s)*Lt/2+At/4),i=Math.sin(s)},Cr.lineEnd=function(){a(t,e)}}function Pr(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 Ir(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Or(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 zr(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Dr(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Nr(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 Rr(t){return[Math.atan2(t[1],t[0]),Dt(t[2])]}function Fr(t,e){return y(t[0]-e[0])<Mt&&y(t[1]-e[1])<Mt}t.geo.bounds=function(){var e,r,n,i,a,o,s,l,c,u,f,h={point:p,lineStart:m,lineEnd:g,polygonStart:function(){h.point=v,h.lineStart=x,h.lineEnd=b,c=0,Cr.polygonStart()},polygonEnd:function(){Cr.polygonEnd(),h.point=p,h.lineStart=m,h.lineEnd=g,Er<0?(e=-(n=180),r=-(i=90)):c>Mt?i=90:c<-Mt&&(r=-90),f[0]=e,f[1]=n}};function p(t,a){u.push(f=[e=t,n=t]),a<r&&(r=a),a>i&&(i=a)}function d(t,o){var s=Pr([t*Lt,o*Lt]);if(l){var c=Or(l,s),u=Or([c[1],-c[0],0],c);Nr(u),u=Rr(u);var f=t-a,h=f>0?1:-1,d=u[0]*Pt*h,m=y(f)>180;if(m^(h*a<d&&d<h*t))(g=u[1]*Pt)>i&&(i=g);else if(m^(h*a<(d=(d+360)%360-180)&&d<h*t)){var g;(g=-u[1]*Pt)<r&&(r=g)}else o<r&&(r=o),o>i&&(i=o);m?t<a?_(e,t)>_(e,n)&&(n=t):_(t,n)>_(e,n)&&(e=t):n>=e?(t<e&&(e=t),t>n&&(n=t)):t>a?_(e,t)>_(e,n)&&(n=t):_(t,n)>_(e,n)&&(e=t)}else p(t,o);l=s,a=t}function m(){h.point=d}function g(){f[0]=e,f[1]=n,h.point=p,l=null}function v(t,e){if(l){var r=t-a;c+=y(r)>180?r+(r>0?360:-360):r}else o=t,s=e;Cr.point(t,e),d(t,e)}function x(){Cr.lineStart()}function b(){v(o,s),Cr.lineEnd(),y(c)>Mt&&(e=-(n=180)),f[0]=e,f[1]=n,l=null}function _(t,e){return(e-=t)<0?e+360:e}function w(t,e){return t[0]-e[0]}function T(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}return function(a){if(i=n=-(e=r=1/0),u=[],t.geo.stream(a,h),c=u.length){u.sort(w);for(var o=1,s=[m=u[0]];o<c;++o)T((p=u[o])[0],m)||T(p[1],m)?(_(m[0],p[1])>_(m[0],m[1])&&(m[1]=p[1]),_(p[0],m[1])>_(m[0],m[1])&&(m[0]=p[0])):s.push(m=p);for(var l,c,p,d=-1/0,m=(o=0,s[c=s.length-1]);o<=c;m=p,++o)p=s[o],(l=_(m[1],p[0]))>d&&(d=l,e=p[0],n=m[1])}return u=f=null,e===1/0||r===1/0?[[NaN,NaN],[NaN,NaN]]:[[e,r],[n,i]]}}(),t.geo.centroid=function(e){vr=yr=xr=br=_r=wr=Tr=Mr=kr=Ar=Sr=0,t.geo.stream(e,Br);var r=kr,n=Ar,i=Sr,a=r*r+n*n+i*i;return a<kt&&(r=wr,n=Tr,i=Mr,yr<Mt&&(r=xr,n=br,i=_r),(a=r*r+n*n+i*i)<kt)?[NaN,NaN]:[Math.atan2(n,r)*Pt,Dt(i/Math.sqrt(a))*Pt]};var Br={sphere:z,point:jr,lineStart:Vr,lineEnd:qr,polygonStart:function(){Br.lineStart=Hr},polygonEnd:function(){Br.lineStart=Vr}};function jr(t,e){t*=Lt;var r=Math.cos(e*=Lt);Ur(r*Math.cos(t),r*Math.sin(t),Math.sin(e))}function Ur(t,e,r){++vr,xr+=(t-xr)/vr,br+=(e-br)/vr,_r+=(r-_r)/vr}function Vr(){var t,e,r;function n(n,i){n*=Lt;var a=Math.cos(i*=Lt),o=a*Math.cos(n),s=a*Math.sin(n),l=Math.sin(i),c=Math.atan2(Math.sqrt((c=e*l-r*s)*c+(c=r*o-t*l)*c+(c=t*s-e*o)*c),t*o+e*s+r*l);yr+=c,wr+=c*(t+(t=o)),Tr+=c*(e+(e=s)),Mr+=c*(r+(r=l)),Ur(t,e,r)}Br.point=function(i,a){i*=Lt;var o=Math.cos(a*=Lt);t=o*Math.cos(i),e=o*Math.sin(i),r=Math.sin(a),Br.point=n,Ur(t,e,r)}}function qr(){Br.point=jr}function Hr(){var t,e,r,n,i;function a(t,e){t*=Lt;var a=Math.cos(e*=Lt),o=a*Math.cos(t),s=a*Math.sin(t),l=Math.sin(e),c=n*l-i*s,u=i*o-r*l,f=r*s-n*o,h=Math.sqrt(c*c+u*u+f*f),p=r*o+n*s+i*l,d=h&&-zt(p)/h,m=Math.atan2(h,p);kr+=d*c,Ar+=d*u,Sr+=d*f,yr+=m,wr+=m*(r+(r=o)),Tr+=m*(n+(n=s)),Mr+=m*(i+(i=l)),Ur(r,n,i)}Br.point=function(o,s){t=o,e=s,Br.point=a,o*=Lt;var l=Math.cos(s*=Lt);r=l*Math.cos(o),n=l*Math.sin(o),i=Math.sin(s),Ur(r,n,i)},Br.lineEnd=function(){a(t,e),Br.lineEnd=qr,Br.point=jr}}function Gr(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))&&t.invert(r[0],r[1])}),r}function Yr(){return!0}function Wr(t,e,r,n,i){var a=[],o=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,r=t[0],n=t[e];if(Fr(r,n)){i.lineStart();for(var s=0;s<e;++s)i.point((r=t[s])[0],r[1]);i.lineEnd()}else{var l=new Xr(r,t,null,!0),c=new Xr(r,null,l,!1);l.o=c,a.push(l),o.push(c),l=new Xr(n,t,null,!1),c=new Xr(n,null,l,!0),l.o=c,a.push(l),o.push(c)}}})),o.sort(e),Zr(a),Zr(o),a.length){for(var s=0,l=r,c=o.length;s<c;++s)o[s].e=l=!l;for(var u,f,h=a[0];;){for(var p=h,d=!0;p.v;)if((p=p.n)===h)return;u=p.z,i.lineStart();do{if(p.v=p.o.v=!0,p.e){if(d)for(s=0,c=u.length;s<c;++s)i.point((f=u[s])[0],f[1]);else n(p.x,p.n.x,1,i);p=p.n}else{if(d)for(s=(u=p.p.z).length-1;s>=0;--s)i.point((f=u[s])[0],f[1]);else n(p.x,p.p.x,-1,i);p=p.p}u=(p=p.o).z,d=!d}while(!p.v);i.lineEnd()}}}function Zr(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 Xr(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 Jr(e,r,n,i){return function(a,o){var s,l=r(o),c=a.invert(i[0],i[1]),u={point:f,lineStart:p,lineEnd:d,polygonStart:function(){u.point=b,u.lineStart=_,u.lineEnd=w,s=[],m=[]},polygonEnd:function(){u.point=f,u.lineStart=p,u.lineEnd=d,s=t.merge(s);var e=function(t,e){var r=t[0],n=t[1],i=[Math.sin(r),-Math.cos(r),0],a=0,o=0;Er.reset();for(var s=0,l=e.length;s<l;++s){var c=e[s],u=c.length;if(u)for(var f=c[0],h=f[0],p=f[1]/2+At/4,d=Math.sin(p),m=Math.cos(p),g=1;;){g===u&&(g=0);var v=(t=c[g])[0],y=t[1]/2+At/4,x=Math.sin(y),b=Math.cos(y),_=v-h,w=_>=0?1:-1,T=w*_,M=T>At,k=d*x;if(Er.add(Math.atan2(k*w*Math.sin(T),m*b+k*Math.cos(T))),a+=M?_+w*St:_,M^h>=r^v>=r){var A=Or(Pr(f),Pr(t));Nr(A);var S=Or(i,A);Nr(S);var E=(M^_>=0?-1:1)*Dt(S[2]);(n>E||n===E&&(A[0]||A[1]))&&(o+=M^_>=0?1:-1)}if(!g++)break;h=v,d=x,m=b,f=t}}return(a<-Mt||a<Mt&&Er<-Mt)^1&o}(c,m);s.length?(x||(o.polygonStart(),x=!0),Wr(s,Qr,e,n,o)):e&&(x||(o.polygonStart(),x=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),x&&(o.polygonEnd(),x=!1),s=m=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function f(t,r){var n=a(t,r);e(t=n[0],r=n[1])&&o.point(t,r)}function h(t,e){var r=a(t,e);l.point(r[0],r[1])}function p(){u.point=h,l.lineStart()}function d(){u.point=f,l.lineEnd()}var m,g,v=$r(),y=r(v),x=!1;function b(t,e){g.push([t,e]);var r=a(t,e);y.point(r[0],r[1])}function _(){y.lineStart(),g=[]}function w(){b(g[0][0],g[0][1]),y.lineEnd();var t,e=y.clean(),r=v.buffer(),n=r.length;if(g.pop(),m.push(g),g=null,n)if(1&e){var i,a=-1;if((n=(t=r[0]).length-1)>0){for(x||(o.polygonStart(),x=!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())),s.push(r.filter(Kr))}return u}}function Kr(t){return t.length>1}function $r(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:z,buffer:function(){var r=e;return e=[],t=null,r},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function Qr(t,e){return((t=t.x)[0]<0?t[1]-Ct-Mt:Ct-t[1])-((e=e.x)[0]<0?e[1]-Ct-Mt:Ct-e[1])}var tn=Jr(Yr,(function(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?At:-At,l=y(a-r);y(l-At)<Mt?(t.point(r,n=(n+o)/2>0?Ct:-Ct),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=At&&(y(r-i)<Mt&&(r-=i*Mt),y(a-s)<Mt&&(a-=s*Mt),n=function(t,e,r,n){var i,a,o=Math.sin(t-r);return y(o)>Mt?Math.atan((Math.sin(e)*(a=Math.cos(n))*Math.sin(r)-Math.sin(n)*(i=Math.cos(e))*Math.sin(t))/(i*a*o)):(e+n)/2}(r,n,a,o),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),e=0),t.point(r=a,n=o),i=s},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}),(function(t,e,r,n){var i;if(null==t)i=r*Ct,n.point(-At,i),n.point(0,i),n.point(At,i),n.point(At,0),n.point(At,-i),n.point(0,-i),n.point(-At,-i),n.point(-At,0),n.point(-At,i);else if(y(t[0]-e[0])>Mt){var a=t[0]<e[0]?At:-At;i=r*a/2,n.point(-a,i),n.point(0,i),n.point(a,i)}else n.point(e[0],e[1])}),[-At,-At/2]);function en(t){var e=Math.cos(t),r=e>0,n=y(e)>Mt;return Jr(i,(function(t){var e,s,l,c,u;return{lineStart:function(){c=l=!1,u=1},point:function(f,h){var p,d=[f,h],m=i(f,h),g=r?m?0:o(f,h):m?o(f+(f<0?At:-At),h):0;if(!e&&(c=l=m)&&t.lineStart(),m!==l&&(p=a(e,d),(Fr(e,p)||Fr(d,p))&&(d[0]+=Mt,d[1]+=Mt,m=i(d[0],d[1]))),m!==l)u=0,m?(t.lineStart(),p=a(d,e),t.point(p[0],p[1])):(p=a(e,d),t.point(p[0],p[1]),t.lineEnd()),e=p;else if(n&&e&&r^m){var v;g&s||!(v=a(d,e,!0))||(u=0,r?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1])))}!m||e&&Fr(e,d)||t.point(d[0],d[1]),e=d,l=m,s=g},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return u|(c&&l)<<1}}}),Fn(t,6*Lt),r?[0,-t]:[-At,t-At]);function i(t,r){return Math.cos(t)*Math.cos(r)>e}function a(t,r,n){var i=[1,0,0],a=Or(Pr(t),Pr(r)),o=Ir(a,a),s=a[0],l=o-s*s;if(!l)return!n&&t;var c=e*o/l,u=-e*s/l,f=Or(i,a),h=Dr(i,c);zr(h,Dr(a,u));var p=f,d=Ir(h,p),m=Ir(p,p),g=d*d-m*(Ir(h,h)-1);if(!(g<0)){var v=Math.sqrt(g),x=Dr(p,(-d-v)/m);if(zr(x,h),x=Rr(x),!n)return x;var b,_=t[0],w=r[0],T=t[1],M=r[1];w<_&&(b=_,_=w,w=b);var k=w-_,A=y(k-At)<Mt;if(!A&&M<T&&(b=T,T=M,M=b),A||k<Mt?A?T+M>0^x[1]<(y(x[0]-_)<Mt?T:M):T<=x[1]&&x[1]<=M:k>At^(_<=x[0]&&x[0]<=w)){var S=Dr(p,(-d+v)/m);return zr(S,h),[x,Rr(S)]}}}function o(e,n){var i=r?t:At-t,a=0;return e<-i?a|=1:e>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}}function rn(t,e,r,n){return function(i){var a,o=i.a,s=i.b,l=o.x,c=o.y,u=0,f=1,h=s.x-l,p=s.y-c;if(a=t-l,h||!(a>0)){if(a/=h,h<0){if(a<u)return;a<f&&(f=a)}else if(h>0){if(a>f)return;a>u&&(u=a)}if(a=r-l,h||!(a<0)){if(a/=h,h<0){if(a>f)return;a>u&&(u=a)}else if(h>0){if(a<u)return;a<f&&(f=a)}if(a=e-c,p||!(a>0)){if(a/=p,p<0){if(a<u)return;a<f&&(f=a)}else if(p>0){if(a>f)return;a>u&&(u=a)}if(a=n-c,p||!(a<0)){if(a/=p,p<0){if(a>f)return;a>u&&(u=a)}else if(p>0){if(a<u)return;a<f&&(f=a)}return u>0&&(i.a={x:l+u*h,y:c+u*p}),f<1&&(i.b={x:l+f*h,y:c+f*p}),i}}}}}}function nn(e,r,n,i){return function(l){var c,u,f,h,p,d,m,g,v,y,x,b=l,_=$r(),w=rn(e,r,n,i),T={point:A,lineStart:function(){T.point=S,u&&u.push(f=[]);y=!0,v=!1,m=g=NaN},lineEnd:function(){c&&(S(h,p),d&&v&&_.rejoin(),c.push(_.buffer()));T.point=A,v&&l.lineEnd()},polygonStart:function(){l=_,c=[],u=[],x=!0},polygonEnd:function(){l=b,c=t.merge(c);var r=function(t){for(var e=0,r=u.length,n=t[1],i=0;i<r;++i)for(var a,o=1,s=u[i],l=s.length,c=s[0];o<l;++o)a=s[o],c[1]<=n?a[1]>n&&Ot(c,a,t)>0&&++e:a[1]<=n&&Ot(c,a,t)<0&&--e,c=a;return 0!==e}([e,i]),n=x&&r,a=c.length;(n||a)&&(l.polygonStart(),n&&(l.lineStart(),M(null,null,1,l),l.lineEnd()),a&&Wr(c,o,r,M,l),l.polygonEnd()),c=u=f=null}};function M(t,o,l,c){var u=0,f=0;if(null==t||(u=a(t,l))!==(f=a(o,l))||s(t,o)<0^l>0)do{c.point(0===u||3===u?e:n,u>1?i:r)}while((u=(u+l+4)%4)!==f);else c.point(o[0],o[1])}function k(t,a){return e<=t&&t<=n&&r<=a&&a<=i}function A(t,e){k(t,e)&&l.point(t,e)}function S(t,e){var r=k(t=Math.max(-1e9,Math.min(1e9,t)),e=Math.max(-1e9,Math.min(1e9,e)));if(u&&f.push([t,e]),y)h=t,p=e,d=r,y=!1,r&&(l.lineStart(),l.point(t,e));else if(r&&v)l.point(t,e);else{var n={a:{x:m,y:g},b:{x:t,y:e}};w(n)?(v||(l.lineStart(),l.point(n.a.x,n.a.y)),l.point(n.b.x,n.b.y),r||l.lineEnd(),x=!1):r&&(l.lineStart(),l.point(t,e),x=!1)}m=t,g=e,v=r}return T};function a(t,i){return y(t[0]-e)<Mt?i>0?0:3:y(t[0]-n)<Mt?i>0?2:1:y(t[1]-r)<Mt?i>0?1:0:i>0?3:2}function o(t,e){return s(t.x,e.x)}function s(t,e){var r=a(t,1),n=a(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]}}function an(t){var e=0,r=At/3,n=Ln(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*At/180,r=t[1]*At/180):[e/At*180,r/At*180]},i}function on(t,e){var r=Math.sin(t),n=(r+Math.sin(e))/2,i=1+r*(2*n-r),a=Math.sqrt(i)/n;function o(t,e){var r=Math.sqrt(i-2*n*Math.sin(e))/n;return[r*Math.sin(t*=n),a-r*Math.cos(t)]}return o.invert=function(t,e){var r=a-e;return[Math.atan2(t,r)/n,Dt((i-(t*t+r*r)*n*n)/(2*n))]},o}t.geo.clipExtent=function(){var t,e,r,n,i,a,o={stream:function(t){return i&&(i.valid=!1),(i=a(t)).valid=!0,i},extent:function(s){return arguments.length?(a=nn(t=+s[0][0],e=+s[0][1],r=+s[1][0],n=+s[1][1]),i&&(i.valid=!1,i=null),o):[[t,e],[r,n]]}};return o.extent([[0,0],[960,500]])},(t.geo.conicEqualArea=function(){return an(on)}).raw=on,t.geo.albers=function(){return t.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},t.geo.albersUsa=function(){var e,r,n,i,a=t.geo.albers(),o=t.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=t.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,r){e=[t,r]}};function c(t){var a=t[0],o=t[1];return e=null,r(a,o),e||(n(a,o),e)||i(a,o),e}return c.invert=function(t){var e=a.scale(),r=a.translate(),n=(t[0]-r[0])/e,i=(t[1]-r[1])/e;return(i>=.12&&i<.234&&n>=-.425&&n<-.214?o:i>=.166&&i<.234&&n>=-.214&&n<-.115?s:a).invert(t)},c.stream=function(t){var e=a.stream(t),r=o.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()}}},c.precision=function(t){return arguments.length?(a.precision(t),o.precision(t),s.precision(t),c):a.precision()},c.scale=function(t){return arguments.length?(a.scale(t),o.scale(.35*t),s.scale(t),c.translate(a.translate())):a.scale()},c.translate=function(t){if(!arguments.length)return a.translate();var e=a.scale(),u=+t[0],f=+t[1];return r=a.translate(t).clipExtent([[u-.455*e,f-.238*e],[u+.455*e,f+.238*e]]).stream(l).point,n=o.translate([u-.307*e,f+.201*e]).clipExtent([[u-.425*e+Mt,f+.12*e+Mt],[u-.214*e-Mt,f+.234*e-Mt]]).stream(l).point,i=s.translate([u-.205*e,f+.212*e]).clipExtent([[u-.214*e+Mt,f+.166*e+Mt],[u-.115*e-Mt,f+.234*e-Mt]]).stream(l).point,c},c.scale(1070)};var sn,ln,cn,un,fn,hn,pn={point:z,lineStart:z,lineEnd:z,polygonStart:function(){ln=0,pn.lineStart=dn},polygonEnd:function(){pn.lineStart=pn.lineEnd=pn.point=z,sn+=y(ln/2)}};function dn(){var t,e,r,n;function i(t,e){ln+=n*t-r*e,r=t,n=e}pn.point=function(a,o){pn.point=i,t=r=a,e=n=o},pn.lineEnd=function(){i(t,e)}}var mn={point:function(t,e){t<cn&&(cn=t);t>fn&&(fn=t);e<un&&(un=e);e>hn&&(hn=e)},lineStart:z,lineEnd:z,polygonStart:z,polygonEnd:z};function gn(){var t=vn(4.5),e=[],r={point:n,lineStart:function(){r.point=i},lineEnd:o,polygonStart:function(){r.lineEnd=s},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(e){return t=vn(e),r},result:function(){if(e.length){var t=e.join("");return e=[],t}}};function n(r,n){e.push("M",r,",",n,t)}function i(t,n){e.push("M",t,",",n),r.point=a}function a(t,r){e.push("L",t,",",r)}function o(){r.point=n}function s(){e.push("Z")}return r}function vn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}var yn,xn={point:bn,lineStart:_n,lineEnd:wn,polygonStart:function(){xn.lineStart=Tn},polygonEnd:function(){xn.point=bn,xn.lineStart=_n,xn.lineEnd=wn}};function bn(t,e){xr+=t,br+=e,++_r}function _n(){var t,e;function r(r,n){var i=r-t,a=n-e,o=Math.sqrt(i*i+a*a);wr+=o*(t+r)/2,Tr+=o*(e+n)/2,Mr+=o,bn(t=r,e=n)}xn.point=function(n,i){xn.point=r,bn(t=n,e=i)}}function wn(){xn.point=bn}function Tn(){var t,e,r,n;function i(t,e){var i=t-r,a=e-n,o=Math.sqrt(i*i+a*a);wr+=o*(r+t)/2,Tr+=o*(n+e)/2,Mr+=o,kr+=(o=n*t-r*e)*(r+t),Ar+=o*(n+e),Sr+=3*o,bn(r=t,n=e)}xn.point=function(a,o){xn.point=i,bn(t=r=a,e=n=o)},xn.lineEnd=function(){i(t,e)}}function Mn(t){var e=4.5,r={point:n,lineStart:function(){r.point=i},lineEnd:o,polygonStart:function(){r.lineEnd=s},polygonEnd:function(){r.lineEnd=o,r.point=n},pointRadius:function(t){return e=t,r},result:z};function n(r,n){t.moveTo(r+e,n),t.arc(r,n,e,0,St)}function i(e,n){t.moveTo(e,n),r.point=a}function a(e,r){t.lineTo(e,r)}function o(){r.point=n}function s(){t.closePath()}return r}function kn(t){var e=.5,r=Math.cos(30*Lt),n=16;function i(t){return(n?o:a)(t)}function a(e){return En(e,(function(r,n){r=t(r,n),e.point(r[0],r[1])}))}function o(e){var r,i,a,o,l,c,u,f,h,p,d,m,g={point:v,lineStart:y,lineEnd:b,polygonStart:function(){e.polygonStart(),g.lineStart=_},polygonEnd:function(){e.polygonEnd(),g.lineStart=y}};function v(r,n){r=t(r,n),e.point(r[0],r[1])}function y(){f=NaN,g.point=x,e.lineStart()}function x(r,i){var a=Pr([r,i]),o=t(r,i);s(f,h,u,p,d,m,f=o[0],h=o[1],u=r,p=a[0],d=a[1],m=a[2],n,e),e.point(f,h)}function b(){g.point=v,e.lineEnd()}function _(){y(),g.point=w,g.lineEnd=T}function w(t,e){x(r=t,e),i=f,a=h,o=p,l=d,c=m,g.point=x}function T(){s(f,h,u,p,d,m,i,a,r,o,l,c,n,e),g.lineEnd=b,b()}return g}function s(n,i,a,o,l,c,u,f,h,p,d,m,g,v){var x=u-n,b=f-i,_=x*x+b*b;if(_>4*e&&g--){var w=o+p,T=l+d,M=c+m,k=Math.sqrt(w*w+T*T+M*M),A=Math.asin(M/=k),S=y(y(M)-1)<Mt||y(a-h)<Mt?(a+h)/2:Math.atan2(T,w),E=t(S,A),C=E[0],L=E[1],P=C-n,I=L-i,O=b*P-x*I;(O*O/_>e||y((x*P+b*I)/_-.5)>.3||o*p+l*d+c*m<r)&&(s(n,i,a,o,l,c,C,L,S,w/=k,T/=k,M,g,v),v.point(C,L),s(C,L,S,w,T,M,u,f,h,p,d,m,g,v))}}return i.precision=function(t){return arguments.length?(n=(e=t*t)>0&&16,i):Math.sqrt(e)},i}function An(t){var e=kn((function(e,r){return t([e*Pt,r*Pt])}));return function(t){return Pn(e(t))}}function Sn(t){this.stream=t}function En(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 Cn(t){return Ln((function(){return t}))()}function Ln(e){var r,n,i,a,o,s,l=kn((function(t,e){return[(t=r(t,e))[0]*c+a,o-t[1]*c]})),c=150,u=480,f=250,h=0,p=0,d=0,m=0,g=0,v=tn,y=L,x=null,b=null;function _(t){return[(t=i(t[0]*Lt,t[1]*Lt))[0]*c+a,o-t[1]*c]}function w(t){return(t=i.invert((t[0]-a)/c,(o-t[1])/c))&&[t[0]*Pt,t[1]*Pt]}function T(){i=Gr(n=zn(d,m,g),r);var t=r(h,p);return a=u-t[0]*c,o=f+t[1]*c,M()}function M(){return s&&(s.valid=!1,s=null),_}return _.stream=function(t){return s&&(s.valid=!1),(s=Pn(v(n,l(y(t))))).valid=!0,s},_.clipAngle=function(t){return arguments.length?(v=null==t?(x=t,tn):en((x=+t)*Lt),M()):x},_.clipExtent=function(t){return arguments.length?(b=t,y=t?nn(t[0][0],t[0][1],t[1][0],t[1][1]):L,M()):b},_.scale=function(t){return arguments.length?(c=+t,T()):c},_.translate=function(t){return arguments.length?(u=+t[0],f=+t[1],T()):[u,f]},_.center=function(t){return arguments.length?(h=t[0]%360*Lt,p=t[1]%360*Lt,T()):[h*Pt,p*Pt]},_.rotate=function(t){return arguments.length?(d=t[0]%360*Lt,m=t[1]%360*Lt,g=t.length>2?t[2]%360*Lt:0,T()):[d*Pt,m*Pt,g*Pt]},t.rebind(_,l,"precision"),function(){return r=e.apply(this,arguments),_.invert=r.invert&&w,T()}}function Pn(t){return En(t,(function(e,r){t.point(e*Lt,r*Lt)}))}function In(t,e){return[t,e]}function On(t,e){return[t>At?t-St:t<-At?t+St:t,e]}function zn(t,e,r){return t?e||r?Gr(Nn(t),Rn(e,r)):Nn(t):e||r?Rn(e,r):On}function Dn(t){return function(e,r){return[(e+=t)>At?e-St:e<-At?e+St:e,r]}}function Nn(t){var e=Dn(t);return e.invert=Dn(-t),e}function Rn(t,e){var r=Math.cos(t),n=Math.sin(t),i=Math.cos(e),a=Math.sin(e);function o(t,e){var o=Math.cos(e),s=Math.cos(t)*o,l=Math.sin(t)*o,c=Math.sin(e),u=c*r+s*n;return[Math.atan2(l*i-u*a,s*r-c*n),Dt(u*i+l*a)]}return o.invert=function(t,e){var o=Math.cos(e),s=Math.cos(t)*o,l=Math.sin(t)*o,c=Math.sin(e),u=c*i-l*a;return[Math.atan2(l*i+c*a,s*r+u*n),Dt(u*r-s*n)]},o}function Fn(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=Bn(r,i),a=Bn(r,a),(o>0?i<a:i>a)&&(i+=o*St)):(i=t+o*St,a=t-.5*l);for(var c,u=i;o>0?u>a:u<a;u-=l)s.point((c=Rr([r,-n*Math.cos(u),-n*Math.sin(u)]))[0],c[1])}}function Bn(t,e){var r=Pr(e);r[0]-=t,Nr(r);var n=zt(-r[1]);return((-r[2]<0?-n:n)+2*Math.PI-Mt)%(2*Math.PI)}function jn(e,r,n){var i=t.range(e,r-Mt,n).concat(r);return function(t){return i.map((function(e){return[t,e]}))}}function Un(e,r,n){var i=t.range(e,r-Mt,n).concat(r);return function(t){return i.map((function(e){return[e,t]}))}}function Vn(t){return t.source}function qn(t){return t.target}t.geo.path=function(){var e,r,n,i,a,o=4.5;function s(e){return e&&("function"==typeof o&&i.pointRadius(+o.apply(this,arguments)),a&&a.valid||(a=n(i)),t.geo.stream(e,a)),i.result()}function l(){return a=null,s}return s.area=function(e){return sn=0,t.geo.stream(e,n(pn)),sn},s.centroid=function(e){return xr=br=_r=wr=Tr=Mr=kr=Ar=Sr=0,t.geo.stream(e,n(xn)),Sr?[kr/Sr,Ar/Sr]:Mr?[wr/Mr,Tr/Mr]:_r?[xr/_r,br/_r]:[NaN,NaN]},s.bounds=function(e){return fn=hn=-(cn=un=1/0),t.geo.stream(e,n(mn)),[[cn,un],[fn,hn]]},s.projection=function(t){return arguments.length?(n=(e=t)?t.stream||An(t):L,l()):e},s.context=function(t){return arguments.length?(i=null==(r=t)?new gn:new Mn(t),"function"!=typeof o&&i.pointRadius(o),l()):r},s.pointRadius=function(t){return arguments.length?(o="function"==typeof t?t:(i.pointRadius(+t),+t),s):o},s.projection(t.geo.albersUsa()).context(null)},t.geo.transform=function(t){return{stream:function(e){var r=new Sn(e);for(var n in t)r[n]=t[n];return r}}},Sn.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()}},t.geo.projection=Cn,t.geo.projectionMutator=Ln,(t.geo.equirectangular=function(){return Cn(In)}).raw=In.invert=In,t.geo.rotation=function(t){function e(e){return(e=t(e[0]*Lt,e[1]*Lt))[0]*=Pt,e[1]*=Pt,e}return t=zn(t[0]%360*Lt,t[1]*Lt,t.length>2?t[2]*Lt:0),e.invert=function(e){return(e=t.invert(e[0]*Lt,e[1]*Lt))[0]*=Pt,e[1]*=Pt,e},e},On.invert=In,t.geo.circle=function(){var t,e,r=[0,0],n=6;function i(){var t="function"==typeof r?r.apply(this,arguments):r,n=zn(-t[0]*Lt,-t[1]*Lt,0).invert,i=[];return e(null,null,1,{point:function(t,e){i.push(t=n(t,e)),t[0]*=Pt,t[1]*=Pt}}),{type:"Polygon",coordinates:[i]}}return i.origin=function(t){return arguments.length?(r=t,i):r},i.angle=function(r){return arguments.length?(e=Fn((t=+r)*Lt,n*Lt),i):t},i.precision=function(r){return arguments.length?(e=Fn(t*Lt,(n=+r)*Lt),i):n},i.angle(90)},t.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Lt,i=t[1]*Lt,a=e[1]*Lt,o=Math.sin(n),s=Math.cos(n),l=Math.sin(i),c=Math.cos(i),u=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((r=f*o)*r+(r=c*u-l*f*s)*r),l*u+c*f*s)},t.geo.graticule=function(){var e,r,n,i,a,o,s,l,c,u,f,h,p=10,d=p,m=90,g=360,v=2.5;function x(){return{type:"MultiLineString",coordinates:b()}}function b(){return t.range(Math.ceil(i/m)*m,n,m).map(f).concat(t.range(Math.ceil(l/g)*g,s,g).map(h)).concat(t.range(Math.ceil(r/p)*p,e,p).filter((function(t){return y(t%m)>Mt})).map(c)).concat(t.range(Math.ceil(o/d)*d,a,d).filter((function(t){return y(t%g)>Mt})).map(u))}return x.lines=function(){return b().map((function(t){return{type:"LineString",coordinates:t}}))},x.outline=function(){return{type:"Polygon",coordinates:[f(i).concat(h(s).slice(1),f(n).reverse().slice(1),h(l).reverse().slice(1))]}},x.extent=function(t){return arguments.length?x.majorExtent(t).minorExtent(t):x.minorExtent()},x.majorExtent=function(t){return arguments.length?(i=+t[0][0],n=+t[1][0],l=+t[0][1],s=+t[1][1],i>n&&(t=i,i=n,n=t),l>s&&(t=l,l=s,s=t),x.precision(v)):[[i,l],[n,s]]},x.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],o=+t[0][1],a=+t[1][1],r>e&&(t=r,r=e,e=t),o>a&&(t=o,o=a,a=t),x.precision(v)):[[r,o],[e,a]]},x.step=function(t){return arguments.length?x.majorStep(t).minorStep(t):x.minorStep()},x.majorStep=function(t){return arguments.length?(m=+t[0],g=+t[1],x):[m,g]},x.minorStep=function(t){return arguments.length?(p=+t[0],d=+t[1],x):[p,d]},x.precision=function(t){return arguments.length?(v=+t,c=jn(o,a,90),u=Un(r,e,v),f=jn(l,s,90),h=Un(i,n,v),x):v},x.majorExtent([[-180,-90+Mt],[180,90-Mt]]).minorExtent([[-180,-80-Mt],[180,80+Mt]])},t.geo.greatArc=function(){var e,r,n=Vn,i=qn;function a(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||i.apply(this,arguments)]}}return a.distance=function(){return t.geo.distance(e||n.apply(this,arguments),r||i.apply(this,arguments))},a.source=function(t){return arguments.length?(n=t,e="function"==typeof t?null:t,a):n},a.target=function(t){return arguments.length?(i=t,r="function"==typeof t?null:t,a):i},a.precision=function(){return arguments.length?a:0},a},t.geo.interpolate=function(t,e){return r=t[0]*Lt,n=t[1]*Lt,i=e[0]*Lt,a=e[1]*Lt,o=Math.cos(n),s=Math.sin(n),l=Math.cos(a),c=Math.sin(a),u=o*Math.cos(r),f=o*Math.sin(r),h=l*Math.cos(i),p=l*Math.sin(i),d=2*Math.asin(Math.sqrt(Rt(a-n)+o*l*Rt(i-r))),m=1/Math.sin(d),(g=d?function(t){var e=Math.sin(t*=d)*m,r=Math.sin(d-t)*m,n=r*u+e*h,i=r*f+e*p,a=r*s+e*c;return[Math.atan2(i,n)*Pt,Math.atan2(a,Math.sqrt(n*n+i*i))*Pt]}:function(){return[r*Pt,n*Pt]}).distance=d,g;var r,n,i,a,o,s,l,c,u,f,h,p,d,m,g},t.geo.length=function(e){return yn=0,t.geo.stream(e,Hn),yn};var Hn={sphere:z,point:z,lineStart:function(){var t,e,r;function n(n,i){var a=Math.sin(i*=Lt),o=Math.cos(i),s=y((n*=Lt)-t),l=Math.cos(s);yn+=Math.atan2(Math.sqrt((s=o*Math.sin(s))*s+(s=r*a-e*o*l)*s),e*a+r*o*l),t=n,e=a,r=o}Hn.point=function(i,a){t=i*Lt,e=Math.sin(a*=Lt),r=Math.cos(a),Hn.point=n},Hn.lineEnd=function(){Hn.point=Hn.lineEnd=z}},lineEnd:z,polygonStart:z,polygonEnd:z};function Gn(t,e){function r(e,r){var n=Math.cos(e),i=Math.cos(r),a=t(n*i);return[a*i*Math.sin(e),a*Math.sin(r)]}return r.invert=function(t,r){var n=Math.sqrt(t*t+r*r),i=e(n),a=Math.sin(i),o=Math.cos(i);return[Math.atan2(t*a,n*o),Math.asin(n&&r*a/n)]},r}var Yn=Gn((function(t){return Math.sqrt(2/(1+t))}),(function(t){return 2*Math.asin(t/2)}));(t.geo.azimuthalEqualArea=function(){return Cn(Yn)}).raw=Yn;var Wn=Gn((function(t){var e=Math.acos(t);return e&&e/Math.sin(e)}),L);function Zn(t,e){var r=Math.cos(t),n=function(t){return Math.tan(At/4+t/2)},i=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(n(e)/n(t)),a=r*Math.pow(n(t),i)/i;if(!i)return Kn;function o(t,e){a>0?e<-Ct+Mt&&(e=-Ct+Mt):e>Ct-Mt&&(e=Ct-Mt);var r=a/Math.pow(n(e),i);return[r*Math.sin(i*t),a-r*Math.cos(i*t)]}return o.invert=function(t,e){var r=a-e,n=It(i)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/i,2*Math.atan(Math.pow(a/n,1/i))-Ct]},o}function Xn(t,e){var r=Math.cos(t),n=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),i=r/n+t;if(y(n)<Mt)return In;function a(t,e){var r=i-e;return[r*Math.sin(n*t),i-r*Math.cos(n*t)]}return a.invert=function(t,e){var r=i-e;return[Math.atan2(t,r)/n,i-It(n)*Math.sqrt(t*t+r*r)]},a}(t.geo.azimuthalEquidistant=function(){return Cn(Wn)}).raw=Wn,(t.geo.conicConformal=function(){return an(Zn)}).raw=Zn,(t.geo.conicEquidistant=function(){return an(Xn)}).raw=Xn;var Jn=Gn((function(t){return 1/t}),Math.atan);function Kn(t,e){return[t,Math.log(Math.tan(At/4+e/2))]}function $n(t){var e,r=Cn(t),n=r.scale,i=r.translate,a=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 o=a.apply(r,arguments);if(o===r){if(e=null==t){var s=At*n(),l=i();a([[l[0]-s,l[1]-s],[l[0]+s,l[1]+s]])}}else e&&(o=null);return o},r.clipExtent(null)}(t.geo.gnomonic=function(){return Cn(Jn)}).raw=Jn,Kn.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Ct]},(t.geo.mercator=function(){return $n(Kn)}).raw=Kn;var Qn=Gn((function(){return 1}),Math.asin);(t.geo.orthographic=function(){return Cn(Qn)}).raw=Qn;var ti=Gn((function(t){return 1/(1+t)}),(function(t){return 2*Math.atan(t)}));function ei(t,e){return[Math.log(Math.tan(At/4+e/2)),-t]}function ri(t){return t[0]}function ni(t){return t[1]}function ii(t){for(var e=t.length,r=[0,1],n=2,i=2;i<e;i++){for(;n>1&&Ot(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function ai(t,e){return t[0]-e[0]||t[1]-e[1]}(t.geo.stereographic=function(){return Cn(ti)}).raw=ti,ei.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Ct]},(t.geo.transverseMercator=function(){var t=$n(ei),e=t.center,r=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):[(t=e())[1],-t[0]]},t.rotate=function(t){return t?r([t[0],t[1],t.length>2?t[2]+90:90]):[(t=r())[0],t[1],t[2]-90]},r([0,0,90])}).raw=ei,t.geom={},t.geom.hull=function(t){var e=ri,r=ni;if(arguments.length)return n(t);function n(t){if(t.length<3)return[];var n,i=de(e),a=de(r),o=t.length,s=[],l=[];for(n=0;n<o;n++)s.push([+i.call(this,t[n],n),+a.call(this,t[n],n),n]);for(s.sort(ai),n=0;n<o;n++)l.push([s[n][0],-s[n][1]]);var c=ii(s),u=ii(l),f=u[0]===c[0],h=u[u.length-1]===c[c.length-1],p=[];for(n=c.length-1;n>=0;--n)p.push(t[s[c[n]][2]]);for(n=+f;n<u.length-h;++n)p.push(t[s[u[n]][2]]);return p}return n.x=function(t){return arguments.length?(e=t,n):e},n.y=function(t){return arguments.length?(r=t,n):r},n},t.geom.polygon=function(t){return U(t,oi),t};var oi=t.geom.polygon.prototype=[];function si(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function li(t,e,r,n){var i=t[0],a=r[0],o=e[0]-i,s=n[0]-a,l=t[1],c=r[1],u=e[1]-l,f=n[1]-c,h=(s*(l-c)-f*(i-a))/(f*o-s*u);return[i+h*o,l+h*u]}function ci(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}oi.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},oi.centroid=function(t){var e,r,n=-1,i=this.length,a=0,o=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],a+=(e[0]+s[0])*r,o+=(e[1]+s[1])*r;return[a*t,o*t]},oi.clip=function(t){for(var e,r,n,i,a,o,s=ci(t),l=-1,c=this.length-ci(this),u=this[c-1];++l<c;){for(e=t.slice(),t.length=0,i=this[l],a=e[(n=e.length-s)-1],r=-1;++r<n;)si(o=e[r],u,i)?(si(a,u,i)||t.push(li(a,o,u,i)),t.push(o)):si(a,u,i)&&t.push(li(a,o,u,i)),a=o;s&&t.push(t[0]),u=i}return t};var ui,fi,hi,pi,di,mi=[],gi=[];function vi(){Ni(this),this.edge=this.site=this.circle=null}function yi(t){var e=mi.pop()||new vi;return e.site=t,e}function xi(t){Ei(t),hi.remove(t),mi.push(t),Ni(t)}function bi(t){var e=t.circle,r=e.x,n=e.cy,i={x:r,y:n},a=t.P,o=t.N,s=[t];xi(t);for(var l=a;l.circle&&y(r-l.circle.x)<Mt&&y(n-l.circle.cy)<Mt;)a=l.P,s.unshift(l),xi(l),l=a;s.unshift(l),Ei(l);for(var c=o;c.circle&&y(r-c.circle.x)<Mt&&y(n-c.circle.cy)<Mt;)o=c.N,s.push(c),xi(c),c=o;s.push(c),Ei(c);var u,f=s.length;for(u=1;u<f;++u)c=s[u],l=s[u-1],Oi(c.edge,l.site,c.site,i);l=s[0],(c=s[f-1]).edge=Pi(l.site,c.site,null,i),Si(l),Si(c)}function _i(t){for(var e,r,n,i,a=t.x,o=t.y,s=hi._;s;)if((n=wi(s,o)-a)>Mt)s=s.L;else{if(!((i=a-Ti(s,o))>Mt)){n>-Mt?(e=s.P,r=s):i>-Mt?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=yi(t);if(hi.insert(e,l),e||r){if(e===r)return Ei(e),r=yi(e.site),hi.insert(l,r),l.edge=r.edge=Pi(e.site,l.site),Si(e),void Si(r);if(r){Ei(e),Ei(r);var c=e.site,u=c.x,f=c.y,h=t.x-u,p=t.y-f,d=r.site,m=d.x-u,g=d.y-f,v=2*(h*g-p*m),y=h*h+p*p,x=m*m+g*g,b={x:(g*y-p*x)/v+u,y:(h*x-m*y)/v+f};Oi(r.edge,c,d,b),l.edge=Pi(c,t,null,b),r.edge=Pi(t,d,null,b),Si(e),Si(r)}else l.edge=Pi(e.site,l.site)}}function wi(t,e){var r=t.site,n=r.x,i=r.y,a=i-e;if(!a)return n;var o=t.P;if(!o)return-1/0;var s=(r=o.site).x,l=r.y,c=l-e;if(!c)return s;var u=s-n,f=1/a-1/c,h=u/c;return f?(-h+Math.sqrt(h*h-2*f*(u*u/(-2*c)-l+c/2+i-a/2)))/f+n:(n+s)/2}function Ti(t,e){var r=t.N;if(r)return wi(r,e);var n=t.site;return n.y===e?n.x:1/0}function Mi(t){this.site=t,this.edges=[]}function ki(t,e){return e.angle-t.angle}function Ai(){Ni(this),this.x=this.y=this.arc=this.site=this.cy=null}function Si(t){var e=t.P,r=t.N;if(e&&r){var n=e.site,i=t.site,a=r.site;if(n!==a){var o=i.x,s=i.y,l=n.x-o,c=n.y-s,u=a.x-o,f=2*(l*(g=a.y-s)-c*u);if(!(f>=-kt)){var h=l*l+c*c,p=u*u+g*g,d=(g*h-c*p)/f,m=(l*p-u*h)/f,g=m+s,v=gi.pop()||new Ai;v.arc=t,v.site=i,v.x=d+o,v.y=g+Math.sqrt(d*d+m*m),v.cy=g,t.circle=v;for(var y=null,x=di._;x;)if(v.y<x.y||v.y===x.y&&v.x<=x.x){if(!x.L){y=x.P;break}x=x.L}else{if(!x.R){y=x;break}x=x.R}di.insert(y,v),y||(pi=v)}}}}function Ei(t){var e=t.circle;e&&(e.P||(pi=e.N),di.remove(e),gi.push(e),Ni(e),t.circle=null)}function Ci(t,e){var r=t.b;if(r)return!0;var n,i,a=t.a,o=e[0][0],s=e[1][0],l=e[0][1],c=e[1][1],u=t.l,f=t.r,h=u.x,p=u.y,d=f.x,m=f.y,g=(h+d)/2,v=(p+m)/2;if(m===p){if(g<o||g>=s)return;if(h>d){if(a){if(a.y>=c)return}else a={x:g,y:l};r={x:g,y:c}}else{if(a){if(a.y<l)return}else a={x:g,y:c};r={x:g,y:l}}}else if(i=v-(n=(h-d)/(m-p))*g,n<-1||n>1)if(h>d){if(a){if(a.y>=c)return}else a={x:(l-i)/n,y:l};r={x:(c-i)/n,y:c}}else{if(a){if(a.y<l)return}else a={x:(c-i)/n,y:c};r={x:(l-i)/n,y:l}}else if(p<m){if(a){if(a.x>=s)return}else a={x:o,y:n*o+i};r={x:s,y:n*s+i}}else{if(a){if(a.x<o)return}else a={x:s,y:n*s+i};r={x:o,y:n*o+i}}return t.a=a,t.b=r,!0}function Li(t,e){this.l=t,this.r=e,this.a=this.b=null}function Pi(t,e,r,n){var i=new Li(t,e);return ui.push(i),r&&Oi(i,t,e,r),n&&Oi(i,e,t,n),fi[t.i].edges.push(new zi(i,t,e)),fi[e.i].edges.push(new zi(i,e,t)),i}function Ii(t,e,r){var n=new Li(t,null);return n.a=e,n.b=r,ui.push(n),n}function Oi(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 zi(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 Di(){this._=null}function Ni(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function Ri(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 Fi(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 Bi(t){for(;t.L;)t=t.L;return t}function ji(t,e){var r,n,i,a=t.sort(Ui).pop();for(ui=[],fi=new Array(t.length),hi=new Di,di=new Di;;)if(i=pi,a&&(!i||a.y<i.y||a.y===i.y&&a.x<i.x))a.x===r&&a.y===n||(fi[a.i]=new Mi(a),_i(a),r=a.x,n=a.y),a=t.pop();else{if(!i)break;bi(i.arc)}e&&(function(t){for(var e,r=ui,n=rn(t[0][0],t[0][1],t[1][0],t[1][1]),i=r.length;i--;)(!Ci(e=r[i],t)||!n(e)||y(e.a.x-e.b.x)<Mt&&y(e.a.y-e.b.y)<Mt)&&(e.a=e.b=null,r.splice(i,1))}(e),function(t){for(var e,r,n,i,a,o,s,l,c,u,f=t[0][0],h=t[1][0],p=t[0][1],d=t[1][1],m=fi,g=m.length;g--;)if((a=m[g])&&a.prepare())for(l=(s=a.edges).length,o=0;o<l;)n=(u=s[o].end()).x,i=u.y,e=(c=s[++o%l].start()).x,r=c.y,(y(n-e)>Mt||y(i-r)>Mt)&&(s.splice(o,0,new zi(Ii(a.site,u,y(n-f)<Mt&&d-i>Mt?{x:f,y:y(e-f)<Mt?r:d}:y(i-d)<Mt&&h-n>Mt?{x:y(r-d)<Mt?e:h,y:d}:y(n-h)<Mt&&i-p>Mt?{x:h,y:y(e-h)<Mt?r:p}:y(i-p)<Mt&&n-f>Mt?{x:y(r-p)<Mt?e:f,y:p}:null),a.site,null)),++l)}(e));var o={cells:fi,edges:ui};return hi=di=ui=fi=null,o}function Ui(t,e){return e.y-t.y||e.x-t.x}Mi.prototype.prepare=function(){for(var t,e=this.edges,r=e.length;r--;)(t=e[r].edge).b&&t.a||e.splice(r,1);return e.sort(ki),e.length},zi.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}},Di.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=Bi(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;)r===(n=r.U).L?(i=n.R)&&i.C?(r.C=i.C=!1,n.C=!0,t=n):(t===r.R&&(Ri(this,r),r=(t=r).U),r.C=!1,n.C=!0,Fi(this,n)):(i=n.L)&&i.C?(r.C=i.C=!1,n.C=!0,t=n):(t===r.L&&(Fi(this,r),r=(t=r).U),r.C=!1,n.C=!0,Ri(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,a=t.L,o=t.R;if(r=a?o?Bi(o):a:o,i?i.L===t?i.L=r:i.R=r:this._=r,a&&o?(n=r.C,r.C=t.C,r.L=a,a.U=r,r!==o?(i=r.U,r.U=t.U,t=r.R,i.L=t,r.R=o,o.U=r):(r.U=i,i=r,t=r.R)):(n=t.C,t=r),t&&(t.U=i),!n)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===i.L){if((e=i.R).C&&(e.C=!1,i.C=!0,Ri(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,Fi(this,e),e=i.R),e.C=i.C,i.C=e.R.C=!1,Ri(this,i),t=this._;break}}else if((e=i.L).C&&(e.C=!1,i.C=!0,Fi(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,Ri(this,e),e=i.L),e.C=i.C,i.C=e.L.C=!1,Fi(this,i),t=this._;break}e.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}},t.geom.voronoi=function(t){var e=ri,r=ni,n=e,i=r,a=Vi;if(t)return o(t);function o(t){var e=new Array(t.length),r=a[0][0],n=a[0][1],i=a[1][0],o=a[1][1];return ji(s(t),a).cells.forEach((function(a,s){var l=a.edges,c=a.site;(e[s]=l.length?l.map((function(t){var e=t.start();return[e.x,e.y]})):c.x>=r&&c.x<=i&&c.y>=n&&c.y<=o?[[r,o],[i,o],[i,n],[r,n]]:[]).point=t[s]})),e}function s(t){return t.map((function(t,e){return{x:Math.round(n(t,e)/Mt)*Mt,y:Math.round(i(t,e)/Mt)*Mt,i:e}}))}return o.links=function(t){return ji(s(t)).edges.filter((function(t){return t.l&&t.r})).map((function(e){return{source:t[e.l.i],target:t[e.r.i]}}))},o.triangles=function(t){var e=[];return ji(s(t)).cells.forEach((function(r,n){for(var i,a,o,s,l=r.site,c=r.edges.sort(ki),u=-1,f=c.length,h=c[f-1].edge,p=h.l===l?h.r:h.l;++u<f;)h,i=p,p=(h=c[u].edge).l===l?h.r:h.l,n<i.i&&n<p.i&&(o=i,s=p,((a=l).x-s.x)*(o.y-a.y)-(a.x-o.x)*(s.y-a.y)<0)&&e.push([t[n],t[i.i],t[p.i]])})),e},o.x=function(t){return arguments.length?(n=de(e=t),o):e},o.y=function(t){return arguments.length?(i=de(r=t),o):r},o.clipExtent=function(t){return arguments.length?(a=null==t?Vi:t,o):a===Vi?null:a},o.size=function(t){return arguments.length?o.clipExtent(t&&[[0,0],t]):a===Vi?null:a&&a[1]},o};var Vi=[[-1e6,-1e6],[1e6,1e6]];function qi(t){return t.x}function Hi(t){return t.y}function Gi(t,e,r,n,i,a){if(!t(e,r,n,i,a)){var o=.5*(r+i),s=.5*(n+a),l=e.nodes;l[0]&&Gi(t,l[0],r,n,o,s),l[1]&&Gi(t,l[1],o,n,i,s),l[2]&&Gi(t,l[2],r,s,o,a),l[3]&&Gi(t,l[3],o,s,i,a)}}function Yi(t,e,r,n,i,a,o){var s,l=1/0;return function t(c,u,f,h,p){if(!(u>a||f>o||h<n||p<i)){if(d=c.point){var d,m=e-c.x,g=r-c.y,v=m*m+g*g;if(v<l){var y=Math.sqrt(l=v);n=e-y,i=r-y,a=e+y,o=r+y,s=d}}for(var x=c.nodes,b=.5*(u+h),_=.5*(f+p),w=(r>=_)<<1|e>=b,T=w+4;w<T;++w)if(c=x[3&w])switch(3&w){case 0:t(c,u,f,b,_);break;case 1:t(c,b,f,h,_);break;case 2:t(c,u,_,b,p);break;case 3:t(c,b,_,h,p)}}}(t,n,i,a,o),s}function Wi(e,r){e=t.rgb(e),r=t.rgb(r);var n=e.r,i=e.g,a=e.b,o=r.r-n,s=r.g-i,l=r.b-a;return function(t){return"#"+se(Math.round(n+o*t))+se(Math.round(i+s*t))+se(Math.round(a+l*t))}}function Zi(t,e){var r,n={},i={};for(r in t)r in e?n[r]=Qi(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 Xi(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function Ji(t,e){var r,n,i,a=Ki.lastIndex=$i.lastIndex=0,o=-1,s=[],l=[];for(t+="",e+="";(r=Ki.exec(t))&&(n=$i.exec(e));)(i=n.index)>a&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:Xi(r,n)})),a=$i.lastIndex;return a<e.length&&(i=e.slice(a),s[o]?s[o]+=i:s[++o]=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;n<e;++n)s[(r=l[n]).i]=r.x(t);return s.join("")})}t.geom.delaunay=function(e){return t.geom.voronoi().triangles(e)},t.geom.quadtree=function(t,e,r,n,i){var a,o=ri,s=ni;if(a=arguments.length)return o=qi,s=Hi,3===a&&(i=r,n=e,r=e=0),l(t);function l(t){var l,c,u,f,h,p,d,m,g,v=de(o),x=de(s);if(null!=e)p=e,d=r,m=n,g=i;else if(m=g=-(p=d=1/0),c=[],u=[],h=t.length,a)for(f=0;f<h;++f)(l=t[f]).x<p&&(p=l.x),l.y<d&&(d=l.y),l.x>m&&(m=l.x),l.y>g&&(g=l.y),c.push(l.x),u.push(l.y);else for(f=0;f<h;++f){var b=+v(l=t[f],f),_=+x(l,f);b<p&&(p=b),_<d&&(d=_),b>m&&(m=b),_>g&&(g=_),c.push(b),u.push(_)}var w=m-p,T=g-d;function M(t,e,r,n,i,a,o,s){if(!isNaN(r)&&!isNaN(n))if(t.leaf){var l=t.x,c=t.y;if(null!=l)if(y(l-r)+y(c-n)<.01)k(t,e,r,n,i,a,o,s);else{var u=t.point;t.x=t.y=t.point=null,k(t,u,l,c,i,a,o,s),k(t,e,r,n,i,a,o,s)}else t.x=r,t.y=n,t.point=e}else k(t,e,r,n,i,a,o,s)}function k(t,e,r,n,i,a,o,s){var l=.5*(i+o),c=.5*(a+s),u=r>=l,f=n>=c,h=f<<1|u;t.leaf=!1,u?i=l:o=l,f?a=c:s=c,M(t=t.nodes[h]||(t.nodes[h]={leaf:!0,nodes:[],point:null,x:null,y:null}),e,r,n,i,a,o,s)}w>T?g=d+w:m=p+T;var A={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){M(A,t,+v(t,++f),+x(t,f),p,d,m,g)},visit:function(t){Gi(t,A,p,d,m,g)},find:function(t){return Yi(A,t[0],t[1],p,d,m,g)}};if(f=-1,null==e){for(;++f<h;)M(A,t[f],c[f],u[f],p,d,m,g);--f}else t.forEach(A.add);return c=u=t=l=null,A}return l.x=function(t){return arguments.length?(o=t,l):o},l.y=function(t){return arguments.length?(s=t,l):s},l.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]),l):null==e?null:[[e,r],[n,i]]},l.size=function(t){return arguments.length?(null==t?e=r=n=i=null:(e=r=0,n=+t[0],i=+t[1]),l):null==e?null:[n-e,i-r]},l},t.interpolateRgb=Wi,t.interpolateObject=Zi,t.interpolateNumber=Xi,t.interpolateString=Ji;var Ki=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,$i=new RegExp(Ki.source,"g");function Qi(e,r){for(var n,i=t.interpolators.length;--i>=0&&!(n=t.interpolators[i](e,r)););return n}function ta(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r<s;++r)n.push(Qi(t[r],e[r]));for(;r<a;++r)i[r]=t[r];for(;r<o;++r)i[r]=e[r];return function(t){for(r=0;r<s;++r)i[r]=n[r](t);return i}}t.interpolate=Qi,t.interpolators=[function(t,e){var r=typeof e;return("string"===r?pe.has(e.toLowerCase())||/^(#|rgb\(|hsl\()/i.test(e)?Wi:Ji:e instanceof Vt?Wi:Array.isArray(e)?ta:"object"===r&&isNaN(e)?Zi:Xi)(t,e)}],t.interpolateArray=ta;var ea=function(){return L},ra=t.map({linear:ea,poly:function(t){return function(e){return Math.pow(e,t)}},quad:function(){return sa},cubic:function(){return la},sin:function(){return ua},exp:function(){return fa},circle:function(){return ha},elastic:function(t,e){var r;arguments.length<2&&(e=.45);arguments.length?r=e/St*Math.asin(1/t):(t=1,r=e/4);return function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*St/e)}},back:function(t){t||(t=1.70158);return function(e){return e*e*((t+1)*e-t)}},bounce:function(){return pa}}),na=t.map({in:L,out:aa,"in-out":oa,"out-in":function(t){return oa(aa(t))}});function ia(t){return function(e){return e<=0?0:e>=1?1:t(e)}}function aa(t){return function(e){return 1-t(1-e)}}function oa(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function sa(t){return t*t}function la(t){return t*t*t}function ca(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function ua(t){return 1-Math.cos(t*Ct)}function fa(t){return Math.pow(2,10*(t-1))}function ha(t){return 1-Math.sqrt(1-t*t)}function pa(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function da(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function ma(t){var e,r,n,i=[t.a,t.b],a=[t.c,t.d],o=va(i),s=ga(i,a),l=va(((e=a)[0]+=(n=-s)*(r=i)[0],e[1]+=n*r[1],e))||0;i[0]*a[1]<a[0]*i[1]&&(i[0]*=-1,i[1]*=-1,o*=-1,s*=-1),this.rotate=(o?Math.atan2(i[1],i[0]):Math.atan2(-a[0],a[1]))*Pt,this.translate=[t.e,t.f],this.scale=[o,l],this.skew=l?Math.atan2(s,l)*Pt:0}function ga(t,e){return t[0]*e[0]+t[1]*e[1]}function va(t){var e=Math.sqrt(ga(t,t));return e&&(t[0]/=e,t[1]/=e),e}t.ease=function(t){var e=t.indexOf("-"),n=e>=0?t.slice(0,e):t,i=e>=0?t.slice(e+1):"in";return n=ra.get(n)||ea,ia((i=na.get(i)||L)(n.apply(null,r.call(arguments,1))))},t.interpolateHcl=function(e,r){e=t.hcl(e),r=t.hcl(r);var n=e.h,i=e.c,a=e.l,o=r.h-n,s=r.c-i,l=r.l-a;isNaN(s)&&(s=0,i=isNaN(i)?r.c:i);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return Zt(n+o*t,i+s*t,a+l*t)+""}},t.interpolateHsl=function(e,r){e=t.hsl(e),r=t.hsl(r);var n=e.h,i=e.s,a=e.l,o=r.h-n,s=r.s-i,l=r.l-a;isNaN(s)&&(s=0,i=isNaN(i)?r.s:i);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return Gt(n+o*t,i+s*t,a+l*t)+""}},t.interpolateLab=function(e,r){e=t.lab(e),r=t.lab(r);var n=e.l,i=e.a,a=e.b,o=r.l-n,s=r.a-i,l=r.b-a;return function(t){return $t(n+o*t,i+s*t,a+l*t)+""}},t.interpolateRound=da,t.transform=function(e){var r=i.createElementNS(t.ns.prefix.svg,"g");return(t.transform=function(t){if(null!=t){r.setAttribute("transform",t);var e=r.transform.baseVal.consolidate()}return new ma(e?e.matrix:ya)})(e)},ma.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ya={a:1,b:0,c:0,d:1,e:0,f:0};function xa(t){return t.length?t.pop()+",":""}function ba(e,r){var n=[],i=[];return e=t.transform(e),r=t.transform(r),function(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:Xi(t[0],e[0])},{i:i-2,x:Xi(t[1],e[1])})}else(e[0]||e[1])&&r.push("translate("+e+")")}(e.translate,r.translate,n,i),function(t,e,r,n){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(xa(r)+"rotate(",null,")")-2,x:Xi(t,e)})):e&&r.push(xa(r)+"rotate("+e+")")}(e.rotate,r.rotate,n,i),function(t,e,r,n){t!==e?n.push({i:r.push(xa(r)+"skewX(",null,")")-2,x:Xi(t,e)}):e&&r.push(xa(r)+"skewX("+e+")")}(e.skew,r.skew,n,i),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(xa(r)+"scale(",null,",",null,")");n.push({i:i-4,x:Xi(t[0],e[0])},{i:i-2,x:Xi(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(xa(r)+"scale("+e+")")}(e.scale,r.scale,n,i),e=r=null,function(t){for(var e,r=-1,a=i.length;++r<a;)n[(e=i[r]).i]=e.x(t);return n.join("")}}function _a(t,e){return e=(e-=t=+t)||1/e,function(r){return(r-t)/e}}function wa(t,e){return e=(e-=t=+t)||1/e,function(r){return Math.max(0,Math.min(1,(r-t)/e))}}function Ta(t){for(var e=t.source,r=t.target,n=function(t,e){if(t===e)return t;var r=Ma(t),n=Ma(e),i=r.pop(),a=n.pop(),o=null;for(;i===a;)o=i,i=r.pop(),a=n.pop();return o}(e,r),i=[e];e!==n;)e=e.parent,i.push(e);for(var a=i.length;r!==n;)i.splice(a,0,r),r=r.parent;return i}function Ma(t){for(var e=[],r=t.parent;null!=r;)e.push(t),t=r,r=r.parent;return e.push(t),e}function ka(t){t.fixed|=2}function Aa(t){t.fixed&=-7}function Sa(t){t.fixed|=4,t.px=t.x,t.py=t.y}function Ea(t){t.fixed&=-5}t.interpolateTransform=ba,t.layout={},t.layout.bundle=function(){return function(t){for(var e=[],r=-1,n=t.length;++r<n;)e.push(Ta(t[r]));return e}},t.layout.chord=function(){var e,r,n,i,a,o,s,l={},c=0;function u(){var l,u,h,p,d,m={},g=[],v=t.range(i),y=[];for(e=[],r=[],l=0,p=-1;++p<i;){for(u=0,d=-1;++d<i;)u+=n[p][d];g.push(u),y.push(t.range(i)),l+=u}for(a&&v.sort((function(t,e){return a(g[t],g[e])})),o&&y.forEach((function(t,e){t.sort((function(t,r){return o(n[e][t],n[e][r])}))})),l=(St-c*i)/l,u=0,p=-1;++p<i;){for(h=u,d=-1;++d<i;){var x=v[p],b=y[x][d],_=n[x][b],w=u,T=u+=_*l;m[x+"-"+b]={index:x,subindex:b,startAngle:w,endAngle:T,value:_}}r[x]={index:x,startAngle:h,endAngle:u,value:g[x]},u+=c}for(p=-1;++p<i;)for(d=p-1;++d<i;){var M=m[p+"-"+d],k=m[d+"-"+p];(M.value||k.value)&&e.push(M.value<k.value?{source:k,target:M}:{source:M,target:k})}s&&f()}function f(){e.sort((function(t,e){return s((t.source.value+t.target.value)/2,(e.source.value+e.target.value)/2)}))}return l.matrix=function(t){return arguments.length?(i=(n=t)&&n.length,e=r=null,l):n},l.padding=function(t){return arguments.length?(c=t,e=r=null,l):c},l.sortGroups=function(t){return arguments.length?(a=t,e=r=null,l):a},l.sortSubgroups=function(t){return arguments.length?(o=t,e=null,l):o},l.sortChords=function(t){return arguments.length?(s=t,e&&f(),l):s},l.chords=function(){return e||u(),e},l.groups=function(){return r||u(),r},l},t.layout.force=function(){var e,r,n,i,a,o,s={},l=t.dispatch("start","tick","end"),c=[1,1],u=.9,f=Ca,h=La,p=-30,d=Pa,m=.1,g=.64,v=[],y=[];function x(t){return function(e,r,n,i){if(e.point!==t){var a=e.cx-t.x,o=e.cy-t.y,s=i-r,l=a*a+o*o;if(s*s/g<l){if(l<d){var c=e.charge/l;t.px-=a*c,t.py-=o*c}return!0}if(e.point&&l&&l<d){c=e.pointCharge/l;t.px-=a*c,t.py-=o*c}}return!e.charge}}function b(e){e.px=t.event.x,e.py=t.event.y,s.resume()}return s.tick=function(){if((n*=.99)<.005)return e=null,l.end({type:"end",alpha:n=0}),!0;var r,s,f,h,d,g,b,_,w,T=v.length,M=y.length;for(s=0;s<M;++s)h=(f=y[s]).source,(g=(_=(d=f.target).x-h.x)*_+(w=d.y-h.y)*w)&&(_*=g=n*a[s]*((g=Math.sqrt(g))-i[s])/g,w*=g,d.x-=_*(b=h.weight+d.weight?h.weight/(h.weight+d.weight):.5),d.y-=w*b,h.x+=_*(b=1-b),h.y+=w*b);if((b=n*m)&&(_=c[0]/2,w=c[1]/2,s=-1,b))for(;++s<T;)(f=v[s]).x+=(_-f.x)*b,f.y+=(w-f.y)*b;if(p)for(!function t(e,r,n){var i=0,a=0;if(e.charge=0,!e.leaf)for(var o,s=e.nodes,l=s.length,c=-1;++c<l;)null!=(o=s[c])&&(t(o,r,n),e.charge+=o.charge,i+=o.charge*o.cx,a+=o.charge*o.cy);if(e.point){e.leaf||(e.point.x+=Math.random()-.5,e.point.y+=Math.random()-.5);var u=r*n[e.point.index];e.charge+=e.pointCharge=u,i+=u*e.point.x,a+=u*e.point.y}e.cx=i/e.charge,e.cy=a/e.charge}(r=t.geom.quadtree(v),n,o),s=-1;++s<T;)(f=v[s]).fixed||r.visit(x(f));for(s=-1;++s<T;)(f=v[s]).fixed?(f.x=f.px,f.y=f.py):(f.x-=(f.px-(f.px=f.x))*u,f.y-=(f.py-(f.py=f.y))*u);l.tick({type:"tick",alpha:n})},s.nodes=function(t){return arguments.length?(v=t,s):v},s.links=function(t){return arguments.length?(y=t,s):y},s.size=function(t){return arguments.length?(c=t,s):c},s.linkDistance=function(t){return arguments.length?(f="function"==typeof t?t:+t,s):f},s.distance=s.linkDistance,s.linkStrength=function(t){return arguments.length?(h="function"==typeof t?t:+t,s):h},s.friction=function(t){return arguments.length?(u=+t,s):u},s.charge=function(t){return arguments.length?(p="function"==typeof t?t:+t,s):p},s.chargeDistance=function(t){return arguments.length?(d=t*t,s):Math.sqrt(d)},s.gravity=function(t){return arguments.length?(m=+t,s):m},s.theta=function(t){return arguments.length?(g=t*t,s):Math.sqrt(g)},s.alpha=function(t){return arguments.length?(t=+t,n?t>0?n=t:(e.c=null,e.t=NaN,e=null,l.end({type:"end",alpha:n=0})):t>0&&(l.start({type:"start",alpha:n=t}),e=we(s.tick)),s):n},s.start=function(){var t,e,r,n=v.length,l=y.length,u=c[0],d=c[1];for(t=0;t<n;++t)(r=v[t]).index=t,r.weight=0;for(t=0;t<l;++t)"number"==typeof(r=y[t]).source&&(r.source=v[r.source]),"number"==typeof r.target&&(r.target=v[r.target]),++r.source.weight,++r.target.weight;for(t=0;t<n;++t)r=v[t],isNaN(r.x)&&(r.x=m("x",u)),isNaN(r.y)&&(r.y=m("y",d)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(i=[],"function"==typeof f)for(t=0;t<l;++t)i[t]=+f.call(this,y[t],t);else for(t=0;t<l;++t)i[t]=f;if(a=[],"function"==typeof h)for(t=0;t<l;++t)a[t]=+h.call(this,y[t],t);else for(t=0;t<l;++t)a[t]=h;if(o=[],"function"==typeof p)for(t=0;t<n;++t)o[t]=+p.call(this,v[t],t);else for(t=0;t<n;++t)o[t]=p;function m(r,i){if(!e){for(e=new Array(n),c=0;c<n;++c)e[c]=[];for(c=0;c<l;++c){var a=y[c];e[a.source.index].push(a.target),e[a.target.index].push(a.source)}}for(var o,s=e[t],c=-1,u=s.length;++c<u;)if(!isNaN(o=s[c][r]))return o;return Math.random()*i}return s.resume()},s.resume=function(){return s.alpha(.1)},s.stop=function(){return s.alpha(0)},s.drag=function(){if(r||(r=t.behavior.drag().origin(L).on("dragstart.force",ka).on("drag.force",b).on("dragend.force",Aa)),!arguments.length)return r;this.on("mouseover.force",Sa).on("mouseout.force",Ea).call(r)},t.rebind(s,l,"on")};var Ca=20,La=1,Pa=1/0;function Ia(e,r){return t.rebind(e,r,"sort","children","value"),e.nodes=e,e.links=Fa,e}function Oa(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 za(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(a=t.children)&&(i=a.length))for(var i,a,o=-1;++o<i;)r.push(a[o]);for(;null!=(t=n.pop());)e(t)}function Da(t){return t.children}function Na(t){return t.value}function Ra(t,e){return e.value-t.value}function Fa(e){return t.merge(e.map((function(t){return(t.children||[]).map((function(e){return{source:t,target:e}}))})))}t.layout.hierarchy=function(){var t=Ra,e=Da,r=Na;function n(i){var a,o=[i],s=[];for(i.depth=0;null!=(a=o.pop());)if(s.push(a),(c=e.call(n,a,a.depth))&&(l=c.length)){for(var l,c,u;--l>=0;)o.push(u=c[l]),u.parent=a,u.depth=a.depth+1;r&&(a.value=0),a.children=c}else r&&(a.value=+r.call(n,a,a.depth)||0),delete a.children;return za(i,(function(e){var n,i;t&&(n=e.children)&&n.sort(t),r&&(i=e.parent)&&(i.value+=e.value)})),s}return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&(Oa(t,(function(t){t.children&&(t.value=0)})),za(t,(function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)}))),t},n},t.layout.partition=function(){var e=t.layout.hierarchy(),r=[1,1];function n(t,n){var i=e.call(this,t,n);return function t(e,r,n,i){var a=e.children;if(e.x=r,e.y=e.depth*i,e.dx=n,e.dy=i,a&&(o=a.length)){var o,s,l,c=-1;for(n=e.value?n/e.value:0;++c<o;)t(s=a[c],r,l=s.value*n,i),r+=l}}(i[0],0,r[0],r[1]/function t(e){var r=e.children,n=0;if(r&&(i=r.length))for(var i,a=-1;++a<i;)n=Math.max(n,t(r[a]));return 1+n}(i[0])),i}return n.size=function(t){return arguments.length?(r=t,n):r},Ia(n,e)},t.layout.pie=function(){var e=Number,r=Ba,n=0,i=St,a=0;function o(s){var l,c=s.length,u=s.map((function(t,r){return+e.call(o,t,r)})),f=+("function"==typeof n?n.apply(this,arguments):n),h=("function"==typeof i?i.apply(this,arguments):i)-f,p=Math.min(Math.abs(h)/c,+("function"==typeof a?a.apply(this,arguments):a)),d=p*(h<0?-1:1),m=t.sum(u),g=m?(h-c*d)/m:0,v=t.range(c),y=[];return null!=r&&v.sort(r===Ba?function(t,e){return u[e]-u[t]}:function(t,e){return r(s[t],s[e])}),v.forEach((function(t){y[t]={data:s[t],value:l=u[t],startAngle:f,endAngle:f+=l*g+d,padAngle:p}})),y}return o.value=function(t){return arguments.length?(e=t,o):e},o.sort=function(t){return arguments.length?(r=t,o):r},o.startAngle=function(t){return arguments.length?(n=t,o):n},o.endAngle=function(t){return arguments.length?(i=t,o):i},o.padAngle=function(t){return arguments.length?(a=t,o):a},o};var Ba={};function ja(t){return t.x}function Ua(t){return t.y}function Va(t,e,r){t.y0=e,t.y=r}t.layout.stack=function(){var e=L,r=Ga,n=Ya,i=Va,a=ja,o=Ua;function s(l,c){if(!(p=l.length))return l;var u=l.map((function(t,r){return e.call(s,t,r)})),f=u.map((function(t){return t.map((function(t,e){return[a.call(s,t,e),o.call(s,t,e)]}))})),h=r.call(s,f,c);u=t.permute(u,h),f=t.permute(f,h);var p,d,m,g,v=n.call(s,f,c),y=u[0].length;for(m=0;m<y;++m)for(i.call(s,u[0][m],g=v[m],f[0][m][1]),d=1;d<p;++d)i.call(s,u[d][m],g+=f[d-1][m][1],f[d][m][1]);return l}return s.values=function(t){return arguments.length?(e=t,s):e},s.order=function(t){return arguments.length?(r="function"==typeof t?t:qa.get(t)||Ga,s):r},s.offset=function(t){return arguments.length?(n="function"==typeof t?t:Ha.get(t)||Ya,s):n},s.x=function(t){return arguments.length?(a=t,s):a},s.y=function(t){return arguments.length?(o=t,s):o},s.out=function(t){return arguments.length?(i=t,s):i},s};var qa=t.map({"inside-out":function(e){var r,n,i=e.length,a=e.map(Wa),o=e.map(Za),s=t.range(i).sort((function(t,e){return a[t]-a[e]})),l=0,c=0,u=[],f=[];for(r=0;r<i;++r)n=s[r],l<c?(l+=o[n],u.push(n)):(c+=o[n],f.push(n));return f.reverse().concat(u)},reverse:function(e){return t.range(e.length).reverse()},default:Ga}),Ha=t.map({silhouette:function(t){var e,r,n,i=t.length,a=t[0].length,o=[],s=0,l=[];for(r=0;r<a;++r){for(e=0,n=0;e<i;e++)n+=t[e][r][1];n>s&&(s=n),o.push(n)}for(r=0;r<a;++r)l[r]=(s-o[r])/2;return l},wiggle:function(t){var e,r,n,i,a,o,s,l,c,u=t.length,f=t[0],h=f.length,p=[];for(p[0]=l=c=0,r=1;r<h;++r){for(e=0,i=0;e<u;++e)i+=t[e][r][1];for(e=0,a=0,s=f[r][0]-f[r-1][0];e<u;++e){for(n=0,o=(t[e][r][1]-t[e][r-1][1])/(2*s);n<e;++n)o+=(t[n][r][1]-t[n][r-1][1])/s;a+=o*t[e][r][1]}p[r]=l-=i?a/i*s:0,l<c&&(c=l)}for(r=0;r<h;++r)p[r]-=c;return p},expand:function(t){var e,r,n,i=t.length,a=t[0].length,o=1/i,s=[];for(r=0;r<a;++r){for(e=0,n=0;e<i;e++)n+=t[e][r][1];if(n)for(e=0;e<i;e++)t[e][r][1]/=n;else for(e=0;e<i;e++)t[e][r][1]=o}for(r=0;r<a;++r)s[r]=0;return s},zero:Ya});function Ga(e){return t.range(e.length)}function Ya(t){for(var e=-1,r=t[0].length,n=[];++e<r;)n[e]=0;return n}function Wa(t){for(var e,r=1,n=0,i=t[0][1],a=t.length;r<a;++r)(e=t[r][1])>i&&(n=r,i=e);return n}function Za(t){return t.reduce(Xa,0)}function Xa(t,e){return t+e[1]}function Ja(t,e){return Ka(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function Ka(t,e){for(var r=-1,n=+t[0],i=(t[1]-n)/e,a=[];++r<=e;)a[r]=i*r+n;return a}function $a(e){return[t.min(e),t.max(e)]}function Qa(t,e){return t.value-e.value}function to(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function eo(t,e){t._pack_next=e,e._pack_prev=t}function ro(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 no(t){if((e=t.children)&&(l=e.length)){var e,r,n,i,a,o,s,l,c=1/0,u=-1/0,f=1/0,h=-1/0;if(e.forEach(io),(r=e[0]).x=-r.r,r.y=0,x(r),l>1&&((n=e[1]).x=n.r,n.y=0,x(n),l>2))for(oo(r,n,i=e[2]),x(i),to(r,i),r._pack_prev=i,to(i,n),n=r._pack_next,a=3;a<l;a++){oo(r,n,i=e[a]);var p=0,d=1,m=1;for(o=n._pack_next;o!==n;o=o._pack_next,d++)if(ro(o,i)){p=1;break}if(1==p)for(s=r._pack_prev;s!==o._pack_prev&&!ro(s,i);s=s._pack_prev,m++);p?(d<m||d==m&&n.r<r.r?eo(r,n=o):eo(r=s,n),a--):(to(r,i),n=i,x(i))}var g=(c+u)/2,v=(f+h)/2,y=0;for(a=0;a<l;a++)(i=e[a]).x-=g,i.y-=v,y=Math.max(y,i.r+Math.sqrt(i.x*i.x+i.y*i.y));t.r=y,e.forEach(ao)}function x(t){c=Math.min(t.x-t.r,c),u=Math.max(t.x+t.r,u),f=Math.min(t.y-t.r,f),h=Math.max(t.y+t.r,h)}}function io(t){t._pack_next=t._pack_prev=t}function ao(t){delete t._pack_next,delete t._pack_prev}function oo(t,e,r){var n=t.r+r.r,i=e.x-t.x,a=e.y-t.y;if(n&&(i||a)){var o=e.r+r.r,s=i*i+a*a,l=.5+((n*=n)-(o*=o))/(2*s),c=Math.sqrt(Math.max(0,2*o*(n+s)-(n-=s)*n-o*o))/(2*s);r.x=t.x+l*i+c*a,r.y=t.y+l*a-c*i}else r.x=t.x+n,r.y=t.y}function so(t,e){return t.parent==e.parent?1:2}function lo(t){var e=t.children;return e.length?e[0]:t.t}function co(t){var e,r=t.children;return(e=r.length)?r[e-1]:t.t}function uo(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 fo(t,e,r){return t.a.parent===e.parent?t.a:r}function ho(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function po(t,e){var r=t.x+e[3],n=t.y+e[0],i=t.dx-e[1]-e[3],a=t.dy-e[0]-e[2];return i<0&&(r+=i/2,i=0),a<0&&(n+=a/2,a=0),{x:r,y:n,dx:i,dy:a}}function mo(t){var e=t[0],r=t[t.length-1];return e<r?[e,r]:[r,e]}function go(t){return t.rangeExtent?t.rangeExtent():mo(t.range())}function vo(t,e,r,n){var i=r(t[0],t[1]),a=n(e[0],e[1]);return function(t){return a(i(t))}}function yo(t,e){var r,n=0,i=t.length-1,a=t[n],o=t[i];return o<a&&(r=n,n=i,i=r,r=a,a=o,o=r),t[n]=e.floor(a),t[i]=e.ceil(o),t}function xo(t){return t?{floor:function(e){return Math.floor(e/t)*t},ceil:function(e){return Math.ceil(e/t)*t}}:bo}t.layout.histogram=function(){var e=!0,r=Number,n=$a,i=Ja;function a(a,o){for(var s,l,c=[],u=a.map(r,this),f=n.call(this,u,o),h=i.call(this,f,u,o),p=(o=-1,u.length),d=h.length-1,m=e?1:1/p;++o<d;)(s=c[o]=[]).dx=h[o+1]-(s.x=h[o]),s.y=0;if(d>0)for(o=-1;++o<p;)(l=u[o])>=f[0]&&l<=f[1]&&((s=c[t.bisect(h,l,1,d)-1]).y+=m,s.push(a[o]));return c}return a.value=function(t){return arguments.length?(r=t,a):r},a.range=function(t){return arguments.length?(n=de(t),a):n},a.bins=function(t){return arguments.length?(i="number"==typeof t?function(e){return Ka(e,t)}:de(t),a):i},a.frequency=function(t){return arguments.length?(e=!!t,a):e},a},t.layout.pack=function(){var e,r=t.layout.hierarchy().sort(Qa),n=0,i=[1,1];function a(t,a){var o=r.call(this,t,a),s=o[0],l=i[0],c=i[1],u=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,za(s,(function(t){t.r=+u(t.value)})),za(s,no),n){var f=n*(e?1:Math.max(2*s.r/l,2*s.r/c))/2;za(s,(function(t){t.r+=f})),za(s,no),za(s,(function(t){t.r-=f}))}return function t(e,r,n,i){var a=e.children;if(e.x=r+=i*e.x,e.y=n+=i*e.y,e.r*=i,a)for(var o=-1,s=a.length;++o<s;)t(a[o],r,n,i)}(s,l/2,c/2,e?1:1/Math.max(2*s.r/l,2*s.r/c)),o}return a.size=function(t){return arguments.length?(i=t,a):i},a.radius=function(t){return arguments.length?(e=null==t||"function"==typeof t?t:+t,a):e},a.padding=function(t){return arguments.length?(n=+t,a):n},Ia(a,r)},t.layout.tree=function(){var e=t.layout.hierarchy().sort(null).value(null),r=so,n=[1,1],i=null;function a(t,a){var c=e.call(this,t,a),u=c[0],f=function(t){var e,r={A:null,children:[t]},n=[r];for(;null!=(e=n.pop());)for(var i,a=e.children,o=0,s=a.length;o<s;++o)n.push((a[o]=i={_:a[o],parent:e,children:(i=a[o].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:o}).a=i);return r.children[0]}(u);if(za(f,o),f.parent.m=-f.z,Oa(f,s),i)Oa(u,l);else{var h=u,p=u,d=u;Oa(u,(function(t){t.x<h.x&&(h=t),t.x>p.x&&(p=t),t.depth>d.depth&&(d=t)}));var m=r(h,p)/2-h.x,g=n[0]/(p.x+r(p,h)/2+m),v=n[1]/(d.depth||1);Oa(u,(function(t){t.x=(t.x+m)*g,t.y=t.depth*v}))}return c}function o(t){var e=t.children,n=t.parent.children,i=t.i?n[t.i-1]:null;if(e.length){!function(t){var e,r=0,n=0,i=t.children,a=i.length;for(;--a>=0;)(e=i[a]).z+=r,e.m+=r,r+=e.s+(n+=e.c)}(t);var a=(e[0].z+e[e.length-1].z)/2;i?(t.z=i.z+r(t._,i._),t.m=t.z-a):t.z=a}else i&&(t.z=i.z+r(t._,i._));t.parent.A=function(t,e,n){if(e){for(var i,a=t,o=t,s=e,l=a.parent.children[0],c=a.m,u=o.m,f=s.m,h=l.m;s=co(s),a=lo(a),s&&a;)l=lo(l),(o=co(o)).a=t,(i=s.z+f-a.z-c+r(s._,a._))>0&&(uo(fo(s,t,n),t,i),c+=i,u+=i),f+=s.m,c+=a.m,h+=l.m,u+=o.m;s&&!co(o)&&(o.t=s,o.m+=f-u),a&&!lo(l)&&(l.t=a,l.m+=c-h,n=t)}return n}(t,i,t.parent.A||n[0])}function s(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function l(t){t.x*=n[0],t.y=t.depth*n[1]}return a.separation=function(t){return arguments.length?(r=t,a):r},a.size=function(t){return arguments.length?(i=null==(n=t)?l:null,a):i?null:n},a.nodeSize=function(t){return arguments.length?(i=null==(n=t)?null:l,a):i?n:null},Ia(a,e)},t.layout.cluster=function(){var e=t.layout.hierarchy().sort(null).value(null),r=so,n=[1,1],i=!1;function a(a,o){var s,l=e.call(this,a,o),c=l[0],u=0;za(c,(function(e){var n=e.children;n&&n.length?(e.x=function(t){return t.reduce((function(t,e){return t+e.x}),0)/t.length}(n),e.y=function(e){return 1+t.max(e,(function(t){return t.y}))}(n)):(e.x=s?u+=r(e,s):0,e.y=0,s=e)}));var f=function t(e){var r=e.children;return r&&r.length?t(r[0]):e}(c),h=function t(e){var r,n=e.children;return n&&(r=n.length)?t(n[r-1]):e}(c),p=f.x-r(f,h)/2,d=h.x+r(h,f)/2;return za(c,i?function(t){t.x=(t.x-c.x)*n[0],t.y=(c.y-t.y)*n[1]}:function(t){t.x=(t.x-p)/(d-p)*n[0],t.y=(1-(c.y?t.y/c.y:1))*n[1]}),l}return a.separation=function(t){return arguments.length?(r=t,a):r},a.size=function(t){return arguments.length?(i=null==(n=t),a):i?null:n},a.nodeSize=function(t){return arguments.length?(i=null!=(n=t),a):i?n:null},Ia(a,e)},t.layout.treemap=function(){var e,r=t.layout.hierarchy(),n=Math.round,i=[1,1],a=null,o=ho,s=!1,l="squarify",c=.5*(1+Math.sqrt(5));function u(t,e){for(var r,n,i=-1,a=t.length;++i<a;)n=(r=t[i]).value*(e<0?0:e),r.area=isNaN(n)||n<=0?0:n}function f(t){var e=t.children;if(e&&e.length){var r,n,i,a=o(t),s=[],c=e.slice(),h=1/0,m="slice"===l?a.dx:"dice"===l?a.dy:"slice-dice"===l?1&t.depth?a.dy:a.dx:Math.min(a.dx,a.dy);for(u(c,a.dx*a.dy/t.value),s.area=0;(i=c.length)>0;)s.push(r=c[i-1]),s.area+=r.area,"squarify"!==l||(n=p(s,m))<=h?(c.pop(),h=n):(s.area-=s.pop().area,d(s,m,a,!1),m=Math.min(a.dx,a.dy),s.length=s.area=0,h=1/0);s.length&&(d(s,m,a,!0),s.length=s.area=0),e.forEach(f)}}function h(t){var e=t.children;if(e&&e.length){var r,n=o(t),i=e.slice(),a=[];for(u(i,n.dx*n.dy/t.value),a.area=0;r=i.pop();)a.push(r),a.area+=r.area,null!=r.z&&(d(a,r.z?n.dx:n.dy,n,!i.length),a.length=a.area=0);e.forEach(h)}}function p(t,e){for(var r,n=t.area,i=0,a=1/0,o=-1,s=t.length;++o<s;)(r=t[o].area)&&(r<a&&(a=r),r>i&&(i=r));return e*=e,(n*=n)?Math.max(e*i*c/n,n/(e*a*c)):1/0}function d(t,e,r,i){var a,o=-1,s=t.length,l=r.x,c=r.y,u=e?n(t.area/e):0;if(e==r.dx){for((i||u>r.dy)&&(u=r.dy);++o<s;)(a=t[o]).x=l,a.y=c,a.dy=u,l+=a.dx=Math.min(r.x+r.dx-l,u?n(a.area/u):0);a.z=!0,a.dx+=r.x+r.dx-l,r.y+=u,r.dy-=u}else{for((i||u>r.dx)&&(u=r.dx);++o<s;)(a=t[o]).x=l,a.y=c,a.dx=u,c+=a.dy=Math.min(r.y+r.dy-c,u?n(a.area/u):0);a.z=!1,a.dy+=r.y+r.dy-c,r.x+=u,r.dx-=u}}function m(t){var n=e||r(t),a=n[0];return a.x=a.y=0,a.value?(a.dx=i[0],a.dy=i[1]):a.dx=a.dy=0,e&&r.revalue(a),u([a],a.dx*a.dy/a.value),(e?h:f)(a),s&&(e=n),n}return m.size=function(t){return arguments.length?(i=t,m):i},m.padding=function(t){if(!arguments.length)return a;function e(e){var r=t.call(m,e,e.depth);return null==r?ho(e):po(e,"number"==typeof r?[r,r,r,r]:r)}function r(e){return po(e,t)}var n;return o=null==(a=t)?ho:"function"==(n=typeof t)?e:"number"===n?(t=[t,t,t,t],r):r,m},m.round=function(t){return arguments.length?(n=t?Math.round:Number,m):n!=Number},m.sticky=function(t){return arguments.length?(s=t,e=null,m):s},m.ratio=function(t){return arguments.length?(c=t,m):c},m.mode=function(t){return arguments.length?(l=t+"",m):l},Ia(m,r)},t.random={normal:function(t,e){var r=arguments.length;return r<2&&(e=1),r<1&&(t=0),function(){var r,n,i;do{i=(r=2*Math.random()-1)*r+(n=2*Math.random()-1)*n}while(!i||i>1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var e=t.random.normal.apply(t,arguments);return function(){return Math.exp(e())}},bates:function(e){var r=t.random.irwinHall(e);return function(){return r()/e}},irwinHall:function(t){return function(){for(var e=0,r=0;r<t;r++)e+=Math.random();return e}}},t.scale={};var bo={floor:L,ceil:L};function _o(e,r,n,i){var a=[],o=[],s=0,l=Math.min(e.length,r.length)-1;for(e[l]<e[0]&&(e=e.slice().reverse(),r=r.slice().reverse());++s<=l;)a.push(n(e[s-1],e[s])),o.push(i(r[s-1],r[s]));return function(r){var n=t.bisect(e,r,1,l)-1;return o[n](a[n](r))}}function wo(e,r){return t.rebind(e,r,"range","rangeRound","interpolate","clamp")}function To(t,e){return yo(t,xo(Mo(t,e)[2])),yo(t,xo(Mo(t,e)[2])),t}function Mo(t,e){null==e&&(e=10);var r=mo(t),n=r[1]-r[0],i=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),a=e/n*i;return a<=.15?i*=10:a<=.35?i*=5:a<=.75&&(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 ko(e,r){return t.range.apply(t,Mo(e,r))}function Ao(e,r,n){var i=Mo(e,r);if(n){var a=Ce.exec(n);if(a.shift(),"s"===a[8]){var o=t.formatPrefix(Math.max(y(i[0]),y(i[1])));return a[7]||(a[7]="."+Eo(o.scale(i[2]))),a[8]="f",n=t.format(a.join("")),function(t){return n(o.scale(t))+o.symbol}}a[7]||(a[7]="."+function(t,e){var r=Eo(e[2]);return t in So?Math.abs(r-Eo(Math.max(y(e[0]),y(e[1]))))+ +("e"!==t):r-2*("%"===t)}(a[8],i)),n=a.join("")}else n=",."+Eo(i[2])+"f";return t.format(n)}t.scale.linear=function(){return function t(e,r,n,i){var a,o;function s(){var t=Math.min(e.length,r.length)>2?_o:vo,s=i?wa:_a;return a=t(e,r,s,n),o=t(r,e,s,Qi),l}function l(t){return a(t)}return l.invert=function(t){return o(t)},l.domain=function(t){return arguments.length?(e=t.map(Number),s()):e},l.range=function(t){return arguments.length?(r=t,s()):r},l.rangeRound=function(t){return l.range(t).interpolate(da)},l.clamp=function(t){return arguments.length?(i=t,s()):i},l.interpolate=function(t){return arguments.length?(n=t,s()):n},l.ticks=function(t){return ko(e,t)},l.tickFormat=function(t,r){return Ao(e,t,r)},l.nice=function(t){return To(e,t),s()},l.copy=function(){return t(e,r,n,i)},s()}([0,1],[0,1],Qi,!1)};var So={s:1,g:1,p:1,r:1,e:1};function Eo(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}t.scale.log=function(){return function e(r,n,i,a){function o(t){return(i?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(n)}function s(t){return i?Math.pow(n,t):-Math.pow(n,-t)}function l(t){return r(o(t))}return l.invert=function(t){return s(r.invert(t))},l.domain=function(t){return arguments.length?(i=t[0]>=0,r.domain((a=t.map(Number)).map(o)),l):a},l.base=function(t){return arguments.length?(n=+t,r.domain(a.map(o)),l):n},l.nice=function(){var t=yo(a.map(o),i?Math:Lo);return r.domain(t),a=t.map(s),l},l.ticks=function(){var t=mo(a),e=[],r=t[0],l=t[1],c=Math.floor(o(r)),u=Math.ceil(o(l)),f=n%1?2:n;if(isFinite(u-c)){if(i){for(;c<u;c++)for(var h=1;h<f;h++)e.push(s(c)*h);e.push(s(c))}else for(e.push(s(c));c++<u;)for(h=f-1;h>0;h--)e.push(s(c)*h);for(c=0;e[c]<r;c++);for(u=e.length;e[u-1]>l;u--);e=e.slice(c,u)}return e},l.tickFormat=function(e,r){if(!arguments.length)return Co;arguments.length<2?r=Co:"function"!=typeof r&&(r=t.format(r));var i=Math.max(1,n*e/l.ticks().length);return function(t){var e=t/s(Math.round(o(t)));return e*n<n-.5&&(e*=n),e<=i?r(t):""}},l.copy=function(){return e(r.copy(),n,i,a)},wo(l,r)}(t.scale.linear().domain([0,1]),10,!0,[1,10])};var Co=t.format(".0e"),Lo={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};function Po(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}t.scale.pow=function(){return function t(e,r,n){var i=Po(r),a=Po(1/r);function o(t){return e(i(t))}return o.invert=function(t){return a(e.invert(t))},o.domain=function(t){return arguments.length?(e.domain((n=t.map(Number)).map(i)),o):n},o.ticks=function(t){return ko(n,t)},o.tickFormat=function(t,e){return Ao(n,t,e)},o.nice=function(t){return o.domain(To(n,t))},o.exponent=function(t){return arguments.length?(i=Po(r=t),a=Po(1/r),e.domain(n.map(i)),o):r},o.copy=function(){return t(e.copy(),r,n)},wo(o,e)}(t.scale.linear(),1,[0,1])},t.scale.sqrt=function(){return t.scale.pow().exponent(.5)},t.scale.ordinal=function(){return function e(r,n){var i,a,o;function s(t){return a[((i.get(t)||("range"===n.t?i.set(t,r.push(t)):NaN))-1)%a.length]}function l(e,n){return t.range(r.length).map((function(t){return e+n*t}))}return s.domain=function(t){if(!arguments.length)return r;r=[],i=new _;for(var e,a=-1,o=t.length;++a<o;)i.has(e=t[a])||i.set(e,r.push(e));return s[n.t].apply(s,n.a)},s.range=function(t){return arguments.length?(a=t,o=0,n={t:"range",a:arguments},s):a},s.rangePoints=function(t,e){arguments.length<2&&(e=0);var i=t[0],c=t[1],u=r.length<2?(i=(i+c)/2,0):(c-i)/(r.length-1+e);return a=l(i+u*e/2,u),o=0,n={t:"rangePoints",a:arguments},s},s.rangeRoundPoints=function(t,e){arguments.length<2&&(e=0);var i=t[0],c=t[1],u=r.length<2?(i=c=Math.round((i+c)/2),0):(c-i)/(r.length-1+e)|0;return a=l(i+Math.round(u*e/2+(c-i-(r.length-1+e)*u)/2),u),o=0,n={t:"rangeRoundPoints",a:arguments},s},s.rangeBands=function(t,e,i){arguments.length<2&&(e=0),arguments.length<3&&(i=e);var c=t[1]<t[0],u=t[c-0],f=t[1-c],h=(f-u)/(r.length-e+2*i);return a=l(u+h*i,h),c&&a.reverse(),o=h*(1-e),n={t:"rangeBands",a:arguments},s},s.rangeRoundBands=function(t,e,i){arguments.length<2&&(e=0),arguments.length<3&&(i=e);var c=t[1]<t[0],u=t[c-0],f=t[1-c],h=Math.floor((f-u)/(r.length-e+2*i));return a=l(u+Math.round((f-u-(r.length-e)*h)/2),h),c&&a.reverse(),o=Math.round(h*(1-e)),n={t:"rangeRoundBands",a:arguments},s},s.rangeBand=function(){return o},s.rangeExtent=function(){return mo(n.a[0])},s.copy=function(){return e(r,n)},s.domain(r)}([],{t:"range",a:[[]]})},t.scale.category10=function(){return t.scale.ordinal().range(Io)},t.scale.category20=function(){return t.scale.ordinal().range(Oo)},t.scale.category20b=function(){return t.scale.ordinal().range(zo)},t.scale.category20c=function(){return t.scale.ordinal().range(Do)};var Io=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(ae),Oo=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(ae),zo=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(ae),Do=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(ae);function No(){return 0}t.scale.quantile=function(){return function e(r,n){var i;function a(){var e=0,a=n.length;for(i=[];++e<a;)i[e-1]=t.quantile(r,e/a);return o}function o(e){if(!isNaN(e=+e))return n[t.bisect(i,e)]}return o.domain=function(t){return arguments.length?(r=t.map(p).filter(d).sort(h),a()):r},o.range=function(t){return arguments.length?(n=t,a()):n},o.quantiles=function(){return i},o.invertExtent=function(t){return(t=n.indexOf(t))<0?[NaN,NaN]:[t>0?i[t-1]:r[0],t<i.length?i[t]:r[r.length-1]]},o.copy=function(){return e(r,n)},a()}([],[])},t.scale.quantize=function(){return function t(e,r,n){var i,a;function o(t){return n[Math.max(0,Math.min(a,Math.floor(i*(t-e))))]}function s(){return i=n.length/(r-e),a=n.length-1,o}return o.domain=function(t){return arguments.length?(e=+t[0],r=+t[t.length-1],s()):[e,r]},o.range=function(t){return arguments.length?(n=t,s()):n},o.invertExtent=function(t){return[t=(t=n.indexOf(t))<0?NaN:t/i+e,t+1/i]},o.copy=function(){return t(e,r,n)},s()}(0,1,[0,1])},t.scale.threshold=function(){return function e(r,n){function i(e){if(e<=e)return n[t.bisect(r,e)]}return i.domain=function(t){return arguments.length?(r=t,i):r},i.range=function(t){return arguments.length?(n=t,i):n},i.invertExtent=function(t){return t=n.indexOf(t),[r[t-1],r[t]]},i.copy=function(){return e(r,n)},i}([.5],[0,1])},t.scale.identity=function(){return function t(e){function r(t){return+t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(e=t.map(r),r):e},r.ticks=function(t){return ko(e,t)},r.tickFormat=function(t,r){return Ao(e,t,r)},r.copy=function(){return t(e)},r}([0,1])},t.svg={},t.svg.arc=function(){var t=Fo,e=Bo,r=No,n=Ro,i=jo,a=Uo,o=Vo;function s(){var s=Math.max(0,+t.apply(this,arguments)),c=Math.max(0,+e.apply(this,arguments)),u=i.apply(this,arguments)-Ct,f=a.apply(this,arguments)-Ct,h=Math.abs(f-u),p=u>f?0:1;if(c<s&&(d=c,c=s,s=d),h>=Et)return l(c,p)+(s?l(s,1-p):"")+"Z";var d,m,g,v,y,x,b,_,w,T,M,k,A=0,S=0,E=[];if((v=(+o.apply(this,arguments)||0)/2)&&(g=n===Ro?Math.sqrt(s*s+c*c):+n.apply(this,arguments),p||(S*=-1),c&&(S=Dt(g/c*Math.sin(v))),s&&(A=Dt(g/s*Math.sin(v)))),c){y=c*Math.cos(u+S),x=c*Math.sin(u+S),b=c*Math.cos(f-S),_=c*Math.sin(f-S);var C=Math.abs(f-u-2*S)<=At?0:1;if(S&&qo(y,x,b,_)===p^C){var L=(u+f)/2;y=c*Math.cos(L),x=c*Math.sin(L),b=_=null}}else y=x=0;if(s){w=s*Math.cos(f-A),T=s*Math.sin(f-A),M=s*Math.cos(u+A),k=s*Math.sin(u+A);var P=Math.abs(u-f+2*A)<=At?0:1;if(A&&qo(w,T,M,k)===1-p^P){var I=(u+f)/2;w=s*Math.cos(I),T=s*Math.sin(I),M=k=null}}else w=T=0;if(h>Mt&&(d=Math.min(Math.abs(c-s)/2,+r.apply(this,arguments)))>.001){m=s<c^p?0:1;var O=d,z=d;if(h<At){var D=null==M?[w,T]:null==b?[y,x]:li([y,x],[M,k],[b,_],[w,T]),N=y-D[0],R=x-D[1],F=b-D[0],B=_-D[1],j=1/Math.sin(Math.acos((N*F+R*B)/(Math.sqrt(N*N+R*R)*Math.sqrt(F*F+B*B)))/2),U=Math.sqrt(D[0]*D[0]+D[1]*D[1]);z=Math.min(d,(s-U)/(j-1)),O=Math.min(d,(c-U)/(j+1))}if(null!=b){var V=Ho(null==M?[w,T]:[M,k],[y,x],c,O,p),q=Ho([b,_],[w,T],c,O,p);d===O?E.push("M",V[0],"A",O,",",O," 0 0,",m," ",V[1],"A",c,",",c," 0 ",1-p^qo(V[1][0],V[1][1],q[1][0],q[1][1]),",",p," ",q[1],"A",O,",",O," 0 0,",m," ",q[0]):E.push("M",V[0],"A",O,",",O," 0 1,",m," ",q[0])}else E.push("M",y,",",x);if(null!=M){var H=Ho([y,x],[M,k],s,-z,p),G=Ho([w,T],null==b?[y,x]:[b,_],s,-z,p);d===z?E.push("L",G[0],"A",z,",",z," 0 0,",m," ",G[1],"A",s,",",s," 0 ",p^qo(G[1][0],G[1][1],H[1][0],H[1][1]),",",1-p," ",H[1],"A",z,",",z," 0 0,",m," ",H[0]):E.push("L",G[0],"A",z,",",z," 0 0,",m," ",H[0])}else E.push("L",w,",",T)}else E.push("M",y,",",x),null!=b&&E.push("A",c,",",c," 0 ",C,",",p," ",b,",",_),E.push("L",w,",",T),null!=M&&E.push("A",s,",",s," 0 ",P,",",1-p," ",M,",",k);return E.push("Z"),E.join("")}function l(t,e){return"M0,"+t+"A"+t+","+t+" 0 1,"+e+" 0,"+-t+"A"+t+","+t+" 0 1,"+e+" 0,"+t}return s.innerRadius=function(e){return arguments.length?(t=de(e),s):t},s.outerRadius=function(t){return arguments.length?(e=de(t),s):e},s.cornerRadius=function(t){return arguments.length?(r=de(t),s):r},s.padRadius=function(t){return arguments.length?(n=t==Ro?Ro:de(t),s):n},s.startAngle=function(t){return arguments.length?(i=de(t),s):i},s.endAngle=function(t){return arguments.length?(a=de(t),s):a},s.padAngle=function(t){return arguments.length?(o=de(t),s):o},s.centroid=function(){var r=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,n=(+i.apply(this,arguments)+ +a.apply(this,arguments))/2-Ct;return[Math.cos(n)*r,Math.sin(n)*r]},s};var Ro="auto";function Fo(t){return t.innerRadius}function Bo(t){return t.outerRadius}function jo(t){return t.startAngle}function Uo(t){return t.endAngle}function Vo(t){return t&&t.padAngle}function qo(t,e,r,n){return(t-r)*e-(e-n)*t>0?0:1}function Ho(t,e,r,n,i){var a=t[0]-e[0],o=t[1]-e[1],s=(i?n:-n)/Math.sqrt(a*a+o*o),l=s*o,c=-s*a,u=t[0]+l,f=t[1]+c,h=e[0]+l,p=e[1]+c,d=(u+h)/2,m=(f+p)/2,g=h-u,v=p-f,y=g*g+v*v,x=r-n,b=u*p-h*f,_=(v<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*v-g*_)/y,T=(-b*g-v*_)/y,M=(b*v+g*_)/y,k=(-b*g+v*_)/y,A=w-d,S=T-m,E=M-d,C=k-m;return A*A+S*S>E*E+C*C&&(w=M,T=k),[[w-l,T-c],[w*r/x,T*r/x]]}function Go(t){var e=ri,r=ni,n=Yr,i=Wo,a=i.key,o=.7;function s(a){var s,l=[],c=[],u=-1,f=a.length,h=de(e),p=de(r);function d(){l.push("M",i(t(c),o))}for(;++u<f;)n.call(this,s=a[u],u)?c.push([+h.call(this,s,u),+p.call(this,s,u)]):c.length&&(d(),c=[]);return c.length&&d(),l.length?l.join(""):null}return s.x=function(t){return arguments.length?(e=t,s):e},s.y=function(t){return arguments.length?(r=t,s):r},s.defined=function(t){return arguments.length?(n=t,s):n},s.interpolate=function(t){return arguments.length?(a="function"==typeof t?i=t:(i=Yo.get(t)||Wo).key,s):a},s.tension=function(t){return arguments.length?(o=t,s):o},s}t.svg.line=function(){return Go(L)};var Yo=t.map({linear:Wo,"linear-closed":Zo,step:function(t){var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];for(;++e<r;)i.push("H",(n[0]+(n=t[e])[0])/2,"V",n[1]);r>1&&i.push("H",n[0]);return i.join("")},"step-before":Xo,"step-after":Jo,basis:Qo,"basis-open":function(t){if(t.length<4)return Wo(t);var e,r=[],n=-1,i=t.length,a=[0],o=[0];for(;++n<3;)e=t[n],a.push(e[0]),o.push(e[1]);r.push(ts(ns,a)+","+ts(ns,o)),--n;for(;++n<i;)e=t[n],a.shift(),a.push(e[0]),o.shift(),o.push(e[1]),is(r,a,o);return r.join("")},"basis-closed":function(t){var e,r,n=-1,i=t.length,a=i+4,o=[],s=[];for(;++n<4;)r=t[n%i],o.push(r[0]),s.push(r[1]);e=[ts(ns,o),",",ts(ns,s)],--n;for(;++n<a;)r=t[n%i],o.shift(),o.push(r[0]),s.shift(),s.push(r[1]),is(e,o,s);return e.join("")},bundle:function(t,e){var r=t.length-1;if(r)for(var n,i,a=t[0][0],o=t[0][1],s=t[r][0]-a,l=t[r][1]-o,c=-1;++c<=r;)n=t[c],i=c/r,n[0]=e*n[0]+(1-e)*(a+i*s),n[1]=e*n[1]+(1-e)*(o+i*l);return Qo(t)},cardinal:function(t,e){return t.length<3?Wo(t):t[0]+Ko(t,$o(t,e))},"cardinal-open":function(t,e){return t.length<4?Wo(t):t[1]+Ko(t.slice(1,-1),$o(t,e))},"cardinal-closed":function(t,e){return t.length<3?Zo(t):t[0]+Ko((t.push(t[0]),t),$o([t[t.length-2]].concat(t,[t[1]]),e))},monotone:function(t){return t.length<3?Wo(t):t[0]+Ko(t,function(t){var e,r,n,i,a=[],o=function(t){var e=0,r=t.length-1,n=[],i=t[0],a=t[1],o=n[0]=as(i,a);for(;++e<r;)n[e]=(o+(o=as(i=a,a=t[e+1])))/2;return n[e]=o,n}(t),s=-1,l=t.length-1;for(;++s<l;)e=as(t[s],t[s+1]),y(e)<Mt?o[s]=o[s+1]=0:(r=o[s]/e,n=o[s+1]/e,(i=r*r+n*n)>9&&(i=3*e/Math.sqrt(i),o[s]=i*r,o[s+1]=i*n));s=-1;for(;++s<=l;)i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),a.push([i||0,o[s]*i||0]);return a}(t))}});function Wo(t){return t.length>1?t.join("L"):t+"Z"}function Zo(t){return t.join("L")+"Z"}function Xo(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 Jo(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 Ko(t,e){if(e.length<1||t.length!=e.length&&t.length!=e.length+2)return Wo(t);var r=t.length!=e.length,n="",i=t[0],a=t[1],o=e[0],s=o,l=1;if(r&&(n+="Q"+(a[0]-2*o[0]/3)+","+(a[1]-2*o[1]/3)+","+a[0]+","+a[1],i=t[1],l=2),e.length>1){s=e[1],a=t[l],l++,n+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var c=2;c<e.length;c++,l++)a=t[l],s=e[c],n+="S"+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1]}if(r){var u=t[l];n+="Q"+(a[0]+2*s[0]/3)+","+(a[1]+2*s[1]/3)+","+u[0]+","+u[1]}return n}function $o(t,e){for(var r,n=[],i=(1-e)/2,a=t[0],o=t[1],s=1,l=t.length;++s<l;)r=a,a=o,o=t[s],n.push([i*(o[0]-r[0]),i*(o[1]-r[1])]);return n}function Qo(t){if(t.length<3)return Wo(t);var e=1,r=t.length,n=t[0],i=n[0],a=n[1],o=[i,i,i,(n=t[1])[0]],s=[a,a,a,n[1]],l=[i,",",a,"L",ts(ns,o),",",ts(ns,s)];for(t.push(t[r-1]);++e<=r;)n=t[e],o.shift(),o.push(n[0]),s.shift(),s.push(n[1]),is(l,o,s);return t.pop(),l.push("L",n),l.join("")}function ts(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}Yo.forEach((function(t,e){e.key=t,e.closed=/-closed$/.test(t)}));var es=[0,2/3,1/3,0],rs=[0,1/3,2/3,0],ns=[0,1/6,2/3,1/6];function is(t,e,r){t.push("C",ts(es,e),",",ts(es,r),",",ts(rs,e),",",ts(rs,r),",",ts(ns,e),",",ts(ns,r))}function as(t,e){return(e[1]-t[1])/(e[0]-t[0])}function os(t){for(var e,r,n,i=-1,a=t.length;++i<a;)r=(e=t[i])[0],n=e[1]-Ct,e[0]=r*Math.cos(n),e[1]=r*Math.sin(n);return t}function ss(t){var e=ri,r=ri,n=0,i=ni,a=Yr,o=Wo,s=o.key,l=o,c="L",u=.7;function f(s){var f,h,p,d=[],m=[],g=[],v=-1,y=s.length,x=de(e),b=de(n),_=e===r?function(){return h}:de(r),w=n===i?function(){return p}:de(i);function T(){d.push("M",o(t(g),u),c,l(t(m.reverse()),u),"Z")}for(;++v<y;)a.call(this,f=s[v],v)?(m.push([h=+x.call(this,f,v),p=+b.call(this,f,v)]),g.push([+_.call(this,f,v),+w.call(this,f,v)])):m.length&&(T(),m=[],g=[]);return m.length&&T(),d.length?d.join(""):null}return f.x=function(t){return arguments.length?(e=r=t,f):r},f.x0=function(t){return arguments.length?(e=t,f):e},f.x1=function(t){return arguments.length?(r=t,f):r},f.y=function(t){return arguments.length?(n=i=t,f):i},f.y0=function(t){return arguments.length?(n=t,f):n},f.y1=function(t){return arguments.length?(i=t,f):i},f.defined=function(t){return arguments.length?(a=t,f):a},f.interpolate=function(t){return arguments.length?(s="function"==typeof t?o=t:(o=Yo.get(t)||Wo).key,l=o.reverse||o,c=o.closed?"M":"L",f):s},f.tension=function(t){return arguments.length?(u=t,f):u},f}function ls(t){return t.radius}function cs(t){return[t.x,t.y]}function us(t){return function(){var e=t.apply(this,arguments),r=e[0],n=e[1]-Ct;return[r*Math.cos(n),r*Math.sin(n)]}}function fs(){return 64}function hs(){return"circle"}function ps(t){var e=Math.sqrt(t/At);return"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+-e+"A"+e+","+e+" 0 1,1 0,"+e+"Z"}t.svg.line.radial=function(){var t=Go(os);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},Xo.reverse=Jo,Jo.reverse=Xo,t.svg.area=function(){return ss(L)},t.svg.area.radial=function(){var t=ss(os);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},t.svg.chord=function(){var t=Vn,e=qn,r=ls,n=jo,i=Uo;function a(r,n){var i,a,c=o(this,t,r,n),u=o(this,e,r,n);return"M"+c.p0+s(c.r,c.p1,c.a1-c.a0)+(a=u,((i=c).a0==a.a0&&i.a1==a.a1?l(c.r,c.p1,c.r,c.p0):l(c.r,c.p1,u.r,u.p0)+s(u.r,u.p1,u.a1-u.a0)+l(u.r,u.p1,c.r,c.p0))+"Z")}function o(t,e,a,o){var s=e.call(t,a,o),l=r.call(t,s,o),c=n.call(t,s,o)-Ct,u=i.call(t,s,o)-Ct;return{r:l,a0:c,a1:u,p0:[l*Math.cos(c),l*Math.sin(c)],p1:[l*Math.cos(u),l*Math.sin(u)]}}function s(t,e,r){return"A"+t+","+t+" 0 "+ +(r>At)+",1 "+e}function l(t,e,r,n){return"Q 0,0 "+n}return a.radius=function(t){return arguments.length?(r=de(t),a):r},a.source=function(e){return arguments.length?(t=de(e),a):t},a.target=function(t){return arguments.length?(e=de(t),a):e},a.startAngle=function(t){return arguments.length?(n=de(t),a):n},a.endAngle=function(t){return arguments.length?(i=de(t),a):i},a},t.svg.diagonal=function(){var t=Vn,e=qn,r=cs;function n(n,i){var a=t.call(this,n,i),o=e.call(this,n,i),s=(a.y+o.y)/2,l=[a,{x:a.x,y:s},{x:o.x,y:s},o];return"M"+(l=l.map(r))[0]+"C"+l[1]+" "+l[2]+" "+l[3]}return n.source=function(e){return arguments.length?(t=de(e),n):t},n.target=function(t){return arguments.length?(e=de(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},t.svg.diagonal.radial=function(){var e=t.svg.diagonal(),r=cs,n=e.projection;return e.projection=function(t){return arguments.length?n(us(r=t)):r},e},t.svg.symbol=function(){var t=hs,e=fs;function r(r,n){return(ds.get(t.call(this,r,n))||ps)(e.call(this,r,n))}return r.type=function(e){return arguments.length?(t=de(e),r):t},r.size=function(t){return arguments.length?(e=de(t),r):e},r};var ds=t.map({circle:ps,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*gs)),r=e*gs;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/ms),r=e*ms/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/ms),r=e*ms/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});t.svg.symbolTypes=ds.keys();var ms=Math.sqrt(3),gs=Math.tan(30*Lt);Y.transition=function(t){for(var e,r,n=bs||++Ts,i=As(t),a=[],o=_s||{time:Date.now(),ease:ca,delay:0,duration:250},s=-1,l=this.length;++s<l;){a.push(e=[]);for(var c=this[s],u=-1,f=c.length;++u<f;)(r=c[u])&&Ss(r,u,i,n,o),e.push(r)}return xs(a,i,n)},Y.interrupt=function(t){return this.each(null==t?vs:ys(As(t)))};var vs=ys(As());function ys(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 xs(t,e,r){return U(t,ws),t.namespace=e,t.id=r,t}var bs,_s,ws=[],Ts=0;function Ms(t,e,r,n){var i=t.id,a=t.namespace;return ut(t,"function"==typeof r?function(t,o,s){t[a][i].tween.set(e,n(r.call(t,t.__data__,o,s)))}:(r=n(r),function(t){t[a][i].tween.set(e,r)}))}function ks(t){return null==t&&(t=""),function(){this.textContent=t}}function As(t){return null==t?"__transition__":"__transition_"+t+"__"}function Ss(t,e,r,n,i){var a,o,s,l,c,u=t[r]||(t[r]={active:0,count:0}),f=u[n];function h(r){var i=u.active,h=u[i];for(var d in h&&(h.timer.c=null,h.timer.t=NaN,--u.count,delete u[i],h.event&&h.event.interrupt.call(t,t.__data__,h.index)),u)if(+d<n){var m=u[d];m.timer.c=null,m.timer.t=NaN,--u.count,delete u[d]}o.c=p,we((function(){return o.c&&p(r||1)&&(o.c=null,o.t=NaN),1}),0,a),u.active=n,f.event&&f.event.start.call(t,t.__data__,e),c=[],f.tween.forEach((function(r,n){(n=n.call(t,t.__data__,e))&&c.push(n)})),l=f.ease,s=f.duration}function p(i){for(var a=i/s,o=l(a),h=c.length;h>0;)c[--h].call(t,o);if(a>=1)return f.event&&f.event.end.call(t,t.__data__,e),--u.count?delete u[n]:delete t[r],1}f||(a=i.time,o=we((function(t){var e=f.delay;if(o.t=e+a,e<=t)return h(t-e);o.c=h}),0,a),f=u[n]={tween:new _,time:a,timer:o,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++u.count)}ws.call=Y.call,ws.empty=Y.empty,ws.node=Y.node,ws.size=Y.size,t.transition=function(e,r){return e&&e.transition?bs?e.transition(r):e:t.selection().transition(e)},t.transition.prototype=ws,ws.select=function(t){var e,r,n,i=this.id,a=this.namespace,o=[];t=W(t);for(var s=-1,l=this.length;++s<l;){o.push(e=[]);for(var c=this[s],u=-1,f=c.length;++u<f;)(n=c[u])&&(r=t.call(n,n.__data__,u,s))?("__data__"in n&&(r.__data__=n.__data__),Ss(r,u,a,i,n[a][i]),e.push(r)):e.push(null)}return xs(o,a,i)},ws.selectAll=function(t){var e,r,n,i,a,o=this.id,s=this.namespace,l=[];t=Z(t);for(var c=-1,u=this.length;++c<u;)for(var f=this[c],h=-1,p=f.length;++h<p;)if(n=f[h]){a=n[s][o],r=t.call(n,n.__data__,h,c),l.push(e=[]);for(var d=-1,m=r.length;++d<m;)(i=r[d])&&Ss(i,d,s,o,a),e.push(i)}return xs(l,s,o)},ws.filter=function(t){var e,r,n=[];"function"!=typeof t&&(t=lt(t));for(var i=0,a=this.length;i<a;i++){n.push(e=[]);for(var o,s=0,l=(o=this[i]).length;s<l;s++)(r=o[s])&&t.call(r,r.__data__,s,i)&&e.push(r)}return xs(n,this.namespace,this.id)},ws.tween=function(t,e){var r=this.id,n=this.namespace;return arguments.length<2?this.node()[n][r].tween.get(t):ut(this,null==e?function(e){e[n][r].tween.remove(t)}:function(i){i[n][r].tween.set(t,e)})},ws.attr=function(e,r){if(arguments.length<2){for(r in e)this.attr(r,e[r]);return this}var n="transform"==e?ba:Qi,i=t.ns.qualify(e);function a(){this.removeAttribute(i)}function o(){this.removeAttributeNS(i.space,i.local)}function s(t){return null==t?a:(t+="",function(){var e,r=this.getAttribute(i);return r!==t&&(e=n(r,t),function(t){this.setAttribute(i,e(t))})})}function l(t){return null==t?o:(t+="",function(){var e,r=this.getAttributeNS(i.space,i.local);return r!==t&&(e=n(r,t),function(t){this.setAttributeNS(i.space,i.local,e(t))})})}return Ms(this,"attr."+e,r,i.local?l:s)},ws.attrTween=function(e,r){var n=t.ns.qualify(e);return this.tween("attr."+e,n.local?function(t,e){var i=r.call(this,t,e,this.getAttributeNS(n.space,n.local));return i&&function(t){this.setAttributeNS(n.space,n.local,i(t))}}:function(t,e){var i=r.call(this,t,e,this.getAttribute(n));return i&&function(t){this.setAttribute(n,i(t))}})},ws.style=function(t,e,r){var n=arguments.length;if(n<3){if("string"!=typeof t){for(r in n<2&&(e=""),t)this.style(r,t[r],e);return this}r=""}function i(){this.style.removeProperty(t)}function a(e){return null==e?i:(e+="",function(){var n,i=o(this).getComputedStyle(this,null).getPropertyValue(t);return i!==e&&(n=Qi(i,e),function(e){this.style.setProperty(t,n(e),r)})})}return Ms(this,"style."+t,e,a)},ws.styleTween=function(t,e,r){function n(n,i){var a=e.call(this,n,i,o(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,n)},ws.text=function(t){return Ms(this,"text",t,ks)},ws.remove=function(){var t=this.namespace;return this.each("end.transition",(function(){var e;this[t].count<2&&(e=this.parentNode)&&e.removeChild(this)}))},ws.ease=function(e){var r=this.id,n=this.namespace;return arguments.length<1?this.node()[n][r].ease:("function"!=typeof e&&(e=t.ease.apply(t,arguments)),ut(this,(function(t){t[n][r].ease=e})))},ws.delay=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].delay:ut(this,"function"==typeof t?function(n,i,a){n[r][e].delay=+t.call(n,n.__data__,i,a)}:(t=+t,function(n){n[r][e].delay=t}))},ws.duration=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].duration:ut(this,"function"==typeof t?function(n,i,a){n[r][e].duration=Math.max(1,t.call(n,n.__data__,i,a))}:(t=Math.max(1,t),function(n){n[r][e].duration=t}))},ws.each=function(e,r){var n=this.id,i=this.namespace;if(arguments.length<2){var a=_s,o=bs;try{bs=n,ut(this,(function(t,r,a){_s=t[i][n],e.call(t,t.__data__,r,a)}))}finally{_s=a,bs=o}}else ut(this,(function(a){var o=a[i][n];(o.event||(o.event=t.dispatch("start","end","interrupt"))).on(e,r)}));return this},ws.transition=function(){for(var t,e,r,n=this.id,i=++Ts,a=this.namespace,o=[],s=0,l=this.length;s<l;s++){o.push(t=[]);for(var c,u=0,f=(c=this[s]).length;u<f;u++)(e=c[u])&&Ss(e,u,a,i,{time:(r=e[a][n]).time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration}),t.push(e)}return xs(o,a,i)},t.svg.axis=function(){var e,r=t.scale.linear(),i=Es,a=6,o=6,s=3,l=[10],c=null;function u(n){n.each((function(){var n,u=t.select(this),f=this.__chart__||r,h=this.__chart__=r.copy(),p=null==c?h.ticks?h.ticks.apply(h,l):h.domain():c,d=null==e?h.tickFormat?h.tickFormat.apply(h,l):L:e,m=u.selectAll(".tick").data(p,h),g=m.enter().insert("g",".domain").attr("class","tick").style("opacity",Mt),v=t.transition(m.exit()).style("opacity",Mt).remove(),y=t.transition(m.order()).style("opacity",1),x=Math.max(a,0)+s,b=go(h),_=u.selectAll(".domain").data([0]),w=(_.enter().append("path").attr("class","domain"),t.transition(_));g.append("line"),g.append("text");var T,M,k,A,S=g.select("line"),E=y.select("line"),C=m.select("text").text(d),P=g.select("text"),I=y.select("text"),O="top"===i||"left"===i?-1:1;if("bottom"===i||"top"===i?(n=Ls,T="x",k="y",M="x2",A="y2",C.attr("dy",O<0?"0em":".71em").style("text-anchor","middle"),w.attr("d","M"+b[0]+","+O*o+"V0H"+b[1]+"V"+O*o)):(n=Ps,T="y",k="x",M="y2",A="x2",C.attr("dy",".32em").style("text-anchor",O<0?"end":"start"),w.attr("d","M"+O*o+","+b[0]+"H0V"+b[1]+"H"+O*o)),S.attr(A,O*a),P.attr(k,O*x),E.attr(M,0).attr(A,O*a),I.attr(T,0).attr(k,O*x),h.rangeBand){var z=h,D=z.rangeBand()/2;f=h=function(t){return z(t)+D}}else f.rangeBand?f=h:v.call(n,h,f);g.call(n,f,h),y.call(n,h,h)}))}return u.scale=function(t){return arguments.length?(r=t,u):r},u.orient=function(t){return arguments.length?(i=t in Cs?t+"":Es,u):i},u.ticks=function(){return arguments.length?(l=n(arguments),u):l},u.tickValues=function(t){return arguments.length?(c=t,u):c},u.tickFormat=function(t){return arguments.length?(e=t,u):e},u.tickSize=function(t){var e=arguments.length;return e?(a=+t,o=+arguments[e-1],u):a},u.innerTickSize=function(t){return arguments.length?(a=+t,u):a},u.outerTickSize=function(t){return arguments.length?(o=+t,u):o},u.tickPadding=function(t){return arguments.length?(s=+t,u):s},u.tickSubdivide=function(){return arguments.length&&u},u};var Es="bottom",Cs={top:1,right:1,bottom:1,left:1};function Ls(t,e,r){t.attr("transform",(function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"}))}function Ps(t,e,r){t.attr("transform",(function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"}))}t.svg.brush=function(){var e,r,n=B(h,"brushstart","brush","brushend"),i=null,a=null,s=[0,0],l=[0,0],c=!0,u=!0,f=Os[0];function h(e){e.each((function(){var e=t.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",g).on("touchstart.brush",g),r=e.selectAll(".background").data([0]);r.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),e.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var n=e.selectAll(".resize").data(f,L);n.exit().remove(),n.enter().append("g").attr("class",(function(t){return"resize "+t})).style("cursor",(function(t){return Is[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"),n.style("display",h.empty()?"none":null);var o,s=t.transition(e),l=t.transition(r);i&&(o=go(i),l.attr("x",o[0]).attr("width",o[1]-o[0]),d(s)),a&&(o=go(a),l.attr("y",o[0]).attr("height",o[1]-o[0]),m(s)),p(s)}))}function p(t){t.selectAll(".resize").attr("transform",(function(t){return"translate("+s[+/e$/.test(t)]+","+l[+/^s/.test(t)]+")"}))}function d(t){t.select(".extent").attr("x",s[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",s[1]-s[0])}function m(t){t.select(".extent").attr("y",l[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",l[1]-l[0])}function g(){var f,g,v=this,y=t.select(t.event.target),x=n.of(v,arguments),b=t.select(v),_=y.datum(),w=!/^(n|s)$/.test(_)&&i,T=!/^(e|w)$/.test(_)&&a,M=y.classed("extent"),k=bt(v),A=t.mouse(v),S=t.select(o(v)).on("keydown.brush",L).on("keyup.brush",P);if(t.event.changedTouches?S.on("touchmove.brush",I).on("touchend.brush",z):S.on("mousemove.brush",I).on("mouseup.brush",z),b.interrupt().selectAll("*").interrupt(),M)A[0]=s[0]-A[0],A[1]=l[0]-A[1];else if(_){var E=+/w$/.test(_),C=+/^n/.test(_);g=[s[1-E]-A[0],l[1-C]-A[1]],A[0]=s[E],A[1]=l[C]}else t.event.altKey&&(f=A.slice());function L(){32==t.event.keyCode&&(M||(f=null,A[0]-=s[1],A[1]-=l[1],M=2),R())}function P(){32==t.event.keyCode&&2==M&&(A[0]+=s[1],A[1]+=l[1],M=0,R())}function I(){var e=t.mouse(v),r=!1;g&&(e[0]+=g[0],e[1]+=g[1]),M||(t.event.altKey?(f||(f=[(s[0]+s[1])/2,(l[0]+l[1])/2]),A[0]=s[+(e[0]<f[0])],A[1]=l[+(e[1]<f[1])]):f=null),w&&O(e,i,0)&&(d(b),r=!0),T&&O(e,a,1)&&(m(b),r=!0),r&&(p(b),x({type:"brush",mode:M?"move":"resize"}))}function O(t,n,i){var a,o,h=go(n),p=h[0],d=h[1],m=A[i],g=i?l:s,v=g[1]-g[0];if(M&&(p-=m,d-=v+m),a=(i?u:c)?Math.max(p,Math.min(d,t[i])):t[i],M?o=(a+=m)+v:(f&&(m=Math.max(p,Math.min(d,2*f[i]-a))),m<a?(o=a,a=m):o=m),g[0]!=a||g[1]!=o)return i?r=null:e=null,g[0]=a,g[1]=o,!0}function z(){I(),b.style("pointer-events","all").selectAll(".resize").style("display",h.empty()?"none":null),t.select("body").style("cursor",null),S.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),k(),x({type:"brushend"})}b.style("pointer-events","none").selectAll(".resize").style("display",null),t.select("body").style("cursor",y.style("cursor")),x({type:"brushstart"}),I()}return h.event=function(i){i.each((function(){var i=n.of(this,arguments),a={x:s,y:l,i:e,j:r},o=this.__chart__||a;this.__chart__=a,bs?t.select(this).transition().each("start.brush",(function(){e=o.i,r=o.j,s=o.x,l=o.y,i({type:"brushstart"})})).tween("brush:brush",(function(){var t=ta(s,a.x),n=ta(l,a.y);return e=r=null,function(e){s=a.x=t(e),l=a.y=n(e),i({type:"brush",mode:"resize"})}})).each("end.brush",(function(){e=a.i,r=a.j,i({type:"brush",mode:"resize"}),i({type:"brushend"})})):(i({type:"brushstart"}),i({type:"brush",mode:"resize"}),i({type:"brushend"}))}))},h.x=function(t){return arguments.length?(f=Os[!(i=t)<<1|!a],h):i},h.y=function(t){return arguments.length?(f=Os[!i<<1|!(a=t)],h):a},h.clamp=function(t){return arguments.length?(i&&a?(c=!!t[0],u=!!t[1]):i?c=!!t:a&&(u=!!t),h):i&&a?[c,u]:i?c:a?u:null},h.extent=function(t){var n,o,c,u,f;return arguments.length?(i&&(n=t[0],o=t[1],a&&(n=n[0],o=o[0]),e=[n,o],i.invert&&(n=i(n),o=i(o)),o<n&&(f=n,n=o,o=f),n==s[0]&&o==s[1]||(s=[n,o])),a&&(c=t[0],u=t[1],i&&(c=c[1],u=u[1]),r=[c,u],a.invert&&(c=a(c),u=a(u)),u<c&&(f=c,c=u,u=f),c==l[0]&&u==l[1]||(l=[c,u])),h):(i&&(e?(n=e[0],o=e[1]):(n=s[0],o=s[1],i.invert&&(n=i.invert(n),o=i.invert(o)),o<n&&(f=n,n=o,o=f))),a&&(r?(c=r[0],u=r[1]):(c=l[0],u=l[1],a.invert&&(c=a.invert(c),u=a.invert(u)),u<c&&(f=c,c=u,u=f))),i&&a?[[n,c],[o,u]]:i?[n,o]:a&&[c,u])},h.clear=function(){return h.empty()||(s=[0,0],l=[0,0],e=r=null),h},h.empty=function(){return!!i&&s[0]==s[1]||!!a&&l[0]==l[1]},t.rebind(h,n,"on")};var Is={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Os=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],zs=Ie.format=sr.timeFormat,Ds=zs.utc,Ns=Ds("%Y-%m-%dT%H:%M:%S.%LZ");function Rs(t){return t.toISOString()}function Fs(e,r,n){function i(t){return e(t)}function a(e,n){var i=(e[1]-e[0])/n,a=t.bisect(js,i);return a==js.length?[r.year,Mo(e.map((function(t){return t/31536e6})),n)[2]]:a?r[i/js[a-1]<js[a]/i?a-1:a]:[qs,Mo(e,n)[2]]}return i.invert=function(t){return Bs(e.invert(t))},i.domain=function(t){return arguments.length?(e.domain(t),i):e.domain().map(Bs)},i.nice=function(t,e){var r=i.domain(),n=mo(r),o=null==t?a(n,10):"number"==typeof t&&a(n,t);function s(r){return!isNaN(r)&&!t.range(r,Bs(+r+1),e).length}return o&&(t=o[0],e=o[1]),i.domain(yo(r,e>1?{floor:function(e){for(;s(e=t.floor(e));)e=Bs(e-1);return e},ceil:function(e){for(;s(e=t.ceil(e));)e=Bs(+e+1);return e}}:t))},i.ticks=function(t,e){var r=mo(i.domain()),n=null==t?a(r,10):"number"==typeof t?a(r,t):!t.range&&[{range:t},e];return n&&(t=n[0],e=n[1]),t.range(r[0],Bs(+r[1]+1),e<1?1:e)},i.tickFormat=function(){return n},i.copy=function(){return Fs(e.copy(),r,n)},wo(i,e)}function Bs(t){return new Date(t)}zs.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Rs:Ns,Rs.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},Rs.toString=Ns.toString,Ie.second=Ne((function(t){return new Oe(1e3*Math.floor(t/1e3))}),(function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))}),(function(t){return t.getSeconds()})),Ie.seconds=Ie.second.range,Ie.seconds.utc=Ie.second.utc.range,Ie.minute=Ne((function(t){return new Oe(6e4*Math.floor(t/6e4))}),(function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))}),(function(t){return t.getMinutes()})),Ie.minutes=Ie.minute.range,Ie.minutes.utc=Ie.minute.utc.range,Ie.hour=Ne((function(t){var e=t.getTimezoneOffset()/60;return new Oe(36e5*(Math.floor(t/36e5-e)+e))}),(function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))}),(function(t){return t.getHours()})),Ie.hours=Ie.hour.range,Ie.hours.utc=Ie.hour.utc.range,Ie.month=Ne((function(t){return(t=Ie.day(t)).setDate(1),t}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t){return t.getMonth()})),Ie.months=Ie.month.range,Ie.months.utc=Ie.month.utc.range;var js=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Us=[[Ie.second,1],[Ie.second,5],[Ie.second,15],[Ie.second,30],[Ie.minute,1],[Ie.minute,5],[Ie.minute,15],[Ie.minute,30],[Ie.hour,1],[Ie.hour,3],[Ie.hour,6],[Ie.hour,12],[Ie.day,1],[Ie.day,2],[Ie.week,1],[Ie.month,1],[Ie.month,3],[Ie.year,1]],Vs=zs.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",Yr]]),qs={range:function(e,r,n){return t.range(Math.ceil(e/n)*n,+r,n).map(Bs)},floor:L,ceil:L};Us.year=Ie.year,Ie.scale=function(){return Fs(t.scale.linear(),Us,Vs)};var Hs=Us.map((function(t){return[t[0].utc,t[1]]})),Gs=Ds.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",Yr]]);function Ys(t){return JSON.parse(t.responseText)}function Ws(t){var e=i.createRange();return e.selectNode(i.body),e.createContextualFragment(t.responseText)}Hs.year=Ie.year.utc,Ie.scale.utc=function(){return Fs(t.scale.linear(),Hs,Gs)},t.text=me((function(t){return t.responseText})),t.json=function(t,e){return ge(t,"application/json",Ys,e)},t.html=function(t,e){return ge(t,"text/html",Ws,e)},t.xml=me((function(t){return t.responseXML})),"object"==typeof e&&e.exports?e.exports=t:this.d3=t}()},{}],139:[function(t,e,r){!function(t){"use strict";var r,n,i,a,o=9e15,s="0123456789abcdef",l="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",c="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",u={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-o,maxE:o,crypto:!1},f=!0,h="[DecimalError] Invalid argument: ",p=Math.floor,d=Math.pow,m=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,g=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,v=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,y=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,x=1e7,b=l.length-1,_=c.length-1,w={name:"[object Decimal]"};function T(t){var e,r,n,i=t.length-1,a="",o=t[0];if(i>0){for(a+=o,e=1;e<i;e++)(r=7-(n=t[e]+"").length)&&(a+=z(r)),a+=n;(r=7-(n=(o=t[e])+"").length)&&(a+=z(r))}else if(0===o)return"0";for(;o%10==0;)o/=10;return a+o}function M(t,e,r){if(t!==~~t||t<e||t>r)throw Error(h+t)}function k(t,e,r,n){var i,a,o,s;for(a=t[0];a>=10;a/=10)--e;return--e<0?(e+=7,i=0):(i=Math.ceil((e+1)/7),e%=7),a=d(10,7-e),s=t[i]%a|0,null==n?e<3?(0==e?s=s/100|0:1==e&&(s=s/10|0),o=r<4&&99999==s||r>3&&49999==s||5e4==s||0==s):o=(r<4&&s+1==a||r>3&&s+1==a/2)&&(t[i+1]/a/100|0)==d(10,e-2)-1||(s==a/2||0==s)&&0==(t[i+1]/a/100|0):e<4?(0==e?s=s/1e3|0:1==e?s=s/100|0:2==e&&(s=s/10|0),o=(n||r<4)&&9999==s||!n&&r>3&&4999==s):o=((n||r<4)&&s+1==a||!n&&r>3&&s+1==a/2)&&(t[i+1]/a/1e3|0)==d(10,e-3)-1,o}function A(t,e,r){for(var n,i,a=[0],o=0,l=t.length;o<l;){for(i=a.length;i--;)a[i]*=e;for(a[0]+=s.indexOf(t.charAt(o++)),n=0;n<a.length;n++)a[n]>r-1&&(void 0===a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/r|0,a[n]%=r)}return a.reverse()}w.absoluteValue=w.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),E(t)},w.ceil=function(){return E(new this.constructor(this),this.e+1,2)},w.comparedTo=w.cmp=function(t){var e,r,n,i,a=this,o=a.d,s=(t=new a.constructor(t)).d,l=a.s,c=t.s;if(!o||!s)return l&&c?l!==c?l:o===s?0:!o^l<0?1:-1:NaN;if(!o[0]||!s[0])return o[0]?l:s[0]?-c:0;if(l!==c)return l;if(a.e!==t.e)return a.e>t.e^l<0?1:-1;for(e=0,r=(n=o.length)<(i=s.length)?n:i;e<r;++e)if(o[e]!==s[e])return o[e]>s[e]^l<0?1:-1;return n===i?0:n>i^l<0?1:-1},w.cosine=w.cos=function(){var t,e,r=this,n=r.constructor;return r.d?r.d[0]?(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(t,e){var r,n,i=e.d.length;i<32?(r=Math.ceil(i/3),n=Math.pow(4,-r).toString()):(r=16,n="2.3283064365386962890625e-10");t.precision+=r,e=q(t,1,e.times(n),new t(1));for(var a=r;a--;){var o=e.times(e);e=o.times(o).minus(o).times(8).plus(1)}return t.precision-=r,e}(n,H(n,r)),n.precision=t,n.rounding=e,E(2==a||3==a?r.neg():r,t,e,!0)):new n(1):new n(NaN)},w.cubeRoot=w.cbrt=function(){var t,e,r,n,i,a,o,s,l,c,u=this,h=u.constructor;if(!u.isFinite()||u.isZero())return new h(u);for(f=!1,(a=u.s*Math.pow(u.s*u,1/3))&&Math.abs(a)!=1/0?n=new h(a.toString()):(r=T(u.d),(a=((t=u.e)-r.length+1)%3)&&(r+=1==a||-2==a?"0":"00"),a=Math.pow(r,1/3),t=p((t+1)/3)-(t%3==(t<0?-1:2)),(n=new h(r=a==1/0?"5e"+t:(r=a.toExponential()).slice(0,r.indexOf("e")+1)+t)).s=u.s),o=(t=h.precision)+3;;)if(c=(l=(s=n).times(s).times(s)).plus(u),n=S(c.plus(u).times(s),c.plus(l),o+2,1),T(s.d).slice(0,o)===(r=T(n.d)).slice(0,o)){if("9999"!=(r=r.slice(o-3,o+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(E(n,t+1,1),e=!n.times(n).times(n).eq(u));break}if(!i&&(E(s,t+1,0),s.times(s).times(s).eq(u))){n=s;break}o+=4,i=1}return f=!0,E(n,t,h.rounding,e)},w.decimalPlaces=w.dp=function(){var t,e=this.d,r=NaN;if(e){if(r=7*((t=e.length-1)-p(this.e/7)),t=e[t])for(;t%10==0;t/=10)r--;r<0&&(r=0)}return r},w.dividedBy=w.div=function(t){return S(this,new this.constructor(t))},w.dividedToIntegerBy=w.divToInt=function(t){var e=this.constructor;return E(S(this,new e(t),0,1,1),e.precision,e.rounding)},w.equals=w.eq=function(t){return 0===this.cmp(t)},w.floor=function(){return E(new this.constructor(this),this.e+1,3)},w.greaterThan=w.gt=function(t){return this.cmp(t)>0},w.greaterThanOrEqualTo=w.gte=function(t){var e=this.cmp(t);return 1==e||0===e},w.hyperbolicCosine=w.cosh=function(){var t,e,r,n,i,a=this,o=a.constructor,s=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return s;r=o.precision,n=o.rounding,o.precision=r+Math.max(a.e,a.sd())+4,o.rounding=1,(i=a.d.length)<32?(t=Math.ceil(i/3),e=Math.pow(4,-t).toString()):(t=16,e="2.3283064365386962890625e-10"),a=q(o,1,a.times(e),new o(1),!0);for(var l,c=t,u=new o(8);c--;)l=a.times(a),a=s.minus(l.times(u.minus(l.times(u))));return E(a,o.precision=r,o.rounding=n,!0)},w.hyperbolicSine=w.sinh=function(){var t,e,r,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(e=a.precision,r=a.rounding,a.precision=e+Math.max(i.e,i.sd())+4,a.rounding=1,(n=i.d.length)<3)i=q(a,2,i,i,!0);else{t=(t=1.4*Math.sqrt(n))>16?16:0|t,i=q(a,2,i=i.times(Math.pow(5,-t)),i,!0);for(var o,s=new a(5),l=new a(16),c=new a(20);t--;)o=i.times(i),i=i.times(s.plus(o.times(l.times(o).plus(c))))}return a.precision=e,a.rounding=r,E(i,e,r,!0)},w.hyperbolicTangent=w.tanh=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+7,n.rounding=1,S(r.sinh(),r.cosh(),n.precision=t,n.rounding=e)):new n(r.s)},w.inverseCosine=w.acos=function(){var t,e=this,r=e.constructor,n=e.abs().cmp(1),i=r.precision,a=r.rounding;return-1!==n?0===n?e.isNeg()?I(r,i,a):new r(0):new r(NaN):e.isZero()?I(r,i+4,a).times(.5):(r.precision=i+6,r.rounding=1,e=e.asin(),t=I(r,i+4,a).times(.5),r.precision=i,r.rounding=a,t.minus(e))},w.inverseHyperbolicCosine=w.acosh=function(){var t,e,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(t=n.precision,e=n.rounding,n.precision=t+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,f=!1,r=r.times(r).minus(1).sqrt().plus(r),f=!0,n.precision=t,n.rounding=e,r.ln()):new n(r)},w.inverseHyperbolicSine=w.asinh=function(){var t,e,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,f=!1,r=r.times(r).plus(1).sqrt().plus(r),f=!0,n.precision=t,n.rounding=e,r.ln())},w.inverseHyperbolicTangent=w.atanh=function(){var t,e,r,n,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(t=a.precision,e=a.rounding,n=i.sd(),Math.max(n,t)<2*-i.e-1?E(new a(i),t,e,!0):(a.precision=r=n-i.e,i=S(i.plus(1),new a(1).minus(i),r+t,1),a.precision=t+4,a.rounding=1,i=i.ln(),a.precision=t,a.rounding=e,i.times(.5))):new a(NaN)},w.inverseSine=w.asin=function(){var t,e,r,n,i=this,a=i.constructor;return i.isZero()?new a(i):(e=i.abs().cmp(1),r=a.precision,n=a.rounding,-1!==e?0===e?((t=I(a,r+4,n).times(.5)).s=i.s,t):new a(NaN):(a.precision=r+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=r,a.rounding=n,i.times(2)))},w.inverseTangent=w.atan=function(){var t,e,r,n,i,a,o,s,l,c=this,u=c.constructor,h=u.precision,p=u.rounding;if(c.isFinite()){if(c.isZero())return new u(c);if(c.abs().eq(1)&&h+4<=_)return(o=I(u,h+4,p).times(.25)).s=c.s,o}else{if(!c.s)return new u(NaN);if(h+4<=_)return(o=I(u,h+4,p).times(.5)).s=c.s,o}for(u.precision=s=h+10,u.rounding=1,t=r=Math.min(28,s/7+2|0);t;--t)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(f=!1,e=Math.ceil(s/7),n=1,l=c.times(c),o=new u(c),i=c;-1!==t;)if(i=i.times(l),a=o.minus(i.div(n+=2)),i=i.times(l),void 0!==(o=a.plus(i.div(n+=2))).d[e])for(t=e;o.d[t]===a.d[t]&&t--;);return r&&(o=o.times(2<<r-1)),f=!0,E(o,u.precision=h,u.rounding=p,!0)},w.isFinite=function(){return!!this.d},w.isInteger=w.isInt=function(){return!!this.d&&p(this.e/7)>this.d.length-2},w.isNaN=function(){return!this.s},w.isNegative=w.isNeg=function(){return this.s<0},w.isPositive=w.isPos=function(){return this.s>0},w.isZero=function(){return!!this.d&&0===this.d[0]},w.lessThan=w.lt=function(t){return this.cmp(t)<0},w.lessThanOrEqualTo=w.lte=function(t){return this.cmp(t)<1},w.logarithm=w.log=function(t){var e,r,n,i,a,o,s,l,c=this.constructor,u=c.precision,h=c.rounding;if(null==t)t=new c(10),e=!0;else{if(r=(t=new c(t)).d,t.s<0||!r||!r[0]||t.eq(1))return new c(NaN);e=t.eq(10)}if(r=this.d,this.s<0||!r||!r[0]||this.eq(1))return new c(r&&!r[0]?-1/0:1!=this.s?NaN:r?0:1/0);if(e)if(r.length>1)a=!0;else{for(i=r[0];i%10==0;)i/=10;a=1!==i}if(f=!1,o=B(this,s=u+5),n=e?P(c,s+10):B(t,s),k((l=S(o,n,s,1)).d,i=u,h))do{if(o=B(this,s+=10),n=e?P(c,s+10):B(t,s),l=S(o,n,s,1),!a){+T(l.d).slice(i+1,i+15)+1==1e14&&(l=E(l,u+1,0));break}}while(k(l.d,i+=10,h));return f=!0,E(l,u,h)},w.minus=w.sub=function(t){var e,r,n,i,a,o,s,l,c,u,h,d,m=this,g=m.constructor;if(t=new g(t),!m.d||!t.d)return m.s&&t.s?m.d?t.s=-t.s:t=new g(t.d||m.s!==t.s?m:NaN):t=new g(NaN),t;if(m.s!=t.s)return t.s=-t.s,m.plus(t);if(c=m.d,d=t.d,s=g.precision,l=g.rounding,!c[0]||!d[0]){if(d[0])t.s=-t.s;else{if(!c[0])return new g(3===l?-0:0);t=new g(m)}return f?E(t,s,l):t}if(r=p(t.e/7),u=p(m.e/7),c=c.slice(),a=u-r){for((h=a<0)?(e=c,a=-a,o=d.length):(e=d,r=u,o=c.length),a>(n=Math.max(Math.ceil(s/7),o)+2)&&(a=n,e.length=1),e.reverse(),n=a;n--;)e.push(0);e.reverse()}else{for((h=(n=c.length)<(o=d.length))&&(o=n),n=0;n<o;n++)if(c[n]!=d[n]){h=c[n]<d[n];break}a=0}for(h&&(e=c,c=d,d=e,t.s=-t.s),o=c.length,n=d.length-o;n>0;--n)c[o++]=0;for(n=d.length;n>a;){if(c[--n]<d[n]){for(i=n;i&&0===c[--i];)c[i]=x-1;--c[i],c[n]+=x}c[n]-=d[n]}for(;0===c[--o];)c.pop();for(;0===c[0];c.shift())--r;return c[0]?(t.d=c,t.e=L(c,r),f?E(t,s,l):t):new g(3===l?-0:0)},w.modulo=w.mod=function(t){var e,r=this,n=r.constructor;return t=new n(t),!r.d||!t.s||t.d&&!t.d[0]?new n(NaN):!t.d||r.d&&!r.d[0]?E(new n(r),n.precision,n.rounding):(f=!1,9==n.modulo?(e=S(r,t.abs(),0,3,1)).s*=t.s:e=S(r,t,0,n.modulo,1),e=e.times(t),f=!0,r.minus(e))},w.naturalExponential=w.exp=function(){return F(this)},w.naturalLogarithm=w.ln=function(){return B(this)},w.negated=w.neg=function(){var t=new this.constructor(this);return t.s=-t.s,E(t)},w.plus=w.add=function(t){var e,r,n,i,a,o,s,l,c,u,h=this,d=h.constructor;if(t=new d(t),!h.d||!t.d)return h.s&&t.s?h.d||(t=new d(t.d||h.s===t.s?h:NaN)):t=new d(NaN),t;if(h.s!=t.s)return t.s=-t.s,h.minus(t);if(c=h.d,u=t.d,s=d.precision,l=d.rounding,!c[0]||!u[0])return u[0]||(t=new d(h)),f?E(t,s,l):t;if(a=p(h.e/7),n=p(t.e/7),c=c.slice(),i=a-n){for(i<0?(r=c,i=-i,o=u.length):(r=u,n=a,o=c.length),i>(o=(a=Math.ceil(s/7))>o?a+1:o+1)&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((o=c.length)-(i=u.length)<0&&(i=o,r=u,u=c,c=r),e=0;i;)e=(c[--i]=c[i]+u[i]+e)/x|0,c[i]%=x;for(e&&(c.unshift(e),++n),o=c.length;0==c[--o];)c.pop();return t.d=c,t.e=L(c,n),f?E(t,s,l):t},w.precision=w.sd=function(t){var e,r=this;if(void 0!==t&&t!==!!t&&1!==t&&0!==t)throw Error(h+t);return r.d?(e=O(r.d),t&&r.e+1>e&&(e=r.e+1)):e=NaN,e},w.round=function(){var t=this,e=t.constructor;return E(new e(t),t.e+1,e.rounding)},w.sine=w.sin=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(t,e){var r,n=e.d.length;if(n<3)return q(t,2,e,e);r=(r=1.4*Math.sqrt(n))>16?16:0|r,e=e.times(Math.pow(5,-r)),e=q(t,2,e,e);for(var i,a=new t(5),o=new t(16),s=new t(20);r--;)i=e.times(e),e=e.times(a.plus(i.times(o.times(i).minus(s))));return e}(n,H(n,r)),n.precision=t,n.rounding=e,E(a>2?r.neg():r,t,e,!0)):new n(NaN)},w.squareRoot=w.sqrt=function(){var t,e,r,n,i,a,o=this,s=o.d,l=o.e,c=o.s,u=o.constructor;if(1!==c||!s||!s[0])return new u(!c||c<0&&(!s||s[0])?NaN:s?o:1/0);for(f=!1,0==(c=Math.sqrt(+o))||c==1/0?(((e=T(s)).length+l)%2==0&&(e+="0"),c=Math.sqrt(e),l=p((l+1)/2)-(l<0||l%2),n=new u(e=c==1/0?"1e"+l:(e=c.toExponential()).slice(0,e.indexOf("e")+1)+l)):n=new u(c.toString()),r=(l=u.precision)+3;;)if(n=(a=n).plus(S(o,a,r+2,1)).times(.5),T(a.d).slice(0,r)===(e=T(n.d)).slice(0,r)){if("9999"!=(e=e.slice(r-3,r+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(E(n,l+1,1),t=!n.times(n).eq(o));break}if(!i&&(E(a,l+1,0),a.times(a).eq(o))){n=a;break}r+=4,i=1}return f=!0,E(n,l,u.rounding,t)},w.tangent=w.tan=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+10,n.rounding=1,(r=r.sin()).s=1,r=S(r,new n(1).minus(r.times(r)).sqrt(),t+10,0),n.precision=t,n.rounding=e,E(2==a||4==a?r.neg():r,t,e,!0)):new n(NaN)},w.times=w.mul=function(t){var e,r,n,i,a,o,s,l,c,u=this,h=u.constructor,d=u.d,m=(t=new h(t)).d;if(t.s*=u.s,!(d&&d[0]&&m&&m[0]))return new h(!t.s||d&&!d[0]&&!m||m&&!m[0]&&!d?NaN:d&&m?0*t.s:t.s/0);for(r=p(u.e/7)+p(t.e/7),(l=d.length)<(c=m.length)&&(a=d,d=m,m=a,o=l,l=c,c=o),a=[],n=o=l+c;n--;)a.push(0);for(n=c;--n>=0;){for(e=0,i=l+n;i>n;)s=a[i]+m[n]*d[i-n-1]+e,a[i--]=s%x|0,e=s/x|0;a[i]=(a[i]+e)%x|0}for(;!a[--o];)a.pop();return e?++r:a.shift(),t.d=a,t.e=L(a,r),f?E(t,h.precision,h.rounding):t},w.toBinary=function(t,e){return G(this,2,t,e)},w.toDecimalPlaces=w.toDP=function(t,e){var r=this,n=r.constructor;return r=new n(r),void 0===t?r:(M(t,0,1e9),void 0===e?e=n.rounding:M(e,0,8),E(r,t+r.e+1,e))},w.toExponential=function(t,e){var r,n=this,i=n.constructor;return void 0===t?r=C(n,!0):(M(t,0,1e9),void 0===e?e=i.rounding:M(e,0,8),r=C(n=E(new i(n),t+1,e),!0,t+1)),n.isNeg()&&!n.isZero()?"-"+r:r},w.toFixed=function(t,e){var r,n,i=this,a=i.constructor;return void 0===t?r=C(i):(M(t,0,1e9),void 0===e?e=a.rounding:M(e,0,8),r=C(n=E(new a(i),t+i.e+1,e),!1,t+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},w.toFraction=function(t){var e,r,n,i,a,o,s,l,c,u,p,m,g=this,v=g.d,y=g.constructor;if(!v)return new y(g);if(c=r=new y(1),n=l=new y(0),o=(a=(e=new y(n)).e=O(v)-g.e-1)%7,e.d[0]=d(10,o<0?7+o:o),null==t)t=a>0?e:c;else{if(!(s=new y(t)).isInt()||s.lt(c))throw Error(h+s);t=s.gt(e)?a>0?e:c:s}for(f=!1,s=new y(T(v)),u=y.precision,y.precision=a=7*v.length*2;p=S(s,e,0,1,1),1!=(i=r.plus(p.times(n))).cmp(t);)r=n,n=i,i=c,c=l.plus(p.times(i)),l=i,i=e,e=s.minus(p.times(i)),s=i;return i=S(t.minus(r),n,0,1,1),l=l.plus(i.times(c)),r=r.plus(i.times(n)),l.s=c.s=g.s,m=S(c,n,a,1).minus(g).abs().cmp(S(l,r,a,1).minus(g).abs())<1?[c,n]:[l,r],y.precision=u,f=!0,m},w.toHexadecimal=w.toHex=function(t,e){return G(this,16,t,e)},w.toNearest=function(t,e){var r=this,n=r.constructor;if(r=new n(r),null==t){if(!r.d)return r;t=new n(1),e=n.rounding}else{if(t=new n(t),void 0!==e&&M(e,0,8),!r.d)return t.s?r:t;if(!t.d)return t.s&&(t.s=r.s),t}return t.d[0]?(f=!1,e<4&&(e=[4,5,7,8][e]),r=S(r,t,0,e,1).times(t),f=!0,E(r)):(t.s=r.s,r=t),r},w.toNumber=function(){return+this},w.toOctal=function(t,e){return G(this,8,t,e)},w.toPower=w.pow=function(t){var e,r,n,i,a,o,s=this,l=s.constructor,c=+(t=new l(t));if(!(s.d&&t.d&&s.d[0]&&t.d[0]))return new l(d(+s,c));if((s=new l(s)).eq(1))return s;if(n=l.precision,a=l.rounding,t.eq(1))return E(s,n,a);if((e=p(t.e/7))>=t.d.length-1&&(r=c<0?-c:c)<=9007199254740991)return i=D(l,s,r,n),t.s<0?new l(1).div(i):E(i,n,a);if((o=s.s)<0){if(e<t.d.length-1)return new l(NaN);if(0==(1&t.d[e])&&(o=1),0==s.e&&1==s.d[0]&&1==s.d.length)return s.s=o,s}return(e=0!=(r=d(+s,c))&&isFinite(r)?new l(r+"").e:p(c*(Math.log("0."+T(s.d))/Math.LN10+s.e+1)))>l.maxE+1||e<l.minE-1?new l(e>0?o/0:0):(f=!1,l.rounding=s.s=1,r=Math.min(12,(e+"").length),(i=F(t.times(B(s,n+r)),n)).d&&k((i=E(i,n+5,1)).d,n,a)&&(e=n+10,+T((i=E(F(t.times(B(s,e+r)),e),e+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=E(i,n+1,0))),i.s=o,f=!0,l.rounding=a,E(i,n,a))},w.toPrecision=function(t,e){var r,n=this,i=n.constructor;return void 0===t?r=C(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(M(t,1,1e9),void 0===e?e=i.rounding:M(e,0,8),r=C(n=E(new i(n),t,e),t<=n.e||n.e<=i.toExpNeg,t)),n.isNeg()&&!n.isZero()?"-"+r:r},w.toSignificantDigits=w.toSD=function(t,e){var r=this.constructor;return void 0===t?(t=r.precision,e=r.rounding):(M(t,1,1e9),void 0===e?e=r.rounding:M(e,0,8)),E(new r(this),t,e)},w.toString=function(){var t=this,e=t.constructor,r=C(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+r:r},w.truncated=w.trunc=function(){return E(new this.constructor(this),this.e+1,1)},w.valueOf=w.toJSON=function(){var t=this,e=t.constructor,r=C(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+r:r};var S=function(){function t(t,e,r){var n,i=0,a=t.length;for(t=t.slice();a--;)n=t[a]*e+i,t[a]=n%r|0,i=n/r|0;return i&&t.unshift(i),t}function e(t,e,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;i<r;i++)if(t[i]!=e[i]){a=t[i]>e[i]?1:-1;break}return a}function r(t,e,r,n){for(var i=0;r--;)t[r]-=i,i=t[r]<e[r]?1:0,t[r]=i*n+t[r]-e[r];for(;!t[0]&&t.length>1;)t.shift()}return function(i,a,o,s,l,c){var u,f,h,d,m,g,v,y,b,_,w,T,M,k,A,S,C,L,P,I,O=i.constructor,z=i.s==a.s?1:-1,D=i.d,N=a.d;if(!(D&&D[0]&&N&&N[0]))return new O(i.s&&a.s&&(D?!N||D[0]!=N[0]:N)?D&&0==D[0]||!N?0*z:z/0:NaN);for(c?(m=1,f=i.e-a.e):(c=x,m=7,f=p(i.e/m)-p(a.e/m)),P=N.length,C=D.length,_=(b=new O(z)).d=[],h=0;N[h]==(D[h]||0);h++);if(N[h]>(D[h]||0)&&f--,null==o?(k=o=O.precision,s=O.rounding):k=l?o+(i.e-a.e)+1:o,k<0)_.push(1),g=!0;else{if(k=k/m+2|0,h=0,1==P){for(d=0,N=N[0],k++;(h<C||d)&&k--;h++)A=d*c+(D[h]||0),_[h]=A/N|0,d=A%N|0;g=d||h<C}else{for((d=c/(N[0]+1)|0)>1&&(N=t(N,d,c),D=t(D,d,c),P=N.length,C=D.length),S=P,T=(w=D.slice(0,P)).length;T<P;)w[T++]=0;(I=N.slice()).unshift(0),L=N[0],N[1]>=c/2&&++L;do{d=0,(u=e(N,w,P,T))<0?(M=w[0],P!=T&&(M=M*c+(w[1]||0)),(d=M/L|0)>1?(d>=c&&(d=c-1),1==(u=e(v=t(N,d,c),w,y=v.length,T=w.length))&&(d--,r(v,P<y?I:N,y,c))):(0==d&&(u=d=1),v=N.slice()),(y=v.length)<T&&v.unshift(0),r(w,v,T,c),-1==u&&(u=e(N,w,P,T=w.length))<1&&(d++,r(w,P<T?I:N,T,c)),T=w.length):0===u&&(d++,w=[0]),_[h++]=d,u&&w[0]?w[T++]=D[S]||0:(w=[D[S]],T=1)}while((S++<C||void 0!==w[0])&&k--);g=void 0!==w[0]}_[0]||_.shift()}if(1==m)b.e=f,n=g;else{for(h=1,d=_[0];d>=10;d/=10)h++;b.e=h+f*m-1,E(b,l?o+b.e+1:o,s,g)}return b}}();function E(t,e,r,n){var i,a,o,s,l,c,u,h,p,m=t.constructor;t:if(null!=e){if(!(h=t.d))return t;for(i=1,s=h[0];s>=10;s/=10)i++;if((a=e-i)<0)a+=7,o=e,l=(u=h[p=0])/d(10,i-o-1)%10|0;else if((p=Math.ceil((a+1)/7))>=(s=h.length)){if(!n)break t;for(;s++<=p;)h.push(0);u=l=0,i=1,o=(a%=7)-7+1}else{for(u=s=h[p],i=1;s>=10;s/=10)i++;l=(o=(a%=7)-7+i)<0?0:u/d(10,i-o-1)%10|0}if(n=n||e<0||void 0!==h[p+1]||(o<0?u:u%d(10,i-o-1)),c=r<4?(l||n)&&(0==r||r==(t.s<0?3:2)):l>5||5==l&&(4==r||n||6==r&&(a>0?o>0?u/d(10,i-o):0:h[p-1])%10&1||r==(t.s<0?8:7)),e<1||!h[0])return h.length=0,c?(e-=t.e+1,h[0]=d(10,(7-e%7)%7),t.e=-e||0):h[0]=t.e=0,t;if(0==a?(h.length=p,s=1,p--):(h.length=p+1,s=d(10,7-a),h[p]=o>0?(u/d(10,i-o)%d(10,o)|0)*s:0),c)for(;;){if(0==p){for(a=1,o=h[0];o>=10;o/=10)a++;for(o=h[0]+=s,s=1;o>=10;o/=10)s++;a!=s&&(t.e++,h[0]==x&&(h[0]=1));break}if(h[p]+=s,h[p]!=x)break;h[p--]=0,s=1}for(a=h.length;0===h[--a];)h.pop()}return f&&(t.e>m.maxE?(t.d=null,t.e=NaN):t.e<m.minE&&(t.e=0,t.d=[0])),t}function C(t,e,r){if(!t.isFinite())return j(t);var n,i=t.e,a=T(t.d),o=a.length;return e?(r&&(n=r-o)>0?a=a.charAt(0)+"."+a.slice(1)+z(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(t.e<0?"e":"e+")+t.e):i<0?(a="0."+z(-i-1)+a,r&&(n=r-o)>0&&(a+=z(n))):i>=o?(a+=z(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+z(n))):((n=i+1)<o&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(a+="."),a+=z(n))),a}function L(t,e){var r=t[0];for(e*=7;r>=10;r/=10)e++;return e}function P(t,e,r){if(e>b)throw f=!0,r&&(t.precision=r),Error("[DecimalError] Precision limit exceeded");return E(new t(l),e,1,!0)}function I(t,e,r){if(e>_)throw Error("[DecimalError] Precision limit exceeded");return E(new t(c),e,r,!0)}function O(t){var e=t.length-1,r=7*e+1;if(e=t[e]){for(;e%10==0;e/=10)r--;for(e=t[0];e>=10;e/=10)r++}return r}function z(t){for(var e="";t--;)e+="0";return e}function D(t,e,r,n){var i,a=new t(1),o=Math.ceil(n/7+4);for(f=!1;;){if(r%2&&Y((a=a.times(e)).d,o)&&(i=!0),0===(r=p(r/2))){r=a.d.length-1,i&&0===a.d[r]&&++a.d[r];break}Y((e=e.times(e)).d,o)}return f=!0,a}function N(t){return 1&t.d[t.d.length-1]}function R(t,e,r){for(var n,i=new t(e[0]),a=0;++a<e.length;){if(!(n=new t(e[a])).s){i=n;break}i[r](n)&&(i=n)}return i}function F(t,e){var r,n,i,a,o,s,l,c=0,u=0,h=0,p=t.constructor,m=p.rounding,g=p.precision;if(!t.d||!t.d[0]||t.e>17)return new p(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(null==e?(f=!1,l=g):l=e,s=new p(.03125);t.e>-2;)t=t.times(s),h+=5;for(l+=n=Math.log(d(2,h))/Math.LN10*2+5|0,r=a=o=new p(1),p.precision=l;;){if(a=E(a.times(t),l,1),r=r.times(++u),T((s=o.plus(S(a,r,l,1))).d).slice(0,l)===T(o.d).slice(0,l)){for(i=h;i--;)o=E(o.times(o),l,1);if(null!=e)return p.precision=g,o;if(!(c<3&&k(o.d,l-n,m,c)))return E(o,p.precision=g,m,f=!0);p.precision=l+=10,r=a=s=new p(1),u=0,c++}o=s}}function B(t,e){var r,n,i,a,o,s,l,c,u,h,p,d=1,m=t,g=m.d,v=m.constructor,y=v.rounding,x=v.precision;if(m.s<0||!g||!g[0]||!m.e&&1==g[0]&&1==g.length)return new v(g&&!g[0]?-1/0:1!=m.s?NaN:g?0:m);if(null==e?(f=!1,u=x):u=e,v.precision=u+=10,n=(r=T(g)).charAt(0),!(Math.abs(a=m.e)<15e14))return c=P(v,u+2,x).times(a+""),m=B(new v(n+"."+r.slice(1)),u-10).plus(c),v.precision=x,null==e?E(m,x,y,f=!0):m;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=T((m=m.times(t)).d)).charAt(0),d++;for(a=m.e,n>1?(m=new v("0."+r),a++):m=new v(n+"."+r.slice(1)),h=m,l=o=m=S(m.minus(1),m.plus(1),u,1),p=E(m.times(m),u,1),i=3;;){if(o=E(o.times(p),u,1),T((c=l.plus(S(o,new v(i),u,1))).d).slice(0,u)===T(l.d).slice(0,u)){if(l=l.times(2),0!==a&&(l=l.plus(P(v,u+2,x).times(a+""))),l=S(l,new v(d),u,1),null!=e)return v.precision=x,l;if(!k(l.d,u-10,y,s))return E(l,v.precision=x,y,f=!0);v.precision=u+=10,c=o=m=S(h.minus(1),h.plus(1),u,1),p=E(m.times(m),u,1),i=s=1}l=c,i+=2}}function j(t){return String(t.s*t.s/0)}function U(t,e){var r,n,i;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),n=0;48===e.charCodeAt(n);n++);for(i=e.length;48===e.charCodeAt(i-1);--i);if(e=e.slice(n,i)){if(i-=n,t.e=r=r-n-1,t.d=[],n=(r+1)%7,r<0&&(n+=7),n<i){for(n&&t.d.push(+e.slice(0,n)),i-=7;n<i;)t.d.push(+e.slice(n,n+=7));n=7-(e=e.slice(n)).length}else n-=i;for(;n--;)e+="0";t.d.push(+e),f&&(t.e>t.constructor.maxE?(t.d=null,t.e=NaN):t.e<t.constructor.minE&&(t.e=0,t.d=[0]))}else t.e=0,t.d=[0];return t}function V(t,e){var n,i,a,o,s,l,c,u,p;if("Infinity"===e||"NaN"===e)return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(g.test(e))n=16,e=e.toLowerCase();else if(m.test(e))n=2;else{if(!v.test(e))throw Error(h+e);n=8}for((o=e.search(/p/i))>0?(c=+e.slice(o+1),e=e.substring(2,o)):e=e.slice(2),s=(o=e.indexOf("."))>=0,i=t.constructor,s&&(o=(l=(e=e.replace(".","")).length)-o,a=D(i,new i(n),o,2*o)),o=p=(u=A(e,n,x)).length-1;0===u[o];--o)u.pop();return o<0?new i(0*t.s):(t.e=L(u,p),t.d=u,f=!1,s&&(t=S(t,a,4*l)),c&&(t=t.times(Math.abs(c)<54?Math.pow(2,c):r.pow(2,c))),f=!0,t)}function q(t,e,r,n,i){var a,o,s,l,c=t.precision,u=Math.ceil(c/7);for(f=!1,l=r.times(r),s=new t(n);;){if(o=S(s.times(l),new t(e++*e++),c,1),s=i?n.plus(o):n.minus(o),n=S(o.times(l),new t(e++*e++),c,1),void 0!==(o=s.plus(n)).d[u]){for(a=u;o.d[a]===s.d[a]&&a--;);if(-1==a)break}a=s,s=n,n=o,o=a}return f=!0,o.d.length=u+1,o}function H(t,e){var r,n=e.s<0,i=I(t,t.precision,1),o=i.times(.5);if((e=e.abs()).lte(o))return a=n?4:1,e;if((r=e.divToInt(i)).isZero())a=n?3:2;else{if((e=e.minus(r.times(i))).lte(o))return a=N(r)?n?2:3:n?4:1,e;a=N(r)?n?1:4:n?3:2}return e.minus(i).abs()}function G(t,e,r,i){var a,o,l,c,u,f,h,p,d,m=t.constructor,g=void 0!==r;if(g?(M(r,1,1e9),void 0===i?i=m.rounding:M(i,0,8)):(r=m.precision,i=m.rounding),t.isFinite()){for(g?(a=2,16==e?r=4*r-3:8==e&&(r=3*r-2)):a=e,(l=(h=C(t)).indexOf("."))>=0&&(h=h.replace(".",""),(d=new m(1)).e=h.length-l,d.d=A(C(d),10,a),d.e=d.d.length),o=u=(p=A(h,10,a)).length;0==p[--u];)p.pop();if(p[0]){if(l<0?o--:((t=new m(t)).d=p,t.e=o,p=(t=S(t,d,r,i,0,a)).d,o=t.e,f=n),l=p[r],c=a/2,f=f||void 0!==p[r+1],f=i<4?(void 0!==l||f)&&(0===i||i===(t.s<0?3:2)):l>c||l===c&&(4===i||f||6===i&&1&p[r-1]||i===(t.s<0?8:7)),p.length=r,f)for(;++p[--r]>a-1;)p[r]=0,r||(++o,p.unshift(1));for(u=p.length;!p[u-1];--u);for(l=0,h="";l<u;l++)h+=s.charAt(p[l]);if(g){if(u>1)if(16==e||8==e){for(l=16==e?4:3,--u;u%l;u++)h+="0";for(u=(p=A(h,a,e)).length;!p[u-1];--u);for(l=1,h="1.";l<u;l++)h+=s.charAt(p[l])}else h=h.charAt(0)+"."+h.slice(1);h=h+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)h="0"+h;h="0."+h}else if(++o>u)for(o-=u;o--;)h+="0";else o<u&&(h=h.slice(0,o)+"."+h.slice(o))}else h=g?"0p+0":"0";h=(16==e?"0x":2==e?"0b":8==e?"0o":"")+h}else h=j(t);return t.s<0?"-"+h:h}function Y(t,e){if(t.length>e)return t.length=e,!0}function W(t){return new this(t).abs()}function Z(t){return new this(t).acos()}function X(t){return new this(t).acosh()}function J(t,e){return new this(t).plus(e)}function K(t){return new this(t).asin()}function $(t){return new this(t).asinh()}function Q(t){return new this(t).atan()}function tt(t){return new this(t).atanh()}function et(t,e){t=new this(t),e=new this(e);var r,n=this.precision,i=this.rounding,a=n+4;return t.s&&e.s?t.d||e.d?!e.d||t.isZero()?(r=e.s<0?I(this,n,i):new this(0)).s=t.s:!t.d||e.isZero()?(r=I(this,a,1).times(.5)).s=t.s:e.s<0?(this.precision=a,this.rounding=1,r=this.atan(S(t,e,a,1)),e=I(this,a,1),this.precision=n,this.rounding=i,r=t.s<0?r.minus(e):r.plus(e)):r=this.atan(S(t,e,a,1)):(r=I(this,a,1).times(e.s>0?.25:.75)).s=t.s:r=new this(NaN),r}function rt(t){return new this(t).cbrt()}function nt(t){return E(t=new this(t),t.e+1,2)}function it(t){if(!t||"object"!=typeof t)throw Error("[DecimalError] Object expected");var e,r,n,i=!0===t.defaults,a=["precision",1,1e9,"rounding",0,8,"toExpNeg",-o,0,"toExpPos",0,o,"maxE",0,o,"minE",-o,0,"modulo",0,9];for(e=0;e<a.length;e+=3)if(r=a[e],i&&(this[r]=u[r]),void 0!==(n=t[r])){if(!(p(n)===n&&n>=a[e+1]&&n<=a[e+2]))throw Error(h+r+": "+n);this[r]=n}if(r="crypto",i&&(this[r]=u[r]),void 0!==(n=t[r])){if(!0!==n&&!1!==n&&0!==n&&1!==n)throw Error(h+r+": "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error("[DecimalError] crypto unavailable");this[r]=!0}else this[r]=!1}return this}function at(t){return new this(t).cos()}function ot(t){return new this(t).cosh()}function st(t,e){return new this(t).div(e)}function lt(t){return new this(t).exp()}function ct(t){return E(t=new this(t),t.e+1,3)}function ut(){var t,e,r=new this(0);for(f=!1,t=0;t<arguments.length;)if((e=new this(arguments[t++])).d)r.d&&(r=r.plus(e.times(e)));else{if(e.s)return f=!0,new this(1/0);r=e}return f=!0,r.sqrt()}function ft(t){return t instanceof r||t&&"[object Decimal]"===t.name||!1}function ht(t){return new this(t).ln()}function pt(t,e){return new this(t).log(e)}function dt(t){return new this(t).log(2)}function mt(t){return new this(t).log(10)}function gt(){return R(this,arguments,"lt")}function vt(){return R(this,arguments,"gt")}function yt(t,e){return new this(t).mod(e)}function xt(t,e){return new this(t).mul(e)}function bt(t,e){return new this(t).pow(e)}function _t(t){var e,r,n,i,a=0,o=new this(1),s=[];if(void 0===t?t=this.precision:M(t,1,1e9),n=Math.ceil(t/7),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));a<n;)(i=e[a])>=429e7?e[a]=crypto.getRandomValues(new Uint32Array(1))[0]:s[a++]=i%1e7;else{if(!crypto.randomBytes)throw Error("[DecimalError] crypto unavailable");for(e=crypto.randomBytes(n*=4);a<n;)(i=e[a]+(e[a+1]<<8)+(e[a+2]<<16)+((127&e[a+3])<<24))>=214e7?crypto.randomBytes(4).copy(e,a):(s.push(i%1e7),a+=4);a=n/4}else for(;a<n;)s[a++]=1e7*Math.random()|0;for(t%=7,(n=s[--a])&&t&&(i=d(10,7-t),s[a]=(n/i|0)*i);0===s[a];a--)s.pop();if(a<0)r=0,s=[0];else{for(r=-1;0===s[0];r-=7)s.shift();for(n=1,i=s[0];i>=10;i/=10)n++;n<7&&(r-=7-n)}return o.e=r,o.d=s,o}function wt(t){return E(t=new this(t),t.e+1,this.rounding)}function Tt(t){return(t=new this(t)).d?t.d[0]?t.s:0*t.s:t.s||NaN}function Mt(t){return new this(t).sin()}function kt(t){return new this(t).sinh()}function At(t){return new this(t).sqrt()}function St(t,e){return new this(t).sub(e)}function Et(t){return new this(t).tan()}function Ct(t){return new this(t).tanh()}function Lt(t){return E(t=new this(t),t.e+1,1)}(r=function t(e){var r,n,i;function a(t){var e,r,n,i=this;if(!(i instanceof a))return new a(t);if(i.constructor=a,t instanceof a)return i.s=t.s,i.e=t.e,void(i.d=(t=t.d)?t.slice():t);if("number"===(n=typeof t)){if(0===t)return i.s=1/t<0?-1:1,i.e=0,void(i.d=[0]);if(t<0?(t=-t,i.s=-1):i.s=1,t===~~t&&t<1e7){for(e=0,r=t;r>=10;r/=10)e++;return i.e=e,void(i.d=[t])}return 0*t!=0?(t||(i.s=NaN),i.e=NaN,void(i.d=null)):U(i,t.toString())}if("string"!==n)throw Error(h+t);return 45===t.charCodeAt(0)?(t=t.slice(1),i.s=-1):i.s=1,y.test(t)?U(i,t):V(i,t)}if(a.prototype=w,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.EUCLID=9,a.config=a.set=it,a.clone=t,a.isDecimal=ft,a.abs=W,a.acos=Z,a.acosh=X,a.add=J,a.asin=K,a.asinh=$,a.atan=Q,a.atanh=tt,a.atan2=et,a.cbrt=rt,a.ceil=nt,a.cos=at,a.cosh=ot,a.div=st,a.exp=lt,a.floor=ct,a.hypot=ut,a.ln=ht,a.log=pt,a.log10=mt,a.log2=dt,a.max=gt,a.min=vt,a.mod=yt,a.mul=xt,a.pow=bt,a.random=_t,a.round=wt,a.sign=Tt,a.sin=Mt,a.sinh=kt,a.sqrt=At,a.sub=St,a.tan=Et,a.tanh=Ct,a.trunc=Lt,void 0===e&&(e={}),e&&!0!==e.defaults)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],r=0;r<i.length;)e.hasOwnProperty(n=i[r++])||(e[n]=this[n]);return a.config(e),a}(u)).default=r.Decimal=r,l=new r(l),c=new r(c),"undefined"!=typeof e&&e.exports?e.exports=r:(t||(t="undefined"!=typeof self&&self&&self.self==self?self:Function("return this")()),i=t.Decimal,r.noConflict=function(){return t.Decimal=i,r},t.Decimal=r)}(this)},{}],140:[function(t,e,r){e.exports=function(){for(var t=0;t<arguments.length;t++)if(void 0!==arguments[t])return arguments[t]}},{}],141:[function(t,e,r){"use strict";var n=t("incremental-convex-hull"),i=t("uniq");function a(t,e){this.point=t,this.index=e}function o(t,e){for(var r=t.point,n=e.point,i=r.length,a=0;a<i;++a){var o=n[a]-r[a];if(o)return o}return 0}e.exports=function(t,e){var r=t.length;if(0===r)return[];var s=t[0].length;if(s<1)return[];if(1===s)return function(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),a=1;a<t;++a){var o=n[a-1],s=n[a];i[a-1]=[o[1],s[1]]}r&&i.push([-1,i[0][1]],[i[t-1][1],-1]);return i}(r,t,e);for(var l=new Array(r),c=1,u=0;u<r;++u){for(var f=t[u],h=new Array(s+1),p=0,d=0;d<s;++d){var m=f[d];h[d]=m,p+=m*m}h[s]=p,l[u]=new a(h,u),c=Math.max(p,c)}i(l,o),r=l.length;var g=new Array(r+s+1),v=new Array(r+s+1),y=(s+1)*(s+1)*c,x=new Array(s+1);for(u=0;u<=s;++u)x[u]=0;x[s]=y,g[0]=x.slice(),v[0]=-1;for(u=0;u<=s;++u){(h=x.slice())[u]=1,g[u+1]=h,v[u+1]=-1}for(u=0;u<r;++u){var b=l[u];g[u+s+1]=b.point,v[u+s+1]=b.index}var _=n(g,!1);_=e?_.filter((function(t){for(var e=0,r=0;r<=s;++r){var n=v[t[r]];if(n<0&&++e>=2)return!1;t[r]=n}return!0})):_.filter((function(t){for(var e=0;e<=s;++e){var r=v[t[e]];if(r<0)return!1;t[e]=r}return!0}));if(1&s)for(u=0;u<_.length;++u){h=(b=_[u])[0];b[0]=b[1],b[1]=h}return _}},{"incremental-convex-hull":419,uniq:1533}],142:[function(t,e,r){"use strict";e.exports=a;var n=(a.canvas=document.createElement("canvas")).getContext("2d"),i=o([32,126]);function a(t,e){Array.isArray(t)&&(t=t.join(", "));var r,a={},s=16,l=.05;e&&(2===e.length&&"number"==typeof e[0]?r=o(e):Array.isArray(e)?r=e:(e.o?r=o(e.o):e.pairs&&(r=e.pairs),e.fontSize&&(s=e.fontSize),null!=e.threshold&&(l=e.threshold))),r||(r=i),n.font=s+"px "+t;for(var c=0;c<r.length;c++){var u=r[c],f=n.measureText(u[0]).width+n.measureText(u[1]).width,h=n.measureText(u).width;if(Math.abs(f-h)>s*l){var p=(h-f)/s;a[u]=1e3*p}}return a}function o(t){for(var e=[],r=t[0];r<=t[1];r++)for(var n=String.fromCharCode(r),i=t[0];i<t[1];i++){var a=n+String.fromCharCode(i);e.push(a)}return e}a.createPairs=o,a.ascii=i},{}],143:[function(t,e,r){(function(t){(function(){var r=!1;if("undefined"!=typeof Float64Array){var n=new Float64Array(1),i=new Uint32Array(n.buffer);if(n[0]=1,r=!0,1072693248===i[1]){e.exports=function(t){return n[0]=t,[i[0],i[1]]},e.exports.pack=function(t,e){return i[0]=t,i[1]=e,n[0]},e.exports.lo=function(t){return n[0]=t,i[0]},e.exports.hi=function(t){return n[0]=t,i[1]}}else if(1072693248===i[0]){e.exports=function(t){return n[0]=t,[i[1],i[0]]},e.exports.pack=function(t,e){return i[1]=t,i[0]=e,n[0]},e.exports.lo=function(t){return n[0]=t,i[1]},e.exports.hi=function(t){return n[0]=t,i[0]}}else r=!1}if(!r){var a=new t(8);e.exports=function(t){return a.writeDoubleLE(t,0,!0),[a.readUInt32LE(0,!0),a.readUInt32LE(4,!0)]},e.exports.pack=function(t,e){return a.writeUInt32LE(t,0,!0),a.writeUInt32LE(e,4,!0),a.readDoubleLE(0,!0)},e.exports.lo=function(t){return a.writeDoubleLE(t,0,!0),a.readUInt32LE(0,!0)},e.exports.hi=function(t){return a.writeDoubleLE(t,0,!0),a.readUInt32LE(4,!0)}}e.exports.sign=function(t){return e.exports.hi(t)>>>31},e.exports.exponent=function(t){return(e.exports.hi(t)<<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){return!(2146435072&e.exports.hi(t))}}).call(this)}).call(this,t("buffer").Buffer)},{buffer:78}],144:[function(t,e,r){var n=t("abs-svg-path"),i=t("normalize-svg-path"),a={M:"moveTo",C:"bezierCurveTo"};e.exports=function(t,e){t.beginPath(),i(n(e)).forEach((function(e){var r=e[0],n=e.slice(1);t[a[r]].apply(t,n)})),t.closePath()}},{"abs-svg-path":32,"normalize-svg-path":145}],145:[function(t,e,r){var n=Math.PI,i=c(120);function a(t,e,r,n){return["C",t,e,r,n,r,n]}function o(t,e,r,n,i,a){return["C",t/3+2/3*r,e/3+2/3*n,i/3+2/3*r,a/3+2/3*n,i,a]}function s(t,e,r,a,o,c,u,f,h,p){if(p)T=p[0],M=p[1],_=p[2],w=p[3];else{var d=l(t,e,-o);t=d.x,e=d.y;var m=(t-(f=(d=l(f,h,-o)).x))/2,g=(e-(h=d.y))/2,v=m*m/(r*r)+g*g/(a*a);v>1&&(r*=v=Math.sqrt(v),a*=v);var y=r*r,x=a*a,b=(c==u?-1:1)*Math.sqrt(Math.abs((y*x-y*g*g-x*m*m)/(y*g*g+x*m*m)));b==1/0&&(b=1);var _=b*r*g/a+(t+f)/2,w=b*-a*m/r+(e+h)/2,T=Math.asin(((e-w)/a).toFixed(9)),M=Math.asin(((h-w)/a).toFixed(9));(T=t<_?n-T:T)<0&&(T=2*n+T),(M=f<_?n-M:M)<0&&(M=2*n+M),u&&T>M&&(T-=2*n),!u&&M>T&&(M-=2*n)}if(Math.abs(M-T)>i){var k=M,A=f,S=h;M=T+i*(u&&M>T?1:-1);var E=s(f=_+r*Math.cos(M),h=w+a*Math.sin(M),r,a,o,0,u,A,S,[M,k,_,w])}var C=Math.tan((M-T)/4),L=4/3*r*C,P=4/3*a*C,I=[2*t-(t+L*Math.sin(T)),2*e-(e-P*Math.cos(T)),f+L*Math.sin(M),h-P*Math.cos(M),f,h];if(p)return I;E&&(I=I.concat(E));for(var O=0;O<I.length;){var z=l(I[O],I[O+1],o);I[O++]=z.x,I[O++]=z.y}return I}function l(t,e,r){return{x:t*Math.cos(r)-e*Math.sin(r),y:t*Math.sin(r)+e*Math.cos(r)}}function c(t){return t*(n/180)}e.exports=function(t){for(var e,r=[],n=0,i=0,l=0,u=0,f=null,h=null,p=0,d=0,m=0,g=t.length;m<g;m++){var v=t[m],y=v[0];switch(y){case"M":l=v[1],u=v[2];break;case"A":(v=s(p,d,v[1],v[2],c(v[3]),v[4],v[5],v[6],v[7])).unshift("C"),v.length>7&&(r.push(v.splice(0,7)),v.unshift("C"));break;case"S":var x=p,b=d;"C"!=e&&"S"!=e||(x+=x-n,b+=b-i),v=["C",x,b,v[1],v[2],v[3],v[4]];break;case"T":"Q"==e||"T"==e?(f=2*p-f,h=2*d-h):(f=p,h=d),v=o(p,d,f,h,v[1],v[2]);break;case"Q":f=v[1],h=v[2],v=o(p,d,v[1],v[2],v[3],v[4]);break;case"L":v=a(p,d,v[1],v[2]);break;case"H":v=a(p,d,v[1],d);break;case"V":v=a(p,d,p,v[1]);break;case"Z":v=a(p,d,l,u)}e=y,p=v[v.length-2],d=v[v.length-1],v.length>4?(n=v[v.length-4],i=v[v.length-3]):(n=p,i=d),r.push(v)}return r}},{}],146:[function(t,e,r){e.exports=function(t){switch(t){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray}}},{}],147:[function(t,e,r){"use strict";e.exports=function(t,e){switch("undefined"==typeof e&&(e=0),typeof t){case"number":if(t>0)return function(t,e){var r,n;for(r=new Array(t),n=0;n<t;++n)r[n]=e;return r}(0|t,e);break;case"object":if("number"==typeof t.length)return function t(e,r,n){var i=0|e[n];if(i<=0)return[];var a,o=new Array(i);if(n===e.length-1)for(a=0;a<i;++a)o[a]=r;else for(a=0;a<i;++a)o[a]=t(e,r,n+1);return o}(t,e,0)}return[]}},{}],148:[function(t,e,r){"use strict";function n(t,e,r){r=r||2;var n,s,l,c,u,p,d,g=e&&e.length,v=g?e[0]*r:t.length,y=i(t,0,v,r,!0),x=[];if(!y||y.next===y.prev)return x;if(g&&(y=function(t,e,r,n){var o,s,l,c,u,p=[];for(o=0,s=e.length;o<s;o++)l=e[o]*n,c=o<s-1?e[o+1]*n:t.length,(u=i(t,l,c,n,!1))===u.next&&(u.steiner=!0),p.push(m(u));for(p.sort(f),o=0;o<p.length;o++)h(p[o],r),r=a(r,r.next);return r}(t,e,y,r)),t.length>80*r){n=l=t[0],s=c=t[1];for(var b=r;b<v;b+=r)(u=t[b])<n&&(n=u),(p=t[b+1])<s&&(s=p),u>l&&(l=u),p>c&&(c=p);d=0!==(d=Math.max(l-n,c-s))?1/d:0}return o(y,x,r,n,s,d),x}function i(t,e,r,n,i){var a,o;if(i===E(t,e,r,n)>0)for(a=e;a<r;a+=n)o=k(a,t[a],t[a+1],o);else for(a=r-n;a>=e;a-=n)o=k(a,t[a],t[a+1],o);return o&&x(o,o.next)&&(A(o),o=o.next),o}function a(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!x(n,n.next)&&0!==y(n.prev,n,n.next))n=n.next;else{if(A(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function o(t,e,r,n,i,f,h){if(t){!h&&f&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=d(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,a,o,s,l,c=1;do{for(r=t,t=null,a=null,o=0;r;){for(o++,n=r,s=0,e=0;e<c&&(s++,n=n.nextZ);e++);for(l=c;s>0||l>0&&n;)0!==s&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;r=n}a.nextZ=null,c*=2}while(o>1)}(i)}(t,n,i,f);for(var p,m,g=t;t.prev!==t.next;)if(p=t.prev,m=t.next,f?l(t,n,i,f):s(t))e.push(p.i/r),e.push(t.i/r),e.push(m.i/r),A(t),t=m.next,g=m.next;else if((t=m)===g){h?1===h?o(t=c(a(t),e,r),e,r,n,i,f,2):2===h&&u(t,e,r,n,i,f):o(a(t),e,r,n,i,f,1);break}}}function s(t){var e=t.prev,r=t,n=t.next;if(y(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(g(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&y(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function l(t,e,r,n){var i=t.prev,a=t,o=t.next;if(y(i,a,o)>=0)return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,l=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,c=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,f=d(s,l,e,r,n),h=d(c,u,e,r,n),p=t.prevZ,m=t.nextZ;p&&p.z>=f&&m&&m.z<=h;){if(p!==t.prev&&p!==t.next&&g(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&y(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,m!==t.prev&&m!==t.next&&g(i.x,i.y,a.x,a.y,o.x,o.y,m.x,m.y)&&y(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;p&&p.z>=f;){if(p!==t.prev&&p!==t.next&&g(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&y(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;m&&m.z<=h;){if(m!==t.prev&&m!==t.next&&g(i.x,i.y,a.x,a.y,o.x,o.y,m.x,m.y)&&y(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function c(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!x(i,o)&&b(i,n,n.next,o)&&T(i,o)&&T(o,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(o.i/r),A(n),A(n.next),n=t=o),n=n.next}while(n!==t);return a(n)}function u(t,e,r,n,i,s){var l=t;do{for(var c=l.next.next;c!==l.prev;){if(l.i!==c.i&&v(l,c)){var u=M(l,c);return l=a(l,l.next),u=a(u,u.next),o(l,e,r,n,i,s),void o(u,e,r,n,i,s)}c=c.next}l=l.next}while(l!==t)}function f(t,e){return t.x-e.x}function h(t,e){if(e=function(t,e){var r,n=e,i=t.x,a=t.y,o=-1/0;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){var s=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>o){if(o=s,s===i){if(a===n.y)return n;if(a===n.next.y)return n.next}r=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!r)return null;if(i===o)return r;var l,c=r,u=r.x,f=r.y,h=1/0;n=r;do{i>=n.x&&n.x>=u&&i!==n.x&&g(a<f?i:o,a,u,f,a<f?o:i,a,n.x,n.y)&&(l=Math.abs(a-n.y)/(i-n.x),T(n,t)&&(l<h||l===h&&(n.x>r.x||n.x===r.x&&p(r,n)))&&(r=n,h=l)),n=n.next}while(n!==c);return r}(t,e)){var r=M(e,t);a(e,e.next),a(r,r.next)}}function p(t,e){return y(t.prev,t,e.prev)<0&&y(e.next,t,t.next)<0}function d(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function m(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function g(t,e,r,n,i,a,o,s){return(i-o)*(e-s)-(t-o)*(a-s)>=0&&(t-o)*(n-s)-(r-o)*(e-s)>=0&&(r-o)*(a-s)-(i-o)*(n-s)>=0}function v(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&b(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(T(t,e)&&T(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(y(t.prev,t,e.prev)||y(t,e.prev,e))||x(t,e)&&y(t.prev,t,t.next)>0&&y(e.prev,e,e.next)>0)}function y(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function x(t,e){return t.x===e.x&&t.y===e.y}function b(t,e,r,n){var i=w(y(t,e,r)),a=w(y(t,e,n)),o=w(y(r,n,t)),s=w(y(r,n,e));return i!==a&&o!==s||(!(0!==i||!_(t,r,e))||(!(0!==a||!_(t,n,e))||(!(0!==o||!_(r,t,n))||!(0!==s||!_(r,e,n)))))}function _(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function w(t){return t>0?1:t<0?-1:0}function T(t,e){return y(t.prev,t,t.next)<0?y(t,e,t.next)>=0&&y(t,t.prev,e)>=0:y(t,e,t.prev)<0||y(t,t.next,e)<0}function M(t,e){var r=new S(t.i,t.x,t.y),n=new S(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,a.next=n,n.prev=a,n}function k(t,e,r,n){var i=new S(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function A(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function S(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function E(t,e,r,n){for(var i=0,a=e,o=r-n;a<r;a+=n)i+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return i}e.exports=n,e.exports.default=n,n.deviation=function(t,e,r,n){var i=e&&e.length,a=i?e[0]*r:t.length,o=Math.abs(E(t,0,a,r));if(i)for(var s=0,l=e.length;s<l;s++){var c=e[s]*r,u=s<l-1?e[s+1]*r:t.length;o-=Math.abs(E(t,c,u,r))}var f=0;for(s=0;s<n.length;s+=3){var h=n[s]*r,p=n[s+1]*r,d=n[s+2]*r;f+=Math.abs((t[h]-t[d])*(t[p+1]-t[h+1])-(t[h]-t[p])*(t[d+1]-t[h+1]))}return 0===o&&0===f?0:Math.abs((f-o)/o)},n.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var a=0;a<t[i].length;a++)for(var o=0;o<e;o++)r.vertices.push(t[i][a][o]);i>0&&(n+=t[i-1].length,r.holes.push(n))}return r}},{}],149:[function(t,e,r){"use strict";e.exports=function(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var i=0;i<r;++i){var a=t[i];e=Math.max(e,a[0],a[1])}e=1+(0|e)}e|=0;var o=new Array(e);for(i=0;i<e;++i)o[i]=[];for(i=0;i<r;++i){a=t[i];o[a[0]].push(a[1]),o[a[1]].push(a[0])}for(var s=0;s<e;++s)n(o[s],(function(t,e){return t-e}));return o};var n=t("uniq")},{uniq:1533}],150:[function(t,e,r){var n=t("strongly-connected-components");e.exports=function(t,e){var r,i=[],a=[],o=[],s={},l=[];function c(t){var e,n,i=!1;for(a.push(t),o[t]=!0,e=0;e<l[t].length;e++)(n=l[t][e])===r?(u(r,a),i=!0):o[n]||(i=c(n));if(i)!function t(e){o[e]=!1,s.hasOwnProperty(e)&&Object.keys(s[e]).forEach((function(r){delete s[e][r],o[r]&&t(r)}))}(t);else for(e=0;e<l[t].length;e++){n=l[t][e];var f=s[n];f||(f={},s[n]=f),f[n]=!0}return a.pop(),i}function u(t,r){var n=[].concat(r).concat(t);e?e(n):i.push(n)}function f(e){!function(e){for(var r=0;r<t.length;r++)(r<e||!t[r])&&(t[r]=[]),t[r]=t[r].filter((function(t){return t>=e}))}(e);for(var r,i=n(t).components.filter((function(t){return t.length>1})),a=1/0,o=0;o<i.length;o++)for(var s=0;s<i[o].length;s++)i[o][s]<a&&(a=i[o][s],r=o);var l=i[r];return!!l&&{leastVertex:a,adjList:t.map((function(t,e){return-1===l.indexOf(e)?[]:t.filter((function(t){return-1!==l.indexOf(t)}))}))}}r=0;for(var h=t.length;r<h;){var p=f(r);if(r=p.leastVertex,l=p.adjList){for(var d=0;d<l.length;d++)for(var m=0;m<l[d].length;m++){var g=l[d][m];o[+g]=!1,s[g]={}}c(r),r+=1}else r=h}return e?void 0:i}},{"strongly-connected-components":1504}],151:[function(t,e,r){"use strict";var n=t("../../object/valid-value");e.exports=function(){return n(this).length=0,this}},{"../../object/valid-value":182}],152:[function(t,e,r){"use strict";e.exports=t("./is-implemented")()?Array.from:t("./shim")},{"./is-implemented":153,"./shim":154}],153:[function(t,e,r){"use strict";e.exports=function(){var t,e,r=Array.from;return"function"==typeof r&&(e=r(t=["raz","dwa"]),Boolean(e&&e!==t&&"dwa"===e[1]))}},{}],154:[function(t,e,r){"use strict";var n=t("es6-symbol").iterator,i=t("../../function/is-arguments"),a=t("../../function/is-function"),o=t("../../number/to-pos-integer"),s=t("../../object/valid-callable"),l=t("../../object/valid-value"),c=t("../../object/is-value"),u=t("../../string/is-string"),f=Array.isArray,h=Function.prototype.call,p={configurable:!0,enumerable:!0,writable:!0,value:null},d=Object.defineProperty;e.exports=function(t){var e,r,m,g,v,y,x,b,_,w,T=arguments[1],M=arguments[2];if(t=Object(l(t)),c(T)&&s(T),this&&this!==Array&&a(this))e=this;else{if(!T){if(i(t))return 1!==(v=t.length)?Array.apply(null,t):((g=new Array(1))[0]=t[0],g);if(f(t)){for(g=new Array(v=t.length),r=0;r<v;++r)g[r]=t[r];return g}}g=[]}if(!f(t))if(void 0!==(_=t[n])){for(x=s(_).call(t),e&&(g=new e),b=x.next(),r=0;!b.done;)w=T?h.call(T,M,b.value,r):b.value,e?(p.value=w,d(g,r,p)):g[r]=w,b=x.next(),++r;v=r}else if(u(t)){for(v=t.length,e&&(g=new e),r=0,m=0;r<v;++r)w=t[r],r+1<v&&(y=w.charCodeAt(0))>=55296&&y<=56319&&(w+=t[++r]),w=T?h.call(T,M,w,m):w,e?(p.value=w,d(g,m,p)):g[m]=w,++m;v=m}if(void 0===v)for(v=o(t.length),e&&(g=new e(v)),r=0;r<v;++r)w=T?h.call(T,M,t[r],r):t[r],e?(p.value=w,d(g,r,p)):g[r]=w;return e&&(p.value=null,g.length=v),g}},{"../../function/is-arguments":155,"../../function/is-function":156,"../../number/to-pos-integer":162,"../../object/is-value":171,"../../object/valid-callable":180,"../../object/valid-value":182,"../../string/is-string":186,"es6-symbol":196}],155:[function(t,e,r){"use strict";var n=Object.prototype.toString,i=n.call(function(){return arguments}());e.exports=function(t){return n.call(t)===i}},{}],156:[function(t,e,r){"use strict";var n=Object.prototype.toString,i=RegExp.prototype.test.bind(/^[object [A-Za-z0-9]*Function]$/);e.exports=function(t){return"function"==typeof t&&i(n.call(t))}},{}],157:[function(t,e,r){"use strict";e.exports=function(){}},{}],158:[function(t,e,r){"use strict";e.exports=t("./is-implemented")()?Math.sign:t("./shim")},{"./is-implemented":159,"./shim":160}],159:[function(t,e,r){"use strict";e.exports=function(){var t=Math.sign;return"function"==typeof t&&(1===t(10)&&-1===t(-20))}},{}],160:[function(t,e,r){"use strict";e.exports=function(t){return t=Number(t),isNaN(t)||0===t?t:t>0?1:-1}},{}],161:[function(t,e,r){"use strict";var n=t("../math/sign"),i=Math.abs,a=Math.floor;e.exports=function(t){return isNaN(t)?0:0!==(t=Number(t))&&isFinite(t)?n(t)*a(i(t)):t}},{"../math/sign":158}],162:[function(t,e,r){"use strict";var n=t("./to-integer"),i=Math.max;e.exports=function(t){return i(0,n(t))}},{"./to-integer":161}],163:[function(t,e,r){"use strict";var n=t("./valid-callable"),i=t("./valid-value"),a=Function.prototype.bind,o=Function.prototype.call,s=Object.keys,l=Object.prototype.propertyIsEnumerable;e.exports=function(t,e){return function(r,c){var u,f=arguments[2],h=arguments[3];return r=Object(i(r)),n(c),u=s(r),h&&u.sort("function"==typeof h?a.call(h,r):void 0),"function"!=typeof t&&(t=u[t]),o.call(t,u,(function(t,n){return l.call(r,t)?o.call(c,f,r[t],t,r,n):e}))}}},{"./valid-callable":180,"./valid-value":182}],164:[function(t,e,r){"use strict";e.exports=t("./is-implemented")()?Object.assign:t("./shim")},{"./is-implemented":165,"./shim":166}],165:[function(t,e,r){"use strict";e.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},{}],166:[function(t,e,r){"use strict";var n=t("../keys"),i=t("../valid-value"),a=Math.max;e.exports=function(t,e){var r,o,s,l=a(arguments.length,2);for(t=Object(i(t)),s=function(n){try{t[n]=e[n]}catch(t){r||(r=t)}},o=1;o<l;++o)n(e=arguments[o]).forEach(s);if(void 0!==r)throw r;return t}},{"../keys":172,"../valid-value":182}],167:[function(t,e,r){"use strict";var n=t("../array/from"),i=t("./assign"),a=t("./valid-value");e.exports=function(t){var e=Object(a(t)),r=arguments[1],o=Object(arguments[2]);if(e!==t&&!r)return e;var s={};return r?n(r,(function(e){(o.ensure||e in t)&&(s[e]=t[e])})):i(s,t),s}},{"../array/from":152,"./assign":164,"./valid-value":182}],168:[function(t,e,r){"use strict";var n,i,a,o,s=Object.create;t("./set-prototype-of/is-implemented")()||(n=t("./set-prototype-of/shim")),e.exports=n?1!==n.level?s:(i={},a={},o={configurable:!1,enumerable:!1,writable:!0,value:void 0},Object.getOwnPropertyNames(Object.prototype).forEach((function(t){a[t]="__proto__"!==t?o:{configurable:!0,enumerable:!1,writable:!0,value:void 0}})),Object.defineProperties(i,a),Object.defineProperty(n,"nullPolyfill",{configurable:!1,enumerable:!1,writable:!1,value:i}),function(t,e){return s(null===t?i:t,e)}):s},{"./set-prototype-of/is-implemented":178,"./set-prototype-of/shim":179}],169:[function(t,e,r){"use strict";e.exports=t("./_iterate")("forEach")},{"./_iterate":163}],170:[function(t,e,r){"use strict";var n=t("./is-value"),i={function:!0,object:!0};e.exports=function(t){return n(t)&&i[typeof t]||!1}},{"./is-value":171}],171:[function(t,e,r){"use strict";var n=t("../function/noop")();e.exports=function(t){return t!==n&&null!==t}},{"../function/noop":157}],172:[function(t,e,r){"use strict";e.exports=t("./is-implemented")()?Object.keys:t("./shim")},{"./is-implemented":173,"./shim":174}],173:[function(t,e,r){"use strict";e.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},{}],174:[function(t,e,r){"use strict";var n=t("../is-value"),i=Object.keys;e.exports=function(t){return i(n(t)?Object(t):t)}},{"../is-value":171}],175:[function(t,e,r){"use strict";var n=t("./valid-callable"),i=t("./for-each"),a=Function.prototype.call;e.exports=function(t,e){var r={},o=arguments[2];return n(e),i(t,(function(t,n,i,s){r[n]=a.call(e,o,t,n,i,s)})),r}},{"./for-each":169,"./valid-callable":180}],176:[function(t,e,r){"use strict";var n=t("./is-value"),i=Array.prototype.forEach,a=Object.create,o=function(t,e){var r;for(r in t)e[r]=t[r]};e.exports=function(t){var e=a(null);return i.call(arguments,(function(t){n(t)&&o(Object(t),e)})),e}},{"./is-value":171}],177:[function(t,e,r){"use strict";e.exports=t("./is-implemented")()?Object.setPrototypeOf:t("./shim")},{"./is-implemented":178,"./shim":179}],178:[function(t,e,r){"use strict";var n=Object.create,i=Object.getPrototypeOf,a={};e.exports=function(){var t=Object.setPrototypeOf,e=arguments[0]||n;return"function"==typeof t&&i(t(e(null),a))===a}},{}],179:[function(t,e,r){"use strict";var n,i=t("../is-object"),a=t("../valid-value"),o=Object.prototype.isPrototypeOf,s=Object.defineProperty,l={configurable:!0,enumerable:!1,writable:!0,value:void 0};n=function(t,e){if(a(t),null===e||i(e))return t;throw new TypeError("Prototype must be null or an object")},e.exports=function(t){var e,r;return t?(2===t.level?t.set?(r=t.set,e=function(t,e){return r.call(n(t,e),e),t}):e=function(t,e){return n(t,e).__proto__=e,t}:e=function t(e,r){var i;return n(e,r),(i=o.call(t.nullPolyfill,e))&&delete t.nullPolyfill.__proto__,null===r&&(r=t.nullPolyfill),e.__proto__=r,i&&s(t.nullPolyfill,"__proto__",l),e},Object.defineProperty(e,"level",{configurable:!1,enumerable:!1,writable:!1,value:t.level})):null}(function(){var t,e=Object.create(null),r={},n=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__");if(n){try{(t=n.set).call(e,r)}catch(t){}if(Object.getPrototypeOf(e)===r)return{set:t,level:2}}return e.__proto__=r,Object.getPrototypeOf(e)===r?{level:2}:((e={}).__proto__=r,Object.getPrototypeOf(e)===r&&{level:1})}()),t("../create")},{"../create":168,"../is-object":170,"../valid-value":182}],180:[function(t,e,r){"use strict";e.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},{}],181:[function(t,e,r){"use strict";var n=t("./is-object");e.exports=function(t){if(!n(t))throw new TypeError(t+" is not an Object");return t}},{"./is-object":170}],182:[function(t,e,r){"use strict";var n=t("./is-value");e.exports=function(t){if(!n(t))throw new TypeError("Cannot use null or undefined");return t}},{"./is-value":171}],183:[function(t,e,r){"use strict";e.exports=t("./is-implemented")()?String.prototype.contains:t("./shim")},{"./is-implemented":184,"./shim":185}],184:[function(t,e,r){"use strict";var n="razdwatrzy";e.exports=function(){return"function"==typeof n.contains&&(!0===n.contains("dwa")&&!1===n.contains("foo"))}},{}],185:[function(t,e,r){"use strict";var n=String.prototype.indexOf;e.exports=function(t){return n.call(this,t,arguments[1])>-1}},{}],186:[function(t,e,r){"use strict";var n=Object.prototype.toString,i=n.call("");e.exports=function(t){return"string"==typeof t||t&&"object"==typeof t&&(t instanceof String||n.call(t)===i)||!1}},{}],187:[function(t,e,r){"use strict";var n=Object.create(null),i=Math.random;e.exports=function(){var t;do{t=i().toString(36).slice(2)}while(n[t]);return t}},{}],188:[function(t,e,r){"use strict";var n,i=t("es5-ext/object/set-prototype-of"),a=t("es5-ext/string/#/contains"),o=t("d"),s=t("es6-symbol"),l=t("./"),c=Object.defineProperty;n=e.exports=function(t,e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");l.call(this,t),e=e?a.call(e,"key+value")?"key+value":a.call(e,"key")?"key":"value":"value",c(this,"__kind__",o("",e))},i&&i(n,l),delete n.prototype.constructor,n.prototype=Object.create(l.prototype,{_resolve:o((function(t){return"value"===this.__kind__?this.__list__[t]:"key+value"===this.__kind__?[t,this.__list__[t]]:t}))}),c(n.prototype,s.toStringTag,o("c","Array Iterator"))},{"./":191,d:124,"es5-ext/object/set-prototype-of":177,"es5-ext/string/#/contains":183,"es6-symbol":196}],189:[function(t,e,r){"use strict";var n=t("es5-ext/function/is-arguments"),i=t("es5-ext/object/valid-callable"),a=t("es5-ext/string/is-string"),o=t("./get"),s=Array.isArray,l=Function.prototype.call,c=Array.prototype.some;e.exports=function(t,e){var r,u,f,h,p,d,m,g,v=arguments[2];if(s(t)||n(t)?r="array":a(t)?r="string":t=o(t),i(e),f=function(){h=!0},"array"!==r)if("string"!==r)for(u=t.next();!u.done;){if(l.call(e,v,u.value,f),h)return;u=t.next()}else for(d=t.length,p=0;p<d&&(m=t[p],p+1<d&&(g=m.charCodeAt(0))>=55296&&g<=56319&&(m+=t[++p]),l.call(e,v,m,f),!h);++p);else c.call(t,(function(t){return l.call(e,v,t,f),h}))}},{"./get":190,"es5-ext/function/is-arguments":155,"es5-ext/object/valid-callable":180,"es5-ext/string/is-string":186}],190:[function(t,e,r){"use strict";var n=t("es5-ext/function/is-arguments"),i=t("es5-ext/string/is-string"),a=t("./array"),o=t("./string"),s=t("./valid-iterable"),l=t("es6-symbol").iterator;e.exports=function(t){return"function"==typeof s(t)[l]?t[l]():n(t)?new a(t):i(t)?new o(t):new a(t)}},{"./array":188,"./string":193,"./valid-iterable":194,"es5-ext/function/is-arguments":155,"es5-ext/string/is-string":186,"es6-symbol":196}],191:[function(t,e,r){"use strict";var n,i=t("es5-ext/array/#/clear"),a=t("es5-ext/object/assign"),o=t("es5-ext/object/valid-callable"),s=t("es5-ext/object/valid-value"),l=t("d"),c=t("d/auto-bind"),u=t("es6-symbol"),f=Object.defineProperty,h=Object.defineProperties;e.exports=n=function(t,e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");h(this,{__list__:l("w",s(t)),__context__:l("w",e),__nextIndex__:l("w",0)}),e&&(o(e.on),e.on("_add",this._onAdd),e.on("_delete",this._onDelete),e.on("_clear",this._onClear))},delete n.prototype.constructor,h(n.prototype,a({_next:l((function(){var t;if(this.__list__)return this.__redo__&&void 0!==(t=this.__redo__.shift())?t:this.__nextIndex__<this.__list__.length?this.__nextIndex__++:void this._unBind()})),next:l((function(){return this._createResult(this._next())})),_createResult:l((function(t){return void 0===t?{done:!0,value:void 0}:{done:!1,value:this._resolve(t)}})),_resolve:l((function(t){return this.__list__[t]})),_unBind:l((function(){this.__list__=null,delete this.__redo__,this.__context__&&(this.__context__.off("_add",this._onAdd),this.__context__.off("_delete",this._onDelete),this.__context__.off("_clear",this._onClear),this.__context__=null)})),toString:l((function(){return"[object "+(this[u.toStringTag]||"Object")+"]"}))},c({_onAdd:l((function(t){t>=this.__nextIndex__||(++this.__nextIndex__,this.__redo__?(this.__redo__.forEach((function(e,r){e>=t&&(this.__redo__[r]=++e)}),this),this.__redo__.push(t)):f(this,"__redo__",l("c",[t])))})),_onDelete:l((function(t){var e;t>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&(-1!==(e=this.__redo__.indexOf(t))&&this.__redo__.splice(e,1),this.__redo__.forEach((function(e,r){e>t&&(this.__redo__[r]=--e)}),this)))})),_onClear:l((function(){this.__redo__&&i.call(this.__redo__),this.__nextIndex__=0}))}))),f(n.prototype,u.iterator,l((function(){return this})))},{d:124,"d/auto-bind":123,"es5-ext/array/#/clear":151,"es5-ext/object/assign":164,"es5-ext/object/valid-callable":180,"es5-ext/object/valid-value":182,"es6-symbol":196}],192:[function(t,e,r){"use strict";var n=t("es5-ext/function/is-arguments"),i=t("es5-ext/object/is-value"),a=t("es5-ext/string/is-string"),o=t("es6-symbol").iterator,s=Array.isArray;e.exports=function(t){return!!i(t)&&(!!s(t)||(!!a(t)||(!!n(t)||"function"==typeof t[o])))}},{"es5-ext/function/is-arguments":155,"es5-ext/object/is-value":171,"es5-ext/string/is-string":186,"es6-symbol":196}],193:[function(t,e,r){"use strict";var n,i=t("es5-ext/object/set-prototype-of"),a=t("d"),o=t("es6-symbol"),s=t("./"),l=Object.defineProperty;n=e.exports=function(t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");t=String(t),s.call(this,t),l(this,"__length__",a("",t.length))},i&&i(n,s),delete n.prototype.constructor,n.prototype=Object.create(s.prototype,{_next:a((function(){if(this.__list__)return this.__nextIndex__<this.__length__?this.__nextIndex__++:void this._unBind()})),_resolve:a((function(t){var e,r=this.__list__[t];return this.__nextIndex__===this.__length__?r:(e=r.charCodeAt(0))>=55296&&e<=56319?r+this.__list__[this.__nextIndex__++]:r}))}),l(n.prototype,o.toStringTag,a("c","String Iterator"))},{"./":191,d:124,"es5-ext/object/set-prototype-of":177,"es6-symbol":196}],194:[function(t,e,r){"use strict";var n=t("./is-iterable");e.exports=function(t){if(!n(t))throw new TypeError(t+" is not iterable");return t}},{"./is-iterable":192}],195:[function(t,e,r){(function(n,i){(function(){
/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
* @version v4.2.8+1e68dce6
*/
!function(t,n){"object"==typeof r&&"undefined"!=typeof e?e.exports=n():t.ES6Promise=n()}(this,(function(){"use strict";function e(t){return"function"==typeof t}var r=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},a=0,o=void 0,s=void 0,l=function(t,e){m[a]=t,m[a+1]=e,2===(a+=2)&&(s?s(g):_())};var c="undefined"!=typeof window?window:void 0,u=c||{},f=u.MutationObserver||u.WebKitMutationObserver,h="undefined"==typeof self&&"undefined"!=typeof n&&"[object process]"==={}.toString.call(n),p="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(g,1)}}var m=new Array(1e3);function g(){for(var t=0;t<a;t+=2){(0,m[t])(m[t+1]),m[t]=void 0,m[t+1]=void 0}a=0}var v,y,x,b,_=void 0;function w(t,e){var r=this,n=new this.constructor(k);void 0===n[M]&&D(n);var i=r._state;if(i){var a=arguments[i-1];l((function(){return O(i,n,a,r._result)}))}else P(r,n,t,e);return n}function T(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(k);return S(e,t),e}h?_=function(){return n.nextTick(g)}:f?(y=0,x=new f(g),b=document.createTextNode(""),x.observe(b,{characterData:!0}),_=function(){b.data=y=++y%2}):p?((v=new MessageChannel).port1.onmessage=g,_=function(){return v.port2.postMessage(0)}):_=void 0===c&&"function"==typeof t?function(){try{var t=Function("return this")().require("vertx");return"undefined"!=typeof(o=t.runOnLoop||t.runOnContext)?function(){o(g)}:d()}catch(t){return d()}}():d();var M=Math.random().toString(36).substring(2);function k(){}function A(t,r,n){r.constructor===t.constructor&&n===w&&r.constructor.resolve===T?function(t,e){1===e._state?C(t,e._result):2===e._state?L(t,e._result):P(e,void 0,(function(e){return S(t,e)}),(function(e){return L(t,e)}))}(t,r):void 0===n?C(t,r):e(n)?function(t,e,r){l((function(t){var n=!1,i=function(t,e,r,n){try{t.call(e,r,n)}catch(t){return t}}(r,e,(function(r){n||(n=!0,e!==r?S(t,r):C(t,r))}),(function(e){n||(n=!0,L(t,e))}),t._label);!n&&i&&(n=!0,L(t,i))}),t)}(t,r,n):C(t,r)}function S(t,e){if(t===e)L(t,new TypeError("You cannot resolve a promise with itself"));else if(i=typeof(n=e),null===n||"object"!==i&&"function"!==i)C(t,e);else{var r=void 0;try{r=e.then}catch(e){return void L(t,e)}A(t,e,r)}var n,i}function E(t){t._onerror&&t._onerror(t._result),I(t)}function C(t,e){void 0===t._state&&(t._result=e,t._state=1,0!==t._subscribers.length&&l(I,t))}function L(t,e){void 0===t._state&&(t._state=2,t._result=e,l(E,t))}function P(t,e,r,n){var i=t._subscribers,a=i.length;t._onerror=null,i[a]=e,i[a+1]=r,i[a+2]=n,0===a&&t._state&&l(I,t)}function I(t){var e=t._subscribers,r=t._state;if(0!==e.length){for(var n=void 0,i=void 0,a=t._result,o=0;o<e.length;o+=3)n=e[o],i=e[o+r],n?O(r,n,i,a):i(a);t._subscribers.length=0}}function O(t,r,n,i){var a=e(n),o=void 0,s=void 0,l=!0;if(a){try{o=n(i)}catch(t){l=!1,s=t}if(r===o)return void L(r,new TypeError("A promises callback cannot return that same promise."))}else o=i;void 0!==r._state||(a&&l?S(r,o):!1===l?L(r,s):1===t?C(r,o):2===t&&L(r,o))}var z=0;function D(t){t[M]=z++,t._state=void 0,t._result=void 0,t._subscribers=[]}var N=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(k),this.promise[M]||D(this.promise),r(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?C(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&C(this.promise,this._result))):L(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;void 0===this._state&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var r=this._instanceConstructor,n=r.resolve;if(n===T){var i=void 0,a=void 0,o=!1;try{i=t.then}catch(t){o=!0,a=t}if(i===w&&void 0!==t._state)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(r===R){var s=new r(k);o?L(s,a):A(s,t,i),this._willSettleAt(s,e)}else this._willSettleAt(new r((function(e){return e(t)})),e)}else this._willSettleAt(n(t),e)},t.prototype._settledAt=function(t,e,r){var n=this.promise;void 0===n._state&&(this._remaining--,2===t?L(n,r):this._result[e]=r),0===this._remaining&&C(n,this._result)},t.prototype._willSettleAt=function(t,e){var r=this;P(t,void 0,(function(t){return r._settledAt(1,e,t)}),(function(t){return r._settledAt(2,e,t)}))},t}();var R=function(){function t(e){this[M]=z++,this._result=this._state=void 0,this._subscribers=[],k!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(t,e){try{e((function(e){S(t,e)}),(function(e){L(t,e)}))}catch(e){L(t,e)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var r=this.constructor;return e(t)?this.then((function(e){return r.resolve(t()).then((function(){return e}))}),(function(e){return r.resolve(t()).then((function(){throw e}))})):this.then(t,t)},t}();return R.prototype.then=w,R.all=function(t){return new N(this,t).promise},R.race=function(t){var e=this;return r(t)?new e((function(r,n){for(var i=t.length,a=0;a<i;a++)e.resolve(t[a]).then(r,n)})):new e((function(t,e){return e(new TypeError("You must pass an array to race."))}))},R.resolve=T,R.reject=function(t){var e=new this(k);return L(e,t),e},R._setScheduler=function(t){s=t},R._setAsap=function(t){l=t},R._asap=l,R.polyfill=function(){var t=void 0;if("undefined"!=typeof i)t=i;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var r=null;try{r=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===r&&!e.cast)return}t.Promise=R},R.Promise=R,R}))}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:1465}],196:[function(t,e,r){"use strict";e.exports=t("./is-implemented")()?t("ext/global-this").Symbol:t("./polyfill")},{"./is-implemented":197,"./polyfill":202,"ext/global-this":211}],197:[function(t,e,r){"use strict";var n=t("ext/global-this"),i={object:!0,symbol:!0};e.exports=function(){var t,e=n.Symbol;if("function"!=typeof e)return!1;t=e("test symbol");try{String(t)}catch(t){return!1}return!!i[typeof e.iterator]&&(!!i[typeof e.toPrimitive]&&!!i[typeof e.toStringTag])}},{"ext/global-this":211}],198:[function(t,e,r){"use strict";e.exports=function(t){return!!t&&("symbol"==typeof t||!!t.constructor&&("Symbol"===t.constructor.name&&"Symbol"===t[t.constructor.toStringTag]))}},{}],199:[function(t,e,r){"use strict";var n=t("d"),i=Object.create,a=Object.defineProperty,o=Object.prototype,s=i(null);e.exports=function(t){for(var e,r,i=0;s[t+(i||"")];)++i;return s[t+=i||""]=!0,a(o,e="@@"+t,n.gs(null,(function(t){r||(r=!0,a(this,e,n(t)),r=!1)}))),e}},{d:124}],200:[function(t,e,r){"use strict";var n=t("d"),i=t("ext/global-this").Symbol;e.exports=function(t){return Object.defineProperties(t,{hasInstance:n("",i&&i.hasInstance||t("hasInstance")),isConcatSpreadable:n("",i&&i.isConcatSpreadable||t("isConcatSpreadable")),iterator:n("",i&&i.iterator||t("iterator")),match:n("",i&&i.match||t("match")),replace:n("",i&&i.replace||t("replace")),search:n("",i&&i.search||t("search")),species:n("",i&&i.species||t("species")),split:n("",i&&i.split||t("split")),toPrimitive:n("",i&&i.toPrimitive||t("toPrimitive")),toStringTag:n("",i&&i.toStringTag||t("toStringTag")),unscopables:n("",i&&i.unscopables||t("unscopables"))})}},{d:124,"ext/global-this":211}],201:[function(t,e,r){"use strict";var n=t("d"),i=t("../../../validate-symbol"),a=Object.create(null);e.exports=function(t){return Object.defineProperties(t,{for:n((function(e){return a[e]?a[e]:a[e]=t(String(e))})),keyFor:n((function(t){var e;for(e in i(t),a)if(a[e]===t)return e}))})}},{"../../../validate-symbol":203,d:124}],202:[function(t,e,r){"use strict";var n,i,a,o=t("d"),s=t("./validate-symbol"),l=t("ext/global-this").Symbol,c=t("./lib/private/generate-name"),u=t("./lib/private/setup/standard-symbols"),f=t("./lib/private/setup/symbol-registry"),h=Object.create,p=Object.defineProperties,d=Object.defineProperty;if("function"==typeof l)try{String(l()),a=!0}catch(t){}else l=null;i=function(t){if(this instanceof i)throw new TypeError("Symbol is not a constructor");return n(t)},e.exports=n=function t(e){var r;if(this instanceof t)throw new TypeError("Symbol is not a constructor");return a?l(e):(r=h(i.prototype),e=void 0===e?"":String(e),p(r,{__description__:o("",e),__name__:o("",c(e))}))},u(n),f(n),p(i.prototype,{constructor:o(n),toString:o("",(function(){return this.__name__}))}),p(n.prototype,{toString:o((function(){return"Symbol ("+s(this).__description__+")"})),valueOf:o((function(){return s(this)}))}),d(n.prototype,n.toPrimitive,o("",(function(){var t=s(this);return"symbol"==typeof t?t:t.toString()}))),d(n.prototype,n.toStringTag,o("c","Symbol")),d(i.prototype,n.toStringTag,o("c",n.prototype[n.toStringTag])),d(i.prototype,n.toPrimitive,o("c",n.prototype[n.toPrimitive]))},{"./lib/private/generate-name":199,"./lib/private/setup/standard-symbols":200,"./lib/private/setup/symbol-registry":201,"./validate-symbol":203,d:124,"ext/global-this":211}],203:[function(t,e,r){"use strict";var n=t("./is-symbol");e.exports=function(t){if(!n(t))throw new TypeError(t+" is not a symbol");return t}},{"./is-symbol":198}],204:[function(t,e,r){"use strict";e.exports=t("./is-implemented")()?WeakMap:t("./polyfill")},{"./is-implemented":205,"./polyfill":207}],205:[function(t,e,r){"use strict";e.exports=function(){var t,e;if("function"!=typeof WeakMap)return!1;try{t=new WeakMap([[e={},"one"],[{},"two"],[{},"three"]])}catch(t){return!1}return"[object WeakMap]"===String(t)&&("function"==typeof t.set&&(t.set({},1)===t&&("function"==typeof t.delete&&("function"==typeof t.has&&"one"===t.get(e)))))}},{}],206:[function(t,e,r){"use strict";e.exports="function"==typeof WeakMap&&"[object WeakMap]"===Object.prototype.toString.call(new WeakMap)},{}],207:[function(t,e,r){"use strict";var n,i=t("es5-ext/object/is-value"),a=t("es5-ext/object/set-prototype-of"),o=t("es5-ext/object/valid-object"),s=t("es5-ext/object/valid-value"),l=t("es5-ext/string/random-uniq"),c=t("d"),u=t("es6-iterator/get"),f=t("es6-iterator/for-of"),h=t("es6-symbol").toStringTag,p=t("./is-native-implemented"),d=Array.isArray,m=Object.defineProperty,g=Object.prototype.hasOwnProperty,v=Object.getPrototypeOf;e.exports=n=function(){var t,e=arguments[0];if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");return t=p&&a&&WeakMap!==n?a(new WeakMap,v(this)):this,i(e)&&(d(e)||(e=u(e))),m(t,"__weakMapData__",c("c","$weakMap$"+l())),e?(f(e,(function(e){s(e),t.set(e[0],e[1])})),t):t},p&&(a&&a(n,WeakMap),n.prototype=Object.create(WeakMap.prototype,{constructor:c(n)})),Object.defineProperties(n.prototype,{delete:c((function(t){return!!g.call(o(t),this.__weakMapData__)&&(delete t[this.__weakMapData__],!0)})),get:c((function(t){if(g.call(o(t),this.__weakMapData__))return t[this.__weakMapData__]})),has:c((function(t){return g.call(o(t),this.__weakMapData__)})),set:c((function(t,e){return m(o(t),this.__weakMapData__,c("c",e)),this})),toString:c((function(){return"[object WeakMap]"}))}),m(n.prototype,h,c("c","WeakMap"))},{"./is-native-implemented":206,d:124,"es5-ext/object/is-value":171,"es5-ext/object/set-prototype-of":177,"es5-ext/object/valid-object":181,"es5-ext/object/valid-value":182,"es5-ext/string/random-uniq":187,"es6-iterator/for-of":189,"es6-iterator/get":190,"es6-symbol":196}],208:[function(t,e,r){"use strict";var n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},i={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},a={"\u2013":"\\--","\u2014":"\\---"," ":"~","\t":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},o=function(t,e){return n({},t,e)};e.exports=function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.preserveFormatting,s=void 0!==r&&r,l=e.escapeMapFn,c=void 0===l?o:l,u=String(t),f="",h=c(n({},i),s?n({},a):{}),p=Object.keys(h),d=function(){var t=!1;p.forEach((function(e,r){t||u.length>=e.length&&u.slice(0,e.length)===e&&(f+=h[p[r]],u=u.slice(e.length,u.length),t=!0)})),t||(f+=u.slice(0,1),u=u.slice(1,u.length))};u;)d();return f}},{}],209:[function(t,e,r){"use strict";var n,i="object"==typeof Reflect?Reflect:null,a=i&&"function"==typeof i.apply?i.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(t,e){return new Promise((function(r,n){function i(r){t.removeListener(e,a),n(r)}function a(){"function"==typeof t.removeListener&&t.removeListener("error",i),r([].slice.call(arguments))}v(t,e,a,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&v(t,"error",e,r)}(t,i,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var l=10;function c(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function f(t,e,r,n){var i,a,o,s;if(c(r),void 0===(a=t._events)?(a=t._events=Object.create(null),t._eventsCount=0):(void 0!==a.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),a=t._events),o=a[e]),void 0===o)o=a[e]=r,++t._eventsCount;else if("function"==typeof o?o=a[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(i=u(t))>0&&o.length>i&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=o.length,s=l,console&&console.warn&&console.warn(s)}return t}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=h.bind(n);return i.listener=r,n.wrapFn=i,i}function d(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(i):g(i,i.length)}function m(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function g(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function v(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function i(a){n.once&&t.removeEventListener(e,i),r(a)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");l=t}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var n="error"===t,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var l=i[t];if(void 0===l)return!1;if("function"==typeof l)a(l,this,e);else{var c=l.length,u=g(l,c);for(r=0;r<c;++r)a(u[r],this,e)}return!0},s.prototype.addListener=function(t,e){return f(this,t,e,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(t,e){return f(this,t,e,!0)},s.prototype.once=function(t,e){return c(e),this.on(t,p(this,t,e)),this},s.prototype.prependOnceListener=function(t,e){return c(e),this.prependListener(t,p(this,t,e)),this},s.prototype.removeListener=function(t,e){var r,n,i,a,o;if(c(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(i=-1,a=r.length-1;a>=0;a--)if(r[a]===e||r[a].listener===e){o=r[a].listener,i=a;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,i),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,o||e)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var i,a=Object.keys(r);for(n=0;n<a.length;++n)"removeListener"!==(i=a[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},s.prototype.listeners=function(t){return d(this,t,!0)},s.prototype.rawListeners=function(t){return d(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},{}],210:[function(t,e,r){var n=function(){if("object"==typeof self&&self)return self;if("object"==typeof window&&window)return window;throw new Error("Unable to resolve global `this`")};e.exports=function(){if(this)return this;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch(t){return n()}try{return __global__||n()}finally{delete Object.prototype.__global__}}()},{}],211:[function(t,e,r){"use strict";e.exports=t("./is-implemented")()?globalThis:t("./implementation")},{"./implementation":210,"./is-implemented":212}],212:[function(t,e,r){"use strict";e.exports=function(){return"object"==typeof globalThis&&(!!globalThis&&globalThis.Array===Array)}},{}],213:[function(t,e,r){"use strict";e.exports=function(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]]]}},{}],214:[function(t,e,r){"use strict";var n=t("is-string-blank");e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(0===(t=+t)&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{"is-string-blank":430}],215:[function(t,e,r){"use strict";e.exports=function(t,e,r){switch(arguments.length){case 0:return new o([0],[0],0);case 1:return"number"==typeof t?new o(n=l(t),n,0):new o(t,l(t.length),0);case 2:if("number"==typeof e){var n=l(t.length);return new o(t,n,+e)}r=0;case 3:if(t.length!==e.length)throw new Error("state and velocity lengths must match");return new o(t,e,r)}};var n=t("cubic-hermite"),i=t("binary-search-bounds");function a(t,e,r){return Math.min(e,Math.max(t,r))}function o(t,e,r){this.dimension=t.length,this.bounds=[new Array(this.dimension),new Array(this.dimension)];for(var n=0;n<this.dimension;++n)this.bounds[0][n]=-1/0,this.bounds[1][n]=1/0;this._state=t.slice().reverse(),this._velocity=e.slice().reverse(),this._time=[r],this._scratch=[t.slice(),t.slice(),t.slice(),t.slice(),t.slice()]}var s=o.prototype;function l(t){for(var e=new Array(t),r=0;r<t;++r)e[r]=0;return e}s.flush=function(t){var e=i.gt(this._time,t)-1;e<=0||(this._time.splice(0,e),this._state.splice(0,e*this.dimension),this._velocity.splice(0,e*this.dimension))},s.curve=function(t){var e=this._time,r=e.length,o=i.le(e,t),s=this._scratch[0],l=this._state,c=this._velocity,u=this.dimension,f=this.bounds;if(o<0)for(var h=u-1,p=0;p<u;++p,--h)s[p]=l[h];else if(o>=r-1){h=l.length-1;var d=t-e[r-1];for(p=0;p<u;++p,--h)s[p]=l[h]+d*c[h]}else{h=u*(o+1)-1;var m=e[o],g=e[o+1]-m||1,v=this._scratch[1],y=this._scratch[2],x=this._scratch[3],b=this._scratch[4],_=!0;for(p=0;p<u;++p,--h)v[p]=l[h],x[p]=c[h]*g,y[p]=l[h+u],b[p]=c[h+u]*g,_=_&&v[p]===y[p]&&x[p]===b[p]&&0===x[p];if(_)for(p=0;p<u;++p)s[p]=v[p];else n(v,x,y,b,(t-m)/g,s)}var w=f[0],T=f[1];for(p=0;p<u;++p)s[p]=a(w[p],T[p],s[p]);return s},s.dcurve=function(t){var e=this._time,r=e.length,a=i.le(e,t),o=this._scratch[0],s=this._state,l=this._velocity,c=this.dimension;if(a>=r-1)for(var u=s.length-1,f=(e[r-1],0);f<c;++f,--u)o[f]=l[u];else{u=c*(a+1)-1;var h=e[a],p=e[a+1]-h||1,d=this._scratch[1],m=this._scratch[2],g=this._scratch[3],v=this._scratch[4],y=!0;for(f=0;f<c;++f,--u)d[f]=s[u],g[f]=l[u]*p,m[f]=s[u+c],v[f]=l[u+c]*p,y=y&&d[f]===m[f]&&g[f]===v[f]&&0===g[f];if(y)for(f=0;f<c;++f)o[f]=0;else{n.derivative(d,g,m,v,(t-h)/p,o);for(f=0;f<c;++f)o[f]/=p}}return o},s.lastT=function(){var t=this._time;return t[t.length-1]},s.stable=function(){for(var t=this._velocity,e=t.length,r=this.dimension-1;r>=0;--r)if(t[--e])return!1;return!0},s.jump=function(t){var e=this.lastT(),r=this.dimension;if(!(t<e||arguments.length!==r+1)){var n=this._state,i=this._velocity,o=n.length-this.dimension,s=this.bounds,l=s[0],c=s[1];this._time.push(e,t);for(var u=0;u<2;++u)for(var f=0;f<r;++f)n.push(n[o++]),i.push(0);this._time.push(t);for(f=r;f>0;--f)n.push(a(l[f-1],c[f-1],arguments[f])),i.push(0)}},s.push=function(t){var e=this.lastT(),r=this.dimension;if(!(t<e||arguments.length!==r+1)){var n=this._state,i=this._velocity,o=n.length-this.dimension,s=t-e,l=this.bounds,c=l[0],u=l[1],f=s>1e-6?1/s:0;this._time.push(t);for(var h=r;h>0;--h){var p=a(c[h-1],u[h-1],arguments[h]);n.push(p),i.push((p-n[o++])*f)}}},s.set=function(t){var e=this.dimension;if(!(t<this.lastT()||arguments.length!==e+1)){var r=this._state,n=this._velocity,i=this.bounds,o=i[0],s=i[1];this._time.push(t);for(var l=e;l>0;--l)r.push(a(o[l-1],s[l-1],arguments[l])),n.push(0)}},s.move=function(t){var e=this.lastT(),r=this.dimension;if(!(t<=e||arguments.length!==r+1)){var n=this._state,i=this._velocity,o=n.length-this.dimension,s=this.bounds,l=s[0],c=s[1],u=t-e,f=u>1e-6?1/u:0;this._time.push(t);for(var h=r;h>0;--h){var p=arguments[h];n.push(a(l[h-1],c[h-1],n[o++]+p)),i.push(p*f)}}},s.idle=function(t){var e=this.lastT();if(!(t<e)){var r=this.dimension,n=this._state,i=this._velocity,o=n.length-r,s=this.bounds,l=s[0],c=s[1],u=t-e;this._time.push(t);for(var f=r-1;f>=0;--f)n.push(a(l[f],c[f],n[o]+u*i[o])),i.push(0),o+=1}}},{"binary-search-bounds":216,"cubic-hermite":119}],216:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){var o=["function ",t,"(a,l,h,",n.join(","),"){",a?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",i?".get(m)":"[m]"];return a?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("}"),a?o.push("return -1};"):o.push("return i};"),o.join("")}function i(t,e,r,i){return new Function([n("A","x"+t+"y",e,["y"],!1,i),n("B","x"+t+"y",e,["y"],!0,i),n("P","c(x,y)"+t+"0",e,["y","c"],!1,i),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,i),"function dispatchBsearch",r,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",r].join(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],217:[function(t,e,r){var n=t("dtype");e.exports=function(t,e,r){if(!t)throw new TypeError("must specify data as first parameter");if(r=0|+(r||0),Array.isArray(t)&&t[0]&&"number"==typeof t[0][0]){var i,a,o,s,l=t[0].length,c=t.length*l;e&&"string"!=typeof e||(e=new(n(e||"float32"))(c+r));var u=e.length-r;if(c!==u)throw new Error("source length "+c+" ("+l+"x"+t.length+") does not match destination length "+u);for(i=0,o=r;i<t.length;i++)for(a=0;a<l;a++)e[o++]=null===t[i][a]?NaN:t[i][a]}else if(e&&"string"!=typeof e)e.set(t,r);else{var f=n(e||"float32");if(Array.isArray(t)||"array"===e)for(e=new f(t.length+r),i=0,o=r,s=e.length;o<s;o++,i++)e[o]=null===t[i]?NaN:t[i];else 0===r?e=new f(t):(e=new f(t.length+r)).set(t,r)}return e}},{dtype:146}],218:[function(t,e,r){"use strict";var n=t("css-font/stringify"),i=[32,126];e.exports=function(t){var e=(t=t||{}).shape?t.shape:t.canvas?[t.canvas.width,t.canvas.height]:[512,512],r=t.canvas||document.createElement("canvas"),a=t.font,o="number"==typeof t.step?[t.step,t.step]:t.step||[32,32],s=t.chars||i;a&&"string"!=typeof a&&(a=n(a));if(Array.isArray(s)){if(2===s.length&&"number"==typeof s[0]&&"number"==typeof s[1]){for(var l=[],c=s[0],u=0;c<=s[1];c++)l[u++]=String.fromCharCode(c);s=l}}else s=String(s).split("");e=e.slice(),r.width=e[0],r.height=e[1];var f=r.getContext("2d");f.fillStyle="#000",f.fillRect(0,0,r.width,r.height),f.font=a,f.textAlign="center",f.textBaseline="middle",f.fillStyle="#fff";var h=o[0]/2,p=o[1]/2;for(c=0;c<s.length;c++)f.fillText(s[c],h,p),(h+=o[0])>e[0]-o[0]/2&&(h=o[0]/2,p+=o[1]);return r}},{"css-font/stringify":116}],219:[function(t,e,r){"use strict";function n(t,e){e||(e={}),("string"==typeof t||Array.isArray(t))&&(e.family=t);var r=Array.isArray(e.family)?e.family.join(", "):e.family;if(!r)throw Error("`family` must be defined");var s=e.size||e.fontSize||e.em||48,l=e.weight||e.fontWeight||"",c=(t=[e.style||e.fontStyle||"",l,s].join(" ")+"px "+r,e.origin||"top");if(n.cache[r]&&s<=n.cache[r].em)return i(n.cache[r],c);var u=e.canvas||n.canvas,f=u.getContext("2d"),h={upper:void 0!==e.upper?e.upper:"H",lower:void 0!==e.lower?e.lower:"x",descent:void 0!==e.descent?e.descent:"p",ascent:void 0!==e.ascent?e.ascent:"h",tittle:void 0!==e.tittle?e.tittle:"i",overshoot:void 0!==e.overshoot?e.overshoot:"O"},p=Math.ceil(1.5*s);u.height=p,u.width=.5*p,f.font=t;var d={top:0};f.clearRect(0,0,p,p),f.textBaseline="top",f.fillStyle="black",f.fillText("H",0,0);var m=a(f.getImageData(0,0,p,p));f.clearRect(0,0,p,p),f.textBaseline="bottom",f.fillText("H",0,p);var g=a(f.getImageData(0,0,p,p));d.lineHeight=d.bottom=p-g+m,f.clearRect(0,0,p,p),f.textBaseline="alphabetic",f.fillText("H",0,p);var v=p-a(f.getImageData(0,0,p,p))-1+m;d.baseline=d.alphabetic=v,f.clearRect(0,0,p,p),f.textBaseline="middle",f.fillText("H",0,.5*p);var y=a(f.getImageData(0,0,p,p));d.median=d.middle=p-y-1+m-.5*p,f.clearRect(0,0,p,p),f.textBaseline="hanging",f.fillText("H",0,.5*p);var x=a(f.getImageData(0,0,p,p));d.hanging=p-x-1+m-.5*p,f.clearRect(0,0,p,p),f.textBaseline="ideographic",f.fillText("H",0,p);var b=a(f.getImageData(0,0,p,p));if(d.ideographic=p-b-1+m,h.upper&&(f.clearRect(0,0,p,p),f.textBaseline="top",f.fillText(h.upper,0,0),d.upper=a(f.getImageData(0,0,p,p)),d.capHeight=d.baseline-d.upper),h.lower&&(f.clearRect(0,0,p,p),f.textBaseline="top",f.fillText(h.lower,0,0),d.lower=a(f.getImageData(0,0,p,p)),d.xHeight=d.baseline-d.lower),h.tittle&&(f.clearRect(0,0,p,p),f.textBaseline="top",f.fillText(h.tittle,0,0),d.tittle=a(f.getImageData(0,0,p,p))),h.ascent&&(f.clearRect(0,0,p,p),f.textBaseline="top",f.fillText(h.ascent,0,0),d.ascent=a(f.getImageData(0,0,p,p))),h.descent&&(f.clearRect(0,0,p,p),f.textBaseline="top",f.fillText(h.descent,0,0),d.descent=o(f.getImageData(0,0,p,p))),h.overshoot){f.clearRect(0,0,p,p),f.textBaseline="top",f.fillText(h.overshoot,0,0);var _=o(f.getImageData(0,0,p,p));d.overshoot=_-v}for(var w in d)d[w]/=s;return d.em=s,n.cache[r]=d,i(d,c)}function i(t,e){var r={};for(var n in"string"==typeof e&&(e=t[e]),t)"em"!==n&&(r[n]=t[n]-e);return r}function a(t){for(var e=t.height,r=t.data,n=3;n<r.length;n+=4)if(0!==r[n])return Math.floor(.25*(n-3)/e)}function o(t){for(var e=t.height,r=t.data,n=r.length-1;n>0;n-=4)if(0!==r[n])return Math.floor(.25*(n-3)/e)}e.exports=n,n.canvas=document.createElement("canvas"),n.cache={}},{}],220:[function(t,e,r){"use strict";e.exports=function(t){return new s(t||m,null)};function n(t,e,r,n,i,a){this._color=t,this.key=e,this.value=r,this.left=n,this.right=i,this._count=a}function i(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function a(t,e){return new n(t,e.key,e.value,e.left,e.right,e._count)}function o(t){t._count=1+(t.left?t.left._count:0)+(t.right?t.right._count:0)}function s(t,e){this._compare=t,this.root=e}var l=s.prototype;function c(t,e){var r;if(e.left&&(r=c(t,e.left)))return r;return(r=t(e.key,e.value))||(e.right?c(t,e.right):void 0)}function u(t,e,r,n){if(e(t,n.key)<=0){var i;if(n.left)if(i=u(t,e,r,n.left))return i;if(i=r(n.key,n.value))return i}if(n.right)return u(t,e,r,n.right)}function f(t,e,r,n,i){var a,o=r(t,i.key),s=r(e,i.key);if(o<=0){if(i.left&&(a=f(t,e,r,n,i.left)))return a;if(s>0&&(a=n(i.key,i.value)))return a}if(s>0&&i.right)return f(t,e,r,n,i.right)}function h(t,e){this.tree=t,this._stack=e}Object.defineProperty(l,"keys",{get:function(){var t=[];return this.forEach((function(e,r){t.push(e)})),t}}),Object.defineProperty(l,"values",{get:function(){var t=[];return this.forEach((function(e,r){t.push(r)})),t}}),Object.defineProperty(l,"length",{get:function(){return this.root?this.root._count:0}}),l.insert=function(t,e){for(var r=this._compare,i=this.root,l=[],c=[];i;){var u=r(t,i.key);l.push(i),c.push(u),i=u<=0?i.left:i.right}l.push(new n(0,t,e,null,null,1));for(var f=l.length-2;f>=0;--f){i=l[f];c[f]<=0?l[f]=new n(i._color,i.key,i.value,l[f+1],i.right,i._count+1):l[f]=new n(i._color,i.key,i.value,i.left,l[f+1],i._count+1)}for(f=l.length-1;f>1;--f){var h=l[f-1];i=l[f];if(1===h._color||1===i._color)break;var p=l[f-2];if(p.left===h)if(h.left===i){if(!(d=p.right)||0!==d._color){if(p._color=0,p.left=h.right,h._color=1,h.right=p,l[f-2]=h,l[f-1]=i,o(p),o(h),f>=3)(m=l[f-3]).left===p?m.left=h:m.right=h;break}h._color=1,p.right=a(1,d),p._color=0,f-=1}else{if(!(d=p.right)||0!==d._color){if(h.right=i.left,p._color=0,p.left=i.right,i._color=1,i.left=h,i.right=p,l[f-2]=i,l[f-1]=h,o(p),o(h),o(i),f>=3)(m=l[f-3]).left===p?m.left=i:m.right=i;break}h._color=1,p.right=a(1,d),p._color=0,f-=1}else if(h.right===i){if(!(d=p.left)||0!==d._color){if(p._color=0,p.right=h.left,h._color=1,h.left=p,l[f-2]=h,l[f-1]=i,o(p),o(h),f>=3)(m=l[f-3]).right===p?m.right=h:m.left=h;break}h._color=1,p.left=a(1,d),p._color=0,f-=1}else{var d;if(!(d=p.left)||0!==d._color){var m;if(h.left=i.right,p._color=0,p.right=i.left,i._color=1,i.right=h,i.left=p,l[f-2]=i,l[f-1]=h,o(p),o(h),o(i),f>=3)(m=l[f-3]).right===p?m.right=i:m.left=i;break}h._color=1,p.left=a(1,d),p._color=0,f-=1}}return l[0]._color=1,new s(r,l[0])},l.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return c(t,this.root);case 2:return u(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return f(e,r,this._compare,t,this.root)}},Object.defineProperty(l,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new h(this,t)}}),Object.defineProperty(l,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new h(this,t)}}),l.at=function(t){if(t<0)return new h(this,[]);for(var e=this.root,r=[];;){if(r.push(e),e.left){if(t<e.left._count){e=e.left;continue}t-=e.left._count}if(!t)return new h(this,r);if(t-=1,!e.right)break;if(t>=e.right._count)break;e=e.right}return new h(this,[])},l.ge=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),a<=0&&(i=n.length),r=a<=0?r.left:r.right}return n.length=i,new h(this,n)},l.gt=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),a<0&&(i=n.length),r=a<0?r.left:r.right}return n.length=i,new h(this,n)},l.lt=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),a>0&&(i=n.length),r=a<=0?r.left:r.right}return n.length=i,new h(this,n)},l.le=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),a>=0&&(i=n.length),r=a<0?r.left:r.right}return n.length=i,new h(this,n)},l.find=function(t){for(var e=this._compare,r=this.root,n=[];r;){var i=e(t,r.key);if(n.push(r),0===i)return new h(this,n);r=i<=0?r.left:r.right}return new h(this,[])},l.remove=function(t){var e=this.find(t);return e?e.remove():this},l.get=function(t){for(var e=this._compare,r=this.root;r;){var n=e(t,r.key);if(0===n)return r.value;r=n<=0?r.left:r.right}};var p=h.prototype;function d(t,e){t.key=e.key,t.value=e.value,t.left=e.left,t.right=e.right,t._color=e._color,t._count=e._count}function m(t,e){return t<e?-1:t>e?1:0}Object.defineProperty(p,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(p,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),p.clone=function(){return new h(this.tree,this._stack.slice())},p.remove=function(){var t=this._stack;if(0===t.length)return this.tree;var e=new Array(t.length),r=t[t.length-1];e[e.length-1]=new n(r._color,r.key,r.value,r.left,r.right,r._count);for(var l=t.length-2;l>=0;--l){(r=t[l]).left===t[l+1]?e[l]=new n(r._color,r.key,r.value,e[l+1],r.right,r._count):e[l]=new n(r._color,r.key,r.value,r.left,e[l+1],r._count)}if((r=e[e.length-1]).left&&r.right){var c=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var u=e[c-1];e.push(new n(r._color,u.key,u.value,r.left,r.right,r._count)),e[c-1].key=r.key,e[c-1].value=r.value;for(l=e.length-2;l>=c;--l)r=e[l],e[l]=new n(r._color,r.key,r.value,r.left,e[l+1],r._count);e[c-1].left=e[c]}if(0===(r=e[e.length-1])._color){var f=e[e.length-2];f.left===r?f.left=null:f.right===r&&(f.right=null),e.pop();for(l=0;l<e.length;++l)e[l]._count--;return new s(this.tree._compare,e[0])}if(r.left||r.right){r.left?d(r,r.left):r.right&&d(r,r.right),r._color=1;for(l=0;l<e.length-1;++l)e[l]._count--;return new s(this.tree._compare,e[0])}if(1===e.length)return new s(this.tree._compare,null);for(l=0;l<e.length;++l)e[l]._count--;var h=e[e.length-2];return function(t){for(var e,r,n,s,l=t.length-1;l>=0;--l){if(e=t[l],0===l)return void(e._color=1);if((r=t[l-1]).left===e){if((n=r.right).right&&0===n.right._color){if(s=(n=r.right=i(n)).right=i(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=1,r._color=1,s._color=1,o(r),o(n),l>1)(c=t[l-2]).left===r?c.left=n:c.right=n;return void(t[l-1]=n)}if(n.left&&0===n.left._color){if(s=(n=r.right=i(n)).left=i(n.left),r.right=s.left,n.left=s.right,s.left=r,s.right=n,s._color=r._color,r._color=1,n._color=1,e._color=1,o(r),o(n),o(s),l>1)(c=t[l-2]).left===r?c.left=s:c.right=s;return void(t[l-1]=s)}if(1===n._color){if(0===r._color)return r._color=1,void(r.right=a(0,n));r.right=a(0,n);continue}n=i(n),r.right=n.left,n.left=r,n._color=r._color,r._color=0,o(r),o(n),l>1&&((c=t[l-2]).left===r?c.left=n:c.right=n),t[l-1]=n,t[l]=r,l+1<t.length?t[l+1]=e:t.push(e),l+=2}else{if((n=r.left).left&&0===n.left._color){if(s=(n=r.left=i(n)).left=i(n.left),r.left=n.right,n.right=r,n.left=s,n._color=r._color,e._color=1,r._color=1,s._color=1,o(r),o(n),l>1)(c=t[l-2]).right===r?c.right=n:c.left=n;return void(t[l-1]=n)}if(n.right&&0===n.right._color){if(s=(n=r.left=i(n)).right=i(n.right),r.left=s.right,n.right=s.left,s.right=r,s.left=n,s._color=r._color,r._color=1,n._color=1,e._color=1,o(r),o(n),o(s),l>1)(c=t[l-2]).right===r?c.right=s:c.left=s;return void(t[l-1]=s)}if(1===n._color){if(0===r._color)return r._color=1,void(r.left=a(0,n));r.left=a(0,n);continue}var c;n=i(n),r.left=n.right,n.right=r,n._color=r._color,r._color=0,o(r),o(n),l>1&&((c=t[l-2]).right===r?c.right=n:c.left=n),t[l-1]=n,t[l]=r,l+1<t.length?t[l+1]=e:t.push(e),l+=2}}}(e),h.left===r?h.left=null:h.right=null,new s(this.tree._compare,e[0])},Object.defineProperty(p,"key",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(p,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(p,"index",{get:function(){var t=0,e=this._stack;if(0===e.length){var r=this.tree.root;return r?r._count:0}e[e.length-1].left&&(t=e[e.length-1].left._count);for(var n=e.length-2;n>=0;--n)e[n+1]===e[n].right&&(++t,e[n].left&&(t+=e[n].left._count));return t},enumerable:!0}),p.next=function(){var t=this._stack;if(0!==t.length){var e=t[t.length-1];if(e.right)for(e=e.right;e;)t.push(e),e=e.left;else for(t.pop();t.length>0&&t[t.length-1].right===e;)e=t[t.length-1],t.pop()}},Object.defineProperty(p,"hasNext",{get:function(){var t=this._stack;if(0===t.length)return!1;if(t[t.length-1].right)return!0;for(var e=t.length-1;e>0;--e)if(t[e-1].left===t[e])return!0;return!1}}),p.update=function(t){var e=this._stack;if(0===e.length)throw new Error("Can't update empty node!");var r=new Array(e.length),i=e[e.length-1];r[r.length-1]=new n(i._color,i.key,t,i.left,i.right,i._count);for(var a=e.length-2;a>=0;--a)(i=e[a]).left===e[a+1]?r[a]=new n(i._color,i.key,i.value,r[a+1],i.right,i._count):r[a]=new n(i._color,i.key,i.value,i.left,r[a+1],i._count);return new s(this.tree._compare,r[0])},p.prev=function(){var t=this._stack;if(0!==t.length){var e=t[t.length-1];if(e.left)for(e=e.left;e;)t.push(e),e=e.right;else for(t.pop();t.length>0&&t[t.length-1].left===e;)e=t[t.length-1],t.pop()}},Object.defineProperty(p,"hasPrev",{get:function(){var t=this._stack;if(0===t.length)return!1;if(t[t.length-1].left)return!0;for(var e=t.length-1;e>0;--e)if(t[e-1].right===t[e])return!0;return!1}})},{}],221:[function(t,e,r){var n=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],i=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];function a(t){if(t<0)return Number("0/0");for(var e=i[0],r=i.length-1;r>0;--r)e+=i[r]/(t+r);var n=t+607/128+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}e.exports=function t(e){if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*t(1-e));if(e>100)return Math.exp(a(e));e-=1;for(var r=n[0],i=1;i<9;i++)r+=n[i]/(e+i);var o=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,e+.5)*Math.exp(-o)*r},e.exports.log=a},{}],222:[function(t,e,r){e.exports=function(t,e){if("string"!=typeof t)throw new TypeError("must specify type string");if(e=e||{},"undefined"==typeof document&&!e.canvas)return null;var r=e.canvas||document.createElement("canvas");"number"==typeof e.width&&(r.width=e.width);"number"==typeof e.height&&(r.height=e.height);var n,i=e;try{var a=[t];0===t.indexOf("webgl")&&a.push("experimental-"+t);for(var o=0;o<a.length;o++)if(n=r.getContext(a[o],i))return n}catch(t){n=null}return n||null}},{}],223:[function(t,e,r){"use strict";e.exports=function(t,e){var r=new u(t);return r.update(e),r};var n=t("./lib/text.js"),i=t("./lib/lines.js"),a=t("./lib/background.js"),o=t("./lib/cube.js"),s=t("./lib/ticks.js"),l=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);function c(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function u(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.tickAlign=["auto","auto","auto"],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.labelAlign=["auto","auto","auto"],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=a(t)}var f=u.prototype;function h(){this.primalOffset=[0,0,0],this.primalMinor=[0,0,0],this.mirrorOffset=[0,0,0],this.mirrorMinor=[0,0,0]}f.update=function(t){function e(e,r,n){if(n in t){var i,a=t[n],o=this[n];(e?Array.isArray(a)&&Array.isArray(a[0]):Array.isArray(a))?this[n]=i=[r(a[0]),r(a[1]),r(a[2])]:this[n]=i=[r(a),r(a),r(a)];for(var s=0;s<3;++s)if(i[s]!==o[s])return!0}return!1}t=t||{};var r,a=e.bind(this,!1,Number),o=e.bind(this,!1,Boolean),l=e.bind(this,!1,String),c=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]})),u=!1,f=!1;if("bounds"in t)for(var h=t.bounds,p=0;p<2;++p)for(var d=0;d<3;++d)h[p][d]!==this.bounds[p][d]&&(f=!0),this.bounds[p][d]=h[p][d];if("ticks"in t){r=t.ticks,u=!0,this.autoTicks=!1;for(p=0;p<3;++p)this.tickSpacing[p]=0}else a("tickSpacing")&&(this.autoTicks=!0,f=!0);if(this._firstInit&&("ticks"in t||"tickSpacing"in t||(this.autoTicks=!0),f=!0,u=!0,this._firstInit=!1),f&&this.autoTicks&&(r=s.create(this.bounds,this.tickSpacing),u=!0),u){for(p=0;p<3;++p)r[p].sort((function(t,e){return t.x-e.x}));s.equal(r,this.ticks)?u=!1:this.ticks=r}o("tickEnable"),l("tickFont")&&(u=!0),a("tickSize"),a("tickAngle"),a("tickPad"),c("tickColor");var m=l("labels");l("labelFont")&&(m=!0),o("labelEnable"),a("labelSize"),a("labelPad"),c("labelColor"),o("lineEnable"),o("lineMirror"),a("lineWidth"),c("lineColor"),o("lineTickEnable"),o("lineTickMirror"),a("lineTickLength"),a("lineTickWidth"),c("lineTickColor"),o("gridEnable"),a("gridWidth"),c("gridColor"),o("zeroEnable"),c("zeroLineColor"),a("zeroLineWidth"),o("backgroundEnable"),c("backgroundColor"),this._text?this._text&&(m||u)&&this._text.update(this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont):this._text=n(this.gl,this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont),this._lines&&u&&(this._lines.dispose(),this._lines=null),this._lines||(this._lines=i(this.gl,this.bounds,this.ticks))};var p=[new h,new h,new h];function d(t,e,r,n,i){for(var a=t.primalOffset,o=t.primalMinor,s=t.mirrorOffset,l=t.mirrorMinor,c=n[e],u=0;u<3;++u)if(e!==u){var f=a,h=s,p=o,d=l;c&1<<u&&(f=s,h=a,p=l,d=o),f[u]=r[0][u],h[u]=r[1][u],i[u]>0?(p[u]=-1,d[u]=0):(p[u]=0,d[u]=1)}}var m=[0,0,0],g={model:l,view:l,projection:l,_ortho:!1};f.isOpaque=function(){return!0},f.isTransparent=function(){return!1},f.drawTransparent=function(t){};var v=[0,0,0],y=[0,0,0],x=[0,0,0];f.draw=function(t){t=t||g;for(var e=this.gl,r=t.model||l,n=t.view||l,i=t.projection||l,a=this.bounds,s=t._ortho||!1,u=o(r,n,i,a,s),f=u.cubeEdges,h=u.axis,b=n[12],_=n[13],w=n[14],T=n[15],M=(s?2:1)*this.pixelRatio*(i[3]*b+i[7]*_+i[11]*w+i[15]*T)/e.drawingBufferHeight,k=0;k<3;++k)this.lastCubeProps.cubeEdges[k]=f[k],this.lastCubeProps.axis[k]=h[k];var A=p;for(k=0;k<3;++k)d(p[k],k,this.bounds,f,h);e=this.gl;var S,E=m;for(k=0;k<3;++k)this.backgroundEnable[k]?E[k]=h[k]:E[k]=0;this._background.draw(r,n,i,a,E,this.backgroundColor),this._lines.bind(r,n,i,this);for(k=0;k<3;++k){var C=[0,0,0];h[k]>0?C[k]=a[1][k]:C[k]=a[0][k];for(var L=0;L<2;++L){var P=(k+1+L)%3,I=(k+1+(1^L))%3;this.gridEnable[P]&&this._lines.drawGrid(P,I,this.bounds,C,this.gridColor[P],this.gridWidth[P]*this.pixelRatio)}for(L=0;L<2;++L){P=(k+1+L)%3,I=(k+1+(1^L))%3;this.zeroEnable[I]&&Math.min(a[0][I],a[1][I])<=0&&Math.max(a[0][I],a[1][I])>=0&&this._lines.drawZero(P,I,this.bounds,C,this.zeroLineColor[I],this.zeroLineWidth[I]*this.pixelRatio)}}for(k=0;k<3;++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);var O=c(v,A[k].primalMinor),z=c(y,A[k].mirrorMinor),D=this.lineTickLength;for(L=0;L<3;++L){var N=M/r[5*L];O[L]*=D[L]*N,z[L]*=D[L]*N}this.lineTickEnable[k]&&this._lines.drawAxisTicks(k,A[k].primalOffset,O,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio),this.lineTickMirror[k]&&this._lines.drawAxisTicks(k,A[k].mirrorOffset,z,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio)}this._lines.unbind(),this._text.bind(r,n,i,this.pixelRatio);var R,F;function B(t){(F=[0,0,0])[t]=1}function j(t,e,r){var n=(t+1)%3,i=(t+2)%3,a=e[n],o=e[i],s=r[n],l=r[i];a>0&&l>0||a>0&&l<0||a<0&&l>0||a<0&&l<0?B(n):(o>0&&s>0||o>0&&s<0||o<0&&s>0||o<0&&s<0)&&B(i)}for(k=0;k<3;++k){var U=A[k].primalMinor,V=A[k].mirrorMinor,q=c(x,A[k].primalOffset);for(L=0;L<3;++L)this.lineTickEnable[k]&&(q[L]+=M*U[L]*Math.max(this.lineTickLength[L],0)/r[5*L]);var H=[0,0,0];if(H[k]=1,this.tickEnable[k]){-3600===this.tickAngle[k]?(this.tickAngle[k]=0,this.tickAlign[k]="auto"):this.tickAlign[k]=-1,R=1,"auto"===(S=[this.tickAlign[k],.5,R])[0]?S[0]=0:S[0]=parseInt(""+S[0]),F=[0,0,0],j(k,U,V);for(L=0;L<3;++L)q[L]+=M*U[L]*this.tickPad[L]/r[5*L];this._text.drawTicks(k,this.tickSize[k],this.tickAngle[k],q,this.tickColor[k],H,F,S)}if(this.labelEnable[k]){R=0,F=[0,0,0],this.labels[k].length>4&&(B(k),R=1),"auto"===(S=[this.labelAlign[k],.5,R])[0]?S[0]=0:S[0]=parseInt(""+S[0]);for(L=0;L<3;++L)q[L]+=M*U[L]*this.labelPad[L]/r[5*L];q[k]+=.5*(a[0][k]+a[1][k]),this._text.drawLabel(k,this.labelSize[k],this.labelAngle[k],q,this.labelColor[k],[0,0,0],F,S)}}this._text.unbind()},f.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":224,"./lib/cube.js":225,"./lib/lines.js":226,"./lib/text.js":228,"./lib/ticks.js":229}],224:[function(t,e,r){"use strict";e.exports=function(t){for(var e=[],r=[],s=0,l=0;l<3;++l)for(var c=(l+1)%3,u=(l+2)%3,f=[0,0,0],h=[0,0,0],p=-1;p<=1;p+=2){r.push(s,s+2,s+1,s+1,s+2,s+3),f[l]=p,h[l]=p;for(var d=-1;d<=1;d+=2){f[c]=d;for(var m=-1;m<=1;m+=2)f[u]=m,e.push(f[0],f[1],f[2],h[0],h[1],h[2]),s+=1}var g=c;c=u,u=g}var v=n(t,new Float32Array(e)),y=n(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),x=i(t,[{buffer:v,type:t.FLOAT,size:3,offset:0,stride:24},{buffer:v,type:t.FLOAT,size:3,offset:12,stride:24}],y),b=a(t);return b.attributes.position.location=0,b.attributes.normal.location=1,new o(t,v,x,b)};var n=t("gl-buffer"),i=t("gl-vao"),a=t("./shaders").bg;function o(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n}var s=o.prototype;s.draw=function(t,e,r,n,i,a){for(var o=!1,s=0;s<3;++s)o=o||i[s];if(o){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:a},this.vao.bind(),this.vao.draw(this.gl.TRIANGLES,36),this.vao.unbind(),l.disable(l.POLYGON_OFFSET_FILL)}},s.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders":227,"gl-buffer":231,"gl-vao":318}],225:[function(t,e,r){"use strict";e.exports=function(t,e,r,a,p){i(s,e,t),i(s,r,s);for(var y=0,x=0;x<2;++x){u[2]=a[x][2];for(var b=0;b<2;++b){u[1]=a[b][1];for(var _=0;_<2;++_)u[0]=a[_][0],h(l[y],u,s),y+=1}}var w=-1;for(x=0;x<8;++x){for(var T=l[x][3],M=0;M<3;++M)c[x][M]=l[x][M]/T;p&&(c[x][2]*=-1),T<0&&(w<0||c[x][2]<c[w][2])&&(w=x)}if(w<0){w=0;for(var k=0;k<3;++k){for(var A=(k+2)%3,S=(k+1)%3,E=-1,C=-1,L=0;L<2;++L){var P=(O=L<<k)+(L<<A)+(1-L<<S),I=O+(1-L<<A)+(L<<S);o(c[O],c[P],c[I],f)<0||(L?E=1:C=1)}if(E<0||C<0)C>E&&(w|=1<<k);else{for(L=0;L<2;++L){P=(O=L<<k)+(L<<A)+(1-L<<S),I=O+(1-L<<A)+(L<<S);var O,z=d([l[O],l[P],l[I],l[O+(1<<A)+(1<<S)]]);L?E=z:C=z}C>E&&(w|=1<<k)}}}var D=7^w,N=-1;for(x=0;x<8;++x)x!==w&&x!==D&&(N<0||c[N][1]>c[x][1])&&(N=x);var R=-1;for(x=0;x<3;++x){if((B=N^1<<x)!==w&&B!==D)R<0&&(R=B),(S=c[B])[0]<c[R][0]&&(R=B)}var F=-1;for(x=0;x<3;++x){var B;if((B=N^1<<x)!==w&&B!==D&&B!==R)F<0&&(F=B),(S=c[B])[0]>c[F][0]&&(F=B)}var j=m;j[0]=j[1]=j[2]=0,j[n.log2(R^N)]=N&R,j[n.log2(N^F)]=N&F;var U=7^F;U===w||U===D?(U=7^R,j[n.log2(F^U)]=U&F):j[n.log2(R^U)]=U&R;var V=g,q=w;for(k=0;k<3;++k)V[k]=q&1<<k?-1:1;return v};var n=t("bit-twiddle"),i=t("gl-mat4/multiply"),a=t("split-polygon"),o=t("robust-orientation"),s=new Array(16),l=new Array(8),c=new Array(8),u=new Array(3),f=[0,0,0];function h(t,e,r){for(var n=0;n<4;++n){t[n]=r[12+n];for(var i=0;i<3;++i)t[n]+=e[i]*r[4*i+n]}}!function(){for(var t=0;t<8;++t)l[t]=[1,1,1,1],c[t]=[1,1,1]}();var p=[[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]];function d(t){for(var e=0;e<p.length;++e)if((t=a.positive(t,p[e])).length<3)return 0;var r=t[0],n=r[0]/r[3],i=r[1]/r[3],o=0;for(e=1;e+1<t.length;++e){var s=t[e],l=t[e+1],c=s[0]/s[3]-n,u=s[1]/s[3]-i,f=l[0]/l[3]-n,h=l[1]/l[3]-i;o+=Math.abs(c*h-u*f)}return o}var m=[1,1,1],g=[0,0,0],v={cubeEdges:m,axis:g}},{"bit-twiddle":65,"gl-mat4/multiply":264,"robust-orientation":1485,"split-polygon":1502}],226:[function(t,e,r){"use strict";e.exports=function(t,e,r){var o=[],s=[0,0,0],l=[0,0,0],c=[0,0,0],u=[0,0,0];o.push(0,0,1,0,1,1,0,0,-1,0,0,-1,0,1,1,0,1,-1);for(var f=0;f<3;++f){for(var h=o.length/3|0,d=0;d<r[f].length;++d){var m=+r[f][d].x;o.push(m,0,1,m,1,1,m,0,-1,m,0,-1,m,1,1,m,1,-1)}var g=o.length/3|0;s[f]=h,l[f]=g-h;h=o.length/3|0;for(var v=0;v<r[f].length;++v){m=+r[f][v].x;o.push(m,0,1,m,1,1,m,0,-1,m,0,-1,m,1,1,m,1,-1)}g=o.length/3|0;c[f]=h,u[f]=g-h}var y=n(t,new Float32Array(o)),x=i(t,[{buffer:y,type:t.FLOAT,size:3,stride:0,offset:0}]),b=a(t);return b.attributes.position.location=0,new p(t,y,x,b,l,s,u,c)};var n=t("gl-buffer"),i=t("gl-vao"),a=t("./shaders").line,o=[0,0,0],s=[0,0,0],l=[0,0,0],c=[0,0,0],u=[1,1];function f(t){return t[0]=t[1]=t[2]=0,t}function h(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function p(t,e,r,n,i,a,o,s){this.gl=t,this.vertBuffer=e,this.vao=r,this.shader=n,this.tickCount=i,this.tickOffset=a,this.gridCount=o,this.gridOffset=s}var d=p.prototype;d.bind=function(t,e,r){this.shader.bind(),this.shader.uniforms.model=t,this.shader.uniforms.view=e,this.shader.uniforms.projection=r,u[0]=this.gl.drawingBufferWidth,u[1]=this.gl.drawingBufferHeight,this.shader.uniforms.screenShape=u,this.vao.bind()},d.unbind=function(){this.vao.unbind()},d.drawAxisLine=function(t,e,r,n,i){var a=f(s);this.shader.uniforms.majorAxis=s,a[t]=e[1][t]-e[0][t],this.shader.uniforms.minorAxis=a;var o,u=h(c,r);u[t]+=e[0][t],this.shader.uniforms.offset=u,this.shader.uniforms.lineWidth=i,this.shader.uniforms.color=n,(o=f(l))[(t+2)%3]=1,this.shader.uniforms.screenAxis=o,this.vao.draw(this.gl.TRIANGLES,6),(o=f(l))[(t+1)%3]=1,this.shader.uniforms.screenAxis=o,this.vao.draw(this.gl.TRIANGLES,6)},d.drawAxisTicks=function(t,e,r,n,i){if(this.tickCount[t]){var a=f(o);a[t]=1,this.shader.uniforms.majorAxis=a,this.shader.uniforms.offset=e,this.shader.uniforms.minorAxis=r,this.shader.uniforms.color=n,this.shader.uniforms.lineWidth=i;var s=f(l);s[t]=1,this.shader.uniforms.screenAxis=s,this.vao.draw(this.gl.TRIANGLES,this.tickCount[t],this.tickOffset[t])}},d.drawGrid=function(t,e,r,n,i,a){if(this.gridCount[t]){var u=f(s);u[e]=r[1][e]-r[0][e],this.shader.uniforms.minorAxis=u;var p=h(c,n);p[e]+=r[0][e],this.shader.uniforms.offset=p;var d=f(o);d[t]=1,this.shader.uniforms.majorAxis=d;var m=f(l);m[t]=1,this.shader.uniforms.screenAxis=m,this.shader.uniforms.lineWidth=a,this.shader.uniforms.color=i,this.vao.draw(this.gl.TRIANGLES,this.gridCount[t],this.gridOffset[t])}},d.drawZero=function(t,e,r,n,i,a){var o=f(s);this.shader.uniforms.majorAxis=o,o[t]=r[1][t]-r[0][t],this.shader.uniforms.minorAxis=o;var u=h(c,n);u[t]+=r[0][t],this.shader.uniforms.offset=u;var p=f(l);p[e]=1,this.shader.uniforms.screenAxis=p,this.shader.uniforms.lineWidth=a,this.shader.uniforms.color=i,this.vao.draw(this.gl.TRIANGLES,6)},d.dispose=function(){this.vao.dispose(),this.vertBuffer.dispose(),this.shader.dispose()}},{"./shaders":227,"gl-buffer":231,"gl-vao":318}],227:[function(t,e,r){"use strict";var n=t("glslify"),i=t("gl-shader"),a=n(["precision highp float;\n#define GLSLIFY 1\n\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=n(["precision highp float;\n#define GLSLIFY 1\n\nuniform vec4 color;\nvoid main() {\n gl_FragColor = color;\n}"]);r.line=function(t){return i(t,a,o,null,[{name:"position",type:"vec3"}])};var s=n(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\nuniform vec3 offset, axis, alignDir, alignOpt;\nuniform float scale, angle, pixelScale;\nuniform vec2 resolution;\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\nfloat computeViewAngle(vec3 a, vec3 b) {\n vec3 A = project(a);\n vec3 B = project(b);\n\n return atan(\n (B.y - A.y) * resolution.y,\n (B.x - A.x) * resolution.x\n );\n}\n\nconst float PI = 3.141592;\nconst float TWO_PI = 2.0 * PI;\nconst float HALF_PI = 0.5 * PI;\nconst float ONE_AND_HALF_PI = 1.5 * PI;\n\nint option = int(floor(alignOpt.x + 0.001));\nfloat hv_ratio = alignOpt.y;\nbool enableAlign = (alignOpt.z != 0.0);\n\nfloat mod_angle(float a) {\n return mod(a, PI);\n}\n\nfloat positive_angle(float a) {\n return mod_angle((a < 0.0) ?\n a + TWO_PI :\n a\n );\n}\n\nfloat look_upwards(float a) {\n float b = positive_angle(a);\n return ((b > HALF_PI) && (b <= ONE_AND_HALF_PI)) ?\n b - PI :\n b;\n}\n\nfloat look_horizontal_or_vertical(float a, float ratio) {\n // ratio controls the ratio between being horizontal to (vertical + horizontal)\n // if ratio is set to 0.5 then it is 50%, 50%.\n // when using a higher ratio e.g. 0.75 the result would\n // likely be more horizontal than vertical.\n\n float b = positive_angle(a);\n\n return\n (b < ( ratio) * HALF_PI) ? 0.0 :\n (b < (2.0 - ratio) * HALF_PI) ? -HALF_PI :\n (b < (2.0 + ratio) * HALF_PI) ? 0.0 :\n (b < (4.0 - ratio) * HALF_PI) ? HALF_PI :\n 0.0;\n}\n\nfloat roundTo(float a, float b) {\n return float(b * floor((a + 0.5 * b) / b));\n}\n\nfloat look_round_n_directions(float a, int n) {\n float b = positive_angle(a);\n float div = TWO_PI / float(n);\n float c = roundTo(b, div);\n return look_upwards(c);\n}\n\nfloat applyAlignOption(float rawAngle, float delta) {\n return\n (option > 2) ? look_round_n_directions(rawAngle + delta, option) : // option 3-n: round to n directions\n (option == 2) ? look_horizontal_or_vertical(rawAngle + delta, hv_ratio) : // horizontal or vertical\n (option == 1) ? rawAngle + delta : // use free angle, and flip to align with one direction of the axis\n (option == 0) ? look_upwards(rawAngle) : // use free angle, and stay upwards\n (option ==-1) ? 0.0 : // useful for backward compatibility, all texts remains horizontal\n rawAngle; // otherwise return back raw input angle\n}\n\nbool isAxisTitle = (axis.x == 0.0) &&\n (axis.y == 0.0) &&\n (axis.z == 0.0);\n\nvoid main() {\n //Compute world offset\n float axisDistance = position.z;\n vec3 dataPosition = axisDistance * axis + offset;\n\n float beta = angle; // i.e. user defined attributes for each tick\n\n float axisAngle;\n float clipAngle;\n float flip;\n\n if (enableAlign) {\n axisAngle = (isAxisTitle) ? HALF_PI :\n computeViewAngle(dataPosition, dataPosition + axis);\n clipAngle = computeViewAngle(dataPosition, dataPosition + alignDir);\n\n axisAngle += (sin(axisAngle) < 0.0) ? PI : 0.0;\n clipAngle += (sin(clipAngle) < 0.0) ? PI : 0.0;\n\n flip = (dot(vec2(cos(axisAngle), sin(axisAngle)),\n vec2(sin(clipAngle),-cos(clipAngle))) > 0.0) ? 1.0 : 0.0;\n\n beta += applyAlignOption(clipAngle, flip * PI);\n }\n\n //Compute plane offset\n vec2 planeCoord = position.xy * pixelScale;\n\n mat2 planeXform = scale * mat2(\n cos(beta), sin(beta),\n -sin(beta), cos(beta)\n );\n\n vec2 viewOffset = 2.0 * planeXform * planeCoord / resolution;\n\n //Compute clip position\n vec3 clipPosition = project(dataPosition);\n\n //Apply text offset in clip coordinates\n clipPosition += vec3(viewOffset, 0.0);\n\n //Done\n gl_Position = vec4(clipPosition, 1.0);\n}"]),l=n(["precision highp float;\n#define GLSLIFY 1\n\nuniform vec4 color;\nvoid main() {\n gl_FragColor = color;\n}"]);r.text=function(t){return i(t,s,l,null,[{name:"position",type:"vec3"}])};var c=n(["precision highp float;\n#define GLSLIFY 1\n\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\n vec3 signAxis = sign(bounds[1] - bounds[0]);\n\n vec3 realNormal = signAxis * normal;\n\n if(dot(realNormal, enable) > 0.0) {\n vec3 minRange = min(bounds[0], bounds[1]);\n vec3 maxRange = max(bounds[0], bounds[1]);\n vec3 nPosition = mix(minRange, maxRange, 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\n colorChannel = abs(realNormal);\n}"]),u=n(["precision highp 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 i(t,c,u,null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},{"gl-shader":298,glslify:399}],228:[function(t,e,r){(function(r){(function(){"use strict";e.exports=function(t,e,r,a,s,l){var u=n(t),f=i(t,[{buffer:u,size:3}]),h=o(t);h.attributes.position.location=0;var p=new c(t,h,u,f);return p.update(e,r,a,s,l),p};var n=t("gl-buffer"),i=t("gl-vao"),a=t("vectorize-text"),o=t("./shaders").text,s=window||r.global||{},l=s.__TEXT_CACHE||{};s.__TEXT_CACHE={};function c(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}var u=c.prototype,f=[0,0];u.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,f[0]=this.gl.drawingBufferWidth,f[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=f},u.unbind=function(){this.vao.unbind()},u.update=function(t,e,r,n,i){var o=[];function s(t,e,r,n,i,s){var c=l[r];c||(c=l[r]={});var u=c[e];u||(u=c[e]=function(t,e){try{return a(t,e)}catch(e){return console.warn('error vectorizing text:"'+t+'" error:',e),{cells:[],positions:[]}}}(e,{triangles:!0,font:r,textAlign:"center",textBaseline:"middle",lineSpacing:i,styletags:s}));for(var f=(n||12)/12,h=u.positions,p=u.cells,d=0,m=p.length;d<m;++d)for(var g=p[d],v=2;v>=0;--v){var y=h[g[v]];o.push(f*y[0],-f*y[1],t)}}for(var c=[0,0,0],u=[0,0,0],f=[0,0,0],h=[0,0,0],p={breaklines:!0,bolds:!0,italics:!0,subscripts:!0,superscripts:!0},d=0;d<3;++d){f[d]=o.length/3|0,s(.5*(t[0][d]+t[1][d]),e[d],r[d],12,1.25,p),h[d]=(o.length/3|0)-f[d],c[d]=o.length/3|0;for(var m=0;m<n[d].length;++m)n[d][m].text&&s(n[d][m].x,n[d][m].text,n[d][m].font||i,n[d][m].fontSize||12,1.25,p);u[d]=(o.length/3|0)-c[d]}this.buffer.update(o),this.tickOffset=c,this.tickCount=u,this.labelOffset=f,this.labelCount=h},u.drawTicks=function(t,e,r,n,i,a,o,s){this.tickCount[t]&&(this.shader.uniforms.axis=a,this.shader.uniforms.color=i,this.shader.uniforms.angle=r,this.shader.uniforms.scale=e,this.shader.uniforms.offset=n,this.shader.uniforms.alignDir=o,this.shader.uniforms.alignOpt=s,this.vao.draw(this.gl.TRIANGLES,this.tickCount[t],this.tickOffset[t]))},u.drawLabel=function(t,e,r,n,i,a,o,s){this.labelCount[t]&&(this.shader.uniforms.axis=a,this.shader.uniforms.color=i,this.shader.uniforms.angle=r,this.shader.uniforms.scale=e,this.shader.uniforms.offset=n,this.shader.uniforms.alignDir=o,this.shader.uniforms.alignOpt=s,this.vao.draw(this.gl.TRIANGLES,this.labelCount[t],this.labelOffset[t]))},u.dispose=function(){this.shader.dispose(),this.vao.dispose(),this.buffer.dispose()}}).call(this)}).call(this,t("_process"))},{"./shaders":227,_process:1465,"gl-buffer":231,"gl-vao":318,"vectorize-text":1536}],229:[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 a=Math.pow(10,i),o=Math.round(t*e*a),s=o+"";if(s.indexOf("e")>=0)return s;var l=o/a,c=o%a;o<0?(l=0|-Math.ceil(l),c=0|-c):(l=0|Math.floor(l),c|=0);var u=""+l;if(o<0&&(u="-"+u),i){for(var f=""+c;f.length<i;)f="0"+f;return u+"."+f}return u}r.create=function(t,e){for(var r=[],i=0;i<3;++i){for(var a=[],o=(t[0][i],t[1][i],0);o*e[i]<=t[1][i];++o)a.push({x:o*e[i],text:n(e[i],o)});for(o=-1;o*e[i]>=t[0][i];--o)a.push({x:o*e[i],text:n(e[i],o)});r.push(a)}return r},r.equal=function(t,e){for(var r=0;r<3;++r){if(t[r].length!==e[r].length)return!1;for(var n=0;n<t[r].length;++n){var i=t[r][n],a=e[r][n];if(i.x!==a.x||i.text!==a.text||i.font!==a.font||i.fontColor!==a.fontColor||i.fontSize!==a.fontSize||i.dx!==a.dx||i.dy!==a.dy)return!1}}return!0}},{}],230:[function(t,e,r){"use strict";e.exports=function(t,e,r,l,f){var h=e.model||c,p=e.view||c,v=e.projection||c,y=e._ortho||!1,x=t.bounds,b=(f=f||a(h,p,v,x,y)).axis;o(u,p,h),o(u,v,u);for(var _=m,w=0;w<3;++w)_[w].lo=1/0,_[w].hi=-1/0,_[w].pixelsPerDataUnit=1/0;var T=n(s(u,u));s(u,u);for(var M=0;M<3;++M){var k=(M+1)%3,A=(M+2)%3,S=g;t:for(w=0;w<2;++w){var E=[];if(b[M]<0!=!!w){S[M]=x[w][M];for(var C=0;C<2;++C){S[k]=x[C^w][k];for(var L=0;L<2;++L)S[A]=x[L^C^w][A],E.push(S.slice())}var P=y?5:4;for(C=P;C===P;++C){if(0===E.length)continue t;E=i.positive(E,T[C])}for(C=0;C<E.length;++C){A=E[C];var I=d(g,u,A,r,l);for(L=0;L<3;++L)_[L].lo=Math.min(_[L].lo,A[L]),_[L].hi=Math.max(_[L].hi,A[L]),L!==M&&(_[L].pixelsPerDataUnit=Math.min(_[L].pixelsPerDataUnit,Math.abs(I[L])))}}}}return _};var n=t("extract-frustum-planes"),i=t("split-polygon"),a=t("./lib/cube.js"),o=t("gl-mat4/multiply"),s=t("gl-mat4/transpose"),l=t("gl-vec4/transformMat4"),c=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),u=new Float32Array(16);function f(t,e,r){this.lo=t,this.hi=e,this.pixelsPerDataUnit=r}var h=[0,0,0,1],p=[0,0,0,1];function d(t,e,r,n,i){for(var a=0;a<3;++a){for(var o=h,s=p,c=0;c<3;++c)s[c]=o[c]=r[c];s[3]=o[3]=1,s[a]+=1,l(s,s,e),s[3]<0&&(t[a]=1/0),o[a]-=1,l(o,o,e),o[3]<0&&(t[a]=1/0);var u=(o[0]/o[3]-s[0]/s[3])*n,f=(o[1]/o[3]-s[1]/s[3])*i;t[a]=.25*Math.sqrt(u*u+f*f)}return t}var m=[new f(1/0,-1/0,1/0),new f(1/0,-1/0,1/0),new f(1/0,-1/0,1/0)],g=[0,0,0]},{"./lib/cube.js":225,"extract-frustum-planes":213,"gl-mat4/multiply":264,"gl-mat4/transpose":275,"gl-vec4/transformMat4":389,"split-polygon":1502}],231:[function(t,e,r){"use strict";var n=t("typedarray-pool"),i=t("ndarray-ops"),a=t("ndarray"),o=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"];function s(t,e,r,n,i){this.gl=t,this.type=e,this.handle=r,this.length=n,this.usage=i}var l=s.prototype;function c(t,e,r,n,i,a){var o=i.length*i.BYTES_PER_ELEMENT;if(a<0)return t.bufferData(e,i,n),o;if(o+a>r)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return t.bufferSubData(e,a,i),r}function u(t,e){for(var r=n.malloc(t.length,e),i=t.length,a=0;a<i;++a)r[a]=t[a];return r}l.bind=function(){this.gl.bindBuffer(this.type,this.handle)},l.unbind=function(){this.gl.bindBuffer(this.type,null)},l.dispose=function(){this.gl.deleteBuffer(this.handle)},l.update=function(t,e){if("number"!=typeof e&&(e=-1),this.bind(),"object"==typeof t&&"undefined"!=typeof t.shape){var r=t.dtype;if(o.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER)r=gl.getExtension("OES_element_index_uint")&&"uint16"!==r?"uint32":"uint16";if(r===t.dtype&&function(t,e){for(var r=1,n=e.length-1;n>=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=c(this.gl,this.type,this.length,this.usage,t.data,e):this.length=c(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var s=n.malloc(t.size,r),l=a(s,t.shape);i.assign(l,t),this.length=c(this.gl,this.type,this.length,this.usage,e<0?s:s.subarray(0,t.size),e),n.free(s)}}else if(Array.isArray(t)){var f;f=this.type===this.gl.ELEMENT_ARRAY_BUFFER?u(t,"uint16"):u(t,"float32"),this.length=c(this.gl,this.type,this.length,this.usage,e<0?f:f.subarray(0,t.length),e),n.free(f)}else if("object"==typeof t&&"number"==typeof t.length)this.length=c(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)<=0&&(t=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=function(t,e,r,n){if(r=r||t.ARRAY_BUFFER,n=n||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(n!==t.DYNAMIC_DRAW&&n!==t.STATIC_DRAW&&n!==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 i=t.createBuffer(),a=new s(t,r,i,0,n);return a.update(e),a}},{ndarray:630,"ndarray-ops":625,"typedarray-pool":1531}],232:[function(t,e,r){"use strict";var n=t("gl-vec3");e.exports=function(t,e){var r=t.positions,i=t.vectors,a={positions:[],vertexIntensity:[],vertexIntensityBounds:t.vertexIntensityBounds,vectors:[],cells:[],coneOffset:t.coneOffset,colormap:t.colormap};if(0===t.positions.length)return e&&(e[0]=[0,0,0],e[1]=[0,0,0]),a;for(var o=0,s=1/0,l=-1/0,c=1/0,u=-1/0,f=1/0,h=-1/0,p=null,d=null,m=[],g=1/0,v=!1,y=0;y<r.length;y++){var x=r[y];s=Math.min(x[0],s),l=Math.max(x[0],l),c=Math.min(x[1],c),u=Math.max(x[1],u),f=Math.min(x[2],f),h=Math.max(x[2],h);var b=i[y];if(n.length(b)>o&&(o=n.length(b)),y){var _=2*n.distance(p,x)/(n.length(d)+n.length(b));_?(g=Math.min(g,_),v=!1):v=!0}v||(p=x,d=b),m.push(b)}var w=[s,c,f],T=[l,u,h];e&&(e[0]=w,e[1]=T),0===o&&(o=1);var M=1/o;isFinite(g)||(g=1),a.vectorScale=g;var k=t.coneSize||.5;t.absoluteConeSize&&(k=t.absoluteConeSize*M),a.coneScale=k;y=0;for(var A=0;y<r.length;y++)for(var S=(x=r[y])[0],E=x[1],C=x[2],L=m[y],P=n.length(L)*M,I=0;I<8;I++){a.positions.push([S,E,C,A++]),a.positions.push([S,E,C,A++]),a.positions.push([S,E,C,A++]),a.positions.push([S,E,C,A++]),a.positions.push([S,E,C,A++]),a.positions.push([S,E,C,A++]),a.vectors.push(L),a.vectors.push(L),a.vectors.push(L),a.vectors.push(L),a.vectors.push(L),a.vectors.push(L),a.vertexIntensity.push(P,P,P),a.vertexIntensity.push(P,P,P);var O=a.positions.length;a.cells.push([O-6,O-5,O-4],[O-3,O-2,O-1])}return a};var i=t("./lib/shaders");e.exports.createMesh=t("./create_mesh"),e.exports.createConeMesh=function(t,r){return e.exports.createMesh(t,r,{shaders:i,traceType:"cone"})}},{"./create_mesh":233,"./lib/shaders":234,"gl-vec3":337}],233:[function(t,e,r){"use strict";var n=t("gl-shader"),i=t("gl-buffer"),a=t("gl-vao"),o=t("gl-texture2d"),s=t("gl-mat4/multiply"),l=t("gl-mat4/invert"),c=t("ndarray"),u=t("colormap"),f=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function h(t,e,r,n,i,a,o,s,l,c,u){this.gl=t,this.pixelRatio=1,this.cells=[],this.positions=[],this.intensity=[],this.texture=e,this.dirty=!0,this.triShader=r,this.pickShader=n,this.trianglePositions=i,this.triangleVectors=a,this.triangleColors=s,this.triangleUVs=l,this.triangleIds=o,this.triangleVAO=c,this.triangleCount=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.traceType=u,this.tubeScale=1,this.coneScale=2,this.vectorScale=1,this.coneOffset=.25,this._model=f,this._view=f,this._projection=f,this._resolution=[1,1]}var p=h.prototype;function d(t,e){var r=n(t,e.meshShader.vertex,e.meshShader.fragment,null,e.meshShader.attributes);return r.attributes.position.location=0,r.attributes.color.location=2,r.attributes.uv.location=3,r.attributes.vector.location=4,r}function m(t,e){var r=n(t,e.pickShader.vertex,e.pickShader.fragment,null,e.pickShader.attributes);return r.attributes.position.location=0,r.attributes.id.location=1,r.attributes.vector.location=4,r}p.isOpaque=function(){return this.opacity>=1},p.isTransparent=function(){return this.opacity<1},p.pickSlots=1,p.setPickBase=function(t){this.pickId=t},p.update=function(t){t=t||{};var e=this.gl;this.dirty=!0,"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),void 0!==t.tubeScale&&(this.tubeScale=t.tubeScale),void 0!==t.vectorScale&&(this.vectorScale=t.vectorScale),void 0!==t.coneScale&&(this.coneScale=t.coneScale),void 0!==t.coneOffset&&(this.coneOffset=t.coneOffset),t.colormap&&(this.texture.shape=[256,256],this.texture.minFilter=e.LINEAR_MIPMAP_LINEAR,this.texture.magFilter=e.LINEAR,this.texture.setPixels(function(t){for(var e=u({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;n<256;++n){for(var i=e[n],a=0;a<3;++a)r[4*n+a]=i[a];r[4*n+3]=255*i[3]}return c(r,[256,256,4],[4,0,1])}(t.colormap)),this.texture.generateMipmap());var r=t.cells,n=t.positions,i=t.vectors;if(n&&r&&i){var a=[],o=[],s=[],l=[],f=[];this.cells=r,this.positions=n,this.vectors=i;var h=t.meshColor||[1,1,1,1],p=t.vertexIntensity,d=1/0,m=-1/0;if(p)if(t.vertexIntensityBounds)d=+t.vertexIntensityBounds[0],m=+t.vertexIntensityBounds[1];else for(var g=0;g<p.length;++g){var v=p[g];d=Math.min(d,v),m=Math.max(m,v)}else for(g=0;g<n.length;++g){v=n[g][2];d=Math.min(d,v),m=Math.max(m,v)}this.intensity=p||function(t){for(var e=t.length,r=new Array(e),n=0;n<e;++n)r[n]=t[n][2];return r}(n),this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]];for(g=0;g<n.length;++g)for(var y=n[g],x=0;x<3;++x)!isNaN(y[x])&&isFinite(y[x])&&(this.bounds[0][x]=Math.min(this.bounds[0][x],y[x]),this.bounds[1][x]=Math.max(this.bounds[1][x],y[x]));var b=0;t:for(g=0;g<r.length;++g){var _=r[g];switch(_.length){case 3:for(x=0;x<3;++x){y=n[T=_[x]];for(var w=0;w<3;++w)if(isNaN(y[w])||!isFinite(y[w]))continue t}for(x=0;x<3;++x){var T;y=n[T=_[2-x]];a.push(y[0],y[1],y[2],y[3]);var M=i[T];o.push(M[0],M[1],M[2],M[3]||0);var k,A=h;3===A.length?s.push(A[0],A[1],A[2],1):s.push(A[0],A[1],A[2],A[3]),k=p?[(p[T]-d)/(m-d),0]:[(y[2]-d)/(m-d),0],l.push(k[0],k[1]),f.push(g)}b+=1}}this.triangleCount=b,this.trianglePositions.update(a),this.triangleVectors.update(o),this.triangleColors.update(s),this.triangleUVs.update(l),this.triangleIds.update(new Uint32Array(f))}},p.drawTransparent=p.draw=function(t){t=t||{};for(var e=this.gl,r=t.model||f,n=t.view||f,i=t.projection||f,a=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)a[0][o]=Math.max(a[0][o],this.clipBounds[0][o]),a[1][o]=Math.min(a[1][o],this.clipBounds[1][o]);var c={model:r,view:n,projection:i,inverseModel:f.slice(),clipBounds:a,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,tubeScale:this.tubeScale,vectorScale:this.vectorScale,coneScale:this.coneScale,coneOffset:this.coneOffset,texture:0};c.inverseModel=l(c.inverseModel,c.model),e.disable(e.CULL_FACE),this.texture.bind(0);var u=new Array(16);s(u,c.view,c.model),s(u,c.projection,u),l(u,u);for(o=0;o<3;++o)c.eyePosition[o]=u[12+o]/u[15];var h=u[15];for(o=0;o<3;++o)h+=this.lightPosition[o]*u[4*o+3];for(o=0;o<3;++o){for(var p=u[12+o],d=0;d<3;++d)p+=u[4*d+o]*this.lightPosition[d];c.lightPosition[o]=p/h}if(this.triangleCount>0){var m=this.triShader;m.bind(),m.uniforms=c,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}},p.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||f,n=t.view||f,i=t.projection||f,a=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)a[0][o]=Math.max(a[0][o],this.clipBounds[0][o]),a[1][o]=Math.min(a[1][o],this.clipBounds[1][o]);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:a,tubeScale:this.tubeScale,vectorScale:this.vectorScale,coneScale:this.coneScale,coneOffset:this.coneOffset,pickId:this.pickId/255},l=this.pickShader;l.bind(),l.uniforms=s,this.triangleCount>0&&(this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind())},p.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[0]+256*t.value[1]+65536*t.value[2],r=this.cells[e],n=this.positions[r[1]].slice(0,3),i={position:n,dataCoordinate:n,index:Math.floor(r[1]/48)};return"cone"===this.traceType?i.index=Math.floor(r[1]/48):"streamtube"===this.traceType&&(i.intensity=this.intensity[r[1]],i.velocity=this.vectors[r[1]].slice(0,3),i.divergence=this.vectors[r[1]][3],i.index=e),i},p.dispose=function(){this.texture.dispose(),this.triShader.dispose(),this.pickShader.dispose(),this.triangleVAO.dispose(),this.trianglePositions.dispose(),this.triangleVectors.dispose(),this.triangleColors.dispose(),this.triangleUVs.dispose(),this.triangleIds.dispose()},e.exports=function(t,e,r){var n=r.shaders;1===arguments.length&&(t=(e=t).gl);var s=d(t,n),l=m(t,n),u=o(t,c(new Uint8Array([255,255,255,255]),[1,1,4]));u.generateMipmap(),u.minFilter=t.LINEAR_MIPMAP_LINEAR,u.magFilter=t.LINEAR;var f=i(t),p=i(t),g=i(t),v=i(t),y=i(t),x=a(t,[{buffer:f,type:t.FLOAT,size:4},{buffer:y,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:g,type:t.FLOAT,size:4},{buffer:v,type:t.FLOAT,size:2},{buffer:p,type:t.FLOAT,size:4}]),b=new h(t,u,s,l,f,p,y,g,v,x,r.traceType||"cone");return b.update(e),b}},{colormap:98,"gl-buffer":231,"gl-mat4/invert":262,"gl-mat4/multiply":264,"gl-shader":298,"gl-texture2d":313,"gl-vao":318,ndarray:630}],234:[function(t,e,r){var n=t("glslify"),i=n(["precision highp float;\n\nprecision highp float;\n#define GLSLIFY 1\n\nvec3 getOrthogonalVector(vec3 v) {\n // Return up-vector for only-z vector.\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the cone vertex and normal at the given index.\n//\n// The returned vertex is for a cone with its top at origin and height of 1.0,\n// pointing in the direction of the vector attribute.\n//\n// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.\n// These vertices are used to make up the triangles of the cone by the following:\n// segment + 0 top vertex\n// segment + 1 perimeter vertex a+1\n// segment + 2 perimeter vertex a\n// segment + 3 center base vertex\n// segment + 4 perimeter vertex a\n// segment + 5 perimeter vertex a+1\n// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.\n// To go from index to segment, floor(index / 6)\n// To go from segment to angle, 2*pi * (segment/segmentCount)\n// To go from index to segment index, index - (segment*6)\n//\nvec3 getConePosition(vec3 d, float rawIndex, float coneOffset, out vec3 normal) {\n\n const float segmentCount = 8.0;\n\n float index = rawIndex - floor(rawIndex /\n (segmentCount * 6.0)) *\n (segmentCount * 6.0);\n\n float segment = floor(0.001 + index/6.0);\n float segmentIndex = index - (segment*6.0);\n\n normal = -normalize(d);\n\n if (segmentIndex > 2.99 && segmentIndex < 3.01) {\n return mix(vec3(0.0), -d, coneOffset);\n }\n\n float nextAngle = (\n (segmentIndex > 0.99 && segmentIndex < 1.01) ||\n (segmentIndex > 4.99 && segmentIndex < 5.01)\n ) ? 1.0 : 0.0;\n float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);\n\n vec3 v1 = mix(d, vec3(0.0), coneOffset);\n vec3 v2 = v1 - d;\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d)*0.25;\n vec3 y = v * sin(angle) * length(d)*0.25;\n vec3 v3 = v2 + x + y;\n if (segmentIndex < 3.0) {\n vec3 tx = u * sin(angle);\n vec3 ty = v * -cos(angle);\n vec3 tangent = tx + ty;\n normal = normalize(cross(v3 - v1, tangent));\n }\n\n if (segmentIndex == 0.0) {\n return mix(d, vec3(0.0), coneOffset);\n }\n return v3;\n}\n\nattribute vec3 vector;\nattribute vec4 color, position;\nattribute vec2 uv;\n\nuniform float vectorScale, coneScale, coneOffset;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 eyePosition, lightPosition;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n // Scale the vector magnitude to stay constant with\n // model & view changes.\n vec3 normal;\n vec3 XYZ = getConePosition(mat3(model) * ((vectorScale * coneScale) * vector), position.w, coneOffset, normal);\n vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * conePosition;\n cameraCoordinate.xyz /= cameraCoordinate.w;\n f_lightDirection = lightPosition - cameraCoordinate.xyz;\n f_eyeDirection = eyePosition - cameraCoordinate.xyz;\n f_normal = normalize((vec4(normal, 0.0) * inverseModel).xyz);\n\n // vec4 m_position = model * vec4(conePosition, 1.0);\n vec4 t_position = view * conePosition;\n gl_Position = projection * t_position;\n\n f_color = color;\n f_data = conePosition.xyz;\n f_position = position.xyz;\n f_uv = uv;\n}\n"]),a=n(["#extension GL_OES_standard_derivatives : enable\n\nprecision highp float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution(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\nfloat cookTorranceSpecular(\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(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\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\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 = min(1.0, max(0.0, cookTorranceSpecular(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}\n"]),o=n(["precision highp float;\n\nprecision highp float;\n#define GLSLIFY 1\n\nvec3 getOrthogonalVector(vec3 v) {\n // Return up-vector for only-z vector.\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the cone vertex and normal at the given index.\n//\n// The returned vertex is for a cone with its top at origin and height of 1.0,\n// pointing in the direction of the vector attribute.\n//\n// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.\n// These vertices are used to make up the triangles of the cone by the following:\n// segment + 0 top vertex\n// segment + 1 perimeter vertex a+1\n// segment + 2 perimeter vertex a\n// segment + 3 center base vertex\n// segment + 4 perimeter vertex a\n// segment + 5 perimeter vertex a+1\n// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.\n// To go from index to segment, floor(index / 6)\n// To go from segment to angle, 2*pi * (segment/segmentCount)\n// To go from index to segment index, index - (segment*6)\n//\nvec3 getConePosition(vec3 d, float rawIndex, float coneOffset, out vec3 normal) {\n\n const float segmentCount = 8.0;\n\n float index = rawIndex - floor(rawIndex /\n (segmentCount * 6.0)) *\n (segmentCount * 6.0);\n\n float segment = floor(0.001 + index/6.0);\n float segmentIndex = index - (segment*6.0);\n\n normal = -normalize(d);\n\n if (segmentIndex > 2.99 && segmentIndex < 3.01) {\n return mix(vec3(0.0), -d, coneOffset);\n }\n\n float nextAngle = (\n (segmentIndex > 0.99 && segmentIndex < 1.01) ||\n (segmentIndex > 4.99 && segmentIndex < 5.01)\n ) ? 1.0 : 0.0;\n float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);\n\n vec3 v1 = mix(d, vec3(0.0), coneOffset);\n vec3 v2 = v1 - d;\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d)*0.25;\n vec3 y = v * sin(angle) * length(d)*0.25;\n vec3 v3 = v2 + x + y;\n if (segmentIndex < 3.0) {\n vec3 tx = u * sin(angle);\n vec3 ty = v * -cos(angle);\n vec3 tangent = tx + ty;\n normal = normalize(cross(v3 - v1, tangent));\n }\n\n if (segmentIndex == 0.0) {\n return mix(d, vec3(0.0), coneOffset);\n }\n return v3;\n}\n\nattribute vec4 vector;\nattribute vec4 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform float vectorScale, coneScale, coneOffset;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n vec3 normal;\n vec3 XYZ = getConePosition(mat3(model) * ((vectorScale * coneScale) * vector.xyz), position.w, coneOffset, normal);\n vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);\n gl_Position = projection * view * conePosition;\n f_id = id;\n f_position = position.xyz;\n}\n"]),s=n(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\n\n gl_FragColor = vec4(pickId, f_id.xyz);\n}"]);r.meshShader={vertex:i,fragment:a,attributes:[{name:"position",type:"vec4"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"vector",type:"vec3"}]},r.pickShader={vertex:o,fragment:s,attributes:[{name:"position",type:"vec4"},{name:"id",type:"vec4"},{name:"vector",type:"vec3"}]}},{glslify:399}],235:[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"}},{}],236:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":235}],237:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl,r=n(e),o=i(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}]),l=a(e);l.attributes.position.location=0,l.attributes.color.location=1,l.attributes.offset.location=2;var c=new s(e,r,o,l);return c.update(t),c};var n=t("gl-buffer"),i=t("gl-vao"),a=t("./shaders/index"),o=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function s(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,this.hasAlpha=!1}var l=s.prototype;function c(t,e){for(var r=0;r<3;++r)t[0][r]=Math.min(t[0][r],e[r]),t[1][r]=Math.max(t[1][r],e[r])}l.isOpaque=function(){return!this.hasAlpha},l.isTransparent=function(){return this.hasAlpha},l.drawTransparent=l.draw=function(t){var e=this.gl,r=this.shader.uniforms;this.shader.bind();var n=r.view=t.view||o,i=r.projection=t.projection||o;r.model=t.model||o,r.clipBounds=this.clipBounds,r.opacity=this.opacity;var a=n[12],s=n[13],l=n[14],c=n[15],u=(t._ortho||!1?2:1)*this.pixelRatio*(i[3]*a+i[7]*s+i[11]*l+i[15]*c)/e.drawingBufferHeight;this.vao.bind();for(var f=0;f<3;++f)e.lineWidth(this.lineWidth[f]*this.pixelRatio),r.capSize=this.capSize[f]*u,this.lineCount[f]&&e.drawArrays(e.LINES,this.lineOffset[f],this.lineCount[f]);this.vao.unbind()};var u=function(){for(var t=new Array(3),e=0;e<3;++e){for(var r=[],n=1;n<=2;++n)for(var i=-1;i<=1;i+=2){var a=[0,0,0];a[(n+e)%3]=i,r.push(a)}t[e]=r}return t}();function f(t,e,r,n){for(var i=u[n],a=0;a<i.length;++a){var o=i[a];t.push(e[0],e[1],e[2],r[0],r[1],r[2],r[3],o[0],o[1],o[2])}return i.length}l.update=function(t){"lineWidth"in(t=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])),this.hasAlpha=!1,"opacity"in t&&(this.opacity=+t.opacity,this.opacity<1&&(this.hasAlpha=!0));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 i=[],a=r.length,o=0;this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.lineCount=[0,0,0];for(var s=0;s<3;++s){this.lineOffset[s]=o;t:for(var l=0;l<a;++l){for(var u=r[l],h=0;h<3;++h)if(isNaN(u[h])||!isFinite(u[h]))continue t;var p=n[l],d=e[s];if(Array.isArray(d[0])&&(d=e[l]),3===d.length?d=[d[0],d[1],d[2],1]:4===d.length&&(d=[d[0],d[1],d[2],d[3]],!this.hasAlpha&&d[3]<1&&(this.hasAlpha=!0)),!isNaN(p[0][s])&&!isNaN(p[1][s])){var m;if(p[0][s]<0)(m=u.slice())[s]+=p[0][s],i.push(u[0],u[1],u[2],d[0],d[1],d[2],d[3],0,0,0,m[0],m[1],m[2],d[0],d[1],d[2],d[3],0,0,0),c(this.bounds,m),o+=2+f(i,m,d,s);if(p[1][s]>0)(m=u.slice())[s]+=p[1][s],i.push(u[0],u[1],u[2],d[0],d[1],d[2],d[3],0,0,0,m[0],m[1],m[2],d[0],d[1],d[2],d[3],0,0,0),c(this.bounds,m),o+=2+f(i,m,d,s)}}this.lineCount[s]=o-this.lineOffset[s]}this.buffer.update(i)}},l.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()}},{"./shaders/index":238,"gl-buffer":231,"gl-vao":318}],238:[function(t,e,r){"use strict";var n=t("glslify"),i=t("gl-shader"),a=n(["precision highp 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=n(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float opacity;\nvarying vec3 fragPosition;\nvarying vec4 fragColor;\n\nvoid main() {\n if (\n outOfRange(clipBounds[0], clipBounds[1], fragPosition) ||\n fragColor.a * opacity == 0.\n ) discard;\n\n gl_FragColor = opacity * fragColor;\n}"]);e.exports=function(t){return i(t,a,o,null,[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"offset",type:"vec3"}])}},{"gl-shader":298,glslify:399}],239:[function(t,e,r){"use strict";var n=t("gl-texture2d");e.exports=function(t,e,r,n){i||(i=t.FRAMEBUFFER_UNSUPPORTED,a=t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT,o=t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS,s=t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);var c=t.getExtension("WEBGL_draw_buffers");!l&&c&&function(t,e){var r=t.getParameter(e.MAX_COLOR_ATTACHMENTS_WEBGL);l=new Array(r+1);for(var n=0;n<=r;++n){for(var i=new Array(r),a=0;a<n;++a)i[a]=t.COLOR_ATTACHMENT0+a;for(a=n;a<r;++a)i[a]=t.NONE;l[n]=i}}(t,c);Array.isArray(e)&&(n=r,r=0|e[1],e=0|e[0]);if("number"!=typeof e)throw new Error("gl-fbo: Missing shape parameter");var u=t.getParameter(t.MAX_RENDERBUFFER_SIZE);if(e<0||e>u||r<0||r>u)throw new Error("gl-fbo: Parameters are too large for FBO");var f=1;if("color"in(n=n||{})){if((f=Math.max(0|n.color,0))<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(f>1){if(!c)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(f>t.getParameter(c.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+f+" draw buffers")}}var h=t.UNSIGNED_BYTE,p=t.getExtension("OES_texture_float");if(n.float&&f>0){if(!p)throw new Error("gl-fbo: Context does not support floating point textures");h=t.FLOAT}else n.preferFloat&&f>0&&p&&(h=t.FLOAT);var m=!0;"depth"in n&&(m=!!n.depth);var g=!1;"stencil"in n&&(g=!!n.stencil);return new d(t,e,r,h,f,m,g,c)};var i,a,o,s,l=null;function c(t){return[t.getParameter(t.FRAMEBUFFER_BINDING),t.getParameter(t.RENDERBUFFER_BINDING),t.getParameter(t.TEXTURE_BINDING_2D)]}function u(t,e){t.bindFramebuffer(t.FRAMEBUFFER,e[0]),t.bindRenderbuffer(t.RENDERBUFFER,e[1]),t.bindTexture(t.TEXTURE_2D,e[2])}function f(t){switch(t){case i:throw new Error("gl-fbo: Framebuffer unsupported");case a:throw new Error("gl-fbo: Framebuffer incomplete attachment");case o:throw new Error("gl-fbo: Framebuffer incomplete dimensions");case s:throw new Error("gl-fbo: Framebuffer incomplete missing attachment");default:throw new Error("gl-fbo: Framebuffer failed for unspecified reason")}}function h(t,e,r,i,a,o){if(!i)return null;var s=n(t,e,r,a,i);return s.magFilter=t.NEAREST,s.minFilter=t.NEAREST,s.mipSamples=1,s.bind(),t.framebufferTexture2D(t.FRAMEBUFFER,o,t.TEXTURE_2D,s.handle,0),s}function p(t,e,r,n,i){var a=t.createRenderbuffer();return t.bindRenderbuffer(t.RENDERBUFFER,a),t.renderbufferStorage(t.RENDERBUFFER,n,e,r),t.framebufferRenderbuffer(t.FRAMEBUFFER,i,t.RENDERBUFFER,a),a}function d(t,e,r,n,i,a,o,s){this.gl=t,this._shape=[0|e,0|r],this._destroyed=!1,this._ext=s,this.color=new Array(i);for(var d=0;d<i;++d)this.color[d]=null;this._color_rb=null,this.depth=null,this._depth_rb=null,this._colorType=n,this._useDepth=a,this._useStencil=o;var m=this,g=[0|e,0|r];Object.defineProperties(g,{0:{get:function(){return m._shape[0]},set:function(t){return m.width=t}},1:{get:function(){return m._shape[1]},set:function(t){return m.height=t}}}),this._shapeVector=g,function(t){var e=c(t.gl),r=t.gl,n=t.handle=r.createFramebuffer(),i=t._shape[0],a=t._shape[1],o=t.color.length,s=t._ext,d=t._useStencil,m=t._useDepth,g=t._colorType;r.bindFramebuffer(r.FRAMEBUFFER,n);for(var v=0;v<o;++v)t.color[v]=h(r,i,a,g,r.RGBA,r.COLOR_ATTACHMENT0+v);0===o?(t._color_rb=p(r,i,a,r.RGBA4,r.COLOR_ATTACHMENT0),s&&s.drawBuffersWEBGL(l[0])):o>1&&s.drawBuffersWEBGL(l[o]);var y=r.getExtension("WEBGL_depth_texture");y?d?t.depth=h(r,i,a,y.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):m&&(t.depth=h(r,i,a,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):m&&d?t._depth_rb=p(r,i,a,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):m?t._depth_rb=p(r,i,a,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):d&&(t._depth_rb=p(r,i,a,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var x=r.checkFramebufferStatus(r.FRAMEBUFFER);if(x!==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(v=0;v<t.color.length;++v)t.color[v].dispose(),t.color[v]=null;t._color_rb&&(r.deleteRenderbuffer(t._color_rb),t._color_rb=null),u(r,e),f(x)}u(r,e)}(this)}var m=d.prototype;function g(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 n=t.gl,i=n.getParameter(n.MAX_RENDERBUFFER_SIZE);if(e<0||e>i||r<0||r>i)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var a=c(n),o=0;o<t.color.length;++o)t.color[o].shape=t._shape;t._color_rb&&(n.bindRenderbuffer(n.RENDERBUFFER,t._color_rb),n.renderbufferStorage(n.RENDERBUFFER,n.RGBA4,t._shape[0],t._shape[1])),t.depth&&(t.depth.shape=t._shape),t._depth_rb&&(n.bindRenderbuffer(n.RENDERBUFFER,t._depth_rb),t._useDepth&&t._useStencil?n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,t._shape[0],t._shape[1]):t._useDepth?n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,t._shape[0],t._shape[1]):t._useStencil&&n.renderbufferStorage(n.RENDERBUFFER,n.STENCIL_INDEX,t._shape[0],t._shape[1])),n.bindFramebuffer(n.FRAMEBUFFER,t.handle);var s=n.checkFramebufferStatus(n.FRAMEBUFFER);s!==n.FRAMEBUFFER_COMPLETE&&(t.dispose(),u(n,a),f(s)),u(n,a)}}Object.defineProperties(m,{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 g(this,e,r),[e,r]},enumerable:!1},width:{get:function(){return this._destroyed?0:this._shape[0]},set:function(t){return g(this,t|=0,this._shape[1]),t},enumerable:!1},height:{get:function(){return this._destroyed?0:this._shape[1]},set:function(t){return t|=0,g(this,this._shape[0],t),t},enumerable:!1}}),m.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])}},m.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":313}],240:[function(t,e,r){var n=t("sprintf-js").sprintf,i=t("gl-constants/lookup"),a=t("glsl-shader-name"),o=t("add-line-numbers");e.exports=function(t,e,r){"use strict";var s=a(e)||"of unknown name (see npm glsl-shader-name)",l="unknown type";void 0!==r&&(l=r===i.FRAGMENT_SHADER?"fragment":"vertex");for(var c=n("Error compiling %s shader %s:\n",l,s),u=n("%s%s",c,t),f=t.split("\n"),h={},p=0;p<f.length;p++){var d=f[p];if(""!==d&&"\0"!==d){var m=parseInt(d.split(":")[2]);if(isNaN(m))throw new Error(n("Could not parse error: %s",d));h[m]=d}}var g=o(e).split("\n");for(p=0;p<g.length;p++)if(h[p+3]||h[p+2]||h[p+1]){var v=g[p];if(c+=v+"\n",h[p+1]){var y=h[p+1];y=y.substr(y.split(":",3).join(":").length+1).trim(),c+=n("^^^ %s\n\n",y)}}return{long:c.trim(),short:u.trim()}}},{"add-line-numbers":33,"gl-constants/lookup":236,"glsl-shader-name":391,"sprintf-js":241}],241:[function(t,e,r){!function(){"use strict";var t={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function e(t){return i(o(t),arguments)}function n(t,r){return e.apply(null,[t].concat(r||[]))}function i(r,n){var i,a,o,s,l,c,u,f,h,p=1,d=r.length,m="";for(a=0;a<d;a++)if("string"==typeof r[a])m+=r[a];else if("object"==typeof r[a]){if((s=r[a]).keys)for(i=n[p],o=0;o<s.keys.length;o++){if(null==i)throw new Error(e('[sprintf] Cannot access property "%s" of undefined value "%s"',s.keys[o],s.keys[o-1]));i=i[s.keys[o]]}else i=s.param_no?n[s.param_no]:n[p++];if(t.not_type.test(s.type)&&t.not_primitive.test(s.type)&&i instanceof Function&&(i=i()),t.numeric_arg.test(s.type)&&"number"!=typeof i&&isNaN(i))throw new TypeError(e("[sprintf] expecting number but found %T",i));switch(t.number.test(s.type)&&(f=i>=0),s.type){case"b":i=parseInt(i,10).toString(2);break;case"c":i=String.fromCharCode(parseInt(i,10));break;case"d":case"i":i=parseInt(i,10);break;case"j":i=JSON.stringify(i,null,s.width?parseInt(s.width):0);break;case"e":i=s.precision?parseFloat(i).toExponential(s.precision):parseFloat(i).toExponential();break;case"f":i=s.precision?parseFloat(i).toFixed(s.precision):parseFloat(i);break;case"g":i=s.precision?String(Number(i.toPrecision(s.precision))):parseFloat(i);break;case"o":i=(parseInt(i,10)>>>0).toString(8);break;case"s":i=String(i),i=s.precision?i.substring(0,s.precision):i;break;case"t":i=String(!!i),i=s.precision?i.substring(0,s.precision):i;break;case"T":i=Object.prototype.toString.call(i).slice(8,-1).toLowerCase(),i=s.precision?i.substring(0,s.precision):i;break;case"u":i=parseInt(i,10)>>>0;break;case"v":i=i.valueOf(),i=s.precision?i.substring(0,s.precision):i;break;case"x":i=(parseInt(i,10)>>>0).toString(16);break;case"X":i=(parseInt(i,10)>>>0).toString(16).toUpperCase()}t.json.test(s.type)?m+=i:(!t.number.test(s.type)||f&&!s.sign?h="":(h=f?"+":"-",i=i.toString().replace(t.sign,"")),c=s.pad_char?"0"===s.pad_char?"0":s.pad_char.charAt(1):" ",u=s.width-(h+i).length,l=s.width&&u>0?c.repeat(u):"",m+=s.align?h+i+l:"0"===c?h+l+i:l+h+i)}return m}var a=Object.create(null);function o(e){if(a[e])return a[e];for(var r,n=e,i=[],o=0;n;){if(null!==(r=t.text.exec(n)))i.push(r[0]);else if(null!==(r=t.modulo.exec(n)))i.push("%");else{if(null===(r=t.placeholder.exec(n)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){o|=1;var s=[],l=r[2],c=[];if(null===(c=t.key.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(s.push(c[1]);""!==(l=l.substring(c[0].length));)if(null!==(c=t.key_access.exec(l)))s.push(c[1]);else{if(null===(c=t.index_access.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");s.push(c[1])}r[2]=s}else o|=2;if(3===o)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");i.push({placeholder:r[0],param_no:r[1],keys:r[2],sign:r[3],pad_char:r[4],align:r[5],width:r[6],precision:r[7],type:r[8]})}n=n.substring(r[0].length)}return a[e]=i}"undefined"!=typeof r&&(r.sprintf=e,r.vsprintf=n),"undefined"!=typeof window&&(window.sprintf=e,window.vsprintf=n)}()},{}],242:[function(t,e,r){"use strict";e.exports=function(t,e){var r=t.gl,n=o(r,l.vertex,l.fragment),i=o(r,l.pickVertex,l.pickFragment),a=s(r),u=s(r),f=s(r),h=s(r),p=new c(t,n,i,a,u,f,h);return p.update(e),t.addObject(p),p};var n=t("binary-search-bounds"),i=t("iota-array"),a=t("typedarray-pool"),o=t("gl-shader"),s=t("gl-buffer"),l=t("./lib/shaders");function c(t,e,r,n,i,a,o){this.plot=t,this.shader=e,this.pickShader=r,this.positionBuffer=n,this.weightBuffer=i,this.colorBuffer=a,this.idBuffer=o,this.xData=[],this.yData=[],this.shape=[0,0],this.bounds=[1/0,1/0,-1/0,-1/0],this.pickOffset=0}var u,f=c.prototype,h=[0,0,1,0,0,1,1,0,1,1,0,1];f.draw=(u=[1,0,0,0,1,0,0,0,1],function(){var t=this.plot,e=this.shader,r=this.bounds,n=this.numVertices;if(!(n<=0)){var i=t.gl,a=t.dataBox,o=r[2]-r[0],s=r[3]-r[1],l=a[2]-a[0],c=a[3]-a[1];u[0]=2*o/l,u[4]=2*s/c,u[6]=2*(r[0]-a[0])/l-1,u[7]=2*(r[1]-a[1])/c-1,e.bind();var f=e.uniforms;f.viewTransform=u,f.shape=this.shape;var h=e.attributes;this.positionBuffer.bind(),h.position.pointer(),this.weightBuffer.bind(),h.weight.pointer(i.UNSIGNED_BYTE,!1),this.colorBuffer.bind(),h.color.pointer(i.UNSIGNED_BYTE,!0),i.drawArrays(i.TRIANGLES,0,n)}}),f.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,a=this.bounds,o=this.numVertices;if(!(o<=0)){var s=n.gl,l=n.dataBox,c=a[2]-a[0],u=a[3]-a[1],f=l[2]-l[0],h=l[3]-l[1];t[0]=2*c/f,t[4]=2*u/h,t[6]=2*(a[0]-l[0])/f-1,t[7]=2*(a[1]-l[1])/h-1;for(var p=0;p<4;++p)e[p]=r>>8*p&255;this.pickOffset=r,i.bind();var d=i.uniforms;d.viewTransform=t,d.pickOffset=e,d.shape=this.shape;var m=i.attributes;return this.positionBuffer.bind(),m.position.pointer(),this.weightBuffer.bind(),m.weight.pointer(s.UNSIGNED_BYTE,!1),this.idBuffer.bind(),m.pickId.pointer(s.UNSIGNED_BYTE,!1),s.drawArrays(s.TRIANGLES,0,o),r+this.shape[0]*this.shape[1]}}}(),f.pick=function(t,e,r){var n=this.pickOffset,i=this.shape[0]*this.shape[1];if(r<n||r>=n+i)return null;var a=r-n,o=this.xData,s=this.yData;return{object:this,pointId:a,dataCoord:[o[a%this.shape[0]],s[a/this.shape[0]|0]]}},f.update=function(t){var e=(t=t||{}).shape||[0,0],r=t.x||i(e[0]),o=t.y||i(e[1]),s=t.z||new Float32Array(e[0]*e[1]),l=!1!==t.zsmooth;this.xData=r,this.yData=o;var c,u,f,p,d=t.colorLevels||[0],m=t.colorValues||[0,0,0,1],g=d.length,v=this.bounds;l?(c=v[0]=r[0],u=v[1]=o[0],f=v[2]=r[r.length-1],p=v[3]=o[o.length-1]):(c=v[0]=r[0]+(r[1]-r[0])/2,u=v[1]=o[0]+(o[1]-o[0])/2,f=v[2]=r[r.length-1]+(r[r.length-1]-r[r.length-2])/2,p=v[3]=o[o.length-1]+(o[o.length-1]-o[o.length-2])/2);var y=1/(f-c),x=1/(p-u),b=e[0],_=e[1];this.shape=[b,_];var w=(l?(b-1)*(_-1):b*_)*(h.length>>>1);this.numVertices=w;for(var T=a.mallocUint8(4*w),M=a.mallocFloat32(2*w),k=a.mallocUint8(2*w),A=a.mallocUint32(w),S=0,E=l?b-1:b,C=l?_-1:_,L=0;L<C;++L){var P,I;l?(P=x*(o[L]-u),I=x*(o[L+1]-u)):(P=L<_-1?x*(o[L]-(o[L+1]-o[L])/2-u):x*(o[L]-(o[L]-o[L-1])/2-u),I=L<_-1?x*(o[L]+(o[L+1]-o[L])/2-u):x*(o[L]+(o[L]-o[L-1])/2-u));for(var O=0;O<E;++O){var z,D;l?(z=y*(r[O]-c),D=y*(r[O+1]-c)):(z=O<b-1?y*(r[O]-(r[O+1]-r[O])/2-c):y*(r[O]-(r[O]-r[O-1])/2-c),D=O<b-1?y*(r[O]+(r[O+1]-r[O])/2-c):y*(r[O]+(r[O]-r[O-1])/2-c));for(var N=0;N<h.length;N+=2){var R,F,B,j,U=h[N],V=h[N+1],q=s[l?(L+V)*b+(O+U):L*b+O],H=n.le(d,q);if(H<0)R=m[0],F=m[1],B=m[2],j=m[3];else if(H===g-1)R=m[4*g-4],F=m[4*g-3],B=m[4*g-2],j=m[4*g-1];else{var G=(q-d[H])/(d[H+1]-d[H]),Y=1-G,W=4*H,Z=4*(H+1);R=Y*m[W]+G*m[Z],F=Y*m[W+1]+G*m[Z+1],B=Y*m[W+2]+G*m[Z+2],j=Y*m[W+3]+G*m[Z+3]}T[4*S]=255*R,T[4*S+1]=255*F,T[4*S+2]=255*B,T[4*S+3]=255*j,M[2*S]=.5*z+.5*D,M[2*S+1]=.5*P+.5*I,k[2*S]=U,k[2*S+1]=V,A[S]=L*b+O,S+=1}}}this.positionBuffer.update(M),this.weightBuffer.update(k),this.colorBuffer.update(T),this.idBuffer.update(A),a.free(M),a.free(T),a.free(k),a.free(A)},f.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.positionBuffer.dispose(),this.weightBuffer.dispose(),this.colorBuffer.dispose(),this.idBuffer.dispose(),this.plot.removeObject(this)}},{"./lib/shaders":243,"binary-search-bounds":64,"gl-buffer":231,"gl-shader":298,"iota-array":423,"typedarray-pool":1531}],243:[function(t,e,r){"use strict";var n=t("glslify");e.exports={fragment:n(["precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n"]),vertex:n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 color;\nattribute vec2 weight;\n\nuniform vec2 shape;\nuniform mat3 viewTransform;\n\nvarying vec4 fragColor;\n\nvoid main() {\n vec3 vPosition = viewTransform * vec3( position + (weight-.5)/(shape-1.) , 1.0);\n fragColor = color;\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n"]),pickFragment:n(["precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragId;\nvarying vec2 vWeight;\n\nuniform vec2 shape;\nuniform vec4 pickOffset;\n\nvoid main() {\n vec2 d = step(.5, vWeight);\n vec4 id = fragId + pickOffset;\n id.x += d.x + d.y*shape.x;\n\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 gl_FragColor = id/255.;\n}\n"]),pickVertex:n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\nattribute vec2 weight;\n\nuniform vec2 shape;\nuniform mat3 viewTransform;\n\nvarying vec4 fragId;\nvarying vec2 vWeight;\n\nvoid main() {\n vWeight = weight;\n\n fragId = pickId;\n\n vec3 vPosition = viewTransform * vec3( position + (weight-.5)/(shape-1.) , 1.0);\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n"])}},{glslify:399}],244:[function(t,e,r){var n=t("glslify"),i=t("gl-shader"),a=n(["precision highp 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\nvec4 project(vec3 p) {\n return projection * view * model * vec4(p, 1.0);\n}\n\nvoid main() {\n vec4 startPoint = project(position);\n vec4 endPoint = project(nextPosition);\n\n vec2 A = startPoint.xy / startPoint.w;\n vec2 B = endPoint.xy / endPoint.w;\n\n float clipAngle = atan(\n (B.y - A.y) * screenShape.y,\n (B.x - A.x) * screenShape.x\n );\n\n vec2 offset = 0.5 * pixelRatio * lineWidth * vec2(\n sin(clipAngle),\n -cos(clipAngle)\n ) / screenShape;\n\n gl_Position = vec4(startPoint.xy + startPoint.w * offset, startPoint.zw);\n\n worldPosition = position;\n pixelArcLength = arcLength;\n fragColor = color;\n}\n"]),o=n(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\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 (\n outOfRange(clipBounds[0], clipBounds[1], worldPosition) ||\n fragColor.a * opacity == 0.\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"]),s=n(["precision highp float;\n#define GLSLIFY 1\n\n#define FLOAT_MAX 1.70141184e38\n#define FLOAT_MIN 1.17549435e-38\n\n// https://github.com/mikolalysenko/glsl-read-float/blob/master/index.glsl\nvec4 packFloat(float v) {\n 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 vec4 c = vec4(0,0,0,0);\n\n //Compute exponent and mantissa\n float e = floor(log2(av));\n 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 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\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform float pickId;\nuniform vec3 clipBounds[2];\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], worldPosition)) discard;\n\n gl_FragColor = vec4(pickId/255.0, packFloat(pixelArcLength).xyz);\n}"]),l=[{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 i(t,a,o,null,l)},r.createPickShader=function(t){return i(t,a,s,null,l)}},{"gl-shader":298,glslify:399}],245:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl||t.scene&&t.scene.gl,r=f(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 o=h(e);o.attributes.position.location=0,o.attributes.nextPosition.location=1,o.attributes.arcLength.location=2,o.attributes.lineWidth.location=3,o.attributes.color.location=4;for(var s=n(e),l=i(e,[{buffer:s,size:3,offset:0,stride:48},{buffer:s,size:3,offset:12,stride:48},{buffer:s,size:1,offset:24,stride:48},{buffer:s,size:1,offset:28,stride:48},{buffer:s,size:4,offset:32,stride:48}]),u=c(new Array(1024),[256,1,4]),p=0;p<1024;++p)u.data[p]=255;var d=a(e,u);d.wrap=e.REPEAT;var m=new v(e,r,o,s,l,d);return m.update(t),m};var n=t("gl-buffer"),i=t("gl-vao"),a=t("gl-texture2d"),o=new Uint8Array(4),s=new Float32Array(o.buffer);var l=t("binary-search-bounds"),c=t("ndarray"),u=t("./lib/shaders"),f=u.createShader,h=u.createPickShader,p=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function d(t,e){for(var r=0,n=0;n<3;++n){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}function m(t){for(var e=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],r=0;r<3;++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 g(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function v(t,e,r,n,i,a){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=a,this.dashScale=1,this.opacity=1,this.hasAlpha=!1,this.dirty=!0,this.pixelRatio=1}var y=v.prototype;y.isTransparent=function(){return this.hasAlpha},y.isOpaque=function(){return!this.hasAlpha},y.pickSlots=1,y.setPickBase=function(t){this.pickId=t},y.drawTransparent=y.draw=function(t){if(this.vertexCount){var e=this.gl,r=this.shader,n=this.vao;r.bind(),r.uniforms={model:t.model||p,view:t.view||p,projection:t.projection||p,clipBounds:m(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),n.unbind()}},y.drawPick=function(t){if(this.vertexCount){var e=this.gl,r=this.pickShader,n=this.vao;r.bind(),r.uniforms={model:t.model||p,view:t.view||p,projection:t.projection||p,pickId:this.pickId,clipBounds:m(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount),n.unbind()}},y.update=function(t){var e,r;this.dirty=!0;var n=!!t.connectGaps;"dashScale"in t&&(this.dashScale=t.dashScale),this.hasAlpha=!1,"opacity"in t&&(this.opacity=+t.opacity,this.opacity<1&&(this.hasAlpha=!0));var i=[],a=[],o=[],s=0,u=0,f=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],h=t.position||t.positions;if(h){var p=t.color||t.colors||[0,0,0,1],m=t.lineWidth||1,g=!1;t:for(e=1;e<h.length;++e){var v,y,x,b=h[e-1],_=h[e];for(a.push(s),o.push(b.slice()),r=0;r<3;++r){if(isNaN(b[r])||isNaN(_[r])||!isFinite(b[r])||!isFinite(_[r])){if(!n&&i.length>0){for(var w=0;w<24;++w)i.push(i[i.length-12]);u+=2,g=!0}continue t}f[0][r]=Math.min(f[0][r],b[r],_[r]),f[1][r]=Math.max(f[1][r],b[r],_[r])}Array.isArray(p[0])?(v=p.length>e-1?p[e-1]:p.length>0?p[p.length-1]:[0,0,0,1],y=p.length>e?p[e]:p.length>0?p[p.length-1]:[0,0,0,1]):v=y=p,3===v.length&&(v=[v[0],v[1],v[2],1]),3===y.length&&(y=[y[0],y[1],y[2],1]),!this.hasAlpha&&v[3]<1&&(this.hasAlpha=!0),x=Array.isArray(m)?m.length>e-1?m[e-1]:m.length>0?m[m.length-1]:[0,0,0,1]:m;var T=s;if(s+=d(b,_),g){for(r=0;r<2;++r)i.push(b[0],b[1],b[2],_[0],_[1],_[2],T,x,v[0],v[1],v[2],v[3]);u+=2,g=!1}i.push(b[0],b[1],b[2],_[0],_[1],_[2],T,x,v[0],v[1],v[2],v[3],b[0],b[1],b[2],_[0],_[1],_[2],T,-x,v[0],v[1],v[2],v[3],_[0],_[1],_[2],b[0],b[1],b[2],s,-x,y[0],y[1],y[2],y[3],_[0],_[1],_[2],b[0],b[1],b[2],s,x,y[0],y[1],y[2],y[3]),u+=4}}if(this.buffer.update(i),a.push(s),o.push(h[h.length-1].slice()),this.bounds=f,this.vertexCount=u,this.points=o,this.arcLength=a,"dashes"in t){var M=t.dashes.slice();for(M.unshift(0),e=1;e<M.length;++e)M[e]=M[e-1]+M[e];var k=c(new Array(1024),[256,1,4]);for(e=0;e<256;++e){for(r=0;r<4;++r)k.set(e,0,r,0);1&l.le(M,M[M.length-1]*e/255)?k.set(e,0,0,0):k.set(e,0,0,255)}this.texture.setPixels(k)}},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=function(t,e,r,n){return o[0]=n,o[1]=r,o[2]=e,o[3]=t,s[0]}(t.value[0],t.value[1],t.value[2],0),r=l.le(this.arcLength,e);if(r<0)return null;if(r===this.arcLength.length-1)return new g(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]),c=1-a,u=[0,0,0],f=0;f<3;++f)u[f]=c*n[f]+a*i[f];var h=Math.min(a<.5?r:r+1,this.points.length-1);return new g(e,u,h,this.points[h])}},{"./lib/shaders":244,"binary-search-bounds":64,"gl-buffer":231,"gl-texture2d":313,"gl-vao":318,ndarray:630}],246:[function(t,e,r){e.exports=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],l=e[6],c=e[7],u=e[8],f=e[9],h=e[10],p=e[11],d=e[12],m=e[13],g=e[14],v=e[15];return t[0]=s*(h*v-p*g)-f*(l*v-c*g)+m*(l*p-c*h),t[1]=-(n*(h*v-p*g)-f*(i*v-a*g)+m*(i*p-a*h)),t[2]=n*(l*v-c*g)-s*(i*v-a*g)+m*(i*c-a*l),t[3]=-(n*(l*p-c*h)-s*(i*p-a*h)+f*(i*c-a*l)),t[4]=-(o*(h*v-p*g)-u*(l*v-c*g)+d*(l*p-c*h)),t[5]=r*(h*v-p*g)-u*(i*v-a*g)+d*(i*p-a*h),t[6]=-(r*(l*v-c*g)-o*(i*v-a*g)+d*(i*c-a*l)),t[7]=r*(l*p-c*h)-o*(i*p-a*h)+u*(i*c-a*l),t[8]=o*(f*v-p*m)-u*(s*v-c*m)+d*(s*p-c*f),t[9]=-(r*(f*v-p*m)-u*(n*v-a*m)+d*(n*p-a*f)),t[10]=r*(s*v-c*m)-o*(n*v-a*m)+d*(n*c-a*s),t[11]=-(r*(s*p-c*f)-o*(n*p-a*f)+u*(n*c-a*s)),t[12]=-(o*(f*g-h*m)-u*(s*g-l*m)+d*(s*h-l*f)),t[13]=r*(f*g-h*m)-u*(n*g-i*m)+d*(n*h-i*f),t[14]=-(r*(s*g-l*m)-o*(n*g-i*m)+d*(n*l-i*s)),t[15]=r*(s*h-l*f)-o*(n*h-i*f)+u*(n*l-i*s),t}},{}],247:[function(t,e,r){e.exports=function(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}},{}],248:[function(t,e,r){e.exports=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}},{}],249:[function(t,e,r){e.exports=function(){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}},{}],250:[function(t,e,r){e.exports=function(t){var e=t[0],r=t[1],n=t[2],i=t[3],a=t[4],o=t[5],s=t[6],l=t[7],c=t[8],u=t[9],f=t[10],h=t[11],p=t[12],d=t[13],m=t[14],g=t[15];return(e*o-r*a)*(f*g-h*m)-(e*s-n*a)*(u*g-h*d)+(e*l-i*a)*(u*m-f*d)+(r*s-n*o)*(c*g-h*p)-(r*l-i*o)*(c*m-f*p)+(n*l-i*s)*(c*d-u*p)}},{}],251:[function(t,e,r){e.exports=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r+r,s=n+n,l=i+i,c=r*o,u=n*o,f=n*s,h=i*o,p=i*s,d=i*l,m=a*o,g=a*s,v=a*l;return t[0]=1-f-d,t[1]=u+v,t[2]=h-g,t[3]=0,t[4]=u-v,t[5]=1-c-d,t[6]=p+m,t[7]=0,t[8]=h+g,t[9]=p-m,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}},{}],252:[function(t,e,r){e.exports=function(t,e,r){var n,i,a,o=r[0],s=r[1],l=r[2],c=Math.sqrt(o*o+s*s+l*l);if(Math.abs(c)<1e-6)return null;return o*=c=1/c,s*=c,l*=c,n=Math.sin(e),i=Math.cos(e),a=1-i,t[0]=o*o*a+i,t[1]=s*o*a+l*n,t[2]=l*o*a-s*n,t[3]=0,t[4]=o*s*a-l*n,t[5]=s*s*a+i,t[6]=l*s*a+o*n,t[7]=0,t[8]=o*l*a+s*n,t[9]=s*l*a-o*n,t[10]=l*l*a+i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}},{}],253:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=n+n,l=i+i,c=a+a,u=n*s,f=n*l,h=n*c,p=i*l,d=i*c,m=a*c,g=o*s,v=o*l,y=o*c;return t[0]=1-(p+m),t[1]=f+y,t[2]=h-v,t[3]=0,t[4]=f-y,t[5]=1-(u+m),t[6]=d+g,t[7]=0,t[8]=h+v,t[9]=d-g,t[10]=1-(u+p),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}},{}],254:[function(t,e,r){e.exports=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}},{}],255:[function(t,e,r){e.exports=function(t,e){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]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}},{}],256:[function(t,e,r){e.exports=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n,t[6]=r,t[7]=0,t[8]=0,t[9]=-r,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}},{}],257:[function(t,e,r){e.exports=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=0,t[2]=-r,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=r,t[9]=0,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}},{}],258:[function(t,e,r){e.exports=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=0,t[4]=-r,t[5]=n,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}},{}],259:[function(t,e,r){e.exports=function(t,e,r,n,i,a,o){var s=1/(r-e),l=1/(i-n),c=1/(a-o);return t[0]=2*a*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*a*l,t[6]=0,t[7]=0,t[8]=(r+e)*s,t[9]=(i+n)*l,t[10]=(o+a)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*a*2*c,t[15]=0,t}},{}],260:[function(t,e,r){e.exports=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}},{}],261:[function(t,e,r){e.exports={create:t("./create"),clone:t("./clone"),copy:t("./copy"),identity:t("./identity"),transpose:t("./transpose"),invert:t("./invert"),adjoint:t("./adjoint"),determinant:t("./determinant"),multiply:t("./multiply"),translate:t("./translate"),scale:t("./scale"),rotate:t("./rotate"),rotateX:t("./rotateX"),rotateY:t("./rotateY"),rotateZ:t("./rotateZ"),fromRotation:t("./fromRotation"),fromRotationTranslation:t("./fromRotationTranslation"),fromScaling:t("./fromScaling"),fromTranslation:t("./fromTranslation"),fromXRotation:t("./fromXRotation"),fromYRotation:t("./fromYRotation"),fromZRotation:t("./fromZRotation"),fromQuat:t("./fromQuat"),frustum:t("./frustum"),perspective:t("./perspective"),perspectiveFromFieldOfView:t("./perspectiveFromFieldOfView"),ortho:t("./ortho"),lookAt:t("./lookAt"),str:t("./str")}},{"./adjoint":246,"./clone":247,"./copy":248,"./create":249,"./determinant":250,"./fromQuat":251,"./fromRotation":252,"./fromRotationTranslation":253,"./fromScaling":254,"./fromTranslation":255,"./fromXRotation":256,"./fromYRotation":257,"./fromZRotation":258,"./frustum":259,"./identity":260,"./invert":262,"./lookAt":263,"./multiply":264,"./ortho":265,"./perspective":266,"./perspectiveFromFieldOfView":267,"./rotate":268,"./rotateX":269,"./rotateY":270,"./rotateZ":271,"./scale":272,"./str":273,"./translate":274,"./transpose":275}],262:[function(t,e,r){e.exports=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],l=e[6],c=e[7],u=e[8],f=e[9],h=e[10],p=e[11],d=e[12],m=e[13],g=e[14],v=e[15],y=r*s-n*o,x=r*l-i*o,b=r*c-a*o,_=n*l-i*s,w=n*c-a*s,T=i*c-a*l,M=u*m-f*d,k=u*g-h*d,A=u*v-p*d,S=f*g-h*m,E=f*v-p*m,C=h*v-p*g,L=y*C-x*E+b*S+_*A-w*k+T*M;if(!L)return null;return L=1/L,t[0]=(s*C-l*E+c*S)*L,t[1]=(i*E-n*C-a*S)*L,t[2]=(m*T-g*w+v*_)*L,t[3]=(h*w-f*T-p*_)*L,t[4]=(l*A-o*C-c*k)*L,t[5]=(r*C-i*A+a*k)*L,t[6]=(g*b-d*T-v*x)*L,t[7]=(u*T-h*b+p*x)*L,t[8]=(o*E-s*A+c*M)*L,t[9]=(n*A-r*E-a*M)*L,t[10]=(d*w-m*b+v*y)*L,t[11]=(f*b-u*w-p*y)*L,t[12]=(s*k-o*S-l*M)*L,t[13]=(r*S-n*k+i*M)*L,t[14]=(m*x-d*_-g*y)*L,t[15]=(u*_-f*x+h*y)*L,t}},{}],263:[function(t,e,r){var n=t("./identity");e.exports=function(t,e,r,i){var a,o,s,l,c,u,f,h,p,d,m=e[0],g=e[1],v=e[2],y=i[0],x=i[1],b=i[2],_=r[0],w=r[1],T=r[2];if(Math.abs(m-_)<1e-6&&Math.abs(g-w)<1e-6&&Math.abs(v-T)<1e-6)return n(t);f=m-_,h=g-w,p=v-T,d=1/Math.sqrt(f*f+h*h+p*p),a=x*(p*=d)-b*(h*=d),o=b*(f*=d)-y*p,s=y*h-x*f,(d=Math.sqrt(a*a+o*o+s*s))?(a*=d=1/d,o*=d,s*=d):(a=0,o=0,s=0);l=h*s-p*o,c=p*a-f*s,u=f*o-h*a,(d=Math.sqrt(l*l+c*c+u*u))?(l*=d=1/d,c*=d,u*=d):(l=0,c=0,u=0);return t[0]=a,t[1]=l,t[2]=f,t[3]=0,t[4]=o,t[5]=c,t[6]=h,t[7]=0,t[8]=s,t[9]=u,t[10]=p,t[11]=0,t[12]=-(a*m+o*g+s*v),t[13]=-(l*m+c*g+u*v),t[14]=-(f*m+h*g+p*v),t[15]=1,t}},{"./identity":260}],264:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=e[6],u=e[7],f=e[8],h=e[9],p=e[10],d=e[11],m=e[12],g=e[13],v=e[14],y=e[15],x=r[0],b=r[1],_=r[2],w=r[3];return t[0]=x*n+b*s+_*f+w*m,t[1]=x*i+b*l+_*h+w*g,t[2]=x*a+b*c+_*p+w*v,t[3]=x*o+b*u+_*d+w*y,x=r[4],b=r[5],_=r[6],w=r[7],t[4]=x*n+b*s+_*f+w*m,t[5]=x*i+b*l+_*h+w*g,t[6]=x*a+b*c+_*p+w*v,t[7]=x*o+b*u+_*d+w*y,x=r[8],b=r[9],_=r[10],w=r[11],t[8]=x*n+b*s+_*f+w*m,t[9]=x*i+b*l+_*h+w*g,t[10]=x*a+b*c+_*p+w*v,t[11]=x*o+b*u+_*d+w*y,x=r[12],b=r[13],_=r[14],w=r[15],t[12]=x*n+b*s+_*f+w*m,t[13]=x*i+b*l+_*h+w*g,t[14]=x*a+b*c+_*p+w*v,t[15]=x*o+b*u+_*d+w*y,t}},{}],265:[function(t,e,r){e.exports=function(t,e,r,n,i,a,o){var s=1/(e-r),l=1/(n-i),c=1/(a-o);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*l,t[14]=(o+a)*c,t[15]=1,t}},{}],266:[function(t,e,r){e.exports=function(t,e,r,n,i){var a=1/Math.tan(e/2),o=1/(n-i);return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*o,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*o,t[15]=0,t}},{}],267:[function(t,e,r){e.exports=function(t,e,r,n){var i=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),o=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),l=2/(o+s),c=2/(i+a);return t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-(o-s)*l*.5,t[9]=(i-a)*c*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t}},{}],268:[function(t,e,r){e.exports=function(t,e,r,n){var i,a,o,s,l,c,u,f,h,p,d,m,g,v,y,x,b,_,w,T,M,k,A,S,E=n[0],C=n[1],L=n[2],P=Math.sqrt(E*E+C*C+L*L);if(Math.abs(P)<1e-6)return null;E*=P=1/P,C*=P,L*=P,i=Math.sin(r),a=Math.cos(r),o=1-a,s=e[0],l=e[1],c=e[2],u=e[3],f=e[4],h=e[5],p=e[6],d=e[7],m=e[8],g=e[9],v=e[10],y=e[11],x=E*E*o+a,b=C*E*o+L*i,_=L*E*o-C*i,w=E*C*o-L*i,T=C*C*o+a,M=L*C*o+E*i,k=E*L*o+C*i,A=C*L*o-E*i,S=L*L*o+a,t[0]=s*x+f*b+m*_,t[1]=l*x+h*b+g*_,t[2]=c*x+p*b+v*_,t[3]=u*x+d*b+y*_,t[4]=s*w+f*T+m*M,t[5]=l*w+h*T+g*M,t[6]=c*w+p*T+v*M,t[7]=u*w+d*T+y*M,t[8]=s*k+f*A+m*S,t[9]=l*k+h*A+g*S,t[10]=c*k+p*A+v*S,t[11]=u*k+d*A+y*S,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]);return t}},{}],269:[function(t,e,r){e.exports=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),a=e[4],o=e[5],s=e[6],l=e[7],c=e[8],u=e[9],f=e[10],h=e[11];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]);return t[4]=a*i+c*n,t[5]=o*i+u*n,t[6]=s*i+f*n,t[7]=l*i+h*n,t[8]=c*i-a*n,t[9]=u*i-o*n,t[10]=f*i-s*n,t[11]=h*i-l*n,t}},{}],270:[function(t,e,r){e.exports=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),a=e[0],o=e[1],s=e[2],l=e[3],c=e[8],u=e[9],f=e[10],h=e[11];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]);return t[0]=a*i-c*n,t[1]=o*i-u*n,t[2]=s*i-f*n,t[3]=l*i-h*n,t[8]=a*n+c*i,t[9]=o*n+u*i,t[10]=s*n+f*i,t[11]=l*n+h*i,t}},{}],271:[function(t,e,r){e.exports=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),a=e[0],o=e[1],s=e[2],l=e[3],c=e[4],u=e[5],f=e[6],h=e[7];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]);return t[0]=a*i+c*n,t[1]=o*i+u*n,t[2]=s*i+f*n,t[3]=l*i+h*n,t[4]=c*i-a*n,t[5]=u*i-o*n,t[6]=f*i-s*n,t[7]=h*i-l*n,t}},{}],272:[function(t,e,r){e.exports=function(t,e,r){var n=r[0],i=r[1],a=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]*a,t[9]=e[9]*a,t[10]=e[10]*a,t[11]=e[11]*a,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}},{}],273:[function(t,e,r){e.exports=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}},{}],274:[function(t,e,r){e.exports=function(t,e,r){var n,i,a,o,s,l,c,u,f,h,p,d,m=r[0],g=r[1],v=r[2];e===t?(t[12]=e[0]*m+e[4]*g+e[8]*v+e[12],t[13]=e[1]*m+e[5]*g+e[9]*v+e[13],t[14]=e[2]*m+e[6]*g+e[10]*v+e[14],t[15]=e[3]*m+e[7]*g+e[11]*v+e[15]):(n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=e[6],u=e[7],f=e[8],h=e[9],p=e[10],d=e[11],t[0]=n,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=l,t[6]=c,t[7]=u,t[8]=f,t[9]=h,t[10]=p,t[11]=d,t[12]=n*m+s*g+f*v+e[12],t[13]=i*m+l*g+h*v+e[13],t[14]=a*m+c*g+p*v+e[14],t[15]=o*m+u*g+d*v+e[15]);return t}},{}],275:[function(t,e,r){e.exports=function(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],a=e[6],o=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]=a,t[11]=e[14],t[12]=i,t[13]=o,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}},{}],276:[function(t,e,r){"use strict";var n=t("barycentric"),i=t("polytope-closest-point/lib/closest_point_2d.js");function a(t,e){for(var r=[0,0,0,0],n=0;n<4;++n)for(var i=0;i<4;++i)r[i]+=t[4*n+i]*e[n];return r}function o(t,e,r,n,i){for(var o=a(n,a(r,a(e,[t[0],t[1],t[2],1]))),s=0;s<3;++s)o[s]/=o[3];return[.5*i[0]*(1+o[0]),.5*i[1]*(1-o[1])]}function s(t,e){for(var r=[0,0,0],n=0;n<t.length;++n)for(var i=t[n],a=e[n],o=0;o<3;++o)r[o]+=a*i[o];return r}e.exports=function(t,e,r,a,l,c){if(1===t.length)return[0,t[0].slice()];for(var u=new Array(t.length),f=0;f<t.length;++f)u[f]=o(t[f],r,a,l,c);var h=0,p=1/0;for(f=0;f<u.length;++f){for(var d=0,m=0;m<2;++m)d+=Math.pow(u[f][m]-e[m],2);d<p&&(p=d,h=f)}var g=function(t,e){if(2===t.length){for(var r=0,a=0,o=0;o<2;++o)r+=Math.pow(e[o]-t[0][o],2),a+=Math.pow(e[o]-t[1][o],2);return r=Math.sqrt(r),a=Math.sqrt(a),r+a<1e-6?[1,0]:[a/(r+a),r/(a+r)]}if(3===t.length){var s=[0,0];return i(t[0],t[1],t[2],e,s),n(t,s)}return[]}(u,e),v=0;for(f=0;f<3;++f){if(g[f]<-.001||g[f]>1.0001)return null;v+=g[f]}if(Math.abs(v-1)>.001)return null;return[h,s(t,g),g]}},{barycentric:46,"polytope-closest-point/lib/closest_point_2d.js":1464}],277:[function(t,e,r){var n=t("glslify"),i=n(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model\n , view\n , projection\n , inverseModel;\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\nvec4 project(vec3 p) {\n return projection * view * model * vec4(p, 1.0);\n}\n\nvoid main() {\n gl_Position = project(position);\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * vec4(position , 1.0);\n cameraCoordinate.xyz /= cameraCoordinate.w;\n f_lightDirection = lightPosition - cameraCoordinate.xyz;\n f_eyeDirection = eyePosition - cameraCoordinate.xyz;\n f_normal = normalize((vec4(normal, 0.0) * inverseModel).xyz);\n\n f_color = color;\n f_data = position;\n f_uv = uv;\n}\n"]),a=n(["#extension GL_OES_standard_derivatives : enable\n\nprecision highp float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution(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\nfloat cookTorranceSpecular(\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(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//#pragma glslify: beckmann = require(glsl-specular-beckmann) // used in gl-surface3d\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular;\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 (f_color.a == 0.0 ||\n outOfRange(clipBounds[0], clipBounds[1], f_data)\n ) discard;\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 = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel)));\n //float specular = max(0.0, beckmann(L, V, N, roughness)); // used in gl-surface3d\n\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = vec4(f_color.rgb, 1.0) * 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 * f_color.a;\n}\n"]),o=n(["precision highp 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}"]),s=n(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\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 (outOfRange(clipBounds[0], clipBounds[1], f_data)) discard;\n\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}"]),l=n(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\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 (outOfRange(clipBounds[0], clipBounds[1], position)) {\n\n gl_Position = vec4(0.0, 0.0 ,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}"]),c=n(["precision highp 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=n(["precision highp 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}"]),f=n(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\n\n gl_FragColor = vec4(pickId, f_id.xyz);\n}"]),h=n(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\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 (outOfRange(clipBounds[0], clipBounds[1], position)) {\n\n gl_Position = vec4(0.0, 0.0, 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}"]),p=n(["precision highp 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=n(["precision highp float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor, 1.0);\n}\n"]);r.meshShader={vertex:i,fragment:a,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:o,fragment:s,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:l,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:u,fragment:f,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:h,fragment:f,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:p,fragment:d,attributes:[{name:"position",type:"vec3"}]}},{glslify:399}],278:[function(t,e,r){"use strict";var n=t("gl-shader"),i=t("gl-buffer"),a=t("gl-vao"),o=t("gl-texture2d"),s=t("normals"),l=t("gl-mat4/multiply"),c=t("gl-mat4/invert"),u=t("ndarray"),f=t("colormap"),h=t("simplicial-complex-contour"),p=t("typedarray-pool"),d=t("./lib/shaders"),m=t("./lib/closest-point"),g=d.meshShader,v=d.wireShader,y=d.pointShader,x=d.pickShader,b=d.pointPickShader,_=d.contourShader,w=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function T(t,e,r,n,i,a,o,s,l,c,u,f,h,p,d,m,g,v,y,x,b,_,T,M,k,A,S){this.gl=t,this.pixelRatio=1,this.cells=[],this.positions=[],this.intensity=[],this.texture=e,this.dirty=!0,this.triShader=r,this.lineShader=n,this.pointShader=i,this.pickShader=a,this.pointPickShader=o,this.contourShader=s,this.trianglePositions=l,this.triangleColors=u,this.triangleNormals=h,this.triangleUVs=f,this.triangleIds=c,this.triangleVAO=p,this.triangleCount=0,this.lineWidth=1,this.edgePositions=d,this.edgeColors=g,this.edgeUVs=v,this.edgeIds=m,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=x,this.pointColors=_,this.pointUVs=T,this.pointSizes=M,this.pointIds=b,this.pointVAO=k,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=A,this.contourVAO=S,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickVertex=!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.hasAlpha=!1,this.opacityscale=!1,this._model=w,this._view=w,this._projection=w,this._resolution=[1,1]}var M=T.prototype;function k(t,e){if(!e)return 1;if(!e.length)return 1;for(var r=0;r<e.length;++r){if(e.length<2)return 1;if(e[r][0]===t)return e[r][1];if(e[r][0]>t&&r>0){var n=(e[r][0]-t)/(e[r][0]-e[r-1][0]);return e[r][1]*(1-n)+n*e[r-1][1]}}return 1}function A(t){var e=n(t,g.vertex,g.fragment);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.normal.location=4,e}function S(t){var e=n(t,v.vertex,v.fragment);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e}function E(t){var e=n(t,y.vertex,y.fragment);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=n(t,x.vertex,x.fragment);return e.attributes.position.location=0,e.attributes.id.location=1,e}function L(t){var e=n(t,b.vertex,b.fragment);return e.attributes.position.location=0,e.attributes.id.location=1,e.attributes.pointSize.location=4,e}function P(t){var e=n(t,_.vertex,_.fragment);return e.attributes.position.location=0,e}M.isOpaque=function(){return!this.hasAlpha},M.isTransparent=function(){return this.hasAlpha},M.pickSlots=1,M.setPickBase=function(t){this.pickId=t},M.highlight=function(t){if(t&&this.contourEnable){for(var e=h(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=p.mallocFloat32(6*a),s=0,l=0;l<a;++l)for(var c=r[l],u=0;u<2;++u){var f=c[0];2===c.length&&(f=c[u]);for(var d=n[f][0],m=n[f][1],g=i[f],v=1-g,y=this.positions[d],x=this.positions[m],b=0;b<3;++b)o[s++]=g*y[b]+v*x[b]}this.contourCount=s/3|0,this.contourPositions.update(o.subarray(0,s)),p.free(o)}else this.contourCount=0},M.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),this.hasAlpha=!1,"opacity"in t&&(this.opacity=t.opacity,this.opacity<1&&(this.hasAlpha=!0)),"opacityscale"in t&&(this.opacityscale=t.opacityscale,this.hasAlpha=!0),"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=o(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(function(t,e){for(var r=f({colormap:t,nshades:256,format:"rgba"}),n=new Uint8Array(1024),i=0;i<256;++i){for(var a=r[i],o=0;o<3;++o)n[4*i+o]=a[o];n[4*i+3]=e?255*k(i/255,e):255*a[3]}return u(n,[256,256,4],[4,0,1])}(t.colormap,this.opacityscale)),this.texture.generateMipmap());var r=t.cells,n=t.positions;if(n&&r){var i=[],a=[],l=[],c=[],h=[],p=[],d=[],m=[],g=[],v=[],y=[],x=[],b=[],_=[];this.cells=r,this.positions=n;var w=t.vertexNormals,T=t.cellNormals,M=void 0===t.vertexNormalsEpsilon?1e-6:t.vertexNormalsEpsilon,A=void 0===t.faceNormalsEpsilon?1e-6:t.faceNormalsEpsilon;t.useFacetNormals&&!T&&(T=s.faceNormals(r,n,A)),T||w||(w=s.vertexNormals(r,n,M));var S=t.vertexColors,E=t.cellColors,C=t.meshColor||[1,1,1,1],L=t.vertexUVs,P=t.vertexIntensity,I=t.cellUVs,O=t.cellIntensity,z=1/0,D=-1/0;if(!L&&!I)if(P)if(t.vertexIntensityBounds)z=+t.vertexIntensityBounds[0],D=+t.vertexIntensityBounds[1];else for(var N=0;N<P.length;++N){var R=P[N];z=Math.min(z,R),D=Math.max(D,R)}else if(O)if(t.cellIntensityBounds)z=+t.cellIntensityBounds[0],D=+t.cellIntensityBounds[1];else for(N=0;N<O.length;++N){R=O[N];z=Math.min(z,R),D=Math.max(D,R)}else for(N=0;N<n.length;++N){R=n[N][2];z=Math.min(z,R),D=Math.max(D,R)}this.intensity=P||(O||function(t){for(var e=t.length,r=new Array(e),n=0;n<e;++n)r[n]=t[n][2];return r}(n)),this.pickVertex=!(O||E);var F=t.pointSizes,B=t.pointSize||1;this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]];for(N=0;N<n.length;++N)for(var j=n[N],U=0;U<3;++U)!isNaN(j[U])&&isFinite(j[U])&&(this.bounds[0][U]=Math.min(this.bounds[0][U],j[U]),this.bounds[1][U]=Math.max(this.bounds[1][U],j[U]));var V=0,q=0,H=0;t:for(N=0;N<r.length;++N){var G=r[N];switch(G.length){case 1:for(j=n[W=G[0]],U=0;U<3;++U)if(isNaN(j[U])||!isFinite(j[U]))continue t;v.push(j[0],j[1],j[2]),Z=S?S[W]:E?E[N]:C,this.opacityscale&&P?a.push(Z[0],Z[1],Z[2],this.opacity*k((P[W]-z)/(D-z),this.opacityscale)):3===Z.length?y.push(Z[0],Z[1],Z[2],this.opacity):(y.push(Z[0],Z[1],Z[2],Z[3]*this.opacity),Z[3]<1&&(this.hasAlpha=!0)),X=L?L[W]:P?[(P[W]-z)/(D-z),0]:I?I[N]:O?[(O[N]-z)/(D-z),0]:[(j[2]-z)/(D-z),0],x.push(X[0],X[1]),F?b.push(F[W]):b.push(B),_.push(N),H+=1;break;case 2:for(U=0;U<2;++U){j=n[W=G[U]];for(var Y=0;Y<3;++Y)if(isNaN(j[Y])||!isFinite(j[Y]))continue t}for(U=0;U<2;++U){j=n[W=G[U]];p.push(j[0],j[1],j[2]),Z=S?S[W]:E?E[N]:C,this.opacityscale&&P?a.push(Z[0],Z[1],Z[2],this.opacity*k((P[W]-z)/(D-z),this.opacityscale)):3===Z.length?d.push(Z[0],Z[1],Z[2],this.opacity):(d.push(Z[0],Z[1],Z[2],Z[3]*this.opacity),Z[3]<1&&(this.hasAlpha=!0)),X=L?L[W]:P?[(P[W]-z)/(D-z),0]:I?I[N]:O?[(O[N]-z)/(D-z),0]:[(j[2]-z)/(D-z),0],m.push(X[0],X[1]),g.push(N)}q+=1;break;case 3:for(U=0;U<3;++U)for(j=n[W=G[U]],Y=0;Y<3;++Y)if(isNaN(j[Y])||!isFinite(j[Y]))continue t;for(U=0;U<3;++U){var W,Z,X,J;j=n[W=G[2-U]];i.push(j[0],j[1],j[2]),(Z=S?S[W]:E?E[N]:C)?this.opacityscale&&P?a.push(Z[0],Z[1],Z[2],this.opacity*k((P[W]-z)/(D-z),this.opacityscale)):3===Z.length?a.push(Z[0],Z[1],Z[2],this.opacity):(a.push(Z[0],Z[1],Z[2],Z[3]*this.opacity),Z[3]<1&&(this.hasAlpha=!0)):a.push(.5,.5,.5,1),X=L?L[W]:P?[(P[W]-z)/(D-z),0]:I?I[N]:O?[(O[N]-z)/(D-z),0]:[(j[2]-z)/(D-z),0],c.push(X[0],X[1]),J=w?w[W]:T[N],l.push(J[0],J[1],J[2]),h.push(N)}V+=1}}this.pointCount=H,this.edgeCount=q,this.triangleCount=V,this.pointPositions.update(v),this.pointColors.update(y),this.pointUVs.update(x),this.pointSizes.update(b),this.pointIds.update(new Uint32Array(_)),this.edgePositions.update(p),this.edgeColors.update(d),this.edgeUVs.update(m),this.edgeIds.update(new Uint32Array(g)),this.trianglePositions.update(i),this.triangleColors.update(a),this.triangleUVs.update(c),this.triangleNormals.update(l),this.triangleIds.update(new Uint32Array(h))}},M.drawTransparent=M.draw=function(t){t=t||{};for(var e=this.gl,r=t.model||w,n=t.view||w,i=t.projection||w,a=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)a[0][o]=Math.max(a[0][o],this.clipBounds[0][o]),a[1][o]=Math.min(a[1][o],this.clipBounds[1][o]);var s={model:r,view:n,projection:i,inverseModel:w.slice(),clipBounds:a,kambient:this.ambientLight,kdiffuse:this.diffuseLight,kspecular:this.specularLight,roughness:this.roughness,fresnel:this.fresnel,eyePosition:[0,0,0],lightPosition:[0,0,0],contourColor:this.contourColor,texture:0};s.inverseModel=c(s.inverseModel,s.model),e.disable(e.CULL_FACE),this.texture.bind(0);var u=new Array(16);l(u,s.view,s.model),l(u,s.projection,u),c(u,u);for(o=0;o<3;++o)s.eyePosition[o]=u[12+o]/u[15];var f,h=u[15];for(o=0;o<3;++o)h+=this.lightPosition[o]*u[4*o+3];for(o=0;o<3;++o){for(var p=u[12+o],d=0;d<3;++d)p+=u[4*d+o]*this.lightPosition[d];s.lightPosition[o]=p/h}this.triangleCount>0&&((f=this.triShader).bind(),f.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind());this.edgeCount>0&&this.lineWidth>0&&((f=this.lineShader).bind(),f.uniforms=s,this.edgeVAO.bind(),e.lineWidth(this.lineWidth*this.pixelRatio),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind());this.pointCount>0&&((f=this.pointShader).bind(),f.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind());this.contourEnable&&this.contourCount>0&&this.contourLineWidth>0&&((f=this.contourShader).bind(),f.uniforms=s,this.contourVAO.bind(),e.drawArrays(e.LINES,0,this.contourCount),this.contourVAO.unbind())},M.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||w,n=t.view||w,i=t.projection||w,a=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)a[0][o]=Math.max(a[0][o],this.clipBounds[0][o]),a[1][o]=Math.min(a[1][o],this.clipBounds[1][o]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(i),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s,l={model:r,view:n,projection:i,clipBounds:a,pickId:this.pickId/255};((s=this.pickShader).bind(),s.uniforms=l,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*this.pixelRatio),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()),this.pointCount>0)&&((s=this.pointPickShader).bind(),s.uniforms=l,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind())},M.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),a=0;a<r.length;++a)i[a]=n[r[a]];var o=t.coord[0],s=t.coord[1];if(!this.pickVertex){var l=this.positions[r[0]],c=this.positions[r[1]],u=this.positions[r[2]],f=[(l[0]+c[0]+u[0])/3,(l[1]+c[1]+u[1])/3,(l[2]+c[2]+u[2])/3];return{_cellCenter:!0,position:[o,s],index:e,cell:r,cellId:e,intensity:this.intensity[e],dataCoordinate:f}}var h=m(i,[o*this.pixelRatio,this._resolution[1]-s*this.pixelRatio],this._model,this._view,this._projection,this._resolution);if(!h)return null;var p=h[2],d=0;for(a=0;a<r.length;++a)d+=p[a]*this.intensity[r[a]];return{position:h[1],index:r[h[0]],cell:r,cellId:e,intensity:d,dataCoordinate:this.positions[r[h[0]]]}},M.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=function(t,e){1===arguments.length&&(t=(e=t).gl);var r=t.getExtension("OES_standard_derivatives")||t.getExtension("MOZ_OES_standard_derivatives")||t.getExtension("WEBKIT_OES_standard_derivatives");if(!r)throw new Error("derivatives not supported");var n=A(t),s=S(t),l=E(t),c=C(t),f=L(t),h=P(t),p=o(t,u(new Uint8Array([255,255,255,255]),[1,1,4]));p.generateMipmap(),p.minFilter=t.LINEAR_MIPMAP_LINEAR,p.magFilter=t.LINEAR;var d=i(t),m=i(t),g=i(t),v=i(t),y=i(t),x=a(t,[{buffer:d,type:t.FLOAT,size:3},{buffer:y,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:m,type:t.FLOAT,size:4},{buffer:g,type:t.FLOAT,size:2},{buffer:v,type:t.FLOAT,size:3}]),b=i(t),_=i(t),w=i(t),M=i(t),k=a(t,[{buffer:b,type:t.FLOAT,size:3},{buffer:M,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:_,type:t.FLOAT,size:4},{buffer:w,type:t.FLOAT,size:2}]),I=i(t),O=i(t),z=i(t),D=i(t),N=i(t),R=a(t,[{buffer:I,type:t.FLOAT,size:3},{buffer:N,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:O,type:t.FLOAT,size:4},{buffer:z,type:t.FLOAT,size:2},{buffer:D,type:t.FLOAT,size:1}]),F=i(t),B=a(t,[{buffer:F,type:t.FLOAT,size:3}]),j=new T(t,p,n,s,l,c,f,h,d,y,m,g,v,x,b,M,_,w,k,I,N,O,z,D,R,F,B);return j.update(e),j}},{"./lib/closest-point":276,"./lib/shaders":277,colormap:98,"gl-buffer":231,"gl-mat4/invert":262,"gl-mat4/multiply":264,"gl-shader":298,"gl-texture2d":313,"gl-vao":318,ndarray:630,normals:633,"simplicial-complex-contour":1492,"typedarray-pool":1531}],279:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl,r=n(e,[0,0,0,1,1,0,1,1]),s=i(e,a.boxVert,a.lineFrag);return new o(t,r,s)};var n=t("gl-buffer"),i=t("gl-shader"),a=t("./shaders");function o(t,e,r){this.plot=t,this.vbo=e,this.shader=r}var s,l,c=o.prototype;c.bind=function(){var t=this.shader;this.vbo.bind(),this.shader.bind(),t.attributes.coord.pointer(),t.uniforms.screenBox=this.plot.screenBox},c.drawBox=(s=[0,0],l=[0,0],function(t,e,r,n,i){var a=this.plot,o=this.shader,c=a.gl;s[0]=t,s[1]=e,l[0]=r,l[1]=n,o.uniforms.lo=s,o.uniforms.hi=l,o.uniforms.color=i,c.drawArrays(c.TRIANGLE_STRIP,0,4)}),c.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":282,"gl-buffer":231,"gl-shader":298}],280:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl,r=n(e),a=i(e,o.gridVert,o.gridFrag),l=i(e,o.tickVert,o.gridFrag);return new s(t,r,a,l)};var n=t("gl-buffer"),i=t("gl-shader"),a=t("binary-search-bounds"),o=t("./shaders");function s(t,e,r,n){this.plot=t,this.vbo=e,this.shader=r,this.tickShader=n,this.ticks=[[],[]]}function l(t,e){return t-e}var c,u,f,h,p,d=s.prototype;d.draw=(c=[0,0],u=[0,0],f=[0,0],function(){for(var t=this.plot,e=this.vbo,r=this.shader,n=this.ticks,i=t.gl,a=t._tickBounds,o=t.dataBox,s=t.viewBox,l=t.gridLineWidth,h=t.gridLineColor,p=t.gridLineEnable,d=t.pixelRatio,m=0;m<2;++m){var g=a[m],v=a[m+2]-g,y=.5*(o[m+2]+o[m]),x=o[m+2]-o[m];u[m]=2*v/x,c[m]=2*(g-y)/x}r.bind(),e.bind(),r.attributes.dataCoord.pointer(),r.uniforms.dataShift=c,r.uniforms.dataScale=u;var b=0;for(m=0;m<2;++m){f[0]=f[1]=0,f[m]=1,r.uniforms.dataAxis=f,r.uniforms.lineWidth=l[m]/(s[m+2]-s[m])*d,r.uniforms.color=h[m];var _=6*n[m].length;p[m]&&_&&i.drawArrays(i.TRIANGLES,b,_),b+=_}}),d.drawTickMarks=function(){var t=[0,0],e=[0,0],r=[1,0],n=[0,1],i=[0,0],o=[0,0];return function(){for(var s=this.plot,c=this.vbo,u=this.tickShader,f=this.ticks,h=s.gl,p=s._tickBounds,d=s.dataBox,m=s.viewBox,g=s.pixelRatio,v=s.screenBox,y=v[2]-v[0],x=v[3]-v[1],b=m[2]-m[0],_=m[3]-m[1],w=0;w<2;++w){var T=p[w],M=p[w+2]-T,k=.5*(d[w+2]+d[w]),A=d[w+2]-d[w];e[w]=2*M/A,t[w]=2*(T-k)/A}e[0]*=b/y,t[0]*=b/y,e[1]*=_/x,t[1]*=_/x,u.bind(),c.bind(),u.attributes.dataCoord.pointer();var S=u.uniforms;S.dataShift=t,S.dataScale=e;var E=s.tickMarkLength,C=s.tickMarkWidth,L=s.tickMarkColor,P=6*f[0].length,I=Math.min(a.ge(f[0],(d[0]-p[0])/(p[2]-p[0]),l),f[0].length),O=Math.min(a.gt(f[0],(d[2]-p[0])/(p[2]-p[0]),l),f[0].length),z=0+6*I,D=6*Math.max(0,O-I),N=Math.min(a.ge(f[1],(d[1]-p[1])/(p[3]-p[1]),l),f[1].length),R=Math.min(a.gt(f[1],(d[3]-p[1])/(p[3]-p[1]),l),f[1].length),F=P+6*N,B=6*Math.max(0,R-N);i[0]=2*(m[0]-E[1])/y-1,i[1]=(m[3]+m[1])/x-1,o[0]=E[1]*g/y,o[1]=C[1]*g/x,B&&(S.color=L[1],S.tickScale=o,S.dataAxis=n,S.screenOffset=i,h.drawArrays(h.TRIANGLES,F,B)),i[0]=(m[2]+m[0])/y-1,i[1]=2*(m[1]-E[0])/x-1,o[0]=C[0]*g/y,o[1]=E[0]*g/x,D&&(S.color=L[0],S.tickScale=o,S.dataAxis=r,S.screenOffset=i,h.drawArrays(h.TRIANGLES,z,D)),i[0]=2*(m[2]+E[3])/y-1,i[1]=(m[3]+m[1])/x-1,o[0]=E[3]*g/y,o[1]=C[3]*g/x,B&&(S.color=L[3],S.tickScale=o,S.dataAxis=n,S.screenOffset=i,h.drawArrays(h.TRIANGLES,F,B)),i[0]=(m[2]+m[0])/y-1,i[1]=2*(m[3]+E[2])/x-1,o[0]=C[2]*g/y,o[1]=E[2]*g/x,D&&(S.color=L[2],S.tickScale=o,S.dataAxis=r,S.screenOffset=i,h.drawArrays(h.TRIANGLES,z,D))}}(),d.update=(h=[1,1,-1,-1,1,-1],p=[1,-1,1,1,-1,-1],function(t){for(var e=t.ticks,r=t.bounds,n=new Float32Array(18*(e[0].length+e[1].length)),i=(this.plot.zeroLineEnable,0),a=[[],[]],o=0;o<2;++o)for(var s=a[o],l=e[o],c=r[o],u=r[o+2],f=0;f<l.length;++f){var d=(l[f].x-c)/(u-c);s.push(d);for(var m=0;m<6;++m)n[i++]=d,n[i++]=h[m],n[i++]=p[m]}this.ticks=a,this.vbo.update(n)}),d.dispose=function(){this.vbo.dispose(),this.shader.dispose(),this.tickShader.dispose()}},{"./shaders":282,"binary-search-bounds":64,"gl-buffer":231,"gl-shader":298}],281:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl,r=n(e,[-1,-1,-1,1,1,-1,1,1]),s=i(e,a.lineVert,a.lineFrag);return new o(t,r,s)};var n=t("gl-buffer"),i=t("gl-shader"),a=t("./shaders");function o(t,e,r){this.plot=t,this.vbo=e,this.shader=r}var s,l,c=o.prototype;c.bind=function(){var t=this.shader;this.vbo.bind(),this.shader.bind(),t.attributes.coord.pointer(),t.uniforms.screenBox=this.plot.screenBox},c.drawLine=(s=[0,0],l=[0,0],function(t,e,r,n,i,a){var o=this.plot,c=this.shader,u=o.gl;s[0]=t,s[1]=e,l[0]=r,l[1]=n,c.uniforms.start=s,c.uniforms.end=l,c.uniforms.width=i*o.pixelRatio,c.uniforms.color=a,u.drawArrays(u.TRIANGLE_STRIP,0,4)}),c.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":282,"gl-buffer":231,"gl-shader":298}],282:[function(t,e,r){"use strict";var n=t("glslify"),i=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:n(["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:i,textVert:n(["#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:i,gridVert:n(["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:i,boxVert:n(["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:n(["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"])}},{glslify:399}],283:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl,r=n(e),a=i(e,s.textVert,s.textFrag);return new l(t,r,a)};var n=t("gl-buffer"),i=t("gl-shader"),a=t("text-cache"),o=t("binary-search-bounds"),s=t("./shaders");function l(t,e,r){this.plot=t,this.vbo=e,this.shader=r,this.tickOffset=[[],[]],this.tickX=[[],[]],this.labelOffset=[0,0],this.labelCount=[0,0]}var c,u,f,h,p,d,m=l.prototype;m.drawTicks=(c=[0,0],u=[0,0],f=[0,0],function(t){var e=this.plot,r=this.shader,n=this.tickX[t],i=this.tickOffset[t],a=e.gl,s=e.viewBox,l=e.dataBox,h=e.screenBox,p=e.pixelRatio,d=e.tickEnable,m=e.tickPad,g=e.tickColor,v=e.tickAngle,y=e.labelEnable,x=e.labelPad,b=e.labelColor,_=e.labelAngle,w=this.labelOffset[t],T=this.labelCount[t],M=o.lt(n,l[t]),k=o.le(n,l[t+2]);c[0]=c[1]=0,c[t]=1,u[t]=(s[2+t]+s[t])/(h[2+t]-h[t])-1;var A=2/h[2+(1^t)]-h[1^t];u[1^t]=A*s[1^t]-1,d[t]&&(u[1^t]-=A*p*m[t],M<k&&i[k]>i[M]&&(r.uniforms.dataAxis=c,r.uniforms.screenOffset=u,r.uniforms.color=g[t],r.uniforms.angle=v[t],a.drawArrays(a.TRIANGLES,i[M],i[k]-i[M]))),y[t]&&T&&(u[1^t]-=A*p*x[t],r.uniforms.dataAxis=f,r.uniforms.screenOffset=u,r.uniforms.color=b[t],r.uniforms.angle=_[t],a.drawArrays(a.TRIANGLES,w,T)),u[1^t]=A*s[2+(1^t)]-1,d[t+2]&&(u[1^t]+=A*p*m[t+2],M<k&&i[k]>i[M]&&(r.uniforms.dataAxis=c,r.uniforms.screenOffset=u,r.uniforms.color=g[t+2],r.uniforms.angle=v[t+2],a.drawArrays(a.TRIANGLES,i[M],i[k]-i[M]))),y[t+2]&&T&&(u[1^t]+=A*p*x[t+2],r.uniforms.dataAxis=f,r.uniforms.screenOffset=u,r.uniforms.color=b[t+2],r.uniforms.angle=_[t+2],a.drawArrays(a.TRIANGLES,w,T))}),m.drawTitle=function(){var t=[0,0],e=[0,0];return function(){var r=this.plot,n=this.shader,i=r.gl,a=r.screenBox,o=r.titleCenter,s=r.titleAngle,l=r.titleColor,c=r.pixelRatio;if(this.titleCount){for(var u=0;u<2;++u)e[u]=2*(o[u]*c-a[u])/(a[2+u]-a[u])-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)}}}(),m.bind=(h=[0,0],p=[0,0],d=[0,0],function(){var t=this.plot,e=this.shader,r=t._tickBounds,n=t.dataBox,i=t.screenBox,a=t.viewBox;e.bind();for(var o=0;o<2;++o){var s=r[o],l=r[o+2]-s,c=.5*(n[o+2]+n[o]),u=n[o+2]-n[o],f=a[o],m=a[o+2]-f,g=i[o],v=i[o+2]-g;p[o]=2*l/u*m/v,h[o]=2*(s-c)/u*m/v}d[1]=2*t.pixelRatio/(i[3]-i[1]),d[0]=d[1]*(i[3]-i[1])/(i[2]-i[0]),e.uniforms.dataScale=p,e.uniforms.dataShift=h,e.uniforms.textScale=d,this.vbo.bind(),e.attributes.textCoordinate.pointer()}),m.update=function(t){var e,r,n,i,o,s=[],l=t.ticks,c=t.bounds;for(o=0;o<2;++o){var u=[Math.floor(s.length/3)],f=[-1/0],h=l[o];for(e=0;e<h.length;++e){var p=h[e],d=p.x,m=p.text,g=p.font||"sans-serif";i=p.fontSize||12;for(var v=1/(c[o+2]-c[o]),y=c[o],x=m.split("\n"),b=0;b<x.length;b++)for(n=a(g,x[b]).data,r=0;r<n.length;r+=2)s.push(n[r]*i,-n[r+1]*i-b*i*1.2,(d-y)*v);u.push(Math.floor(s.length/3)),f.push(d)}this.tickOffset[o]=u,this.tickX[o]=f}for(o=0;o<2;++o){for(this.labelOffset[o]=Math.floor(s.length/3),n=a(t.labelFont[o],t.labels[o],{textAlign:"center"}).data,i=t.labelSize[o],e=0;e<n.length;e+=2)s.push(n[e]*i,-n[e+1]*i,0);this.labelCount[o]=Math.floor(s.length/3)-this.labelOffset[o]}for(this.titleOffset=Math.floor(s.length/3),n=a(t.titleFont,t.title).data,i=t.titleSize,e=0;e<n.length;e+=2)s.push(n[e]*i,-n[e+1]*i,0);this.titleCount=Math.floor(s.length/3)-this.titleOffset,this.vbo.update(s)},m.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":282,"binary-search-bounds":64,"gl-buffer":231,"gl-shader":298,"text-cache":1509}],284:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl,r=n(e,[e.drawingBufferWidth,e.drawingBufferHeight]),c=new l(e,r);return c.grid=i(c),c.text=a(c),c.line=o(c),c.box=s(c),c.update(t),c};var n=t("gl-select-static"),i=t("./lib/grid"),a=t("./lib/text"),o=t("./lib/line"),s=t("./lib/box");function l(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.static=!1,this.dirty=!1,this.pickDirty=!1,this.pickDelay=120,this.pickRadius=10,this._pickTimeout=null,this._drawPick=this.drawPick.bind(this),this._depthCounter=0}var c=l.prototype;function u(t){for(var e=t.slice(),r=0;r<e.length;++r)e[r]=e[r].slice();return e}function f(t,e){return t.x-e.x}c.setDirty=function(){this.dirty=this.pickDirty=!0},c.setOverlayDirty=function(){this.dirty=!0},c.nextDepthValue=function(){return this._depthCounter++/65536},c.draw=function(){var t=this.gl,e=this.screenBox,r=this.viewBox,n=this.dataBox,i=this.pixelRatio,a=this.grid,o=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){if(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),this.borderColor){t.scissor(e[0],e[1],e[2]-e[0],e[3]-e[1]);var c=this.borderColor;t.clearColor(c[0]*c[3],c[1]*c[3],c[2]*c[3],c[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 u=this.backgroundColor;t.clearColor(u[0]*u[3],u[1]*u[3],u[2]*u[3],u[3]),t.clear(t.COLOR_BUFFER_BIT),a.draw();var f=this.zeroLineEnable,h=this.zeroLineColor,p=this.zeroLineWidth;if(f[0]||f[1]){o.bind();for(var d=0;d<2;++d)if(f[d]&&n[d]<=0&&n[d+2]>=0){var m=e[d]-n[d]*(e[d+2]-e[d])/(n[d+2]-n[d]);0===d?o.drawLine(m,e[1],m,e[3],p[d],h[d]):o.drawLine(e[0],m,e[2],m,p[d],h[d])}}for(d=0;d<l.length;++d)l[d].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(),o.bind();var g=this.borderLineEnable,v=this.borderLineWidth,y=this.borderLineColor;for(g[1]&&o.drawLine(r[0],r[1]-.5*v[1]*i,r[0],r[3]+.5*v[3]*i,v[1],y[1]),g[0]&&o.drawLine(r[0]-.5*v[0]*i,r[1],r[2]+.5*v[2]*i,r[1],v[0],y[0]),g[3]&&o.drawLine(r[2],r[1]-.5*v[1]*i,r[2],r[3]+.5*v[3]*i,v[3],y[3]),g[2]&&o.drawLine(r[0]-.5*v[0]*i,r[3],r[2]+.5*v[2]*i,r[3],v[2],y[2]),s.bind(),d=0;d<2;++d)s.drawTicks(d);this.titleEnable&&s.drawTitle();var x=this.overlays;for(d=0;d<x.length;++d)x[d].draw();t.disable(t.SCISSOR_TEST),t.disable(t.BLEND),t.depthMask(!0)}},c.drawPick=function(){if(!this.static){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()}},c.pick=function(t,e){if(!this.static){var r=this.pixelRatio,n=this.pickPixelRatio,i=this.viewBox,a=0|Math.round((t-i[0]/r)*n),o=0|Math.round((e-i[1]/r)*n),s=this.pickBuffer.query(a,o,this.pickRadius);if(!s)return null;for(var l=s.id+(s.value[0]<<8)+(s.value[1]<<16)+(s.value[2]<<24),c=this.objects,u=0;u<c.length;++u){var f=c[u].pick(a,o,l);if(f)return f}return null}},c.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()},c.setDataBox=function(t){var e=this.dataBox;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3])&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],this.setDirty())},c.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()},c.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,i=(n[2]-n[0])/(n[3]-n[1]);this.setDataBox(t.dataBox||[-10,-10/i,10,10/i]),this.borderColor=!1!==t.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=u(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=u(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=u(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=u(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=u(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=u(t.borderLineColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);var a=t.ticks||[[],[]],o=this._tickBounds;o[0]=o[1]=1/0,o[2]=o[3]=-1/0;for(var s=0;s<2;++s){var l=a[s].slice(0);0!==l.length&&(l.sort(f),o[s]=Math.min(o[s],l[0].x),o[s+2]=Math.max(o[s+2],l[l.length-1].x))}this.grid.update({bounds:o,ticks:a}),this.text.update({bounds:o,ticks:a,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.static=!!t.static,this.setDirty()},c.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(t=this.overlays.length-1;t>=0;--t)this.overlays[t].dispose();this.overlays.length=0,this.gl=null},c.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},c.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}},c.addOverlay=function(t){this.overlays.indexOf(t)<0&&(this.overlays.push(t),this.setOverlayDirty())},c.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":279,"./lib/grid":280,"./lib/line":281,"./lib/text":283,"gl-select-static":297}],285:[function(t,e,r){"use strict";e.exports=function(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 c=i({center:e.center||[0,0,0],up:e.up||[0,1,0],eye:e.eye||[0,0,10],mode:e.mode||"orbit",distanceLimits:r}),u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],f=0,h=t.clientWidth,p=t.clientHeight,d={keyBindingMode:"rotate",enableWheel:!0,view:c,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:c.modes,_ortho:e._ortho||e.projection&&"orthographic"===e.projection.type||!1,tick:function(){var e=n(),r=this.delay,i=e-2*r;c.idle(e-r),c.recalcMatrix(i),c.flush(e-(100+2*r));for(var a=!0,o=c.computedMatrix,s=0;s<16;++s)a=a&&u[s]===o[s],u[s]=o[s];var l=t.clientWidth===h&&t.clientHeight===p;return h=t.clientWidth,p=t.clientHeight,a?!l:(f=Math.exp(c.computedRadius[0]),!0)},lookAt:function(t,e,r){c.lookAt(c.lastT(),t,e,r)},rotate:function(t,e,r){c.rotate(c.lastT(),t,e,r)},pan:function(t,e,r){c.pan(c.lastT(),t,e,r)},translate:function(t,e,r){c.translate(c.lastT(),t,e,r)}};return Object.defineProperties(d,{matrix:{get:function(){return c.computedMatrix},set:function(t){return c.setMatrix(c.lastT(),t),c.computedMatrix},enumerable:!0},mode:{get:function(){return c.getMode()},set:function(t){var e=c.computedUp.slice(),r=c.computedEye.slice(),i=c.computedCenter.slice();if(c.setMode(t),"turntable"===t){var a=n();c._active.lookAt(a,r,i,e),c._active.lookAt(a+500,r,i,[0,0,1]),c._active.flush(a)}return c.getMode()},enumerable:!0},center:{get:function(){return c.computedCenter},set:function(t){return c.lookAt(c.lastT(),null,t),c.computedCenter},enumerable:!0},eye:{get:function(){return c.computedEye},set:function(t){return c.lookAt(c.lastT(),t),c.computedEye},enumerable:!0},up:{get:function(){return c.computedUp},set:function(t){return c.lookAt(c.lastT(),null,null,t),c.computedUp},enumerable:!0},distance:{get:function(){return f},set:function(t){return c.setDistance(c.lastT(),t),t},enumerable:!0},distanceLimits:{get:function(){return c.getDistanceLimits(r)},set:function(t){return c.setDistanceLimits(t),t},enumerable:!0}}),t.addEventListener("contextmenu",(function(t){return t.preventDefault(),!1})),d._lastX=-1,d._lastY=-1,d._lastMods={shift:!1,control:!1,alt:!1,meta:!1},d.enableMouseListeners=function(){function e(e,r,i,a){var o=d.keyBindingMode;if(!1!==o){var s="rotate"===o,l="pan"===o,u="zoom"===o,h=!!a.control,p=!!a.alt,m=!!a.shift,g=!!(1&e),v=!!(2&e),y=!!(4&e),x=1/t.clientHeight,b=x*(r-d._lastX),_=x*(i-d._lastY),w=d.flipX?1:-1,T=d.flipY?1:-1,M=Math.PI*d.rotateSpeed,k=n();if(-1!==d._lastX&&-1!==d._lastY&&((s&&g&&!h&&!p&&!m||g&&!h&&!p&&m)&&c.rotate(k,w*M*b,-T*M*_,0),(l&&g&&!h&&!p&&!m||v||g&&h&&!p&&!m)&&c.pan(k,-d.translateSpeed*b*f,d.translateSpeed*_*f,0),u&&g&&!h&&!p&&!m||y||g&&!h&&p&&!m)){var A=-d.zoomSpeed*_/window.innerHeight*(k-c.lastT())*100;c.pan(k,0,0,f*(Math.exp(A)-1))}return d._lastX=r,d._lastY=i,d._lastMods=a,!0}}d.mouseListener=a(t,e),t.addEventListener("touchstart",(function(r){var n=s(r.changedTouches[0],t);e(0,n[0],n[1],d._lastMods),e(1,n[0],n[1],d._lastMods)}),!!l&&{passive:!0}),t.addEventListener("touchmove",(function(r){var n=s(r.changedTouches[0],t);e(1,n[0],n[1],d._lastMods),r.preventDefault()}),!!l&&{passive:!1}),t.addEventListener("touchend",(function(t){e(0,d._lastX,d._lastY,d._lastMods)}),!!l&&{passive:!0}),d.wheelListener=o(t,(function(t,e){if(!1!==d.keyBindingMode&&d.enableWheel){var r=d.flipX?1:-1,i=d.flipY?1:-1,a=n();if(Math.abs(t)>Math.abs(e))c.rotate(a,0,0,-t*r*Math.PI*d.rotateSpeed/window.innerWidth);else if(!d._ortho){var o=-d.zoomSpeed*i*e/window.innerHeight*(a-c.lastT())/20;c.pan(a,0,0,f*(Math.exp(o)-1))}}}),!0)},d.enableMouseListeners(),d};var n=t("right-now"),i=t("3d-view"),a=t("mouse-change"),o=t("mouse-wheel"),s=t("mouse-event-offset"),l=t("has-passive-events")},{"3d-view":21,"has-passive-events":401,"mouse-change":618,"mouse-event-offset":619,"mouse-wheel":621,"right-now":1479}],286:[function(t,e,r){var n=t("glslify"),i=t("gl-shader"),a=n(["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=n(["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 i(t,a,o,null,[{name:"position",type:"vec2"}])}},{"gl-shader":298,glslify:399}],287:[function(t,e,r){"use strict";var n=t("./camera.js"),i=t("gl-axes3d"),a=t("gl-axes3d/properties"),o=t("gl-spikes3d"),s=t("gl-select-static"),l=t("gl-fbo"),c=t("a-big-triangle"),u=t("mouse-change"),f=t("gl-mat4/perspective"),h=t("gl-mat4/ortho"),p=t("./lib/shader"),d=t("is-mobile")({tablet:!0,featureDetect:!0});function m(){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 g(t){var e=Math.round(Math.log(Math.abs(t))/Math.log(10));if(e<0){var r=Math.round(Math.pow(10,-e));return Math.ceil(t*r)/r}if(e>0){r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function v(t){return"boolean"!=typeof t||t}e.exports={createScene:function(t){(t=t||{}).camera=t.camera||{};var e=t.canvas;if(!e){if(e=document.createElement("canvas"),t.container)t.container.appendChild(e);else document.body.appendChild(e)}var r=t.gl;r||(t.glOptions&&(d=!!t.glOptions.preserveDrawingBuffer),r=function(t,e){var r=null;try{(r=t.getContext("webgl",e))||(r=t.getContext("experimental-webgl",e))}catch(t){return null}return r}(e,t.glOptions||{premultipliedAlpha:!0,antialias:!0,preserveDrawingBuffer:d}));if(!r)throw new Error("webgl not supported");var y=t.bounds||[[-10,-10,-10],[10,10,10]],x=new m,b=l(r,r.drawingBufferWidth,r.drawingBufferHeight,{preferFloat:!d}),_=p(r),w=t.cameraObject&&!0===t.cameraObject._ortho||t.camera.projection&&"orthographic"===t.camera.projection.type||!1,T={eye:t.camera.eye||[2,0,0],center:t.camera.center||[0,0,0],up:t.camera.up||[0,1,0],zoomMin:t.camera.zoomMax||.1,zoomMax:t.camera.zoomMin||100,mode:t.camera.mode||"turntable",_ortho:w},M=t.axes||{},k=i(r,M);k.enable=!M.disable;var A=t.spikes||{},S=o(r,A),E=[],C=[],L=[],P=[],I=!0,O=!0,z=new Array(16),D=new Array(16),N={view:null,projection:z,model:D,_ortho:!1},R=(O=!0,[r.drawingBufferWidth,r.drawingBufferHeight]),F=t.cameraObject||n(e,T),B={gl:r,contextLost:!1,pixelRatio:t.pixelRatio||1,canvas:e,selection:x,camera:F,axes:k,axesPixels:null,spikes:S,bounds:y,objects:E,shape:R,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:v(t.autoResize),autoBounds:v(t.autoBounds),autoScale:!!t.autoScale,autoCenter:v(t.autoCenter),clipToBounds:v(t.clipToBounds),snapToData:!!t.snapToData,onselect:t.onselect||null,onrender:t.onrender||null,onclick:t.onclick||null,cameraParams:N,oncontextloss:null,mouseListener:null,_stopped:!1,getAspectratio:function(){return{x:this.aspect[0],y:this.aspect[1],z:this.aspect[2]}},setAspectratio:function(t){this.aspect[0]=t.x,this.aspect[1]=t.y,this.aspect[2]=t.z,O=!0},setBounds:function(t,e){this.bounds[0][t]=e.min,this.bounds[1][t]=e.max},setClearColor:function(t){this.clearColor=t},clearRGBA:function(){this.gl.clearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT)}},j=[r.drawingBufferWidth/B.pixelRatio|0,r.drawingBufferHeight/B.pixelRatio|0];function U(){if(!B._stopped&&B.autoResize){var t=e.parentNode,r=1,n=1;t&&t!==document.body?(r=t.clientWidth,n=t.clientHeight):(r=window.innerWidth,n=window.innerHeight);var i=0|Math.ceil(r*B.pixelRatio),a=0|Math.ceil(n*B.pixelRatio);if(i!==e.width||a!==e.height){e.width=i,e.height=a;var o=e.style;o.position=o.position||"absolute",o.left="0px",o.top="0px",o.width=r+"px",o.height=n+"px",I=!0}}}B.autoResize&&U();function V(){for(var t=E.length,e=P.length,n=0;n<e;++n)L[n]=0;t:for(n=0;n<t;++n){var i=E[n],a=i.pickSlots;if(a){for(var o=0;o<e;++o)if(L[o]+a<255){C[n]=o,i.setPickBase(L[o]+1),L[o]+=a;continue t}var l=s(r,R);C[n]=e,P.push(l),L.push(a),i.setPickBase(1),e+=1}else C[n]=-1}for(;e>0&&0===L[e-1];)L.pop(),P.pop().dispose()}function q(){if(B.contextLost)return!0;r.isContextLost()&&(B.contextLost=!0,B.mouseListener.enabled=!1,B.selection.object=null,B.oncontextloss&&B.oncontextloss())}window.addEventListener("resize",U),B.update=function(t){B._stopped||(t=t||{},I=!0,O=!0)},B.add=function(t){B._stopped||(t.axes=k,E.push(t),C.push(-1),I=!0,O=!0,V())},B.remove=function(t){if(!B._stopped){var e=E.indexOf(t);e<0||(E.splice(e,1),C.pop(),I=!0,O=!0,V())}},B.dispose=function(){if(!B._stopped&&(B._stopped=!0,window.removeEventListener("resize",U),e.removeEventListener("webglcontextlost",q),B.mouseListener.enabled=!1,!B.contextLost)){k.dispose(),S.dispose();for(var t=0;t<E.length;++t)E[t].dispose();b.dispose();for(t=0;t<P.length;++t)P[t].dispose();_.dispose(),r=null,k=null,S=null,E=[]}},B._mouseRotating=!1,B._prevButtons=0,B.enableMouseListeners=function(){B.mouseListener=u(e,(function(t,e,r){if(!B._stopped){var n=P.length,i=E.length,a=x.object;x.distance=1/0,x.mouse[0]=e,x.mouse[1]=r,x.object=null,x.screen=null,x.dataCoordinate=x.dataPosition=null;var o=!1;if(t&&B._prevButtons)B._mouseRotating=!0;else{B._mouseRotating&&(O=!0),B._mouseRotating=!1;for(var s=0;s<n;++s){var l=P[s].query(e,j[1]-r-1,B.pickRadius);if(l){if(l.distance>x.distance)continue;for(var c=0;c<i;++c){var u=E[c];if(C[c]===s){var f=u.pick(l);f&&(x.buttons=t,x.screen=l.coord,x.distance=l.distance,x.object=u,x.index=f.distance,x.dataPosition=f.position,x.dataCoordinate=f.dataCoordinate,x.data=f,o=!0)}}}}}a&&a!==x.object&&(a.highlight&&a.highlight(null),I=!0),x.object&&(x.object.highlight&&x.object.highlight(x.data),I=!0),(o=o||x.object!==a)&&B.onselect&&B.onselect(x),1&t&&!(1&B._prevButtons)&&B.onclick&&B.onclick(x),B._prevButtons=t}}))},e.addEventListener("webglcontextlost",q);var H=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],G=[H[0].slice(),H[1].slice()];function Y(){if(!q()){U();var t=B.camera.tick();N.view=B.camera.matrix,I=I||t,O=O||t,k.pixelRatio=B.pixelRatio,S.pixelRatio=B.pixelRatio;var e=E.length,n=H[0],i=H[1];n[0]=n[1]=n[2]=1/0,i[0]=i[1]=i[2]=-1/0;for(var o=0;o<e;++o){(L=E[o]).pixelRatio=B.pixelRatio,L.axes=B.axes,I=I||!!L.dirty,O=O||!!L.dirty;var s=L.bounds;if(s)for(var l=s[0],u=s[1],p=0;p<3;++p)n[p]=Math.min(n[p],l[p]),i[p]=Math.max(i[p],u[p])}var d=B.bounds;if(B.autoBounds)for(p=0;p<3;++p){if(i[p]<n[p])n[p]=-1,i[p]=1;else{n[p]===i[p]&&(n[p]-=1,i[p]+=1);var m=.05*(i[p]-n[p]);n[p]=n[p]-m,i[p]=i[p]+m}d[0][p]=n[p],d[1][p]=i[p]}var v=!1;for(p=0;p<3;++p)v=v||G[0][p]!==d[0][p]||G[1][p]!==d[1][p],G[0][p]=d[0][p],G[1][p]=d[1][p];if(O=O||v,I=I||v){if(v){var y=[0,0,0];for(o=0;o<3;++o)y[o]=g((d[1][o]-d[0][o])/10);k.autoTicks?k.update({bounds:d,tickSpacing:y}):k.update({bounds:d})}var T=r.drawingBufferWidth,M=r.drawingBufferHeight;R[0]=T,R[1]=M,j[0]=0|Math.max(T/B.pixelRatio,1),j[1]=0|Math.max(M/B.pixelRatio,1),function(t,e){var r=t.bounds,n=t.cameraParams,i=n.projection,a=n.model,o=t.gl.drawingBufferWidth,s=t.gl.drawingBufferHeight,l=t.zNear,c=t.zFar,u=t.fovy,p=o/s;e?(h(i,-p,p,-1,1,l,c),n._ortho=!0):(f(i,u,p,l,c),n._ortho=!1);for(var d=0;d<16;++d)a[d]=0;a[15]=1;var m=0;for(d=0;d<3;++d)m=Math.max(m,r[1][d]-r[0][d]);for(d=0;d<3;++d)t.autoScale?a[5*d]=t.aspect[d]/(r[1][d]-r[0][d]):a[5*d]=1/m,t.autoCenter&&(a[12+d]=.5*-a[5*d]*(r[0][d]+r[1][d]))}(B,w);for(o=0;o<e;++o){(L=E[o]).axesBounds=d,B.clipToBounds&&(L.clipBounds=d)}x.object&&(B.snapToData?S.position=x.dataCoordinate:S.position=x.dataPosition,S.bounds=d),O&&(O=!1,function(){if(!q()){r.colorMask(!0,!0,!0,!0),r.depthMask(!0),r.disable(r.BLEND),r.enable(r.DEPTH_TEST),r.depthFunc(r.LEQUAL);for(var t=E.length,e=P.length,n=0;n<e;++n){var i=P[n];i.shape=j,i.begin();for(var a=0;a<t;++a)if(C[a]===n){var o=E[a];o.drawPick&&(o.pixelRatio=1,o.drawPick(N))}i.end()}}}()),B.axesPixels=a(B.axes,N,T,M),B.onrender&&B.onrender(),r.bindFramebuffer(r.FRAMEBUFFER,null),r.viewport(0,0,T,M),B.clearRGBA(),r.depthMask(!0),r.colorMask(!0,!0,!0,!0),r.enable(r.DEPTH_TEST),r.depthFunc(r.LEQUAL),r.disable(r.BLEND),r.disable(r.CULL_FACE);var A=!1;k.enable&&(A=A||k.isTransparent(),k.draw(N)),S.axes=k,x.object&&S.draw(N),r.disable(r.CULL_FACE);for(o=0;o<e;++o){(L=E[o]).axes=k,L.pixelRatio=B.pixelRatio,L.isOpaque&&L.isOpaque()&&L.draw(N),L.isTransparent&&L.isTransparent()&&(A=!0)}if(A){b.shape=R,b.bind(),r.clear(r.DEPTH_BUFFER_BIT),r.colorMask(!1,!1,!1,!1),r.depthMask(!0),r.depthFunc(r.LESS),k.enable&&k.isTransparent()&&k.drawTransparent(N);for(o=0;o<e;++o){(L=E[o]).isOpaque&&L.isOpaque()&&L.draw(N)}r.enable(r.BLEND),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA),r.colorMask(!0,!0,!0,!0),r.depthMask(!1),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),k.isTransparent()&&k.drawTransparent(N);for(o=0;o<e;++o){var L;(L=E[o]).isTransparent&&L.isTransparent()&&L.drawTransparent(N)}r.bindFramebuffer(r.FRAMEBUFFER,null),r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA),r.disable(r.DEPTH_TEST),_.bind(),b.color[0].bind(0),_.uniforms.accumBuffer=0,c(r),r.disable(r.BLEND)}I=!1;for(o=0;o<e;++o)E[o].dirty=!1}}}return B.enableMouseListeners(),function t(){if(B._stopped||B.contextLost)return;Y(),requestAnimationFrame(t)}(),B.redraw=function(){B._stopped||(I=!0,Y())},B},createCamera:n}},{"./camera.js":285,"./lib/shader":286,"a-big-triangle":31,"gl-axes3d":223,"gl-axes3d/properties":230,"gl-fbo":239,"gl-mat4/ortho":265,"gl-mat4/perspective":266,"gl-select-static":297,"gl-spikes3d":307,"is-mobile":427,"mouse-change":618}],288:[function(t,e,r){var n=t("glslify");r.pointVertex=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform float pointCloud;\n\nhighp float rand(vec2 co) {\n highp float a = 12.9898;\n highp float b = 78.233;\n highp float c = 43758.5453;\n highp float d = dot(co.xy, vec2(a, b));\n highp float e = mod(d, 3.14);\n return fract(sin(e) * c);\n}\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n // if we don't jitter the point size a bit, overall point cloud\n // saturation 'jumps' on zooming, which is disturbing and confusing\n gl_PointSize = pointSize * ((19.5 + rand(position)) / 20.0);\n if(pointCloud != 0.0) { // pointCloud is truthy\n // get the same square surface as circle would be\n gl_PointSize *= 0.886;\n }\n}"]),r.pointFragment=n(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color, borderColor;\nuniform float centerFraction;\nuniform float pointCloud;\n\nvoid main() {\n float radius;\n vec4 baseColor;\n if(pointCloud != 0.0) { // pointCloud is truthy\n if(centerFraction == 1.0) {\n gl_FragColor = color;\n } else {\n gl_FragColor = mix(borderColor, color, centerFraction);\n }\n } else {\n radius = length(2.0 * gl_PointCoord.xy - 1.0);\n if(radius > 1.0) {\n discard;\n }\n baseColor = mix(borderColor, color, step(radius, centerFraction));\n gl_FragColor = vec4(baseColor.rgb * baseColor.a, baseColor.a);\n }\n}\n"]),r.pickVertex=n(["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=n(["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"])},{glslify:399}],289:[function(t,e,r){"use strict";var n=t("gl-shader"),i=t("gl-buffer"),a=t("typedarray-pool"),o=t("./lib/shader");function s(t,e,r,n,i){this.plot=t,this.offsetBuffer=e,this.pickBuffer=r,this.shader=n,this.pickShader=i,this.sizeMin=.5,this.sizeMinCap=2,this.sizeMax=20,this.areaRatio=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.blend=!1,this.pickOffset=0,this.points=null}e.exports=function(t,e){var r=t.gl,a=i(r),l=i(r),c=n(r,o.pointVertex,o.pointFragment),u=n(r,o.pickVertex,o.pickFragment),f=new s(t,a,l,c,u);return f.update(e),t.addObject(f),f};var l,c,u=s.prototype;u.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.plot.removeObject(this)},u.update=function(t){var e;function r(e,r){return e in t?t[e]:r}t=t||{},this.sizeMin=r("sizeMin",.5),this.sizeMax=r("sizeMax",20),this.color=r("color",[1,0,0,1]).slice(),this.areaRatio=r("areaRatio",1),this.borderColor=r("borderColor",[0,0,0,1]).slice(),this.blend=r("blend",!1);var n=t.positions.length>>>1,i=t.positions instanceof Float32Array,o=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,s=t.positions,l=i?s:a.mallocFloat32(s.length),c=o?t.idToIndex:a.mallocInt32(n);if(i||l.set(s),!o)for(l.set(s),e=0;e<n;e++)c[e]=e;this.points=s,this.offsetBuffer.update(l),this.pickBuffer.update(c),i||a.free(l),o||a.free(c),this.pointCount=n,this.pickOffset=0},u.unifiedDraw=(l=[1,0,0,0,1,0,0,0,1],c=[0,0,0,0],function(t){var e=void 0!==t,r=e?this.pickShader:this.shader,n=this.plot.gl,i=this.plot.dataBox;if(0===this.pointCount)return t;var a=i[2]-i[0],o=i[3]-i[1],s=function(t,e){var r,n=0,i=t.length>>>1;for(r=0;r<i;r++){var a=t[2*r],o=t[2*r+1];a>=e[0]&&a<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}(this.points,i),u=this.plot.pickPixelRatio*Math.max(Math.min(this.sizeMinCap,this.sizeMin),Math.min(this.sizeMax,this.sizeMax/Math.pow(s,.33333)));l[0]=2/a,l[4]=2/o,l[6]=-2*i[0]/a-1,l[7]=-2*i[1]/o-1,this.offsetBuffer.bind(),r.bind(),r.attributes.position.pointer(),r.uniforms.matrix=l,r.uniforms.color=this.color,r.uniforms.borderColor=this.borderColor,r.uniforms.pointCloud=u<5,r.uniforms.pointSize=u,r.uniforms.centerFraction=Math.min(1,Math.max(0,Math.sqrt(1-this.areaRatio))),e&&(c[0]=255&t,c[1]=t>>8&255,c[2]=t>>16&255,c[3]=t>>24&255,this.pickBuffer.bind(),r.attributes.pickId.pointer(n.UNSIGNED_BYTE),r.uniforms.pickOffset=c,this.pickOffset=t);var f=n.getParameter(n.BLEND),h=n.getParameter(n.DITHER);return f&&!this.blend&&n.disable(n.BLEND),h&&n.disable(n.DITHER),n.drawArrays(n.POINTS,0,this.pointCount),f&&!this.blend&&n.enable(n.BLEND),h&&n.enable(n.DITHER),t+this.pointCount}),u.draw=u.unifiedDraw,u.drawPick=u.unifiedDraw,u.pick=function(t,e,r){var n=this.pickOffset,i=this.pointCount;if(r<n||r>=n+i)return null;var a=r-n,o=this.points;return{object:this,pointId:a,dataCoord:[o[2*a],o[2*a+1]]}}},{"./lib/shader":288,"gl-buffer":231,"gl-shader":298,"typedarray-pool":1531}],290:[function(t,e,r){e.exports=function(t,e,r,n){var i,a,o,s,l,c=e[0],u=e[1],f=e[2],h=e[3],p=r[0],d=r[1],m=r[2],g=r[3];(a=c*p+u*d+f*m+h*g)<0&&(a=-a,p=-p,d=-d,m=-m,g=-g);1-a>1e-6?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-n)*i)/o,l=Math.sin(n*i)/o):(s=1-n,l=n);return t[0]=s*c+l*p,t[1]=s*u+l*d,t[2]=s*f+l*m,t[3]=s*h+l*g,t}},{}],291:[function(t,e,r){"use strict";e.exports=function(t){return t||0===t?t.toString():""}},{}],292:[function(t,e,r){"use strict";var n=t("vectorize-text");e.exports=function(t,e,r){var a=i[e];a||(a=i[e]={});if(t in a)return a[t];var o={textAlign:"center",textBaseline:"middle",lineHeight:1,font:e,lineSpacing:1.25,styletags:{breaklines:!0,bolds:!0,italics:!0,subscripts:!0,superscripts:!0},triangles:!0},s=n(t,o);o.triangles=!1;var l,c,u=n(t,o);if(r&&1!==r){for(l=0;l<s.positions.length;++l)for(c=0;c<s.positions[l].length;++c)s.positions[l][c]/=r;for(l=0;l<u.positions.length;++l)for(c=0;c<u.positions[l].length;++c)u.positions[l][c]/=r}var f=[[1/0,1/0],[-1/0,-1/0]],h=u.positions.length;for(l=0;l<h;++l){var p=u.positions[l];for(c=0;c<2;++c)f[0][c]=Math.min(f[0][c],p[c]),f[1][c]=Math.max(f[1][c],p[c])}return a[t]=[s,u,f]};var i={}},{"vectorize-text":1536}],293:[function(t,e,r){var n=t("gl-shader"),i=t("glslify"),a=i(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\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 (outOfRange(clipBounds[0], clipBounds[1], position)) {\n\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}"]),o=i(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\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 (outOfRange(clipBounds[0], clipBounds[1], position)) {\n\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=i(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\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 (outOfRange(clipBounds[0], clipBounds[1], position)) {\n\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=i(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 fragClipBounds[2];\nuniform float opacity;\n\nvarying vec4 interpColor;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if (\n outOfRange(fragClipBounds[0], fragClipBounds[1], dataCoordinate) ||\n interpColor.a * opacity == 0.\n ) discard;\n gl_FragColor = interpColor * opacity;\n}\n"]),c=i(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 fragClipBounds[2];\nuniform float pickGroup;\n\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if (outOfRange(fragClipBounds[0], fragClipBounds[1], dataCoordinate)) discard;\n\n gl_FragColor = vec4(pickGroup, pickId.bgr);\n}"]),u=[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"glyph",type:"vec2"},{name:"id",type:"vec4"}],f={vertex:a,fragment:l,attributes:u},h={vertex:o,fragment:l,attributes:u},p={vertex:s,fragment:l,attributes:u},d={vertex:a,fragment:c,attributes:u},m={vertex:o,fragment:c,attributes:u},g={vertex:s,fragment:c,attributes:u};function v(t,e){var r=n(t,e),i=r.attributes;return i.position.location=0,i.color.location=1,i.glyph.location=2,i.id.location=3,r}r.createPerspective=function(t){return v(t,f)},r.createOrtho=function(t){return v(t,h)},r.createProject=function(t){return v(t,p)},r.createPickPerspective=function(t){return v(t,d)},r.createPickOrtho=function(t){return v(t,m)},r.createPickProject=function(t){return v(t,g)}},{"gl-shader":298,glslify:399}],294:[function(t,e,r){"use strict";var n=t("is-string-blank"),i=t("gl-buffer"),a=t("gl-vao"),o=t("typedarray-pool"),s=t("gl-mat4/multiply"),l=t("./lib/shaders"),c=t("./lib/glyphs"),u=t("./lib/get-simple-string"),f=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function h(t,e){var r=t[0],n=t[1],i=t[2],a=t[3];return t[0]=e[0]*r+e[4]*n+e[8]*i+e[12]*a,t[1]=e[1]*r+e[5]*n+e[9]*i+e[13]*a,t[2]=e[2]*r+e[6]*n+e[10]*i+e[14]*a,t[3]=e[3]*r+e[7]*n+e[11]*i+e[15]*a,t}function p(t,e,r,n){return h(n,n),h(n,n),h(n,n)}function d(t,e){this.index=t,this.dataCoordinate=this.position=e}function m(t){return!0===t||t>1?1:t}function g(t,e,r,n,i,a,o,s,l,c,u,f){this.gl=t,this.pixelRatio=1,this.shader=e,this.orthoShader=r,this.projectShader=n,this.pointBuffer=i,this.colorBuffer=a,this.glyphBuffer=o,this.idBuffer=s,this.vao=l,this.vertexCount=0,this.lineVertexCount=0,this.opacity=1,this.hasAlpha=!1,this.lineWidth=0,this.projectScale=[2/3,2/3,2/3],this.projectOpacity=[1,1,1],this.projectHasAlpha=!1,this.pickId=0,this.pickPerspectiveShader=c,this.pickOrthoShader=u,this.pickProjectShader=f,this.points=[],this._selectResult=new d(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}e.exports=function(t){var e=t.gl,r=l.createPerspective(e),n=l.createOrtho(e),o=l.createProject(e),s=l.createPickPerspective(e),c=l.createPickOrtho(e),u=l.createPickProject(e),f=i(e),h=i(e),p=i(e),d=i(e),m=a(e,[{buffer:f,size:3,type:e.FLOAT},{buffer:h,size:4,type:e.FLOAT},{buffer:p,size:2,type:e.FLOAT},{buffer:d,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),v=new g(e,r,n,o,f,h,p,d,m,s,c,u);return v.update(t),v};var v=g.prototype;v.pickSlots=1,v.setPickBase=function(t){this.pickId=t},v.isTransparent=function(){if(this.hasAlpha)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectHasAlpha)return!0;return!1},v.isOpaque=function(){if(!this.hasAlpha)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&!this.projectHasAlpha)return!0;return!1};var y=[0,0],x=[0,0,0],b=[0,0,0],_=[0,0,0,1],w=[0,0,0,1],T=f.slice(),M=[0,0,0],k=[[0,0,0],[0,0,0]];function A(t){return t[0]=t[1]=t[2]=0,t}function S(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t}function E(t,e,r,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[r]=n,t}function C(t,e,r,n){var i,a=e.axesProject,o=e.gl,l=t.uniforms,c=r.model||f,u=r.view||f,h=r.projection||f,d=e.axesBounds,m=function(t){for(var e=k,r=0;r<2;++r)for(var n=0;n<3;++n)e[r][n]=Math.max(Math.min(t[r][n],1e8),-1e8);return e}(e.clipBounds);i=e.axes&&e.axes.lastCubeProps?e.axes.lastCubeProps.axis:[1,1,1],y[0]=2/o.drawingBufferWidth,y[1]=2/o.drawingBufferHeight,t.bind(),l.view=u,l.projection=h,l.screenSize=y,l.highlightId=e.highlightId,l.highlightScale=e.highlightScale,l.clipBounds=m,l.pickGroup=e.pickId/255,l.pixelRatio=n;for(var g=0;g<3;++g)if(a[g]){l.scale=e.projectScale[g],l.opacity=e.projectOpacity[g];for(var v=T,C=0;C<16;++C)v[C]=0;for(C=0;C<4;++C)v[5*C]=1;v[5*g]=0,i[g]<0?v[12+g]=d[0][g]:v[12+g]=d[1][g],s(v,c,v),l.model=v;var L=(g+1)%3,P=(g+2)%3,I=A(x),O=A(b);I[L]=1,O[P]=1;var z=p(0,0,0,S(_,I)),D=p(0,0,0,S(w,O));if(Math.abs(z[1])>Math.abs(D[1])){var N=z;z=D,D=N,N=I,I=O,O=N;var R=L;L=P,P=R}z[0]<0&&(I[L]=-1),D[1]>0&&(O[P]=-1);var F=0,B=0;for(C=0;C<4;++C)F+=Math.pow(c[4*L+C],2),B+=Math.pow(c[4*P+C],2);I[L]/=Math.sqrt(F),O[P]/=Math.sqrt(B),l.axes[0]=I,l.axes[1]=O,l.fragClipBounds[0]=E(M,m[0],g,-1e8),l.fragClipBounds[1]=E(M,m[1],g,1e8),e.vao.bind(),e.vao.draw(o.TRIANGLES,e.vertexCount),e.lineWidth>0&&(o.lineWidth(e.lineWidth*n),e.vao.draw(o.LINES,e.lineVertexCount,e.vertexCount)),e.vao.unbind()}}var L=[[-1e8,-1e8,-1e8],[1e8,1e8,1e8]];function P(t,e,r,n,i,a,o){var s=r.gl;if((a===r.projectHasAlpha||o)&&C(e,r,n,i),a===r.hasAlpha||o){t.bind();var l=t.uniforms;l.model=n.model||f,l.view=n.view||f,l.projection=n.projection||f,y[0]=2/s.drawingBufferWidth,y[1]=2/s.drawingBufferHeight,l.screenSize=y,l.highlightId=r.highlightId,l.highlightScale=r.highlightScale,l.fragClipBounds=L,l.clipBounds=r.axes.bounds,l.opacity=r.opacity,l.pickGroup=r.pickId/255,l.pixelRatio=i,r.vao.bind(),r.vao.draw(s.TRIANGLES,r.vertexCount),r.lineWidth>0&&(s.lineWidth(r.lineWidth*i),r.vao.draw(s.LINES,r.lineVertexCount,r.vertexCount)),r.vao.unbind()}}function I(t,e,r,i){var a;a=Array.isArray(t)?e<t.length?t[e]:void 0:t,a=u(a);var o=!0;n(a)&&(a="\u25bc",o=!1);var s=c(a,r,i);return{mesh:s[0],lines:s[1],bounds:s[2],visible:o}}v.draw=function(t){P(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,this.pixelRatio,!1,!1)},v.drawTransparent=function(t){P(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,this.pixelRatio,!0,!1)},v.drawPick=function(t){P(this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader,this.pickProjectShader,this,t,1,!0,!0)},v.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||e<0)return null;var r=this.points[e],n=this._selectResult;n.index=e;for(var i=0;i<3;++i)n.position[i]=n.dataCoordinate[i]=r[i];return n},v.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]},v.update=function(t){if("perspective"in(t=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(this.projectHasAlpha=!1,"projectOpacity"in t){if(Array.isArray(t.projectOpacity))this.projectOpacity=t.projectOpacity.slice();else{r=+t.projectOpacity;this.projectOpacity=[r,r,r]}for(var n=0;n<3;++n)this.projectOpacity[n]=m(this.projectOpacity[n]),this.projectOpacity[n]<1&&(this.projectHasAlpha=!0)}this.hasAlpha=!1,"opacity"in t&&(this.opacity=m(t.opacity),this.opacity<1&&(this.hasAlpha=!0)),this.dirty=!0;var i,a,s=t.position,l=t.font||"normal",c=t.alignment||[0,0];if(2===c.length)i=c[0],a=c[1];else{i=[],a=[];for(n=0;n<c.length;++n)i[n]=c[n][0],a[n]=c[n][1]}var u=[1/0,1/0,1/0],f=[-1/0,-1/0,-1/0],h=t.glyph,p=t.color,d=t.size,g=t.angle,v=t.lineColor,y=-1,x=0,b=0,_=0;if(s.length){_=s.length;t:for(n=0;n<_;++n){for(var w=s[n],T=0;T<3;++T)if(isNaN(w[T])||!isFinite(w[T]))continue t;var M=(B=I(h,n,l,this.pixelRatio)).mesh,k=B.lines,A=B.bounds;x+=3*M.cells.length,b+=2*k.edges.length}}var S=x+b,E=o.mallocFloat(3*S),C=o.mallocFloat(4*S),L=o.mallocFloat(2*S),P=o.mallocUint32(S);if(S>0){var O=0,z=x,D=[0,0,0,1],N=[0,0,0,1],R=Array.isArray(p)&&Array.isArray(p[0]),F=Array.isArray(v)&&Array.isArray(v[0]);t:for(n=0;n<_;++n){y+=1;for(w=s[n],T=0;T<3;++T){if(isNaN(w[T])||!isFinite(w[T]))continue t;f[T]=Math.max(f[T],w[T]),u[T]=Math.min(u[T],w[T])}M=(B=I(h,n,l,this.pixelRatio)).mesh,k=B.lines,A=B.bounds;var B,j=B.visible;if(j)if(Array.isArray(p)){if(3===(U=R?n<p.length?p[n]:[0,0,0,0]:p).length){for(T=0;T<3;++T)D[T]=U[T];D[3]=1}else if(4===U.length){for(T=0;T<4;++T)D[T]=U[T];!this.hasAlpha&&U[3]<1&&(this.hasAlpha=!0)}}else D[0]=D[1]=D[2]=0,D[3]=1;else D=[1,1,1,0];if(j)if(Array.isArray(v)){var U;if(3===(U=F?n<v.length?v[n]:[0,0,0,0]:v).length){for(T=0;T<3;++T)N[T]=U[T];N[T]=1}else if(4===U.length){for(T=0;T<4;++T)N[T]=U[T];!this.hasAlpha&&U[3]<1&&(this.hasAlpha=!0)}}else N[0]=N[1]=N[2]=0,N[3]=1;else N=[1,1,1,0];var V=.5;j?Array.isArray(d)?V=n<d.length?+d[n]:12:d?V=+d:this.useOrtho&&(V=12):V=0;var q=0;Array.isArray(g)?q=n<g.length?+g[n]:0:g&&(q=+g);var H=Math.cos(q),G=Math.sin(q);for(w=s[n],T=0;T<3;++T)f[T]=Math.max(f[T],w[T]),u[T]=Math.min(u[T],w[T]);var Y=i,W=a;Y=0;Array.isArray(i)?Y=n<i.length?i[n]:0:i&&(Y=i);W=0;Array.isArray(a)?W=n<a.length?a[n]:0:a&&(W=a);var Z=[Y*=Y>0?1-A[0][0]:Y<0?1+A[1][0]:1,W*=W>0?1-A[0][1]:W<0?1+A[1][1]:1],X=M.cells||[],J=M.positions||[];for(T=0;T<X.length;++T)for(var K=X[T],$=0;$<3;++$){for(var Q=0;Q<3;++Q)E[3*O+Q]=w[Q];for(Q=0;Q<4;++Q)C[4*O+Q]=D[Q];P[O]=y;var tt=J[K[$]];L[2*O]=V*(H*tt[0]-G*tt[1]+Z[0]),L[2*O+1]=V*(G*tt[0]+H*tt[1]+Z[1]),O+=1}for(X=k.edges,J=k.positions,T=0;T<X.length;++T)for(K=X[T],$=0;$<2;++$){for(Q=0;Q<3;++Q)E[3*z+Q]=w[Q];for(Q=0;Q<4;++Q)C[4*z+Q]=N[Q];P[z]=y;tt=J[K[$]];L[2*z]=V*(H*tt[0]-G*tt[1]+Z[0]),L[2*z+1]=V*(G*tt[0]+H*tt[1]+Z[1]),z+=1}}}this.bounds=[u,f],this.points=s,this.pointCount=s.length,this.vertexCount=x,this.lineVertexCount=b,this.pointBuffer.update(E),this.colorBuffer.update(C),this.glyphBuffer.update(L),this.idBuffer.update(P),o.free(E),o.free(C),o.free(L),o.free(P)},v.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/get-simple-string":291,"./lib/glyphs":292,"./lib/shaders":293,"gl-buffer":231,"gl-mat4/multiply":264,"gl-vao":318,"is-string-blank":430,"typedarray-pool":1531}],295:[function(t,e,r){"use strict";var n=t("glslify");r.boxVertex=n(["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=n(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n"])},{glslify:399}],296:[function(t,e,r){"use strict";var n=t("gl-shader"),i=t("gl-buffer"),a=t("./lib/shaders");function o(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}e.exports=function(t,e){var r=t.gl,s=i(r,[0,0,0,1,1,0,1,1]),l=n(r,a.boxVertex,a.boxFragment),c=new o(t,s,l);return c.update(e),t.addOverlay(c),c};var s=o.prototype;s.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),a=this.borderColor,o=t.box,s=t.screenBox,l=t.dataBox,c=t.viewBox,u=t.pixelRatio,f=(e[0]-l[0])*(c[2]-c[0])/(l[2]-l[0])+c[0],h=(e[1]-l[1])*(c[3]-c[1])/(l[3]-l[1])+c[1],p=(e[2]-l[0])*(c[2]-c[0])/(l[2]-l[0])+c[0],d=(e[3]-l[1])*(c[3]-c[1])/(l[3]-l[1])+c[1];if(f=Math.max(f,c[0]),h=Math.max(h,c[1]),p=Math.min(p,c[2]),d=Math.min(d,c[3]),!(p<f||d<h)){o.bind();var m=s[2]-s[0],g=s[3]-s[1];if(this.outerFill&&(o.drawBox(0,0,m,h,i),o.drawBox(0,h,f,d,i),o.drawBox(0,d,m,g,i),o.drawBox(p,h,m,d,i)),this.innerFill&&o.drawBox(f,h,p,d,n),r>0){var v=r*u;o.drawBox(f-v,h-v,p+v,h+v,a),o.drawBox(f-v,d-v,p+v,d+v,a),o.drawBox(f-v,h-v,f+v,d+v,a),o.drawBox(p-v,h-v,p+v,d+v,a)}}}},s.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()},s.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":295,"gl-buffer":231,"gl-shader":298}],297:[function(t,e,r){"use strict";e.exports=function(t,e){var r=e[0],a=e[1],o=n(t,r,a,{}),s=i.mallocUint8(r*a*4);return new l(t,o,s)};var n=t("gl-fbo"),i=t("typedarray-pool"),a=t("ndarray"),o=t("bit-twiddle").nextPow2;function s(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}function l(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)}}var c=l.prototype;Object.defineProperty(c,"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){i.free(this.buffer);for(var n=this.buffer=i.mallocUint8(o(r*e*4)),a=0;a<r*e*4;++a)n[a]=255}return t}}}),c.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))},c.end=function(){var t=this.gl;t&&(t.bindFramebuffer(t.FRAMEBUFFER,null),this._readTimeout||clearTimeout(this._readTimeout),this._readTimeout=setTimeout(this._readCallback,1))},c.query=function(t,e,r){if(!this.gl)return null;var n=this.fbo.shape.slice();t|=0,e|=0,"number"!=typeof r&&(r=1);var i=0|Math.min(Math.max(t-r,0),n[0]),o=0|Math.min(Math.max(t+r,0),n[0]),l=0|Math.min(Math.max(e-r,0),n[1]),c=0|Math.min(Math.max(e+r,0),n[1]);if(o<=i||c<=l)return null;var u=[o-i,c-l],f=a(this.buffer,[u[0],u[1],4],[4,4*n[0],1],4*(i+n[0]*l)),h=function(t,e,r){for(var n=1e8,i=-1,a=-1,o=t.shape[0],s=t.shape[1],l=0;l<o;l++)for(var c=0;c<s;c++){var u=t.get(l,c,0),f=t.get(l,c,1),h=t.get(l,c,2),p=t.get(l,c,3);if(u<255||f<255||h<255||p<255){var d=e-l,m=r-c,g=d*d+m*m;g<n&&(n=g,i=l,a=c)}}return[i,a,n]}(f.hi(u[0],u[1],1),r,r),p=h[0],d=h[1];return p<0||Math.pow(this.radius,2)<h[2]?null:new s(p+i|0,d+l|0,f.get(p,d,0),[f.get(p,d,1),f.get(p,d,2),f.get(p,d,3)],Math.sqrt(h[2]))},c.dispose=function(){this.gl&&(this.fbo.dispose(),i.free(this.buffer),this.gl=null,this._readTimeout&&clearTimeout(this._readTimeout))}},{"bit-twiddle":65,"gl-fbo":239,ndarray:630,"typedarray-pool":1531}],298:[function(t,e,r){"use strict";var n=t("./lib/create-uniforms"),i=t("./lib/create-attributes"),a=t("./lib/reflect"),o=t("./lib/shader-cache"),s=t("./lib/runtime-reflect"),l=t("./lib/GLError");function c(t){this.gl=t,this.gl.lastAttribCount=0,this._vref=this._fref=this._relink=this.vertShader=this.fragShader=this.program=this.attributes=this.uniforms=this.types=null}var u=c.prototype;function f(t,e){return t.name<e.name?-1:1}u.bind=function(){var t;this.program||this._relink();var e=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_ATTRIBUTES),r=this.gl.lastAttribCount;if(e>r)for(t=r;t<e;t++)this.gl.enableVertexAttribArray(t);else if(r>e)for(t=e;t<r;t++)this.gl.disableVertexAttribArray(t);this.gl.lastAttribCount=e,this.gl.useProgram(this.program)},u.dispose=function(){for(var t=this.gl.lastAttribCount,e=0;e<t;e++)this.gl.disableVertexAttribArray(e);this.gl.lastAttribCount=0,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},u.update=function(t,e,r,c){if(!e||1===arguments.length){var u=t;t=u.vertex,e=u.fragment,r=u.uniforms,c=u.attributes}var h=this,p=h.gl,d=h._vref;h._vref=o.shader(p,p.VERTEX_SHADER,t),d&&d.dispose(),h.vertShader=h._vref.shader;var m=this._fref;if(h._fref=o.shader(p,p.FRAGMENT_SHADER,e),m&&m.dispose(),h.fragShader=h._fref.shader,!r||!c){var g=p.createProgram();if(p.attachShader(g,h.fragShader),p.attachShader(g,h.vertShader),p.linkProgram(g),!p.getProgramParameter(g,p.LINK_STATUS)){var v=p.getProgramInfoLog(g);throw new l(v,"Error linking program:"+v)}r=r||s.uniforms(p,g),c=c||s.attributes(p,g),p.deleteProgram(g)}(c=c.slice()).sort(f);var y,x=[],b=[],_=[];for(y=0;y<c.length;++y){var w=c[y];if(w.type.indexOf("mat")>=0){for(var T=0|w.type.charAt(w.type.length-1),M=new Array(T),k=0;k<T;++k)M[k]=_.length,b.push(w.name+"["+k+"]"),"number"==typeof w.location?_.push(w.location+k):Array.isArray(w.location)&&w.location.length===T&&"number"==typeof w.location[k]?_.push(0|w.location[k]):_.push(-1);x.push({name:w.name,type:w.type,locations:M})}else x.push({name:w.name,type:w.type,locations:[_.length]}),b.push(w.name),"number"==typeof w.location?_.push(0|w.location):_.push(-1)}var A=0;for(y=0;y<_.length;++y)if(_[y]<0){for(;_.indexOf(A)>=0;)A+=1;_[y]=A}var S=new Array(r.length);function E(){h.program=o.program(p,h._vref,h._fref,b,_);for(var t=0;t<r.length;++t)S[t]=p.getUniformLocation(h.program,r[t].name)}E(),h._relink=E,h.types={uniforms:a(r),attributes:a(c)},h.attributes=i(p,h,x,_),Object.defineProperty(h,"uniforms",n(p,h,r,S))},e.exports=function(t,e,r,n,i){var a=new c(t);return a.update(e,r,n,i),a}},{"./lib/GLError":299,"./lib/create-attributes":300,"./lib/create-uniforms":301,"./lib/reflect":302,"./lib/runtime-reflect":303,"./lib/shader-cache":304}],299:[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},{}],300:[function(t,e,r){"use strict";e.exports=function(t,e,r,i){for(var a={},l=0,c=r.length;l<c;++l){var u=r[l],f=u.name,h=u.type,p=u.locations;switch(h){case"bool":case"int":case"float":o(t,e,p[0],i,1,a,f);break;default:if(h.indexOf("vec")>=0){if((d=h.charCodeAt(h.length-1)-48)<2||d>4)throw new n("","Invalid data type for attribute "+f+": "+h);o(t,e,p[0],i,d,a,f)}else{if(!(h.indexOf("mat")>=0))throw new n("","Unknown data type for attribute "+f+": "+h);var d;if((d=h.charCodeAt(h.length-1)-48)<2||d>4)throw new n("","Invalid data type for attribute "+f+": "+h);s(t,e,p,i,d,a,f)}}}return a};var n=t("./GLError");function i(t,e,r,n,i,a){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=a}var a=i.prototype;function o(t,e,r,n,a,o,s){for(var l=["gl","v"],c=[],u=0;u<a;++u)l.push("x"+u),c.push("x"+u);l.push("if(x0.length===void 0){return gl.vertexAttrib"+a+"f(v,"+c.join()+")}else{return gl.vertexAttrib"+a+"fv(v,x0)}");var f=Function.apply(null,l),h=new i(t,e,r,n,a,f);Object.defineProperty(o,s,{set:function(e){return t.disableVertexAttribArray(n[r]),f(t,n[r],e),e},get:function(){return h},enumerable:!0})}function s(t,e,r,n,i,a,s){for(var l=new Array(i),c=new Array(i),u=0;u<i;++u)o(t,e,r[u],n,i,l,u),c[u]=l[u];Object.defineProperty(l,"location",{set:function(t){if(Array.isArray(t))for(var e=0;e<i;++e)c[e].location=t[e];else for(e=0;e<i;++e)c[e].location=t+e;return t},get:function(){for(var t=new Array(i),e=0;e<i;++e)t[e]=n[r[e]];return t},enumerable:!0}),l.pointer=function(e,a,o,s){e=e||t.FLOAT,a=!!a,o=o||i*i,s=s||0;for(var l=0;l<i;++l){var c=n[r[l]];t.vertexAttribPointer(c,i,e,a,o,s+l*i),t.enableVertexAttribArray(c)}};var f=new Array(i),h=t["vertexAttrib"+i+"fv"];Object.defineProperty(a,s,{set:function(e){for(var a=0;a<i;++a){var o=n[r[a]];if(t.disableVertexAttribArray(o),Array.isArray(e[0]))h.call(t,o,e[a]);else{for(var s=0;s<i;++s)f[s]=e[i*a+s];h.call(t,o,f)}}return e},get:function(){return l},enumerable:!0})}a.pointer=function(t,e,r,n){var i=this._gl,a=this._locations[this._index];i.vertexAttribPointer(a,this._dimension,t||i.FLOAT,!!e,r||0,n||0),i.enableVertexAttribArray(a)},a.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(a,"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":299}],301:[function(t,e,r){"use strict";var n=t("./reflect"),i=t("./GLError");function a(t){return new Function("y","return function(){return y}")(t)}function o(t,e){for(var r=new Array(t),n=0;n<t;++n)r[n]=e;return r}e.exports=function(t,e,r,s){function l(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(!(0<=n&&n<=1&&r.length===4+n)){if(0===r.indexOf("mat")&&4===r.length){var a;if((a=r.charCodeAt(r.length-1)-48)<2||a>4)throw new i("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+a+"fv(locations["+e+"],false,obj"+t+")"}throw new i("","Unknown uniform data type for "+name+": "+r)}if((a=r.charCodeAt(r.length-1)-48)<2||a>4)throw new i("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+a+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+a+"fv(locations["+e+"],obj"+t+")";default:throw new i("","Unrecognized data type for vector "+name+": "+r)}}}function c(e){for(var n=["return function updateProperty(obj){"],i=function t(e,r){if("object"!=typeof r)return[[e,r]];var n=[];for(var i in r){var a=r[i],o=e;parseInt(i)+""===i?o+="["+i+"]":o+="."+i,"object"==typeof a?n.push.apply(n,t(o,a)):n.push([o,a])}return n}("",e),a=0;a<i.length;++a){var o=i[a],c=o[0],u=o[1];s[u]&&n.push(l(c,u,r[u].type))}return n.push("return obj}"),new Function("gl","locations",n.join("\n"))(t,s)}function u(n,l,u){if("object"==typeof u){var h=f(u);Object.defineProperty(n,l,{get:a(h),set:c(u),enumerable:!0,configurable:!1})}else s[u]?Object.defineProperty(n,l,{get:(p=u,new Function("gl","wrapper","locations","return function(){return gl.getUniform(wrapper.program,locations["+p+"])}")(t,e,s)),set:c(u),enumerable:!0,configurable:!1}):n[l]=function(t){switch(t){case"bool":return!1;case"int":case"sampler2D":case"samplerCube":case"float":return 0;default:var e=t.indexOf("vec");if(0<=e&&e<=1&&t.length===4+e){if((r=t.charCodeAt(t.length-1)-48)<2||r>4)throw new i("","Invalid data type");return"b"===t.charAt(0)?o(r,!1):o(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r;if((r=t.charCodeAt(t.length-1)-48)<2||r>4)throw new i("","Invalid uniform dimension type for matrix "+name+": "+t);return o(r*r,0)}throw new i("","Unknown uniform data type for "+name+": "+t)}}(r[u].type);var p}function f(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r<t.length;++r)u(e,r,t[r])}else for(var n in e={},t)u(e,n,t[n]);return e}var h=n(r,!0);return{get:a(f(h)),set:c(h),enumerable:!0,configurable:!0}}},{"./GLError":299,"./reflect":302}],302:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r={},n=0;n<t.length;++n)for(var i=t[n].name.split("."),a=r,o=0;o<i.length;++o){var s=i[o].split("[");if(s.length>1){s[0]in a||(a[s[0]]=[]),a=a[s[0]];for(var l=1;l<s.length;++l){var c=parseInt(s[l]);l<s.length-1||o<i.length-1?(c in a||(l<s.length-1?a[c]=[]:a[c]={}),a=a[c]):a[c]=e?n:t[n].type}}else o<i.length-1?(s[0]in a||(a[s[0]]={}),a=a[s[0]]):a[s[0]]=e?n:t[n].type}return r}},{}],303:[function(t,e,r){"use strict";r.uniforms=function(t,e){for(var r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),n=[],i=0;i<r;++i){var o=t.getActiveUniform(e,i);if(o){var s=a(t,o.type);if(o.size>1)for(var l=0;l<o.size;++l)n.push({name:o.name.replace("[0]","["+l+"]"),type:s});else n.push({name:o.name,type:s})}}return n},r.attributes=function(t,e){for(var r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=[],i=0;i<r;++i){var o=t.getActiveAttrib(e,i);o&&n.push({name:o.name,type:a(t,o.type)})}return n};var n={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"},i=null;function a(t,e){if(!i){var r=Object.keys(n);i={};for(var a=0;a<r.length;++a){var o=r[a];i[t[o]]=n[o]}}return i[e]}},{}],304:[function(t,e,r){"use strict";r.shader=function(t,e,r){return u(t).getShaderReference(e,r)},r.program=function(t,e,r,n,i){return u(t).getProgram(e,r,n,i)};var n=t("./GLError"),i=t("gl-format-compiler-error"),a=new("undefined"==typeof WeakMap?t("weakmap-shim"):WeakMap),o=0;function s(t,e,r,n,i,a,o){this.id=t,this.src=e,this.type=r,this.shader=n,this.count=a,this.programs=[],this.cache=o}function l(t){this.gl=t,this.shaders=[{},{}],this.programs={}}s.prototype.dispose=function(){if(0==--this.count){for(var t=this.cache,e=t.gl,r=this.programs,n=0,i=r.length;n<i;++n){var a=t.programs[r[n]];a&&(delete t.programs[n],e.deleteProgram(a))}e.deleteShader(this.shader),delete t.shaders[this.type===e.FRAGMENT_SHADER|0][this.src]}};var c=l.prototype;function u(t){var e=a.get(t);return e||(e=new l(t),a.set(t,e)),e}c.getShaderReference=function(t,e){var r=this.gl,a=this.shaders[t===r.FRAGMENT_SHADER|0],l=a[e];if(l&&r.isShader(l.shader))l.count+=1;else{var c=function(t,e,r){var a=t.createShader(e);if(t.shaderSource(a,r),t.compileShader(a),!t.getShaderParameter(a,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(a);try{var s=i(o,r,e)}catch(t){throw console.warn("Failed to format compiler error: "+t),new n(o,"Error compiling shader:\n"+o)}throw new n(o,s.short,s.long)}return a}(r,t,e);l=a[e]=new s(o++,e,t,c,[],1,this)}return l},c.getProgram=function(t,e,r,i){var a=[t.id,e.id,r.join(":"),i.join(":")].join("@"),o=this.programs[a];return o&&this.gl.isProgram(o)||(this.programs[a]=o=function(t,e,r,i,a){var o=t.createProgram();t.attachShader(o,e),t.attachShader(o,r);for(var s=0;s<i.length;++s)t.bindAttribLocation(o,a[s],i[s]);if(t.linkProgram(o),!t.getProgramParameter(o,t.LINK_STATUS)){var l=t.getProgramInfoLog(o);throw new n(l,"Error linking program: "+l)}return o}(this.gl,t.shader,e.shader,r,i),t.programs.push(a),e.programs.push(a)),o}},{"./GLError":299,"gl-format-compiler-error":240,"weakmap-shim":1541}],305:[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]}e.exports=function(t,e){var r=new n(t);return r.update(e),t.addOverlay(r),r};var i=n.prototype;i.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()},i.draw=function(){var t=this.enable,e=this.width,r=this.color,n=this.center,i=this.plot,a=i.line,o=i.dataBox,s=i.viewBox;if(a.bind(),o[0]<=n[0]&&n[0]<=o[2]&&o[1]<=n[1]&&n[1]<=o[3]){var l=s[0]+(n[0]-o[0])/(o[2]-o[0])*(s[2]-s[0]),c=s[1]+(n[1]-o[1])/(o[3]-o[1])*(s[3]-s[1]);t[0]&&a.drawLine(l,c,s[0],c,e[0],r[0]),t[1]&&a.drawLine(l,c,l,s[1],e[1],r[1]),t[2]&&a.drawLine(l,c,s[2],c,e[2],r[2]),t[3]&&a.drawLine(l,c,l,s[3],e[3],r[3])}},i.dispose=function(){this.plot.removeOverlay(this)}},{}],306:[function(t,e,r){"use strict";var n=t("glslify"),i=t("gl-shader"),a=n(["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=n(["precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}"]);e.exports=function(t){return i(t,a,o,null,[{name:"position",type:"vec3"},{name:"color",type:"vec3"},{name:"weight",type:"float"}])}},{"gl-shader":298,glslify:399}],307:[function(t,e,r){"use strict";var n=t("gl-buffer"),i=t("gl-vao"),a=t("./shaders/index");e.exports=function(t,e){var r=[];function o(t,e,n,i,a,o){var s=[t,e,n,0,0,0,1];s[i+3]=1,s[i]=a,r.push.apply(r,s),s[6]=-1,r.push.apply(r,s),s[i]=o,r.push.apply(r,s),r.push.apply(r,s),s[6]=1,r.push.apply(r,s),s[i]=a,r.push.apply(r,s)}o(0,0,0,0,0,1),o(0,0,0,1,0,1),o(0,0,0,2,0,1),o(1,0,0,1,-1,1),o(1,0,0,2,-1,1),o(0,1,0,0,-1,1),o(0,1,0,2,-1,1),o(0,0,1,0,-1,1),o(0,0,1,1,-1,1);var l=n(t,r),c=i(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}]),u=a(t);u.attributes.position.location=0,u.attributes.color.location=1,u.attributes.weight.location=2;var f=new s(t,l,c,u);return f.update(e),f};var o=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function s(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}var l=s.prototype,c=[0,0,0],u=[0,0,0],f=[0,0];l.isTransparent=function(){return!1},l.drawTransparent=function(t){},l.draw=function(t){var e=this.gl,r=this.vao,n=this.shader;r.bind(),n.bind();var i,a=t.model||o,s=t.view||o,l=t.projection||o;this.axes&&(i=this.axes.lastCubeProps.axis);for(var h=c,p=u,d=0;d<3;++d)i&&i[d]<0?(h[d]=this.bounds[0][d],p[d]=this.bounds[1][d]):(h[d]=this.bounds[1][d],p[d]=this.bounds[0][d]);f[0]=e.drawingBufferWidth,f[1]=e.drawingBufferHeight,n.uniforms.model=a,n.uniforms.view=s,n.uniforms.projection=l,n.uniforms.coordinates=[this.position,h,p],n.uniforms.colors=this.colors,n.uniforms.screenShape=f;for(d=0;d<3;++d)n.uniforms.lineWidth=this.lineWidth[d]*this.pixelRatio,this.enabled[d]&&(r.draw(e.TRIANGLES,6,6*d),this.drawSides[d]&&r.draw(e.TRIANGLES,12,18+12*d));r.unbind()},l.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))},l.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders/index":306,"gl-buffer":231,"gl-vao":318}],308:[function(t,e,r){var n=t("glslify"),i=n(["precision highp float;\n\nprecision highp float;\n#define GLSLIFY 1\n\nvec3 getOrthogonalVector(vec3 v) {\n // Return up-vector for only-z vector.\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the tube vertex and normal at the given index.\n//\n// The returned vertex is for a tube ring with its center at origin, radius of length(d), pointing in the direction of d.\n//\n// Each tube segment is made up of a ring of vertices.\n// These vertices are used to make up the triangles of the tube by connecting them together in the vertex array.\n// The indexes of tube segments run from 0 to 8.\n//\nvec3 getTubePosition(vec3 d, float index, out vec3 normal) {\n float segmentCount = 8.0;\n\n float angle = 2.0 * 3.14159 * (index / segmentCount);\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d);\n vec3 y = v * sin(angle) * length(d);\n vec3 v3 = x + y;\n\n normal = normalize(v3);\n\n return v3;\n}\n\nattribute vec4 vector;\nattribute vec4 color, position;\nattribute vec2 uv;\n\nuniform float vectorScale, tubeScale;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 eyePosition, lightPosition;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n // Scale the vector magnitude to stay constant with\n // model & view changes.\n vec3 normal;\n vec3 XYZ = getTubePosition(mat3(model) * (tubeScale * vector.w * normalize(vector.xyz)), position.w, normal);\n vec4 tubePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * tubePosition;\n cameraCoordinate.xyz /= cameraCoordinate.w;\n f_lightDirection = lightPosition - cameraCoordinate.xyz;\n f_eyeDirection = eyePosition - cameraCoordinate.xyz;\n f_normal = normalize((vec4(normal, 0.0) * inverseModel).xyz);\n\n // vec4 m_position = model * vec4(tubePosition, 1.0);\n vec4 t_position = view * tubePosition;\n gl_Position = projection * t_position;\n\n f_color = color;\n f_data = tubePosition.xyz;\n f_position = position.xyz;\n f_uv = uv;\n}\n"]),a=n(["#extension GL_OES_standard_derivatives : enable\n\nprecision highp float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution(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\nfloat cookTorranceSpecular(\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(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\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\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 = min(1.0, max(0.0, cookTorranceSpecular(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}\n"]),o=n(["precision highp float;\n\nprecision highp float;\n#define GLSLIFY 1\n\nvec3 getOrthogonalVector(vec3 v) {\n // Return up-vector for only-z vector.\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the tube vertex and normal at the given index.\n//\n// The returned vertex is for a tube ring with its center at origin, radius of length(d), pointing in the direction of d.\n//\n// Each tube segment is made up of a ring of vertices.\n// These vertices are used to make up the triangles of the tube by connecting them together in the vertex array.\n// The indexes of tube segments run from 0 to 8.\n//\nvec3 getTubePosition(vec3 d, float index, out vec3 normal) {\n float segmentCount = 8.0;\n\n float angle = 2.0 * 3.14159 * (index / segmentCount);\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d);\n vec3 y = v * sin(angle) * length(d);\n vec3 v3 = x + y;\n\n normal = normalize(v3);\n\n return v3;\n}\n\nattribute vec4 vector;\nattribute vec4 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform float tubeScale;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n vec3 normal;\n vec3 XYZ = getTubePosition(mat3(model) * (tubeScale * vector.w * normalize(vector.xyz)), position.w, normal);\n vec4 tubePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0);\n\n gl_Position = projection * view * tubePosition;\n f_id = id;\n f_position = position.xyz;\n}\n"]),s=n(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard;\n\n gl_FragColor = vec4(pickId, f_id.xyz);\n}"]);r.meshShader={vertex:i,fragment:a,attributes:[{name:"position",type:"vec4"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"vector",type:"vec4"}]},r.pickShader={vertex:o,fragment:s,attributes:[{name:"position",type:"vec4"},{name:"id",type:"vec4"},{name:"vector",type:"vec4"}]}},{glslify:399}],309:[function(t,e,r){"use strict";var n=t("gl-vec3"),i=t("gl-vec4"),a=["xyz","xzy","yxz","yzx","zxy","zyx"],o=function(t,e,r,a){for(var o=0,s=0;s<t.length;s++)for(var l=t[s].velocities,c=0;c<l.length;c++)o=Math.max(o,n.length(l[c]));var u=t.map((function(t){return function(t,e,r,a){for(var o=t.points,s=t.velocities,l=t.divergences,c=[],u=[],f=[],h=[],p=[],d=[],m=0,g=0,v=i.create(),y=i.create(),x=0;x<o.length;x++){var b=o[x],_=s[x],w=l[x];0===e&&(w=.05*r),g=n.length(_)/a,v=i.create(),n.copy(v,_),v[3]=w;for(var T=0;T<8;T++)p[T]=[b[0],b[1],b[2],T];if(h.length>0)for(T=0;T<8;T++){var M=(T+1)%8;c.push(h[T],p[T],p[M],p[M],h[M],h[T]),f.push(y,v,v,v,y,y),d.push(m,g,g,g,m,m);var k=c.length;u.push([k-6,k-5,k-4],[k-3,k-2,k-1])}var A=h;h=p,p=A;var S=y;y=v,v=S;var E=m;m=g,g=E}return{positions:c,cells:u,vectors:f,vertexIntensity:d}}(t,r,a,o)})),f=[],h=[],p=[],d=[];for(s=0;s<u.length;s++){var m=u[s],g=f.length;f=f.concat(m.positions),p=p.concat(m.vectors),d=d.concat(m.vertexIntensity);for(c=0;c<m.cells.length;c++){var v=m.cells[c],y=[];h.push(y);for(var x=0;x<v.length;x++)y.push(v[x]+g)}}return{positions:f,cells:h,vectors:p,vertexIntensity:d,colormap:e}},s=function(t,e){var r,n=t.length;for(r=0;r<n;r++){var i=t[r];if(i===e)return r;if(i>e)return r-1}return r},l=function(t,e,r){return t<e?e:t>r?r:t},c=function(t){var e=1/0;t.sort((function(t,e){return t-e}));for(var r=t.length,n=1;n<r;n++){var i=Math.abs(t[n]-t[n-1]);i<e&&(e=i)}return e};e.exports=function(t,e){var r=t.startingPositions,i=t.maxLength||1e3,u=t.tubeSize||1,f=t.absoluteTubeSize,h=t.gridFill||"+x+y+z",p={};-1!==h.indexOf("-x")&&(p.reversedX=!0),-1!==h.indexOf("-y")&&(p.reversedY=!0),-1!==h.indexOf("-z")&&(p.reversedZ=!0),p.filled=a.indexOf(h.replace(/-/g,"").replace(/\+/g,""));var d=t.getVelocity||function(e){return function(t,e,r){var i=e.vectors,a=e.meshgrid,o=t[0],c=t[1],u=t[2],f=a[0].length,h=a[1].length,p=a[2].length,d=s(a[0],o),m=s(a[1],c),g=s(a[2],u),v=d+1,y=m+1,x=g+1;if(d=l(d,0,f-1),v=l(v,0,f-1),m=l(m,0,h-1),y=l(y,0,h-1),g=l(g,0,p-1),x=l(x,0,p-1),d<0||m<0||g<0||v>f-1||y>h-1||x>p-1)return n.create();var b,_,w,T,M,k,A=a[0][d],S=a[0][v],E=a[1][m],C=a[1][y],L=a[2][g],P=(o-A)/(S-A),I=(c-E)/(C-E),O=(u-L)/(a[2][x]-L);switch(isFinite(P)||(P=.5),isFinite(I)||(I=.5),isFinite(O)||(O=.5),r.reversedX&&(d=f-1-d,v=f-1-v),r.reversedY&&(m=h-1-m,y=h-1-y),r.reversedZ&&(g=p-1-g,x=p-1-x),r.filled){case 5:M=g,k=x,w=m*p,T=y*p,b=d*p*h,_=v*p*h;break;case 4:M=g,k=x,b=d*p,_=v*p,w=m*p*f,T=y*p*f;break;case 3:w=m,T=y,M=g*h,k=x*h,b=d*h*p,_=v*h*p;break;case 2:w=m,T=y,b=d*h,_=v*h,M=g*h*f,k=x*h*f;break;case 1:b=d,_=v,M=g*f,k=x*f,w=m*f*p,T=y*f*p;break;default:b=d,_=v,w=m*f,T=y*f,M=g*f*h,k=x*f*h}var z=i[b+w+M],D=i[b+w+k],N=i[b+T+M],R=i[b+T+k],F=i[_+w+M],B=i[_+w+k],j=i[_+T+M],U=i[_+T+k],V=n.create(),q=n.create(),H=n.create(),G=n.create();n.lerp(V,z,F,P),n.lerp(q,D,B,P),n.lerp(H,N,j,P),n.lerp(G,R,U,P);var Y=n.create(),W=n.create();n.lerp(Y,V,H,I),n.lerp(W,q,G,I);var Z=n.create();return n.lerp(Z,Y,W,O),Z}(e,t,p)},m=t.getDivergence||function(t,e){var r=n.create(),i=1e-4;n.add(r,t,[i,0,0]);var a=d(r);n.subtract(a,a,e),n.scale(a,a,1/i),n.add(r,t,[0,i,0]);var o=d(r);n.subtract(o,o,e),n.scale(o,o,1/i),n.add(r,t,[0,0,i]);var s=d(r);return n.subtract(s,s,e),n.scale(s,s,1/i),n.add(r,a,o),n.add(r,r,s),r},g=[],v=e[0][0],y=e[0][1],x=e[0][2],b=e[1][0],_=e[1][1],w=e[1][2],T=function(t){var e=t[0],r=t[1],n=t[2];return!(e<v||e>b||r<y||r>_||n<x||n>w)},M=10*n.distance(e[0],e[1])/i,k=M*M,A=1,S=0,E=r.length;E>1&&(A=function(t){for(var e=[],r=[],n=[],i={},a={},o={},s=t.length,l=0;l<s;l++){var u=t[l],f=u[0],h=u[1],p=u[2];i[f]||(e.push(f),i[f]=!0),a[h]||(r.push(h),a[h]=!0),o[p]||(n.push(p),o[p]=!0)}var d=c(e),m=c(r),g=c(n),v=Math.min(d,m,g);return isFinite(v)?v:1}(r));for(var C=0;C<E;C++){var L=n.create();n.copy(L,r[C]);var P=[L],I=[],O=d(L),z=L;I.push(O);var D=[],N=m(L,O),R=n.length(N);isFinite(R)&&R>S&&(S=R),D.push(R),g.push({points:P,velocities:I,divergences:D});for(var F=0;F<100*i&&P.length<i&&T(L);){F++;var B=n.clone(O),j=n.squaredLength(B);if(0===j)break;if(j>k&&n.scale(B,B,M/Math.sqrt(j)),n.add(B,B,L),O=d(B),n.squaredDistance(z,B)-k>-1e-4*k){P.push(B),z=B,I.push(O);N=m(B,O),R=n.length(N);isFinite(R)&&R>S&&(S=R),D.push(R)}L=B}}var U=o(g,t.colormap,S,A);return f?U.tubeScale=f:(0===S&&(S=1),U.tubeScale=.5*u*A/S),U};var u=t("./lib/shaders"),f=t("gl-cone3d").createMesh;e.exports.createTubeMesh=function(t,e){return f(t,e,{shaders:u,traceType:"streamtube"})}},{"./lib/shaders":308,"gl-cone3d":232,"gl-vec3":337,"gl-vec4":373}],310:[function(t,e,r){var n=t("gl-shader"),i=t("glslify"),a=i(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute vec3 f;\nattribute vec3 normal;\n\nuniform vec3 objectOffset;\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 lightPosition, eyePosition;\nuniform sampler2D colormap;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n vec3 localCoordinate = vec3(uv.zw, f.x);\n worldCoordinate = objectOffset + localCoordinate;\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 vColor = texture2D(colormap, vec2(value, value));\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=i(["precision highp float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution(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\nfloat beckmannSpecular(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness) {\n return beckmannDistribution(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness);\n}\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\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;\nuniform float vertexColor;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n if (\n kill > 0.0 ||\n vColor.a == 0.0 ||\n outOfRange(clipBounds[0], clipBounds[1], worldCoordinate)\n ) discard;\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 = max(beckmannSpecular(L, V, N, roughness), 0.);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n //decide how to interpolate color \u2014 in vertex or in fragment\n vec4 surfaceColor =\n step(vertexColor, .5) * texture2D(colormap, vec2(value, value)) +\n step(.5, vertexColor) * vColor;\n\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"]),s=i(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute float f;\n\nuniform vec3 objectOffset;\nuniform mat3 permutation;\nuniform mat4 model, view, projection;\nuniform float height, zOffset;\nuniform sampler2D colormap;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n vec3 dataCoordinate = permutation * vec3(uv.xy, height);\n worldCoordinate = objectOffset + dataCoordinate;\n vec4 worldPosition = model * vec4(worldCoordinate, 1.0);\n\n vec4 clipPosition = projection * view * worldPosition;\n clipPosition.z += zOffset;\n\n gl_Position = clipPosition;\n value = f + objectOffset.z;\n kill = -1.0;\n planeCoordinate = uv.zw;\n\n vColor = texture2D(colormap, vec2(value, value));\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"]),l=i(["precision highp float;\n#define GLSLIFY 1\n\nbool outOfRange(float a, float b, float p) {\n return ((p > max(a, b)) || \n (p < min(a, b)));\n}\n\nbool outOfRange(vec2 a, vec2 b, vec2 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y));\n}\n\nbool outOfRange(vec3 a, vec3 b, vec3 p) {\n return (outOfRange(a.x, b.x, p.x) ||\n outOfRange(a.y, b.y, p.y) ||\n outOfRange(a.z, b.z, p.z));\n}\n\nbool outOfRange(vec4 a, vec4 b, vec4 p) {\n return outOfRange(a.xyz, b.xyz, p.xyz);\n}\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 (outOfRange(clipBounds[0], clipBounds[1], worldCoordinate))) 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,a,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,a,l,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,s,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,s,l,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e}},{"gl-shader":298,glslify:399}],311:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl,r=y(e),n=b(e),s=x(e),l=_(e),c=i(e),u=a(e,[{buffer:c,size:4,stride:40,offset:0},{buffer:c,size:3,stride:40,offset:16},{buffer:c,size:3,stride:40,offset:28}]),f=i(e),h=a(e,[{buffer:f,size:4,stride:20,offset:0},{buffer:f,size:1,stride:20,offset:16}]),p=i(e),d=a(e,[{buffer:p,size:2,type:e.FLOAT}]),m=o(e,1,256,e.RGBA,e.UNSIGNED_BYTE);m.minFilter=e.LINEAR,m.magFilter=e.LINEAR;var g=new A(e,[0,0],[[0,0,0],[0,0,0]],r,n,c,u,m,s,l,f,h,p,d,[0,0,0]),v={levels:[[],[],[]]};for(var w in t)v[w]=t[w];return v.colormap=v.colormap||"jet",g.update(v),g};var n=t("bit-twiddle"),i=t("gl-buffer"),a=t("gl-vao"),o=t("gl-texture2d"),s=t("typedarray-pool"),l=t("colormap"),c=t("ndarray-ops"),u=t("ndarray-pack"),f=t("ndarray"),h=t("surface-nets"),p=t("gl-mat4/multiply"),d=t("gl-mat4/invert"),m=t("binary-search-bounds"),g=t("ndarray-gradient"),v=t("./lib/shaders"),y=v.createShader,x=v.createContourShader,b=v.createPickShader,_=v.createPickContourShader,w=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],T=[[0,0],[0,1],[1,0],[1,1],[1,0],[0,1]],M=[[0,0,0,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 k(t,e,r,n,i){this.position=t,this.index=e,this.uv=r,this.level=n,this.dataCoordinate=i}!function(){for(var t=0;t<3;++t){var e=M[t],r=(t+2)%3;e[(t+1)%3+0]=1,e[r+3]=1,e[t+6]=1}}();function A(t,e,r,n,i,a,o,l,c,u,h,p,d,m,g){this.gl=t,this.shape=e,this.bounds=r,this.objectOffset=g,this.intensityBounds=[],this._shader=n,this._pickShader=i,this._coordinateBuffer=a,this._vao=o,this._colorMap=l,this._contourShader=c,this._contourPickShader=u,this._contourBuffer=h,this._contourVAO=p,this._contourOffsets=[[],[],[]],this._contourCounts=[[],[],[]],this._vertexCount=0,this._pickResult=new k([0,0,0],[0,0],[0,0],[0,0,0],[0,0,0]),this._dynamicBuffer=d,this._dynamicVAO=m,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=[f(s.mallocFloat(1024),[0,0]),f(s.mallocFloat(1024),[0,0]),f(s.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.pixelRatio=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.vertexColor=0,this.dirty=!0}var S=A.prototype;S.genColormap=function(t,e){var r=!1,n=u([l({colormap:t,nshades:256,format:"rgba"}).map((function(t,n){var i=e?function(t,e){if(!e)return 1;if(!e.length)return 1;for(var r=0;r<e.length;++r){if(e.length<2)return 1;if(e[r][0]===t)return e[r][1];if(e[r][0]>t&&r>0){var n=(e[r][0]-t)/(e[r][0]-e[r-1][0]);return e[r][1]*(1-n)+n*e[r-1][1]}}return 1}(n/255,e):t[3];return i<1&&(r=!0),[t[0],t[1],t[2],255*i]}))]);return c.divseq(n,255),this.hasAlphaScale=r,n},S.isTransparent=function(){return this.opacity<1||this.hasAlphaScale},S.isOpaque=function(){return!this.isTransparent()},S.pickSlots=1,S.setPickBase=function(t){this.pickId=t};var E=[0,0,0],C={showSurface:!1,showContour:!1,projections:[w.slice(),w.slice(),w.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]};function L(t,e){var r,n,i,a=e.axes&&e.axes.lastCubeProps.axis||E,o=e.showSurface,s=e.showContour;for(r=0;r<3;++r)for(o=o||e.surfaceProject[r],n=0;n<3;++n)s=s||e.contourProject[r][n];for(r=0;r<3;++r){var l=C.projections[r];for(n=0;n<16;++n)l[n]=0;for(n=0;n<4;++n)l[5*n]=1;l[5*r]=0,l[12+r]=e.axesBounds[+(a[r]>0)][r],p(l,t.model,l);var c=C.clipBounds[r];for(i=0;i<2;++i)for(n=0;n<3;++n)c[i][n]=t.clipBounds[i][n];c[0][r]=-1e8,c[1][r]=1e8}return C.showSurface=o,C.showContour=s,C}var P={model:w,view:w,projection:w,inverseModel:w.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,objectOffset:[0,0,0],kambient:1,kdiffuse:1,kspecular:1,lightPosition:[1e3,1e3,1e3],eyePosition:[0,0,0],roughness:1,fresnel:1,opacity:1,vertexColor:0},I=w.slice(),O=[1,0,0,0,1,0,0,0,1];function z(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=P;n.model=t.model||w,n.view=t.view||w,n.projection=t.projection||w,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.objectOffset=this.objectOffset,n.contourColor=this.contourColor[0],n.inverseModel=d(n.inverseModel,n.model);for(var i=0;i<2;++i)for(var a=n.clipBounds[i],o=0;o<3;++o)a[o]=Math.min(Math.max(this.clipBounds[i][o],-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=O,n.vertexColor=this.vertexColor;var s=I;for(p(s,n.view,n.model),p(s,n.projection,s),d(s,s),i=0;i<3;++i)n.eyePosition[i]=s[12+i]/s[15];var l=s[15];for(i=0;i<3;++i)l+=this.lightPosition[i]*s[4*i+3];for(i=0;i<3;++i){var c=s[12+i];for(o=0;o<3;++o)c+=s[4*o+i]*this.lightPosition[o];n.lightPosition[i]=c/l}var u=L(n,this);if(u.showSurface){for(this._shader.bind(),this._shader.uniforms=n,this._vao.bind(),this.showSurface&&this._vertexCount&&this._vao.draw(r.TRIANGLES,this._vertexCount),i=0;i<3;++i)this.surfaceProject[i]&&this.vertexCount&&(this._shader.uniforms.model=u.projections[i],this._shader.uniforms.clipBounds=u.clipBounds[i],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(u.showContour){var f=this._contourShader;n.kambient=1,n.kdiffuse=0,n.kspecular=0,n.opacity=1,f.bind(),f.uniforms=n;var h=this._contourVAO;for(h.bind(),i=0;i<3;++i)for(f.uniforms.permutation=M[i],r.lineWidth(this.contourWidth[i]*this.pixelRatio),o=0;o<this.contourLevels[i].length;++o)o===this.highlightLevel[i]?(f.uniforms.contourColor=this.highlightColor[i],f.uniforms.contourTint=this.highlightTint[i]):0!==o&&o-1!==this.highlightLevel[i]||(f.uniforms.contourColor=this.contourColor[i],f.uniforms.contourTint=this.contourTint[i]),this._contourCounts[i][o]&&(f.uniforms.height=this.contourLevels[i][o],h.draw(r.LINES,this._contourCounts[i][o],this._contourOffsets[i][o]));for(i=0;i<3;++i)for(f.uniforms.model=u.projections[i],f.uniforms.clipBounds=u.clipBounds[i],o=0;o<3;++o)if(this.contourProject[i][o]){f.uniforms.permutation=M[o],r.lineWidth(this.contourWidth[o]*this.pixelRatio);for(var m=0;m<this.contourLevels[o].length;++m)m===this.highlightLevel[o]?(f.uniforms.contourColor=this.highlightColor[o],f.uniforms.contourTint=this.highlightTint[o]):0!==m&&m-1!==this.highlightLevel[o]||(f.uniforms.contourColor=this.contourColor[o],f.uniforms.contourTint=this.contourTint[o]),this._contourCounts[o][m]&&(f.uniforms.height=this.contourLevels[o][m],h.draw(r.LINES,this._contourCounts[o][m],this._contourOffsets[o][m]))}for(h.unbind(),(h=this._dynamicVAO).bind(),i=0;i<3;++i)if(0!==this._dynamicCounts[i])for(f.uniforms.model=n.model,f.uniforms.clipBounds=n.clipBounds,f.uniforms.permutation=M[i],r.lineWidth(this.dynamicWidth[i]*this.pixelRatio),f.uniforms.contourColor=this.dynamicColor[i],f.uniforms.contourTint=this.dynamicTint[i],f.uniforms.height=this.dynamicLevel[i],h.draw(r.LINES,this._dynamicCounts[i],this._dynamicOffsets[i]),o=0;o<3;++o)this.contourProject[o][i]&&(f.uniforms.model=u.projections[o],f.uniforms.clipBounds=u.clipBounds[o],h.draw(r.LINES,this._dynamicCounts[i],this._dynamicOffsets[i]));h.unbind()}}S.draw=function(t){return z.call(this,t,!1)},S.drawTransparent=function(t){return z.call(this,t,!0)};var D={model:w,view:w,projection:w,inverseModel:w,clipBounds:[[0,0,0],[0,0,0]],height:0,shape:[0,0],pickId:0,lowerBound:[0,0,0],upperBound:[0,0,0],zOffset:0,objectOffset:[0,0,0],permutation:[1,0,0,0,1,0,0,0,1],lightPosition:[0,0,0],eyePosition:[0,0,0]};function N(t,e){return Array.isArray(t)?[e(t[0]),e(t[1]),e(t[2])]:[e(t),e(t),e(t)]}function R(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 F(t){if(Array.isArray(t)){if(Array.isArray(t))return[R(t[0]),R(t[1]),R(t[2])];var e=R(t);return[e.slice(),e.slice(),e.slice()]}}S.drawPick=function(t){t=t||{};var e=this.gl;e.disable(e.CULL_FACE);var r=D;r.model=t.model||w,r.view=t.view||w,r.projection=t.projection||w,r.shape=this._field[2].shape,r.pickId=this.pickId/255,r.lowerBound=this.bounds[0],r.upperBound=this.bounds[1],r.objectOffset=this.objectOffset,r.permutation=O;for(var n=0;n<2;++n)for(var i=r.clipBounds[n],a=0;a<3;++a)i[a]=Math.min(Math.max(this.clipBounds[n][a],-1e8),1e8);var o=L(r,this);if(o.showSurface){for(this._pickShader.bind(),this._pickShader.uniforms=r,this._vao.bind(),this._vao.draw(e.TRIANGLES,this._vertexCount),n=0;n<3;++n)this.surfaceProject[n]&&(this._pickShader.uniforms.model=o.projections[n],this._pickShader.uniforms.clipBounds=o.clipBounds[n],this._vao.draw(e.TRIANGLES,this._vertexCount));this._vao.unbind()}if(o.showContour){var s=this._contourPickShader;s.bind(),s.uniforms=r;var l=this._contourVAO;for(l.bind(),a=0;a<3;++a)for(e.lineWidth(this.contourWidth[a]*this.pixelRatio),s.uniforms.permutation=M[a],n=0;n<this.contourLevels[a].length;++n)this._contourCounts[a][n]&&(s.uniforms.height=this.contourLevels[a][n],l.draw(e.LINES,this._contourCounts[a][n],this._contourOffsets[a][n]));for(n=0;n<3;++n)for(s.uniforms.model=o.projections[n],s.uniforms.clipBounds=o.clipBounds[n],a=0;a<3;++a)if(this.contourProject[n][a]){s.uniforms.permutation=M[a],e.lineWidth(this.contourWidth[a]*this.pixelRatio);for(var c=0;c<this.contourLevels[a].length;++c)this._contourCounts[a][c]&&(s.uniforms.height=this.contourLevels[a][c],l.draw(e.LINES,this._contourCounts[a][c],this._contourOffsets[a][c]))}l.unbind()}},S.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),a=n-i,o=e[1]*(t.value[1]+(15&t.value[2])/16)/255,s=Math.floor(o),l=o-s;i+=1,s+=1;var c=r.position;c[0]=c[1]=c[2]=0;for(var u=0;u<2;++u)for(var f=u?a:1-a,h=0;h<2;++h)for(var p=i+u,d=s+h,g=f*(h?l:1-l),v=0;v<3;++v)c[v]+=this._field[v].get(p,d)*g;for(var y=this._pickResult.level,x=0;x<3;++x)if(y[x]=m.le(this.contourLevels[x],c[x]),y[x]<0)this.contourLevels[x].length>0&&(y[x]=0);else if(y[x]<this.contourLevels[x].length-1){var b=this.contourLevels[x][y[x]],_=this.contourLevels[x][y[x]+1];Math.abs(b-c[x])>Math.abs(_-c[x])&&(y[x]+=1)}for(r.index[0]=a<.5?i:i+1,r.index[1]=l<.5?s:s+1,r.uv[0]=n/e[0],r.uv[1]=o/e[1],v=0;v<3;++v)r.dataCoordinate[v]=this._field[v].get(r.index[0],r.index[1]);return r},S.padField=function(t,e){var r=e.shape.slice(),n=t.shape.slice();c.assign(t.lo(1,1).hi(r[0],r[1]),e),c.assign(t.lo(1).hi(r[0],1),e.hi(r[0],1)),c.assign(t.lo(1,n[1]-1).hi(r[0],1),e.lo(0,r[1]-1).hi(r[0],1)),c.assign(t.lo(0,1).hi(1,r[1]),e.hi(1)),c.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))},S.update=function(t){t=t||{},this.objectOffset=t.objectOffset||this.objectOffset,this.dirty=!0,"contourWidth"in t&&(this.contourWidth=N(t.contourWidth,Number)),"showContour"in t&&(this.showContour=N(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=N(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=F(t.contourColor)),"contourProject"in t&&(this.contourProject=N(t.contourProject,(function(t){return N(t,Boolean)}))),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=F(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=N(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=N(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"opacityscale"in t&&(this.opacityscale=t.opacityscale),"colorBounds"in t&&(this.colorBounds=t.colorBounds),"vertexColor"in t&&(this.vertexColor=t.vertexColor?1:0),"colormap"in t&&this._colorMap.setPixels(this.genColormap(t.colormap,this.opacityscale));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 i=(e.shape[0]+2)*(e.shape[1]+2);i>this._field[2].data.length&&(s.freeFloat(this._field[2].data),this._field[2].data=s.mallocFloat(n.nextPow2(i))),this._field[2]=f(this._field[2].data,[e.shape[0]+2,e.shape[1]+2]),this.padField(this._field[2],e),this.shape=e.shape.slice();for(var a=this.shape,o=0;o<2;++o)this._field[2].size>this._field[o].data.length&&(s.freeFloat(this._field[o].data),this._field[o].data=s.mallocFloat(this._field[2].size)),this._field[o]=f(this._field[o].data,[a[0]+2,a[1]+2]);if(t.coords){var l=t.coords;if(!Array.isArray(l)||3!==l.length)throw new Error("gl-surface: invalid coordinates for x/y");for(o=0;o<2;++o){var c=l[o];for(v=0;v<2;++v)if(c.shape[v]!==a[v])throw new Error("gl-surface: coords have incorrect shape");this.padField(this._field[o],c)}}else if(t.ticks){var u=t.ticks;if(!Array.isArray(u)||2!==u.length)throw new Error("gl-surface: invalid ticks");for(o=0;o<2;++o){var p=u[o];if((Array.isArray(p)||p.length)&&(p=f(p)),p.shape[0]!==a[o])throw new Error("gl-surface: invalid tick length");var d=f(p.data,a);d.stride[o]=p.stride[0],d.stride[1^o]=0,this.padField(this._field[o],d)}}else{for(o=0;o<2;++o){var m=[0,0];m[o]=1,this._field[o]=f(this._field[o].data,[a[0]+2,a[1]+2],m,0)}this._field[0].set(0,0,0);for(var v=0;v<a[0];++v)this._field[0].set(v+1,0,v);for(this._field[0].set(a[0]+1,0,a[0]-1),this._field[1].set(0,0,0),v=0;v<a[1];++v)this._field[1].set(0,v+1,v);this._field[1].set(0,a[1]+1,a[1]-1)}var y=this._field,x=f(s.mallocFloat(3*y[2].size*2),[3,a[0]+2,a[1]+2,2]);for(o=0;o<3;++o)g(x.pick(o),y[o],"mirror");var b=f(s.mallocFloat(3*y[2].size),[a[0]+2,a[1]+2,3]);for(o=0;o<a[0]+2;++o)for(v=0;v<a[1]+2;++v){var _=x.get(0,o,v,0),w=x.get(0,o,v,1),M=x.get(1,o,v,0),k=x.get(1,o,v,1),A=x.get(2,o,v,0),S=x.get(2,o,v,1),E=M*S-k*A,C=A*w-S*_,L=_*k-w*M,P=Math.sqrt(E*E+C*C+L*L);P<1e-8?(P=Math.max(Math.abs(E),Math.abs(C),Math.abs(L)))<1e-8?(L=1,C=E=0,P=1):P=1/P:P=1/Math.sqrt(P),b.set(o,v,0,E*P),b.set(o,v,1,C*P),b.set(o,v,2,L*P)}s.free(x.data);var I=[1/0,1/0,1/0],O=[-1/0,-1/0,-1/0],z=1/0,D=-1/0,R=(a[0]-1)*(a[1]-1)*6,B=s.mallocFloat(n.nextPow2(10*R)),j=0,U=0;for(o=0;o<a[0]-1;++o)t:for(v=0;v<a[1]-1;++v){for(var V=0;V<2;++V)for(var q=0;q<2;++q)for(var H=0;H<3;++H){var G=this._field[H].get(1+o+V,1+v+q);if(isNaN(G)||!isFinite(G))continue t}for(H=0;H<6;++H){var Y=o+T[H][0],W=v+T[H][1],Z=this._field[0].get(Y+1,W+1),X=this._field[1].get(Y+1,W+1);G=this._field[2].get(Y+1,W+1),E=b.get(Y+1,W+1,0),C=b.get(Y+1,W+1,1),L=b.get(Y+1,W+1,2),t.intensity&&(J=t.intensity.get(Y,W));var J=t.intensity?t.intensity.get(Y,W):G+this.objectOffset[2];B[j++]=Y,B[j++]=W,B[j++]=Z,B[j++]=X,B[j++]=G,B[j++]=0,B[j++]=J,B[j++]=E,B[j++]=C,B[j++]=L,I[0]=Math.min(I[0],Z+this.objectOffset[0]),I[1]=Math.min(I[1],X+this.objectOffset[1]),I[2]=Math.min(I[2],G+this.objectOffset[2]),z=Math.min(z,J),O[0]=Math.max(O[0],Z+this.objectOffset[0]),O[1]=Math.max(O[1],X+this.objectOffset[1]),O[2]=Math.max(O[2],G+this.objectOffset[2]),D=Math.max(D,J),U+=1}}for(t.intensityBounds&&(z=+t.intensityBounds[0],D=+t.intensityBounds[1]),o=6;o<j;o+=10)B[o]=(B[o]-z)/(D-z);this._vertexCount=U,this._coordinateBuffer.update(B.subarray(0,j)),s.freeFloat(B),s.free(b.data),this.bounds=[I,O],this.intensity=t.intensity||this._field[2],this.intensityBounds[0]===z&&this.intensityBounds[1]===D||(r=!0),this.intensityBounds=[z,D]}if("levels"in t){var K=t.levels;for(K=Array.isArray(K[0])?K.slice():[[],[],K],o=0;o<3;++o)K[o]=K[o].slice(),K[o].sort((function(t,e){return t-e}));for(o=0;o<3;++o)for(v=0;v<K[o].length;++v)K[o][v]-=this.objectOffset[o];t:for(o=0;o<3;++o){if(K[o].length!==this.contourLevels[o].length){r=!0;break}for(v=0;v<K[o].length;++v)if(K[o][v]!==this.contourLevels[o][v]){r=!0;break t}}this.contourLevels=K}if(r){y=this._field,a=this.shape;for(var $=[],Q=0;Q<3;++Q){var tt=this.contourLevels[Q],et=[],rt=[],nt=[0,0,0];for(o=0;o<tt.length;++o){var it=h(this._field[Q],tt[o]);et.push($.length/5|0),U=0;t:for(v=0;v<it.cells.length;++v){var at=it.cells[v];for(H=0;H<2;++H){var ot=it.positions[at[H]],st=ot[0],lt=0|Math.floor(st),ct=st-lt,ut=ot[1],ft=0|Math.floor(ut),ht=ut-ft,pt=!1;e:for(var dt=0;dt<3;++dt){nt[dt]=0;var mt=(Q+dt+1)%3;for(V=0;V<2;++V){var gt=V?ct:1-ct;for(Y=0|Math.min(Math.max(lt+V,0),a[0]),q=0;q<2;++q){var vt=q?ht:1-ht;if(W=0|Math.min(Math.max(ft+q,0),a[1]),G=dt<2?this._field[mt].get(Y,W):(this.intensity.get(Y,W)-this.intensityBounds[0])/(this.intensityBounds[1]-this.intensityBounds[0]),!isFinite(G)||isNaN(G)){pt=!0;break e}var yt=gt*vt;nt[dt]+=yt*G}}}if(pt){if(H>0){for(var xt=0;xt<5;++xt)$.pop();U-=1}continue t}$.push(nt[0],nt[1],ot[0],ot[1],nt[2]),U+=1}}rt.push(U)}this._contourOffsets[Q]=et,this._contourCounts[Q]=rt}var bt=s.mallocFloat($.length);for(o=0;o<$.length;++o)bt[o]=$[o];this._contourBuffer.update(bt),s.freeFloat(bt)}},S.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;t<3;++t)s.freeFloat(this._field[t].data)},S.highlight=function(t){var e,r;if(!t)return this._dynamicCounts=[0,0,0],this.dyanamicLevel=[NaN,NaN,NaN],void(this.highlightLevel=[-1,-1,-1]);for(e=0;e<3;++e)this.enableHighlight[e]?this.highlightLevel[e]=t.level[e]:this.highlightLevel[e]=-1;for(r=this.snapToData?t.dataCoordinate:t.position,e=0;e<3;++e)r[e]-=this.objectOffset[e];if(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,a=s.mallocFloat(12*i[0]*i[1]),o=0;o<3;++o)if(this.enableDynamic[o]){this.dynamicLevel[o]=r[o];var l=(o+1)%3,c=(o+2)%3,u=this._field[o],f=this._field[l],p=this._field[c],d=h(u,r[o]),m=d.cells,g=d.positions;for(this._dynamicOffsets[o]=n,e=0;e<m.length;++e)for(var v=m[e],y=0;y<2;++y){var x=g[v[y]],b=+x[0],_=0|b,w=0|Math.min(_+1,i[0]),T=b-_,M=1-T,k=+x[1],A=0|k,S=0|Math.min(A+1,i[1]),E=k-A,C=1-E,L=M*C,P=M*E,I=T*C,O=T*E,z=L*f.get(_,A)+P*f.get(_,S)+I*f.get(w,A)+O*f.get(w,S),D=L*p.get(_,A)+P*p.get(_,S)+I*p.get(w,A)+O*p.get(w,S);if(isNaN(z)||isNaN(D)){y&&(n-=1);break}a[2*n+0]=z,a[2*n+1]=D,n+=1}this._dynamicCounts[o]=n-this._dynamicOffsets[o]}else this.dynamicLevel[o]=NaN,this._dynamicCounts[o]=0;this._dynamicBuffer.update(a.subarray(0,2*n)),s.freeFloat(a)}}},{"./lib/shaders":310,"binary-search-bounds":64,"bit-twiddle":65,colormap:98,"gl-buffer":231,"gl-mat4/invert":262,"gl-mat4/multiply":264,"gl-texture2d":313,"gl-vao":318,ndarray:630,"ndarray-gradient":623,"ndarray-ops":625,"ndarray-pack":626,"surface-nets":1505,"typedarray-pool":1531}],312:[function(t,e,r){"use strict";var n=t("css-font"),i=t("pick-by-alias"),a=t("regl"),o=t("gl-util/context"),s=t("es6-weak-map"),l=t("color-normalize"),c=t("font-atlas"),u=t("typedarray-pool"),f=t("parse-rect"),h=t("is-plain-obj"),p=t("parse-unit"),d=t("to-px"),m=t("detect-kerning"),g=t("object-assign"),v=t("font-measure"),y=t("flatten-vertex-data"),x=t("bit-twiddle").nextPow2,b=new s,_=!1;if(document.body){var w=document.body.appendChild(document.createElement("div"));w.style.font="italic small-caps bold condensed 16px/2 cursive",getComputedStyle(w).fontStretch&&(_=!0),document.body.removeChild(w)}var T=function(t){!function(t){return"function"==typeof t&&t._gl&&t.prop&&t.texture&&t.buffer}(t)?this.gl=o(t):(t={regl:t},this.gl=t.regl._gl),this.shader=b.get(this.gl),this.shader?this.regl=this.shader.regl:this.regl=t.regl||a({gl:this.gl}),this.charBuffer=this.regl.buffer({type:"uint8",usage:"stream"}),this.sizeBuffer=this.regl.buffer({type:"float",usage:"stream"}),this.shader||(this.shader=this.createShader(),b.set(this.gl,this.shader)),this.batch=[],this.fontSize=[],this.font=[],this.fontAtlas=[],this.draw=this.shader.draw.bind(this),this.render=function(){this.regl._refresh(),this.draw(this.batch)},this.canvas=this.gl.canvas,this.update(h(t)?t:{})};T.prototype.createShader=function(){var t=this.regl,e=t({blend:{enable:!0,color:[0,0,0,1],func:{srcRGB:"src alpha",dstRGB:"one minus src alpha",srcAlpha:"one minus dst alpha",dstAlpha:"one"}},stencil:{enable:!1},depth:{enable:!1},count:t.prop("count"),offset:t.prop("offset"),attributes:{charOffset:{offset:4,stride:8,buffer:t.this("sizeBuffer")},width:{offset:0,stride:8,buffer:t.this("sizeBuffer")},char:t.this("charBuffer"),position:t.this("position")},uniforms:{atlasSize:function(t,e){return[e.atlas.width,e.atlas.height]},atlasDim:function(t,e){return[e.atlas.cols,e.atlas.rows]},atlas:function(t,e){return e.atlas.texture},charStep:function(t,e){return e.atlas.step},em:function(t,e){return e.atlas.em},color:t.prop("color"),opacity:t.prop("opacity"),viewport:t.this("viewportArray"),scale:t.this("scale"),align:t.prop("align"),baseline:t.prop("baseline"),translate:t.this("translate"),positionOffset:t.prop("positionOffset")},primitive:"points",viewport:t.this("viewport"),vert:"\n\t\t\tprecision highp float;\n\t\t\tattribute float width, charOffset, char;\n\t\t\tattribute vec2 position;\n\t\t\tuniform float fontSize, charStep, em, align, baseline;\n\t\t\tuniform vec4 viewport;\n\t\t\tuniform vec4 color;\n\t\t\tuniform vec2 atlasSize, atlasDim, scale, translate, positionOffset;\n\t\t\tvarying vec2 charCoord, charId;\n\t\t\tvarying float charWidth;\n\t\t\tvarying vec4 fontColor;\n\t\t\tvoid main () {\n\t\t\t\t"+(T.normalViewport?"":"vec2 positionOffset = vec2(positionOffset.x,- positionOffset.y);")+"\n\n\t\t\t\tvec2 offset = floor(em * (vec2(align + charOffset, baseline)\n\t\t\t\t\t+ positionOffset))\n\t\t\t\t\t/ (viewport.zw * scale.xy);\n\n\t\t\t\tvec2 position = (position + translate) * scale;\n\t\t\t\tposition += offset * scale;\n\n\t\t\t\t"+(T.normalViewport?"position.y = 1. - position.y;":"")+"\n\n\t\t\t\tcharCoord = position * viewport.zw + viewport.xy;\n\n\t\t\t\tgl_Position = vec4(position * 2. - 1., 0, 1);\n\n\t\t\t\tgl_PointSize = charStep;\n\n\t\t\t\tcharId.x = mod(char, atlasDim.x);\n\t\t\t\tcharId.y = floor(char / atlasDim.x);\n\n\t\t\t\tcharWidth = width * em;\n\n\t\t\t\tfontColor = color / 255.;\n\t\t\t}",frag:"\n\t\t\tprecision highp float;\n\t\t\tuniform sampler2D atlas;\n\t\t\tuniform float fontSize, charStep, opacity;\n\t\t\tuniform vec2 atlasSize;\n\t\t\tuniform vec4 viewport;\n\t\t\tvarying vec4 fontColor;\n\t\t\tvarying vec2 charCoord, charId;\n\t\t\tvarying float charWidth;\n\n\t\t\tfloat lightness(vec4 color) {\n\t\t\t\treturn color.r * 0.299 + color.g * 0.587 + color.b * 0.114;\n\t\t\t}\n\n\t\t\tvoid main () {\n\t\t\t\tvec2 uv = gl_FragCoord.xy - charCoord + charStep * .5;\n\t\t\t\tfloat halfCharStep = floor(charStep * .5 + .5);\n\n\t\t\t\t// invert y and shift by 1px (FF expecially needs that)\n\t\t\t\tuv.y = charStep - uv.y;\n\n\t\t\t\t// ignore points outside of character bounding box\n\t\t\t\tfloat halfCharWidth = ceil(charWidth * .5);\n\t\t\t\tif (floor(uv.x) > halfCharStep + halfCharWidth ||\n\t\t\t\t\tfloor(uv.x) < halfCharStep - halfCharWidth) return;\n\n\t\t\t\tuv += charId * charStep;\n\t\t\t\tuv = uv / atlasSize;\n\n\t\t\t\tvec4 color = fontColor;\n\t\t\t\tvec4 mask = texture2D(atlas, uv);\n\n\t\t\t\tfloat maskY = lightness(mask);\n\t\t\t\t// float colorY = lightness(color);\n\t\t\t\tcolor.a *= maskY;\n\t\t\t\tcolor.a *= opacity;\n\n\t\t\t\t// color.a += .1;\n\n\t\t\t\t// antialiasing, see yiq color space y-channel formula\n\t\t\t\t// color.rgb += (1. - color.rgb) * (1. - mask.rgb);\n\n\t\t\t\tgl_FragColor = color;\n\t\t\t}"});return{regl:t,draw:e,atlas:{}}},T.prototype.update=function(t){var e=this;if("string"==typeof t)t={text:t};else if(!t)return;null!=(t=i(t,{position:"position positions coord coords coordinates",font:"font fontFace fontface typeface cssFont css-font family fontFamily",fontSize:"fontSize fontsize size font-size",text:"text texts chars characters value values symbols",align:"align alignment textAlign textbaseline",baseline:"baseline textBaseline textbaseline",direction:"dir direction textDirection",color:"color colour fill fill-color fillColor textColor textcolor",kerning:"kerning kern",range:"range dataBox",viewport:"vp viewport viewBox viewbox viewPort",opacity:"opacity alpha transparency visible visibility opaque",offset:"offset positionOffset padding shift indent indentation"},!0)).opacity&&(Array.isArray(t.opacity)?this.opacity=t.opacity.map((function(t){return parseFloat(t)})):this.opacity=parseFloat(t.opacity)),null!=t.viewport&&(this.viewport=f(t.viewport),T.normalViewport&&(this.viewport.y=this.canvas.height-this.viewport.y-this.viewport.height),this.viewportArray=[this.viewport.x,this.viewport.y,this.viewport.width,this.viewport.height]),null==this.viewport&&(this.viewport={x:0,y:0,width:this.gl.drawingBufferWidth,height:this.gl.drawingBufferHeight},this.viewportArray=[this.viewport.x,this.viewport.y,this.viewport.width,this.viewport.height]),null!=t.kerning&&(this.kerning=t.kerning),null!=t.offset&&("number"==typeof t.offset&&(t.offset=[t.offset,0]),this.positionOffset=y(t.offset)),t.direction&&(this.direction=t.direction),t.range&&(this.range=t.range,this.scale=[1/(t.range[2]-t.range[0]),1/(t.range[3]-t.range[1])],this.translate=[-t.range[0],-t.range[1]]),t.scale&&(this.scale=t.scale),t.translate&&(this.translate=t.translate),this.scale||(this.scale=[1/this.viewport.width,1/this.viewport.height]),this.translate||(this.translate=[0,0]),this.font.length||t.font||(t.font=T.baseFontSize+"px sans-serif");var r,a=!1,o=!1;if(t.font&&(Array.isArray(t.font)?t.font:[t.font]).forEach((function(t,r){if("string"==typeof t)try{t=n.parse(t)}catch(e){t=n.parse(T.baseFontSize+"px "+t)}else t=n.parse(n.stringify(t));var i=n.stringify({size:T.baseFontSize,family:t.family,stretch:_?t.stretch:void 0,variant:t.variant,weight:t.weight,style:t.style}),s=p(t.size),l=Math.round(s[0]*d(s[1]));if(l!==e.fontSize[r]&&(o=!0,e.fontSize[r]=l),!(e.font[r]&&i==e.font[r].baseString||(a=!0,e.font[r]=T.fonts[i],e.font[r]))){var c=t.family.join(", "),u=[t.style];t.style!=t.variant&&u.push(t.variant),t.variant!=t.weight&&u.push(t.weight),_&&t.weight!=t.stretch&&u.push(t.stretch),e.font[r]={baseString:i,family:c,weight:t.weight,stretch:t.stretch,style:t.style,variant:t.variant,width:{},kerning:{},metrics:v(c,{origin:"top",fontSize:T.baseFontSize,fontStyle:u.join(" ")})},T.fonts[i]=e.font[r]}})),(a||o)&&this.font.forEach((function(r,i){var a=n.stringify({size:e.fontSize[i],family:r.family,stretch:_?r.stretch:void 0,variant:r.variant,weight:r.weight,style:r.style});if(e.fontAtlas[i]=e.shader.atlas[a],!e.fontAtlas[i]){var o=r.metrics;e.shader.atlas[a]=e.fontAtlas[i]={fontString:a,step:2*Math.ceil(e.fontSize[i]*o.bottom*.5),em:e.fontSize[i],cols:0,rows:0,height:0,width:0,chars:[],ids:{},texture:e.regl.texture()}}null==t.text&&(t.text=e.text)})),"string"==typeof t.text&&t.position&&t.position.length>2){for(var s=Array(.5*t.position.length),h=0;h<s.length;h++)s[h]=t.text;t.text=s}if(null!=t.text||a){if(this.textOffsets=[0],Array.isArray(t.text)){this.count=t.text[0].length,this.counts=[this.count];for(var b=1;b<t.text.length;b++)this.textOffsets[b]=this.textOffsets[b-1]+t.text[b-1].length,this.count+=t.text[b].length,this.counts.push(t.text[b].length);this.text=t.text.join("")}else this.text=t.text,this.count=this.text.length,this.counts=[this.count];r=[],this.font.forEach((function(t,n){T.atlasContext.font=t.baseString;for(var i=e.fontAtlas[n],a=0;a<e.text.length;a++){var o=e.text.charAt(a);if(null==i.ids[o]&&(i.ids[o]=i.chars.length,i.chars.push(o),r.push(o)),null==t.width[o]&&(t.width[o]=T.atlasContext.measureText(o).width/T.baseFontSize,e.kerning)){var s=[];for(var l in t.width)s.push(l+o,o+l);g(t.kerning,m(t.family,{pairs:s}))}}}))}if(t.position)if(t.position.length>2){for(var w=!t.position[0].length,M=u.mallocFloat(2*this.count),k=0,A=0;k<this.counts.length;k++){var S=this.counts[k];if(w)for(var E=0;E<S;E++)M[A++]=t.position[2*k],M[A++]=t.position[2*k+1];else for(var C=0;C<S;C++)M[A++]=t.position[k][0],M[A++]=t.position[k][1]}this.position.call?this.position({type:"float",data:M}):this.position=this.regl.buffer({type:"float",data:M}),u.freeFloat(M)}else this.position.destroy&&this.position.destroy(),this.position={constant:t.position};if(t.text||a){var L=u.mallocUint8(this.count),P=u.mallocFloat(2*this.count);this.textWidth=[];for(var I=0,O=0;I<this.counts.length;I++){for(var z=this.counts[I],D=this.font[I]||this.font[0],N=this.fontAtlas[I]||this.fontAtlas[0],R=0;R<z;R++){var F=this.text.charAt(O),B=this.text.charAt(O-1);if(L[O]=N.ids[F],P[2*O]=D.width[F],R){var j=P[2*O-2],U=P[2*O],V=P[2*O-1]+.5*j+.5*U;if(this.kerning){var q=D.kerning[B+F];q&&(V+=.001*q)}P[2*O+1]=V}else P[2*O+1]=.5*P[2*O];O++}this.textWidth.push(P.length?.5*P[2*O-2]+P[2*O-1]:0)}t.align||(t.align=this.align),this.charBuffer({data:L,type:"uint8",usage:"stream"}),this.sizeBuffer({data:P,type:"float",usage:"stream"}),u.freeUint8(L),u.freeFloat(P),r.length&&this.font.forEach((function(t,r){var n=e.fontAtlas[r],i=n.step,a=Math.floor(T.maxAtlasSize/i),o=Math.min(a,n.chars.length),s=Math.ceil(n.chars.length/o),l=x(o*i),u=x(s*i);n.width=l,n.height=u,n.rows=s,n.cols=o,n.em&&n.texture({data:c({canvas:T.atlasCanvas,font:n.fontString,chars:n.chars,shape:[l,u],step:[i,i]})})}))}if(t.align&&(this.align=t.align,this.alignOffset=this.textWidth.map((function(t,r){var n=Array.isArray(e.align)?e.align.length>1?e.align[r]:e.align[0]:e.align;if("number"==typeof n)return n;switch(n){case"right":case"end":return-t;case"center":case"centre":case"middle":return.5*-t}return 0}))),null==this.baseline&&null==t.baseline&&(t.baseline=0),null!=t.baseline&&(this.baseline=t.baseline,Array.isArray(this.baseline)||(this.baseline=[this.baseline]),this.baselineOffset=this.baseline.map((function(t,r){var n=(e.font[r]||e.font[0]).metrics,i=0;return i+=.5*n.bottom,i+="number"==typeof t?t-n.baseline:-n[t],T.normalViewport||(i*=-1),i}))),null!=t.color)if(t.color||(t.color="transparent"),"string"!=typeof t.color&&isNaN(t.color)){var H;if("number"==typeof t.color[0]&&t.color.length>this.counts.length){var G=t.color.length;H=u.mallocUint8(G);for(var Y=(t.color.subarray||t.color.slice).bind(t.color),W=0;W<G;W+=4)H.set(l(Y(W,W+4),"uint8"),W)}else{var Z=t.color.length;H=u.mallocUint8(4*Z);for(var X=0;X<Z;X++)H.set(l(t.color[X]||0,"uint8"),4*X)}this.color=H}else this.color=l(t.color,"uint8");if(t.position||t.text||t.color||t.baseline||t.align||t.font||t.offset||t.opacity)if(this.color.length>4||this.baselineOffset.length>1||this.align&&this.align.length>1||this.fontAtlas.length>1||this.positionOffset.length>2){var J=Math.max(.5*this.position.length||0,.25*this.color.length||0,this.baselineOffset.length||0,this.alignOffset.length||0,this.font.length||0,this.opacity.length||0,.5*this.positionOffset.length||0);this.batch=Array(J);for(var K=0;K<this.batch.length;K++)this.batch[K]={count:this.counts.length>1?this.counts[K]:this.counts[0],offset:this.textOffsets.length>1?this.textOffsets[K]:this.textOffsets[0],color:this.color?this.color.length<=4?this.color:this.color.subarray(4*K,4*K+4):[0,0,0,255],opacity:Array.isArray(this.opacity)?this.opacity[K]:this.opacity,baseline:null!=this.baselineOffset[K]?this.baselineOffset[K]:this.baselineOffset[0],align:this.align?null!=this.alignOffset[K]?this.alignOffset[K]:this.alignOffset[0]:0,atlas:this.fontAtlas[K]||this.fontAtlas[0],positionOffset:this.positionOffset.length>2?this.positionOffset.subarray(2*K,2*K+2):this.positionOffset}}else this.count?this.batch=[{count:this.count,offset:0,color:this.color||[0,0,0,255],opacity:Array.isArray(this.opacity)?this.opacity[0]:this.opacity,baseline:this.baselineOffset[0],align:this.alignOffset?this.alignOffset[0]:0,atlas:this.fontAtlas[0],positionOffset:this.positionOffset}]:this.batch=[]},T.prototype.destroy=function(){},T.prototype.kerning=!0,T.prototype.position={constant:new Float32Array(2)},T.prototype.translate=null,T.prototype.scale=null,T.prototype.font=null,T.prototype.text="",T.prototype.positionOffset=[0,0],T.prototype.opacity=1,T.prototype.color=new Uint8Array([0,0,0,255]),T.prototype.alignOffset=[0,0],T.normalViewport=!1,T.maxAtlasSize=1024,T.atlasCanvas=document.createElement("canvas"),T.atlasContext=T.atlasCanvas.getContext("2d",{alpha:!1}),T.baseFontSize=64,T.fonts={},e.exports=T},{"bit-twiddle":65,"color-normalize":92,"css-font":113,"detect-kerning":142,"es6-weak-map":204,"flatten-vertex-data":217,"font-atlas":218,"font-measure":219,"gl-util/context":314,"is-plain-obj":429,"object-assign":634,"parse-rect":639,"parse-unit":641,"pick-by-alias":646,regl:1477,"to-px":1513,"typedarray-pool":1531}],313:[function(t,e,r){"use strict";var n=t("ndarray"),i=t("ndarray-ops"),a=t("typedarray-pool");e.exports=function(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");o||c(t);if("number"==typeof arguments[1])return v(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return v(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],r=u(e)?e:e.raw;if(r)return y(t,r,0|e.width,0|e.height,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return x(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")};var o=null,s=null,l=null;function c(t){o=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],s=[t.NEAREST,t.LINEAR,t.NEAREST_MIPMAP_NEAREST,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_LINEAR],l=[t.REPEAT,t.CLAMP_TO_EDGE,t.MIRRORED_REPEAT]}function u(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement||"undefined"!=typeof ImageData&&t instanceof ImageData}var f=function(t,e){i.muls(t,e,255)};function h(t,e,r){var n=t.gl,i=n.getParameter(n.MAX_TEXTURE_SIZE);if(e<0||e>i||r<0||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 p(t,e,r,n,i,a){this.gl=t,this.handle=e,this.format=i,this.type=a,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 o=this,s=[this._wrapS,this._wrapT];Object.defineProperties(s,[{get:function(){return o._wrapS},set:function(t){return o.wrapS=t}},{get:function(){return o._wrapT},set:function(t){return o.wrapT=t}}]),this._wrapVector=s;var l=[this._shape[0],this._shape[1]];Object.defineProperties(l,[{get:function(){return o._shape[0]},set:function(t){return o.width=t}},{get:function(){return o._shape[1]},set:function(t){return o.height=t}}]),this._shapeVector=l}var d=p.prototype;function m(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 g(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 v(t,e,r,n,i){var a=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>a||r<0||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 o=g(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new p(t,o,e,r,n,i)}function y(t,e,r,n,i,a){var o=g(t);return t.texImage2D(t.TEXTURE_2D,0,i,i,a,e),new p(t,o,r,n,i,a)}function x(t,e){var r=e.dtype,o=e.shape.slice(),s=t.getParameter(t.MAX_TEXTURE_SIZE);if(o[0]<0||o[0]>s||o[1]<0||o[1]>s)throw new Error("gl-texture2d: Invalid texture size");var l=m(o,e.stride.slice()),c=0;"float32"===r?c=t.FLOAT:"float64"===r?(c=t.FLOAT,l=!1,r="float32"):"uint8"===r?c=t.UNSIGNED_BYTE:(c=t.UNSIGNED_BYTE,l=!1,r="uint8");var u,h,d=0;if(2===o.length)d=t.LUMINANCE,o=[o[0],o[1],1],e=n(e.data,o,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==o.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===o[2])d=t.ALPHA;else if(2===o[2])d=t.LUMINANCE_ALPHA;else if(3===o[2])d=t.RGB;else{if(4!==o[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");d=t.RGBA}}c!==t.FLOAT||t.getExtension("OES_texture_float")||(c=t.UNSIGNED_BYTE,l=!1);var v=e.size;if(l)u=0===e.offset&&e.data.length===v?e.data:e.data.subarray(e.offset,e.offset+v);else{var y=[o[2],o[2]*o[0],1];h=a.malloc(v,r);var x=n(h,o,y,0);"float32"!==r&&"float64"!==r||c!==t.UNSIGNED_BYTE?i.assign(x,e):f(x,e),u=h.subarray(0,v)}var b=g(t);return t.texImage2D(t.TEXTURE_2D,0,d,o[0],o[1],0,d,c,u),l||a.free(h),new p(t,b,o[0],o[1],d,c)}Object.defineProperties(d,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&o.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),s.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&&o.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),s.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=this.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(),l.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(),l.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;e<2;++e)if(l.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 h(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return h(this,t|=0,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,h(this,this._shape[0],t),t}}}),d.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},d.dispose=function(){this.gl.deleteTexture(this.handle)},d.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)},d.setPixels=function(t,e,r,o){var s=this.gl;this.bind(),Array.isArray(e)?(o=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),o=o||0;var l=u(t)?t:t.raw;if(l){this._mipLevels.indexOf(o)<0?(s.texImage2D(s.TEXTURE_2D,0,this.format,this.format,this.type,l),this._mipLevels.push(o)):s.texSubImage2D(s.TEXTURE_2D,o,e,r,this.format,this.type,l)}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]>>>o||r+t.shape[0]>this._shape[0]>>>o||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");!function(t,e,r,o,s,l,c,u){var h=u.dtype,p=u.shape.slice();if(p.length<2||p.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var d=0,g=0,v=m(p,u.stride.slice());"float32"===h?d=t.FLOAT:"float64"===h?(d=t.FLOAT,v=!1,h="float32"):"uint8"===h?d=t.UNSIGNED_BYTE:(d=t.UNSIGNED_BYTE,v=!1,h="uint8");if(2===p.length)g=t.LUMINANCE,p=[p[0],p[1],1],u=n(u.data,p,[u.stride[0],u.stride[1],1],u.offset);else{if(3!==p.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===p[2])g=t.ALPHA;else if(2===p[2])g=t.LUMINANCE_ALPHA;else if(3===p[2])g=t.RGB;else{if(4!==p[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");g=t.RGBA}p[2]}g!==t.LUMINANCE&&g!==t.ALPHA||s!==t.LUMINANCE&&s!==t.ALPHA||(g=s);if(g!==s)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=u.size,x=c.indexOf(o)<0;x&&c.push(o);if(d===l&&v)0===u.offset&&u.data.length===y?x?t.texImage2D(t.TEXTURE_2D,o,s,p[0],p[1],0,s,l,u.data):t.texSubImage2D(t.TEXTURE_2D,o,e,r,p[0],p[1],s,l,u.data):x?t.texImage2D(t.TEXTURE_2D,o,s,p[0],p[1],0,s,l,u.data.subarray(u.offset,u.offset+y)):t.texSubImage2D(t.TEXTURE_2D,o,e,r,p[0],p[1],s,l,u.data.subarray(u.offset,u.offset+y));else{var b;b=l===t.FLOAT?a.mallocFloat32(y):a.mallocUint8(y);var _=n(b,p,[p[2],p[2]*p[0],1]);d===t.FLOAT&&l===t.UNSIGNED_BYTE?f(_,u):i.assign(_,u),x?t.texImage2D(t.TEXTURE_2D,o,s,p[0],p[1],0,s,l,b.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,o,e,r,p[0],p[1],s,l,b.subarray(0,y)),l===t.FLOAT?a.freeFloat32(b):a.freeUint8(b)}}(s,e,r,o,this.format,this.type,this._mipLevels,t)}}},{ndarray:630,"ndarray-ops":625,"typedarray-pool":1531}],314:[function(t,e,r){(function(r){(function(){"use strict";var n=t("pick-by-alias");function i(t){if(t.container)if(t.container==document.body)document.body.style.width||(t.canvas.width=t.width||t.pixelRatio*r.innerWidth),document.body.style.height||(t.canvas.height=t.height||t.pixelRatio*r.innerHeight);else{var e=t.container.getBoundingClientRect();t.canvas.width=t.width||e.right-e.left,t.canvas.height=t.height||e.bottom-e.top}}function a(t){return"function"==typeof t.getContext&&"width"in t&&"height"in t}function o(){var t=document.createElement("canvas");return t.style.position="absolute",t.style.top=0,t.style.left=0,t}e.exports=function(t){var e;if(t?"string"==typeof t&&(t={container:t}):t={},a(t)?t={container:t}:t="string"==typeof(e=t).nodeName&&"function"==typeof e.appendChild&&"function"==typeof e.getBoundingClientRect?{container:t}:function(t){return"function"==typeof t.drawArrays||"function"==typeof t.drawElements}(t)?{gl:t}:n(t,{container:"container target element el canvas holder parent parentNode wrapper use ref root node",gl:"gl context webgl glContext",attrs:"attributes attrs contextAttributes",pixelRatio:"pixelRatio pxRatio px ratio pxratio pixelratio",width:"w width",height:"h height"},!0),t.pixelRatio||(t.pixelRatio=r.pixelRatio||1),t.gl)return t.gl;if(t.canvas&&(t.container=t.canvas.parentNode),t.container){if("string"==typeof t.container){var s=document.querySelector(t.container);if(!s)throw Error("Element "+t.container+" is not found");t.container=s}a(t.container)?(t.canvas=t.container,t.container=t.canvas.parentNode):t.canvas||(t.canvas=o(),t.container.appendChild(t.canvas),i(t))}else if(!t.canvas){if("undefined"==typeof document)throw Error("Not DOM environment. Use headless-gl.");t.container=document.body||document.documentElement,t.canvas=o(),t.container.appendChild(t.canvas),i(t)}return t.gl||["webgl","experimental-webgl","webgl-experimental"].some((function(e){try{t.gl=t.canvas.getContext(e,t.attrs)}catch(t){}return t.gl})),t.gl}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"pick-by-alias":646}],315:[function(t,e,r){"use strict";e.exports=function(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 a=r[i];if(a.buffer){var o=a.buffer,s=a.size||4,l=a.type||t.FLOAT,c=!!a.normalized,u=a.stride||0,f=a.offset||0;o.bind(),t.enableVertexAttribArray(i),t.vertexAttribPointer(i,s,l,c,u,f)}else{if("number"==typeof a)t.vertexAttrib1f(i,a);else if(1===a.length)t.vertexAttrib1f(i,a[0]);else if(2===a.length)t.vertexAttrib2f(i,a[0],a[1]);else if(3===a.length)t.vertexAttrib3f(i,a[0],a[1],a[2]);else{if(4!==a.length)throw new Error("gl-vao: Invalid vertex attribute");t.vertexAttrib4f(i,a[0],a[1],a[2],a[3])}t.disableVertexAttribArray(i)}}for(;i<n;++i)t.disableVertexAttribArray(i)}else{t.bindBuffer(t.ARRAY_BUFFER,null);for(i=0;i<n;++i)t.disableVertexAttribArray(i)}}},{}],316:[function(t,e,r){"use strict";var n=t("./do-bind.js");function i(t){this.gl=t,this._elements=null,this._attributes=null,this._elementsType=t.UNSIGNED_SHORT}i.prototype.bind=function(){n(this.gl,this._elements,this._attributes)},i.prototype.update=function(t,e,r){this._elements=e,this._attributes=t,this._elementsType=r||this.gl.UNSIGNED_SHORT},i.prototype.dispose=function(){},i.prototype.unbind=function(){},i.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=function(t){return new i(t)}},{"./do-bind.js":315}],317:[function(t,e,r){"use strict";var n=t("./do-bind.js");function i(t,e,r,n,i,a){this.location=t,this.dimension=e,this.a=r,this.b=n,this.c=i,this.d=a}function a(t,e,r){this.gl=t,this._ext=e,this.handle=r,this._attribs=[],this._useElements=!1,this._elementsType=t.UNSIGNED_SHORT}i.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)}},a.prototype.bind=function(){this._ext.bindVertexArrayOES(this.handle);for(var t=0;t<this._attribs.length;++t)this._attribs[t].bind(this.gl)},a.prototype.unbind=function(){this._ext.bindVertexArrayOES(null)},a.prototype.dispose=function(){this._ext.deleteVertexArrayOES(this.handle)},a.prototype.update=function(t,e,r){if(this.bind(),n(this.gl,e,t),this.unbind(),this._attribs.length=0,t)for(var a=0;a<t.length;++a){var o=t[a];"number"==typeof o?this._attribs.push(new i(a,1,o)):Array.isArray(o)&&this._attribs.push(new i(a,o.length,o[0],o[1],o[2],o[3]))}this._useElements=!!e,this._elementsType=r||this.gl.UNSIGNED_SHORT},a.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=function(t,e){return new a(t,e,e.createVertexArrayOES())}},{"./do-bind.js":315}],318:[function(t,e,r){"use strict";var n=t("./lib/vao-native.js"),i=t("./lib/vao-emulated.js");function a(t){this.bindVertexArrayOES=t.bindVertexArray.bind(t),this.createVertexArrayOES=t.createVertexArray.bind(t),this.deleteVertexArrayOES=t.deleteVertexArray.bind(t)}e.exports=function(t,e,r,o){var s,l=t.createVertexArray?new a(t):t.getExtension("OES_vertex_array_object");return(s=l?n(t,l):i(t)).update(e,r,o),s}},{"./lib/vao-emulated.js":316,"./lib/vao-native.js":317}],319:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}},{}],320:[function(t,e,r){e.exports=function(t,e){var r=n(t[0],t[1],t[2]),o=n(e[0],e[1],e[2]);i(r,r),i(o,o);var s=a(r,o);return s>1?0:Math.acos(s)};var n=t("./fromValues"),i=t("./normalize"),a=t("./dot")},{"./dot":330,"./fromValues":336,"./normalize":347}],321:[function(t,e,r){e.exports=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t}},{}],322:[function(t,e,r){e.exports=function(t){var e=new Float32Array(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}},{}],323:[function(t,e,r){e.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}},{}],324:[function(t,e,r){e.exports=function(){var t=new Float32Array(3);return t[0]=0,t[1]=0,t[2]=0,t}},{}],325:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2];return t[0]=i*l-a*s,t[1]=a*o-n*l,t[2]=n*s-i*o,t}},{}],326:[function(t,e,r){e.exports=t("./distance")},{"./distance":327}],327:[function(t,e,r){e.exports=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(r*r+n*n+i*i)}},{}],328:[function(t,e,r){e.exports=t("./divide")},{"./divide":329}],329:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t}},{}],330:[function(t,e,r){e.exports=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}},{}],331:[function(t,e,r){e.exports=1e-6},{}],332:[function(t,e,r){e.exports=function(t,e){var r=t[0],i=t[1],a=t[2],o=e[0],s=e[1],l=e[2];return Math.abs(r-o)<=n*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-s)<=n*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(a-l)<=n*Math.max(1,Math.abs(a),Math.abs(l))};var n=t("./epsilon")},{"./epsilon":331}],333:[function(t,e,r){e.exports=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}},{}],334:[function(t,e,r){e.exports=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t}},{}],335:[function(t,e,r){e.exports=function(t,e,r,i,a,o){var s,l;e||(e=3);r||(r=0);l=i?Math.min(i*e+r,t.length):t.length;for(s=r;s<l;s+=e)n[0]=t[s],n[1]=t[s+1],n[2]=t[s+2],a(n,n,o),t[s]=n[0],t[s+1]=n[1],t[s+2]=n[2];return t};var n=t("./create")()},{"./create":324}],336:[function(t,e,r){e.exports=function(t,e,r){var n=new Float32Array(3);return n[0]=t,n[1]=e,n[2]=r,n}},{}],337:[function(t,e,r){e.exports={EPSILON:t("./epsilon"),create:t("./create"),clone:t("./clone"),angle:t("./angle"),fromValues:t("./fromValues"),copy:t("./copy"),set:t("./set"),equals:t("./equals"),exactEquals:t("./exactEquals"),add:t("./add"),subtract:t("./subtract"),sub:t("./sub"),multiply:t("./multiply"),mul:t("./mul"),divide:t("./divide"),div:t("./div"),min:t("./min"),max:t("./max"),floor:t("./floor"),ceil:t("./ceil"),round:t("./round"),scale:t("./scale"),scaleAndAdd:t("./scaleAndAdd"),distance:t("./distance"),dist:t("./dist"),squaredDistance:t("./squaredDistance"),sqrDist:t("./sqrDist"),length:t("./length"),len:t("./len"),squaredLength:t("./squaredLength"),sqrLen:t("./sqrLen"),negate:t("./negate"),inverse:t("./inverse"),normalize:t("./normalize"),dot:t("./dot"),cross:t("./cross"),lerp:t("./lerp"),random:t("./random"),transformMat4:t("./transformMat4"),transformMat3:t("./transformMat3"),transformQuat:t("./transformQuat"),rotateX:t("./rotateX"),rotateY:t("./rotateY"),rotateZ:t("./rotateZ"),forEach:t("./forEach")}},{"./add":319,"./angle":320,"./ceil":321,"./clone":322,"./copy":323,"./create":324,"./cross":325,"./dist":326,"./distance":327,"./div":328,"./divide":329,"./dot":330,"./epsilon":331,"./equals":332,"./exactEquals":333,"./floor":334,"./forEach":335,"./fromValues":336,"./inverse":338,"./len":339,"./length":340,"./lerp":341,"./max":342,"./min":343,"./mul":344,"./multiply":345,"./negate":346,"./normalize":347,"./random":348,"./rotateX":349,"./rotateY":350,"./rotateZ":351,"./round":352,"./scale":353,"./scaleAndAdd":354,"./set":355,"./sqrDist":356,"./sqrLen":357,"./squaredDistance":358,"./squaredLength":359,"./sub":360,"./subtract":361,"./transformMat3":362,"./transformMat4":363,"./transformQuat":364}],338:[function(t,e,r){e.exports=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}},{}],339:[function(t,e,r){e.exports=t("./length")},{"./length":340}],340:[function(t,e,r){e.exports=function(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}},{}],341:[function(t,e,r){e.exports=function(t,e,r,n){var i=e[0],a=e[1],o=e[2];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t[2]=o+n*(r[2]-o),t}},{}],342:[function(t,e,r){e.exports=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}},{}],343:[function(t,e,r){e.exports=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}},{}],344:[function(t,e,r){e.exports=t("./multiply")},{"./multiply":345}],345:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}},{}],346:[function(t,e,r){e.exports=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}},{}],347:[function(t,e,r){e.exports=function(t,e){var r=e[0],n=e[1],i=e[2],a=r*r+n*n+i*i;a>0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a);return t}},{}],348:[function(t,e,r){e.exports=function(t,e){e=e||1;var r=2*Math.random()*Math.PI,n=2*Math.random()-1,i=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(r)*i,t[1]=Math.sin(r)*i,t[2]=n*e,t}},{}],349:[function(t,e,r){e.exports=function(t,e,r,n){var i=r[1],a=r[2],o=e[1]-i,s=e[2]-a,l=Math.sin(n),c=Math.cos(n);return t[0]=e[0],t[1]=i+o*c-s*l,t[2]=a+o*l+s*c,t}},{}],350:[function(t,e,r){e.exports=function(t,e,r,n){var i=r[0],a=r[2],o=e[0]-i,s=e[2]-a,l=Math.sin(n),c=Math.cos(n);return t[0]=i+s*l+o*c,t[1]=e[1],t[2]=a+s*c-o*l,t}},{}],351:[function(t,e,r){e.exports=function(t,e,r,n){var i=r[0],a=r[1],o=e[0]-i,s=e[1]-a,l=Math.sin(n),c=Math.cos(n);return t[0]=i+o*c-s*l,t[1]=a+o*l+s*c,t[2]=e[2],t}},{}],352:[function(t,e,r){e.exports=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t}},{}],353:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}},{}],354:[function(t,e,r){e.exports=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}},{}],355:[function(t,e,r){e.exports=function(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}},{}],356:[function(t,e,r){e.exports=t("./squaredDistance")},{"./squaredDistance":358}],357:[function(t,e,r){e.exports=t("./squaredLength")},{"./squaredLength":359}],358:[function(t,e,r){e.exports=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return r*r+n*n+i*i}},{}],359:[function(t,e,r){e.exports=function(t){var e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n}},{}],360:[function(t,e,r){e.exports=t("./subtract")},{"./subtract":361}],361:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}},{}],362:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2];return t[0]=n*r[0]+i*r[3]+a*r[6],t[1]=n*r[1]+i*r[4]+a*r[7],t[2]=n*r[2]+i*r[5]+a*r[8],t}},{}],363:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return o=o||1,t[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o,t[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,t[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,t}},{}],364:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2],c=r[3],u=c*n+s*a-l*i,f=c*i+l*n-o*a,h=c*a+o*i-s*n,p=-o*n-s*i-l*a;return t[0]=u*c+p*-o+f*-l-h*-s,t[1]=f*c+p*-s+h*-o-u*-l,t[2]=h*c+p*-l+u*-s-f*-o,t}},{}],365:[function(t,e,r){e.exports=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}},{}],366:[function(t,e,r){e.exports=function(t){var e=new Float32Array(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}},{}],367:[function(t,e,r){e.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}},{}],368:[function(t,e,r){e.exports=function(){var t=new Float32Array(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}},{}],369:[function(t,e,r){e.exports=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return Math.sqrt(r*r+n*n+i*i+a*a)}},{}],370:[function(t,e,r){e.exports=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}},{}],371:[function(t,e,r){e.exports=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}},{}],372:[function(t,e,r){e.exports=function(t,e,r,n){var i=new Float32Array(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}},{}],373:[function(t,e,r){e.exports={create:t("./create"),clone:t("./clone"),fromValues:t("./fromValues"),copy:t("./copy"),set:t("./set"),add:t("./add"),subtract:t("./subtract"),multiply:t("./multiply"),divide:t("./divide"),min:t("./min"),max:t("./max"),scale:t("./scale"),scaleAndAdd:t("./scaleAndAdd"),distance:t("./distance"),squaredDistance:t("./squaredDistance"),length:t("./length"),squaredLength:t("./squaredLength"),negate:t("./negate"),inverse:t("./inverse"),normalize:t("./normalize"),dot:t("./dot"),lerp:t("./lerp"),random:t("./random"),transformMat4:t("./transformMat4"),transformQuat:t("./transformQuat")}},{"./add":365,"./clone":366,"./copy":367,"./create":368,"./distance":369,"./divide":370,"./dot":371,"./fromValues":372,"./inverse":374,"./length":375,"./lerp":376,"./max":377,"./min":378,"./multiply":379,"./negate":380,"./normalize":381,"./random":382,"./scale":383,"./scaleAndAdd":384,"./set":385,"./squaredDistance":386,"./squaredLength":387,"./subtract":388,"./transformMat4":389,"./transformQuat":390}],374:[function(t,e,r){e.exports=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}},{}],375:[function(t,e,r){e.exports=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)}},{}],376:[function(t,e,r){e.exports=function(t,e,r,n){var i=e[0],a=e[1],o=e[2],s=e[3];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t[2]=o+n*(r[2]-o),t[3]=s+n*(r[3]-s),t}},{}],377:[function(t,e,r){e.exports=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}},{}],378:[function(t,e,r){e.exports=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}},{}],379:[function(t,e,r){e.exports=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}},{}],380:[function(t,e,r){e.exports=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}},{}],381:[function(t,e,r){e.exports=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r*r+n*n+i*i+a*a;o>0&&(o=1/Math.sqrt(o),t[0]=r*o,t[1]=n*o,t[2]=i*o,t[3]=a*o);return t}},{}],382:[function(t,e,r){var n=t("./normalize"),i=t("./scale");e.exports=function(t,e){return e=e||1,t[0]=Math.random(),t[1]=Math.random(),t[2]=Math.random(),t[3]=Math.random(),n(t,t),i(t,t,e),t}},{"./normalize":381,"./scale":383}],383:[function(t,e,r){e.exports=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}},{}],384:[function(t,e,r){e.exports=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}},{}],385:[function(t,e,r){e.exports=function(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}},{}],386:[function(t,e,r){e.exports=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return r*r+n*n+i*i+a*a}},{}],387:[function(t,e,r){e.exports=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}},{}],388:[function(t,e,r){e.exports=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}},{}],389:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,t[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,t[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,t[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,t}},{}],390:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2],c=r[3],u=c*n+s*a-l*i,f=c*i+l*n-o*a,h=c*a+o*i-s*n,p=-o*n-s*i-l*a;return t[0]=u*c+p*-o+f*-l-h*-s,t[1]=f*c+p*-s+h*-o-u*-l,t[2]=h*c+p*-l+u*-s-f*-o,t[3]=e[3],t}},{}],391:[function(t,e,r){var n=t("glsl-tokenizer"),i=t("atob-lite");e.exports=function(t){for(var e=Array.isArray(t)?t:n(t),r=0;r<e.length;r++){var a=e[r];if("preprocessor"===a.type){var o=a.data.match(/\#define\s+SHADER_NAME(_B64)?\s+(.+)$/);if(o&&o[2]){var s=o[1],l=o[2];return(s?i(l):l).trim()}}}}},{"atob-lite":45,"glsl-tokenizer":398}],392:[function(t,e,r){e.exports=function(t){var e,r,c,u=0,f=0,h=999,p=[],d=[],m=1,g=0,v=0,y=!1,x=!1,b="",_=a,w=n;"300 es"===(t=t||{}).version&&(_=s,w=o);var T={},M={};for(u=0;u<_.length;u++)T[_[u]]=!0;for(u=0;u<w.length;u++)M[w[u]]=!0;return function(t){return d=[],null!==t?function(t){u=0,t.toString&&(t=t.toString());var r;b+=t.replace(/\r\n/g,"\n"),c=b.length;for(;e=b[u],u<c;){switch(r=u,h){case 0:u=C();break;case 1:case 2:u=E();break;case 3:u=L();break;case 4:u=O();break;case 11:u=I();break;case 5:u=z();break;case 9999:u=D();break;case 9:u=S();break;case 999:u=A()}if(r!==u)switch(b[r]){case"\n":g=0,++m;break;default:++g}}return f+=u,b=b.slice(u),d}(t):function(t){p.length&&k(p.join(""));return h=10,k("(eof)"),d}()};function k(t){t.length&&d.push({type:l[h],data:t,position:v,line:m,column:g})}function A(){return p=p.length?[]:p,"/"===r&&"*"===e?(v=f+u-1,h=0,r=e,u+1):"/"===r&&"/"===e?(v=f+u-1,h=1,r=e,u+1):"#"===e?(h=2,v=f+u,u):/\s/.test(e)?(h=9,v=f+u,u):(y=/\d/.test(e),x=/[^\w_]/.test(e),v=f+u,h=y?4:x?3:9999,u)}function S(){return/[^\s]/g.test(e)?(k(p.join("")),h=999,u):(p.push(e),r=e,u+1)}function E(){return"\r"!==e&&"\n"!==e||"\\"===r?(p.push(e),r=e,u+1):(k(p.join("")),h=999,u)}function C(){return"/"===e&&"*"===r?(p.push(e),k(p.join("")),h=999,u+1):(p.push(e),r=e,u+1)}function L(){if("."===r&&/\d/.test(e))return h=5,u;if("/"===r&&"*"===e)return h=0,u;if("/"===r&&"/"===e)return h=1,u;if("."===e&&p.length){for(;P(p););return h=5,u}if(";"===e||")"===e||"("===e){if(p.length)for(;P(p););return k(e),h=999,u+1}var t=2===p.length&&"="!==e;if(/[\w_\d\s]/.test(e)||t){for(;P(p););return h=999,u}return p.push(e),r=e,u+1}function P(t){for(var e,r,n=0;;){if(e=i.indexOf(t.slice(0,t.length+n).join("")),r=i[e],-1===e){if(n--+t.length>0)continue;r=t.slice(0,1).join("")}return k(r),v+=r.length,(p=p.slice(r.length)).length}}function I(){return/[^a-fA-F0-9]/.test(e)?(k(p.join("")),h=999,u):(p.push(e),r=e,u+1)}function O(){return"."===e||/[eE]/.test(e)?(p.push(e),h=5,r=e,u+1):"x"===e&&1===p.length&&"0"===p[0]?(h=11,p.push(e),r=e,u+1):/[^\d]/.test(e)?(k(p.join("")),h=999,u):(p.push(e),r=e,u+1)}function z(){return"f"===e&&(p.push(e),r=e,u+=1),/[eE]/.test(e)?(p.push(e),r=e,u+1):("-"!==e&&"+"!==e||!/[eE]/.test(r))&&/[^\d]/.test(e)?(k(p.join("")),h=999,u):(p.push(e),r=e,u+1)}function D(){if(/[^\d\w_]/.test(e)){var t=p.join("");return h=M[t]?8:T[t]?7:6,k(p.join("")),h=999,u}return p.push(e),r=e,u+1}};var n=t("./lib/literals"),i=t("./lib/operators"),a=t("./lib/builtins"),o=t("./lib/literals-300es"),s=t("./lib/builtins-300es"),l=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":394,"./lib/builtins-300es":393,"./lib/literals":396,"./lib/literals-300es":395,"./lib/operators":397}],393:[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":394}],394:[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"]},{}],395:[function(t,e,r){var n=t("./literals");e.exports=n.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"])},{"./literals":396}],396:[function(t,e,r){e.exports=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","uint","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"]},{}],397:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],398:[function(t,e,r){var n=t("./index");e.exports=function(t,e){var r=n(e),i=[];return i=(i=i.concat(r(t))).concat(r(null))}},{"./index":392}],399:[function(t,e,r){e.exports=function(t){"string"==typeof t&&(t=[t]);for(var e=[].slice.call(arguments,1),r=[],n=0;n<t.length-1;n++)r.push(t[n],e[n]||"");return r.push(t[n]),r.join("")}},{}],400:[function(t,e,r){(function(r){(function(){"use strict";var n,i=t("is-browser");n="function"==typeof r.matchMedia?!r.matchMedia("(hover: none)").matches:i,e.exports=n}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"is-browser":424}],401:[function(t,e,r){"use strict";var n=t("is-browser");e.exports=n&&function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(e){t=!1}return t}()},{"is-browser":424}],402:[function(t,e,r){
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
r.read=function(t,e,r,n,i){var a,o,s=8*i-n-1,l=(1<<s)-1,c=l>>1,u=-7,f=r?i-1:0,h=r?-1:1,p=t[e+f];for(f+=h,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=256*a+t[e+f],f+=h,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=n;u>0;o=256*o+t[e+f],f+=h,u-=8);if(0===a)a=1-c;else{if(a===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),a-=c}return(p?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,c=8*a-i-1,u=(1<<c)-1,f=u>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,d=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+f>=1?h/l:h*Math.pow(2,1-f))*l>=2&&(o++,l/=2),o+f>=u?(s=0,o=u):o+f>=1?(s=(e*l-1)*Math.pow(2,i),o+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;t[r+p]=255&s,p+=d,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;t[r+p]=255&o,p+=d,o/=256,c-=8);t[r+p-d]|=128*m}},{}],403:[function(t,e,r){"use strict";var n=t("./types");e.exports=function(t,e){var r;for(r in n)if(n[r].detect(t,e))return r}},{"./types":406}],404:[function(t,e,r){(function(r){(function(){"use strict";var n=t("fs"),i=t("path"),a=t("./types"),o=t("./detector");function s(t,e){var r=o(t,e);if(r in a){var n=a[r].calculate(t,e);if(!1!==n)return n.type=r,n}throw new TypeError("unsupported file type: "+r+" (file: "+e+")")}e.exports=function(t,e){if(r.isBuffer(t))return s(t);if("string"!=typeof t)throw new TypeError("invalid invocation");var a=i.resolve(t);if("function"!=typeof e)return s(function(t){var e=n.openSync(t,"r"),i=n.fstatSync(e).size,a=Math.min(i,524288),o=r.alloc(a);return n.readSync(e,o,0,a,0),n.closeSync(e),o}(a),a);!function(t,e){n.open(t,"r",(function(i,a){if(i)return e(i);n.fstat(a,(function(i,o){if(i)return e(i);var s=o.size;if(s<=0)return e(new Error("File size is not greater than 0 \u2014\u2014 "+t));var l=Math.min(s,524288),c=r.alloc(l);n.read(a,c,0,l,0,(function(t){if(t)return e(t);n.close(a,(function(t){e(t,c)}))}))}))}))}(a,(function(t,r){if(t)return e(t);var n;try{n=s(r,a)}catch(e){t=e}e(t,n)}))},e.exports.types=Object.keys(a)}).call(this)}).call(this,t("buffer").Buffer)},{"./detector":403,"./types":406,buffer:78,fs:77,path:642}],405:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){return r=r||0,t["readUInt"+e+(n?"BE":"LE")].call(t,r)}},{}],406:[function(t,e,r){"use strict";var n={bmp:t("./types/bmp"),cur:t("./types/cur"),dds:t("./types/dds"),gif:t("./types/gif"),icns:t("./types/icns"),ico:t("./types/ico"),jpg:t("./types/jpg"),png:t("./types/png"),psd:t("./types/psd"),svg:t("./types/svg"),tiff:t("./types/tiff"),webp:t("./types/webp")};e.exports=n},{"./types/bmp":407,"./types/cur":408,"./types/dds":409,"./types/gif":410,"./types/icns":411,"./types/ico":412,"./types/jpg":413,"./types/png":414,"./types/psd":415,"./types/svg":416,"./types/tiff":417,"./types/webp":418}],407:[function(t,e,r){"use strict";e.exports={detect:function(t){return"BM"===t.toString("ascii",0,2)},calculate:function(t){return{width:t.readUInt32LE(18),height:Math.abs(t.readInt32LE(22))}}}},{}],408:[function(t,e,r){"use strict";e.exports={detect:function(t){return 0===t.readUInt16LE(0)&&2===t.readUInt16LE(2)},calculate:t("./ico").calculate}},{"./ico":412}],409:[function(t,e,r){"use strict";e.exports={detect:function(t){return 542327876===t.readUInt32LE(0)},calculate:function(t){return{height:t.readUInt32LE(12),width:t.readUInt32LE(16)}}}},{}],410:[function(t,e,r){"use strict";var n=/^GIF8[79]a/;e.exports={detect:function(t){var e=t.toString("ascii",0,6);return n.test(e)},calculate:function(t){return{width:t.readUInt16LE(6),height:t.readUInt16LE(8)}}}},{}],411:[function(t,e,r){"use strict";var n={ICON:32,"ICN#":32,"icm#":16,icm4:16,icm8:16,"ics#":16,ics4:16,ics8:16,is32:16,s8mk:16,icp4:16,icl4:32,icl8:32,il32:32,l8mk:32,icp5:32,ic11:32,ich4:48,ich8:48,ih32:48,h8mk:48,icp6:64,ic12:32,it32:128,t8mk:128,ic07:128,ic08:256,ic13:256,ic09:512,ic14:512,ic10:1024};function i(t,e){var r=e+4;return[t.toString("ascii",e,r),t.readUInt32BE(r)]}function a(t){var e=n[t];return{width:e,height:e,type:t}}e.exports={detect:function(t){return"icns"===t.toString("ascii",0,4)},calculate:function(t){var e,r,n,o=t.length,s=8,l=t.readUInt32BE(4);if(r=a((e=i(t,s))[0]),(s+=e[1])===l)return r;for(n={width:r.width,height:r.height,images:[r]};s<l&&s<o;)r=a((e=i(t,s))[0]),s+=e[1],n.images.push(r);return n}}},{}],412:[function(t,e,r){"use strict";function n(t,e){var r=t.readUInt8(e);return 0===r?256:r}function i(t,e){var r=6+16*e;return{width:n(t,r),height:n(t,r+1)}}e.exports={detect:function(t){return 0===t.readUInt16LE(0)&&1===t.readUInt16LE(2)},calculate:function(t){var e,r=t.readUInt16LE(4),n=i(t,0);if(1===r)return n;for(n.images=[{width:n.width,height:n.height}],e=1;e<r;e+=1)n.images.push(i(t,e));return n}}},{}],413:[function(t,e,r){"use strict";var n=t("../readUInt");function i(t){return"45786966"===t.toString("hex",2,6)}function a(t,e){return{height:t.readUInt16BE(e),width:t.readUInt16BE(e+2)}}function o(t,e){var r=t.slice(2,e),i=r.toString("hex",6,8),a="4d4d"===i;if(a||"4949"===i)return function(t,e){for(var r,i,a=n(t,16,14,e),o=0;o<a;o++){if(i=(r=16+12*o)+12,r>t.length)return;var s=t.slice(r,i);if(274===n(s,16,0,e)){if(3!==n(s,16,2,e))return;if(1!==n(s,32,4,e))return;return n(s,16,8,e)}}}(r,a)}function s(t,e){if(e>t.length)throw new TypeError("Corrupt JPG, exceeded buffer limits");if(255!==t[e])throw new TypeError("Invalid JPG, marker table corrupted")}e.exports={detect:function(t){return"ffd8"===t.toString("hex",0,2)},calculate:function(t){var e,r,n;for(t=t.slice(4);t.length;){if(r=t.readUInt16BE(0),i(t)&&(e=o(t,r)),s(t,r),192===(n=t[r+1])||193===n||194===n){var l=a(t,r+5);return e?{width:l.width,height:l.height,orientation:e}:l}t=t.slice(r+2)}throw new TypeError("Invalid JPG, no size found")}}},{"../readUInt":405}],414:[function(t,e,r){"use strict";e.exports={detect:function(t){if("PNG\r\n\x1a\n"===t.toString("ascii",1,8)){var e=t.toString("ascii",12,16);if("CgBI"===e&&(e=t.toString("ascii",28,32)),"IHDR"!==e)throw new TypeError("invalid png");return!0}},calculate:function(t){return"CgBI"===t.toString("ascii",12,16)?{width:t.readUInt32BE(32),height:t.readUInt32BE(36)}:{width:t.readUInt32BE(16),height:t.readUInt32BE(20)}}}},{}],415:[function(t,e,r){"use strict";e.exports={detect:function(t){return"8BPS"===t.toString("ascii",0,4)},calculate:function(t){return{width:t.readUInt32BE(18),height:t.readUInt32BE(14)}}}},{}],416:[function(t,e,r){"use strict";var n=/<svg\s([^>"']|"[^"]*"|'[^']*')*>/;var i={root:n,width:/\swidth=(['"])([^%]+?)\1/,height:/\sheight=(['"])([^%]+?)\1/,viewbox:/\sviewBox=(['"])(.+?)\1/},a={cm:96/2.54,mm:96/2.54/10,m:96/2.54*100,pt:96/72,pc:96/72/12,em:16,ex:8};function o(t){var e=/([0-9.]+)([a-z]*)/.exec(t);if(e)return Math.round(parseFloat(e[1])*(a[e[2]]||1))}function s(t){var e=t.split(" ");return{width:o(e[2]),height:o(e[3])}}e.exports={detect:function(t){return n.test(t)},calculate:function(t){var e=t.toString("utf8").match(i.root);if(e){var r=function(t){var e=t.match(i.width),r=t.match(i.height),n=t.match(i.viewbox);return{width:e&&o(e[2]),height:r&&o(r[2]),viewbox:n&&s(n[2])}}(e[0]);if(r.width&&r.height)return function(t){return{width:t.width,height:t.height}}(r);if(r.viewbox)return function(t){var e=t.viewbox.width/t.viewbox.height;return t.width?{width:t.width,height:Math.floor(t.width/e)}:t.height?{width:Math.floor(t.height*e),height:t.height}:{width:t.viewbox.width,height:t.viewbox.height}}(r)}throw new TypeError("invalid svg")}}},{}],417:[function(t,e,r){(function(r){(function(){"use strict";var n=t("fs"),i=t("../readUInt");function a(t,e){var r=i(t,16,8,e);return(i(t,16,10,e)<<16)+r}function o(t){if(t.length>24)return t.slice(12)}e.exports={detect:function(t){var e=t.toString("hex",0,4);return"49492a00"===e||"4d4d002a"===e},calculate:function(t,e){if(!e)throw new TypeError("Tiff doesn't support buffer");var s="BE"===function(t){var e=t.toString("ascii",0,2);return"II"===e?"LE":"MM"===e?"BE":void 0}(t),l=function(t,e){for(var r,n,s,l={};t&&t.length&&(r=i(t,16,0,e),n=i(t,16,2,e),s=i(t,32,4,e),0!==r);)1!==s||3!==n&&4!==n||(l[r]=a(t,e)),t=o(t);return l}(function(t,e,a){var o=i(t,32,4,a),s=1024,l=n.statSync(e).size;o+s>l&&(s=l-o-10);var c=r.alloc(s),u=n.openSync(e,"r");return n.readSync(u,c,0,s,o),c.slice(2)}(t,e,s),s),c=l[256],u=l[257];if(!c||!u)throw new TypeError("Invalid Tiff, missing tags");return{width:c,height:u}}}}).call(this)}).call(this,t("buffer").Buffer)},{"../readUInt":405,buffer:78,fs:77}],418:[function(t,e,r){"use strict";e.exports={detect:function(t){var e="RIFF"===t.toString("ascii",0,4),r="WEBP"===t.toString("ascii",8,12),n="VP8"===t.toString("ascii",12,15);return e&&r&&n},calculate:function(t){var e=t.toString("ascii",12,16);if(t=t.slice(20,30),"VP8X"===e){var r=t[0];return!(!(0==(192&r))||!(0==(1&r)))&&function(t){return{width:1+t.readUIntLE(4,3),height:1+t.readUIntLE(7,3)}}(t)}if("VP8 "===e&&47!==t[0])return function(t){return{width:16383&t.readInt16LE(6),height:16383&t.readInt16LE(8)}}(t);var n=t.toString("hex",3,6);return"VP8L"===e&&"9d012a"!==n&&function(t){return{width:1+((63&t[2])<<8|t[1]),height:1+((15&t[4])<<10|t[3]<<2|(192&t[2])>>6)}}(t)}}},{}],419:[function(t,e,r){"use strict";e.exports=function(t,e){var r=t.length;if(0===r)throw new Error("Must have at least d+1 points");var i=t[0].length;if(r<=i)throw new Error("Must input at least d+1 points");var o=t.slice(0,i+1),s=n.apply(void 0,o);if(0===s)throw new Error("Input not in general position");for(var l=new Array(i+1),u=0;u<=i;++u)l[u]=u;s<0&&(l[0]=1,l[1]=0);var f=new a(l,new Array(i+1),!1),h=f.adjacent,p=new Array(i+2);for(u=0;u<=i;++u){for(var d=l.slice(),m=0;m<=i;++m)m===u&&(d[m]=-1);var g=d[0];d[0]=d[1],d[1]=g;var v=new a(d,new Array(i+1),!0);h[u]=v,p[u]=v}p[i+1]=f;for(u=0;u<=i;++u){d=h[u].vertices;var y=h[u].adjacent;for(m=0;m<=i;++m){var x=d[m];if(x<0)y[m]=f;else for(var b=0;b<=i;++b)h[b].vertices.indexOf(x)<0&&(y[m]=h[b])}}var _=new c(i,o,p),w=!!e;for(u=i+1;u<r;++u)_.insert(t[u],w);return _.boundary()};var n=t("robust-orientation"),i=t("simplicial-complex").compareCells;function a(t,e,r){this.vertices=t,this.adjacent=e,this.boundary=r,this.lastVisited=-1}function o(t,e,r){this.vertices=t,this.cell=e,this.index=r}function s(t,e){return i(t.vertices,e.vertices)}a.prototype.flip=function(){var t=this.vertices[0];this.vertices[0]=this.vertices[1],this.vertices[1]=t;var e=this.adjacent[0];this.adjacent[0]=this.adjacent[1],this.adjacent[1]=e};var l=[];function c(t,e,r){this.dimension=t,this.vertices=e,this.simplices=r,this.interior=r.filter((function(t){return!t.boundary})),this.tuple=new Array(t+1);for(var i=0;i<=t;++i)this.tuple[i]=this.vertices[i];var a=l[t];a||(a=l[t]=function(t){for(var e=["function orient(){var tuple=this.tuple;return test("],r=0;r<=t;++r)r>0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var i=new Function("test",e.join("")),a=n[t+1];return a||(a=n),i(a)}(t)),this.orient=a}var u=c.prototype;u.handleBoundaryDegeneracy=function(t,e){var r=this.dimension,n=this.vertices.length-1,i=this.tuple,a=this.vertices,o=[t];for(t.lastVisited=-n;o.length>0;){(t=o.pop()).vertices;for(var s=t.adjacent,l=0;l<=r;++l){var c=s[l];if(c.boundary&&!(c.lastVisited<=-n)){for(var u=c.vertices,f=0;f<=r;++f){var h=u[f];i[f]=h<0?e:a[h]}var p=this.orient();if(p>0)return c;c.lastVisited=-n,0===p&&o.push(c)}}}return null},u.walk=function(t,e){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,a=this.tuple,o=e?this.interior.length*Math.random()|0:this.interior.length-1,s=this.interior[o];t:for(;!s.boundary;){for(var l=s.vertices,c=s.adjacent,u=0;u<=n;++u)a[u]=i[l[u]];s.lastVisited=r;for(u=0;u<=n;++u){var f=c[u];if(!(f.lastVisited>=r)){var h=a[u];a[u]=t;var p=this.orient();if(a[u]=h,p<0){s=f;continue t}f.boundary?f.lastVisited=-r:f.lastVisited=r}}return}return s},u.addPeaks=function(t,e){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,l=this.tuple,c=this.interior,u=this.simplices,f=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,c.push(e);for(var h=[];f.length>0;){var p=(e=f.pop()).vertices,d=e.adjacent,m=p.indexOf(r);if(!(m<0))for(var g=0;g<=n;++g)if(g!==m){var v=d[g];if(v.boundary&&!(v.lastVisited>=r)){var y=v.vertices;if(v.lastVisited!==-r){for(var x=0,b=0;b<=n;++b)y[b]<0?(x=b,l[b]=t):l[b]=i[y[b]];if(this.orient()>0){y[x]=r,v.boundary=!1,c.push(v),f.push(v),v.lastVisited=r;continue}v.lastVisited=-r}var _=v.adjacent,w=p.slice(),T=d.slice(),M=new a(w,T,!0);u.push(M);var k=_.indexOf(e);if(!(k<0)){_[k]=M,T[m]=v,w[g]=-1,T[g]=e,d[g]=M,M.flip();for(b=0;b<=n;++b){var A=w[b];if(!(A<0||A===r)){for(var S=new Array(n-1),E=0,C=0;C<=n;++C){var L=w[C];L<0||C===b||(S[E++]=L)}h.push(new o(S,M,b))}}}}}}h.sort(s);for(g=0;g+1<h.length;g+=2){var P=h[g],I=h[g+1],O=P.index,z=I.index;O<0||z<0||(P.cell.adjacent[P.index]=I.cell,I.cell.adjacent[I.index]=P.cell)}},u.insert=function(t,e){var r=this.vertices;r.push(t);var n=this.walk(t,e);if(n){for(var i=this.dimension,a=this.tuple,o=0;o<=i;++o){var s=n.vertices[o];a[o]=s<0?t:r[s]}var l=this.orient(a);l<0||(0!==l||(n=this.handleBoundaryDegeneracy(n,t)))&&this.addPeaks(t,n)}},u.boundary=function(){for(var t=this.dimension,e=[],r=this.simplices,n=r.length,i=0;i<n;++i){var a=r[i];if(a.boundary){for(var o=new Array(t),s=a.vertices,l=0,c=0,u=0;u<=t;++u)s[u]>=0?o[l++]=s[u]:c=1&u;if(c===(1&t)){var f=o[0];o[0]=o[1],o[1]=f}e.push(o)}}return e}},{"robust-orientation":1485,"simplicial-complex":1494}],420:[function(t,e,r){"use strict";var n=t("binary-search-bounds");function i(t,e,r,n,i){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(e?e.count:0)+(r?r.count:0)+n.length}e.exports=function(t){if(!t||0===t.length)return new v(null);return new v(g(t))};var a=i.prototype;function o(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function s(t,e){var r=g(e);t.mid=r.mid,t.left=r.left,t.right=r.right,t.leftPoints=r.leftPoints,t.rightPoints=r.rightPoints,t.count=r.count}function l(t,e){var r=t.intervals([]);r.push(e),s(t,r)}function c(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?0:(r.splice(n,1),s(t,r),1)}function u(t,e,r){for(var n=0;n<t.length&&t[n][0]<=e;++n){var i=r(t[n]);if(i)return i}}function f(t,e,r){for(var n=t.length-1;n>=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function h(t,e){for(var r=0;r<t.length;++r){var n=e(t[r]);if(n)return n}}function p(t,e){return t-e}function d(t,e){var r=t[0]-e[0];return r||t[1]-e[1]}function m(t,e){var r=t[1]-e[1];return r||t[0]-e[0]}function g(t){if(0===t.length)return null;for(var e=[],r=0;r<t.length;++r)e.push(t[r][0],t[r][1]);e.sort(p);var n=e[e.length>>1],a=[],o=[],s=[];for(r=0;r<t.length;++r){var l=t[r];l[1]<n?a.push(l):n<l[0]?o.push(l):s.push(l)}var c=s,u=s.slice();return c.sort(d),u.sort(m),new i(n,g(a),g(o),c,u)}function v(t){this.root=t}a.intervals=function(t){return t.push.apply(t,this.leftPoints),this.left&&this.left.intervals(t),this.right&&this.right.intervals(t),t},a.insert=function(t){var e=this.count-this.leftPoints.length;if(this.count+=1,t[1]<this.mid)this.left?4*(this.left.count+1)>3*(e+1)?l(this,t):this.left.insert(t):this.left=g([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?l(this,t):this.right.insert(t):this.right=g([t]);else{var r=n.ge(this.leftPoints,t,d),i=n.ge(this.rightPoints,t,m);this.leftPoints.splice(r,0,t),this.rightPoints.splice(i,0,t)}},a.remove=function(t){var e=this.count-this.leftPoints;if(t[1]<this.mid)return this.left?4*(this.right?this.right.count:0)>3*(e-1)?c(this,t):2===(s=this.left.remove(t))?(this.left=null,this.count-=1,1):(1===s&&(this.count-=1),s):0;if(t[0]>this.mid)return this.right?4*(this.left?this.left.count:0)>3*(e-1)?c(this,t):2===(s=this.right.remove(t))?(this.right=null,this.count-=1,1):(1===s&&(this.count-=1),s):0;if(1===this.count)return this.leftPoints[0]===t?2:0;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var r=this,i=this.left;i.right;)r=i,i=i.right;if(r===this)i.right=this.right;else{var a=this.left,s=this.right;r.count-=i.count,r.right=i.left,i.left=a,i.right=s}o(this,i),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?o(this,this.left):o(this,this.right);return 1}for(a=n.ge(this.leftPoints,t,d);a<this.leftPoints.length&&this.leftPoints[a][0]===t[0];++a)if(this.leftPoints[a]===t){this.count-=1,this.leftPoints.splice(a,1);for(s=n.ge(this.rightPoints,t,m);s<this.rightPoints.length&&this.rightPoints[s][1]===t[1];++s)if(this.rightPoints[s]===t)return this.rightPoints.splice(s,1),1}return 0},a.queryPoint=function(t,e){if(t<this.mid){if(this.left)if(r=this.left.queryPoint(t,e))return r;return u(this.leftPoints,t,e)}if(t>this.mid){var r;if(this.right)if(r=this.right.queryPoint(t,e))return r;return f(this.rightPoints,t,e)}return h(this.leftPoints,e)},a.queryInterval=function(t,e,r){var n;if(t<this.mid&&this.left&&(n=this.left.queryInterval(t,e,r)))return n;if(e>this.mid&&this.right&&(n=this.right.queryInterval(t,e,r)))return n;return e<this.mid?u(this.leftPoints,e,r):t>this.mid?f(this.rightPoints,t,r):h(this.leftPoints,r)};var y=v.prototype;y.insert=function(t){this.root?this.root.insert(t):this.root=new i(t[0],null,null,[t],[t])},y.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),0!==e}return!1},y.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},y.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(y,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(y,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":421}],421:[function(t,e,r){arguments[4][216][0].apply(r,arguments)},{dup:216}],422:[function(t,e,r){"use strict";e.exports=function(t,e){e=e||new Array(t.length);for(var r=0;r<t.length;++r)e[t[r]]=r;return e}},{}],423:[function(t,e,r){"use strict";e.exports=function(t){for(var e=new Array(t),r=0;r<t;++r)e[r]=r;return e}},{}],424:[function(t,e,r){e.exports=!0},{}],425:[function(t,e,r){function n(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
e.exports=function(t){return null!=t&&(n(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},{}],426:[function(t,e,r){"use strict";e.exports="undefined"!=typeof navigator&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion))},{}],427:[function(t,e,r){"use strict";e.exports=a,e.exports.isMobile=a,e.exports.default=a;var n=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,i=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i;function a(t){t||(t={});var e=t.ua;if(e||"undefined"==typeof navigator||(e=navigator.userAgent),e&&e.headers&&"string"==typeof e.headers["user-agent"]&&(e=e.headers["user-agent"]),"string"!=typeof e)return!1;var r=t.tablet?i.test(e):n.test(e);return!r&&t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==e.indexOf("Macintosh")&&-1!==e.indexOf("Safari")&&(r=!0),r}},{}],428:[function(t,e,r){"use strict";e.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}},{}],429:[function(t,e,r){"use strict";var n=Object.prototype.toString;e.exports=function(t){var e;return"[object Object]"===n.call(t)&&(null===(e=Object.getPrototypeOf(t))||e===Object.getPrototypeOf({}))}},{}],430:[function(t,e,r){"use strict";e.exports=function(t){for(var e,r=t.length,n=0;n<r;n++)if(((e=t.charCodeAt(n))<9||e>13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(e<8192||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}},{}],431:[function(t,e,r){"use strict";e.exports=function(t){return"string"==typeof t&&(t=t.trim(),!!(/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(t)&&/[\dz]$/i.test(t)&&t.length>4))}},{}],432:[function(t,e,r){e.exports=function(t,e,r){return t*(1-r)+e*r}},{}],433:[function(t,e,r){!function(t,n){"object"==typeof r&&"undefined"!=typeof e?e.exports=n():(t=t||self).mapboxgl=n()}(this,(function(){"use strict";var t,e,r;function n(n,i){if(t)if(e){var a="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",o={};t(o),(r=i(o)).workerUrl=window.URL.createObjectURL(new Blob([a],{type:"text/javascript"}))}else e=i;else t=i}return n(0,(function(t){function e(t,e){return t(e={exports:{}},e.exports),e.exports}var r=n;function n(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=r,this.p2y=n}n.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},n.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},n.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},n.prototype.solveCurveX=function(t,e){var r,n,i,a,o;for(void 0===e&&(e=1e-6),i=t,o=0;o<8;o++){if(a=this.sampleCurveX(i)-t,Math.abs(a)<e)return i;var s=this.sampleCurveDerivativeX(i);if(Math.abs(s)<1e-6)break;i-=a/s}if((i=t)<(r=0))return r;if(i>(n=1))return n;for(;r<n;){if(a=this.sampleCurveX(i),Math.abs(a-t)<e)return i;t>a?r=i:n=i,i=.5*(n-r)+r}return i},n.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var i=a;function a(t,e){this.x=t,this.y=e}function o(t,e,n,i){var a=new r(t,e,n,i);return function(t){return a.solve(t)}}a.prototype={clone:function(){return new a(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},a.convert=function(t){return t instanceof a?t:Array.isArray(t)?new a(t[0],t[1]):t};var s=o(.25,.1,.25,1);function l(t,e,r){return Math.min(r,Math.max(e,t))}function c(t,e,r){var n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function u(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n<i.length;n+=1){var a=i[n];for(var o in a)t[o]=a[o]}return t}var f=1;function h(){return f++}function p(){return function t(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function d(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function m(t,e){t.forEach((function(t){e[t]&&(e[t]=e[t].bind(e))}))}function g(t,e){return-1!==t.indexOf(e,t.length-e.length)}function v(t,e,r){var n={};for(var i in t)n[i]=e.call(r||this,t[i],i,t);return n}function y(t,e,r){var n={};for(var i in t)e.call(r||this,t[i],i,t)&&(n[i]=t[i]);return n}function x(t){return Array.isArray(t)?t.map(x):"object"==typeof t&&t?v(t,x):t}var b={};function _(t){b[t]||("undefined"!=typeof console&&console.warn(t),b[t]=!0)}function w(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function T(t){for(var e=0,r=0,n=t.length,i=n-1,a=void 0,o=void 0;r<n;i=r++)e+=((o=t[i]).x-(a=t[r]).x)*(a.y+o.y);return e}function M(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function k(t){var e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(function(t,r,n,i){var a=n||i;return e[r]=!a||a.toLowerCase(),""})),e["max-age"]){var r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}var A=null;function S(t){if(null==A){var e=t.navigator?t.navigator.userAgent:null;A=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return A}function E(t){try{var e=self[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return!1}}var C,L,P,I,O=self.performance&&self.performance.now?self.performance.now.bind(self.performance):Date.now.bind(Date),z=self.requestAnimationFrame||self.mozRequestAnimationFrame||self.webkitRequestAnimationFrame||self.msRequestAnimationFrame,D=self.cancelAnimationFrame||self.mozCancelAnimationFrame||self.webkitCancelAnimationFrame||self.msCancelAnimationFrame,N={now:O,frame:function(t){var e=z(t);return{cancel:function(){return D(e)}}},getImageData:function(t,e){void 0===e&&(e=0);var r=self.document.createElement("canvas"),n=r.getContext("2d");if(!n)throw new Error("failed to create canvas 2d context");return r.width=t.width,r.height=t.height,n.drawImage(t,0,0,t.width,t.height),n.getImageData(-e,-e,t.width+2*e,t.height+2*e)},resolveURL:function(t){return C||(C=self.document.createElement("a")),C.href=t,C.href},hardwareConcurrency:self.navigator.hardwareConcurrency||4,get devicePixelRatio(){return self.devicePixelRatio},get prefersReducedMotion(){return!!self.matchMedia&&(null==L&&(L=self.matchMedia("(prefers-reduced-motion: reduce)")),L.matches)}},R={API_URL:"https://api.mapbox.com",get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},FEEDBACK_URL:"https://apps.mapbox.com/feedback",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},F={supported:!1,testSupport:function(t){!B&&I&&(j?U(t):P=t)}},B=!1,j=!1;function U(t){var e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,I),t.isContextLost())return;F.supported=!0}catch(t){}t.deleteTexture(e),B=!0}self.document&&((I=self.document.createElement("img")).onload=function(){P&&U(P),P=null,j=!0},I.onerror=function(){B=!0,P=null},I.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var V="01",q=function(t,e){this._transformRequestFn=t,this._customAccessToken=e,this._createSkuToken()};function H(t){return 0===t.indexOf("mapbox:")}q.prototype._createSkuToken=function(){var t=function(){for(var t="",e=0;e<10;e++)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",V,t].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt},q.prototype._isSkuTokenExpired=function(){return Date.now()>this._skuTokenExpiresAt},q.prototype.transformRequest=function(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}},q.prototype.normalizeStyleURL=function(t,e){if(!H(t))return t;var r=Z(t);return r.path="/styles/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},q.prototype.normalizeGlyphsURL=function(t,e){if(!H(t))return t;var r=Z(t);return r.path="/fonts/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},q.prototype.normalizeSourceURL=function(t,e){if(!H(t))return t;var r=Z(t);return r.path="/v4/"+r.authority+".json",r.params.push("secure"),this._makeAPIURL(r,this._customAccessToken||e)},q.prototype.normalizeSpriteURL=function(t,e,r,n){var i=Z(t);return H(t)?(i.path="/styles/v1"+i.path+"/sprite"+e+r,this._makeAPIURL(i,this._customAccessToken||n)):(i.path+=""+e+r,X(i))},q.prototype.normalizeTileURL=function(t,e){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!H(t))return t;var r=Z(t);r.path=r.path.replace(/(\.(png|jpg)\d*)(?=$)/,(N.devicePixelRatio>=2||512===e?"@2x":"")+(F.supported?".webp":"$1")),r.path=r.path.replace(/^.+\/v4\//,"/"),r.path="/v4"+r.path;var n=this._customAccessToken||function(t){for(var e=0,r=t;e<r.length;e+=1){var n=r[e].match(/^access_token=(.*)$/);if(n)return n[1]}return null}(r.params)||R.ACCESS_TOKEN;return R.REQUIRE_ACCESS_TOKEN&&n&&this._skuToken&&r.params.push("sku="+this._skuToken),this._makeAPIURL(r,n)},q.prototype.canonicalizeTileURL=function(t,e){var r=Z(t);if(!r.path.match(/(^\/v4\/)/)||!r.path.match(/\.[\w]+$/))return t;var n="mapbox://tiles/";n+=r.path.replace("/v4/","");var i=r.params;return e&&(i=i.filter((function(t){return!t.match(/^access_token=/)}))),i.length&&(n+="?"+i.join("&")),n},q.prototype.canonicalizeTileset=function(t,e){for(var r=!!e&&H(e),n=[],i=0,a=t.tiles||[];i<a.length;i+=1){var o=a[i];Y(o)?n.push(this.canonicalizeTileURL(o,r)):n.push(o)}return n},q.prototype._makeAPIURL=function(t,e){var r="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",n=Z(R.API_URL);if(t.protocol=n.protocol,t.authority=n.authority,"/"!==n.path&&(t.path=""+n.path+t.path),!R.REQUIRE_ACCESS_TOKEN)return X(t);if(!(e=e||R.ACCESS_TOKEN))throw new Error("An API access token is required to use Mapbox GL. "+r);if("s"===e[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+r);return t.params=t.params.filter((function(t){return-1===t.indexOf("access_token")})),t.params.push("access_token="+e),X(t)};var G=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;function Y(t){return G.test(t)}var W=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Z(t){var e=t.match(W);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function X(t){var e=t.params.length?"?"+t.params.join("&"):"";return t.protocol+"://"+t.authority+t.path+e}function J(t){if(!t)return null;var e=t.split(".");if(!e||3!==e.length)return null;try{return JSON.parse(decodeURIComponent(self.atob(e[1]).split("").map((function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)})).join("")))}catch(t){return null}}var K=function(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null};K.prototype.getStorageKey=function(t){var e,r=J(R.ACCESS_TOKEN);return e=r&&r.u?self.btoa(encodeURIComponent(r.u).replace(/%([0-9A-F]{2})/g,(function(t,e){return String.fromCharCode(Number("0x"+e))}))):R.ACCESS_TOKEN||"",t?"mapbox.eventData."+t+":"+e:"mapbox.eventData:"+e},K.prototype.fetchEventData=function(){var t=E("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{var n=self.localStorage.getItem(e);n&&(this.eventData=JSON.parse(n));var i=self.localStorage.getItem(r);i&&(this.anonId=i)}catch(t){_("Unable to read from LocalStorage")}},K.prototype.saveEventData=function(){var t=E("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{self.localStorage.setItem(r,this.anonId),Object.keys(this.eventData).length>=1&&self.localStorage.setItem(e,JSON.stringify(this.eventData))}catch(t){_("Unable to write to LocalStorage")}},K.prototype.processRequests=function(t){},K.prototype.postEvent=function(t,e,r,n){var i=this;if(R.EVENTS_URL){var a=Z(R.EVENTS_URL);a.params.push("access_token="+(n||R.ACCESS_TOKEN||""));var o={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"1.10.1",skuId:V,userId:this.anonId},s=e?u(o,e):o,l={url:X(a),headers:{"Content-Type":"text/plain"},body:JSON.stringify([s])};this.pendingRequest=xt(l,(function(t){i.pendingRequest=null,r(t),i.saveEventData(),i.processRequests(n)}))}},K.prototype.queueRequest=function(t,e){this.queue.push(t),this.processRequests(e)};var $,Q,tt=function(t){function e(){t.call(this,"map.load"),this.success={},this.skuToken=""}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postMapLoadEvent=function(t,e,r,n){this.skuToken=r,(R.EVENTS_URL&&n||R.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return H(t)||Y(t)})))&&this.queueRequest({id:e,timestamp:Date.now()},n)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){var r=this.queue.shift(),n=r.id,i=r.timestamp;n&&this.success[n]||(this.anonId||this.fetchEventData(),d(this.anonId)||(this.anonId=p()),this.postEvent(i,{skuToken:this.skuToken},(function(t){t||n&&(e.success[n]=!0)}),t))}},e}(K),et=new(function(t){function e(e){t.call(this,"appUserTurnstile"),this._customAccessToken=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postTurnstileEvent=function(t,e){R.EVENTS_URL&&R.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return H(t)||Y(t)}))&&this.queueRequest(Date.now(),e)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();var r=J(R.ACCESS_TOKEN),n=r?r.u:R.ACCESS_TOKEN,i=n!==this.eventData.tokenU;d(this.anonId)||(this.anonId=p(),i=!0);var a=this.queue.shift();if(this.eventData.lastSuccess){var o=new Date(this.eventData.lastSuccess),s=new Date(a),l=(a-this.eventData.lastSuccess)/864e5;i=i||l>=1||l<-1||o.getDate()!==s.getDate()}else i=!0;if(!i)return this.processRequests();this.postEvent(a,{"enabled.telemetry":!1},(function(t){t||(e.eventData.lastSuccess=a,e.eventData.tokenU=n)}),t)}},e}(K)),rt=et.postTurnstileEvent.bind(et),nt=new tt,it=nt.postMapLoadEvent.bind(nt),at=500,ot=50;function st(){self.caches&&!$&&($=self.caches.open("mapbox-tiles"))}function lt(t){var e=t.indexOf("?");return e<0?t:t.slice(0,e)}var ct,ut=1/0;function ft(){return null==ct&&(ct=self.OffscreenCanvas&&new self.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),ct}var ht={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(ht);var pt,dt,mt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment